From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 00:10:22 2014 Return-Path: Delivered-To: svn-src-all@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 F2AD870C; Sun, 27 Jul 2014 00:10:21 +0000 (UTC) Received: from mail-qa0-x232.google.com (mail-qa0-x232.google.com [IPv6:2607:f8b0:400d:c00::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 928AD2F5C; Sun, 27 Jul 2014 00:10:21 +0000 (UTC) Received: by mail-qa0-f50.google.com with SMTP id s7so6171963qap.9 for ; Sat, 26 Jul 2014 17:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=OnYDB6Co4eQHLtTzsuAFsA4ZULUTYI2si9W2xwnvpBM=; b=reLNExvmkv2fPVot5lQ620Ao7ap6lOYD1POCB0ovxScaw4tDHYhDOQkR5ee9jc4IKn 75RBY9x7H48vfP09HeOVz2feuhqyBDS7178waZvgfJ8VLfTSmY5eVDwkoy4CbJc8hOjO gb085pEOT3THkyWW4Bo2qcRQ56BuVTS/Vt/b6Vkra7r+ytIV7OxbMsChfOyvqpTBeDGV JG8E02zfw+abFgKqDu3OXoKL9l+gT9NVhHNDVlh5Jgl7+DWHsNMqQoRqOM6kdRV1iigv 6ZI7VTgVQ8UuMURCcTJuIpUj7xwCV6sYCXOBEO1Zva/kyMhHZr3BdwXbGuphCIIM4rei F8kg== MIME-Version: 1.0 X-Received: by 10.224.55.131 with SMTP id u3mr42732357qag.98.1406419820227; Sat, 26 Jul 2014 17:10:20 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sat, 26 Jul 2014 17:10:20 -0700 (PDT) In-Reply-To: <53D3FDEC.5040000@selasky.org> References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> Date: Sat, 26 Jul 2014 17:10:20 -0700 X-Google-Sender-Auth: eDlPFzHXRIuFocUxuC70PGqTNME Message-ID: Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 00:10:22 -0000 On 26 July 2014 12:13, Hans Petter Selasky wrote: > On 07/26/14 20:36, Adrian Chadd wrote: >> >> Hi, >> >> We should likely review how the PLCP bits are being used and why it's >> getting a rate of 0 in the first place. >> >> So, why's it getting a rate of 0 passed into the transmit path? >> >> > > Hi Adrian, > > Here is the backtrace of the panic: > > Fatal trap 18: integer divide fault while in kernel mode > cpuid = 2; apic id = 02 > instruction pointer = 0x20:0xffffffff807826cf > stack pointer = 0x28:0xffffff8000305090 > frame pointer = 0x28:0xffffff80003050a0 > code segment = base 0x0, limit 0xfffff, type 0x1b > = DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags = interrupt enabled, resume, IOPL = 0 > current process = 15 (usbus0) > trap number = 18 > panic: integer divide fault > cpuid = 2 > KDB: stack backtrace: > #0 0xffffffff809257e6 at kdb_backtrace+0x66 > #1 0xffffffff808eb3ae at panic+0x1ce > #2 0xffffffff80cd2c30 at trap_fatal+0x290 > #3 0xffffffff80cd3480 at trap+0x250 > #4 0xffffffff80cbc783 at calltrap+0x8 > #5 0xffffffff80783d90 at ural_start+0x1d0 > #6 0xffffffff809aa2ea at if_transmit+0xea > #7 0xffffffff809ef7b2 at ieee80211_start+0x542 > #8 0xffffffff809aa2ea at if_transmit+0xea > #9 0xffffffff809ae8b3 at ether_output_frame+0x33 > #10 0xffffffff809aee30 at ether_output+0x530 > #11 0xffffffff80a186b4 at ip_output+0xd74 > #12 0xffffffff80a87d2a at tcp_output+0xfea > #13 0xffffffff80a82222 at tcp_do_segment+0xc02 > #14 0xffffffff80a85219 at tcp_input+0xa29 > #15 0xffffffff80a155fa at ip_input+0xaa > #16 0xffffffff809b7808 at netisr_dispatch_src+0x218 > #17 0xffffffff809ae3fd at ether_demux+0x14d Hm, so at some point that rate was not assigned to something. Can you trace the ural_start path to see where it's supposed to be calculating the rate? -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 05:44:43 2014 Return-Path: Delivered-To: svn-src-all@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 5D26C515; Sun, 27 Jul 2014 05:44:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A96F27DA; Sun, 27 Jul 2014 05:44:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R5ih8P000940; Sun, 27 Jul 2014 05:44:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6R5ihsl000938; Sun, 27 Jul 2014 05:44:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201407270544.s6R5ihsl000938@svn.freebsd.org> From: Adrian Chadd Date: Sun, 27 Jul 2014 05:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269148 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 05:44:43 -0000 Author: adrian Date: Sun Jul 27 05:44:42 2014 New Revision: 269148 URL: http://svnweb.freebsd.org/changeset/base/269148 Log: Commit some sins in the name of "oh god oh god I don't really want to be able to claim I know how the UART code works." * Just return 115200 as the current baud rate. I should cache it in the device struct and return that but I'm lazy right now. * don't error out on other ioctl settings for now, just silently ignore them. * remove some code that was copied from the 8250 driver that isn't needed any longer. Tested: * AR9331, Carambola-2 board. Modified: head/sys/mips/atheros/uart_dev_ar933x.c Modified: head/sys/mips/atheros/uart_dev_ar933x.c ============================================================================== --- head/sys/mips/atheros/uart_dev_ar933x.c Sat Jul 26 21:33:17 2014 (r269147) +++ head/sys/mips/atheros/uart_dev_ar933x.c Sun Jul 27 05:44:42 2014 (r269148) @@ -428,8 +428,6 @@ ar933x_bus_getsig(struct uart_softc *sc) /* * For now, let's just return that DSR/DCD/CTS is asserted. - * - * XXX TODO: actually verify whether this is correct! */ SIGCHG(1, sig, SER_DSR, SER_DDSR); SIGCHG(1, sig, SER_CTS, SER_DCTS); @@ -441,80 +439,31 @@ ar933x_bus_getsig(struct uart_softc *sc) return (sig); } +/* + * XXX TODO: actually implement the rest of this! + */ static int ar933x_bus_ioctl(struct uart_softc *sc, int request, intptr_t data) { -#if 0 - struct uart_bas *bas; - int baudrate, divisor, error; - uint8_t efr, lcr; + int error = 0; - bas = &sc->sc_bas; - error = 0; - uart_lock(sc->sc_hwmtx); + /* XXX lock */ switch (request) { case UART_IOCTL_BREAK: - lcr = uart_getreg(bas, REG_LCR); - if (data) - lcr |= LCR_SBREAK; - else - lcr &= ~LCR_SBREAK; - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - break; case UART_IOCTL_IFLOW: - lcr = uart_getreg(bas, REG_LCR); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, 0xbf); - uart_barrier(bas); - efr = uart_getreg(bas, REG_EFR); - if (data) - efr |= EFR_RTS; - else - efr &= ~EFR_RTS; - uart_setreg(bas, REG_EFR, efr); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - break; case UART_IOCTL_OFLOW: - lcr = uart_getreg(bas, REG_LCR); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, 0xbf); - uart_barrier(bas); - efr = uart_getreg(bas, REG_EFR); - if (data) - efr |= EFR_CTS; - else - efr &= ~EFR_CTS; - uart_setreg(bas, REG_EFR, efr); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); break; case UART_IOCTL_BAUD: - lcr = uart_getreg(bas, REG_LCR); - uart_setreg(bas, REG_LCR, lcr | LCR_DLAB); - uart_barrier(bas); - divisor = uart_getreg(bas, REG_DLL) | - (uart_getreg(bas, REG_DLH) << 8); - uart_barrier(bas); - uart_setreg(bas, REG_LCR, lcr); - uart_barrier(bas); - baudrate = (divisor > 0) ? bas->rclk / divisor / 16 : 0; - if (baudrate > 0) - *(int*)data = baudrate; - else - error = ENXIO; + *(int*)data = 115200; break; default: error = EINVAL; break; } - uart_unlock(sc->sc_hwmtx); + + /* XXX unlock */ + return (error); -#endif - return (ENXIO); } /* @@ -581,6 +530,8 @@ ar933x_bus_ipend(struct uart_softc *sc) /* * Only signal TX idle if we're not busy transmitting. + * + * XXX I never get _out_ of txbusy? Debug that! */ if (sc->sc_txbusy) { if (isr & AR933X_UART_INT_TX_EMPTY) { From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 06:49:55 2014 Return-Path: Delivered-To: svn-src-all@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 C763FFD9; Sun, 27 Jul 2014 06:49: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A88022BF8; Sun, 27 Jul 2014 06:49:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R6ntQj021629; Sun, 27 Jul 2014 06:49:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6R6ntKa021628; Sun, 27 Jul 2014 06:49:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407270649.s6R6ntKa021628@svn.freebsd.org> From: Alexander Motin Date: Sun, 27 Jul 2014 06:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269149 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 06:49:56 -0000 Author: mav Date: Sun Jul 27 06:49:55 2014 New Revision: 269149 URL: http://svnweb.freebsd.org/changeset/base/269149 Log: Fix several cases of NULL dereference when INQUIRY sent to absent LUN. MFC after: 3 days Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Jul 27 05:44:42 2014 (r269148) +++ head/sys/cam/ctl/ctl.c Sun Jul 27 06:49:55 2014 (r269149) @@ -10024,7 +10024,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; - if (ctl_map_lun_back(port->targ_port, lun->lun) >= + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= CTL_MAX_LUNS) continue; num_target_ports++; @@ -10080,7 +10081,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; - if (ctl_map_lun_back(port->targ_port, lun->lun) >= + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= CTL_MAX_LUNS) continue; p = port->targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS; @@ -10123,7 +10125,6 @@ ctl_inquiry_evpd_block_limits(struct ctl int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; @@ -10157,10 +10158,13 @@ ctl_inquiry_evpd_block_limits(struct ctl scsi_ulto2b(sizeof(*bl_ptr), bl_ptr->page_length); bl_ptr->max_cmp_write_len = 0xff; scsi_ulto4b(0xffffffff, bl_ptr->max_txfer_len); - scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + if (lun != NULL) { + bs = lun->be_lun->blocksize; + scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); + if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + } } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); @@ -10177,10 +10181,8 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * { struct scsi_vpd_logical_block_prov *lbp_ptr; struct ctl_lun *lun; - int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; @@ -10211,7 +10213,7 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * lbp_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; lbp_ptr->page_code = SVPD_LBP; - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) + if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | SVPD_LBP_WS10; ctsio->scsi_status = SCSI_STATUS_OK; From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 07:11:18 2014 Return-Path: Delivered-To: svn-src-all@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 B7907453; Sun, 27 Jul 2014 07:11:18 +0000 (UTC) Received: from mail-pd0-x22f.google.com (mail-pd0-x22f.google.com [IPv6:2607:f8b0:400e:c02::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80EF42DD1; Sun, 27 Jul 2014 07:11:18 +0000 (UTC) Received: by mail-pd0-f175.google.com with SMTP id r10so7996953pdi.34 for ; Sun, 27 Jul 2014 00:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=af22jETQiX843co+zeUsY+Jzd4tyNUUehAFXJzOHtGU=; b=t/qLTif7lsJcpcmMivozV7aNxDDgWGS+7wPoKFyxQw2yteQjGrO14fIaCol94nbZEF lmj89QWmGXvps9i60YdiSWHwYSs+qUENucPj3Ltq3TujHBPOh4vyRybrQhYett253cTZ WmYqt4Yy6Mmand1MyZJHm8l6slbRhgU6X4QFm8RHa2gwc6soV3e2umpoA+rRF5nR3ora 2BTDP4LpNVDbwoybT3XVXeFxE6JqUPtW36NVTYwZnudK7AYrXgb65VTlwjG8IoN/2bIm Tsip/ORRegY5mly6c1YB0OJ3MNXcaP6UcumFstoRkiWJqXFXH1M+vaWV4vV/6fYzbn6r HvYA== X-Received: by 10.68.173.65 with SMTP id bi1mr560501pbc.130.1406445077582; Sun, 27 Jul 2014 00:11:17 -0700 (PDT) Received: from ox ([24.6.44.228]) by mx.google.com with ESMTPSA id k9sm18498701pdo.28.2014.07.27.00.11.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 27 Jul 2014 00:11:17 -0700 (PDT) Sender: Navdeep Parhar Date: Sun, 27 Jul 2014 00:11:12 -0700 From: Navdeep Parhar To: Konstantin Belousov Subject: Re: svn commit: r269106 - head/tools/tools/cxgbetool Message-ID: <20140727071112.GA14128@ox> Mail-Followup-To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201407260051.s6Q0pjNO077573@svn.freebsd.org> <20140726182607.GG93733@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140726182607.GG93733@kib.kiev.ua> 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 07:11:18 -0000 On Sat, Jul 26, 2014 at 09:26:07PM +0300, Konstantin Belousov wrote: > On Sat, Jul 26, 2014 at 12:51:45AM +0000, Navdeep Parhar wrote: > > Author: np > > Date: Sat Jul 26 00:51:45 2014 > > New Revision: 269106 > > URL: http://svnweb.freebsd.org/changeset/base/269106 > > > > Log: > > Add a 'raw' parameter to the 'modinfo' subcommand. This is handy when > > trying to figure out why a QSFP+/SFP+ connector or cable wasn't > > identified correctly by cxgbe(4). Its output looks like this: > > > > # cxgbetool t5nex0 modinfo 0 raw > > 00: 03 04 21 00 00 00 00 00 ..!. .... > > 08: 04 00 00 00 67 00 00 00 .... g... > > 10: 00 00 05 00 41 6d 70 68 .... Amph > > 18: 65 6e 6f 6c 20 20 20 20 enol > > 20: 20 20 20 20 00 41 50 48 .APH > > 28: 35 37 31 35 34 30 30 30 5715 4000 > > 30: 33 20 20 20 20 20 20 20 3 > > 38: 4b 20 20 20 01 00 00 fa K .... > > 40: 00 00 00 00 41 50 46 31 .... APF1 > > 48: 30 30 34 30 30 33 30 30 0040 0300 > > 50: 30 33 20 20 31 30 30 31 03 1001 > > 58: 33 30 20 20 00 00 00 97 30 .... > > > > MFC after: 3 days > > > > Modified: > > head/tools/tools/cxgbetool/cxgbetool.c > > I do not remember if this question was already asked. > > Why cxgbetool lives in tools and not installed into /usr/sbin as > cxgbecontrol(8) ? cxgbetool was originally meant to be just a debug tool, not something that would be of interest to most users (not even those using cxgbe). But once written, it offered an easy way to interface with the driver and chip, and so it gradually grew a number of commands for features for which there is no system CLI (packet filtering/steering, QoS-ish stuff, packet sniffing, pluggable optics/copper modules, etc.). In its current state I think it fits in tools/tools or usr/sbin equally well. Moving it to usr/sbin will force the issue of a manpage -- I have one that has been 80% complete for 2 years now :-( Regards, Navdeep From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:02:24 2014 Return-Path: Delivered-To: svn-src-all@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 97A03F53; Sun, 27 Jul 2014 08:02:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 848EA2150; Sun, 27 Jul 2014 08:02:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R82OTP055048; Sun, 27 Jul 2014 08:02:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6R82Olf055047; Sun, 27 Jul 2014 08:02:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407270802.s6R82Olf055047@svn.freebsd.org> From: Alexander Motin Date: Sun, 27 Jul 2014 08:02:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269151 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:02:24 -0000 Author: mav Date: Sun Jul 27 08:02:24 2014 New Revision: 269151 URL: http://svnweb.freebsd.org/changeset/base/269151 Log: MFC r269058: Fix build with QUEUE_MACRO_DEBUG. Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Sun Jul 27 07:07:12 2014 (r269150) +++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Sun Jul 27 08:02:24 2014 (r269151) @@ -815,7 +815,7 @@ ctl_backend_ramdisk_lun_shutdown(void *b if (lun->flags & CTL_BE_RAMDISK_LUN_WAITING) { wakeup(lun); } else { - STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_ramdisk_lun, + STAILQ_REMOVE(&softc->lun_list, lun, ctl_be_ramdisk_lun, links); softc->num_luns--; do_free = 1; From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:20:33 2014 Return-Path: Delivered-To: svn-src-all@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 AF71374C; Sun, 27 Jul 2014 08:20:33 +0000 (UTC) Received: from mail-qa0-x22d.google.com (mail-qa0-x22d.google.com [IPv6:2607:f8b0:400d:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CEB822D4; Sun, 27 Jul 2014 08:20:33 +0000 (UTC) Received: by mail-qa0-f45.google.com with SMTP id cm18so6433136qab.18 for ; Sun, 27 Jul 2014 01:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=26p8CqPZwpuTK3vNY3BAqqULoDhpOJv071vOJr439aw=; b=hybjh+J5HKWYMQkzoyE/5D/Fmw+aYo5EpNhER8zyZACidxaJNz6El2ZnWM4ySmggcb uunfslf9zYGpJOoWlXA5ooUNCmrmC8bKlYrQ24t8qp26qeFdOjWxZh7YrkFVG9ksv7jn 5YwLfqnvdDwJGjQQUnBxvtXg2s89ZmSBU9QwWqB9t5rnMw/j3fEBhfMVOBpPxetPCupw KW9hZaX1mnU+HHsQaRSPowLA5JqrO2Et0QqZHSrg16EqjbAVAysNCmDzVDPXWGMKbgGZ k/Xdj416vQKfUXTKBkJNEvrgk5U1+8YRrrnnxL9OLpq84W30qVK4jZS1tgK9zhzdYoR3 7MvA== MIME-Version: 1.0 X-Received: by 10.224.112.1 with SMTP id u1mr44500148qap.7.1406449231821; Sun, 27 Jul 2014 01:20:31 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:20:31 -0700 (PDT) In-Reply-To: <53C335EF.2090606@FreeBSD.org> References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> Date: Sun, 27 Jul 2014 01:20:31 -0700 X-Google-Sender-Auth: gAcSBRm7vdPxtwg6lVul3VBClX4 Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:20:33 -0000 Hi! ok, so how do I figure out what the right patch should be? pcm0: at nid 22 and 24 on hdaa0 pcm1: at nid 26 and 29 on hdaa0 .. and hdac0@pci0:0:27:0: class=0x040300 card=0x20f217aa chip=0x293e8086 rev=0x03 hdr=0x00 -a On 13 July 2014 18:44, Alexander Motin wrote: > On 13.07.2014 21:50, Adrian Chadd wrote: >> So I have an X230 and a T400 - both require fiddling of the default >> sound unit sysctl when I want to use headphones. >> >> Does this above patch outline what I need to do to get it working dynamically? > > As a quick and easy solution -- quite likely yes. > > Proper general solution for all of those laptops, and not only, would be > to rewrite the concept of default unit in sound(4) to allow it be > switched during playback/record, and separately for playback/record > paths. HDA driver is already able to provide all information about > connected devices, number of their channels, etc, but there is just > nothing above it to use that information. :( > >> On 13 July 2014 03:31, Mark Johnston wrote: >>> Author: markj >>> Date: Sun Jul 13 10:31:29 2014 >>> New Revision: 268584 >>> URL: http://svnweb.freebsd.org/changeset/base/268584 >>> >>> Log: >>> Add a headphone redirection quirk for the Lenovo G580. >>> >>> MFC after: 1 week >>> >>> Modified: >>> head/sys/dev/sound/pci/hda/hdaa_patches.c >>> head/sys/dev/sound/pci/hda/hdac.h >>> >>> Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c >>> ============================================================================== >>> --- head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 13 09:34:59 2014 (r268583) >>> +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 13 10:31:29 2014 (r268584) >>> @@ -350,7 +350,8 @@ hdac_pin_patch(struct hdaa_widget *w) >>> (subid == LENOVO_X1_SUBVENDOR || >>> subid == LENOVO_X220_SUBVENDOR || >>> subid == LENOVO_T420_SUBVENDOR || >>> - subid == LENOVO_T520_SUBVENDOR)) { >>> + subid == LENOVO_T520_SUBVENDOR || >>> + subid == LENOVO_G580_SUBVENDOR)) { >>> switch (nid) { >>> case 25: >>> patch = "as=1 seq=15"; >>> >>> Modified: head/sys/dev/sound/pci/hda/hdac.h >>> ============================================================================== >>> --- head/sys/dev/sound/pci/hda/hdac.h Sun Jul 13 09:34:59 2014 (r268583) >>> +++ head/sys/dev/sound/pci/hda/hdac.h Sun Jul 13 10:31:29 2014 (r268584) >>> @@ -241,6 +241,7 @@ >>> #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) >>> #define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) >>> #define LENOVO_T530_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f6) >>> +#define LENOVO_G580_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3977) >>> #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) >>> >>> /* Samsung */ >>> >> > > > -- > Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:24:09 2014 Return-Path: Delivered-To: svn-src-all@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 01D0797C; Sun, 27 Jul 2014 08:24:09 +0000 (UTC) Received: from mail-qa0-x230.google.com (mail-qa0-x230.google.com [IPv6:2607:f8b0:400d:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72FB922E9; Sun, 27 Jul 2014 08:24:08 +0000 (UTC) Received: by mail-qa0-f48.google.com with SMTP id m5so6459720qaj.35 for ; Sun, 27 Jul 2014 01:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=6zmirTbDizS0iXYdPdvrmMswYYiEnglSB0ZT9fVQVMU=; b=TSpW26pyukSbIqyQ/p85br/CsT3dtlrXiltFpCCuNtIFRfz9/qAljTvtq8L1rmsGbe ProiVFmcOrVH/gTfIwlu/iqXnJdKcYdOyeEoj1oM6fnIoDp8uaM1DL9/IV/jYYVti27D 1CwyL6a4vAMoolcVGv4n3MYDvnhTJ+qpzPubLyutNvPymqvfmBhg8WleAlRDokiYvkYm D5+GgS0ILSbadwXZpaxAoobUDSMLkQhFq1K7LCzVRoXk/cYImBWUZ4EOJQAYfXk2ehhU cH5SjhJdgTo03Dm8NdYWcjvBwtTbr/X1+QIgkb4AgS4enACnK58Qb4CqYKy/0TkSmbNO JfTQ== MIME-Version: 1.0 X-Received: by 10.224.156.145 with SMTP id x17mr45282136qaw.49.1406449447607; Sun, 27 Jul 2014 01:24:07 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:24:07 -0700 (PDT) In-Reply-To: References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> Date: Sun, 27 Jul 2014 01:24:07 -0700 X-Google-Sender-Auth: UayLIKindCAGlpsK0alpeZk7FZ0 Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:24:09 -0000 Oh, and: pci0:21:0:1: reprobing on driver added hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 hdaa0: Subsystem ID: 0x17aa211c hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1 hdaa0: GPIO0: disabled hdaa0: GPIO1: disabled hdaa0: GPIO2: disabled hdaa0: GPIO3: disabled hdaa0: Original pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=22 hdaa0: Patching pin config nid=22 0x022140f0 -> 0x0221401f hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=23 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=24 hdaa0: Patching pin config nid=24 0x02a190f0 -> 0x02a1901f hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=25 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=26 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=27 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=28 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=29 hdaa0: Patched pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 0221401f 1 15 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA hdaa0: 24 02a1901f 1 15 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdaa0: hdaa_audio_as_parse: Duplicate pin 15 (24) in association 1! Disabling association. hdaa0: hdaa_audio_as_parse: Pin 24 has wrong direction for association 1! Disabling association. hdaa0: 3 associations found: hdaa0: Association 0 (1) out (disabled): hdaa0: Pin nid=24 seq=15 hdaa0: Association 1 (15) out: hdaa0: Pin nid=26 seq=0 hdaa0: Association 2 (15) in: hdaa0: Pin nid=29 seq=0 hdaa0: Tracing association 1 (15) hdaa0: Pin 26 traced to DAC 16 hdaa0: Association 1 (15) trace succeeded hdaa0: Tracing association 2 (15) hdaa0: Pin 29 traced to ADC 20 hdaa0: Association 2 (15) trace succeeded hdaa0: Looking for additional DAC for association 1 (15) hdaa0: Looking for additional ADC for association 2 (15) hdaa0: Tracing input monitor hdaa0: Tracing other input monitors hdaa0: Tracing nid 29 to out hdaa0: Tracing beeper hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref pcm0: at nid 26 and 29 on hdaa0 pcm0: Playback: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm0: DAC: 16 pcm0: pcm0: nid=26 [pin: Speaker (Fixed)] pcm0: + <- nid=16 [audio output] [src: pcm] pcm0: pcm0: Record: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0160 16 20 24 bits, 44 48 96 KHz pcm0: ADC: 20 pcm0: pcm0: nid=20 [audio input] pcm0: + <- nid=29 [pin: Mic (Fixed)] [src: monitor] pcm0: pcm0: Master Volume (OSS: vol): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: PCM Volume (OSS: pcm): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: Microphone2 Volume (OSS: monitor): 0/48dB pcm0: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm0: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm0: pcm0: Speaker/Beep Volume (OSS: speaker): -18/0dB pcm0: +- ctl 3 (nid 19 out): -18/0dB (4 steps) pcm0: pcm0: Recording Level (OSS: rec): -74/6dB pcm0: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm0: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm0: pcm0: Mixer "vol": pcm0: Mixer "pcm": pcm0: Mixer "speaker": pcm0: Mixer "rec": pcm0: Mixer "ogain": pcm0: Mixer "monitor": pcm0: Playback channel set is: Front Left, Front Right, pcm0: Playback channel matrix is: 2.0 (unknown) pcm0: Automatically set rec source to: monitor pcm0: Recording channel set is: Front Left, Front Right, pcm0: Recording channel matrix is: 2.0 (unknown) unknown: at nid 2 on hdacc0 (no driver attached) hdacc0: Subsystem ID: 0xc536484c -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:27:26 2014 Return-Path: Delivered-To: svn-src-all@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 84B90BCB; Sun, 27 Jul 2014 08:27:26 +0000 (UTC) Received: from mail-qg0-x22a.google.com (mail-qg0-x22a.google.com [IPv6:2607:f8b0:400d:c04::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0041D2301; Sun, 27 Jul 2014 08:27:25 +0000 (UTC) Received: by mail-qg0-f42.google.com with SMTP id j5so6986056qga.15 for ; Sun, 27 Jul 2014 01:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ZBuqx1lM5AyA4oj/psCNWopiS87Mfc8ysyRI6ywmfIs=; b=hFSeUkTqRNWhhoyOSIrqJHRig8Q2Yru9pNoDZIOZJAidI60Pira3N80DKwfEHnRUit 4Js4z4ewK8VqH18otf1vZKcwPeeMwB1+qL/6wtc0iokTP8YAg+YUy4Syha9dytQuAh/r c82spz8cxwew6dJxrPilThWnznqrI/cJUD9aEngXkBQ1fV00JiEUpnhYpHO6iIRXDIQq bskLR45d8HKPmZ+cI1Qm9r859xZzBIszFxeOrdhL6Ug6EmOThREJFOPIb/NeUvUeu4Ps PIqczfeHPo9ystML3pcIaPh1z82eNc119Z3ZRh0vnsd4PDtKN7e2iJ007e0WVSaUgIJ4 7QQg== MIME-Version: 1.0 X-Received: by 10.140.107.4 with SMTP id g4mr33046315qgf.100.1406449644862; Sun, 27 Jul 2014 01:27:24 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:27:24 -0700 (PDT) In-Reply-To: References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> Date: Sun, 27 Jul 2014 01:27:24 -0700 X-Google-Sender-Auth: zhoc9vKcRX7L_yD_PyH2WdSBG7Q Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:27:26 -0000 actually, scratch that, I had some test hacks in there. Try: pci0:21:0:1: reprobing on driver added hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 hdaa0: Subsystem ID: 0x17aa211c hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1 hdaa0: GPIO0: disabled hdaa0: GPIO1: disabled hdaa0: GPIO2: disabled hdaa0: GPIO3: disabled hdaa0: Original pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=22 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=23 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=24 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=25 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=26 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=27 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=28 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=29 hdaa0: Patched pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdaa0: 4 associations found: hdaa0: Association 0 (15) out: hdaa0: Pin nid=22 seq=0 hdaa0: Association 1 (15) in: hdaa0: Pin nid=24 seq=0 hdaa0: Association 2 (15) out: hdaa0: Pin nid=26 seq=0 hdaa0: Association 3 (15) in: hdaa0: Pin nid=29 seq=0 hdaa0: Tracing association 0 (15) hdaa0: Pin 22 traced to DAC 16 hdaa0: Association 0 (15) trace succeeded hdaa0: Tracing association 1 (15) hdaa0: Unable to trace pin 24 to ADC 20, undo traces hdaa0: Pin 24 traced to ADC 21 hdaa0: Association 1 (15) trace succeeded hdaa0: Tracing association 2 (15) hdaa0: Pin 26 traced to DAC 17 hdaa0: Association 2 (15) trace succeeded hdaa0: Tracing association 3 (15) hdaa0: Pin 29 traced to ADC 20 hdaa0: Association 3 (15) trace succeeded hdaa0: Looking for additional DAC for association 0 (15) hdaa0: Looking for additional ADC for association 1 (15) hdaa0: Looking for additional DAC for association 2 (15) hdaa0: Looking for additional ADC for association 3 (15) hdaa0: Tracing input monitor hdaa0: Tracing other input monitors hdaa0: Tracing nid 24 to out hdaa0: Tracing nid 29 to out hdaa0: Tracing beeper hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref pcm0: at nid 22 and 24 on hdaa0 pcm0: Playback: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm0: DAC: 16 pcm0: pcm0: nid=22 [pin: Headphones (Green Jack)] pcm0: + <- nid=16 [audio output] [src: pcm] pcm0: pcm0: Record: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0160 16 20 24 bits, 44 48 96 KHz pcm0: ADC: 21 pcm0: pcm0: nid=21 [audio input] pcm0: + <- nid=24 [pin: Mic (Pink Jack)] [src: mic] pcm0: pcm0: Master Volume (OSS: vol): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: PCM Volume (OSS: pcm): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: Microphone Volume (OSS: mic): 0/40dB pcm0: +- ctl 5 (nid 21 in 0): -74/6dB (81 steps) pcm0: +- ctl 7 (nid 24 out): 0/40dB (5 steps) pcm0: pcm0: Speaker/Beep Volume (OSS: speaker): -18/0dB pcm0: +- ctl 3 (nid 19 out): -18/0dB (4 steps) pcm0: pcm0: Recording Level (OSS: rec): -74/6dB pcm0: +- ctl 5 (nid 21 in 0): -74/6dB (81 steps) pcm0: +- ctl 7 (nid 24 out): 0/40dB (5 steps) pcm0: pcm0: Mixer "vol": pcm0: Mixer "pcm": pcm0: Mixer "speaker": pcm0: Mixer "mic": pcm0: Mixer "rec": pcm0: Playback channel set is: Front Left, Front Right, pcm0: Playback channel matrix is: 2.0 (disconnected) pcm0: Recording channel set is: Front Left, Front Right, pcm0: Recording channel matrix is: 2.0 (disconnected) pcm1: at nid 26 and 29 on hdaa0 pcm1: Playback: pcm1: Stream cap: 0x00000001 PCM pcm1: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm1: DAC: 17 pcm1: pcm1: nid=26 [pin: Speaker (Fixed)] pcm1: + <- nid=17 [audio output] [src: pcm] pcm1: pcm1: Record: pcm1: Stream cap: 0x00000001 PCM pcm1: PCM cap: 0x000e0160 16 20 24 bits, 44 48 96 KHz pcm1: ADC: 20 pcm1: pcm1: nid=20 [audio input] pcm1: + <- nid=29 [pin: Mic (Fixed)] [src: monitor] pcm1: pcm1: Master Volume (OSS: vol): -74/0dB pcm1: +- ctl 2 (nid 17 out): -74/0dB (75 steps) pcm1: pcm1: PCM Volume (OSS: pcm): -74/0dB pcm1: +- ctl 2 (nid 17 out): -74/0dB (75 steps) pcm1: pcm1: Microphone2 Volume (OSS: monitor): 0/48dB pcm1: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm1: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm1: pcm1: Recording Level (OSS: rec): -74/6dB pcm1: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm1: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm1: pcm1: Mixer "vol": pcm1: Mixer "pcm": pcm1: Mixer "rec": pcm1: Mixer "ogain": pcm1: Mixer "monitor": pcm1: Playback channel set is: Front Left, Front Right, pcm1: Playback channel matrix is: 2.0 (unknown) pcm1: Automatically set rec source to: monitor pcm1: Recording channel set is: Front Left, Front Right, pcm1: Recording channel matrix is: 2.0 (unknown) unknown: at nid 2 on hdacc0 (no driver attached) hdacc0: Subsystem ID: 0xc520e84c -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:29:13 2014 Return-Path: Delivered-To: svn-src-all@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 2B9E1D4D; Sun, 27 Jul 2014 08:29:13 +0000 (UTC) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21879230B; Sun, 27 Jul 2014 08:29:11 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id bs8so2918212wib.3 for ; Sun, 27 Jul 2014 01:29:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=EvV3PMdxy2afjuX0qdSpl6fYMJhEsrGz4mj0K6iXTNU=; b=vuneaS5nNPm0bdEjUyoS3Yj5vcyqRSf5/N9eu74f6X0hrWG78Zbu5zRtCRLm4+UeBU rjF6PQ+Th2ybX9rtvgmroBGtt0z9K3AbnjjfYxMJgCOPI7R7qZKxOgE8Aq0SKpcFktnC HQddzW5pDv0WOBqJ4QfL77GaECDceDbFo9HEZyH0QqI/E4GrqKmhziiPT+AN/vKkwG/o 64AXmK//OP3W/svty5hTVRpvGQzexI7oQSLlAB/Tmstst68HflJAaqs9/liRLzYtmwEA kxUL6Qsj/sXl4gYswU5Exk/866IFkSkghgFgmBPYQnxz8WTfEpcXuL5goRvwsl18EQze bnMg== X-Received: by 10.180.101.136 with SMTP id fg8mr19450271wib.44.1406449749916; Sun, 27 Jul 2014 01:29:09 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id u10sm16799545wix.14.2014.07.27.01.29.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Jul 2014 01:29:09 -0700 (PDT) Sender: Alexander Motin Message-ID: <53D4B853.8040305@FreeBSD.org> Date: Sun, 27 Jul 2014 11:29:07 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:29:13 -0000 On 27.07.2014 11:20, Adrian Chadd wrote: > ok, so how do I figure out what the right patch should be? > > pcm0: at nid 22 and 24 on hdaa0 > pcm1: at nid 26 and 29 on hdaa0 > > .. and > > hdac0@pci0:0:27:0: class=0x040300 card=0x20f217aa chip=0x293e8086 > rev=0x03 hdr=0x00 Technically there is not all of required info shown above, but assuming some likeness I would try this (just replace ZZZ with your model name): Index: hdaa_patches.c =================================================================== --- hdaa_patches.c (revision 269151) +++ hdaa_patches.c (working copy) @@ -340,7 +340,8 @@ hdac_pin_patch(struct hdaa_widget *w) } } } else if (id == HDA_CODEC_CX20561 && - subid == LENOVO_B450_SUBVENDOR) { + (subid == LENOVO_B450_SUBVENDOR || + subid == LENOVO_ZZZ_SUBVENDOR)) { switch (nid) { case 22: patch = "as=1 seq=15"; Index: hdac.h =================================================================== --- hdac.h (revision 269151) +++ hdac.h (working copy) @@ -236,6 +236,7 @@ #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_ZZZ_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:37:13 2014 Return-Path: Delivered-To: svn-src-all@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 C1BF8151; Sun, 27 Jul 2014 08:37:13 +0000 (UTC) Received: from mail-qg0-x230.google.com (mail-qg0-x230.google.com [IPv6:2607:f8b0:400d:c04::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DBC723B3; Sun, 27 Jul 2014 08:37:13 +0000 (UTC) Received: by mail-qg0-f48.google.com with SMTP id i50so6939550qgf.7 for ; Sun, 27 Jul 2014 01:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=JOsg6iHy1fORv+vnJsPREIQqZ2SunBA814qblErDKXA=; b=KPMctn9v7T7znJJY/lS6LMxto1YJSkCapEGnkPS7iy5Tax2bajLbnHrBu3xnRIsPJd 8sezymIbYJ0cfYGd5/ZOXgWSHGMyOkkwNJwjs3dbjhDoFmwlDKCAOKhsV2V3PGY32ePs dXc/Grq3uD9Rm/sMsJTtEdZ89D5M+yiqT+72FkpkVASHzS57dWw/BlrZKEFiiocCV3hZ yUMdl5SnbhB7wAG4lsus4IGudVjpteqHrDeZ3aTFmMVAbeEPyR0O8ayIxIgWZtw0Bbuj l+CHUchwiJCAtDZx0iSxjI0D1MF6pZpdxMqiYLgv6WfXo6EuXv8YEJUQI7PReDEZtnKF V1vA== MIME-Version: 1.0 X-Received: by 10.224.97.65 with SMTP id k1mr45937607qan.28.1406450232270; Sun, 27 Jul 2014 01:37:12 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:37:12 -0700 (PDT) In-Reply-To: <53D4B853.8040305@FreeBSD.org> References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> <53D4B853.8040305@FreeBSD.org> Date: Sun, 27 Jul 2014 01:37:12 -0700 X-Google-Sender-Auth: mh9B-mhADRINgO_ULeLLjT52hSQ Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:37:13 -0000 On 27 July 2014 01:29, Alexander Motin wrote: > On 27.07.2014 11:20, Adrian Chadd wrote: >> ok, so how do I figure out what the right patch should be? >> >> pcm0: at nid 22 and 24 on hdaa0 >> pcm1: at nid 26 and 29 on hdaa0 >> >> .. and >> >> hdac0@pci0:0:27:0: class=0x040300 card=0x20f217aa chip=0x293e8086 >> rev=0x03 hdr=0x00 > > Technically there is not all of required info shown above, but assuming > some likeness I would try this (just replace ZZZ with your model name): > > Index: hdaa_patches.c > =================================================================== > --- hdaa_patches.c (revision 269151) > +++ hdaa_patches.c (working copy) > @@ -340,7 +340,8 @@ hdac_pin_patch(struct hdaa_widget *w) > } > } > } else if (id == HDA_CODEC_CX20561 && > - subid == LENOVO_B450_SUBVENDOR) { > + (subid == LENOVO_B450_SUBVENDOR || > + subid == LENOVO_ZZZ_SUBVENDOR)) { > switch (nid) { > case 22: > patch = "as=1 seq=15"; > Index: hdac.h > =================================================================== > --- hdac.h (revision 269151) > +++ hdac.h (working copy) > @@ -236,6 +236,7 @@ > #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) > #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) > #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) > +#define LENOVO_ZZZ_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) > #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) > #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) > #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) So I have: adrian@lucy-11i386:~/work/freebsd/head/src/sys/dev/sound/pci/hda % svn diff . Index: hdaa_patches.c =================================================================== --- hdaa_patches.c (revision 268931) +++ hdaa_patches.c (working copy) @@ -154,6 +154,8 @@ id = hdaa_codec_id(w->devinfo); subid = hdaa_card_id(w->devinfo); + printf("%s: id=0x%08x; subid=0x%08x; nid=%d\n", __func__, id, subid, nid); + /* XXX: Old patches require complete review. * Now they may create more problem then solve due to * incorrect associations. @@ -340,9 +342,10 @@ } } } else if (id == HDA_CODEC_CX20561 && - subid == LENOVO_B450_SUBVENDOR) { + (subid == LENOVO_T400_SUBVENDOR || + subid == LENOVO_B450_SUBVENDOR)) { switch (nid) { - case 22: + case 22: /* headphones */ patch = "as=1 seq=15"; break; } Index: hdac.h =================================================================== --- hdac.h (revision 268931) +++ hdac.h (working copy) @@ -236,6 +236,7 @@ #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_T400_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) adrian@lucy-11i386:~/work/freebsd/head/src/sys/dev/sound/pci/hda % But it still chooses the speakers as pcm0: adrian@lucy-11i386:~/work/freebsd/head/src/sys/dev/sound/pci/hda % dmesg pcm0: detached pcm1: detached hdaa0: detached hdacc0: detached hdac0: detached pci0: at device 27.0 (no driver attached) snd_unit_init() u=0x00ff8000 [512] d=0x00007c00 [32] c=0x000003ff [1024] feeder_register: snd_unit=-1 snd_maxautovchans=16 latency=5 feeder_rate_min=1 feeder_rate_max=2016000 feeder_rate_round=25 pci0: driver added found-> vendor=0x8086, dev=0x2a44, revid=0x07 domain=0, bus=0, slot=3, func=0 class=07-80-00, hdrtype=0x00, mfdev=1 cmdreg=0x0006, statreg=0x0010, cachelnsz=0 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=a, irq=16 powerspec 3 supports D0 D3 current D0 MSI supports 1 message, 64 bit pci0:0:3:0: reprobing on driver added found-> vendor=0x8086, dev=0x293e, revid=0x03 domain=0, bus=0, slot=27, func=0 class=04-03-00, hdrtype=0x00, mfdev=0 cmdreg=0x0506, statreg=0x0010, cachelnsz=16 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=b, irq=17 powerspec 2 supports D0 D3 current D0 MSI supports 1 message, 64 bit pci0:0:27:0: reprobing on driver added hdac0: mem 0xfc020000-0xfc023fff irq 17 at device 27.0 on pci0 hdac0: PCI card vendor: 0x17aa, device: 0x20f2 hdac0: HDA Driver Revision: 20120126_0002 hdac0: Config options: on=0x00000000 off=0x00000000 hdac0: attempting to allocate 1 MSI vectors (1 supported) msi: routing MSI IRQ 258 to local APIC 1 vector 54 hdac0: using IRQ 258 for MSI hdac0: Caps: OSS 4, ISS 4, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256 found-> vendor=0x8086, dev=0x2930, revid=0x03 domain=0, bus=0, slot=31, func=3 class=0c-05-00, hdrtype=0x00, mfdev=0 cmdreg=0x0103, statreg=0x0280, cachelnsz=0 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=a, irq=23 pci0:0:31:3: reprobing on driver added pci2: driver added pci3: driver added pci5: driver added pci13: driver added pci21: driver added found-> vendor=0x1180, dev=0x0832, revid=0x04 domain=0, bus=21, slot=0, func=1 class=0c-00-10, hdrtype=0x00, mfdev=1 cmdreg=0x0106, statreg=0x0210, cachelnsz=16 (dwords) lattimer=0x20 (960 ns), mingnt=0x02 (500 ns), maxlat=0x04 (1000 ns) intpin=b, irq=17 powerspec 2 supports D0 D1 D2 D3 current D0 pci0:21:0:1: reprobing on driver added hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 hdaa0: Subsystem ID: 0x17aa211c hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1 hdaa0: GPIO0: disabled hdaa0: GPIO1: disabled hdaa0: GPIO2: disabled hdaa0: GPIO3: disabled hdaa0: Original pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=22 hdaa0: Patching pin config nid=22 0x022140f0 -> 0x0221401f hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=23 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=24 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=25 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=26 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=27 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=28 hdac_pin_patch: id=0x14f15051; subid=0x20f217aa; nid=29 hdaa0: Patched pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 0221401f 1 15 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdaa0: 4 associations found: hdaa0: Association 0 (1) out: hdaa0: Pin nid=22 seq=15 hdaa0: Association 1 (15) in: hdaa0: Pin nid=24 seq=0 hdaa0: Association 2 (15) out: hdaa0: Pin nid=26 seq=0 hdaa0: Association 3 (15) in: hdaa0: Pin nid=29 seq=0 hdaa0: Tracing association 0 (1) hdaa0: Pin 22 traced to DAC 16 hdaa0: Association 0 (1) trace succeeded hdaa0: Tracing association 1 (15) hdaa0: Unable to trace pin 24 to ADC 20, undo traces hdaa0: Pin 24 traced to ADC 21 hdaa0: Association 1 (15) trace succeeded hdaa0: Tracing association 2 (15) hdaa0: Pin 26 traced to DAC 17 hdaa0: Association 2 (15) trace succeeded hdaa0: Tracing association 3 (15) hdaa0: Pin 29 traced to ADC 20 hdaa0: Association 3 (15) trace succeeded hdaa0: Looking for additional DAC for association 0 (1) hdaa0: Looking for additional ADC for association 1 (15) hdaa0: Looking for additional DAC for association 2 (15) hdaa0: Looking for additional ADC for association 3 (15) hdaa0: Tracing input monitor hdaa0: Tracing other input monitors hdaa0: Tracing nid 24 to out hdaa0: Tracing nid 29 to out hdaa0: Tracing beeper hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref pcm0: at nid 22 and 24 on hdaa0 pcm0: Playback: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm0: DAC: 16 pcm0: pcm0: nid=22 [pin: Headphones (Green Jack)] pcm0: + <- nid=16 [audio output] [src: pcm] pcm0: pcm0: Record: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0160 16 20 24 bits, 44 48 96 KHz pcm0: ADC: 21 pcm0: pcm0: nid=21 [audio input] pcm0: + <- nid=24 [pin: Mic (Pink Jack)] [src: mic] pcm0: pcm0: Master Volume (OSS: vol): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: PCM Volume (OSS: pcm): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: Microphone Volume (OSS: mic): 0/40dB pcm0: +- ctl 5 (nid 21 in 0): -74/6dB (81 steps) pcm0: +- ctl 7 (nid 24 out): 0/40dB (5 steps) pcm0: pcm0: Speaker/Beep Volume (OSS: speaker): -18/0dB pcm0: +- ctl 3 (nid 19 out): -18/0dB (4 steps) pcm0: pcm0: Recording Level (OSS: rec): -74/6dB pcm0: +- ctl 5 (nid 21 in 0): -74/6dB (81 steps) pcm0: +- ctl 7 (nid 24 out): 0/40dB (5 steps) pcm0: pcm0: Mixer "vol": pcm0: Mixer "pcm": pcm0: Mixer "speaker": pcm0: Mixer "mic": pcm0: Mixer "rec": pcm0: Playback channel matrix is: unknown, assuming 2.0 (disconnected) pcm0: Recording channel set is: Front Left, Front Right, pcm0: Recording channel matrix is: 2.0 (disconnected) pcm1: at nid 26 and 29 on hdaa0 pcm1: Playback: pcm1: Stream cap: 0x00000001 PCM pcm1: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm1: DAC: 17 pcm1: pcm1: nid=26 [pin: Speaker (Fixed)] pcm1: + <- nid=17 [audio output] [src: pcm] pcm1: pcm1: Record: pcm1: Stream cap: 0x00000001 PCM pcm1: PCM cap: 0x000e0160 16 20 24 bits, 44 48 96 KHz pcm1: ADC: 20 pcm1: pcm1: nid=20 [audio input] pcm1: + <- nid=29 [pin: Mic (Fixed)] [src: monitor] pcm1: pcm1: Master Volume (OSS: vol): -74/0dB pcm1: +- ctl 2 (nid 17 out): -74/0dB (75 steps) pcm1: pcm1: PCM Volume (OSS: pcm): -74/0dB pcm1: +- ctl 2 (nid 17 out): -74/0dB (75 steps) pcm1: pcm1: Microphone2 Volume (OSS: monitor): 0/48dB pcm1: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm1: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm1: pcm1: Recording Level (OSS: rec): -74/6dB pcm1: +- ctl 4 (nid 20 in 0): -74/6dB (81 steps) pcm1: +- ctl 8 (nid 29 out): 0/48dB (5 steps) pcm1: pcm1: Mixer "vol": pcm1: Mixer "pcm": pcm1: Mixer "rec": pcm1: Mixer "ogain": pcm1: Mixer "monitor": pcm1: Playback channel set is: Front Left, Front Right, pcm1: Playback channel matrix is: 2.0 (unknown) pcm1: Automatically set rec source to: monitor pcm1: Recording channel set is: Front Left, Front Right, pcm1: Recording channel matrix is: 2.0 (unknown) unknown: at nid 2 on hdacc0 (no driver attached) hdacc0: Subsystem ID: 0xf250584c adrian@lucy-11i386:~/work/freebsd/head/src/sys/dev/sound/pci/hda % From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:37:42 2014 Return-Path: Delivered-To: svn-src-all@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 AC7332BA; Sun, 27 Jul 2014 08:37:42 +0000 (UTC) Received: from mail-we0-x22b.google.com (mail-we0-x22b.google.com [IPv6:2a00:1450:400c:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A3DBF23B7; Sun, 27 Jul 2014 08:37:41 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id p10so6130351wes.2 for ; Sun, 27 Jul 2014 01:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=UmzkghAlh1p1h7HuQtwp7Med7h/4cq8frUz5bg3n264=; b=Fo7qP+N1I0bWMRMTpvKznLe4Q574swnIxsQQBPy9YKeC8AdxW1LFmAD4PSiWVLORKq BD8e825yuEVYHa455GBgnIiwhAEQuiEdBS2UfWRQwjIga66Qm+5TtsylvVfqs8TNw9pt 6poDgOu1D9XKuf+qrXfTFNYazaAXSeS21tgpBRaqytl0Wx4oq1KNrg7pShMglnw7p+2D 5cl/n0ISGRUk544HtOhU6WvAQyCIfD+7zAr7qWe5RBdgihvq5RsNh0/WLa+WBlIOqhbT /r1cShRDMkQN/8LW9ubINTiEvljJn0lCcwuptAAKkCwkd1ejAy1moOGvBKI8pBLDJNMa lZRg== X-Received: by 10.180.78.100 with SMTP id a4mr19106580wix.36.1406450259959; Sun, 27 Jul 2014 01:37:39 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id go4sm39811575wjc.39.2014.07.27.01.37.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Jul 2014 01:37:38 -0700 (PDT) Sender: Alexander Motin Message-ID: <53D4BA51.7070505@FreeBSD.org> Date: Sun, 27 Jul 2014 11:37:37 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:37:42 -0000 On 27.07.2014 11:27, Adrian Chadd wrote: > actually, scratch that, I had some test hacks in there. Try: > > hdaa0: Patched pins configuration: > hdaa0: nid 0x as seq device conn jack loc color misc > hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 > hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA > hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 > hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA > hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 > hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA > hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA > hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 > hdaa0: 4 associations found: > hdaa0: Association 0 (15) out: > hdaa0: Pin nid=22 seq=0 > hdaa0: Association 1 (15) in: > hdaa0: Pin nid=24 seq=0 > hdaa0: Association 2 (15) out: > hdaa0: Pin nid=26 seq=0 > hdaa0: Association 3 (15) in: > hdaa0: Pin nid=29 seq=0 Yes, that is what I'd like to see. Your situation looks a bit more complicated, requiring some bigger patch: Index: hdaa_patches.c =================================================================== --- hdaa_patches.c (revision 269151) +++ hdaa_patches.c (working copy) @@ -346,6 +346,22 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_CX20561 && + subid == LENOVO_ZZZ_SUBVENDOR) { + switch (nid) { + case 22: + patch = "as=1 seq=15"; + break; + case 24: + patch = "as=2 seq=14"; + break; + case 26: + patch = "as=1 seq=0"; + break; + case 29: + patch = "as=2 seq=0"; + break; + } } else if (id == HDA_CODEC_CX20590 && (subid == LENOVO_X1_SUBVENDOR || subid == LENOVO_X220_SUBVENDOR || Index: hdac.h =================================================================== --- hdac.h (revision 269151) +++ hdac.h (working copy) @@ -236,6 +236,7 @@ #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_ZZZ_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:40:40 2014 Return-Path: Delivered-To: svn-src-all@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 3BD8942A; Sun, 27 Jul 2014 08:40:40 +0000 (UTC) Received: from mail-qg0-x233.google.com (mail-qg0-x233.google.com [IPv6:2607:f8b0:400d:c04::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA68823C7; Sun, 27 Jul 2014 08:40:39 +0000 (UTC) Received: by mail-qg0-f51.google.com with SMTP id a108so6979334qge.24 for ; Sun, 27 Jul 2014 01:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gh6OjB+no1HCBQObcHKafF2ic2yMcRnqOg9xE3mvoCI=; b=xjRVns+hweQNQvlkXTAI+HNWPbSCDshbRdlOEnZlnBsaouf92v9E7QQFhfVg+mRWe4 T2Snd60skPExDBMk1gCxkCnvBJ/ATZf+DUhKNhd8N8XwNofxMEBWhT8jYiG5A7ln5Op1 QMd6LFKZiqBDzVnX5QctksmR0wqtYFNj45dnO1VkMRJUBkJ0s/dB7CnWzZ4J+2RIlgbJ 2fWMzh471zQy3M1Ckn63U0Z3W8H2UhXqcqe8xnnDwOVpulFraZW74soWKs7gO0TO31Df Uk+Hnnf6Cs/Y2UG9sEcIWvyN4W/I/HQsPsa2t002N8im6Sa8JdzFVCaaKgRLC8L5A/Zm pL6Q== MIME-Version: 1.0 X-Received: by 10.140.107.4 with SMTP id g4mr33143323qgf.100.1406450438788; Sun, 27 Jul 2014 01:40:38 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:40:38 -0700 (PDT) In-Reply-To: <53D4BA51.7070505@FreeBSD.org> References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> <53D4BA51.7070505@FreeBSD.org> Date: Sun, 27 Jul 2014 01:40:38 -0700 X-Google-Sender-Auth: 5ug6t0O0T6wZx67AKSF9qc9Otfs Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:40:40 -0000 ok, with that it looks like: root@lucy-11i386:/home/adrian/work/freebsd/head/src # kldload sound ; kldload snd_hda root@lucy-11i386:/home/adrian/work/freebsd/head/src # dmesg snd_unit_init() u=0x00ff8000 [512] d=0x00007c00 [32] c=0x000003ff [1024] feeder_register: snd_unit=-1 snd_maxautovchans=16 latency=5 feeder_rate_min=1 feeder_rate_max=2016000 feeder_rate_round=25 pci0: driver added found-> vendor=0x8086, dev=0x2a44, revid=0x07 domain=0, bus=0, slot=3, func=0 class=07-80-00, hdrtype=0x00, mfdev=1 cmdreg=0x0006, statreg=0x0010, cachelnsz=0 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=a, irq=16 powerspec 3 supports D0 D3 current D0 MSI supports 1 message, 64 bit pci0:0:3:0: reprobing on driver added found-> vendor=0x8086, dev=0x293e, revid=0x03 domain=0, bus=0, slot=27, func=0 class=04-03-00, hdrtype=0x00, mfdev=0 cmdreg=0x0506, statreg=0x0010, cachelnsz=16 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=b, irq=17 powerspec 2 supports D0 D3 current D0 MSI supports 1 message, 64 bit pci0:0:27:0: reprobing on driver added hdac0: mem 0xfc020000-0xfc023fff irq 17 at device 27.0 on pci0 hdac0: PCI card vendor: 0x17aa, device: 0x20f2 hdac0: HDA Driver Revision: 20120126_0002 hdac0: Config options: on=0x00000000 off=0x00000000 hdac0: attempting to allocate 1 MSI vectors (1 supported) msi: routing MSI IRQ 258 to local APIC 0 vector 52 hdac0: using IRQ 258 for MSI hdac0: Caps: OSS 4, ISS 4, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256 found-> vendor=0x8086, dev=0x2930, revid=0x03 domain=0, bus=0, slot=31, func=3 class=0c-05-00, hdrtype=0x00, mfdev=0 cmdreg=0x0103, statreg=0x0280, cachelnsz=0 (dwords) lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) intpin=a, irq=23 pci0:0:31:3: reprobing on driver added pci2: driver added pci3: driver added pci5: driver added pci13: driver added pci21: driver added found-> vendor=0x1180, dev=0x0832, revid=0x04 domain=0, bus=21, slot=0, func=1 class=0c-00-10, hdrtype=0x00, mfdev=1 cmdreg=0x0106, statreg=0x0210, cachelnsz=16 (dwords) lattimer=0x20 (960 ns), mingnt=0x02 (500 ns), maxlat=0x04 (1000 ns) intpin=b, irq=17 powerspec 2 supports D0 D1 D2 D3 current D0 pci0:21:0:1: reprobing on driver added hdacc0: at cad 0 on hdac0 hdaa0: at nid 1 on hdacc0 hdaa0: Subsystem ID: 0x17aa211c hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1 hdaa0: GPIO0: disabled hdaa0: GPIO1: disabled hdaa0: GPIO2: disabled hdaa0: GPIO3: disabled hdaa0: Original pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 hdaa0: Patching pin config nid=22 0x022140f0 -> 0x0221401f hdaa0: Patching pin config nid=24 0x02a190f0 -> 0x02a1902e hdaa0: Patching pin config nid=26 0x901701f0 -> 0x90170110 hdaa0: Patching pin config nid=29 0x90a601f0 -> 0x90a60120 hdaa0: Patched pins configuration: hdaa0: nid 0x as seq device conn jack loc color misc hdaa0: 22 0221401f 1 15 Headphones Jack 1/8 Front Green 0 hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA hdaa0: 24 02a1902e 2 14 Mic Jack 1/8 Front Pink 0 hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA hdaa0: 26 90170110 1 0 Speaker Fixed Analog Internal Unknown 1 hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA hdaa0: 29 90a60120 2 0 Mic Fixed Digital Internal Unknown 1 hdaa0: 2 associations found: hdaa0: Association 0 (1) out: hdaa0: Pin nid=26 seq=0 hdaa0: Pin nid=22 seq=15 hdaa0: Association 1 (2) in: hdaa0: Pin nid=29 seq=0 hdaa0: Pin nid=24 seq=14 hdaa0: Tracing association 0 (1) hdaa0: Pin 26 traced to DAC 16 hdaa0: Pin 22 traced to DAC 16 and hpredir 0 hdaa0: Association 0 (1) trace succeeded hdaa0: Tracing association 1 (2) hdaa0: Pin 29 traced to ADC 20 hdaa0: Unable to trace pin 24 to ADC 20, undo traces hdaa0: Unable to trace pin 29 to ADC 21, undo traces hdaa0: Association 1 (2) trace failed hdaa0: Looking for additional DAC for association 0 (1) hdaa0: Tracing input monitor hdaa0: Tracing other input monitors hdaa0: Tracing beeper hdaa0: Headphones redirection for association 0 nid=22 using unsolicited responses. hdaa0: Redirect output to: main hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref pcm0: at nid 26,22 on hdaa0 pcm0: Playback: pcm0: Stream cap: 0x00000001 PCM pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz pcm0: DAC: 16 pcm0: pcm0: nid=26 [pin: Speaker (Fixed)] pcm0: + <- nid=16 [audio output] [src: pcm] pcm0: pcm0: nid=22 [pin: Headphones (Green Jack)] pcm0: + <- nid=16 [audio output] [src: pcm] pcm0: pcm0: Master Volume (OSS: vol): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: PCM Volume (OSS: pcm): -74/0dB pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) pcm0: pcm0: Speaker/Beep Volume (OSS: speaker): -18/0dB pcm0: +- ctl 3 (nid 19 out): -18/0dB (4 steps) pcm0: pcm0: Mixer "vol": pcm0: Mixer "pcm": pcm0: Mixer "speaker": pcm0: Mixer "ogain": pcm0: Playback channel set is: Front Left, Front Right, pcm0: Playback channel matrix is: 2.0 (unknown) unknown: at nid 2 on hdacc0 (no driver attached) hdacc0: Subsystem ID: 0xf24f684c -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:42:09 2014 Return-Path: Delivered-To: svn-src-all@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 BA5E2663; Sun, 27 Jul 2014 08:42:09 +0000 (UTC) Received: from mail-qa0-x230.google.com (mail-qa0-x230.google.com [IPv6:2607:f8b0:400d:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 337A22455; Sun, 27 Jul 2014 08:42:09 +0000 (UTC) Received: by mail-qa0-f48.google.com with SMTP id m5so6310397qaj.7 for ; Sun, 27 Jul 2014 01:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=N7Q0SJ8J7fTo+537I3+m/SYhvPi/Fdv54nTDVmjlkb4=; b=l3Q9A/dUac4zxWCLV0PpKvWnA2+KmnUFXKXL4k6B4InHXxeIaOXFidy0QOM72UIthY rjzHQ+YTxZbJ6WKq9124Ot0O97kDJ07dZDgrDaNRIF84vNg7wJaBanMY/0OhmUlHiBDe hRBpgAwZF5S2tKjLEW6M4Of5BkTurkGK2n8jizn39wsG8klm3ZKNkxV+B3KVQ/qiW6wP Tqm4d8QM+NTjmPt6Pv38RUERKTzTUXSwKWHdGyQzm9MOnRG6CPtw3YuGlI+mLkkgWvmr VCgUYAZc2GymybjIh4Aes2tTFuUzwRK2qpYvnN3DQjXg0fjAnBeowssi2xaasRXB891P oNmA== MIME-Version: 1.0 X-Received: by 10.224.171.197 with SMTP id i5mr46723578qaz.55.1406450528367; Sun, 27 Jul 2014 01:42:08 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 01:42:08 -0700 (PDT) In-Reply-To: References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> <53D4BA51.7070505@FreeBSD.org> Date: Sun, 27 Jul 2014 01:42:08 -0700 X-Google-Sender-Auth: Aih6yWyUeWJa0Tr76uLPp7fso7k Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:42:09 -0000 ... aaand it worked. Woo! So how'd it actually map the correct selection between headphones and speaker? That's now cutting back and forth correctly as I plug in and out the headphone jack. -a On 27 July 2014 01:40, Adrian Chadd wrote: > ok, with that it looks like: > > root@lucy-11i386:/home/adrian/work/freebsd/head/src # kldload sound ; > kldload snd_hda > root@lucy-11i386:/home/adrian/work/freebsd/head/src # dmesg > snd_unit_init() u=0x00ff8000 [512] d=0x00007c00 [32] c=0x000003ff [1024] > feeder_register: snd_unit=-1 snd_maxautovchans=16 latency=5 > feeder_rate_min=1 feeder_rate_max=2016000 feeder_rate_round=25 > pci0: driver added > found-> vendor=0x8086, dev=0x2a44, revid=0x07 > domain=0, bus=0, slot=3, func=0 > class=07-80-00, hdrtype=0x00, mfdev=1 > cmdreg=0x0006, statreg=0x0010, cachelnsz=0 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=a, irq=16 > powerspec 3 supports D0 D3 current D0 > MSI supports 1 message, 64 bit > pci0:0:3:0: reprobing on driver added > found-> vendor=0x8086, dev=0x293e, revid=0x03 > domain=0, bus=0, slot=27, func=0 > class=04-03-00, hdrtype=0x00, mfdev=0 > cmdreg=0x0506, statreg=0x0010, cachelnsz=16 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=b, irq=17 > powerspec 2 supports D0 D3 current D0 > MSI supports 1 message, 64 bit > pci0:0:27:0: reprobing on driver added > hdac0: mem 0xfc020000-0xfc023fff irq 17 > at device 27.0 on pci0 > hdac0: PCI card vendor: 0x17aa, device: 0x20f2 > hdac0: HDA Driver Revision: 20120126_0002 > hdac0: Config options: on=0x00000000 off=0x00000000 > hdac0: attempting to allocate 1 MSI vectors (1 supported) > msi: routing MSI IRQ 258 to local APIC 0 vector 52 > hdac0: using IRQ 258 for MSI > hdac0: Caps: OSS 4, ISS 4, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256 > found-> vendor=0x8086, dev=0x2930, revid=0x03 > domain=0, bus=0, slot=31, func=3 > class=0c-05-00, hdrtype=0x00, mfdev=0 > cmdreg=0x0103, statreg=0x0280, cachelnsz=0 (dwords) > lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns) > intpin=a, irq=23 > pci0:0:31:3: reprobing on driver added > pci2: driver added > pci3: driver added > pci5: driver added > pci13: driver added > pci21: driver added > found-> vendor=0x1180, dev=0x0832, revid=0x04 > domain=0, bus=21, slot=0, func=1 > class=0c-00-10, hdrtype=0x00, mfdev=1 > cmdreg=0x0106, statreg=0x0210, cachelnsz=16 (dwords) > lattimer=0x20 (960 ns), mingnt=0x02 (500 ns), maxlat=0x04 (1000 ns) > intpin=b, irq=17 > powerspec 2 supports D0 D1 D2 D3 current D0 > pci0:21:0:1: reprobing on driver added > hdacc0: at cad 0 on hdac0 > hdaa0: at nid 1 on hdacc0 > hdaa0: Subsystem ID: 0x17aa211c > hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1 > hdaa0: GPIO0: disabled > hdaa0: GPIO1: disabled > hdaa0: GPIO2: disabled > hdaa0: GPIO3: disabled > hdaa0: Original pins configuration: > hdaa0: nid 0x as seq device conn jack loc color misc > hdaa0: 22 022140f0 15 0 Headphones Jack 1/8 Front Green 0 > hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 > hdaa0: 24 02a190f0 15 0 Mic Jack 1/8 Front Pink 0 > hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 > hdaa0: 26 901701f0 15 0 Speaker Fixed Analog Internal Unknown 1 > hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 > hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 > hdaa0: 29 90a601f0 15 0 Mic Fixed Digital Internal Unknown 1 > hdaa0: Patching pin config nid=22 0x022140f0 -> 0x0221401f > hdaa0: Patching pin config nid=24 0x02a190f0 -> 0x02a1902e > hdaa0: Patching pin config nid=26 0x901701f0 -> 0x90170110 > hdaa0: Patching pin config nid=29 0x90a601f0 -> 0x90a60120 > hdaa0: Patched pins configuration: > hdaa0: nid 0x as seq device conn jack loc color misc > hdaa0: 22 0221401f 1 15 Headphones Jack 1/8 Front Green 0 > hdaa0: 23 61a190f0 15 0 Mic None 1/8 Ext-Rear Pink 0 DISA > hdaa0: 24 02a1902e 2 14 Mic Jack 1/8 Front Pink 0 > hdaa0: 25 40f000f0 15 0 Other None Unknown 0x00 Unknown 0 DISA > hdaa0: 26 90170110 1 0 Speaker Fixed Analog Internal Unknown 1 > hdaa0: 27 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA > hdaa0: 28 40f001f0 15 0 Other None Unknown 0x00 Unknown 1 DISA > hdaa0: 29 90a60120 2 0 Mic Fixed Digital Internal Unknown 1 > hdaa0: 2 associations found: > hdaa0: Association 0 (1) out: > hdaa0: Pin nid=26 seq=0 > hdaa0: Pin nid=22 seq=15 > hdaa0: Association 1 (2) in: > hdaa0: Pin nid=29 seq=0 > hdaa0: Pin nid=24 seq=14 > hdaa0: Tracing association 0 (1) > hdaa0: Pin 26 traced to DAC 16 > hdaa0: Pin 22 traced to DAC 16 and hpredir 0 > hdaa0: Association 0 (1) trace succeeded > hdaa0: Tracing association 1 (2) > hdaa0: Pin 29 traced to ADC 20 > hdaa0: Unable to trace pin 24 to ADC 20, undo traces > hdaa0: Unable to trace pin 29 to ADC 21, undo traces > hdaa0: Association 1 (2) trace failed > hdaa0: Looking for additional DAC for association 0 (1) > hdaa0: Tracing input monitor > hdaa0: Tracing other input monitors > hdaa0: Tracing beeper > hdaa0: Headphones redirection for association 0 nid=22 using > unsolicited responses. > hdaa0: Redirect output to: main > hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref > pcm0: at nid 26,22 on hdaa0 > pcm0: Playback: > pcm0: Stream cap: 0x00000001 PCM > pcm0: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz > pcm0: DAC: 16 > pcm0: > pcm0: nid=26 [pin: Speaker (Fixed)] > pcm0: + <- nid=16 [audio output] [src: pcm] > pcm0: > pcm0: nid=22 [pin: Headphones (Green Jack)] > pcm0: + <- nid=16 [audio output] [src: pcm] > pcm0: > pcm0: Master Volume (OSS: vol): -74/0dB > pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) > pcm0: > pcm0: PCM Volume (OSS: pcm): -74/0dB > pcm0: +- ctl 1 (nid 16 out): -74/0dB (75 steps) > pcm0: > pcm0: Speaker/Beep Volume (OSS: speaker): -18/0dB > pcm0: +- ctl 3 (nid 19 out): -18/0dB (4 steps) > pcm0: > pcm0: Mixer "vol": > pcm0: Mixer "pcm": > pcm0: Mixer "speaker": > pcm0: Mixer "ogain": > pcm0: Playback channel set is: Front Left, Front Right, > pcm0: Playback channel matrix is: 2.0 (unknown) > unknown: > at nid 2 on hdacc0 (no driver attached) > hdacc0: Subsystem ID: 0xf24f684c > > -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:44:16 2014 Return-Path: Delivered-To: svn-src-all@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 7E45A811; Sun, 27 Jul 2014 08:44: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B651246D; Sun, 27 Jul 2014 08:44:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6R8iGdY075636; Sun, 27 Jul 2014 08:44:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6R8iG8s075634; Sun, 27 Jul 2014 08:44:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201407270844.s6R8iG8s075634@svn.freebsd.org> From: Adrian Chadd Date: Sun, 27 Jul 2014 08:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269152 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:44:16 -0000 Author: adrian Date: Sun Jul 27 08:44:15 2014 New Revision: 269152 URL: http://svnweb.freebsd.org/changeset/base/269152 Log: Add support for my Lenovo T400. Tested: * Lenovo T400, model w/ P8700 Intel CPU on-board Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 27 08:02:24 2014 (r269151) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 27 08:44:15 2014 (r269152) @@ -346,6 +346,22 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_CX20561 && + subid == LENOVO_T400_SUBVENDOR) { + switch (nid) { + case 22: + patch = "as=1 seq=15"; + break; + case 24: + patch = "as=2 seq=14"; + break; + case 26: + patch = "as=1 seq=0"; + break; + case 29: + patch = "as=2 seq=0"; + break; + } } else if (id == HDA_CODEC_CX20590 && (subid == LENOVO_X1_SUBVENDOR || subid == LENOVO_X220_SUBVENDOR || Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Sun Jul 27 08:02:24 2014 (r269151) +++ head/sys/dev/sound/pci/hda/hdac.h Sun Jul 27 08:44:15 2014 (r269152) @@ -236,6 +236,7 @@ #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_T400_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 08:53:14 2014 Return-Path: Delivered-To: svn-src-all@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 1F719B34; Sun, 27 Jul 2014 08:53:14 +0000 (UTC) Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [IPv6:2a00:1450:400c:c00::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D53A2540; Sun, 27 Jul 2014 08:53:12 +0000 (UTC) Received: by mail-wg0-f48.google.com with SMTP id x13so5971710wgg.19 for ; Sun, 27 Jul 2014 01:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=GVhs0wQHhjswKgMGsiOwCZhpnLgm15PbEDQ3L23VyX4=; b=ZqWBc5NhltuH/ficZlBRjiprMdEGmtDUkiOZb3nRGkwtMuGJ6/o4dYAIzShpNZmBkX uwpwCSjdk7LAumSYSsThI1b0AEelLMnj9Dxdf1MCEvfbZyP6RPwwUdkcOC4Y2rFOGQmz b1ll76m43v2f4Yyihm5AoBMiBJRKWjPc8k0TrvFRqhbp8wD6/ftfTcsn/zS7vbvqcj/o Dth+om5O2zcEw/AojzFDH/WUcY/8sVlM4U9+KTZ0tTDDnzS3fiSbvfoQ3Ha5VNljrtU/ qzjYnOVtzRzdgL6RlMkj7IJCVww3soNjL2nGwa2vY3UB4UNNY1ogvSsvUsdUAyD1htH7 T1bQ== X-Received: by 10.194.84.69 with SMTP id w5mr10267711wjy.0.1406451191214; Sun, 27 Jul 2014 01:53:11 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id d12sm39938289wjx.0.2014.07.27.01.53.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 27 Jul 2014 01:53:10 -0700 (PDT) Sender: Alexander Motin Message-ID: <53D4BDF4.3040207@FreeBSD.org> Date: Sun, 27 Jul 2014 11:53:08 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> <53D4BA51.7070505@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 08:53:14 -0000 On 27.07.2014 11:42, Adrian Chadd wrote: > ... aaand it worked. Woo! It worked for playback, but completely broke recording. I've missed that your CODEC does not support input switching in hardware, while driver does not support that in software. For playback software switching is supported by the driver, so it worked. Patch below should give you automatic switching on playback, but still two separate recording devices. > So how'd it actually map the correct selection between headphones and > speaker? That's now cutting back and forth correctly as I plug in and > out the headphone jack. It tells the driver that those two inputs should be parts of one output device, and driver following HDA specifications reads jack presence information from respective CODEC pins. Sound actually played to both outputs, but driver mutes one of them, depending on jack presence. Lenovo engineers configured the CODEC to report each pin as separate audio device, but the problem that our sound(4) does not support automatic switching between them. :( > On 27 July 2014 01:40, Adrian Chadd wrote: >> ok, with that it looks like: >> >> hdaa0: 2 associations found: >> hdaa0: Association 0 (1) out: >> hdaa0: Pin nid=26 seq=0 >> hdaa0: Pin nid=22 seq=15 >> hdaa0: Association 1 (2) in: >> hdaa0: Pin nid=29 seq=0 >> hdaa0: Pin nid=24 seq=14 >> hdaa0: Tracing association 0 (1) >> hdaa0: Pin 26 traced to DAC 16 >> hdaa0: Pin 22 traced to DAC 16 and hpredir 0 >> hdaa0: Association 0 (1) trace succeeded >> hdaa0: Tracing association 1 (2) >> hdaa0: Pin 29 traced to ADC 20 >> hdaa0: Unable to trace pin 24 to ADC 20, undo traces >> hdaa0: Unable to trace pin 29 to ADC 21, undo traces >> hdaa0: Association 1 (2) trace failed Index: hdaa_patches.c =================================================================== --- hdaa_patches.c (revision 269151) +++ hdaa_patches.c (working copy) @@ -346,6 +346,16 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_CX20561 && + subid == LENOVO_ZZZ_SUBVENDOR) { + switch (nid) { + case 22: + patch = "as=1 seq=15"; + break; + case 26: + patch = "as=1 seq=0"; + break; + } } else if (id == HDA_CODEC_CX20590 && (subid == LENOVO_X1_SUBVENDOR || subid == LENOVO_X220_SUBVENDOR || Index: hdac.h =================================================================== --- hdac.h (revision 269151) +++ hdac.h (working copy) @@ -236,6 +236,7 @@ #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_ZZZ_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 09:50:48 2014 Return-Path: Delivered-To: svn-src-all@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 677029D0; Sun, 27 Jul 2014 09:50:48 +0000 (UTC) Received: from mail-qa0-x231.google.com (mail-qa0-x231.google.com [IPv6:2607:f8b0:400d:c00::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D375E29FD; Sun, 27 Jul 2014 09:50:47 +0000 (UTC) Received: by mail-qa0-f49.google.com with SMTP id dc16so6428364qab.8 for ; Sun, 27 Jul 2014 02:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=K9jDfX2TuktsP8V/kj1Dsa/4WpOWNRKtzV2uofVJS24=; b=rJkH3Z+o7fYbHx1IzpIkir9qKLPjJD5WIDPZmDpJa5xhRe7WzCLxv/ba6NH7cHC11g mPc7V06n8eb+qIr6nQS4Nzr5iHJEE7OVcTI6To2aIZZVr6fjCeOFBqU5kt3jaXaFFY19 23b6lOdn+KBvpUHkck1WksXtqE3/uCct7z+UUyA7G2jXS1cCGEQH6RYQyWRNx/z4jWRE ebDaRDjIrJ1pm6FCvOQT1shVSxqi8sVboNBn9AImkGkqWEzuqb+nFktdTf0If9IrtATl g2wkkltEFJMjQy3qkKOSLg52ML0RmatePc3CGUcDtJ2GAPVcAJ5MmsE3+leY07gzOotY qEvA== MIME-Version: 1.0 X-Received: by 10.224.97.65 with SMTP id k1mr46478866qan.28.1406454646990; Sun, 27 Jul 2014 02:50:46 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 02:50:46 -0700 (PDT) In-Reply-To: <53D4BDF4.3040207@FreeBSD.org> References: <201407131031.s6DAVTja093433@svn.freebsd.org> <53C335EF.2090606@FreeBSD.org> <53D4BA51.7070505@FreeBSD.org> <53D4BDF4.3040207@FreeBSD.org> Date: Sun, 27 Jul 2014 02:50:46 -0700 X-Google-Sender-Auth: lBPr0AbiCrXYJ08LE1P_NtfCWRM Message-ID: Subject: Re: svn commit: r268584 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Mark Johnston , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 09:50:48 -0000 Ok, I'll test this out and commit a fix to what's in -HEAD. Thanks! -a On 27 July 2014 01:53, Alexander Motin wrote: > On 27.07.2014 11:42, Adrian Chadd wrote: >> ... aaand it worked. Woo! > > It worked for playback, but completely broke recording. I've missed that > your CODEC does not support input switching in hardware, while driver > does not support that in software. For playback software switching is > supported by the driver, so it worked. Patch below should give you > automatic switching on playback, but still two separate recording devices. > >> So how'd it actually map the correct selection between headphones and >> speaker? That's now cutting back and forth correctly as I plug in and >> out the headphone jack. > > It tells the driver that those two inputs should be parts of one output > device, and driver following HDA specifications reads jack presence > information from respective CODEC pins. Sound actually played to both > outputs, but driver mutes one of them, depending on jack presence. > > Lenovo engineers configured the CODEC to report each pin as separate > audio device, but the problem that our sound(4) does not support > automatic switching between them. :( > >> On 27 July 2014 01:40, Adrian Chadd wrote: >>> ok, with that it looks like: >>> >>> hdaa0: 2 associations found: >>> hdaa0: Association 0 (1) out: >>> hdaa0: Pin nid=26 seq=0 >>> hdaa0: Pin nid=22 seq=15 >>> hdaa0: Association 1 (2) in: >>> hdaa0: Pin nid=29 seq=0 >>> hdaa0: Pin nid=24 seq=14 >>> hdaa0: Tracing association 0 (1) >>> hdaa0: Pin 26 traced to DAC 16 >>> hdaa0: Pin 22 traced to DAC 16 and hpredir 0 >>> hdaa0: Association 0 (1) trace succeeded >>> hdaa0: Tracing association 1 (2) >>> hdaa0: Pin 29 traced to ADC 20 >>> hdaa0: Unable to trace pin 24 to ADC 20, undo traces >>> hdaa0: Unable to trace pin 29 to ADC 21, undo traces >>> hdaa0: Association 1 (2) trace failed > > Index: hdaa_patches.c > =================================================================== > --- hdaa_patches.c (revision 269151) > +++ hdaa_patches.c (working copy) > @@ -346,6 +346,16 @@ hdac_pin_patch(struct hdaa_widget *w) > patch = "as=1 seq=15"; > break; > } > + } else if (id == HDA_CODEC_CX20561 && > + subid == LENOVO_ZZZ_SUBVENDOR) { > + switch (nid) { > + case 22: > + patch = "as=1 seq=15"; > + break; > + case 26: > + patch = "as=1 seq=0"; > + break; > + } > } else if (id == HDA_CODEC_CX20590 && > (subid == LENOVO_X1_SUBVENDOR || > subid == LENOVO_X220_SUBVENDOR || > Index: hdac.h > =================================================================== > --- hdac.h (revision 269151) > +++ hdac.h (working copy) > @@ -236,6 +236,7 @@ > #define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) > #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) > #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) > +#define LENOVO_ZZZ_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20f2) > #define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) > #define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) > #define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) > > > -- > Alexander Motin From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 16:12:54 2014 Return-Path: Delivered-To: svn-src-all@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 A7606BE5; Sun, 27 Jul 2014 16:12: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8850129BA; Sun, 27 Jul 2014 16:12:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6RGCsEu086320; Sun, 27 Jul 2014 16:12:54 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6RGCpeY086298; Sun, 27 Jul 2014 16:12:51 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407271612.s6RGCpeY086298@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 27 Jul 2014 16:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269153 - in head/sys/boot: amd64/efi common i386/libi386 i386/loader mips/beri/loader ofw/common pc98/loader powerpc/ps3 sparc64/loader uboot/common userboot/userboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 16:12:54 -0000 Author: marcel Date: Sun Jul 27 16:12:51 2014 New Revision: 269153 URL: http://svnweb.freebsd.org/changeset/base/269153 Log: Give loaders more control over the Forth initialization process. In particular, allow loaders to define the name of the RC script the interpreter needs to use. Use this new-found control to have the PXE loader (when compiled with TFTP support and not NFS support) read from ${bootfile}.4th, where ${bootfile} is the name of the file fetched by the PXE firmware. The normal startup process involves reading the following files: 1. /boot/boot.4th 2. /boot/loader.rc or alternatively /boot/boot.conf When these come from a FreeBSD-defined file system, this is all good. But when we boot over the network, subdirectories and fixed file names are often painful to administrators and there's really no way for them to change the behaviour of the loader. Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/amd64/efi/main.c head/sys/boot/common/bootstrap.h head/sys/boot/common/interp.c head/sys/boot/common/interp_forth.c head/sys/boot/i386/libi386/libi386.h head/sys/boot/i386/libi386/pxe.c head/sys/boot/i386/loader/main.c head/sys/boot/mips/beri/loader/main.c head/sys/boot/ofw/common/main.c head/sys/boot/pc98/loader/main.c head/sys/boot/powerpc/ps3/main.c head/sys/boot/sparc64/loader/main.c head/sys/boot/uboot/common/main.c head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/amd64/efi/main.c ============================================================================== --- head/sys/boot/amd64/efi/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/amd64/efi/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -124,7 +124,7 @@ main(int argc, CHAR16 *argv[]) archsw.arch_copyout = x86_efi_copyout; archsw.arch_readin = x86_efi_readin; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (EFI_SUCCESS); /* keep compiler happy */ } Modified: head/sys/boot/common/bootstrap.h ============================================================================== --- head/sys/boot/common/bootstrap.h Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/common/bootstrap.h Sun Jul 27 16:12:51 2014 (r269153) @@ -59,7 +59,7 @@ extern char command_errbuf[]; /* XXX bla #define CMD_ERROR 1 /* interp.c */ -void interact(void); +void interact(const char *rc); int include(const char *filename); /* interp_backslash.c */ @@ -69,7 +69,7 @@ char *backslash(char *str); int parse(int *argc, char ***argv, char *str); /* interp_forth.c */ -void bf_init(void); +void bf_init(const char *rc); int bf_run(char *line); /* boot.c */ Modified: head/sys/boot/common/interp.c ============================================================================== --- head/sys/boot/common/interp.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/common/interp.c Sun Jul 27 16:12:51 2014 (r269153) @@ -90,7 +90,7 @@ perform(int argc, char *argv[]) * Interactive mode */ void -interact(void) +interact(const char *rc) { static char input[256]; /* big enough? */ #ifndef BOOT_FORTH @@ -99,15 +99,18 @@ interact(void) #endif #ifdef BOOT_FORTH - bf_init(); + bf_init((rc) ? "" : NULL); #endif - /* - * Read our default configuration - */ - if (include("/boot/loader.rc") != CMD_OK) - include("/boot/boot.conf"); + if (rc == NULL) { + /* Read our default configuration. */ + if (include("/boot/loader.rc") != CMD_OK) + include("/boot/boot.conf"); + } else if (*rc != '\0') + include(rc); + printf("\n"); + /* * Before interacting, we might want to autoboot. */ Modified: head/sys/boot/common/interp_forth.c ============================================================================== --- head/sys/boot/common/interp_forth.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/common/interp_forth.c Sun Jul 27 16:12:51 2014 (r269153) @@ -241,7 +241,7 @@ bf_command(FICL_VM *vm) * Initialise the Forth interpreter, create all our commands as words. */ void -bf_init(void) +bf_init(const char *rc) { struct bootblk_command **cmdp; char create_buf[41]; /* 31 characters-long builtins */ @@ -271,13 +271,20 @@ bf_init(void) ficlSetEnv(bf_sys, "loader_version", (bootprog_rev[0] - '0') * 10 + (bootprog_rev[2] - '0')); + pInterp = ficlLookup(bf_sys, "interpret"); + /* try to load and run init file if present */ - if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { - (void)ficlExecFD(bf_vm, fd); - close(fd); + if (rc == NULL) + rc = "/boot/boot.4th"; + if (*rc != '\0') { + fd = open(rc, O_RDONLY); + if (fd != -1) { + (void)ficlExecFD(bf_vm, fd); + close(fd); + } } - /* Do this last, so /boot/boot.4th can change it */ + /* Do this again, so that interpret can be redefined. */ pInterp = ficlLookup(bf_sys, "interpret"); } Modified: head/sys/boot/i386/libi386/libi386.h ============================================================================== --- head/sys/boot/i386/libi386/libi386.h Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/i386/libi386/libi386.h Sun Jul 27 16:12:51 2014 (r269153) @@ -121,4 +121,5 @@ int bi_load32(char *args, int *howtop, i vm_offset_t *modulep, vm_offset_t *kernend); int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend); +char *pxe_default_rc(void); void pxe_enable(void *pxeinfo); Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/i386/libi386/pxe.c Sun Jul 27 16:12:51 2014 (r269153) @@ -694,3 +694,26 @@ readudp(struct iodesc *h, void *pkt, siz uh->uh_sport = udpread_p->s_port; return udpread_p->buffer_size; } + +char * +pxe_default_rc(void) +{ + char *rc; + size_t count, rcsz; + + /* XXX It may not be a good idea to modify the PXE boot file. */ + rc = (char *)bootplayer.bootfile; + rcsz = sizeof(bootplayer.bootfile); + + /* Ignore how we define rc and rcsz above -- it can change. */ + if (rcsz < 6) + return (NULL); + if (*rc == '\0') { + strncpy(rc, "pxeboot", rcsz); + rc[rcsz - 1] = '\0'; + } + count = strlen(rc); + strncat(rc, ".4th", rcsz - count - 1); + printf("PXE: loading Forth from %s\n", rc); + return (rc); +} Modified: head/sys/boot/i386/loader/main.c ============================================================================== --- head/sys/boot/i386/loader/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/i386/loader/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -192,7 +192,12 @@ main(void) bios_getsmap(); - interact(); /* doesn't return */ +#ifdef LOADER_TFTP_SUPPORT + if (kargs->bootflags & KARGS_FLAGS_PXE) + interact(pxe_default_rc()); + else +#endif + interact(NULL); /* if we ever get here, it is an error */ return (1); Modified: head/sys/boot/mips/beri/loader/main.c ============================================================================== --- head/sys/boot/mips/beri/loader/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/mips/beri/loader/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -151,7 +151,7 @@ main(int argc, char *argv[], char *envv[ printf("bootpath=\"%s\"\n", bootpath); #endif - interact(); + interact(NULL); return (0); } Modified: head/sys/boot/ofw/common/main.c ============================================================================== --- head/sys/boot/ofw/common/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/ofw/common/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -162,7 +162,7 @@ main(int (*openfirm)(void *)) archsw.arch_readin = ofw_readin; archsw.arch_autoload = ofw_autoload; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ OF_exit(); Modified: head/sys/boot/pc98/loader/main.c ============================================================================== --- head/sys/boot/pc98/loader/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/pc98/loader/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -193,7 +193,7 @@ main(void) extract_currdev(); /* set $currdev and $loaddev */ setenv("LINES", "24", 1); /* optional */ - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ /* if we ever get here, it is an error */ return (1); Modified: head/sys/boot/powerpc/ps3/main.c ============================================================================== --- head/sys/boot/powerpc/ps3/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/powerpc/ps3/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -145,7 +145,7 @@ main(void) setenv("LINES", "24", 1); setenv("hw.platform", "ps3", 1); - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (0); } Modified: head/sys/boot/sparc64/loader/main.c ============================================================================== --- head/sys/boot/sparc64/loader/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/sparc64/loader/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -897,7 +897,7 @@ main(int (*openfirm)(void *)) printf("bootpath=\"%s\"\n", bootpath); /* Give control to the machine independent loader code. */ - interact(); + interact(NULL); return (1); } Modified: head/sys/boot/uboot/common/main.c ============================================================================== --- head/sys/boot/uboot/common/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/uboot/common/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -492,7 +492,7 @@ main(void) archsw.arch_readin = uboot_readin; archsw.arch_autoload = uboot_autoload; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ return (0); } Modified: head/sys/boot/userboot/userboot/main.c ============================================================================== --- head/sys/boot/userboot/userboot/main.c Sun Jul 27 08:44:15 2014 (r269152) +++ head/sys/boot/userboot/userboot/main.c Sun Jul 27 16:12:51 2014 (r269153) @@ -141,7 +141,7 @@ loader_main(struct loader_callbacks *cb, if (setjmp(jb)) return; - interact(); /* doesn't return */ + interact(NULL); /* doesn't return */ exit(0); } From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 16:29:57 2014 Return-Path: Delivered-To: svn-src-all@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 C283850E; Sun, 27 Jul 2014 16:29: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9550C2AE9; Sun, 27 Jul 2014 16:29:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6RGTvqi092337; Sun, 27 Jul 2014 16:29:57 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6RGTvMf092336; Sun, 27 Jul 2014 16:29:57 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407271629.s6RGTvMf092336@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 27 Jul 2014 16:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269154 - head/sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 16:29:57 -0000 Author: marcel Date: Sun Jul 27 16:29:57 2014 New Revision: 269154 URL: http://svnweb.freebsd.org/changeset/base/269154 Log: 1. Suppress output for the TFTP-based PXE loader, but leave it in place for the NFS-based PXE loader. Information like rootpath or rootip aren't that useful for TFTP and the gateway IP is typically already printed by the firmware. 2. Only set boot.nfsroot.* environment variables for NFS. This makes it possible for the OS to work either way by checking for the presence or absence of environment variables. 3. Set boot.netif.server when using TFTP so that the OS can fetch files as well. A typical use case for this is network-based installations with the installation process implemented on top of FreeBSD. 4. The pxelinux loader has a set of alternative names it tries for configuration files. Make it easier to do something similar in Forth by providing the IP address as a 32-bit hex number in the pxeboot.ip variable and the MAC address with dashes in the pxeboot.hwaddr environment variable. Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/i386/libi386/pxe.c Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Sun Jul 27 16:12:51 2014 (r269153) +++ head/sys/boot/i386/libi386/pxe.c Sun Jul 27 16:29:57 2014 (r269154) @@ -301,10 +301,6 @@ pxe_open(struct open_file *f, ...) bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); } - printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); - printf("pxe_open: server path: %s\n", rootpath); - printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); - setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); @@ -312,9 +308,24 @@ pxe_open(struct open_file *f, ...) sprintf(temp, "%6D", bootplayer.CAddr, ":"); setenv("boot.netif.hwaddr", temp, 1); } +#ifdef LOADER_NFS_SUPPORT + printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); + printf("pxe_open: server path: %s\n", rootpath); + printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); + setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); setenv("boot.nfsroot.path", rootpath, 1); +#else + setenv("boot.netif.server", inet_ntoa(rootip), 1); +#endif setenv("dhcp.host-name", hostname, 1); + + sprintf(temp, "%08X", ntohl(myip.s_addr)); + setenv("pxeboot.ip", temp, 1); + if (bootplayer.Hardware == ETHER_TYPE) { + sprintf(temp, "%6D", bootplayer.CAddr, "-"); + setenv("pxeboot.hwaddr", temp, 1); + } } } pxe_opens++; From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 17:34:49 2014 Return-Path: Delivered-To: svn-src-all@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 C38F5C0; Sun, 27 Jul 2014 17:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B05D320AC; Sun, 27 Jul 2014 17:34:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RHYniu032776; Sun, 27 Jul 2014 17:34:49 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RHYnYe032775; Sun, 27 Jul 2014 17:34:49 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201407271734.s6RHYnYe032775@svn.freebsd.org> From: Peter Wemm Date: Sun, 27 Jul 2014 17:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269155 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 17:34:49 -0000 Author: peter Date: Sun Jul 27 17:34:49 2014 New Revision: 269155 URL: http://svnweb.freebsd.org/changeset/base/269155 Log: Forced commit - testing commit mail etc pipelines. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Jul 27 16:29:57 2014 (r269154) +++ head/UPDATING Sun Jul 27 17:34:49 2014 (r269155) @@ -1,4 +1,4 @@ -Updating Information for FreeBSD current users +Updating Information for FreeBSD current users. This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 18:07:26 2014 Return-Path: Delivered-To: svn-src-all@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 E31E4941; Sun, 27 Jul 2014 18:07:26 +0000 (UTC) Received: from felyko.com (felyko.com [IPv6:2001:470:1:2d5:26:3:1337:ca7]) by mx1.freebsd.org (Postfix) with ESMTP id C40232379; Sun, 27 Jul 2014 18:07:26 +0000 (UTC) Received: from [IPv6:2601:9:8280:5fd:2427:9cfd:cbe3:fde2] (unknown [IPv6:2601:9:8280:5fd:2427:9cfd:cbe3:fde2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by felyko.com (Postfix) with ESMTPSA id 676FE34A9E4; Sun, 27 Jul 2014 11:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=felyko.com; s=mail; t=1406484446; bh=zXjH/xvcotaHskHj1DWjSFHptKKJmUBKLqdVjm+zyq4=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=mLWC5t3XWSkuz/Ip6Rsalw0/Z8/zyWLvNMQXZ/Ro6LU0M/nYJsyNWpryEovuyJG2f oTjEtVdWnQh6d84Dd4gsB+3BFzgXuYTNU51at4mJZ6HfJfBbzTsm8VlrJNEKTNnpRu W/Yn7FSbYtSJzKmuR7Lt7MlJV0uI2Od/6OlUQD54= Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269152 - head/sys/dev/sound/pci/hda From: Rui Paulo In-Reply-To: <201407270844.s6R8iG8s075634@svn.freebsd.org> Date: Sun, 27 Jul 2014 11:07:23 -0700 Content-Transfer-Encoding: 7bit Message-Id: <29F33138-FE01-4E3F-BDBD-5BB4D63724DE@felyko.com> References: <201407270844.s6R8iG8s075634@svn.freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 18:07:27 -0000 On Jul 27, 2014, at 1:44, Adrian Chadd wrote: > Author: adrian > Date: Sun Jul 27 08:44:15 2014 > New Revision: 269152 > URL: http://svnweb.freebsd.org/changeset/base/269152 > > Log: > Add support for my Lenovo T400. > > Tested: > > * Lenovo T400, model w/ P8700 Intel CPU on-board Don't forget to MFC :-) -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 18:08:48 2014 Return-Path: Delivered-To: svn-src-all@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 B33E0A98; Sun, 27 Jul 2014 18:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F8F82386; Sun, 27 Jul 2014 18:08:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RI8mIZ046917; Sun, 27 Jul 2014 18:08:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RI8mSI046916; Sun, 27 Jul 2014 18:08:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407271808.s6RI8mSI046916@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 27 Jul 2014 18:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269156 - stable/10/sys/fs/nullfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 18:08:48 -0000 Author: kib Date: Sun Jul 27 18:08:47 2014 New Revision: 269156 URL: http://svnweb.freebsd.org/changeset/base/269156 Log: MFC r269081: Fix typo. Modified: stable/10/sys/fs/nullfs/null_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/10/sys/fs/nullfs/null_vnops.c Sun Jul 27 17:34:49 2014 (r269155) +++ stable/10/sys/fs/nullfs/null_vnops.c Sun Jul 27 18:08:47 2014 (r269156) @@ -738,7 +738,7 @@ null_reclaim(struct vop_reclaim_args *ap lowervp = xp->null_lowervp; KASSERT(lowervp != NULL && vp->v_vnlock != &vp->v_lock, - ("Reclaiming inclomplete null vnode %p", vp)); + ("Reclaiming incomplete null vnode %p", vp)); null_hashrem(xp); /* From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 18:10:08 2014 Return-Path: Delivered-To: svn-src-all@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 2AAEAD4C; Sun, 27 Jul 2014 18:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1715723AB; Sun, 27 Jul 2014 18:10:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RIA7wF047285; Sun, 27 Jul 2014 18:10:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RIA7hv047284; Sun, 27 Jul 2014 18:10:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407271810.s6RIA7hv047284@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 27 Jul 2014 18:10:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269157 - stable/9/sys/fs/nullfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 18:10:08 -0000 Author: kib Date: Sun Jul 27 18:10:07 2014 New Revision: 269157 URL: http://svnweb.freebsd.org/changeset/base/269157 Log: MFC r269081: Fix typo. Modified: stable/9/sys/fs/nullfs/null_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/9/sys/fs/nullfs/null_vnops.c Sun Jul 27 18:08:47 2014 (r269156) +++ stable/9/sys/fs/nullfs/null_vnops.c Sun Jul 27 18:10:07 2014 (r269157) @@ -738,7 +738,7 @@ null_reclaim(struct vop_reclaim_args *ap lowervp = xp->null_lowervp; KASSERT(lowervp != NULL && vp->v_vnlock != &vp->v_lock, - ("Reclaiming inclomplete null vnode %p", vp)); + ("Reclaiming incomplete null vnode %p", vp)); null_hashrem(xp); /* From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:10:45 2014 Return-Path: Delivered-To: svn-src-all@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 3AD18E3A; Sun, 27 Jul 2014 20:10:45 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDED62176; Sun, 27 Jul 2014 20:10:44 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 725071FE027; Sun, 27 Jul 2014 22:10:42 +0200 (CEST) Message-ID: <53D55CD9.4000408@selasky.org> Date: Sun, 27 Jul 2014 22:11:05 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:10:45 -0000 On 07/27/14 02:10, Adrian Chadd wrote: > On 26 July 2014 12:13, Hans Petter Selasky wrote: >> On 07/26/14 20:36, Adrian Chadd wrote: >>> >>> Hi, >>> >>> We should likely review how the PLCP bits are being used and why it's >>> getting a rate of 0 in the first place. >>> >>> So, why's it getting a rate of 0 passed into the transmit path? >>> >>> >> >> Hi Adrian, >> >> Here is the backtrace of the panic: >> >> Fatal trap 18: integer divide fault while in kernel mode >> cpuid = 2; apic id = 02 >> instruction pointer = 0x20:0xffffffff807826cf >> stack pointer = 0x28:0xffffff8000305090 >> frame pointer = 0x28:0xffffff80003050a0 >> code segment = base 0x0, limit 0xfffff, type 0x1b >> = DPL 0, pres 1, long 1, def32 0, gran 1 >> processor eflags = interrupt enabled, resume, IOPL = 0 >> current process = 15 (usbus0) >> trap number = 18 >> panic: integer divide fault >> cpuid = 2 >> KDB: stack backtrace: >> #0 0xffffffff809257e6 at kdb_backtrace+0x66 >> #1 0xffffffff808eb3ae at panic+0x1ce >> #2 0xffffffff80cd2c30 at trap_fatal+0x290 >> #3 0xffffffff80cd3480 at trap+0x250 >> #4 0xffffffff80cbc783 at calltrap+0x8 >> #5 0xffffffff80783d90 at ural_start+0x1d0 >> #6 0xffffffff809aa2ea at if_transmit+0xea >> #7 0xffffffff809ef7b2 at ieee80211_start+0x542 >> #8 0xffffffff809aa2ea at if_transmit+0xea >> #9 0xffffffff809ae8b3 at ether_output_frame+0x33 >> #10 0xffffffff809aee30 at ether_output+0x530 >> #11 0xffffffff80a186b4 at ip_output+0xd74 >> #12 0xffffffff80a87d2a at tcp_output+0xfea >> #13 0xffffffff80a82222 at tcp_do_segment+0xc02 >> #14 0xffffffff80a85219 at tcp_input+0xa29 >> #15 0xffffffff80a155fa at ip_input+0xaa >> #16 0xffffffff809b7808 at netisr_dispatch_src+0x218 >> #17 0xffffffff809ae3fd at ether_demux+0x14d > > Hm, so at some point that rate was not assigned to something. Can you > trace the ural_start path to see where it's supposed to be calculating > the rate? > Rate comes from this: tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) rate = tp->mcastrate; else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) rate = tp->ucastrate; else rate = ni->ni_txrate; --HPS From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:14:10 2014 Return-Path: Delivered-To: svn-src-all@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 8A83011D; Sun, 27 Jul 2014 20:14:10 +0000 (UTC) Received: from mail-qa0-x235.google.com (mail-qa0-x235.google.com [IPv6:2607:f8b0:400d:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 272C622AB; Sun, 27 Jul 2014 20:14:10 +0000 (UTC) Received: by mail-qa0-f53.google.com with SMTP id v10so6764123qac.40 for ; Sun, 27 Jul 2014 13:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Lp1IdVZCo4Y4KwIXsfUkuWngJeAIT0du96hSug0Pfqk=; b=okYDDU0p3AiXR0DM8QSIr+nW8nd3TDkJ89AgDjXsralFw4B7+SXI7AJZeQ0Rv3l2fk JKv0fd389p6wBWzXqd+WN4FsdnzxIF8zycUE/WltmURwKMVwCjOFJtjQhg5I5hCYYag4 xVNh2PZQeZgUHUR5Kq5ikBNLVD1QhDL5N8Vlwq5LzdUCob9VWLYRfaG9jtOK6hMCY7If eay8ZVc75jaI6XErF1E7o2hFLwENIi55bl4yHcYRouCBRhm0jdLitPB18UXZm+VZoh/+ nosTJrqUzTC0ykA/5lUySpDFKaIDkndMLu9b5ZYGkbr6Z/cT56cGKaTux/dLAhdjPuOj ic/Q== MIME-Version: 1.0 X-Received: by 10.140.102.142 with SMTP id w14mr51743321qge.101.1406492048681; Sun, 27 Jul 2014 13:14:08 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 13:14:08 -0700 (PDT) In-Reply-To: <29F33138-FE01-4E3F-BDBD-5BB4D63724DE@felyko.com> References: <201407270844.s6R8iG8s075634@svn.freebsd.org> <29F33138-FE01-4E3F-BDBD-5BB4D63724DE@felyko.com> Date: Sun, 27 Jul 2014 13:14:08 -0700 X-Google-Sender-Auth: Kd4pNpPNqQtIFOoyKWrtvt2T5YU Message-ID: Subject: Re: svn commit: r269152 - head/sys/dev/sound/pci/hda From: Adrian Chadd To: Rui Paulo 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:14:10 -0000 On 27 July 2014 11:07, Rui Paulo wrote: > On Jul 27, 2014, at 1:44, Adrian Chadd wrote: > >> Author: adrian >> Date: Sun Jul 27 08:44:15 2014 >> New Revision: 269152 >> URL: http://svnweb.freebsd.org/changeset/base/269152 >> >> Log: >> Add support for my Lenovo T400. >> >> Tested: >> >> * Lenovo T400, model w/ P8700 Intel CPU on-board > > Don't forget to MFC :-) > Once it's actually working, sure. :) -a From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:14:23 2014 Return-Path: Delivered-To: svn-src-all@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 5F972258; Sun, 27 Jul 2014 20:14: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C87B22B0; Sun, 27 Jul 2014 20:14:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RKENNv020494; Sun, 27 Jul 2014 20:14:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RKEN4T020467; Sun, 27 Jul 2014 20:14:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201407272014.s6RKEN4T020467@svn.freebsd.org> From: Adrian Chadd Date: Sun, 27 Jul 2014 20:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269158 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:14:23 -0000 Author: adrian Date: Sun Jul 27 20:14:22 2014 New Revision: 269158 URL: http://svnweb.freebsd.org/changeset/base/269158 Log: Update from mav@ - don't break the input switching. Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 27 18:10:07 2014 (r269157) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Sun Jul 27 20:14:22 2014 (r269158) @@ -352,15 +352,9 @@ hdac_pin_patch(struct hdaa_widget *w) case 22: patch = "as=1 seq=15"; break; - case 24: - patch = "as=2 seq=14"; - break; case 26: patch = "as=1 seq=0"; break; - case 29: - patch = "as=2 seq=0"; - break; } } else if (id == HDA_CODEC_CX20590 && (subid == LENOVO_X1_SUBVENDOR || From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:15:18 2014 Return-Path: Delivered-To: svn-src-all@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 671CB39A; Sun, 27 Jul 2014 20:15:18 +0000 (UTC) Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com [IPv6:2607:f8b0:400d:c04::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 03F0A22B8; Sun, 27 Jul 2014 20:15:17 +0000 (UTC) Received: by mail-qg0-f53.google.com with SMTP id q107so7366813qgd.26 for ; Sun, 27 Jul 2014 13:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=WREq847eXUnO3qqs4Xg4oUlcl2P02xlX8TE2XFMVuyg=; b=R5dTG4gyqF4Efa5uBeLTeyU+GoYquOWKePl+L4uZm3/LfTXfLN4UtmCXwGaoUD0Ih5 LcYCM+T5bbD75r/wDguRAd7NyvQUCIozLMC6fpCR/xb6nPVO1tul/hUgm1VSiUMa6pyy DVILa4nb4/TC1t3mrf5otgCXRg7TGTqBFAX9ZXRYe/Dbbe/wwX3t/PLE4QGseY5Z+s0g BOyrGwtoJF+3BiZy+FFj2PXXoc8zaDH+SnYFwEu8gP7bc1b2VbatKGSZ0CXVz9SbdGz/ 2CJabzeLS4MEj8f0cN9IgnJ+7Dd/wdeyIkHbpobtqJhrS7V3ky5ivE3X9jyxLRSdT77P 3urQ== MIME-Version: 1.0 X-Received: by 10.140.107.4 with SMTP id g4mr39561658qgf.100.1406492117110; Sun, 27 Jul 2014 13:15:17 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Sun, 27 Jul 2014 13:15:17 -0700 (PDT) In-Reply-To: <53D55CD9.4000408@selasky.org> References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> <53D55CD9.4000408@selasky.org> Date: Sun, 27 Jul 2014 13:15:17 -0700 X-Google-Sender-Auth: eV8T7byBiHsPof08pTsNnieEneI Message-ID: Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:15:18 -0000 Hi, Ok. So, which one of those is showing up as 0? Maybe refactor out the rate lookup code and if it's zero, log an error and reset it to either 2 (for 11ng) or 12 (11a.) '2' isn't valid for 11a - the minimum rate is 6mb. -a On 27 July 2014 13:11, Hans Petter Selasky wrote: > On 07/27/14 02:10, Adrian Chadd wrote: >> >> On 26 July 2014 12:13, Hans Petter Selasky wrote: >>> >>> On 07/26/14 20:36, Adrian Chadd wrote: >>>> >>>> >>>> Hi, >>>> >>>> We should likely review how the PLCP bits are being used and why it's >>>> getting a rate of 0 in the first place. >>>> >>>> So, why's it getting a rate of 0 passed into the transmit path? >>>> >>>> >>> >>> Hi Adrian, >>> >>> Here is the backtrace of the panic: >>> >>> Fatal trap 18: integer divide fault while in kernel mode >>> cpuid = 2; apic id = 02 >>> instruction pointer = 0x20:0xffffffff807826cf >>> stack pointer = 0x28:0xffffff8000305090 >>> frame pointer = 0x28:0xffffff80003050a0 >>> code segment = base 0x0, limit 0xfffff, type 0x1b >>> = DPL 0, pres 1, long 1, def32 0, gran 1 >>> processor eflags = interrupt enabled, resume, IOPL = 0 >>> current process = 15 (usbus0) >>> trap number = 18 >>> panic: integer divide fault >>> cpuid = 2 >>> KDB: stack backtrace: >>> #0 0xffffffff809257e6 at kdb_backtrace+0x66 >>> #1 0xffffffff808eb3ae at panic+0x1ce >>> #2 0xffffffff80cd2c30 at trap_fatal+0x290 >>> #3 0xffffffff80cd3480 at trap+0x250 >>> #4 0xffffffff80cbc783 at calltrap+0x8 >>> #5 0xffffffff80783d90 at ural_start+0x1d0 >>> #6 0xffffffff809aa2ea at if_transmit+0xea >>> #7 0xffffffff809ef7b2 at ieee80211_start+0x542 >>> #8 0xffffffff809aa2ea at if_transmit+0xea >>> #9 0xffffffff809ae8b3 at ether_output_frame+0x33 >>> #10 0xffffffff809aee30 at ether_output+0x530 >>> #11 0xffffffff80a186b4 at ip_output+0xd74 >>> #12 0xffffffff80a87d2a at tcp_output+0xfea >>> #13 0xffffffff80a82222 at tcp_do_segment+0xc02 >>> #14 0xffffffff80a85219 at tcp_input+0xa29 >>> #15 0xffffffff80a155fa at ip_input+0xaa >>> #16 0xffffffff809b7808 at netisr_dispatch_src+0x218 >>> #17 0xffffffff809ae3fd at ether_demux+0x14d >> >> >> Hm, so at some point that rate was not assigned to something. Can you >> trace the ural_start path to see where it's supposed to be calculating >> the rate? >> > > Rate comes from this: > > tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; > if (IEEE80211_IS_MULTICAST(wh->i_addr1)) > rate = tp->mcastrate; > else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) > rate = tp->ucastrate; > else > rate = ni->ni_txrate; > > --HPS From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:47:08 2014 Return-Path: Delivered-To: svn-src-all@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 1B40EC83; Sun, 27 Jul 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0847F265F; Sun, 27 Jul 2014 20:47:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RKl7M8090631; Sun, 27 Jul 2014 20:47:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RKl76K090630; Sun, 27 Jul 2014 20:47:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407272047.s6RKl76K090630@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 27 Jul 2014 20:47:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269159 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:47:08 -0000 Author: kib Date: Sun Jul 27 20:47:06 2014 New Revision: 269159 URL: http://svnweb.freebsd.org/changeset/base/269159 Log: Correct the locking statement. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/share/man/man9/VOP_INACTIVE.9 Modified: head/share/man/man9/VOP_INACTIVE.9 ============================================================================== --- head/share/man/man9/VOP_INACTIVE.9 Sun Jul 27 20:14:22 2014 (r269158) +++ head/share/man/man9/VOP_INACTIVE.9 Sun Jul 27 20:47:06 2014 (r269159) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd July 27, 2014 .Dt VOP_INACTIVE 9 .Os .Sh NAME @@ -63,17 +63,13 @@ is called when a vnode is being reused f Any file system specific resources associated with the vnode should be freed. .Sh LOCKS -For VOP_INACTIVE, the -.Fa vp -will be locked on entry. -Your VOP_INACTIVE code -must unlock the -.Fa vp -prior to returning. -.Pp -For VOP_RECLAIM, the +For both +.Fn VOP_INACTIVE +and +.Fn VOP_RECLAIM , +the .Fa vp -will not be locked on entry and should be left unlocked on return. +will be locked on entry, and must be left locked on return. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:48:57 2014 Return-Path: Delivered-To: svn-src-all@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 2A65FDDA; Sun, 27 Jul 2014 20:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17A592673; Sun, 27 Jul 2014 20:48:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RKmuPa090895; Sun, 27 Jul 2014 20:48:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RKmuIU090894; Sun, 27 Jul 2014 20:48:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407272048.s6RKmuIU090894@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 27 Jul 2014 20:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269160 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:48:57 -0000 Author: kib Date: Sun Jul 27 20:48:56 2014 New Revision: 269160 URL: http://svnweb.freebsd.org/changeset/base/269160 Log: Remove man page for non-existent VOPs. Sponsored by: The FreeBSD Foundation MFC after: 3 days Deleted: head/share/man/man9/VOP_GETVOBJECT.9 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Jul 27 20:47:06 2014 (r269159) +++ head/share/man/man9/Makefile Sun Jul 27 20:48:56 2014 (r269160) @@ -358,7 +358,6 @@ MAN= accept_filter.9 \ VOP_GETACL.9 \ VOP_GETEXTATTR.9 \ VOP_GETPAGES.9 \ - VOP_GETVOBJECT.9 \ VOP_INACTIVE.9 \ VOP_IOCTL.9 \ VOP_LINK.9 \ @@ -1559,8 +1558,6 @@ MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \ VOP_CREATE.9 VOP_MKNOD.9 \ VOP_CREATE.9 VOP_SYMLINK.9 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9 -MLINKS+=VOP_GETVOBJECT.9 VOP_CREATEVOBJECT.9 \ - VOP_GETVOBJECT.9 VOP_DESTROYVOBJECT.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 MLINKS+=VOP_LOCK.9 vn_lock.9 \ VOP_LOCK.9 VOP_ISLOCKED.9 \ From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 20:55:48 2014 Return-Path: Delivered-To: svn-src-all@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 44EF67B; Sun, 27 Jul 2014 20:55: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 326CA278A; Sun, 27 Jul 2014 20:55:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RKtmMC094961; Sun, 27 Jul 2014 20:55:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RKtmw1094960; Sun, 27 Jul 2014 20:55:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407272055.s6RKtmw1094960@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 27 Jul 2014 20:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269161 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 20:55:48 -0000 Author: kib Date: Sun Jul 27 20:55:47 2014 New Revision: 269161 URL: http://svnweb.freebsd.org/changeset/base/269161 Log: Explicitely mention that inactivated or reclaimed vnode is locked exclusively. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/share/man/man9/VOP_INACTIVE.9 Modified: head/share/man/man9/VOP_INACTIVE.9 ============================================================================== --- head/share/man/man9/VOP_INACTIVE.9 Sun Jul 27 20:48:56 2014 (r269160) +++ head/share/man/man9/VOP_INACTIVE.9 Sun Jul 27 20:55:47 2014 (r269161) @@ -69,7 +69,8 @@ and .Fn VOP_RECLAIM , the .Fa vp -will be locked on entry, and must be left locked on return. +will be exclusively locked on entry, and must be left exclusively +locked on return. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 22:54:16 2014 Return-Path: Delivered-To: svn-src-all@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 8D04B8A7; Sun, 27 Jul 2014 22:54: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E5A22128; Sun, 27 Jul 2014 22:54:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RMsG7t049566; Sun, 27 Jul 2014 22:54:16 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RMsE4E049551; Sun, 27 Jul 2014 22:54:14 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407272254.s6RMsE4E049551@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 27 Jul 2014 22:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269162 - in head/usr.bin/m4: . lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 22:54:16 -0000 Author: bapt Date: Sun Jul 27 22:54:13 2014 New Revision: 269162 URL: http://svnweb.freebsd.org/changeset/base/269162 Log: Sync with OpenBSD This brings: - check for integer overflows in custom allocs - fix potential integer overflows in memory allocation - annotate regexp error messages with source string - better error handling in mkstemp/unlink/fdopen logic Added: head/usr.bin/m4/lib/ohash.c (contents, props changed) Deleted: head/usr.bin/m4/lib/ohash_create_entry.c head/usr.bin/m4/lib/ohash_delete.c head/usr.bin/m4/lib/ohash_do.c head/usr.bin/m4/lib/ohash_entries.c head/usr.bin/m4/lib/ohash_enum.c head/usr.bin/m4/lib/ohash_init.c head/usr.bin/m4/lib/ohash_interval.c head/usr.bin/m4/lib/ohash_lookup_interval.c head/usr.bin/m4/lib/ohash_lookup_memory.c head/usr.bin/m4/lib/ohash_qlookup.c head/usr.bin/m4/lib/ohash_qlookupi.c Modified: head/usr.bin/m4/Makefile head/usr.bin/m4/eval.c head/usr.bin/m4/extern.h head/usr.bin/m4/gnum4.c head/usr.bin/m4/lib/ohash.h head/usr.bin/m4/lib/ohash_init.3 head/usr.bin/m4/lib/ohash_interval.3 head/usr.bin/m4/look.c head/usr.bin/m4/m4.1 head/usr.bin/m4/main.c head/usr.bin/m4/misc.c Modified: head/usr.bin/m4/Makefile ============================================================================== --- head/usr.bin/m4/Makefile Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/Makefile Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2002/04/26 13:13:41 espie Exp $ +# $OpenBSD: Makefile,v 1.13 2014/05/12 19:11:19 espie Exp $ # $FreeBSD$ # -DEXTENDED @@ -15,10 +15,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS= SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l .PATH: ${.CURDIR}/lib -SRCS+= ohash_create_entry.c ohash_delete.c ohash_do.c ohash_entries.c \ - ohash_enum.c ohash_init.c ohash_int.h ohash_interval.c \ - ohash_lookup_interval.c ohash_lookup_memory.c ohash_qlookup.c \ - ohash_qlookupi.c +SRCS+= ohash.c tokenizer.o: parser.h Modified: head/usr.bin/m4/eval.c ============================================================================== --- head/usr.bin/m4/eval.c Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/eval.c Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.70 2012/04/12 17:00:11 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.73 2014/07/11 21:04:17 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -267,7 +267,7 @@ expand_builtin(const char *argv[], int a doesyscmd(argv[2]); break; case INCLTYPE: - if (argc > 2) + if (argc > 2) { if (!doincl(argv[2])) { if (mimic_gnu) { warn("%s at line %lu: include(%s)", @@ -277,6 +277,7 @@ expand_builtin(const char *argv[], int a err(1, "%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); } + } break; case SINCTYPE: @@ -794,7 +795,7 @@ dom4wrap(const char *text) maxwraps = 16; else maxwraps *= 2; - m4wraps = xrealloc(m4wraps, maxwraps * sizeof(*m4wraps), + m4wraps = xreallocarray(m4wraps, maxwraps, sizeof(*m4wraps), "too many m4wraps"); } m4wraps[wrapindex++] = xstrdup(text); @@ -821,11 +822,10 @@ dodiv(int n) if (outfile[n] == NULL) { char fname[] = _PATH_DIVNAME; - if ((fd = mkstemp(fname)) < 0 || - (outfile[n] = fdopen(fd, "w+")) == NULL) - err(1, "%s: cannot divert", fname); - if (unlink(fname) == -1) - err(1, "%s: cannot unlink", fname); + if ((fd = mkstemp(fname)) < 0 || + unlink(fname) == -1 || + (outfile[n] = fdopen(fd, "w+")) == NULL) + err(1, "%s: cannot divert", fname); } active = outfile[n]; } Modified: head/usr.bin/m4/extern.h ============================================================================== --- head/usr.bin/m4/extern.h Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/extern.h Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.52 2012/04/12 17:00:11 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.54 2014/05/12 19:11:19 espie Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- @@ -104,8 +104,10 @@ extern void pbnumbase(int, int, int); extern void pbunsigned(unsigned long); extern void pbstr(const char *); extern void pushback(int); -extern void *xalloc(size_t, const char *fmt, ...); -extern void *xrealloc(void *, size_t, const char *fmt, ...); +extern void *xalloc(size_t, const char *, ...); +extern void *xcalloc(size_t, size_t, const char *, ...); +extern void *xrealloc(void *, size_t, const char *, ...); +extern void *xreallocarray(void *, size_t, size_t, const char *, ...); extern char *xstrdup(const char *); extern void usage(void); extern void resizedivs(int); Modified: head/usr.bin/m4/gnum4.c ============================================================================== --- head/usr.bin/m4/gnum4.c Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/gnum4.c Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: gnum4.c,v 1.42 2011/11/06 12:25:43 espie Exp $ */ +/* $OpenBSD: gnum4.c,v 1.46 2014/07/10 14:12:31 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie @@ -196,10 +196,12 @@ static void addchars(const char *, size_ static void addchar(int); static char *twiddle(const char *); static char *getstring(void); -static void exit_regerror(int, regex_t *); -static void do_subst(const char *, regex_t *, const char *, regmatch_t *); -static void do_regexpindex(const char *, regex_t *, regmatch_t *); -static void do_regexp(const char *, regex_t *, const char *, regmatch_t *); +static void exit_regerror(int, regex_t *, const char *); +static void do_subst(const char *, regex_t *, const char *, const char *, + regmatch_t *); +static void do_regexpindex(const char *, regex_t *, const char *, regmatch_t *); +static void do_regexp(const char *, regex_t *, const char *, const char *, + regmatch_t *); static void add_sub(int, const char *, regex_t *, regmatch_t *); static void add_replace(const char *, regex_t *, const char *, regmatch_t *); #define addconstantstring(s) addchars((s), sizeof(s)-1) @@ -243,7 +245,7 @@ getstring(void) static void -exit_regerror(int er, regex_t *re) +exit_regerror(int er, regex_t *re, const char *source) { size_t errlen; char *errbuf; @@ -252,7 +254,7 @@ exit_regerror(int er, regex_t *re) errbuf = xalloc(errlen, "malloc in regerror: %lu", (unsigned long)errlen); regerror(er, re, errbuf, errlen); - m4errx(1, "regular expression error: %s.", errbuf); + m4errx(1, "regular expression error in %s: %s.", source, errbuf); } static void @@ -296,7 +298,7 @@ add_replace(const char *string, regex_t p++; continue; } - if (isdigit(p[1])) { + if (isdigit((unsigned char)p[1])) { add_sub(*(++p) - '0', string, re, pm); continue; } @@ -306,7 +308,8 @@ add_replace(const char *string, regex_t } static void -do_subst(const char *string, regex_t *re, const char *replace, regmatch_t *pm) +do_subst(const char *string, regex_t *re, const char *source, + const char *replace, regmatch_t *pm) { int error; int flags = 0; @@ -341,12 +344,13 @@ do_subst(const char *string, regex_t *re string += pm[0].rm_eo; } if (error != REG_NOMATCH) - exit_regerror(error, re); + exit_regerror(error, re, source); pbstr(string); } static void -do_regexp(const char *string, regex_t *re, const char *replace, regmatch_t *pm) +do_regexp(const char *string, regex_t *re, const char *source, + const char *replace, regmatch_t *pm) { int error; @@ -358,12 +362,13 @@ do_regexp(const char *string, regex_t *r case REG_NOMATCH: break; default: - exit_regerror(error, re); + exit_regerror(error, re, source); } } static void -do_regexpindex(const char *string, regex_t *re, regmatch_t *pm) +do_regexpindex(const char *string, regex_t *re, const char *source, + regmatch_t *pm) { int error; @@ -375,7 +380,7 @@ do_regexpindex(const char *string, regex pbnum(-1); break; default: - exit_regerror(error, re); + exit_regerror(error, re, source); } } @@ -459,6 +464,7 @@ dopatsubst(const char *argv[], int argc) regex_t re; regmatch_t *pmatch; int mode = REG_EXTENDED; + const char *source; size_t l = strlen(argv[3]); if (!mimic_gnu || @@ -466,13 +472,14 @@ dopatsubst(const char *argv[], int argc) (l > 0 && argv[3][l-1] == '$')) mode |= REG_NEWLINE; - error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3], - mode); + source = mimic_gnu ? twiddle(argv[3]) : argv[3]; + error = regcomp(&re, source, mode); if (error != 0) - exit_regerror(error, &re); + exit_regerror(error, &re, source); - pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL); - do_subst(argv[2], &re, + pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), + NULL); + do_subst(argv[2], &re, source, argc > 4 && argv[4] != NULL ? argv[4] : "", pmatch); free(pmatch); regfree(&re); @@ -486,6 +493,7 @@ doregexp(const char *argv[], int argc) int error; regex_t re; regmatch_t *pmatch; + const char *source; if (argc <= 3) { warnx("Too few arguments to regexp"); @@ -498,16 +506,16 @@ doregexp(const char *argv[], int argc) else pbstr(argv[4]); } - error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3], - REG_EXTENDED|REG_NEWLINE); + source = mimic_gnu ? twiddle(argv[3]) : argv[3]; + error = regcomp(&re, source, REG_EXTENDED|REG_NEWLINE); if (error != 0) - exit_regerror(error, &re); + exit_regerror(error, &re, source); - pmatch = xalloc(sizeof(regmatch_t) * (re.re_nsub+1), NULL); + pmatch = xreallocarray(NULL, re.re_nsub+1, sizeof(regmatch_t), NULL); if (argc == 4 || argv[4] == NULL) - do_regexpindex(argv[2], &re, pmatch); + do_regexpindex(argv[2], &re, source, pmatch); else - do_regexp(argv[2], &re, argv[4], pmatch); + do_regexp(argv[2], &re, source, argv[4], pmatch); free(pmatch); regfree(&re); } Added: head/usr.bin/m4/lib/ohash.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/m4/lib/ohash.c Sun Jul 27 22:54:13 2014 (r269162) @@ -0,0 +1,330 @@ +/* $OpenBSD: src/lib/libutil/ohash.c,v 1.1 2014/06/02 18:52:03 deraadt Exp $ */ + +/* Copyright (c) 1999, 2004 Marc Espie + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include "ohash.h" + +struct _ohash_record { + uint32_t hv; + const char *p; +}; + +#define DELETED ((const char *)h) +#define NONE (h->size) + +/* Don't bother changing the hash table if the change is small enough. */ +#define MINSIZE (1UL << 4) +#define MINDELETED 4 + +static void ohash_resize(struct ohash *); + + +/* This handles the common case of variable length keys, where the + * key is stored at the end of the record. + */ +void * +ohash_create_entry(struct ohash_info *i, const char *start, const char **end) +{ + char *p; + + if (!*end) + *end = start + strlen(start); + p = (i->alloc)(i->key_offset + (*end - start) + 1, i->data); + if (p) { + memcpy(p+i->key_offset, start, *end-start); + p[i->key_offset + (*end - start)] = '\0'; + } + return (void *)p; +} + +/* hash_delete only frees the hash structure. Use hash_first/hash_next + * to free entries as well. */ +void +ohash_delete(struct ohash *h) +{ + (h->info.free)(h->t, h->info.data); +#ifndef NDEBUG + h->t = NULL; +#endif +} + +static void +ohash_resize(struct ohash *h) +{ + struct _ohash_record *n; + size_t ns; + unsigned int j; + unsigned int i, incr; + + if (4 * h->deleted < h->total) { + if (h->size >= (UINT_MAX >> 1U)) + ns = UINT_MAX; + else + ns = h->size << 1U; + } else if (3 * h->deleted > 2 * h->total) + ns = h->size >> 1U; + else + ns = h->size; + if (ns < MINSIZE) + ns = MINSIZE; +#ifdef STATS_HASH + STAT_HASH_EXPAND++; + STAT_HASH_SIZE += ns - h->size; +#endif + + n = (h->info.calloc)(ns, sizeof(struct _ohash_record), h->info.data); + if (!n) + return; + + for (j = 0; j < h->size; j++) { + if (h->t[j].p != NULL && h->t[j].p != DELETED) { + i = h->t[j].hv % ns; + incr = ((h->t[j].hv % (ns - 2)) & ~1) + 1; + while (n[i].p != NULL) { + i += incr; + if (i >= ns) + i -= ns; + } + n[i].hv = h->t[j].hv; + n[i].p = h->t[j].p; + } + } + (h->info.free)(h->t, h->info.data); + h->t = n; + h->size = ns; + h->total -= h->deleted; + h->deleted = 0; +} + +void * +ohash_remove(struct ohash *h, unsigned int i) +{ + void *result = (void *)h->t[i].p; + + if (result == NULL || result == DELETED) + return NULL; + +#ifdef STATS_HASH + STAT_HASH_ENTRIES--; +#endif + h->t[i].p = DELETED; + h->deleted++; + if (h->deleted >= MINDELETED && 4 * h->deleted > h->total) + ohash_resize(h); + return result; +} + +void * +ohash_find(struct ohash *h, unsigned int i) +{ + if (h->t[i].p == DELETED) + return NULL; + else + return (void *)h->t[i].p; +} + +void * +ohash_insert(struct ohash *h, unsigned int i, void *p) +{ +#ifdef STATS_HASH + STAT_HASH_ENTRIES++; +#endif + if (h->t[i].p == DELETED) { + h->deleted--; + h->t[i].p = p; + } else { + h->t[i].p = p; + /* Arbitrary resize boundary. Tweak if not efficient enough. */ + if (++h->total * 4 > h->size * 3) + ohash_resize(h); + } + return p; +} + +unsigned int +ohash_entries(struct ohash *h) +{ + return h->total - h->deleted; +} + +void * +ohash_first(struct ohash *h, unsigned int *pos) +{ + *pos = 0; + return ohash_next(h, pos); +} + +void * +ohash_next(struct ohash *h, unsigned int *pos) +{ + for (; *pos < h->size; (*pos)++) + if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL) + return (void *)h->t[(*pos)++].p; + return NULL; +} + +void +ohash_init(struct ohash *h, unsigned int size, struct ohash_info *info) +{ + h->size = 1UL << size; + if (h->size < MINSIZE) + h->size = MINSIZE; +#ifdef STATS_HASH + STAT_HASH_CREATION++; + STAT_HASH_SIZE += h->size; +#endif + /* Copy info so that caller may free it. */ + h->info.key_offset = info->key_offset; + h->info.calloc = info->calloc; + h->info.free = info->free; + h->info.alloc = info->alloc; + h->info.data = info->data; + h->t = (h->info.calloc)(h->size, sizeof(struct _ohash_record), + h->info.data); + h->total = h->deleted = 0; +} + +uint32_t +ohash_interval(const char *s, const char **e) +{ + uint32_t k; + + if (!*e) + *e = s + strlen(s); + if (s == *e) + k = 0; + else + k = *s++; + while (s != *e) + k = ((k << 2) | (k >> 30)) ^ *s++; + return k; +} + +unsigned int +ohash_lookup_interval(struct ohash *h, const char *start, const char *end, + uint32_t hv) +{ + unsigned int i, incr; + unsigned int empty; + +#ifdef STATS_HASH + STAT_HASH_LOOKUP++; +#endif + empty = NONE; + i = hv % h->size; + incr = ((hv % (h->size-2)) & ~1) + 1; + while (h->t[i].p != NULL) { +#ifdef STATS_HASH + STAT_HASH_LENGTH++; +#endif + if (h->t[i].p == DELETED) { + if (empty == NONE) + empty = i; + } else if (h->t[i].hv == hv && + strncmp(h->t[i].p+h->info.key_offset, start, + end - start) == 0 && + (h->t[i].p+h->info.key_offset)[end-start] == '\0') { + if (empty != NONE) { + h->t[empty].hv = hv; + h->t[empty].p = h->t[i].p; + h->t[i].p = DELETED; + return empty; + } else { +#ifdef STATS_HASH + STAT_HASH_POSITIVE++; +#endif + return i; + } + } + i += incr; + if (i >= h->size) + i -= h->size; + } + + /* Found an empty position. */ + if (empty != NONE) + i = empty; + h->t[i].hv = hv; + return i; +} + +unsigned int +ohash_lookup_memory(struct ohash *h, const char *k, size_t size, uint32_t hv) +{ + unsigned int i, incr; + unsigned int empty; + +#ifdef STATS_HASH + STAT_HASH_LOOKUP++; +#endif + empty = NONE; + i = hv % h->size; + incr = ((hv % (h->size-2)) & ~1) + 1; + while (h->t[i].p != NULL) { +#ifdef STATS_HASH + STAT_HASH_LENGTH++; +#endif + if (h->t[i].p == DELETED) { + if (empty == NONE) + empty = i; + } else if (h->t[i].hv == hv && + memcmp(h->t[i].p+h->info.key_offset, k, size) == 0) { + if (empty != NONE) { + h->t[empty].hv = hv; + h->t[empty].p = h->t[i].p; + h->t[i].p = DELETED; + return empty; + } else { +#ifdef STATS_HASH + STAT_HASH_POSITIVE++; +#endif + } return i; + } + i += incr; + if (i >= h->size) + i -= h->size; + } + + /* Found an empty position. */ + if (empty != NONE) + i = empty; + h->t[i].hv = hv; + return i; +} + +unsigned int +ohash_qlookup(struct ohash *h, const char *s) +{ + const char *e = NULL; + return ohash_qlookupi(h, s, &e); +} + +unsigned int +ohash_qlookupi(struct ohash *h, const char *s, const char **e) +{ + uint32_t hv; + + hv = ohash_interval(s, e); + return ohash_lookup_interval(h, s, *e, hv); +} Modified: head/usr.bin/m4/lib/ohash.h ============================================================================== --- head/usr.bin/m4/lib/ohash.h Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/lib/ohash.h Sun Jul 27 22:54:13 2014 (r269162) @@ -1,8 +1,4 @@ -#ifndef OHASH_H -#define OHASH_H -/* $OpenBSD: ohash.h,v 1.8 2005/12/29 18:54:47 jaredy Exp $ */ -/* ex:ts=8 sw=4: - */ +/* $OpenBSD: src/lib/libutil/ohash.h,v 1.2 2014/06/02 18:52:03 deraadt Exp $ */ /* Copyright (c) 1999, 2004 Marc Espie * @@ -21,21 +17,26 @@ * $FreeBSD$ */ +#ifndef OHASH_H +#define OHASH_H + /* Open hashing support. * Open hashing was chosen because it is much lighter than other hash * techniques, and more efficient in most cases. */ +/* user-visible data structure */ struct ohash_info { ptrdiff_t key_offset; void *data; /* user data */ - void *(*halloc)(size_t, void *); - void (*hfree)(void *, size_t, void *); + void *(*calloc)(size_t, size_t, void *); + void (*free)(void *, void *); void *(*alloc)(size_t, void *); }; struct _ohash_record; +/* private structure. It's there just so you can do a sizeof */ struct ohash { struct _ohash_record *t; struct ohash_info info; @@ -55,9 +56,10 @@ void ohash_init(struct ohash *, unsigned void ohash_delete(struct ohash *); unsigned int ohash_lookup_interval(struct ohash *, const char *, - const char *, u_int32_t); + const char *, uint32_t); unsigned int ohash_lookup_memory(struct ohash *, const char *, - size_t, u_int32_t); + size_t, uint32_t) + __attribute__ ((__bounded__(__string__,2,3))); void *ohash_find(struct ohash *, unsigned int); void *ohash_remove(struct ohash *, unsigned int); void *ohash_insert(struct ohash *, unsigned int, void *); @@ -66,10 +68,9 @@ void *ohash_next(struct ohash *, unsigne unsigned int ohash_entries(struct ohash *); void *ohash_create_entry(struct ohash_info *, const char *, const char **); -u_int32_t ohash_interval(const char *, const char **); +uint32_t ohash_interval(const char *, const char **); unsigned int ohash_qlookupi(struct ohash *, const char *, const char **); unsigned int ohash_qlookup(struct ohash *, const char *); __END_DECLS #endif - Modified: head/usr.bin/m4/lib/ohash_init.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_init.3 Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/lib/ohash_init.3 Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -.\" $OpenBSD: ohash_init.3,v 1.14 2007/05/31 19:19:30 jmc Exp $ +.\" $OpenBSD: ohash_init.3,v 1.2 2014/05/13 14:01:41 jmc Exp $ .\" Copyright (c) 1999 Marc Espie .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -15,8 +15,8 @@ .\" .\" $FreeBSD$ .\" -.Dd $Mdocdate: May 31 2007 $ -.Dt OPEN_HASH 3 +.Dd May 12 2014 +.Dt OHASH_INIT 3 .Os .Sh NAME .Nm ohash_init , @@ -71,11 +71,46 @@ initializes the table to store roughly 2 .Fa size elements. .Fa info -holds the position of the key in each record, and two pointers to +is a pointer to a +.Fa struct ohash_info . +.Bd -literal -offset indent +struct ohash_info { + ptrdiff_t key_offset; + void *data; /* user data */ + void *(*calloc)(size_t, size_t, void *); + void (*free)(void *, void *); + void *(*alloc)(size_t, void *); +}; +.Ed +.Pp +The +.Va offset +field holds the position of the key in each record; +the +.Va calloc +and +.Va free +fields are pointers to .Xr calloc 3 and .Xr free 3 Ns -like -functions, to use for managing the table internal storage. +functions, used for managing the table internal storage; +the +.Va alloc +field is only used by the utility function +.Xr ohash_create_entry 3 . +.Pp +Each of these functions are called similarly to their standard counterpart, +but with an extra +.Ft void * +parameter corresponding to the content of the field +.Fa data , +which can be used to communicate specific information to the functions. +.Pp +.Fn ohash_init +stores a copy of those fields internally, so +.Fa info +can be reclaimed after initialization. .Pp .Fn ohash_delete frees storage internal to @@ -166,7 +201,7 @@ for (n = ohash_first(h, &i); n != NULL; points to an auxiliary unsigned integer used to record the current position in the ohash table. Those functions are safe to use even while entries are added to/removed -from the table, but in such a case they do not guarantee that new entries +from the table, but in such a case they don't guarantee that new entries will be returned. As a special case, they can safely be used to free elements in the table. .Pp @@ -179,7 +214,13 @@ Only .Fn ohash_remove and .Fn ohash_delete -may call the user-supplied memory functions. +may call the user-supplied memory functions: +.Bd -literal -offset indent +p = (*info->calloc)(n, sizeof_record, info->data); +/* copy data from old to p */ +(*info->free)(old, info->data); +.Ed +.Pp It is the responsibility of the user memory allocation code to verify that those calls did not fail. .Pp @@ -213,6 +254,7 @@ call. .Pp Multi-threaded applications should explicitly protect ohash table access. .Sh SEE ALSO +.Xr hcreate 3 , .Xr ohash_interval 3 .Rs .%A Donald E. Knuth Modified: head/usr.bin/m4/lib/ohash_interval.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_interval.3 Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/lib/ohash_interval.3 Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -.\" $OpenBSD: ohash_interval.3,v 1.11 2007/05/31 19:19:30 jmc Exp $ +.\" $OpenBSD: ohash_interval.3,v 1.1 2014/05/12 19:09:00 espie Exp $ .\" Copyright (c) 2001 Marc Espie .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -15,8 +15,8 @@ .\" .\" $FreeBSD$ .\" -.Dd $Mdocdate: May 31 2007 $ -.Dt OPEN_HASH_HELPER 3 +.Dd June 5 2013 +.Dt OHASH_INTERVAL 3 .Os .Sh NAME .Nm ohash_interval , @@ -68,7 +68,10 @@ the alloc field of .Fa info should point to a .Xr malloc 3 Ns -like -function to allocate the storage. +function to allocate the storage: +.Bd -literal -offset indent +p = (*info->alloc)(sz, info->data); +.Ed .Pp .Fn ohash_qlookupi is a wrapper function that simply calls Modified: head/usr.bin/m4/look.c ============================================================================== --- head/usr.bin/m4/look.c Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/look.c Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: look.c,v 1.22 2010/09/07 19:58:09 marco Exp $ */ +/* $OpenBSD: look.c,v 1.23 2014/05/12 19:11:19 espie Exp $ */ /* * Copyright (c) 1989, 1993 @@ -51,36 +51,34 @@ __FBSDID("$FreeBSD$"); #include "stdd.h" #include "extern.h" -static void *hash_alloc(size_t, void *); -static void hash_free(void *, size_t, void *); +static void *hash_calloc(size_t, size_t, void *); +static void hash_free(void *, void *); static void *element_alloc(size_t, void *); static void setup_definition(struct macro_definition *, const char *, const char *); static struct ohash_info macro_info = { offsetof(struct ndblock, name), - NULL, hash_alloc, hash_free, element_alloc }; + NULL, hash_calloc, hash_free, element_alloc }; struct ohash macros; /* Support routines for hash tables. */ void * -hash_alloc(size_t s, __unused void *u) +hash_calloc(size_t n, size_t s, void *u __unused) { - void *storage = xalloc(s, "hash alloc"); - if (storage) - memset(storage, 0, s); + void *storage = xcalloc(n, s, "hash alloc"); return storage; } void -hash_free(void *p, __unused size_t s, __unused void *u) +hash_free(void *p, void *u __unused) { free(p); } void * -element_alloc(size_t s, __unused void *u) +element_alloc(size_t s, void *u __unused) { return xalloc(s, "element alloc"); } Modified: head/usr.bin/m4/m4.1 ============================================================================== --- head/usr.bin/m4/m4.1 Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/m4.1 Sun Jul 27 22:54:13 2014 (r269162) @@ -1,5 +1,5 @@ .\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $ -.\" @(#) $OpenBSD: m4.1,v 1.59 2010/10/21 13:20:51 jmc Exp $ +.\" @(#) $OpenBSD: m4.1,v 1.62 2014/04/14 07:00:47 jmc Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2010 +.Dd January 12 2014 $ .Dt M4 1 .Os .Sh NAME @@ -88,9 +88,7 @@ In arguments to macros, leading unquoted .Pq Sq \en characters are ignored. To quote strings, use left and right single quotes -.Po e.g.,\ \& -.Sq "\ this is a string with a leading space" -.Pc . +.Pq e.g., Sq \ \&this is a string with a leading space . You can change the quote characters with the .Ic changequote built-in macro. @@ -258,15 +256,17 @@ Prints the first argument on the standar Passes its first argument to a shell and returns the shell's standard output. Note that the shell shares its standard input and standard error with .Nm . -.It Fn eval expr +.It Fn eval expr[,radix[,minimum]] Computes the first argument as an arithmetic expression using 32-bit arithmetic. Operators are the standard C ternary, arithmetic, logical, shift, relational, bitwise, and parentheses operators. You can specify octal, decimal, and hexadecimal numbers as in C. -The second argument (if any) -specifies the radix for the result and the third argument (if any) +The optional second argument +.Fa radix +specifies the radix for the result and the optional third argument +.Fa minimum specifies the minimum number of digits in the result. .It Fn expr expr This is an alias for @@ -441,12 +441,12 @@ macro can modify the exit status. .Sh STANDARDS The .Nm -utility is mostly compliant with the +utility is compliant with the .St -p1003.1-2008 specification. .Pp The flags -.Op Fl dgIot +.Op Fl dgIPot and the macros .Ic builtin , .Ic esyscmd , @@ -467,9 +467,13 @@ are extensions to that specification. is not supposed to be a synonym for .Ic mkstemp , but instead to be an insecure temporary file name creation function. -The change causes no known compatibility issues. +It is marked by +.St -p1003.1-2008 +as being obsolescent and should not be used if portability is a concern. .Pp -The output format of tracing and of +The output format of +.Ic traceon +and .Ic dumpdef are not specified in any standard, are likely to change and should not be relied upon. Modified: head/usr.bin/m4/main.c ============================================================================== --- head/usr.bin/m4/main.c Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/main.c Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.81 2012/04/12 17:00:11 espie Exp $ */ +/* $OpenBSD: main.c,v 1.83 2014/05/12 19:11:19 espie Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -180,8 +180,8 @@ main(int argc, char *argv[]) initspaces(); STACKMAX = INITSTACKMAX; - mstack = (stae *)xalloc(sizeof(stae) * STACKMAX, NULL); - sstack = (char *)xalloc(STACKMAX, NULL); + mstack = xreallocarray(NULL, STACKMAX, sizeof(stae), NULL); + sstack = xalloc(STACKMAX, NULL); maxout = 0; outfile = NULL; @@ -415,7 +415,8 @@ macro(void) } } } else if (t == EOF) { - if (sp > -1 && ilevel <= 0) { + if (!mimic_gnu /* you can puke right there */ + && sp > -1 && ilevel <= 0) { warnx( "unexpected end of input, unclosed parenthesis:"); dump_stack(paren, PARLEV); exit(1); @@ -625,7 +626,7 @@ static void enlarge_stack(void) { STACKMAX += STACKMAX/2; - mstack = xrealloc(mstack, sizeof(stae) * STACKMAX, + mstack = xreallocarray(mstack, STACKMAX, sizeof(stae), "Evaluation stack overflow (%lu)", (unsigned long)STACKMAX); sstack = xrealloc(sstack, STACKMAX, Modified: head/usr.bin/m4/misc.c ============================================================================== --- head/usr.bin/m4/misc.c Sun Jul 27 20:55:47 2014 (r269161) +++ head/usr.bin/m4/misc.c Sun Jul 27 22:54:13 2014 (r269162) @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.42 2010/09/07 19:58:09 marco Exp $ */ +/* $OpenBSD: misc.c,v 1.44 2014/05/12 19:11:19 espie Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* @@ -32,6 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + #include __FBSDID("$FreeBSD$"); @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -165,7 +167,7 @@ initspaces(void) strspace = xalloc(strsize+1, NULL); ep = strspace; endest = strspace+strsize; - buf = (unsigned char *)xalloc(bufsize, NULL); + buf = xalloc(bufsize, NULL); bufbase = buf; bp = buf; endpbb = buf + bufsize; @@ -239,7 +241,7 @@ getdiv(int n) } void -onintr(__unused int signo) +onintr(int signo __unused) { #define intrmessage "m4: interrupted.\n" write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1); @@ -263,7 +265,7 @@ killdiv(void) extern char *__progname; void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jul 27 22:56:47 2014 Return-Path: Delivered-To: svn-src-all@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 A1B8DA0E; Sun, 27 Jul 2014 22:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77DD62141; Sun, 27 Jul 2014 22:56:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6RMul7S049953; Sun, 27 Jul 2014 22:56:47 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6RMulAr049952; Sun, 27 Jul 2014 22:56:47 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407272256.s6RMulAr049952@svn.freebsd.org> From: Baptiste Daroussin Date: Sun, 27 Jul 2014 22:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269163 - head/usr.bin/m4/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jul 2014 22:56:47 -0000 Author: bapt Date: Sun Jul 27 22:56:46 2014 New Revision: 269163 URL: http://svnweb.freebsd.org/changeset/base/269163 Log: Remove ohash_int.h forgotten in previous commit Deleted: head/usr.bin/m4/lib/ohash_int.h From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 00:43:44 2014 Return-Path: Delivered-To: svn-src-all@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 46689BA2; Mon, 28 Jul 2014 00:43: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33A4B2A65; Mon, 28 Jul 2014 00:43:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S0hhti000416; Mon, 28 Jul 2014 00:43:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S0hgVf000406; Mon, 28 Jul 2014 00:43:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280043.s6S0hgVf000406@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 00:43:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269164 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 00:43:44 -0000 Author: kib Date: Mon Jul 28 00:43:42 2014 New Revision: 269164 URL: http://svnweb.freebsd.org/changeset/base/269164 Log: MFC r268605: Remove code separator lines which do not conform to style(9). Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_fifoops.c stable/10/sys/fs/tmpfs/tmpfs_fifoops.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c stable/10/sys/fs/tmpfs/tmpfs_vnops.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs.h Mon Jul 28 00:43:42 2014 (r269164) @@ -35,9 +35,6 @@ #ifndef _FS_TMPFS_TMPFS_H_ #define _FS_TMPFS_TMPFS_H_ -/* --------------------------------------------------------------------- - * KERNEL-SPECIFIC DEFINITIONS - * --------------------------------------------------------------------- */ #include #include #include @@ -46,7 +43,6 @@ #include #include -/* --------------------------------------------------------------------- */ #include #include #include @@ -56,8 +52,6 @@ MALLOC_DECLARE(M_TMPFSMNT); MALLOC_DECLARE(M_TMPFSNAME); -/* --------------------------------------------------------------------- */ - /* * Internal representation of a tmpfs directory entry. */ @@ -137,8 +131,6 @@ RB_HEAD(tmpfs_dir, tmpfs_dirent); #define TMPFS_DIRCOOKIE_DUP_MAX \ (TMPFS_DIRCOOKIE_DUP | TMPFS_DIRCOOKIE_MASK) -/* --------------------------------------------------------------------- */ - /* * Internal representation of a tmpfs file system node. * @@ -308,7 +300,6 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define TMPFS_VNODE_WANT 2 #define TMPFS_VNODE_DOOMED 4 #define TMPFS_VNODE_WRECLAIM 8 -/* --------------------------------------------------------------------- */ /* * Internal representation of a tmpfs mount point. @@ -375,8 +366,6 @@ struct tmpfs_mount { #define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) -/* --------------------------------------------------------------------- */ - /* * This structure maps a file identifier to a tmpfs node. Used by the * NFS code. @@ -388,8 +377,6 @@ struct tmpfs_fid { unsigned long tf_gen; }; -/* --------------------------------------------------------------------- */ - #ifdef _KERNEL /* * Prototypes for tmpfs_subr.c. @@ -433,16 +420,12 @@ void tmpfs_itimes(struct vnode *, const void tmpfs_update(struct vnode *); int tmpfs_truncate(struct vnode *, off_t); -/* --------------------------------------------------------------------- */ - /* * Convenience macros to simplify some logical expressions. */ #define IMPLIES(a, b) (!(a) || (b)) #define IFF(a, b) (IMPLIES(a, b) && IMPLIES(b, a)) -/* --------------------------------------------------------------------- */ - /* * Checks that the directory entry pointed by 'de' matches the name 'name' * with a length of 'len'. @@ -451,8 +434,6 @@ int tmpfs_truncate(struct vnode *, off_t (de->td_namelen == len && \ bcmp((de)->ud.td_name, (name), (de)->td_namelen) == 0) -/* --------------------------------------------------------------------- */ - /* * Ensures that the node pointed by 'node' is a directory and that its * contents are consistent with respect to directories. @@ -462,8 +443,6 @@ int tmpfs_truncate(struct vnode *, off_t MPASS((node)->tn_size % sizeof(struct tmpfs_dirent) == 0); \ } while (0) -/* --------------------------------------------------------------------- */ - /* * Memory management stuff. */ @@ -480,8 +459,6 @@ size_t tmpfs_pages_used(struct tmpfs_mou #endif -/* --------------------------------------------------------------------- */ - /* * Macros/functions to convert from generic data structures to tmpfs * specific ones. Modified: stable/10/sys/fs/tmpfs/tmpfs_fifoops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_fifoops.c Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_fifoops.c Mon Jul 28 00:43:42 2014 (r269164) @@ -48,8 +48,6 @@ #include #include -/* --------------------------------------------------------------------- */ - static int tmpfs_fifo_kqfilter(struct vop_kqfilter_args *ap) { @@ -71,8 +69,6 @@ tmpfs_fifo_kqfilter(struct vop_kqfilter_ return fifo_specops.vop_kqfilter(ap); } -/* --------------------------------------------------------------------- */ - static int tmpfs_fifo_close(struct vop_close_args *v) { Modified: stable/10/sys/fs/tmpfs/tmpfs_fifoops.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_fifoops.h Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_fifoops.h Mon Jul 28 00:43:42 2014 (r269164) @@ -41,13 +41,10 @@ #include -/* --------------------------------------------------------------------- */ - /* * Declarations for tmpfs_fifoops.c. */ extern struct vop_vector tmpfs_fifoop_entries; -/* --------------------------------------------------------------------- */ #endif /* _FS_TMPFS_TMPFS_FIFOOPS_H_ */ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 00:43:42 2014 (r269164) @@ -136,8 +136,6 @@ tmpfs_pages_check_avail(struct tmpfs_mou return (1); } -/* --------------------------------------------------------------------- */ - /* * Allocates a new node of type 'type' inside the 'tmp' mount point, with * its owner set to 'uid', its group to 'gid' and its mode set to 'mode', @@ -251,8 +249,6 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp return 0; } -/* --------------------------------------------------------------------- */ - /* * Destroys the node pointed to by node from the file system 'tmp'. * If the node does not belong to the given mount point, the results are @@ -328,8 +324,6 @@ tmpfs_free_node(struct tmpfs_mount *tmp, uma_zfree(tmp->tm_node_pool, node); } -/* --------------------------------------------------------------------- */ - static __inline uint32_t tmpfs_dirent_hash(const char *name, u_int len) { @@ -406,8 +400,6 @@ tmpfs_alloc_dirent(struct tmpfs_mount *t return 0; } -/* --------------------------------------------------------------------- */ - /* * Frees a directory entry. It is the caller's responsibility to destroy * the node referenced by it if needed. @@ -432,8 +424,6 @@ tmpfs_free_dirent(struct tmpfs_mount *tm uma_zfree(tmp->tm_dirent_pool, de); } -/* --------------------------------------------------------------------- */ - void tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) { @@ -631,8 +621,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - /* * Destroys the association between the vnode vp and the node it * references. @@ -652,8 +640,6 @@ tmpfs_free_vp(struct vnode *vp) vp->v_data = NULL; } -/* --------------------------------------------------------------------- */ - /* * Allocates a new file of type 'type' and adds it to the parent directory * 'dvp'; this addition is done using the component name given in 'cnp'. @@ -733,8 +719,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - static struct tmpfs_dirent * tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) { @@ -990,8 +974,6 @@ tmpfs_dir_attach(struct vnode *vp, struc TMPFS_NODE_MODIFIED; } -/* --------------------------------------------------------------------- */ - /* * Detaches the directory entry de from the directory represented by vp. * Note that this does not change the link count of the node pointed by @@ -1057,8 +1039,6 @@ tmpfs_dir_destroy(struct tmpfs_mount *tm } } -/* --------------------------------------------------------------------- */ - /* * Helper function for tmpfs_readdir. Creates a '.' entry for the given * directory and returns it in the uio space. The function returns 0 @@ -1092,8 +1072,6 @@ tmpfs_dir_getdotdent(struct tmpfs_node * return error; } -/* --------------------------------------------------------------------- */ - /* * Helper function for tmpfs_readdir. Creates a '..' entry for the given * directory and returns it in the uio space. The function returns 0 @@ -1139,8 +1117,6 @@ tmpfs_dir_getdotdotdent(struct tmpfs_nod return error; } -/* --------------------------------------------------------------------- */ - /* * Helper function for tmpfs_readdir. Returns as much directory entries * as can fit in the uio space. The read starts at uio->uio_offset. @@ -1310,8 +1286,6 @@ tmpfs_dir_whiteout_remove(struct vnode * tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de); } -/* --------------------------------------------------------------------- */ - /* * Resizes the aobj associated with the regular file pointed to by 'vp' to the * size 'newsize'. 'vp' must point to a vnode that represents a regular file. @@ -1422,8 +1396,6 @@ retry: return (0); } -/* --------------------------------------------------------------------- */ - /* * Change flags of the given vnode. * Caller should execute tmpfs_update on vp after a successful execution. @@ -1481,8 +1453,6 @@ tmpfs_chflags(struct vnode *vp, u_long f return 0; } -/* --------------------------------------------------------------------- */ - /* * Change access mode on the given vnode. * Caller should execute tmpfs_update on vp after a successful execution. @@ -1539,8 +1509,6 @@ tmpfs_chmod(struct vnode *vp, mode_t mod return 0; } -/* --------------------------------------------------------------------- */ - /* * Change ownership of the given vnode. At least one of uid or gid must * be different than VNOVAL. If one is set to that value, the attribute @@ -1612,8 +1580,6 @@ tmpfs_chown(struct vnode *vp, uid_t uid, return 0; } -/* --------------------------------------------------------------------- */ - /* * Change size of the given vnode. * Caller should execute tmpfs_update on vp after a successful execution. @@ -1669,8 +1635,6 @@ tmpfs_chsize(struct vnode *vp, u_quad_t return error; } -/* --------------------------------------------------------------------- */ - /* * Change access and modification times of the given vnode. * Caller should execute tmpfs_update on vp after a successful execution. @@ -1719,7 +1683,6 @@ tmpfs_chtimes(struct vnode *vp, struct v return 0; } -/* --------------------------------------------------------------------- */ /* Sync timestamps */ void tmpfs_itimes(struct vnode *vp, const struct timespec *acc, @@ -1752,8 +1715,6 @@ tmpfs_itimes(struct vnode *vp, const str ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); } -/* --------------------------------------------------------------------- */ - void tmpfs_update(struct vnode *vp) { @@ -1761,8 +1722,6 @@ tmpfs_update(struct vnode *vp) tmpfs_itimes(vp, NULL, NULL); } -/* --------------------------------------------------------------------- */ - int tmpfs_truncate(struct vnode *vp, off_t length) { Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Mon Jul 28 00:43:42 2014 (r269164) @@ -68,8 +68,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures"); MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names"); -/* --------------------------------------------------------------------- */ - static int tmpfs_mount(struct mount *); static int tmpfs_unmount(struct mount *, int); static int tmpfs_root(struct mount *, int flags, struct vnode **); @@ -77,8 +75,6 @@ static int tmpfs_fhtovp(struct mount *, struct vnode **); static int tmpfs_statfs(struct mount *, struct statfs *); -/* --------------------------------------------------------------------- */ - static const char *tmpfs_opts[] = { "from", "size", "maxfilesize", "inodes", "uid", "gid", "mode", "export", "union", NULL @@ -88,8 +84,6 @@ static const char *tmpfs_updateopts[] = "from", "export", NULL }; -/* --------------------------------------------------------------------- */ - static int tmpfs_node_ctor(void *mem, int size, void *arg, int flags) { @@ -271,8 +265,6 @@ tmpfs_mount(struct mount *mp) return 0; } -/* --------------------------------------------------------------------- */ - /* ARGSUSED2 */ static int tmpfs_unmount(struct mount *mp, int mntflags) @@ -328,8 +320,6 @@ tmpfs_unmount(struct mount *mp, int mntf return 0; } -/* --------------------------------------------------------------------- */ - static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { @@ -342,8 +332,6 @@ tmpfs_root(struct mount *mp, int flags, return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) @@ -380,8 +368,6 @@ tmpfs_fhtovp(struct mount *mp, struct fi return (EINVAL); } -/* --------------------------------------------------------------------- */ - /* ARGSUSED2 */ static int tmpfs_statfs(struct mount *mp, struct statfs *sbp) @@ -415,8 +401,6 @@ tmpfs_statfs(struct mount *mp, struct st return 0; } -/* --------------------------------------------------------------------- */ - /* * tmpfs vfs operations. */ Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 00:43:42 2014 (r269164) @@ -68,8 +68,6 @@ SYSCTL_INT(_vfs_tmpfs, OID_AUTO, rename_ __DEVOLATILE(int *, &tmpfs_rename_restarts), 0, "Times rename had to restart due to lock contention"); -/* --------------------------------------------------------------------- */ - static int tmpfs_lookup(struct vop_cachedlookup_args *v) { @@ -207,8 +205,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_create(struct vop_create_args *v) { @@ -221,7 +217,6 @@ tmpfs_create(struct vop_create_args *v) return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL); } -/* --------------------------------------------------------------------- */ static int tmpfs_mknod(struct vop_mknod_args *v) @@ -238,8 +233,6 @@ tmpfs_mknod(struct vop_mknod_args *v) return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL); } -/* --------------------------------------------------------------------- */ - static int tmpfs_open(struct vop_open_args *v) { @@ -272,8 +265,6 @@ tmpfs_open(struct vop_open_args *v) return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_close(struct vop_close_args *v) { @@ -285,8 +276,6 @@ tmpfs_close(struct vop_close_args *v) return (0); } -/* --------------------------------------------------------------------- */ - int tmpfs_access(struct vop_access_args *v) { @@ -341,8 +330,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - int tmpfs_getattr(struct vop_getattr_args *v) { @@ -504,8 +491,6 @@ out: return (error); } -/* --------------------------------------------------------------------- */ - static int tmpfs_fsync(struct vop_fsync_args *v) { @@ -518,8 +503,6 @@ tmpfs_fsync(struct vop_fsync_args *v) return 0; } -/* --------------------------------------------------------------------- */ - static int tmpfs_remove(struct vop_remove_args *v) { @@ -572,8 +555,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_link(struct vop_link_args *v) { @@ -640,8 +621,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - /* * We acquire all but fdvp locks using non-blocking acquisitions. If we * fail to acquire any lock in the path we will drop all held locks, @@ -1051,8 +1030,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_mkdir(struct vop_mkdir_args *v) { @@ -1066,8 +1043,6 @@ tmpfs_mkdir(struct vop_mkdir_args *v) return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL); } -/* --------------------------------------------------------------------- */ - static int tmpfs_rmdir(struct vop_rmdir_args *v) { @@ -1161,8 +1136,6 @@ out: return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_symlink(struct vop_symlink_args *v) { @@ -1181,8 +1154,6 @@ tmpfs_symlink(struct vop_symlink_args *v return tmpfs_alloc_file(dvp, vpp, vap, cnp, target); } -/* --------------------------------------------------------------------- */ - static int tmpfs_readdir(struct vop_readdir_args *v) { @@ -1235,8 +1206,6 @@ tmpfs_readdir(struct vop_readdir_args *v return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_readlink(struct vop_readlink_args *v) { @@ -1258,8 +1227,6 @@ tmpfs_readlink(struct vop_readlink_args return error; } -/* --------------------------------------------------------------------- */ - static int tmpfs_inactive(struct vop_inactive_args *v) { @@ -1275,8 +1242,6 @@ tmpfs_inactive(struct vop_inactive_args return 0; } -/* --------------------------------------------------------------------- */ - int tmpfs_reclaim(struct vop_reclaim_args *v) { @@ -1314,8 +1279,6 @@ tmpfs_reclaim(struct vop_reclaim_args *v return 0; } -/* --------------------------------------------------------------------- */ - static int tmpfs_print(struct vop_print_args *v) { @@ -1339,8 +1302,6 @@ tmpfs_print(struct vop_print_args *v) return 0; } -/* --------------------------------------------------------------------- */ - static int tmpfs_pathconf(struct vop_pathconf_args *v) { @@ -1430,8 +1391,6 @@ tmpfs_whiteout(struct vop_whiteout_args } } -/* --------------------------------------------------------------------- */ - /* * vnode operations vector used for files stored in a tmpfs file system. */ Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.h Sun Jul 27 22:56:46 2014 (r269163) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.h Mon Jul 28 00:43:42 2014 (r269164) @@ -39,8 +39,6 @@ #error not supposed to be exposed to userland. #endif -/* --------------------------------------------------------------------- */ - /* * Declarations for tmpfs_vnops.c. */ @@ -52,6 +50,4 @@ vop_getattr_t tmpfs_getattr; vop_setattr_t tmpfs_setattr; vop_reclaim_t tmpfs_reclaim; -/* --------------------------------------------------------------------- */ - #endif /* _FS_TMPFS_TMPFS_VNOPS_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 00:53:28 2014 Return-Path: Delivered-To: svn-src-all@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 282E9DC2; Mon, 28 Jul 2014 00:53: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A6C82B3E; Mon, 28 Jul 2014 00:53:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S0rReN004929; Mon, 28 Jul 2014 00:53:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S0rRPX004922; Mon, 28 Jul 2014 00:53:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280053.s6S0rRPX004922@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 00:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269165 - in stable/10/sys: fs/cd9660 fs/msdosfs kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 00:53:28 -0000 Author: kib Date: Mon Jul 28 00:53:26 2014 New Revision: 269165 URL: http://svnweb.freebsd.org/changeset/base/269165 Log: MFC r268606: Generalize vn_get_ino() to allow filesystems to use custom vnode producer. Convert inline copies of vn_get_ino() in msdosfs and cd9660 into the uses of vn_get_ino_gen(). Modified: stable/10/sys/fs/cd9660/cd9660_lookup.c stable/10/sys/fs/msdosfs/msdosfs_lookup.c stable/10/sys/kern/vfs_vnops.c stable/10/sys/sys/vnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/cd9660/cd9660_lookup.c ============================================================================== --- stable/10/sys/fs/cd9660/cd9660_lookup.c Mon Jul 28 00:43:42 2014 (r269164) +++ stable/10/sys/fs/cd9660/cd9660_lookup.c Mon Jul 28 00:53:26 2014 (r269165) @@ -50,6 +50,23 @@ __FBSDID("$FreeBSD$"); #include #include +struct cd9660_ino_alloc_arg { + ino_t ino; + ino_t i_ino; + struct iso_directory_record *ep; +}; + +static int +cd9660_ino_alloc(struct mount *mp, void *arg, int lkflags, + struct vnode **vpp) +{ + struct cd9660_ino_alloc_arg *dd_arg; + + dd_arg = arg; + return (cd9660_vget_internal(mp, dd_arg->i_ino, lkflags, vpp, + dd_arg->i_ino != dd_arg->ino, dd_arg->ep)); +} + /* * Convert a component of a pathname into a pointer to a locked inode. * This is a very central and rather complicated routine. @@ -104,6 +121,7 @@ cd9660_lookup(ap) doff_t endsearch; /* offset to end directory search */ struct vnode *pdp; /* saved dp during symlink work */ struct vnode *tdp; /* returned by cd9660_vget_internal */ + struct cd9660_ino_alloc_arg dd_arg; u_long bmask; /* block offset mask */ int error; ino_t ino, i_ino; @@ -114,7 +132,6 @@ cd9660_lookup(ap) int res; int assoc, len; char *name; - struct mount *mp; struct vnode **vpp = ap->a_vpp; struct componentname *cnp = ap->a_cnp; int flags = cnp->cn_flags; @@ -368,39 +385,13 @@ found: * it's a relocated directory. */ if (flags & ISDOTDOT) { - /* - * Expanded copy of vn_vget_ino() so that we can use - * cd9660_vget_internal(). - */ - mp = pdp->v_mount; - ltype = VOP_ISLOCKED(pdp); - error = vfs_busy(mp, MBF_NOWAIT); - if (error != 0) { - vfs_ref(mp); - VOP_UNLOCK(pdp, 0); - error = vfs_busy(mp, 0); - vn_lock(pdp, ltype | LK_RETRY); - vfs_rel(mp); - if (error) - return (ENOENT); - if (pdp->v_iflag & VI_DOOMED) { - vfs_unbusy(mp); - return (ENOENT); - } - } - VOP_UNLOCK(pdp, 0); - error = cd9660_vget_internal(vdp->v_mount, i_ino, - cnp->cn_lkflags, &tdp, - i_ino != ino, ep); + dd_arg.ino = ino; + dd_arg.i_ino = i_ino; + dd_arg.ep = ep; + error = vn_vget_ino_gen(pdp, cd9660_ino_alloc, &dd_arg, + cnp->cn_lkflags, &tdp); free(ep2, M_TEMP); - vfs_unbusy(mp); - vn_lock(pdp, ltype | LK_RETRY); - if (pdp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(tdp); - error = ENOENT; - } - if (error) + if (error != 0) return (error); *vpp = tdp; } else if (dp->i_number == i_ino) { Modified: stable/10/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/10/sys/fs/msdosfs/msdosfs_lookup.c Mon Jul 28 00:43:42 2014 (r269164) +++ stable/10/sys/fs/msdosfs/msdosfs_lookup.c Mon Jul 28 00:53:26 2014 (r269165) @@ -63,8 +63,6 @@ static int msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp, u_int64_t *inum); -static int msdosfs_deget_dotdot(struct vnode *vp, u_long cluster, int blkoff, - struct vnode **rvp); int msdosfs_lookup(struct vop_cachedlookup_args *ap) @@ -73,6 +71,28 @@ msdosfs_lookup(struct vop_cachedlookup_a return (msdosfs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL)); } +struct deget_dotdot { + u_long cluster; + int blkoff; +}; + +static int +msdosfs_deget_dotdot(struct mount *mp, void *arg, int lkflags, + struct vnode **rvp) +{ + struct deget_dotdot *dd_arg; + struct denode *rdp; + struct msdosfsmount *pmp; + int error; + + pmp = VFSTOMSDOSFS(mp); + dd_arg = arg; + error = deget(pmp, dd_arg->cluster, dd_arg->blkoff, &rdp); + if (error == 0) + *rvp = DETOV(rdp); + return (error); +} + /* * When we search a directory the blocks containing directory entries are * read and examined. The directory entries contain information that would @@ -110,6 +130,7 @@ msdosfs_lookup_(struct vnode *vdp, struc struct msdosfsmount *pmp; struct buf *bp = NULL; struct direntry *dep = NULL; + struct deget_dotdot dd_arg; u_char dosfilename[12]; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; @@ -524,8 +545,11 @@ foundroot: */ pdp = vdp; if (flags & ISDOTDOT) { - error = msdosfs_deget_dotdot(pdp, cluster, blkoff, vpp); - if (error) { + dd_arg.cluster = cluster; + dd_arg.blkoff = blkoff; + error = vn_vget_ino_gen(vdp, msdosfs_deget_dotdot, + &dd_arg, cnp->cn_lkflags, vpp); + if (error != 0) { *vpp = NULL; return (error); } @@ -560,54 +584,6 @@ foundroot: return (0); } -static int -msdosfs_deget_dotdot(struct vnode *vp, u_long cluster, int blkoff, - struct vnode **rvp) -{ - struct mount *mp; - struct msdosfsmount *pmp; - struct denode *rdp; - int ltype, error; - - mp = vp->v_mount; - pmp = VFSTOMSDOSFS(mp); - ltype = VOP_ISLOCKED(vp); - KASSERT(ltype == LK_EXCLUSIVE || ltype == LK_SHARED, - ("msdosfs_deget_dotdot: vp not locked")); - - error = vfs_busy(mp, MBF_NOWAIT); - if (error != 0) { - vfs_ref(mp); - VOP_UNLOCK(vp, 0); - error = vfs_busy(mp, 0); - vn_lock(vp, ltype | LK_RETRY); - vfs_rel(mp); - if (error != 0) - return (ENOENT); - if (vp->v_iflag & VI_DOOMED) { - vfs_unbusy(mp); - return (ENOENT); - } - } - VOP_UNLOCK(vp, 0); - error = deget(pmp, cluster, blkoff, &rdp); - vfs_unbusy(mp); - if (error == 0) - *rvp = DETOV(rdp); - if (*rvp != vp) - vn_lock(vp, ltype | LK_RETRY); - if (vp->v_iflag & VI_DOOMED) { - if (error == 0) { - if (*rvp == vp) - vunref(*rvp); - else - vput(*rvp); - } - error = ENOENT; - } - return (error); -} - /* * dep - directory entry to copy into the directory * ddep - directory to add to Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Mon Jul 28 00:43:42 2014 (r269164) +++ stable/10/sys/kern/vfs_vnops.c Mon Jul 28 00:53:26 2014 (r269165) @@ -1953,12 +1953,30 @@ vn_extattr_rm(struct vnode *vp, int iofl return (error); } +static int +vn_get_ino_alloc_vget(struct mount *mp, void *arg, int lkflags, + struct vnode **rvp) +{ + + return (VFS_VGET(mp, *(ino_t *)arg, lkflags, rvp)); +} + int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp) { + + return (vn_vget_ino_gen(vp, vn_get_ino_alloc_vget, &ino, + lkflags, rvp)); +} + +int +vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, void *alloc_arg, + int lkflags, struct vnode **rvp) +{ struct mount *mp; int ltype, error; + ASSERT_VOP_LOCKED(vp, "vn_vget_ino_get"); mp = vp->v_mount; ltype = VOP_ISLOCKED(vp); KASSERT(ltype == LK_EXCLUSIVE || ltype == LK_SHARED, @@ -1978,12 +1996,17 @@ vn_vget_ino(struct vnode *vp, ino_t ino, } } VOP_UNLOCK(vp, 0); - error = VFS_VGET(mp, ino, lkflags, rvp); + error = alloc(mp, alloc_arg, lkflags, rvp); vfs_unbusy(mp); - vn_lock(vp, ltype | LK_RETRY); + if (*rvp != vp) + vn_lock(vp, ltype | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(*rvp); + if (error == 0) { + if (*rvp == vp) + vunref(vp); + else + vput(*rvp); + } error = ENOENT; } return (error); Modified: stable/10/sys/sys/vnode.h ============================================================================== --- stable/10/sys/sys/vnode.h Mon Jul 28 00:43:42 2014 (r269164) +++ stable/10/sys/sys/vnode.h Mon Jul 28 00:53:26 2014 (r269165) @@ -593,6 +593,8 @@ struct uio; struct vattr; struct vnode; +typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **); + /* cache_* may belong in namei.h. */ #define cache_enter(dvp, vp, cnp) \ cache_enter_time(dvp, vp, cnp, NULL, NULL) @@ -696,6 +698,8 @@ int vn_extattr_rm(struct vnode *vp, int const char *attrname, struct thread *td); int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp); +int vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, + void *alloc_arg, int lkflags, struct vnode **rvp); int vn_utimes_perm(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct thread *td); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 00:57:28 2014 Return-Path: Delivered-To: svn-src-all@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 CCB5AF66; Mon, 28 Jul 2014 00:57: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB1BF2B5C; Mon, 28 Jul 2014 00:57:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S0vSbE005524; Mon, 28 Jul 2014 00:57:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S0vSiM005523; Mon, 28 Jul 2014 00:57:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280057.s6S0vSiM005523@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 00:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269166 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 00:57:28 -0000 Author: kib Date: Mon Jul 28 00:57:28 2014 New Revision: 269166 URL: http://svnweb.freebsd.org/changeset/base/269166 Log: MFC r268607: In kern_linkat(), avoid passing doomed vnode to the VOP. Modified: stable/10/sys/kern/vfs_syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_syscalls.c ============================================================================== --- stable/10/sys/kern/vfs_syscalls.c Mon Jul 28 00:53:26 2014 (r269165) +++ stable/10/sys/kern/vfs_syscalls.c Mon Jul 28 00:57:28 2014 (r269166) @@ -1555,6 +1555,7 @@ kern_linkat(struct thread *td, int fd1, bwillwrite(); NDINIT_AT(&nd, LOOKUP, follow | AUDITVNODE1, segflg, path1, fd1, td); +again: if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1577,8 +1578,7 @@ kern_linkat(struct thread *td, int fd1, vput(nd.ni_dvp); vrele(nd.ni_vp); error = EEXIST; - } else if ((error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY)) - == 0) { + } else if ((error = vn_lock(vp, LK_EXCLUSIVE)) == 0) { error = can_hardlink(vp, td->td_ucred); if (error == 0) #ifdef MAC @@ -1589,6 +1589,12 @@ kern_linkat(struct thread *td, int fd1, error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); VOP_UNLOCK(vp, 0); vput(nd.ni_dvp); + } else { + vput(nd.ni_dvp); + NDFREE(&nd, NDF_ONLY_PNBUF); + vrele(vp); + vn_finished_write(mp); + goto again; } NDFREE(&nd, NDF_ONLY_PNBUF); } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:01:21 2014 Return-Path: Delivered-To: svn-src-all@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 1B5A5146; Mon, 28 Jul 2014 01:01: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09FBF2B77; Mon, 28 Jul 2014 01:01:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S11K0X008848; Mon, 28 Jul 2014 01:01:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S11KPV008847; Mon, 28 Jul 2014 01:01:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280101.s6S11KPV008847@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:01:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269167 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:01:21 -0000 Author: kib Date: Mon Jul 28 01:01:20 2014 New Revision: 269167 URL: http://svnweb.freebsd.org/changeset/base/269167 Log: MFC r268608: The tmpfs_link() must not dereference the filesystem-specific data for a vnode until it is verified that the vnode indeed belongs to tmpfs mount. Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 00:57:28 2014 (r269166) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:01:20 2014 (r269167) @@ -570,8 +570,6 @@ tmpfs_link(struct vop_link_args *v) MPASS(cnp->cn_flags & HASBUF); MPASS(dvp != vp); /* XXX When can this be false? */ - node = VP_TO_TMPFS_NODE(vp); - /* XXX: Why aren't the following two tests done by the caller? */ /* Hard links of directories are forbidden. */ @@ -586,6 +584,8 @@ tmpfs_link(struct vop_link_args *v) goto out; } + node = VP_TO_TMPFS_NODE(vp); + /* Ensure that we do not overflow the maximum number of links imposed * by the system. */ MPASS(node->tn_links <= LINK_MAX); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:04:34 2014 Return-Path: Delivered-To: svn-src-all@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 4C2322C0; Mon, 28 Jul 2014 01:04:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A2642C90; Mon, 28 Jul 2014 01:04:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S14YjT009977; Mon, 28 Jul 2014 01:04:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S14XkL009975; Mon, 28 Jul 2014 01:04:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280104.s6S14XkL009975@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269168 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:04:34 -0000 Author: kib Date: Mon Jul 28 01:04:33 2014 New Revision: 269168 URL: http://svnweb.freebsd.org/changeset/base/269168 Log: MFC r268609: Add some assertions for the code handling vm_object for tmpfs vnode. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:01:20 2014 (r269167) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:04:33 2014 (r269168) @@ -428,6 +428,7 @@ void tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) { + ASSERT_VOP_ELOCKED(vp, "tmpfs_destroy_vobject"); if (vp->v_type != VREG || obj == NULL) return; Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:01:20 2014 (r269167) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:04:33 2014 (r269168) @@ -258,6 +258,8 @@ tmpfs_open(struct vop_open_args *v) else { error = 0; /* For regular files, the call below is nop. */ + KASSERT(vp->v_type != VREG || (node->tn_reg.tn_aobj->flags & + OBJ_DEAD) == 0, ("dead object")); vnode_create_vobject(vp, node->tn_size, v->a_td); } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:06:37 2014 Return-Path: Delivered-To: svn-src-all@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 7BE7441E; Mon, 28 Jul 2014 01:06:37 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A7D22CA9; Mon, 28 Jul 2014 01:06:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S16b10010404; Mon, 28 Jul 2014 01:06:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S16b8e010402; Mon, 28 Jul 2014 01:06:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280106.s6S16b8e010402@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269169 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:06:37 -0000 Author: kib Date: Mon Jul 28 01:06:36 2014 New Revision: 269169 URL: http://svnweb.freebsd.org/changeset/base/269169 Log: MFC r268610: Add convenience macro to assert tmpfs node lock. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Mon Jul 28 01:04:33 2014 (r269168) +++ stable/10/sys/fs/tmpfs/tmpfs.h Mon Jul 28 01:06:36 2014 (r269169) @@ -276,6 +276,8 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define TMPFS_NODE_LOCK(node) mtx_lock(&(node)->tn_interlock) #define TMPFS_NODE_UNLOCK(node) mtx_unlock(&(node)->tn_interlock) #define TMPFS_NODE_MTX(node) (&(node)->tn_interlock) +#define TMPFS_NODE_ASSERT_LOCKED(node) mtx_assert(TMPFS_NODE_MTX(node), \ + MA_OWNED) #ifdef INVARIANTS #define TMPFS_ASSERT_LOCKED(node) do { \ Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:04:33 2014 (r269168) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:06:36 2014 (r269169) @@ -633,7 +633,7 @@ tmpfs_free_vp(struct vnode *vp) node = VP_TO_TMPFS_NODE(vp); - mtx_assert(TMPFS_NODE_MTX(node), MA_OWNED); + TMPFS_NODE_ASSERT_LOCKED(node); node->tn_vnode = NULL; if ((node->tn_vpstate & TMPFS_VNODE_WRECLAIM) != 0) wakeup(&node->tn_vnode); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:08:43 2014 Return-Path: Delivered-To: svn-src-all@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 C75A658E; Mon, 28 Jul 2014 01:08:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B57562CC9; Mon, 28 Jul 2014 01:08:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S18hGQ010825; Mon, 28 Jul 2014 01:08:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S18hTp010824; Mon, 28 Jul 2014 01:08:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280108.s6S18hTp010824@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269170 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:08:43 -0000 Author: kib Date: Mon Jul 28 01:08:43 2014 New Revision: 269170 URL: http://svnweb.freebsd.org/changeset/base/269170 Log: MFC r268611: Replace goto's with the return. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:06:36 2014 (r269169) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:08:43 2014 (r269170) @@ -677,8 +677,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru * imposed by the system. */ MPASS(dnode->tn_links <= LINK_MAX); if (dnode->tn_links == LINK_MAX) { - error = EMLINK; - goto out; + return (EMLINK); } parent = dnode; @@ -690,14 +689,14 @@ tmpfs_alloc_file(struct vnode *dvp, stru error = tmpfs_alloc_node(tmp, vap->va_type, cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); if (error != 0) - goto out; + return (error); /* Allocate a directory entry that points to the new file. */ error = tmpfs_alloc_dirent(tmp, node, cnp->cn_nameptr, cnp->cn_namelen, &de); if (error != 0) { tmpfs_free_node(tmp, node); - goto out; + return (error); } /* Allocate a vnode for the new file. */ @@ -705,7 +704,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru if (error != 0) { tmpfs_free_dirent(tmp, de); tmpfs_free_node(tmp, node); - goto out; + return (error); } /* Now that all required items are allocated, we can proceed to @@ -714,10 +713,7 @@ tmpfs_alloc_file(struct vnode *dvp, stru if (cnp->cn_flags & ISWHITEOUT) tmpfs_dir_whiteout_remove(dvp, cnp); tmpfs_dir_attach(dvp, de); - -out: - - return error; + return (0); } static struct tmpfs_dirent * From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:11:30 2014 Return-Path: Delivered-To: svn-src-all@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 63FF76EB; Mon, 28 Jul 2014 01:11:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 517022D5A; Mon, 28 Jul 2014 01:11:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1BUT2014537; Mon, 28 Jul 2014 01:11:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1BTg4014534; Mon, 28 Jul 2014 01:11:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280111.s6S1BTg4014534@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269171 - in stable/10/sys: kern sys ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:11:30 -0000 Author: kib Date: Mon Jul 28 01:11:29 2014 New Revision: 269171 URL: http://svnweb.freebsd.org/changeset/base/269171 Log: MFC r268612: Add helper helper vfs_write_suspend_umnt(). Fix the bug in the FFS unmount, when suspension failed, the ufs extattrs were not reinitialized. Modified: stable/10/sys/kern/vfs_vnops.c stable/10/sys/sys/vnode.h stable/10/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Mon Jul 28 01:08:43 2014 (r269170) +++ stable/10/sys/kern/vfs_vnops.c Mon Jul 28 01:11:29 2014 (r269171) @@ -1830,6 +1830,37 @@ vfs_write_resume(struct mount *mp, int f } /* + * Helper loop around vfs_write_suspend() for filesystem unmount VFS + * methods. + */ +int +vfs_write_suspend_umnt(struct mount *mp) +{ + int error; + + KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, + ("vfs_write_suspend_umnt: recursed")); + + /* dounmount() already called vn_start_write(). */ + for (;;) { + vn_finished_write(mp); + error = vfs_write_suspend(mp, 0); + if (error != 0) + return (error); + MNT_ILOCK(mp); + if ((mp->mnt_kern_flag & MNTK_SUSPENDED) != 0) + break; + MNT_IUNLOCK(mp); + vn_start_write(NULL, &mp, V_WAIT); + } + mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | MNTK_SUSPEND2); + wakeup(&mp->mnt_flag); + MNT_IUNLOCK(mp); + curthread->td_pflags |= TDP_IGNSUSP; + return (0); +} + +/* * Implement kqueues for files by translating it to vnode operation. */ static int Modified: stable/10/sys/sys/vnode.h ============================================================================== --- stable/10/sys/sys/vnode.h Mon Jul 28 01:08:43 2014 (r269170) +++ stable/10/sys/sys/vnode.h Mon Jul 28 01:11:29 2014 (r269171) @@ -721,6 +721,7 @@ int vfs_cache_lookup(struct vop_lookup_a void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp, int flags); +int vfs_write_suspend_umnt(struct mount *mp); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfsync(struct vop_fsync_args *); int vop_stdgetwritemount(struct vop_getwritemount_args *); Modified: stable/10/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_vfsops.c Mon Jul 28 01:08:43 2014 (r269170) +++ stable/10/sys/ufs/ffs/ffs_vfsops.c Mon Jul 28 01:11:29 2014 (r269171) @@ -255,31 +255,9 @@ ffs_mount(struct mount *mp) */ if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0) return (error); - for (;;) { - vn_finished_write(mp); - if ((error = vfs_write_suspend(mp, 0)) != 0) - return (error); - MNT_ILOCK(mp); - if (mp->mnt_kern_flag & MNTK_SUSPENDED) { - /* - * Allow the secondary writes - * to proceed. - */ - mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | - MNTK_SUSPEND2); - wakeup(&mp->mnt_flag); - MNT_IUNLOCK(mp); - /* - * Allow the curthread to - * ignore the suspension to - * synchronize on-disk state. - */ - td->td_pflags |= TDP_IGNSUSP; - break; - } - MNT_IUNLOCK(mp); - vn_start_write(NULL, &mp, V_WAIT); - } + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); /* * Check for and optionally get rid of files open * for writing. @@ -1250,25 +1228,9 @@ ffs_unmount(mp, mntflags) } #endif if (susp) { - /* - * dounmount already called vn_start_write(). - */ - for (;;) { - vn_finished_write(mp); - if ((error = vfs_write_suspend(mp, 0)) != 0) - return (error); - MNT_ILOCK(mp); - if (mp->mnt_kern_flag & MNTK_SUSPENDED) { - mp->mnt_kern_flag &= ~(MNTK_SUSPENDED | - MNTK_SUSPEND2); - wakeup(&mp->mnt_flag); - MNT_IUNLOCK(mp); - td->td_pflags |= TDP_IGNSUSP; - break; - } - MNT_IUNLOCK(mp); - vn_start_write(NULL, &mp, V_WAIT); - } + error = vfs_write_suspend_umnt(mp); + if (error != 0) + goto fail1; } if (MOUNTEDSOFTDEP(mp)) error = softdep_flushfiles(mp, flags, td); @@ -1331,6 +1293,7 @@ ffs_unmount(mp, mntflags) fail: if (susp) vfs_write_resume(mp, VR_START_WRITE); +fail1: #ifdef UFS_EXTATTR if (e_restart) { ufs_extattr_uepm_init(&ump->um_extattr); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:14:25 2014 Return-Path: Delivered-To: svn-src-all@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 CA053850; Mon, 28 Jul 2014 01:14: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B870A2D6A; Mon, 28 Jul 2014 01:14:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1EPmR014973; Mon, 28 Jul 2014 01:14:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1EPlh014971; Mon, 28 Jul 2014 01:14:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280114.s6S1EPlh014971@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:14:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269172 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:14:25 -0000 Author: kib Date: Mon Jul 28 01:14:25 2014 New Revision: 269172 URL: http://svnweb.freebsd.org/changeset/base/269172 Log: MFC r268613: Style. Add comment about lock mode. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:11:29 2014 (r269171) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:14:25 2014 (r269172) @@ -548,6 +548,7 @@ loop1: goto unlock; MPASS(vp != NULL); + /* lkflag is ignored, the lock is exclusive */ (void) vn_lock(vp, lkflag | LK_RETRY); vp->v_data = node; Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:11:29 2014 (r269171) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:14:25 2014 (r269172) @@ -171,7 +171,7 @@ tmpfs_lookup(struct vop_cachedlookup_arg /* Allocate a new vnode on the matching entry. */ error = tmpfs_alloc_vp(dvp->v_mount, tnode, - cnp->cn_lkflags, vpp); + cnp->cn_lkflags, vpp); if (error != 0) goto out; From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:16:08 2014 Return-Path: Delivered-To: svn-src-all@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 0169D999; Mon, 28 Jul 2014 01:16: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3D6A2D74; Mon, 28 Jul 2014 01:16:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1G75I015287; Mon, 28 Jul 2014 01:16:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1G7Vx015286; Mon, 28 Jul 2014 01:16:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280116.s6S1G7Vx015286@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269173 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:16:08 -0000 Author: kib Date: Mon Jul 28 01:16:07 2014 New Revision: 269173 URL: http://svnweb.freebsd.org/changeset/base/269173 Log: MFC r268614: Use tmpfs_vn_get_ino_gen() to handle the races with reclaim in tmpfs dotdot lookup. Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:14:25 2014 (r269172) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:16:07 2014 (r269173) @@ -69,15 +69,22 @@ SYSCTL_INT(_vfs_tmpfs, OID_AUTO, rename_ "Times rename had to restart due to lock contention"); static int +tmpfs_vn_get_ino_alloc(struct mount *mp, void *arg, int lkflags, + struct vnode **rvp) +{ + + return (tmpfs_alloc_vp(mp, arg, lkflags, rvp)); +} + +static int tmpfs_lookup(struct vop_cachedlookup_args *v) { struct vnode *dvp = v->a_dvp; struct vnode **vpp = v->a_vpp; struct componentname *cnp = v->a_cnp; - - int error; struct tmpfs_dirent *de; struct tmpfs_node *dnode; + int error; dnode = VP_TO_TMPFS_DIR(dvp); *vpp = NULLVP; @@ -98,17 +105,10 @@ tmpfs_lookup(struct vop_cachedlookup_arg goto out; } if (cnp->cn_flags & ISDOTDOT) { - int ltype = 0; - - ltype = VOP_ISLOCKED(dvp); - vhold(dvp); - VOP_UNLOCK(dvp, 0); - /* Allocate a new vnode on the matching entry. */ - error = tmpfs_alloc_vp(dvp->v_mount, dnode->tn_dir.tn_parent, - cnp->cn_lkflags, vpp); - - vn_lock(dvp, ltype | LK_RETRY); - vdrop(dvp); + error = vn_vget_ino_gen(dvp, tmpfs_vn_get_ino_alloc, + dnode->tn_dir.tn_parent, cnp->cn_lkflags, vpp); + if (error != 0) + goto out; } else if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { VREF(dvp); *vpp = dvp; From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:21:04 2014 Return-Path: Delivered-To: svn-src-all@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 DDE44BDF; Mon, 28 Jul 2014 01:21:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBACC2E06; Mon, 28 Jul 2014 01:21:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1L3Pd017044; Mon, 28 Jul 2014 01:21:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1L3ve017041; Mon, 28 Jul 2014 01:21:03 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280121.s6S1L3ve017041@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269174 - in stable/10/sys: fs/tmpfs vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:21:04 -0000 Author: kib Date: Mon Jul 28 01:21:02 2014 New Revision: 269174 URL: http://svnweb.freebsd.org/changeset/base/269174 Log: MFC r268615: Add OBJ_TMPFS_NODE flag. MFC r268616: Set the OBJ_TMPFS_NODE flag for vm_object of VREG tmpfs node. MFC r269053: Correct assertion. tmpfs vm object is always at the bottom of the shadow chain. Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/vm/vm_object.c stable/10/sys/vm/vm_object.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:16:07 2014 (r269173) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:21:02 2014 (r269174) @@ -231,7 +231,7 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp NULL /* XXXKIB - tmpfs needs swap reservation */); VM_OBJECT_WLOCK(obj); /* OBJ_TMPFS is set together with the setting of vp->v_object */ - vm_object_set_flag(obj, OBJ_NOSPLIT); + vm_object_set_flag(obj, OBJ_NOSPLIT | OBJ_TMPFS_NODE); vm_object_clear_flag(obj, OBJ_ONEMAPPING); VM_OBJECT_WUNLOCK(obj); break; Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Mon Jul 28 01:16:07 2014 (r269173) +++ stable/10/sys/vm/vm_object.c Mon Jul 28 01:21:02 2014 (r269174) @@ -553,14 +553,12 @@ vm_object_deallocate(vm_object_t object) object->handle == NULL && (object->type == OBJT_DEFAULT || (object->type == OBJT_SWAP && - (object->flags & OBJ_TMPFS) == 0))) { + (object->flags & OBJ_TMPFS_NODE) == 0))) { vm_object_set_flag(object, OBJ_ONEMAPPING); } else if ((object->shadow_count == 1) && (object->handle == NULL) && (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { - KASSERT((object->flags & OBJ_TMPFS) == 0, - ("shadowed tmpfs v_object %p", object)); vm_object_t robject; robject = LIST_FIRST(&object->shadow_head); @@ -568,6 +566,8 @@ vm_object_deallocate(vm_object_t object) ("vm_object_deallocate: ref_count: %d, shadow_count: %d", object->ref_count, object->shadow_count)); + KASSERT((robject->flags & OBJ_TMPFS_NODE) == 0, + ("shadowed tmpfs v_object %p", object)); if (!VM_OBJECT_TRYWLOCK(robject)) { /* * Avoid a potential deadlock. @@ -637,6 +637,8 @@ retry: doterm: temp = object->backing_object; if (temp != NULL) { + KASSERT((object->flags & OBJ_TMPFS_NODE) == 0, + ("shadowed tmpfs v_object 2 %p", object)); VM_OBJECT_WLOCK(temp); LIST_REMOVE(object, shadow_list); temp->shadow_count--; @@ -2104,7 +2106,7 @@ vm_object_coalesce(vm_object_t prev_obje VM_OBJECT_WLOCK(prev_object); if ((prev_object->type != OBJT_DEFAULT && prev_object->type != OBJT_SWAP) || - (prev_object->flags & OBJ_TMPFS) != 0) { + (prev_object->flags & OBJ_TMPFS_NODE) != 0) { VM_OBJECT_WUNLOCK(prev_object); return (FALSE); } Modified: stable/10/sys/vm/vm_object.h ============================================================================== --- stable/10/sys/vm/vm_object.h Mon Jul 28 01:16:07 2014 (r269173) +++ stable/10/sys/vm/vm_object.h Mon Jul 28 01:21:02 2014 (r269174) @@ -186,10 +186,11 @@ struct vm_object { #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ +#define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */ -#define OBJ_TMPFS 0x8000 +#define OBJ_TMPFS 0x8000 /* has tmpfs vnode allocated */ #define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) #define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:24:00 2014 Return-Path: Delivered-To: svn-src-all@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 C6EE5D78; Mon, 28 Jul 2014 01:24: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B41522E29; Mon, 28 Jul 2014 01:24:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1O0CJ019650; Mon, 28 Jul 2014 01:24:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1O043019640; Mon, 28 Jul 2014 01:24:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280124.s6S1O043019640@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269175 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:24:01 -0000 Author: kib Date: Mon Jul 28 01:23:59 2014 New Revision: 269175 URL: http://svnweb.freebsd.org/changeset/base/269175 Log: MFC r268617: Rework the tmpfs unmount. Modified: stable/10/sys/fs/tmpfs/tmpfs.h stable/10/sys/fs/tmpfs/tmpfs_subr.c stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs.h Mon Jul 28 01:21:02 2014 (r269174) +++ stable/10/sys/fs/tmpfs/tmpfs.h Mon Jul 28 01:23:59 2014 (r269175) @@ -384,7 +384,7 @@ struct tmpfs_fid { * Prototypes for tmpfs_subr.c. */ -int tmpfs_alloc_node(struct tmpfs_mount *, enum vtype, +int tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *, enum vtype, uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *, char *, dev_t, struct tmpfs_node **); void tmpfs_free_node(struct tmpfs_mount *, struct tmpfs_node *); Modified: stable/10/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:21:02 2014 (r269174) +++ stable/10/sys/fs/tmpfs/tmpfs_subr.c Mon Jul 28 01:23:59 2014 (r269175) @@ -159,7 +159,7 @@ tmpfs_pages_check_avail(struct tmpfs_mou * Returns zero on success or an appropriate error code on failure. */ int -tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type, +tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *parent, char *target, dev_t rdev, struct tmpfs_node **node) { @@ -169,6 +169,8 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp /* If the root directory of the 'tmp' file system is not yet * allocated, this must be the request to do it. */ MPASS(IMPLIES(tmp->tm_root == NULL, parent == NULL && type == VDIR)); + KASSERT(tmp->tm_root == NULL || mp->mnt_writeopcount > 0, + ("creating node not under vn_start_write")); MPASS(IFF(type == VLNK, target != NULL)); MPASS(IFF(type == VBLK || type == VCHR, rdev != VNOVAL)); @@ -178,6 +180,24 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp if (tmpfs_pages_check_avail(tmp, 1) == 0) return (ENOSPC); + if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + /* + * When a new tmpfs node is created for fully + * constructed mount point, there must be a parent + * node, which vnode is locked exclusively. As + * consequence, if the unmount is executing in + * parallel, vflush() cannot reclaim the parent vnode. + * Due to this, the check for MNTK_UNMOUNT flag is not + * racy: if we did not see MNTK_UNMOUNT flag, then tmp + * cannot be destroyed until node construction is + * finished and the parent vnode unlocked. + * + * Tmpfs does not need to instantiate new nodes during + * unmount. + */ + return (EBUSY); + } + nnode = (struct tmpfs_node *)uma_zalloc_arg( tmp->tm_node_pool, tmp, M_WAITOK); @@ -687,7 +707,8 @@ tmpfs_alloc_file(struct vnode *dvp, stru parent = NULL; /* Allocate a node that represents the new file. */ - error = tmpfs_alloc_node(tmp, vap->va_type, cnp->cn_cred->cr_uid, + error = tmpfs_alloc_node(dvp->v_mount, tmp, vap->va_type, + cnp->cn_cred->cr_uid, dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); if (error != 0) return (error); Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Mon Jul 28 01:21:02 2014 (r269174) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Mon Jul 28 01:23:59 2014 (r269175) @@ -238,7 +238,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ - error = tmpfs_alloc_node(tmp, VDIR, root_uid, + error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid, root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); @@ -269,38 +269,49 @@ tmpfs_mount(struct mount *mp) static int tmpfs_unmount(struct mount *mp, int mntflags) { - int error; - int flags = 0; struct tmpfs_mount *tmp; struct tmpfs_node *node; + int error, flags; - /* Handle forced unmounts. */ - if (mntflags & MNT_FORCE) - flags |= FORCECLOSE; - - /* Finalize all pending I/O. */ - error = vflush(mp, 0, flags, curthread); - if (error != 0) - return error; - + flags = (mntflags & MNT_FORCE) != 0 ? FORCECLOSE : 0; tmp = VFS_TO_TMPFS(mp); - /* Free all associated data. The loop iterates over the linked list - * we have containing all used nodes. For each of them that is - * a directory, we free all its directory entries. Note that after - * freeing a node, it will automatically go to the available list, - * so we will later have to iterate over it to release its items. */ - node = LIST_FIRST(&tmp->tm_nodes_used); - while (node != NULL) { - struct tmpfs_node *next; + /* Stop writers */ + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); + /* + * At this point, nodes cannot be destroyed by any other + * thread because write suspension is started. + */ + + for (;;) { + error = vflush(mp, 0, flags, curthread); + if (error != 0) { + vfs_write_resume(mp, VR_START_WRITE); + return (error); + } + MNT_ILOCK(mp); + if (mp->mnt_nvnodelistsize == 0) { + MNT_IUNLOCK(mp); + break; + } + MNT_IUNLOCK(mp); + if ((mntflags & MNT_FORCE) == 0) { + vfs_write_resume(mp, VR_START_WRITE); + return (EBUSY); + } + } + TMPFS_LOCK(tmp); + while ((node = LIST_FIRST(&tmp->tm_nodes_used)) != NULL) { + TMPFS_UNLOCK(tmp); if (node->tn_type == VDIR) tmpfs_dir_destroy(tmp, node); - - next = LIST_NEXT(node, tn_entries); tmpfs_free_node(tmp, node); - node = next; + TMPFS_LOCK(tmp); } + TMPFS_UNLOCK(tmp); uma_zdestroy(tmp->tm_dirent_pool); uma_zdestroy(tmp->tm_node_pool); @@ -313,11 +324,13 @@ tmpfs_unmount(struct mount *mp, int mntf /* Throw away the tmpfs_mount structure. */ free(mp->mnt_data, M_TMPFSMNT); mp->mnt_data = NULL; + vfs_write_resume(mp, VR_START_WRITE); MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_LOCAL; MNT_IUNLOCK(mp); - return 0; + + return (0); } static int @@ -401,6 +414,18 @@ tmpfs_statfs(struct mount *mp, struct st return 0; } +static int +tmpfs_sync(struct mount *mp, int waitfor) +{ + + if (waitfor == MNT_SUSPEND) { + MNT_ILOCK(mp); + mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED; + MNT_IUNLOCK(mp); + } + return (0); +} + /* * tmpfs vfs operations. */ @@ -411,5 +436,6 @@ struct vfsops tmpfs_vfsops = { .vfs_root = tmpfs_root, .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, + .vfs_sync = tmpfs_sync, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 01:25:49 2014 Return-Path: Delivered-To: svn-src-all@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 CEEB3EB2; Mon, 28 Jul 2014 01:25: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCC842E31; Mon, 28 Jul 2014 01:25:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S1Pngi019956; Mon, 28 Jul 2014 01:25:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S1Pnpw019954; Mon, 28 Jul 2014 01:25:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407280125.s6S1Pnpw019954@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 01:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269176 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 01:25:49 -0000 Author: kib Date: Mon Jul 28 01:25:49 2014 New Revision: 269176 URL: http://svnweb.freebsd.org/changeset/base/269176 Log: MFC r268766: Do not ignore error from tmpfs_alloc_vp(). Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:23:59 2014 (r269175) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Mon Jul 28 01:25:49 2014 (r269176) @@ -186,7 +186,9 @@ tmpfs_lookup(struct vop_cachedlookup_arg cnp->cn_flags |= SAVENAME; } else { error = tmpfs_alloc_vp(dvp->v_mount, tnode, - cnp->cn_lkflags, vpp); + cnp->cn_lkflags, vpp); + if (error != 0) + goto out; } } } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 02:07:19 2014 Return-Path: Delivered-To: svn-src-all@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 2BD10793; Mon, 28 Jul 2014 02:07: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D47021C4; Mon, 28 Jul 2014 02:07:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S27Ibu038615; Mon, 28 Jul 2014 02:07:18 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S27G0T038597; Mon, 28 Jul 2014 02:07:16 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407280207.s6S27G0T038597@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 28 Jul 2014 02:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269177 - stable/10/usr.bin/mkimg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 02:07:19 -0000 Author: marcel Date: Mon Jul 28 02:07:16 2014 New Revision: 269177 URL: http://svnweb.freebsd.org/changeset/base/269177 Log: MFC r268236,268264,268524,268646,268802,269021: This brings VHD support to mkimg(1); both dynamic and fixed file formats. Dynamic VHD and VMDK file images are now sparsely written, meaning that "free" sectors do not occupy space. Relnotes: yes Added: stable/10/usr.bin/mkimg/vhd.c - copied, changed from r268236, head/usr.bin/mkimg/vhd.c Modified: stable/10/usr.bin/mkimg/Makefile stable/10/usr.bin/mkimg/apm.c stable/10/usr.bin/mkimg/gpt.c stable/10/usr.bin/mkimg/image.c stable/10/usr.bin/mkimg/image.h stable/10/usr.bin/mkimg/mkimg.1 stable/10/usr.bin/mkimg/mkimg.c stable/10/usr.bin/mkimg/mkimg.h stable/10/usr.bin/mkimg/raw.c stable/10/usr.bin/mkimg/vmdk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkimg/Makefile ============================================================================== --- stable/10/usr.bin/mkimg/Makefile Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/Makefile Mon Jul 28 02:07:16 2014 (r269177) @@ -9,6 +9,7 @@ CFLAGS+=-DSPARSE_WRITE # List of formats to support SRCS+= \ raw.c \ + vhd.c \ vmdk.c # List of schemes to support Modified: stable/10/usr.bin/mkimg/apm.c ============================================================================== --- stable/10/usr.bin/mkimg/apm.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/apm.c Mon Jul 28 02:07:16 2014 (r269177) @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include "mkimg.h" #include "scheme.h" +#ifndef APM_ENT_TYPE_APPLE_BOOT +#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" +#endif #ifndef APM_ENT_TYPE_FREEBSD_NANDFS #define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" #endif Modified: stable/10/usr.bin/mkimg/gpt.c ============================================================================== --- stable/10/usr.bin/mkimg/gpt.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/gpt.c Mon Jul 28 02:07:16 2014 (r269177) @@ -211,7 +211,7 @@ gpt_mktbl(u_int tblsz) STAILQ_FOREACH(part, &partlist, link) { ent = tbl + part->index; gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); - uuidgen(&uuid, 1); + mkimg_uuid(&uuid); gpt_uuid_enc(&ent->ent_uuid, &uuid); le64enc(&ent->ent_lba_start, part->block); le64enc(&ent->ent_lba_end, part->block + part->size - 1); @@ -279,7 +279,7 @@ gpt_write(lba_t imgsz, void *bootcode) le32enc(&hdr->hdr_size, offsetof(struct gpt_hdr, padding)); le64enc(&hdr->hdr_lba_start, 2 + tblsz); le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); - uuidgen(&uuid, 1); + mkimg_uuid(&uuid); gpt_uuid_enc(&hdr->hdr_uuid, &uuid); le32enc(&hdr->hdr_entries, nparts); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); Modified: stable/10/usr.bin/mkimg/image.c ============================================================================== --- stable/10/usr.bin/mkimg/image.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/image.c Mon Jul 28 02:07:16 2014 (r269177) @@ -94,21 +94,49 @@ image_copyin(lba_t blk, int fd, uint64_t int image_copyout(int fd) { + int error; + + error = image_copyout_region(fd, 0, image_size); + if (!error) + error = image_copyout_done(fd); + return (error); +} + +int +image_copyout_done(int fd) +{ + off_t ofs; + int error; + + ofs = lseek(fd, 0L, SEEK_CUR); + if (ofs == -1) + return (0); + error = (ftruncate(fd, ofs) == -1) ? errno : 0; + return (error); +} + +int +image_copyout_region(int fd, lba_t blk, lba_t size) +{ char *buffer; off_t ofs; + size_t sz; ssize_t rdsz, wrsz; int error; ofs = lseek(fd, 0L, SEEK_CUR); - if (lseek(image_fd, 0, SEEK_SET) != 0) + blk *= secsz; + if (lseek(image_fd, blk, SEEK_SET) != blk) return (errno); buffer = malloc(BUFFER_SIZE); if (buffer == NULL) return (errno); error = 0; - while (1) { - rdsz = read(image_fd, buffer, BUFFER_SIZE); + size *= secsz; + while (size > 0) { + sz = (BUFFER_SIZE < size) ? BUFFER_SIZE : size; + rdsz = read(image_fd, buffer, sz); if (rdsz <= 0) { error = (rdsz < 0) ? errno : 0; break; @@ -120,17 +148,40 @@ image_copyout(int fd) error = errno; break; } + assert(wrsz == rdsz); + size -= rdsz; } free(buffer); - if (error) - return (error); - ofs = lseek(fd, 0L, SEEK_CUR); - if (ofs == -1) - return (errno); - error = (ftruncate(fd, ofs) == -1) ? errno : 0; return (error); } +int +image_data(lba_t blk, lba_t size) +{ + char *buffer, *p; + + blk *= secsz; + if (lseek(image_fd, blk, SEEK_SET) != blk) + return (1); + + size *= secsz; + buffer = malloc(size); + if (buffer == NULL) + return (1); + + if (read(image_fd, buffer, size) != (ssize_t)size) { + free(buffer); + return (1); + } + + p = buffer; + while (size > 0 && *p == '\0') + size--, p++; + + free(buffer); + return ((size == 0) ? 0 : 1); +} + lba_t image_get_size(void) { Modified: stable/10/usr.bin/mkimg/image.h ============================================================================== --- stable/10/usr.bin/mkimg/image.h Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/image.h Mon Jul 28 02:07:16 2014 (r269177) @@ -33,6 +33,9 @@ typedef int64_t lba_t; int image_copyin(lba_t blk, int fd, uint64_t *sizep); int image_copyout(int fd); +int image_copyout_done(int fd); +int image_copyout_region(int fd, lba_t blk, lba_t size); +int image_data(lba_t blk, lba_t size); lba_t image_get_size(void); int image_init(void); int image_set_size(lba_t blk); Modified: stable/10/usr.bin/mkimg/mkimg.1 ============================================================================== --- stable/10/usr.bin/mkimg/mkimg.1 Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/mkimg.1 Mon Jul 28 02:07:16 2014 (r269177) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2014 +.Dd July 4, 2014 .Dt MKIMG 1 .Os .Sh NAME .Nm mkimg -.Nd "utility to make a disk image" +.Nd "utility to make disk images" .Sh SYNOPSIS .Nm .Op Fl H Ar heads @@ -40,6 +40,7 @@ .Op Fl f Ar format .Op Fl o Ar outfile .Op Fl v +.Op Fl y .Fl s Ar scheme .Fl p Ar partition .Op Fl p Ar partition ... @@ -111,6 +112,16 @@ option increases the level of output tha .Nm utility prints. .Pp +The +.Op Fl y +option is used for testing purposes only and is not to be used in production. +When present, the +.Nm +utility will generate predictable values for Universally Unique Identifiers +(UUIDs) and time stamps so that consecutive runs of the +.Nm +utility will create images that are identical. +.Pp For a complete list of supported partitioning schemes or supported output format, or for a detailed description of how to specify partitions, run the .Nm Modified: stable/10/usr.bin/mkimg/mkimg.c ============================================================================== --- stable/10/usr.bin/mkimg/mkimg.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/mkimg.c Mon Jul 28 02:07:16 2014 (r269177) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ __FBSDID("$FreeBSD$"); struct partlisthead partlist = STAILQ_HEAD_INITIALIZER(partlist); u_int nparts = 0; +u_int unit_testing; u_int verbose; u_int ncyls = 0; @@ -73,6 +75,8 @@ usage(const char *why) fprintf(stderr, "\t-o \t- file to write image into\n"); fprintf(stderr, "\t-p \n"); fprintf(stderr, "\t-s \n"); + fprintf(stderr, "\t-v\t\t- increase verbosity\n"); + fprintf(stderr, "\t-y\t\t- [developers] enable unit test\n"); fprintf(stderr, "\t-H \t- number of heads to simulate\n"); fprintf(stderr, "\t-P \t- physical sector size\n"); fprintf(stderr, "\t-S \t- logical sector size\n"); @@ -258,6 +262,22 @@ sparse_write(int fd, const void *ptr, si } #endif /* SPARSE_WRITE */ +void +mkimg_uuid(struct uuid *uuid) +{ + static uint8_t gen[sizeof(struct uuid)]; + u_int i; + + if (!unit_testing) { + uuidgen(uuid, 1); + return; + } + + for (i = 0; i < sizeof(gen); i++) + gen[i]++; + memcpy(uuid, gen, sizeof(uuid_t)); +} + static void mkimg(void) { @@ -337,7 +357,7 @@ main(int argc, char *argv[]) bcfd = -1; outfd = 1; /* Write to stdout by default */ - while ((c = getopt(argc, argv, "b:f:o:p:s:vH:P:S:T:")) != -1) { + while ((c = getopt(argc, argv, "b:f:o:p:s:vyH:P:S:T:")) != -1) { switch (c) { case 'b': /* BOOT CODE */ if (bcfd != -1) @@ -373,6 +393,9 @@ main(int argc, char *argv[]) if (error) errc(EX_DATAERR, error, "scheme"); break; + case 'y': + unit_testing++; + break; case 'v': verbose++; break; Modified: stable/10/usr.bin/mkimg/mkimg.h ============================================================================== --- stable/10/usr.bin/mkimg/mkimg.h Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/mkimg.h Mon Jul 28 02:07:16 2014 (r269177) @@ -50,6 +50,7 @@ struct part { extern STAILQ_HEAD(partlisthead, part) partlist; extern u_int nparts; +extern u_int unit_testing; extern u_int verbose; extern u_int ncyls; @@ -71,4 +72,7 @@ round_block(lba_t n) ssize_t sparse_write(int, const void *, size_t); #endif +struct uuid; +void mkimg_uuid(struct uuid *); + #endif /* _MKIMG_MKIMG_H_ */ Modified: stable/10/usr.bin/mkimg/raw.c ============================================================================== --- stable/10/usr.bin/mkimg/raw.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/raw.c Mon Jul 28 02:07:16 2014 (r269177) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include Copied and modified: stable/10/usr.bin/mkimg/vhd.c (from r268236, head/usr.bin/mkimg/vhd.c) ============================================================================== --- head/usr.bin/mkimg/vhd.c Thu Jul 3 20:31:43 2014 (r268236, copy source) +++ stable/10/usr.bin/mkimg/vhd.c Mon Jul 28 02:07:16 2014 (r269177) @@ -40,16 +40,23 @@ __FBSDID("$FreeBSD$"); #include "format.h" #include "mkimg.h" +#ifndef __has_extension +#define __has_extension(x) 0 +#endif + /* - * Notes: + * General notes: * o File is in network byte order. - * o File layout: - * copy of disk footer - * dynamic disk header - * block allocation table (BAT) - * data blocks - * disk footer * o The timestamp is seconds since 1/1/2000 12:00:00 AM UTC + * + * This file is divided in 3 parts: + * 1. Common definitions + * 2. Dynamic VHD support + * 3. Fixed VHD support + */ + +/* + * PART 1: Common definitions */ #define VHD_SECTOR_SIZE 512 @@ -85,43 +92,10 @@ struct vhd_footer { uint8_t saved_state; uint8_t _reserved[427]; }; +#if __has_extension(c_static_assert) _Static_assert(sizeof(struct vhd_footer) == VHD_SECTOR_SIZE, "Wrong size for footer"); - -struct vhd_dyn_header { - uint64_t cookie; -#define VHD_HEADER_COOKIE 0x6378737061727365 - uint64_t data_offset; - uint64_t table_offset; - uint32_t version; - uint32_t max_entries; - uint32_t block_size; - uint32_t checksum; - uuid_t parent_id; - uint32_t parent_timestamp; - char _reserved1[4]; - uint16_t parent_name[256]; /* UTF-16 */ - struct { - uint32_t code; - uint32_t data_space; - uint32_t data_length; - uint32_t _reserved; - uint64_t data_offset; - } parent_locator[8]; - char _reserved2[256]; -}; -_Static_assert(sizeof(struct vhd_dyn_header) == VHD_SECTOR_SIZE * 2, - "Wrong size for header"); - -static int -vhd_resize(lba_t imgsz) -{ - uint64_t imagesz; - - imagesz = imgsz * secsz; - imagesz = (imagesz + VHD_BLOCK_SIZE - 1) & ~(VHD_BLOCK_SIZE - 1); - return (image_set_size(imagesz / secsz)); -} +#endif static uint32_t vhd_checksum(void *buf, size_t sz) @@ -136,36 +110,8 @@ vhd_checksum(void *buf, size_t sz) return (~sum); } -static uint32_t -vhd_timestamp(void) -{ - time_t t; - - if (!unit_testing) { - t = time(NULL); - return (t - 0x386d4380); - } - - return (0x01234567); -} - -static void -vhd_uuid_enc(void *buf, const uuid_t *uuid) -{ - uint8_t *p = buf; - int i; - - be32enc(p, uuid->time_low); - be16enc(p + 4, uuid->time_mid); - be16enc(p + 6, uuid->time_hi_and_version); - p[8] = uuid->clock_seq_hi_and_reserved; - p[9] = uuid->clock_seq_low; - for (i = 0; i < _UUID_NODE_LEN; i++) - p[10 + i] = uuid->node[i]; -} - static void -vhd_geometry(struct vhd_footer *footer) +vhd_geometry(struct vhd_footer *footer, uint64_t image_size) { lba_t imgsz; long cth; @@ -180,7 +126,7 @@ vhd_geometry(struct vhd_footer *footer) return; } - imgsz = (image_get_size() * secsz) / VHD_SECTOR_SIZE; + imgsz = image_size / VHD_SECTOR_SIZE; if (imgsz > 65536 * 16 * 255) imgsz = 65536 * 16 * 255; if (imgsz >= 65535 * 16 * 63) { @@ -207,14 +153,121 @@ vhd_geometry(struct vhd_footer *footer) be16enc(&footer->cylinders, cth / footer->heads); } +static uint32_t +vhd_timestamp(void) +{ + time_t t; + + if (!unit_testing) { + t = time(NULL); + return (t - 0x386d4380); + } + + return (0x01234567); +} + +static void +vhd_uuid_enc(void *buf, const uuid_t *uuid) +{ + uint8_t *p = buf; + int i; + + be32enc(p, uuid->time_low); + be16enc(p + 4, uuid->time_mid); + be16enc(p + 6, uuid->time_hi_and_version); + p[8] = uuid->clock_seq_hi_and_reserved; + p[9] = uuid->clock_seq_low; + for (i = 0; i < _UUID_NODE_LEN; i++) + p[10 + i] = uuid->node[i]; +} + +static void +vhd_make_footer(struct vhd_footer *footer, uint64_t image_size, + uint32_t disk_type, uint64_t data_offset) +{ + uuid_t id; + + memset(footer, 0, sizeof(*footer)); + be64enc(&footer->cookie, VHD_FOOTER_COOKIE); + be32enc(&footer->features, VHD_FEATURES_RESERVED); + be32enc(&footer->version, VHD_VERSION); + be64enc(&footer->data_offset, data_offset); + be32enc(&footer->timestamp, vhd_timestamp()); + be32enc(&footer->creator_tool, VHD_CREATOR_TOOL); + be32enc(&footer->creator_version, VHD_CREATOR_VERSION); + be32enc(&footer->creator_os, VHD_CREATOR_OS); + be64enc(&footer->original_size, image_size); + be64enc(&footer->current_size, image_size); + vhd_geometry(footer, image_size); + be32enc(&footer->disk_type, disk_type); + mkimg_uuid(&id); + vhd_uuid_enc(&footer->id, &id); + be32enc(&footer->checksum, vhd_checksum(footer, sizeof(*footer))); +} + +/* + * We round the image size to 2MB for both the dynamic and + * fixed VHD formats. For dynamic VHD, this is needed to + * have the image size be a multiple of the grain size. For + * fixed VHD this is not really needed, but makes sure that + * it's easy to convert from fixed VHD to dynamic VHD. + */ static int -vhd_write(int fd) +vhd_resize(lba_t imgsz) +{ + uint64_t imagesz; + + imagesz = imgsz * secsz; + imagesz = (imagesz + VHD_BLOCK_SIZE - 1) & ~(VHD_BLOCK_SIZE - 1); + return (image_set_size(imagesz / secsz)); +} + +/* + * PART 2: Dynamic VHD support + * + * Notes: + * o File layout: + * copy of disk footer + * dynamic disk header + * block allocation table (BAT) + * data blocks + * disk footer + */ + +struct vhd_dyn_header { + uint64_t cookie; +#define VHD_HEADER_COOKIE 0x6378737061727365 + uint64_t data_offset; + uint64_t table_offset; + uint32_t version; + uint32_t max_entries; + uint32_t block_size; + uint32_t checksum; + uuid_t parent_id; + uint32_t parent_timestamp; + char _reserved1[4]; + uint16_t parent_name[256]; /* UTF-16 */ + struct { + uint32_t code; + uint32_t data_space; + uint32_t data_length; + uint32_t _reserved; + uint64_t data_offset; + } parent_locator[8]; + char _reserved2[256]; +}; +#if __has_extension(c_static_assert) +_Static_assert(sizeof(struct vhd_dyn_header) == VHD_SECTOR_SIZE * 2, + "Wrong size for header"); +#endif + +static int +vhd_dyn_write(int fd) { struct vhd_footer footer; struct vhd_dyn_header header; - uuid_t id; uint64_t imgsz; - lba_t blk, nblks; + lba_t blk, blkcnt, nblks; uint32_t *bat; void *bitmap; size_t batsz; @@ -224,22 +277,7 @@ vhd_write(int fd) imgsz = image_get_size() * secsz; bat_entries = imgsz / VHD_BLOCK_SIZE; - memset(&footer, 0, sizeof(footer)); - be64enc(&footer.cookie, VHD_FOOTER_COOKIE); - be32enc(&footer.features, VHD_FEATURES_RESERVED); - be32enc(&footer.version, VHD_VERSION); - be64enc(&footer.data_offset, sizeof(footer)); - be32enc(&footer.timestamp, vhd_timestamp()); - be32enc(&footer.creator_tool, VHD_CREATOR_TOOL); - be32enc(&footer.creator_version, VHD_CREATOR_VERSION); - be32enc(&footer.creator_os, VHD_CREATOR_OS); - be64enc(&footer.original_size, imgsz); - be64enc(&footer.current_size, imgsz); - vhd_geometry(&footer); - be32enc(&footer.disk_type, VHD_DISK_TYPE_DYNAMIC); - mkimg_uuid(&id); - vhd_uuid_enc(&footer.id, &id); - be32enc(&footer.checksum, vhd_checksum(&footer, sizeof(footer))); + vhd_make_footer(&footer, imgsz, VHD_DISK_TYPE_DYNAMIC, sizeof(footer)); if (sparse_write(fd, &footer, sizeof(footer)) < 0) return (errno); @@ -260,10 +298,14 @@ vhd_write(int fd) if (bat == NULL) return (errno); memset(bat, 0xff, batsz); + blkcnt = VHD_BLOCK_SIZE / secsz; sector = (sizeof(footer) + sizeof(header) + batsz) / VHD_SECTOR_SIZE; for (entry = 0; entry < bat_entries; entry++) { - be32enc(&bat[entry], sector); - sector += (VHD_BLOCK_SIZE / VHD_SECTOR_SIZE) + 1; + blk = entry * blkcnt; + if (image_data(blk, blkcnt)) { + be32enc(&bat[entry], sector); + sector += (VHD_BLOCK_SIZE / VHD_SECTOR_SIZE) + 1; + } } if (sparse_write(fd, bat, batsz) < 0) { free(bat); @@ -277,16 +319,21 @@ vhd_write(int fd) memset(bitmap, 0xff, VHD_SECTOR_SIZE); blk = 0; + blkcnt = VHD_BLOCK_SIZE / secsz; nblks = image_get_size(); while (blk < nblks) { + if (!image_data(blk, blkcnt)) { + blk += blkcnt; + continue; + } if (sparse_write(fd, bitmap, VHD_SECTOR_SIZE) < 0) { error = errno; break; } - error = image_copyout_region(fd, blk, VHD_BLOCK_SIZE / secsz); + error = image_copyout_region(fd, blk, blkcnt); if (error) break; - blk += VHD_BLOCK_SIZE / secsz; + blk += blkcnt; } free(bitmap); if (blk != nblks) @@ -298,11 +345,41 @@ vhd_write(int fd) return (0); } -static struct mkimg_format vhd_format = { +static struct mkimg_format vhd_dyn_format = { .name = "vhd", .description = "Virtual Hard Disk", .resize = vhd_resize, - .write = vhd_write, + .write = vhd_dyn_write, +}; + +FORMAT_DEFINE(vhd_dyn_format); + +/* + * PART 2: Fixed VHD + */ + +static int +vhd_fix_write(int fd) +{ + struct vhd_footer footer; + uint64_t imgsz; + int error; + + error = image_copyout(fd); + if (!error) { + imgsz = image_get_size() * secsz; + vhd_make_footer(&footer, imgsz, VHD_DISK_TYPE_FIXED, ~0ULL); + if (sparse_write(fd, &footer, sizeof(footer)) < 0) + error = errno; + } + return (error); +} + +static struct mkimg_format vhd_fix_format = { + .name = "vhdf", + .description = "Fixed Virtual Hard Disk", + .resize = vhd_resize, + .write = vhd_fix_write, }; -FORMAT_DEFINE(vhd_format); +FORMAT_DEFINE(vhd_fix_format); Modified: stable/10/usr.bin/mkimg/vmdk.c ============================================================================== --- stable/10/usr.bin/mkimg/vmdk.c Mon Jul 28 01:25:49 2014 (r269176) +++ stable/10/usr.bin/mkimg/vmdk.c Mon Jul 28 02:07:16 2014 (r269177) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -115,8 +114,9 @@ vmdk_write(int fd) char *buf, *desc; off_t cur, lim; uint64_t imagesz; + lba_t blkofs, blkcnt; size_t gdsz, gtsz; - uint32_t sec; + uint32_t sec, cursec; int error, desc_len, n, ngrains, ngts; imagesz = (image_get_size() * secsz) / VMDK_SECTOR_SIZE; @@ -179,8 +179,15 @@ vmdk_write(int fd) return (ENOMEM); } - for (n = 0; n < ngrains; n++) - le32enc(gt + n, sec + n * grainsz); + cursec = sec; + blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz; + for (n = 0; n < ngrains; n++) { + blkofs = n * blkcnt; + if (image_data(blkofs, blkcnt)) { + le32enc(gt + n, cursec); + cursec += grainsz; + } + } error = 0; if (!error && sparse_write(fd, &hdr, VMDK_SECTOR_SIZE) < 0) @@ -211,9 +218,19 @@ vmdk_write(int fd) if (buf != NULL) free(buf); } - if (!error) - error = image_copyout(fd); - return (error); + if (error) + return (error); + + blkcnt = (grainsz * VMDK_SECTOR_SIZE) / secsz; + for (n = 0; n < ngrains; n++) { + blkofs = n * blkcnt; + if (image_data(blkofs, blkcnt)) { + error = image_copyout_region(fd, blkofs, blkcnt); + if (error) + return (error); + } + } + return (image_copyout_done(fd)); } static struct mkimg_format vmdk_format = { From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 05:37:11 2014 Return-Path: Delivered-To: svn-src-all@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 2258D3B7; Mon, 28 Jul 2014 05:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 034421E51; Mon, 28 Jul 2014 05:37:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S5bA9a033321; Mon, 28 Jul 2014 05:37:10 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S5bAVw033320; Mon, 28 Jul 2014 05:37:10 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201407280537.s6S5bAVw033320@svn.freebsd.org> From: Ruslan Bukin Date: Mon, 28 Jul 2014 05:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269178 - head/sys/arm/samsung/exynos X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 05:37:11 -0000 Author: br Date: Mon Jul 28 05:37:10 2014 New Revision: 269178 URL: http://svnweb.freebsd.org/changeset/base/269178 Log: Add the rest of combined interrupt groups. Modified: head/sys/arm/samsung/exynos/exynos5_combiner.c Modified: head/sys/arm/samsung/exynos/exynos5_combiner.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_combiner.c Mon Jul 28 02:07:16 2014 (r269177) +++ head/sys/arm/samsung/exynos/exynos5_combiner.c Mon Jul 28 05:37:10 2014 (r269178) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #define NGRP 32 -#define ITABLE_LEN 24 #define IESR(n) (0x10 * n + 0x0) /* Interrupt enable set */ #define IECR(n) (0x10 * n + 0x4) /* Interrupt enable clear */ @@ -118,7 +117,7 @@ struct combiner_entry { char *source_name; }; -static struct combiner_entry interrupt_table[ITABLE_LEN] = { +static struct combiner_entry interrupt_table[] = { { 63, 1, "EINT[15]" }, { 63, 0, "EINT[14]" }, { 62, 1, "EINT[13]" }, @@ -143,8 +142,116 @@ static struct combiner_entry interrupt_t { 55, 4, "MCT_G1" }, { 55, 3, "MCT_G0" }, { 55, 0, "EINT[0]" }, + { 54, 7, "CPU_nCNTVIRQ[1]" }, + { 54, 6, "CPU_nCTIIRQ[1]" }, + { 54, 5, "CPU_nCNTPSIRQ[1]" }, + { 54, 4, "CPU_nPMUIRQ[1]" }, + { 54, 3, "CPU_nCNTPNSIRQ[1]" }, + { 54, 2, "CPU_PARITYFAILSCU[1]" }, + { 54, 1, "CPU_nCNTHPIRQ[1]" }, + { 54, 0, "PARITYFAIL[1]" }, + { 53, 1, "CPU_nIRQ[1]" }, + { 52, 0, "CPU_nIRQ[0]" }, + { 51, 7, "CPU_nRAMERRIRQ" }, + { 51, 6, "CPU_nAXIERRIRQ" }, + { 51, 4, "INT_COMB_ISP_GIC" }, + { 51, 3, "INT_COMB_IOP_GIC" }, + { 51, 2, "CCI_nERRORIRQ" }, + { 51, 1, "INT_COMB_ARMISP_GIC" }, + { 51, 0, "INT_COMB_ARMIOP_GIC" }, + { 50, 7, "DISP1[3]" }, + { 50, 6, "DISP1[2]" }, + { 50, 5, "DISP1[1]" }, + { 50, 4, "DISP1[0]" }, + { 49, 3, "SSCM_PULSE_IRQ_C2CIF[1]" }, + { 49, 2, "SSCM_PULSE_IRQ_C2CIF[0]" }, + { 49, 1, "SSCM_IRQ_C2CIF[1]" }, + { 49, 0, "SSCM_IRQ_C2CIF[0]" }, + { 48, 3, "PEREV_M1_CDREX" }, + { 48, 2, "PEREV_M0_CDREX" }, + { 48, 1, "PEREV_A1_CDREX" }, + { 48, 0, "PEREV_A0_CDREX" }, + { 47, 3, "MDMA0_ABORT" }, + /* 46 is fully reserved */ + { 45, 1, "MDMA1_ABORT" }, + /* 44 is fully reserved */ + { 43, 7, "SYSMMU_DRCISP[1]" }, + { 43, 6, "SYSMMU_DRCISP[0]" }, + { 43, 1, "SYSMMU_ODC[1]" }, + { 43, 0, "SYSMMU_ODC[0]" }, + { 42, 7, "SYSMMU_ISP[1]" }, + { 42, 6, "SYSMMU_ISP[0]" }, + { 42, 5, "SYSMMU_DIS0[1]" }, + { 42, 4, "SYSMMU_DIS0[0]" }, + { 42, 3, "DP1" }, + { 41, 5, "SYSMMU_DIS1[1]" }, + { 41, 4, "SYSMMU_DIS1[0]" }, + { 40, 6, "SYSMMU_MFCL[1]" }, + { 40, 5, "SYSMMU_MFCL[0]" }, + { 39, 5, "SYSMMU_TV_M0[1]" }, + { 39, 4, "SYSMMU_TV_M0[0]" }, + { 39, 3, "SYSMMU_MDMA1[1]" }, + { 39, 2, "SYSMMU_MDMA1[0]" }, + { 39, 1, "SYSMMU_MDMA0[1]" }, + { 39, 0, "SYSMMU_MDMA0[0]" }, + { 38, 7, "SYSMMU_SSS[1]" }, + { 38, 6, "SYSMMU_SSS[0]" }, + { 38, 5, "SYSMMU_RTIC[1]" }, + { 38, 4, "SYSMMU_RTIC[0]" }, + { 38, 3, "SYSMMU_MFCR[1]" }, + { 38, 2, "SYSMMU_MFCR[0]" }, + { 38, 1, "SYSMMU_ARM[1]" }, + { 38, 0, "SYSMMU_ARM[0]" }, + { 37, 7, "SYSMMU_3DNR[1]" }, + { 37, 6, "SYSMMU_3DNR[0]" }, + { 37, 5, "SYSMMU_MCUISP[1]" }, + { 37, 4, "SYSMMU_MCUISP[0]" }, + { 37, 3, "SYSMMU_SCALERCISP[1]" }, + { 37, 2, "SYSMMU_SCALERCISP[0]" }, + { 37, 1, "SYSMMU_FDISP[1]" }, + { 37, 0, "SYSMMU_FDISP[0]" }, + { 36, 7, "MCUIOP_CTIIRQ" }, + { 36, 6, "MCUIOP_PMUIRQ" }, + { 36, 5, "MCUISP_CTIIRQ" }, + { 36, 4, "MCUISP_PMUIRQ" }, + { 36, 3, "SYSMMU_JPEGX[1]" }, + { 36, 2, "SYSMMU_JPEGX[0]" }, + { 36, 1, "SYSMMU_ROTATOR[1]" }, + { 36, 0, "SYSMMU_ROTATOR[0]" }, + { 35, 7, "SYSMMU_SCALERPISP[1]" }, + { 35, 6, "SYSMMU_SCALERPISP[0]" }, + { 35, 5, "SYSMMU_FIMC_LITE0[1]" }, + { 35, 4, "SYSMMU_FIMC_LITE0[0]" }, + { 35, 3, "SYSMMU_DISP1_M0[1]" }, + { 35, 2, "SYSMMU_DISP1_M0[0]" }, + { 35, 1, "SYSMMU_FIMC_LITE2[1]" }, + { 35, 0, "SYSMMU_FIMC_LITE2[0]" }, + { 34, 7, "SYSMMU_GSCL3[1]" }, + { 34, 6, "SYSMMU_GSCL3[0]" }, + { 34, 5, "SYSMMU_GSCL2[1]" }, + { 34, 4, "SYSMMU_GSCL2[0]" }, + { 34, 3, "SYSMMU_GSCL1[1]" }, + { 34, 2, "SYSMMU_GSCL1[0]" }, + { 34, 1, "SYSMMU_GSCL0[1]" }, + { 34, 0, "SYSMMU_GSCL0[0]" }, + { 33, 7, "CPU_nCNTVIRQ[0]" }, + { 33, 6, "CPU_nCNTPSIRQ[0]" }, + { 33, 5, "CPU_nCNTPSNIRQ[0]" }, + { 33, 4, "CPU_nCNTHPIRQ[0]" }, + { 33, 3, "CPU_nCTIIRQ[0]" }, + { 33, 2, "CPU_nPMUIRQ[0]" }, + { 33, 1, "CPU_PARITYFAILSCU[0]" }, + { 33, 0, "CPU_PARITYFAIL0" }, + { 32, 7, "TZASC_XR1BXW" }, + { 32, 6, "TZASC_XR1BXR" }, + { 32, 5, "TZASC_XLBXW" }, + { 32, 4, "TZASC_XLBXR" }, + { 32, 3, "TZASC_DRBXW" }, + { 32, 2, "TZASC_DRBXR" }, + { 32, 1, "TZASC_CBXW" }, + { 32, 0, "TZASC_CBXR" }, - /* TODO: add groups 54-32 */ + { -1, -1, NULL }, }; struct combined_intr { @@ -212,7 +319,7 @@ combiner_setup_intr(char *source_name, v entry = NULL; - for (i = 0; i < ITABLE_LEN; i++) { + for (i = 0; i < NGRP && interrupt_table[i].bit != -1; i++) { if (strcmp(interrupt_table[i].source_name, source_name) == 0) { entry = &interrupt_table[i]; } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 07:20:23 2014 Return-Path: Delivered-To: svn-src-all@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 25AD786E; Mon, 28 Jul 2014 07:20: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1360E27F9; Mon, 28 Jul 2014 07:20:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S7KMZd080143; Mon, 28 Jul 2014 07:20:22 GMT (envelope-from gahr@svn.freebsd.org) Received: (from gahr@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S7KMxp080139; Mon, 28 Jul 2014 07:20:22 GMT (envelope-from gahr@svn.freebsd.org) Message-Id: <201407280720.s6S7KMxp080139@svn.freebsd.org> From: Pietro Cerutti Date: Mon, 28 Jul 2014 07:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269179 - in head: lib/libsbuf 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 07:20:23 -0000 Author: gahr (ports committer) Date: Mon Jul 28 07:20:22 2014 New Revision: 269179 URL: http://svnweb.freebsd.org/changeset/base/269179 Log: Unbreak the ABI by reverting r268494 until the compat shims are provided Modified: head/lib/libsbuf/Makefile head/sys/kern/subr_sbuf.c head/sys/sys/sbuf.h Modified: head/lib/libsbuf/Makefile ============================================================================== --- head/lib/libsbuf/Makefile Mon Jul 28 05:37:10 2014 (r269178) +++ head/lib/libsbuf/Makefile Mon Jul 28 07:20:22 2014 (r269179) @@ -4,7 +4,7 @@ LIB= sbuf SHLIBDIR?= /lib SRCS= subr_sbuf.c -SHLIB_MAJOR = 7 +SHLIB_MAJOR = 6 SYMBOL_MAPS= ${.CURDIR}/Symbol.map VERSION_DEF= ${.CURDIR}/Version.def Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Mon Jul 28 05:37:10 2014 (r269178) +++ head/sys/kern/subr_sbuf.c Mon Jul 28 07:20:22 2014 (r269179) @@ -152,16 +152,11 @@ static int sbuf_extend(struct sbuf *s, int addlen) { char *newbuf; - size_t newsize; + int newsize; if (!SBUF_CANEXTEND(s)) return (-1); newsize = sbuf_extendsize(s->s_size + addlen); - if (s->s_buf == s->s_static_buf && newsize <= sizeof(s->s_static_buf)) { - s->s_size = sizeof(s->s_static_buf); - return (0); - } - newbuf = SBMALLOC(newsize); if (newbuf == NULL) return (-1); @@ -181,7 +176,7 @@ sbuf_extend(struct sbuf *s, int addlen) * big enough to hold at least length characters. */ static struct sbuf * -sbuf_newbuf(struct sbuf *s, char *buf, size_t length, int flags) +sbuf_newbuf(struct sbuf *s, char *buf, int length, int flags) { memset(s, 0, sizeof(*s)); @@ -200,11 +195,6 @@ sbuf_newbuf(struct sbuf *s, char *buf, s if ((flags & SBUF_AUTOEXTEND) != 0) s->s_size = sbuf_extendsize(s->s_size); - if (s->s_size <= sizeof(s->s_static_buf)) { - s->s_buf = s->s_static_buf; - return (s); - } - s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) return (NULL); @@ -293,19 +283,21 @@ sbuf_clear(struct sbuf *s) * Effectively truncates the sbuf at the new position. */ int -sbuf_setpos(struct sbuf *s, size_t pos) +sbuf_setpos(struct sbuf *s, ssize_t pos) { assert_sbuf_integrity(s); assert_sbuf_state(s, 0); + KASSERT(pos >= 0, + ("attempt to seek to a negative position (%jd)", (intmax_t)pos)); KASSERT(pos < s->s_size, ("attempt to seek past end of sbuf (%jd >= %jd)", (intmax_t)pos, (intmax_t)s->s_size)); KASSERT(!SBUF_ISSECTION(s), ("attempt to seek when in a section")); - if (pos > s->s_len) + if (pos < 0 || pos > s->s_len) return (-1); s->s_len = pos; return (0); @@ -569,8 +561,7 @@ int sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap) { va_list ap_copy; - size_t len; - int error; + int error, len; assert_sbuf_integrity(s); assert_sbuf_state(s, 0); Modified: head/sys/sys/sbuf.h ============================================================================== --- head/sys/sys/sbuf.h Mon Jul 28 05:37:10 2014 (r269178) +++ head/sys/sys/sbuf.h Mon Jul 28 07:20:22 2014 (r269179) @@ -44,8 +44,8 @@ struct sbuf { sbuf_drain_func *s_drain_func; /* drain function */ void *s_drain_arg; /* user-supplied drain argument */ int s_error; /* current error code */ - size_t s_size; /* size of storage buffer */ - size_t s_len; /* current length of string */ + ssize_t s_size; /* size of storage buffer */ + ssize_t s_len; /* current length of string */ #define SBUF_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ #define SBUF_AUTOEXTEND 0x00000001 /* automatically extend buffer */ #define SBUF_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */ @@ -55,9 +55,6 @@ struct sbuf { #define SBUF_INSECTION 0x00100000 /* set by sbuf_start_section() */ int s_flags; /* flags */ ssize_t s_sect_len; /* current length of section */ -#define SBUF_STATIC_LEN 64 /* static storage buffer length */ - char s_static_buf[SBUF_STATIC_LEN]; - /* static storage buffer */ }; __BEGIN_DECLS @@ -68,7 +65,7 @@ struct sbuf *sbuf_new(struct sbuf *, cha #define sbuf_new_auto() \ sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND) void sbuf_clear(struct sbuf *); -int sbuf_setpos(struct sbuf *, size_t); +int sbuf_setpos(struct sbuf *, ssize_t); int sbuf_bcat(struct sbuf *, const void *, size_t); int sbuf_bcpy(struct sbuf *, const void *, size_t); int sbuf_cat(struct sbuf *, const char *); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 08:22:08 2014 Return-Path: Delivered-To: svn-src-all@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 ADE4C12D; Mon, 28 Jul 2014 08:22: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BBB62221; Mon, 28 Jul 2014 08:22:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6S8M8ak012195; Mon, 28 Jul 2014 08:22:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6S8M8nZ012194; Mon, 28 Jul 2014 08:22:08 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407280822.s6S8M8nZ012194@svn.freebsd.org> From: Xin LI Date: Mon, 28 Jul 2014 08:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269180 - head/sbin/ping6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 08:22:08 -0000 Author: delphij Date: Mon Jul 28 08:22:08 2014 New Revision: 269180 URL: http://svnweb.freebsd.org/changeset/base/269180 Log: When interval is set to very small value with limited amount of packets, ping6(8) would quit before the remote side gets a chance to respond. Solve this by resetting the itimer when we have reached the maximum packet number have reached, but let the other handling to continue. PR: bin/151023 Submitted by: tjmao at tjmao.net MFC after: 2 weeks Modified: head/sbin/ping6/ping6.c Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Mon Jul 28 07:20:22 2014 (r269179) +++ head/sbin/ping6/ping6.c Mon Jul 28 08:22:08 2014 (r269180) @@ -1090,8 +1090,14 @@ main(int argc, char *argv[]) /* signal handling */ if (seenalrm) { /* last packet sent, timeout reached? */ - if (npackets && ntransmitted >= npackets) - break; + if (npackets && ntransmitted >= npackets) { + struct timeval zerotime = {0, 0}; + itimer.it_value = zerotime; + itimer.it_interval = zerotime; + (void)setitimer(ITIMER_REAL, &itimer, NULL); + seenalrm = 0; /* clear flag */ + continue; + } retransmit(); seenalrm = 0; continue; From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 10:01:24 2014 Return-Path: Delivered-To: svn-src-all@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 3D66EC72; Mon, 28 Jul 2014 10:01:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B5E82D21; Mon, 28 Jul 2014 10:01:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SA1OSg058261; Mon, 28 Jul 2014 10:01:24 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SA1OVj058260; Mon, 28 Jul 2014 10:01:24 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201407281001.s6SA1OVj058260@svn.freebsd.org> From: Antoine Brodin Date: Mon, 28 Jul 2014 10:01:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269181 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 10:01:24 -0000 Author: antoine Date: Mon Jul 28 10:01:23 2014 New Revision: 269181 URL: http://svnweb.freebsd.org/changeset/base/269181 Log: libsbuf.so.6 is no longer obsolete Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Jul 28 08:22:08 2014 (r269180) +++ head/ObsoleteFiles.inc Mon Jul 28 10:01:23 2014 (r269181) @@ -40,8 +40,6 @@ # 20140723: renamed to PCBGROUP.9 OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz -# 20140719: libsbuf version bump -OLD_LIBS+=lib/libsbuf.so.6 # 20140718: Remove obsolete man pages OLD_FILES+=usr/share/man/man9/zero_copy.9.gz OLD_FILES+=usr/share/man/man9/zero_copy_sockets.9.gz From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 10:17:41 2014 Return-Path: Delivered-To: svn-src-all@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 ABDDFDA; Mon, 28 Jul 2014 10:17: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9990C2014; Mon, 28 Jul 2014 10:17:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SAHfUm064154; Mon, 28 Jul 2014 10:17:41 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SAHf6o064153; Mon, 28 Jul 2014 10:17:41 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201407281017.s6SAHf6o064153@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 28 Jul 2014 10:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269182 - head/lib/libpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 10:17:41 -0000 Author: gnn Date: Mon Jul 28 10:17:41 2014 New Revision: 269182 URL: http://svnweb.freebsd.org/changeset/base/269182 Log: Update the list of cross references to include the more modern set of processors that we now support. Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Mon Jul 28 10:01:23 2014 (r269181) +++ head/lib/libpmc/pmc.3 Mon Jul 28 10:17:41 2014 (r269182) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2008 +.Dd July 28, 2014 .Dt PMC 3 .Os .Sh NAME @@ -525,14 +525,26 @@ API is .Xr pmc.atom 3 , .Xr pmc.core 3 , .Xr pmc.core2 3 , +.Xr pmc.haswell 3 , +.Xr pmc.haswelluc 3 , .Xr pmc.iaf 3 , +.Xr pmc.ivybridge 3 , +.Xr pmc.ivybridgexeon 3 , .Xr pmc.k7 3 , .Xr pmc.k8 3 , +.Xr pmc.mips24k 3 , +.Xr pmc.octeon 3 , .Xr pmc.p4 3 , .Xr pmc.p5 3 , .Xr pmc.p6 3 , +.Xr pmc.sandybridge 3 , +.Xr pmc.sandybridgeuc 3 , +.Xr pmc.sandybridgexeon 3 , .Xr pmc.soft 3 , .Xr pmc.tsc 3 , +.Xr pmc.westmere 3 , +.Xr pmc.westmereuc 3 , +.Xr pmc.xscale 3 , .Xr pmclog 3 , .Xr hwpmc 4 , .Xr pmccontrol 8 , From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 12:47:10 2014 Return-Path: Delivered-To: svn-src-all@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 C1B6A44B; Mon, 28 Jul 2014 12:47: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2A0E24AF; Mon, 28 Jul 2014 12:47:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SClANK034533; Mon, 28 Jul 2014 12:47:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SCl9kF034529; Mon, 28 Jul 2014 12:47:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407281247.s6SCl9kF034529@svn.freebsd.org> From: Alexander Motin Date: Mon, 28 Jul 2014 12:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269183 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 12:47:10 -0000 Author: mav Date: Mon Jul 28 12:47:09 2014 New Revision: 269183 URL: http://svnweb.freebsd.org/changeset/base/269183 Log: Add netmasks support to initiator-portal option. MFC after: 2 weeks Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Mon Jul 28 10:17:41 2014 (r269182) +++ head/usr.sbin/ctld/ctl.conf.5 Mon Jul 28 12:47:09 2014 (r269183) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 20, 2014 +.Dd July 28, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -119,7 +119,7 @@ name. Otherwise, only initiators with names matching one of defined ones will be allowed to connect. .It Ic initiator-portal Ao Ar address Ac -Specifies iSCSI initiator portal - IPv4 or IPv6 address. +Specifies iSCSI initiator portal - IPv4 or IPv6 address or network. If not defined, there will be no restrictions based on initiator address. Otherwise, only initiators with addresses matching one of defined Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Mon Jul 28 10:17:41 2014 (r269182) +++ head/usr.sbin/ctld/ctld.c Mon Jul 28 12:47:09 2014 (r269183) @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -319,14 +320,56 @@ const struct auth_portal * auth_portal_new(struct auth_group *ag, const char *portal) { struct auth_portal *ap; + char *net, *mask, *str, *tmp; + int len, dm, m; ap = calloc(1, sizeof(*ap)); if (ap == NULL) log_err(1, "calloc"); ap->ap_auth_group = ag; ap->ap_initator_portal = checked_strdup(portal); + mask = str = checked_strdup(portal); + net = strsep(&mask, "/"); + if (net[0] == '[') + net++; + len = strlen(net); + if (len == 0) + goto error; + if (net[len - 1] == ']') + net[len - 1] = 0; + if (strchr(net, ':') != NULL) { + struct sockaddr_in6 *sin6 = + (struct sockaddr_in6 *)&ap->ap_sa; + + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_family = AF_INET6; + if (inet_pton(AF_INET6, net, &sin6->sin6_addr) <= 0) + goto error; + dm = 128; + } else { + struct sockaddr_in *sin = + (struct sockaddr_in *)&ap->ap_sa; + + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + if (inet_pton(AF_INET, net, &sin->sin_addr) <= 0) + goto error; + dm = 32; + } + if (mask != NULL) { + m = strtol(mask, &tmp, 0); + if (m < 0 || m > dm || tmp[0] != 0) + goto error; + } else + m = dm; + ap->ap_mask = m; + free(str); TAILQ_INSERT_TAIL(&ag->ag_portals, ap, ap_next); return (ap); + +error: + log_errx(1, "Incorrect initiator portal '%s'", portal); + return (NULL); } static void @@ -347,13 +390,34 @@ auth_portal_defined(const struct auth_gr } const struct auth_portal * -auth_portal_find(const struct auth_group *ag, const char *portal) +auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *ss) { - const struct auth_portal *auth_portal; + const struct auth_portal *ap; + uint8_t *a, *b, bmask; + int i; - TAILQ_FOREACH(auth_portal, &ag->ag_portals, ap_next) { - if (strcmp(auth_portal->ap_initator_portal, portal) == 0) - return (auth_portal); + TAILQ_FOREACH(ap, &ag->ag_portals, ap_next) { + if (ap->ap_sa.ss_family != ss->ss_family) + continue; + if (ss->ss_family == AF_INET) { + a = (uint8_t *)&((struct sockaddr_in *)ss)->sin_addr; + b = (uint8_t *)&((struct sockaddr_in *)&ap->ap_sa)->sin_addr; + } else { + a = (uint8_t *)&((struct sockaddr_in6 *)ss)->sin6_addr; + b = (uint8_t *)&((struct sockaddr_in6 *)&ap->ap_sa)->sin6_addr; + } + for (i = 0; i < ap->ap_mask / 8; i++) { + if (a[i] != b[i]) + goto next; + } + if (ap->ap_mask % 8) { + bmask = 0xff << (8 - (ap->ap_mask % 8)); + if ((a[i] & bmask) != (b[i] & bmask)) + goto next; + } + return (ap); +next: + ; } return (NULL); @@ -950,7 +1014,8 @@ lun_option_set(struct lun_option *lo, co } static struct connection * -connection_new(struct portal *portal, int fd, const char *host) +connection_new(struct portal *portal, int fd, const char *host, + const struct sockaddr *client_sa) { struct connection *conn; @@ -960,6 +1025,7 @@ connection_new(struct portal *portal, in conn->conn_portal = portal; conn->conn_socket = fd; conn->conn_initiator_addr = checked_strdup(host); + memcpy(&conn->conn_initiator_sa, client_sa, client_sa->sa_len); /* * Default values, from RFC 3720, section 12. @@ -1586,7 +1652,7 @@ wait_for_children(bool block) static void handle_connection(struct portal *portal, int fd, - const struct sockaddr *client_sa, socklen_t client_salen, bool dont_fork) + const struct sockaddr *client_sa, bool dont_fork) { struct connection *conn; int error; @@ -1621,7 +1687,7 @@ handle_connection(struct portal *portal, } pidfile_close(conf->conf_pidfh); - error = getnameinfo(client_sa, client_salen, + error = getnameinfo(client_sa, client_sa->sa_len, host, sizeof(host), NULL, 0, NI_NUMERICHOST); if (error != 0) log_errx(1, "getnameinfo: %s", gai_strerror(error)); @@ -1631,7 +1697,7 @@ handle_connection(struct portal *portal, log_set_peer_addr(host); setproctitle("%s", host); - conn = connection_new(portal, fd, host); + conn = connection_new(portal, fd, host, client_sa); set_timeout(conf); kernel_capsicate(); login(conn); @@ -1687,6 +1753,9 @@ main_loop(struct conf *conf, bool dont_f client_salen = sizeof(client_sa); kernel_accept(&connection_id, &portal_id, (struct sockaddr *)&client_sa, &client_salen); + if (client_salen < client_sa.ss_len) + log_errx(1, "salen %u < %u", + client_salen, client_sa.ss_len); log_debugx("incoming connection, id %d, portal id %d", connection_id, portal_id); @@ -1703,8 +1772,7 @@ main_loop(struct conf *conf, bool dont_f found: handle_connection(portal, connection_id, - (struct sockaddr *)&client_sa, client_salen, - dont_fork); + (struct sockaddr *)&client_sa, dont_fork); } else { #endif assert(proxy_mode == false); @@ -1731,9 +1799,13 @@ found: &client_salen); if (client_fd < 0) log_err(1, "accept"); + if (client_salen < client_sa.ss_len) + log_errx(1, "salen %u < %u", + client_salen, + client_sa.ss_len); handle_connection(portal, client_fd, (struct sockaddr *)&client_sa, - client_salen, dont_fork); + dont_fork); break; } } Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Mon Jul 28 10:17:41 2014 (r269182) +++ head/usr.sbin/ctld/ctld.h Mon Jul 28 12:47:09 2014 (r269183) @@ -35,8 +35,8 @@ #include #ifdef ICL_KERNEL_PROXY #include -#include #endif +#include #include #include @@ -67,6 +67,8 @@ struct auth_portal { TAILQ_ENTRY(auth_portal) ap_next; struct auth_group *ap_auth_group; char *ap_initator_portal; + struct sockaddr_storage ap_sa; + int ap_mask; }; #define AG_TYPE_UNKNOWN 0 @@ -179,6 +181,7 @@ struct connection { char *conn_initiator_addr; char *conn_initiator_alias; uint8_t conn_initiator_isid[6]; + struct sockaddr_storage conn_initiator_sa; uint32_t conn_cmdsn; uint32_t conn_statsn; size_t conn_max_data_segment_length; @@ -235,7 +238,7 @@ const struct auth_portal *auth_portal_ne const char *initiator_portal); bool auth_portal_defined(const struct auth_group *ag); const struct auth_portal *auth_portal_find(const struct auth_group *ag, - const char *initiator_portal); + const struct sockaddr_storage *sa); struct portal_group *portal_group_new(struct conf *conf, const char *name); void portal_group_delete(struct portal_group *pg); Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Mon Jul 28 10:17:41 2014 (r269182) +++ head/usr.sbin/ctld/login.c Mon Jul 28 12:47:09 2014 (r269183) @@ -954,7 +954,7 @@ login(struct connection *conn) } if (auth_portal_defined(ag)) { - if (auth_portal_find(ag, conn->conn_initiator_addr) == NULL) { + if (auth_portal_find(ag, &conn->conn_initiator_sa) == NULL) { login_send_error(request, 0x02, 0x02); log_errx(1, "initiator does not match allowed " "initiator portals"); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 13:01:49 2014 Return-Path: Delivered-To: svn-src-all@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 7A8AD4AD; Mon, 28 Jul 2014 13:01:49 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 2733D2693; Mon, 28 Jul 2014 13:01:48 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 58645D483A6; Mon, 28 Jul 2014 22:39:12 +1000 (EST) Date: Mon, 28 Jul 2014 22:39:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Xin LI Subject: Re: svn commit: r269180 - head/sbin/ping6 In-Reply-To: <201407280822.s6S8M8nZ012194@svn.freebsd.org> Message-ID: <20140728204019.V2446@besplex.bde.org> References: <201407280822.s6S8M8nZ012194@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dZS5gxne c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=X5Tdy0IGBsYA:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=ksqxlQUqAAAA:8 a=Vdyic15ku6N4TUeXP_8A:9 a=CjuIK1q_8ugA:10 a=jPZpO7HPqmwA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 13:01:49 -0000 On Mon, 28 Jul 2014, Xin LI wrote: > Log: > When interval is set to very small value with limited amount of packets, > ping6(8) would quit before the remote side gets a chance to respond. > > Solve this by resetting the itimer when we have reached the maximum packet > number have reached, but let the other handling to continue. > > PR: bin/151023 > Submitted by: tjmao at tjmao.net > MFC after: 2 weeks ping6 is still using the old signal code which fenner improved in ping in 1998. It still uses SIGALRM for the main timeout, and doesn't even use sigaction() to set up signals. ping uses select() for the main timeout. It never uses setitimer() directly and only uses alarm() for -t. ping6 only uses a timeout with select() in the -f case. Except it has another misfeature: it has extra code to optionally use poll() instead of select(). This option is hard-configured to always enabled. So ping6 uses timeouts with poll() instead of with select(), but only in the -f case. Apart from the extra code, poll() also loses by only having millisecond resolution. Since the poll() timeout is currently only used for -f, this doesn't matter. Since 1/hz is normally 1 millisecond or larger and intervals smaller than 1 millisecond are not very useful, this doesn't matter much. Perhaps updating ping6 to the 1998 quality of ping would fix the bug. > Modified: > head/sbin/ping6/ping6.c > > Modified: head/sbin/ping6/ping6.c > ============================================================================== > --- head/sbin/ping6/ping6.c Mon Jul 28 07:20:22 2014 (r269179) > +++ head/sbin/ping6/ping6.c Mon Jul 28 08:22:08 2014 (r269180) > @@ -1090,8 +1090,14 @@ main(int argc, char *argv[]) > /* signal handling */ > if (seenalrm) { > /* last packet sent, timeout reached? */ > - if (npackets && ntransmitted >= npackets) > - break; > + if (npackets && ntransmitted >= npackets) { > + struct timeval zerotime = {0, 0}; > + itimer.it_value = zerotime; > + itimer.it_interval = zerotime; > + (void)setitimer(ITIMER_REAL, &itimer, NULL); > + seenalrm = 0; /* clear flag */ > + continue; > + } Style bugs: - nested declaration - initialization in declaration - pessimal declaration and initialization. The variable should be static const with default initialization to 0. The compiler might optimize it to much the same - extra code/initializations. You can use a static const itimer with default initialization to 0 and don't need to laboriously copy timevals into it. Nothing is gained from not assuming anything about the internals of struct itimer, since the above initialization assumes the internals of struct timeval. It's actually a smaller assumption to use the default initialization of a static object -- this initializes all the padding, and the only assumption is that all-bits-0 gives values of 0 for all the fields in the structure and that there are no fields which don't really have a value. - banal comment. > retransmit(); > seenalrm = 0; > continue; I forget how this works. The corresponding code in ping is: % if (!npackets || ntransmitted < npackets) % pinger(); % else { % if (almost_done) % break; % almost_done = 1; % intvl.tv_usec = 0; % if (nreceived) { % intvl.tv_sec = 2 * tmax / 1000; % if (!intvl.tv_sec) % intvl.tv_sec = 1; % } else { % intvl.tv_sec = waittime / 1000; % intvl.tv_usec = waittime % 1000 * 1000; % } % } This seems to do things related to the patch but is more sophisticated. Canceling the timer completely doesn't seem right. ping sets a special nonzero timeout for completion unless it is already set. waittime used to be hard-coded to 10 seconds but is now controlled by the -W option which allows it to be 0. Other bugs related to timeout intervals: - the hard-coded flood timeout of 10 msec may have been correct for 1 Mbps ethernet, but is now nonsense. You can set a much smaller timeout using -i. This loads the network more than -f but doesn't give other features of -f. - the restrictions to privileged users on -i and some on -f are nonsense. Anyone can load the network about as much and the local machine much more using "while :; do ping -c1 host; done" with about as many instances as CPUs. - ping* has mounds of bad code for -i: ping.c: % case 'i': /* wait between sending packets */ % t = strtod(optarg, &ep) * 1000.0; The API made the timeout in milliseconds, so it is excessively restricted in another way and wouldn't be further restricted by using poll(). % if (*ep || ep == optarg || t > (double)INT_MAX) % errx(EX_USAGE, "invalid timing interval: `%s'", % optarg); Missing checking for negative intervals and overflow of such. I like negative intervals meaning 0, but with no overflow checking and blind passing of them to functions not expecting them, they are worse than an up-front error. I think this timeout is only passed to functions like select() which consider negative timeouts invalid. Negative timevals are valid, but negative timeouts can reasonably be considered invalid. % options |= F_INTERVAL; % interval = (int)t; % if (uid && interval < 1000) { % errno = EPERM; % err(EX_NOPERM, "-i interval too short"); % } Bogus restriction on unprivileged users. % break; ping6.c: % case 'i': /* wait between sending packets */ % intval = strtod(optarg, &e); Overflow before overflow can be checked for. ping assigned to a variable of the correct type. Using strtod() is bogus since ping6 still hasn't caught up with ping's change to support sub-second intervals, except possibly to change the function name here. % if (*optarg == '\0' || *e != '\0') % errx(1, "illegal timing interval %s", optarg); Less canonical error checking than for ping. Missing overflow checking. Bad wording "illegal". There are no lawyers here. Invalid timing intervals are not even detected. Only invalid formats are detected. % if (intval < 1 && getuid()) { % errx(1, "%s: only root may use interval < 1s", % strerror(EPERM)); % } Same restriction as ping (it's to 1 second instead of 1000 milliseconds). Better wording giving more details about who is restricted. Missing the style bug of conversion to sysexits. % interval.tv_sec = (long)intval; Bogus cast (no effect since intval has type int). tv_sec has type time_t, not long. Casting to that would make some sense to turn off warnings (we check for overflow later), but in practice time_t is going to be no smaller than int so again the cast has no effect. % interval.tv_usec = % (long)((intval - interval.tv_sec) * 1000000); % if (interval.tv_sec < 0) % errx(1, "illegal timing interval %s", optarg); Negative values are detected here. A silly way to do it. The check should be up-front together with the check that the value fits in intval. Then only 1 errx() describes both. The different error messages for slightly different cases are a little over-engineered, especially when the checks to classify the cases are broken. % /* less than 1/hz does not make sense */ % if (interval.tv_sec == 0 && interval.tv_usec < 1) { % warnx("too small interval, raised to .000001"); % interval.tv_usec = 1; % } This code is nonsense. All it does is prevent root from using a timeout of 0, but that works fine in ping (I think it really does mean a timeout of 0. This almost makes sense, and gives an effect that cannot be achieved by root users in another way. It causes select() to not wait, so the select() calls just waste time). For non-root, the timeout is >= 1, so it cannot be < 1/hz. The restriction to 1/hz is now wrong, since fine-grained timouts can do better with that. However, the code doesn't implement the 1/hz restriction; it only implements a nonzero restriction. So all it does is warn root users about an interval of 0 being too small and giving a misleading indication of what it is raised to. Even fine-grained timeouts will probably raise it to a more than 1 microsecond (I think they can only give 10-20 usec on fast x86's). % options |= F_INTERVAL; % break; Bruce From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 13:47:03 2014 Return-Path: Delivered-To: svn-src-all@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 3D15E6BF; Mon, 28 Jul 2014 13:47:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2AAD42AF5; Mon, 28 Jul 2014 13:47:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SDl3EA064668; Mon, 28 Jul 2014 13:47:03 GMT (envelope-from akiyama@svn.freebsd.org) Received: (from akiyama@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SDl3H9064667; Mon, 28 Jul 2014 13:47:03 GMT (envelope-from akiyama@svn.freebsd.org) Message-Id: <201407281347.s6SDl3H9064667@svn.freebsd.org> From: Shunsuke Akiyama Date: Mon, 28 Jul 2014 13:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269184 - head/sys/x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 13:47:03 -0000 Author: akiyama Date: Mon Jul 28 13:47:02 2014 New Revision: 269184 URL: http://svnweb.freebsd.org/changeset/base/269184 Log: Add missing newline to output dmesg properly. Modified: head/sys/x86/acpica/madt.c Modified: head/sys/x86/acpica/madt.c ============================================================================== --- head/sys/x86/acpica/madt.c Mon Jul 28 12:47:09 2014 (r269183) +++ head/sys/x86/acpica/madt.c Mon Jul 28 13:47:02 2014 (r269184) @@ -299,7 +299,7 @@ interrupt_polarity(UINT16 IntiFlags, UIN switch (IntiFlags & ACPI_MADT_POLARITY_MASK) { default: - printf("WARNING: Bogus Interrupt Polarity. Assume CONFORMS"); + printf("WARNING: Bogus Interrupt Polarity. Assume CONFORMS\n"); /* FALLTHROUGH*/ case ACPI_MADT_POLARITY_CONFORMS: if (Source == AcpiGbl_FADT.SciInterrupt) @@ -319,7 +319,7 @@ interrupt_trigger(UINT16 IntiFlags, UINT switch (IntiFlags & ACPI_MADT_TRIGGER_MASK) { default: - printf("WARNING: Bogus Interrupt Trigger Mode. Assume CONFORMS."); + printf("WARNING: Bogus Interrupt Trigger Mode. Assume CONFORMS.\n"); /*FALLTHROUGH*/ case ACPI_MADT_TRIGGER_CONFORMS: if (Source == AcpiGbl_FADT.SciInterrupt) From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:14:33 2014 Return-Path: Delivered-To: svn-src-all@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 DC0EE3EE; Mon, 28 Jul 2014 14:14: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFED42F65; Mon, 28 Jul 2014 14:14:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEEXIS082460; Mon, 28 Jul 2014 14:14:33 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEEXUM082459; Mon, 28 Jul 2014 14:14:33 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281414.s6SEEXUM082459@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269185 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:14:33 -0000 Author: ray Date: Mon Jul 28 14:14:33 2014 New Revision: 269185 URL: http://svnweb.freebsd.org/changeset/base/269185 Log: Remove unused macro VT_CONSDEV_DECLARE. Join console device now declared in one place. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt.h Modified: head/sys/dev/vt/vt.h ============================================================================== --- head/sys/dev/vt/vt.h Mon Jul 28 13:47:02 2014 (r269184) +++ head/sys/dev/vt/vt.h Mon Jul 28 14:14:33 2014 (r269185) @@ -347,54 +347,6 @@ void vt_upgrade(struct vt_device *vd); #define VT_FB_DEFAULT_HEIGHT 1200 #endif -#define VT_CONSDEV_DECLARE(driver, width, height, softc) \ -static struct terminal driver ## _consterm; \ -static struct vt_window driver ## _conswindow; \ -static struct vt_device driver ## _consdev = { \ - .vd_driver = &driver, \ - .vd_softc = (softc), \ - .vd_flags = VDF_INVALID, \ - .vd_windows = { [VT_CONSWINDOW] = &driver ## _conswindow, }, \ - .vd_curwindow = &driver ## _conswindow, \ - .vd_markedwin = NULL, \ - .vd_kbstate = 0, \ -}; \ -static term_char_t driver ## _constextbuf[(width) * \ - (VBF_DEFAULT_HISTORY_SIZE)]; \ -static term_char_t *driver ## _constextbufrows[ \ - VBF_DEFAULT_HISTORY_SIZE]; \ -static struct vt_window driver ## _conswindow = { \ - .vw_number = VT_CONSWINDOW, \ - .vw_flags = VWF_CONSOLE, \ - .vw_buf = { \ - .vb_buffer = driver ## _constextbuf, \ - .vb_rows = driver ## _constextbufrows, \ - .vb_history_size = VBF_DEFAULT_HISTORY_SIZE, \ - .vb_curroffset = 0, \ - .vb_roffset = 0, \ - .vb_flags = VBF_STATIC, \ - .vb_mark_start = { \ - .tp_row = 0, \ - .tp_col = 0, \ - }, \ - .vb_mark_end = { \ - .tp_row = 0, \ - .tp_col = 0, \ - }, \ - .vb_scr_size = { \ - .tp_row = height, \ - .tp_col = width, \ - }, \ - }, \ - .vw_device = &driver ## _consdev, \ - .vw_terminal = &driver ## _consterm, \ - .vw_kbdmode = K_XLATE, \ -}; \ -TERMINAL_DECLARE_EARLY(driver ## _consterm, vt_termclass, \ - &driver ## _conswindow); \ -SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, \ - vt_upgrade, &driver ## _consdev) - /* name argument is not used yet. */ #define VT_DRIVER_DECLARE(name, drv) DATA_SET(vt_drv_set, drv) From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:15:41 2014 Return-Path: Delivered-To: svn-src-all@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 B4490554; Mon, 28 Jul 2014 14:15: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1DA92F7F; Mon, 28 Jul 2014 14:15:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEFfdx082729; Mon, 28 Jul 2014 14:15:41 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEFf6C082728; Mon, 28 Jul 2014 14:15:41 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281415.s6SEFf6C082728@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:15:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269186 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:15:41 -0000 Author: ray Date: Mon Jul 28 14:15:41 2014 New Revision: 269186 URL: http://svnweb.freebsd.org/changeset/base/269186 Log: o Remove useless debug string. o Fix indent. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:14:33 2014 (r269185) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:15:41 2014 (r269186) @@ -2025,9 +2025,8 @@ vt_upgrade(struct vt_device *vd) vd->vd_curwindow = vd->vd_windows[VT_CONSWINDOW]; if (!(vd->vd_flags & VDF_ASYNC)) { - /* Attach keyboard. */ - vt_allocate_keyboard(vd); - DPRINTF(20, "%s: vd_keyboard = %d\n", __func__, vd->vd_keyboard); + /* Attach keyboard. */ + vt_allocate_keyboard(vd); /* Init 25 Hz timer. */ callout_init_mtx(&vd->vd_timer, &vd->vd_lock, 0); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:20:32 2014 Return-Path: Delivered-To: svn-src-all@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 2935D7BE; Mon, 28 Jul 2014 14:20: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 170DA2FAF; Mon, 28 Jul 2014 14:20:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEKVHW084515; Mon, 28 Jul 2014 14:20:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEKVqC084514; Mon, 28 Jul 2014 14:20:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407281420.s6SEKVqC084514@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 14:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269187 - head/sys/fs/nullfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:20:32 -0000 Author: kib Date: Mon Jul 28 14:20:31 2014 New Revision: 269187 URL: http://svnweb.freebsd.org/changeset/base/269187 Log: Assert that nullfs vnode has VV_ROOT set whenever lower vnode has. Assert that dotdot lookup on the root vnode is not performed. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Mon Jul 28 14:15:41 2014 (r269186) +++ head/sys/fs/nullfs/null_vnops.c Mon Jul 28 14:20:31 2014 (r269187) @@ -372,6 +372,10 @@ null_lookup(struct vop_lookup_args *ap) */ ldvp = NULLVPTOLOWERVP(dvp); vp = lvp = NULL; + KASSERT((ldvp->v_vflag & VV_ROOT) == 0 || + ((dvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) == 0), + ("ldvp %p fl %#x dvp %p fl %#x flags %#x", ldvp, ldvp->v_vflag, + dvp, dvp->v_vflag, flags)); error = VOP_LOOKUP(ldvp, &lvp, cnp); if (error == EJUSTRETURN && (flags & ISLASTCN) && (dvp->v_mount->mnt_flag & MNT_RDONLY) && From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:22:34 2014 Return-Path: Delivered-To: svn-src-all@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 D6583B08; Mon, 28 Jul 2014 14:22:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4A4620A0; Mon, 28 Jul 2014 14:22:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEMYqE087923; Mon, 28 Jul 2014 14:22:34 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEMYuC087922; Mon, 28 Jul 2014 14:22:34 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281422.s6SEMYuC087922@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269188 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:22:34 -0000 Author: ray Date: Mon Jul 28 14:22:34 2014 New Revision: 269188 URL: http://svnweb.freebsd.org/changeset/base/269188 Log: Avoid embedding buffers into static virtual terminal window. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:20:31 2014 (r269187) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:22:34 2014 (r269188) @@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = .vw_number = VT_CONSWINDOW, .vw_flags = VWF_CONSOLE, .vw_buf = { - .vb_buffer = vt_constextbuf, - .vb_rows = vt_constextbufrows, + .vb_buffer = &vt_constextbuf[0], + .vb_rows = &vt_constextbufrows[0], .vb_history_size = VBF_DEFAULT_HISTORY_SIZE, .vb_curroffset = 0, .vb_roffset = 0, From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:24:19 2014 Return-Path: Delivered-To: svn-src-all@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 3BCC8C80; Mon, 28 Jul 2014 14:24: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2906820C2; Mon, 28 Jul 2014 14:24:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEOJqI088205; Mon, 28 Jul 2014 14:24:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEOILA088203; Mon, 28 Jul 2014 14:24:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407281424.s6SEOILA088203@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 14:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269189 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:24:19 -0000 Author: kib Date: Mon Jul 28 14:24:18 2014 New Revision: 269189 URL: http://svnweb.freebsd.org/changeset/base/269189 Log: Initialize zfs vnode v_hash when the vnode is allocated, instead of postponing it to zfs_vget(). zfs_root() returned vnode with the default value of v_hash, which caused inconsistent v_hash value when root vnode was obtained from zfs_vget(). Nullfs allocated two upper vnodes for the root zfs vnode due to different hashes, causing consistency problems. Reported and tested by: Harald Schmalzbauer Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Jul 28 14:22:34 2014 (r269188) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Jul 28 14:24:18 2014 (r269189) @@ -2075,8 +2075,6 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; - else - (*vpp)->v_hash = ino; return (err); } 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 Mon Jul 28 14:22:34 2014 (r269188) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Mon Jul 28 14:24:18 2014 (r269189) @@ -1228,9 +1228,10 @@ again: vnode_t *vp = ZTOV(zp); err = insmntque(vp, zfsvfs->z_vfs); - if (err == 0) + if (err == 0) { + vp->v_hash = obj_num; VOP_UNLOCK(vp, 0); - else { + } else { zp->z_vnode = NULL; zfs_znode_dmu_fini(zp); zfs_znode_free(zp); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:27:05 2014 Return-Path: Delivered-To: svn-src-all@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 D57F8DED; Mon, 28 Jul 2014 14:27: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2FFF20E0; Mon, 28 Jul 2014 14:27:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SER5A1088634; Mon, 28 Jul 2014 14:27:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SER5gh088632; Mon, 28 Jul 2014 14:27:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407281427.s6SER5gh088632@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 28 Jul 2014 14:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269190 - in head/sys: dev/md kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:27:05 -0000 Author: kib Date: Mon Jul 28 14:27:05 2014 New Revision: 269190 URL: http://svnweb.freebsd.org/changeset/base/269190 Log: For md(4), posix shm(3) and tmpfs(5), free swap space used by paged in dirty page, which is written by the process. Reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/md/md.c head/sys/kern/uipc_shm.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Jul 28 14:24:18 2014 (r269189) +++ head/sys/dev/md/md.c Mon Jul 28 14:27:05 2014 (r269190) @@ -895,8 +895,10 @@ mdstart_swap(struct md_s *sc, struct bio else vm_page_activate(m); vm_page_unlock(m); - if (bp->bio_cmd == BIO_WRITE) + if (bp->bio_cmd == BIO_WRITE) { vm_page_dirty(m); + vm_pager_page_unswapped(m); + } /* Actions on further pages start at offset 0 */ p += PAGE_SIZE - offs; Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Mon Jul 28 14:24:18 2014 (r269189) +++ head/sys/kern/uipc_shm.c Mon Jul 28 14:27:05 2014 (r269190) @@ -199,6 +199,7 @@ uiomove_object_page(vm_object_t obj, siz if (uio->uio_rw == UIO_WRITE && error == 0) { VM_OBJECT_WLOCK(obj); vm_page_dirty(m); + vm_pager_page_unswapped(m); VM_OBJECT_WUNLOCK(obj); } vm_page_lock(m); From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:29:18 2014 Return-Path: Delivered-To: svn-src-all@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 085BAF4C; Mon, 28 Jul 2014 14:29:18 +0000 (UTC) Received: from mail-qg0-x22f.google.com (mail-qg0-x22f.google.com [IPv6:2607:f8b0:400d:c04::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D54920F2; Mon, 28 Jul 2014 14:29:17 +0000 (UTC) Received: by mail-qg0-f47.google.com with SMTP id i50so8566913qgf.6 for ; Mon, 28 Jul 2014 07:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=D3WKQTuH0YKweT4o3Y2hUB/ZDDSy7QComtnqt0+R2fY=; b=dIIRaIYHPTHfQtEO89RCRx1JPWt7FQQV/CBbE2Zkjy+1cQ0J+j6do23s/Z4ElfAiWM UR8ao1nUhIcQEjz8VWdt0FmBR17BmNzc8y2R/UWB3ExWbbOjXtxNwyk0x+D5mOKLS8cg Ni6PxI5aH3wpi5SWYqwXS8Ilo5dydCCXCfG1642Mswc+GgmWgyE34jrzGrnQhvLPhsNq qYMDD676WdQ6xS0Im4toari8ifr2fG9G9eJDESwxzksjCxmE6x6dmMTjzPk9HijUFzOb lt+pson+r/SMF3vt8dfqalBvjeMnbaq7UMfO7MQHabnqQDqLkeY4P39bX4gyFF6mCbHH kWcw== MIME-Version: 1.0 X-Received: by 10.140.87.75 with SMTP id q69mr60418794qgd.94.1406557756587; Mon, 28 Jul 2014 07:29:16 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.140.50.243 with HTTP; Mon, 28 Jul 2014 07:29:16 -0700 (PDT) In-Reply-To: <201407261314.s6QDESOC015453@svn.freebsd.org> References: <201407261314.s6QDESOC015453@svn.freebsd.org> Date: Mon, 28 Jul 2014 10:29:16 -0400 X-Google-Sender-Auth: 59-yFyXOgXt6iOrWCuv9RIwTbdw Message-ID: Subject: Re: svn commit: r269120 - head/usr.sbin/kbdcontrol From: Ed Maste To: Stefan Esser 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:29:18 -0000 On 26 July 2014 09:14, Stefan Esser wrote: > Author: se > Date: Sat Jul 26 13:14:28 2014 > New Revision: 269120 > URL: http://svnweb.freebsd.org/changeset/base/269120 > > Log: > The previous commit (r269119) introduced a regression: It removed the > ability to specify the the full path name of the keymap file. > > Instead leave the original search order intact, but insert the path for > newcons-specific fonts (if run on a system using newcons): > > - KEYMAP_PATH in environment > - full path name > - /usr/share/vt/keymaps (only if newcons is in use!) > - /usr/share/syscons/keymaps (also as fall-back for newcons) Thanks -- this is a useful measure until the keymaps are all converted or copied over. To clarify for others, the 8859-1 (*.iso.kbd) keymaps should all be fine with vt(4), as the first 256 Unicode code points are the same as 8859-1. From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:32:21 2014 Return-Path: Delivered-To: svn-src-all@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 85B2230D; Mon, 28 Jul 2014 14:32: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73B042197; Mon, 28 Jul 2014 14:32:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEWL6H092758; Mon, 28 Jul 2014 14:32:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEWLh7092757; Mon, 28 Jul 2014 14:32:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407281432.s6SEWLh7092757@svn.freebsd.org> From: Alexander Motin Date: Mon, 28 Jul 2014 14:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269191 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:32:21 -0000 Author: mav Date: Mon Jul 28 14:32:20 2014 New Revision: 269191 URL: http://svnweb.freebsd.org/changeset/base/269191 Log: Fix r269183 build woth GCC. MFC after: 2 weeks Modified: head/usr.sbin/ctld/ctld.c Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Mon Jul 28 14:27:05 2014 (r269190) +++ head/usr.sbin/ctld/ctld.c Mon Jul 28 14:32:20 2014 (r269191) @@ -393,18 +393,23 @@ const struct auth_portal * auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *ss) { const struct auth_portal *ap; - uint8_t *a, *b, bmask; + const uint8_t *a, *b; int i; + uint8_t bmask; TAILQ_FOREACH(ap, &ag->ag_portals, ap_next) { if (ap->ap_sa.ss_family != ss->ss_family) continue; if (ss->ss_family == AF_INET) { - a = (uint8_t *)&((struct sockaddr_in *)ss)->sin_addr; - b = (uint8_t *)&((struct sockaddr_in *)&ap->ap_sa)->sin_addr; + a = (const uint8_t *) + &((const struct sockaddr_in *)ss)->sin_addr; + b = (const uint8_t *) + &((const struct sockaddr_in *)&ap->ap_sa)->sin_addr; } else { - a = (uint8_t *)&((struct sockaddr_in6 *)ss)->sin6_addr; - b = (uint8_t *)&((struct sockaddr_in6 *)&ap->ap_sa)->sin6_addr; + a = (const uint8_t *) + &((const struct sockaddr_in6 *)ss)->sin6_addr; + b = (const uint8_t *) + &((const struct sockaddr_in6 *)&ap->ap_sa)->sin6_addr; } for (i = 0; i < ap->ap_mask / 8; i++) { if (a[i] != b[i]) From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:35:22 2014 Return-Path: Delivered-To: svn-src-all@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 0EA6348B; Mon, 28 Jul 2014 14:35: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F092221B4; Mon, 28 Jul 2014 14:35:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEZLnt093245; Mon, 28 Jul 2014 14:35:21 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEZLL9093244; Mon, 28 Jul 2014 14:35:21 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281435.s6SEZLL9093244@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269192 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:35:22 -0000 Author: ray Date: Mon Jul 28 14:35:21 2014 New Revision: 269192 URL: http://svnweb.freebsd.org/changeset/base/269192 Log: Remove special handling of console window size. It's done in vt_upgrade() for all windows. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:32:20 2014 (r269191) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:35:21 2014 (r269192) @@ -2064,7 +2064,6 @@ void vt_allocate(struct vt_driver *drv, void *softc) { struct vt_device *vd; - struct winsize wsz; if (!vty_enabled(VTY_VT)) return; @@ -2125,11 +2124,6 @@ vt_allocate(struct vt_driver *drv, void } termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal); - - /* Update console window sizes to actual. */ - vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz); - terminal_set_winsize_blank(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, - &wsz, 0, NULL); } void From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:37:33 2014 Return-Path: Delivered-To: svn-src-all@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 7ADF36D5; Mon, 28 Jul 2014 14:37:33 +0000 (UTC) Received: from fep22.mx.upcmail.net (fep22.mx.upcmail.net [62.179.121.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3D03B21DD; Mon, 28 Jul 2014 14:37:31 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep22-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20140728143724.FZBW10910.viefep22-int.chello.at@edge04.upcmail.net>; Mon, 28 Jul 2014 16:37:24 +0200 Received: from mole.fafoe.narf.at ([80.109.55.137]) by edge04.upcmail.net with edge id XqdP1o01g2xdvHc03qdPvm; Mon, 28 Jul 2014 16:37:24 +0200 X-SourceIP: 80.109.55.137 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 51CA26D47C; Mon, 28 Jul 2014 16:37:23 +0200 (CEST) Date: Mon, 28 Jul 2014 16:37:23 +0200 From: Stefan Farfeleder To: Aleksandr Rybalko Subject: Re: svn commit: r269188 - head/sys/dev/vt Message-ID: <20140728143722.GB1263@mole.fafoe.narf.at> References: <201407281422.s6SEMYuC087922@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201407281422.s6SEMYuC087922@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:37:33 -0000 On Mon, Jul 28, 2014 at 02:22:34PM +0000, Aleksandr Rybalko wrote: > Author: ray > Date: Mon Jul 28 14:22:34 2014 > New Revision: 269188 > URL: http://svnweb.freebsd.org/changeset/base/269188 > > Log: > Avoid embedding buffers into static virtual terminal window. > > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/dev/vt/vt_core.c > > Modified: head/sys/dev/vt/vt_core.c > ============================================================================== > --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:20:31 2014 (r269187) > +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:22:34 2014 (r269188) > @@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = > .vw_number = VT_CONSWINDOW, > .vw_flags = VWF_CONSOLE, > .vw_buf = { > - .vb_buffer = vt_constextbuf, > - .vb_rows = vt_constextbufrows, > + .vb_buffer = &vt_constextbuf[0], > + .vb_rows = &vt_constextbufrows[0], > .vb_history_size = VBF_DEFAULT_HISTORY_SIZE, > .vb_curroffset = 0, > .vb_roffset = 0, > Hi Aleksandr, What's that supposed to change exactly? I'd be very surprised if it didn't produce the same binary code. BR, Stefan From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:38:00 2014 Return-Path: Delivered-To: svn-src-all@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 054DF814; Mon, 28 Jul 2014 14:38: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E726A21E2; Mon, 28 Jul 2014 14:37:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEbxJD094558; Mon, 28 Jul 2014 14:37:59 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEbxnc094557; Mon, 28 Jul 2014 14:37:59 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281437.s6SEbxnc094557@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269193 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:38:00 -0000 Author: ray Date: Mon Jul 28 14:37:59 2014 New Revision: 269193 URL: http://svnweb.freebsd.org/changeset/base/269193 Log: Update comments. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:35:21 2014 (r269192) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:37:59 2014 (r269193) @@ -2111,6 +2111,7 @@ vt_allocate(struct vt_driver *drv, void vd->vd_driver->vd_init(vd); VT_UNLOCK(vd); + /* Update windows sizes and initialize last items. */ vt_upgrade(vd); #ifdef DEV_SPLASH @@ -2119,10 +2120,16 @@ vt_allocate(struct vt_driver *drv, void #endif if (vd->vd_flags & VDF_ASYNC) { + /* Allow to put chars now. */ terminal_mute(vd->vd_curwindow->vw_terminal, 0); + /* Rerun timer for screen updates. */ callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ); } + /* + * Register as console. If it already registered, cnadd() will ignore + * it. + */ termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal); } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:41:23 2014 Return-Path: Delivered-To: svn-src-all@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 018CDC39; Mon, 28 Jul 2014 14:41: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9732228F; Mon, 28 Jul 2014 14:41:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEfMSE098062; Mon, 28 Jul 2014 14:41:22 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEfMPg098061; Mon, 28 Jul 2014 14:41:22 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281441.s6SEfMPg098061@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269194 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:41:23 -0000 Author: ray Date: Mon Jul 28 14:41:22 2014 New Revision: 269194 URL: http://svnweb.freebsd.org/changeset/base/269194 Log: Revise font initialization handling. MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:37:59 2014 (r269193) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:41:22 2014 (r269194) @@ -996,7 +996,7 @@ vtterm_cnprobe(struct terminal *tm, stru sprintf(cp->cn_name, "ttyv%r", VT_UNIT(vw)); /* Attach default font if not in TEXTMODE. */ - if (!(vd->vd_flags & VDF_TEXTMODE)) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) vw->vw_font = vtfont_ref(&vt_font_default); vtbuf_init_early(&vw->vw_buf); @@ -1147,7 +1147,7 @@ vt_change_font(struct vt_window *vw, str VT_UNLOCK(vd); return (EBUSY); } - if (vw->vw_font == NULL) { + if (vd->vd_flags & VDF_TEXTMODE) { /* Our device doesn't need fonts. */ VT_UNLOCK(vd); return (ENOTTY); @@ -1169,8 +1169,14 @@ vt_change_font(struct vt_window *vw, str /* Actually apply the font to the current window. */ VT_LOCK(vd); - vtfont_unref(vw->vw_font); - vw->vw_font = vtfont_ref(vf); + if (vw->vw_font != vf) { + /* + * In case vt_change_font called to update size we don't need + * to update font link. + */ + vtfont_unref(vw->vw_font); + vw->vw_font = vtfont_ref(vf); + } /* Force a full redraw the next timer tick. */ if (vd->vd_curwindow == vw) @@ -1978,7 +1984,7 @@ vt_allocate_window(struct vt_device *vd, vw->vw_number = window; vw->vw_kbdmode = K_XLATE; - if (!(vd->vd_flags & VDF_TEXTMODE)) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) vw->vw_font = vtfont_ref(&vt_font_default); vt_termsize(vd, vw->vw_font, &size); @@ -2056,7 +2062,10 @@ vt_resize(struct vt_device *vd) vw->vw_font = vtfont_ref(&vt_font_default); VT_UNLOCK(vd); /* Resize terminal windows */ - vt_change_font(vw, vw->vw_font); + while (vt_change_font(vw, vw->vw_font) == EBUSY) { + DPRINTF(100, "%s: vt_change_font() is busy, " + "window %d\n", __func__, i); + } } } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 20:49:51 2014 Return-Path: Delivered-To: svn-src-all@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 5BF111D8; Mon, 28 Jul 2014 20:49:51 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A94C2101; Mon, 28 Jul 2014 20:49:50 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E359E1FE027; Mon, 28 Jul 2014 22:49:47 +0200 (CEST) Message-ID: <53D6B784.6080102@selasky.org> Date: Mon, 28 Jul 2014 22:50:12 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> <53D55CD9.4000408@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 20:49:51 -0000 On 07/27/14 22:15, Adrian Chadd wrote: > Ok. So, which one of those is showing up as 0? Hi, I think it is the last one. I cannot test this again until later this year, because I don't have access to the AP which is causing this :-( Is it possible you can add a function to the net80211 stack, which gets the rate from the "ni" in a safe manner? --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 20:52:07 2014 Return-Path: Delivered-To: svn-src-all@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 6A56C347; Mon, 28 Jul 2014 20:52:07 +0000 (UTC) Received: from mail-qa0-x235.google.com (mail-qa0-x235.google.com [IPv6:2607:f8b0:400d:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 066B42196; Mon, 28 Jul 2014 20:52:06 +0000 (UTC) Received: by mail-qa0-f53.google.com with SMTP id v10so8351671qac.26 for ; Mon, 28 Jul 2014 13:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=nBBCiPieBtmorsrUc6tepdq65x1QcOsVtzdkgrfLBsI=; b=VG+cgcM8F3VwnM4qVdj8OErwVM8dV+Dqug8SuF4n6HiWCBeS1g5EUv5w5hB7yZQ+w0 X1fxfn+ee+QyYqo4HgEhjGedbMpaTnn4E16HrTDU0KRJwny/q1QF+IeGBKkdfYBh0z+K rXM8uuP9hEE4skHaJqB3n2C1YtxoeFxJxr3ZlH50t7zYdgK2KH9vxKO6uLnnGkMap5Jw bwSBXFeOkR1mYcrXgbax1N4ldQQh1UTqMwFj5NguCB8tC47UzBRsabRVQL2zO0f3g8O/ UY4cNHY2IsG+MN/MwM9Uqt3DNesxFMkzw6MvZhJbPpgi2ONxKdKjOi1A3wTnR4g79oom Bjmw== MIME-Version: 1.0 X-Received: by 10.224.161.83 with SMTP id q19mr8518131qax.26.1406580726071; Mon, 28 Jul 2014 13:52:06 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Mon, 28 Jul 2014 13:52:06 -0700 (PDT) In-Reply-To: <53D6B784.6080102@selasky.org> References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> <53D55CD9.4000408@selasky.org> <53D6B784.6080102@selasky.org> Date: Mon, 28 Jul 2014 13:52:06 -0700 X-Google-Sender-Auth: QXTYa4MJ1icFWan3V0ahVqCYjHs Message-ID: Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 20:52:07 -0000 On 28 July 2014 13:50, Hans Petter Selasky wrote: > On 07/27/14 22:15, Adrian Chadd wrote: >> >> Ok. So, which one of those is showing up as 0? > > > Hi, > > I think it is the last one. I cannot test this again until later this year, > because I don't have access to the AP which is causing this :-( > > Is it possible you can add a function to the net80211 stack, which gets the > rate from the "ni" in a safe manner? The whole rate control thing from net80211 has to be upgraded. Drivers shouldn't be using ni->ni_txrate for anything other than informational purposes, yet .. well, that's not the case. -a From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 21:04:59 2014 Return-Path: Delivered-To: svn-src-all@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 E8268761; Mon, 28 Jul 2014 21:04:59 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A02D4228D; Mon, 28 Jul 2014 21:04:59 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 72FE61FE027; Mon, 28 Jul 2014 23:04:50 +0200 (CEST) Message-ID: <53D6BB0B.4010604@selasky.org> Date: Mon, 28 Jul 2014 23:05:15 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> <53D55CD9.4000408@selasky.org> <53D6B784.6080102@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 21:05:00 -0000 On 07/28/14 22:52, Adrian Chadd wrote: > The whole rate control thing from net80211 has to be upgraded. Drivers > shouldn't be using ni->ni_txrate for anything other than informational > purposes, yet .. well, that's not the case. Hi, Should the rate be extracted from the NET80211 header instead, and if yes, how? --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 21:11:21 2014 Return-Path: Delivered-To: svn-src-all@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 635EFC90; Mon, 28 Jul 2014 21:11: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3BA244A; Mon, 28 Jul 2014 21:11:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SLBL93005265; Mon, 28 Jul 2014 21:11:21 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SLBI7f005244; Mon, 28 Jul 2014 21:11:18 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201407282111.s6SLBI7f005244@svn.freebsd.org> From: Jack F Vogel Date: Mon, 28 Jul 2014 21:11:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269196 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 21:11:21 -0000 Author: jfv Date: Mon Jul 28 21:11:18 2014 New Revision: 269196 URL: http://svnweb.freebsd.org/changeset/base/269196 Log: MFC of R267935: Sync the E1000 shared code to Intel internal, and more importantly add new I218 adapter support to em. Modified: stable/10/sys/dev/e1000/e1000_82542.c stable/10/sys/dev/e1000/e1000_82571.c stable/10/sys/dev/e1000/e1000_82571.h stable/10/sys/dev/e1000/e1000_82575.c stable/10/sys/dev/e1000/e1000_82575.h stable/10/sys/dev/e1000/e1000_api.c stable/10/sys/dev/e1000/e1000_api.h stable/10/sys/dev/e1000/e1000_defines.h stable/10/sys/dev/e1000/e1000_hw.h stable/10/sys/dev/e1000/e1000_i210.c stable/10/sys/dev/e1000/e1000_i210.h stable/10/sys/dev/e1000/e1000_ich8lan.c stable/10/sys/dev/e1000/e1000_ich8lan.h stable/10/sys/dev/e1000/e1000_mac.c stable/10/sys/dev/e1000/e1000_mac.h stable/10/sys/dev/e1000/e1000_manage.c stable/10/sys/dev/e1000/e1000_mbx.c stable/10/sys/dev/e1000/e1000_mbx.h stable/10/sys/dev/e1000/e1000_nvm.c stable/10/sys/dev/e1000/e1000_osdep.h stable/10/sys/dev/e1000/e1000_phy.c stable/10/sys/dev/e1000/e1000_phy.h stable/10/sys/dev/e1000/e1000_regs.h stable/10/sys/dev/e1000/e1000_vf.c stable/10/sys/dev/e1000/e1000_vf.h stable/10/sys/dev/e1000/if_em.c Modified: stable/10/sys/dev/e1000/e1000_82542.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_82542.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_82542.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ static s32 e1000_init_hw_82542(struct e static s32 e1000_setup_link_82542(struct e1000_hw *hw); static s32 e1000_led_on_82542(struct e1000_hw *hw); static s32 e1000_led_off_82542(struct e1000_hw *hw); -static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); +static int e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw); @@ -409,7 +409,7 @@ static s32 e1000_led_off_82542(struct e1 * Sets the receive address array register at index to the address passed * in by addr. **/ -static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index) +static int e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index) { u32 rar_low, rar_high; @@ -431,6 +431,7 @@ static void e1000_rar_set_82542(struct e E1000_WRITE_REG_ARRAY(hw, E1000_RA, (index << 1), rar_low); E1000_WRITE_REG_ARRAY(hw, E1000_RA, ((index << 1) + 1), rar_high); + return E1000_SUCCESS; } /** Modified: stable/10/sys/dev/e1000/e1000_82571.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_82571.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_82571.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1453,10 +1453,14 @@ static void e1000_clear_vfta_82571(struc static bool e1000_check_mng_mode_82574(struct e1000_hw *hw) { u16 data; + s32 ret_val; DEBUGFUNC("e1000_check_mng_mode_82574"); - hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &data); + ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &data); + if (ret_val) + return FALSE; + return (data & E1000_NVM_INIT_CTRL2_MNGM) != 0; } Modified: stable/10/sys/dev/e1000/e1000_82571.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_82571.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_82571.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,29 +35,30 @@ #ifndef _E1000_82571_H_ #define _E1000_82571_H_ -#define ID_LED_RESERVED_F746 0xF746 -#define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ - (ID_LED_OFF1_ON2 << 8) | \ - (ID_LED_DEF1_DEF2 << 4) | \ - (ID_LED_DEF1_DEF2)) +#define ID_LED_RESERVED_F746 0xF746 +#define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ + (ID_LED_OFF1_ON2 << 8) | \ + (ID_LED_DEF1_DEF2 << 4) | \ + (ID_LED_DEF1_DEF2)) -#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 -#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ +#define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 +#define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ /* Intr Throttling - RW */ -#define E1000_EITR_82574(_n) (0x000E8 + (0x4 * (_n))) +#define E1000_EITR_82574(_n) (0x000E8 + (0x4 * (_n))) -#define E1000_EIAC_82574 0x000DC /* Ext. Interrupt Auto Clear - RW */ -#define E1000_EIAC_MASK_82574 0x01F00000 +#define E1000_EIAC_82574 0x000DC /* Ext. Interrupt Auto Clear - RW */ +#define E1000_EIAC_MASK_82574 0x01F00000 -#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */ +#define E1000_IVAR_INT_ALLOC_VALID 0x8 -#define E1000_RXCFGL 0x0B634 /* TimeSync Rx EtherType & Msg Type Reg - RW */ +/* Manageability Operation Mode mask */ +#define E1000_NVM_INIT_CTRL2_MNGM 0x6000 -#define E1000_BASE1000T_STATUS 10 -#define E1000_IDLE_ERROR_COUNT_MASK 0xFF -#define E1000_RECEIVE_ERROR_COUNTER 21 -#define E1000_RECEIVE_ERROR_MAX 0xFFFF +#define E1000_BASE1000T_STATUS 10 +#define E1000_IDLE_ERROR_COUNT_MASK 0xFF +#define E1000_RECEIVE_ERROR_COUNTER 21 +#define E1000_RECEIVE_ERROR_MAX 0xFFFF bool e1000_check_phy_82574(struct e1000_hw *hw); bool e1000_get_laa_state_82571(struct e1000_hw *hw); void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state); Modified: stable/10/sys/dev/e1000/e1000_82575.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_82575.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_82575.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -56,7 +56,6 @@ static s32 e1000_check_for_link_media_s static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw); static s32 e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); -static s32 e1000_init_hw_82575(struct e1000_hw *hw); static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw); static s32 e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data); @@ -120,7 +119,8 @@ static bool e1000_get_i2c_data(u32 *i2cc static const u16 e1000_82580_rxpbs_table[] = { 36, 72, 144, 1, 2, 4, 8, 16, 35, 70, 140 }; #define E1000_82580_RXPBS_TABLE_SIZE \ - (sizeof(e1000_82580_rxpbs_table)/sizeof(u16)) + (sizeof(e1000_82580_rxpbs_table) / \ + sizeof(e1000_82580_rxpbs_table[0])) /** @@ -273,6 +273,11 @@ static s32 e1000_init_phy_params_82575(s hw->mac.ops.check_for_link = e1000_check_for_link_media_swap; } + if (phy->id == M88E1512_E_PHY_ID) { + ret_val = e1000_initialize_M88E1512_phy(hw); + if (ret_val) + goto out; + } break; case IGP03E1000_E_PHY_ID: case IGP04E1000_E_PHY_ID: @@ -450,6 +455,9 @@ static s32 e1000_init_mac_params_82575(s else mac->ops.reset_hw = e1000_reset_hw_82575; /* hw initialization */ + if ((mac->type == e1000_i210) || (mac->type == e1000_i211)) + mac->ops.init_hw = e1000_init_hw_i210; + else mac->ops.init_hw = e1000_init_hw_82575; /* link setup */ mac->ops.setup_link = e1000_setup_link_generic; @@ -750,6 +758,7 @@ out: static s32 e1000_phy_hw_reset_sgmii_82575(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; + struct e1000_phy_info *phy = &hw->phy; DEBUGFUNC("e1000_phy_hw_reset_sgmii_82575"); @@ -772,7 +781,11 @@ static s32 e1000_phy_hw_reset_sgmii_8257 goto out; ret_val = hw->phy.ops.commit(hw); + if (ret_val) + goto out; + if (phy->id == M88E1512_E_PHY_ID) + ret_val = e1000_initialize_M88E1512_phy(hw); out: return ret_val; } @@ -879,7 +892,6 @@ out: static s32 e1000_set_d0_lplu_state_82580(struct e1000_hw *hw, bool active) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val = E1000_SUCCESS; u32 data; DEBUGFUNC("e1000_set_d0_lplu_state_82580"); @@ -907,7 +919,7 @@ static s32 e1000_set_d0_lplu_state_82580 } E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data); - return ret_val; + return E1000_SUCCESS; } /** @@ -927,7 +939,6 @@ static s32 e1000_set_d0_lplu_state_82580 s32 e1000_set_d3_lplu_state_82580(struct e1000_hw *hw, bool active) { struct e1000_phy_info *phy = &hw->phy; - s32 ret_val = E1000_SUCCESS; u32 data; DEBUGFUNC("e1000_set_d3_lplu_state_82580"); @@ -955,7 +966,7 @@ s32 e1000_set_d3_lplu_state_82580(struct } E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, data); - return ret_val; + return E1000_SUCCESS; } /** @@ -969,7 +980,7 @@ s32 e1000_set_d3_lplu_state_82580(struct **/ static s32 e1000_acquire_nvm_82575(struct e1000_hw *hw) { - s32 ret_val; + s32 ret_val = E1000_SUCCESS; DEBUGFUNC("e1000_acquire_nvm_82575"); @@ -991,6 +1002,7 @@ static s32 e1000_acquire_nvm_82575(struc DEBUGOUT("Nvm bit banging access error detected and cleared.\n"); } } + if (hw->mac.type == e1000_82580) { u32 eecd = E1000_READ_REG(hw, E1000_EECD); if (eecd & E1000_EECD_BLOCKED) { @@ -1001,7 +1013,6 @@ static s32 e1000_acquire_nvm_82575(struc } } - ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) e1000_release_swfw_sync_82575(hw, E1000_SWFW_EEP_SM); @@ -1115,7 +1126,6 @@ static void e1000_release_swfw_sync_8257 static s32 e1000_get_cfg_done_82575(struct e1000_hw *hw) { s32 timeout = PHY_CFG_TIMEOUT; - s32 ret_val = E1000_SUCCESS; u32 mask = E1000_NVM_CFG_DONE_PORT_0; DEBUGFUNC("e1000_get_cfg_done_82575"); @@ -1140,7 +1150,7 @@ static s32 e1000_get_cfg_done_82575(stru (hw->phy.type == e1000_phy_igp_3)) e1000_phy_init_script_igp3(hw); - return ret_val; + return E1000_SUCCESS; } /** @@ -1466,7 +1476,7 @@ static s32 e1000_reset_hw_82575(struct e * * This inits the hardware readying it for operation. **/ -static s32 e1000_init_hw_82575(struct e1000_hw *hw) +s32 e1000_init_hw_82575(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; s32 ret_val; @@ -1985,7 +1995,7 @@ static s32 e1000_reset_init_script_82575 **/ static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("e1000_read_mac_addr_82575"); @@ -2478,11 +2488,17 @@ static s32 e1000_reset_hw_82580(struct e ctrl |= E1000_CTRL_RST; E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - E1000_WRITE_FLUSH(hw); - /* Add delay to insure DEV_RST has time to complete */ - if (global_device_reset) - msec_delay(5); + switch (hw->device_id) { + case E1000_DEV_ID_DH89XXCC_SGMII: + break; + default: + E1000_WRITE_FLUSH(hw); + break; + } + + /* Add delay to insure DEV_RST or RST has time to complete */ + msec_delay(5); ret_val = e1000_get_auto_rd_done_generic(hw); if (ret_val) { @@ -2617,7 +2633,7 @@ out: **/ static s32 e1000_validate_nvm_checksum_82580(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u16 eeprom_regions_count = 1; u16 j, nvm_data; u16 nvm_offset; @@ -2757,7 +2773,7 @@ out: static s32 __e1000_access_emi_reg(struct e1000_hw *hw, u16 address, u16 *data, bool read) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("__e1000_access_emi_reg"); @@ -2787,6 +2803,95 @@ s32 e1000_read_emi_reg(struct e1000_hw * } /** + * e1000_initialize_M88E1512_phy - Initialize M88E1512 PHY + * @hw: pointer to the HW structure + * + * Initialize Marverl 1512 to work correctly with Avoton. + **/ +s32 e1000_initialize_M88E1512_phy(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_initialize_M88E1512_phy"); + + /* Check if this is correct PHY. */ + if (phy->id != M88E1512_E_PHY_ID) + goto out; + + /* Switch to PHY page 0xFF. */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0x00FF); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_2, 0x214B); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_1, 0x2144); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_2, 0x0C28); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_1, 0x2146); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_2, 0xB233); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_1, 0x214D); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_2, 0xCC0C); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_1, 0x2159); + if (ret_val) + goto out; + + /* Switch to PHY page 0xFB. */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0x00FB); + if (ret_val) + goto out; + + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_CFG_REG_3, 0x000D); + if (ret_val) + goto out; + + /* Switch to PHY page 0x12. */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0x12); + if (ret_val) + goto out; + + /* Change mode to SGMII-to-Copper */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1512_MODE, 0x8001); + if (ret_val) + goto out; + + /* Return the PHY to page 0. */ + ret_val = phy->ops.write_reg(hw, E1000_M88E1543_PAGE_ADDR, 0); + if (ret_val) + goto out; + + ret_val = phy->ops.commit(hw); + if (ret_val) { + DEBUGOUT("Error committing the PHY changes\n"); + return ret_val; + } + + msec_delay(1000); +out: + return ret_val; +} + +/** * e1000_set_eee_i350 - Enable/disable EEE support * @hw: pointer to the HW structure * @@ -2795,7 +2900,6 @@ s32 e1000_read_emi_reg(struct e1000_hw * **/ s32 e1000_set_eee_i350(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; u32 ipcnfg, eeer; DEBUGFUNC("e1000_set_eee_i350"); @@ -2828,7 +2932,7 @@ s32 e1000_set_eee_i350(struct e1000_hw * E1000_READ_REG(hw, E1000_EEER); out: - return ret_val; + return E1000_SUCCESS; } /** Modified: stable/10/sys/dev/e1000/e1000_82575.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_82575.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_82575.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -384,7 +384,7 @@ struct e1000_adv_tx_context_desc { #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) #define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1U << 31) +#define E1000_ETQF_QUEUE_ENABLE (1 << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -411,7 +411,7 @@ struct e1000_adv_tx_context_desc { #define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ #define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 #define E1000_DTXSWC_LLE_SHIFT 16 -#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1U << 31) /* global VF LB enable */ +#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ /* Easy defines for setting default pool, would normally be left a zero */ #define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7 @@ -480,6 +480,7 @@ void e1000_vmdq_set_loopback_pf(struct e void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf); void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable); s32 e1000_init_nvm_params_82575(struct e1000_hw *hw); +s32 e1000_init_hw_82575(struct e1000_hw *hw); enum e1000_promisc_type { e1000_promisc_disabled = 0, /* all promisc modes disabled */ @@ -497,6 +498,7 @@ s32 e1000_read_emi_reg(struct e1000_hw * s32 e1000_set_eee_i350(struct e1000_hw *); s32 e1000_set_eee_i354(struct e1000_hw *); s32 e1000_get_eee_status_i354(struct e1000_hw *, bool *); +s32 e1000_initialize_M88E1512_phy(struct e1000_hw *hw); /* I2C SDA and SCL timing parameters for standard mode */ #define E1000_I2C_T_HD_STA 4 Modified: stable/10/sys/dev/e1000/e1000_api.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_api.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_api.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -293,6 +293,10 @@ s32 e1000_set_mac_type(struct e1000_hw * case E1000_DEV_ID_PCH_LPT_I217_V: case E1000_DEV_ID_PCH_LPTLP_I218_LM: case E1000_DEV_ID_PCH_LPTLP_I218_V: + case E1000_DEV_ID_PCH_I218_LM2: + case E1000_DEV_ID_PCH_I218_V2: + case E1000_DEV_ID_PCH_I218_LM3: + case E1000_DEV_ID_PCH_I218_V3: mac->type = e1000_pch_lpt; break; case E1000_DEV_ID_82575EB_COPPER: @@ -828,10 +832,12 @@ void e1000_config_collision_dist(struct * * Sets a Receive Address Register (RAR) to the specified address. **/ -void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) +int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) { if (hw->mac.ops.rar_set) - hw->mac.ops.rar_set(hw, addr, index); + return hw->mac.ops.rar_set(hw, addr, index); + + return E1000_SUCCESS; } /** Modified: stable/10/sys/dev/e1000/e1000_api.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_api.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_api.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -69,7 +69,7 @@ s32 e1000_setup_link(struct e1000_hw *hw s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex); s32 e1000_disable_pcie_master(struct e1000_hw *hw); void e1000_config_collision_dist(struct e1000_hw *hw); -void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); +int e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list, u32 mc_addr_count); Modified: stable/10/sys/dev/e1000/e1000_defines.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_defines.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_defines.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ #define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ /* Physical Func Reset Done Indication */ #define E1000_CTRL_EXT_PFRSTD 0x00004000 +#define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */ #define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ #define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ #define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clk Gating */ @@ -131,7 +132,7 @@ #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ -#define E1000_RXDEXT_STATERR_TST 0x00010000 /* Time Stamp taken */ +#define E1000_RXDEXT_STATERR_TST 0x00000100 /* Time Stamp taken */ #define E1000_RXDEXT_STATERR_LB 0x00040000 #define E1000_RXDEXT_STATERR_CE 0x01000000 #define E1000_RXDEXT_STATERR_SE 0x02000000 @@ -157,6 +158,7 @@ E1000_RXDEXT_STATERR_CXE | \ E1000_RXDEXT_STATERR_RXE) +#define E1000_MRQC_ENABLE_RSS_2Q 0x00000001 #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 @@ -464,6 +466,7 @@ #define ETHERNET_FCS_SIZE 4 #define MAX_JUMBO_FRAME_SIZE 0x3F00 +#define E1000_TX_PTR_GAP 0x1F /* Extended Configuration Control and Size */ #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 @@ -853,6 +856,10 @@ #define E1000_PCS_STATUS_ADDR_I354 1 #define E1000_PCS_STATUS_RX_LPI_RCVD 0x0400 #define E1000_PCS_STATUS_TX_LPI_RCVD 0x0800 +#define E1000_M88E1512_CFG_REG_1 0x0010 +#define E1000_M88E1512_CFG_REG_2 0x0011 +#define E1000_M88E1512_CFG_REG_3 0x0007 +#define E1000_M88E1512_MODE 0x0014 #define E1000_EEE_SU_LPI_CLK_STP 0x00800000 /* EEE LPI Clock Stop */ #define E1000_EEE_LP_ADV_DEV_I210 7 /* EEE LP Adv Device */ #define E1000_EEE_LP_ADV_ADDR_I210 61 /* EEE LP Adv Register */ @@ -1429,6 +1436,9 @@ #define E1000_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */ #define E1000_RXPBS_SIZE_I210_MASK 0x0000003F /* Rx packet buffer size */ #define E1000_TXPB0S_SIZE_I210_MASK 0x0000003F /* Tx packet buffer 0 size */ +#define I210_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */ +#define I210_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */ + #define E1000_DOBFFCTL_OBFFTHR_MASK 0x000000FF /* OBFF threshold */ #define E1000_DOBFFCTL_EXIT_ACT_MASK 0x01000000 /* Exit active CB */ @@ -1455,5 +1465,7 @@ #define E1000_STATUS_LAN_ID_OFFSET 2 #define E1000_VFTA_ENTRIES 128 #define E1000_UNUSEDARG +#ifndef ERROR_REPORT #define ERROR_REPORT(fmt) do { } while (0) +#endif /* ERROR_REPORT */ #endif /* _E1000_DEFINES_H_ */ Modified: stable/10/sys/dev/e1000/e1000_hw.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_hw.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_hw.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -133,6 +133,10 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_LPT_I217_V 0x153B #define E1000_DEV_ID_PCH_LPTLP_I218_LM 0x155A #define E1000_DEV_ID_PCH_LPTLP_I218_V 0x1559 +#define E1000_DEV_ID_PCH_I218_LM2 0x15A0 +#define E1000_DEV_ID_PCH_I218_V2 0x15A1 +#define E1000_DEV_ID_PCH_I218_LM3 0x15A2 /* Wildcat Point PCH */ +#define E1000_DEV_ID_PCH_I218_V3 0x15A3 /* Wildcat Point PCH */ #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -696,7 +700,7 @@ struct e1000_mac_operations { s32 (*setup_led)(struct e1000_hw *); void (*write_vfta)(struct e1000_hw *, u32, u32); void (*config_collision_dist)(struct e1000_hw *); - void (*rar_set)(struct e1000_hw *, u8*, u32); + int (*rar_set)(struct e1000_hw *, u8*, u32); s32 (*read_mac_addr)(struct e1000_hw *); s32 (*validate_mdi_setting)(struct e1000_hw *); s32 (*set_obff_timer)(struct e1000_hw *, u32); @@ -934,6 +938,13 @@ struct e1000_shadow_ram { #define E1000_SHADOW_RAM_WORDS 2048 +/* I218 PHY Ultra Low Power (ULP) states */ +enum e1000_ulp_state { + e1000_ulp_state_unknown, + e1000_ulp_state_off, + e1000_ulp_state_on, +}; + struct e1000_dev_spec_ich8lan { bool kmrn_lock_loss_workaround_enabled; struct e1000_shadow_ram shadow_ram[E1000_SHADOW_RAM_WORDS]; @@ -942,6 +953,7 @@ struct e1000_dev_spec_ich8lan { bool nvm_k1_enabled; bool eee_disable; u16 eee_lp_ability; + enum e1000_ulp_state ulp_state; }; struct e1000_dev_spec_82575 { Modified: stable/10/sys/dev/e1000/e1000_i210.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_i210.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_i210.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -536,7 +536,7 @@ s32 e1000_validate_nvm_checksum_i210(str **/ s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u16 checksum = 0; u16 i, nvm_data; @@ -615,7 +615,7 @@ bool e1000_get_flash_presence_i210(struc **/ s32 e1000_update_flash_i210(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; u32 flup; DEBUGFUNC("e1000_update_flash_i210"); @@ -671,7 +671,7 @@ s32 e1000_pool_flash_update_done_i210(st **/ static s32 e1000_init_nvm_params_i210(struct e1000_hw *hw) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; struct e1000_nvm_info *nvm = &hw->nvm; DEBUGFUNC("e1000_init_nvm_params_i210"); @@ -756,7 +756,7 @@ out: static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address, u8 dev_addr, u16 *data, bool read) { - s32 ret_val = E1000_SUCCESS; + s32 ret_val; DEBUGFUNC("__e1000_access_xmdio_reg"); @@ -815,3 +815,90 @@ s32 e1000_write_xmdio_reg(struct e1000_h return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, FALSE); } + +/** + * e1000_pll_workaround_i210 + * @hw: pointer to the HW structure + * + * Works around an errata in the PLL circuit where it occasionally + * provides the wrong clock frequency after power up. + **/ +static s32 e1000_pll_workaround_i210(struct e1000_hw *hw) +{ + s32 ret_val; + u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val; + u16 nvm_word, phy_word, pci_word, tmp_nvm; + int i; + + /* Get and set needed register values */ + wuc = E1000_READ_REG(hw, E1000_WUC); + mdicnfg = E1000_READ_REG(hw, E1000_MDICNFG); + reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO; + E1000_WRITE_REG(hw, E1000_MDICNFG, reg_val); + + /* Get data from NVM, or set default */ + ret_val = e1000_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD, + &nvm_word); + if (ret_val != E1000_SUCCESS) + nvm_word = E1000_INVM_DEFAULT_AL; + tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; + for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { + /* check current state directly from internal PHY */ + e1000_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | + E1000_PHY_PLL_FREQ_REG), &phy_word); + if ((phy_word & E1000_PHY_PLL_UNCONF) + != E1000_PHY_PLL_UNCONF) { + ret_val = E1000_SUCCESS; + break; + } else { + ret_val = -E1000_ERR_PHY; + } + /* directly reset the internal PHY */ + ctrl = E1000_READ_REG(hw, E1000_CTRL); + E1000_WRITE_REG(hw, E1000_CTRL, ctrl|E1000_CTRL_PHY_RST); + + ctrl_ext = E1000_READ_REG(hw, E1000_CTRL_EXT); + ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE); + E1000_WRITE_REG(hw, E1000_CTRL_EXT, ctrl_ext); + + E1000_WRITE_REG(hw, E1000_WUC, 0); + reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16); + E1000_WRITE_REG(hw, E1000_EEARBC_I210, reg_val); + + e1000_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); + pci_word |= E1000_PCI_PMCSR_D3; + e1000_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); + msec_delay(1); + pci_word &= ~E1000_PCI_PMCSR_D3; + e1000_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); + reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16); + E1000_WRITE_REG(hw, E1000_EEARBC_I210, reg_val); + + /* restore WUC register */ + E1000_WRITE_REG(hw, E1000_WUC, wuc); + } + /* restore MDICNFG setting */ + E1000_WRITE_REG(hw, E1000_MDICNFG, mdicnfg); + return ret_val; +} + +/** + * e1000_init_hw_i210 - Init hw for I210/I211 + * @hw: pointer to the HW structure + * + * Called to initialize hw for i210 hw family. + **/ +s32 e1000_init_hw_i210(struct e1000_hw *hw) +{ + s32 ret_val; + + DEBUGFUNC("e1000_init_hw_i210"); + if ((hw->mac.type >= e1000_i210) && + !(e1000_get_flash_presence_i210(hw))) { + ret_val = e1000_pll_workaround_i210(hw); + if (ret_val != E1000_SUCCESS) + return ret_val; + } + ret_val = e1000_init_hw_82575(hw); + return ret_val; +} Modified: stable/10/sys/dev/e1000/e1000_i210.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_i210.h Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_i210.h Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,6 +49,7 @@ s32 e1000_read_xmdio_reg(struct e1000_hw u16 *data); s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); +s32 e1000_init_hw_i210(struct e1000_hw *hw); #define E1000_STM_OPCODE 0xDB00 #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 @@ -93,4 +94,16 @@ enum E1000_INVM_STRUCTURE_TYPE { #define NVM_INIT_CTRL_4_DEFAULT_I211 0x00C1 #define NVM_LED_1_CFG_DEFAULT_I211 0x0184 #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C + +/* PLL Defines */ +#define E1000_PCI_PMCSR 0x44 +#define E1000_PCI_PMCSR_D3 0x03 +#define E1000_MAX_PLL_TRIES 5 +#define E1000_PHY_PLL_UNCONF 0xFF +#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000 +#define E1000_PHY_PLL_FREQ_REG 0x000E +#define E1000_INVM_DEFAULT_AL 0x202F +#define E1000_INVM_AUTOLOAD 0x0A +#define E1000_INVM_PLL_WO_VAL 0x0010 + #endif Modified: stable/10/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_ich8lan.c Mon Jul 28 19:01:25 2014 (r269195) +++ stable/10/sys/dev/e1000/e1000_ich8lan.c Mon Jul 28 21:11:18 2014 (r269196) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2014, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -63,6 +63,10 @@ * Ethernet Connection I217-V * Ethernet Connection I218-V * Ethernet Connection I218-LM + * Ethernet Connection (2) I218-LM + * Ethernet Connection (2) I218-V + * Ethernet Connection (3) I218-LM + * Ethernet Connection (3) I218-V */ #include "e1000_api.h" @@ -73,8 +77,8 @@ static s32 e1000_acquire_nvm_ich8lan(st static void e1000_release_nvm_ich8lan(struct e1000_hw *hw); static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); -static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); -static void e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index); +static int e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index); +static int e1000_rar_set_pch_lpt(struct e1000_hw *hw, u8 *addr, u32 index); static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw); static void e1000_update_mc_addr_list_pch2lan(struct e1000_hw *hw, u8 *mc_addr_list, @@ -250,7 +254,7 @@ out: * Toggling the LANPHYPC pin value fully power-cycles the PHY and is * used to reset the PHY to a quiescent state when necessary. **/ -void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw) +static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw) { u32 mac_reg; @@ -306,6 +310,12 @@ static s32 e1000_init_phy_workarounds_pc */ e1000_gate_hw_phy_config_ich8lan(hw, TRUE); + /* It is not possible to be certain of the current state of ULP + * so forcibly disable it. + */ + hw->dev_spec.ich8lan.ulp_state = e1000_ulp_state_unknown; + e1000_disable_ulp_lpt_lp(hw, TRUE); + ret_val = hw->phy.ops.acquire(hw); if (ret_val) { DEBUGOUT("Failed to initialize PHY flow\n"); @@ -611,13 +621,12 @@ static s32 e1000_init_nvm_params_ich8lan DEBUGFUNC("e1000_init_nvm_params_ich8lan"); /* Can't read flash registers if the register set isn't mapped. */ + nvm->type = e1000_nvm_flash_sw; if (!hw->flash_address) { DEBUGOUT("ERROR: Flash registers not mapped\n"); return -E1000_ERR_CONFIG; } - nvm->type = e1000_nvm_flash_sw; - gfpreg = E1000_READ_FLASH_REG(hw, ICH_FLASH_GFPREG); /* sector_X_addr is a "sector"-aligned address (4096 bytes) @@ -915,6 +924,17 @@ s32 e1000_set_eee_pchlan(struct e1000_hw } } + if (hw->phy.type == e1000_phy_82579) { + ret_val = e1000_read_emi_reg_locked(hw, I82579_LPI_PLL_SHUT, + &data); + if (ret_val) + goto release; + + data &= ~I82579_LPI_100_PLL_SHUT; + ret_val = e1000_write_emi_reg_locked(hw, I82579_LPI_PLL_SHUT, + data); + } + /* R/Clr IEEE MMD 3.1 bits 11:10 - Tx/Rx LPI Received */ ret_val = e1000_read_emi_reg_locked(hw, pcs_status, &data); if (ret_val) @@ -1179,6 +1199,256 @@ static s32 e1000_set_obff_timer_pch_lpt( } /** + * e1000_enable_ulp_lpt_lp - configure Ultra Low Power mode for LynxPoint-LP + * @hw: pointer to the HW structure + * @to_sx: boolean indicating a system power state transition to Sx + * + * When link is down, configure ULP mode to significantly reduce the power + * to the PHY. If on a Manageability Engine (ME) enabled system, tell the + * ME firmware to start the ULP configuration. If not on an ME enabled + * system, configure the ULP mode by software. + */ +s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx) +{ + u32 mac_reg; + s32 ret_val = E1000_SUCCESS; + u16 phy_reg; + + if ((hw->mac.type < e1000_pch_lpt) || + (hw->device_id == E1000_DEV_ID_PCH_LPT_I217_LM) || + (hw->device_id == E1000_DEV_ID_PCH_LPT_I217_V) || + (hw->device_id == E1000_DEV_ID_PCH_I218_LM2) || + (hw->device_id == E1000_DEV_ID_PCH_I218_V2) || + (hw->dev_spec.ich8lan.ulp_state == e1000_ulp_state_on)) + return 0; + + if (E1000_READ_REG(hw, E1000_FWSM) & E1000_ICH_FWSM_FW_VALID) { + /* Request ME configure ULP mode in the PHY */ + mac_reg = E1000_READ_REG(hw, E1000_H2ME); + mac_reg |= E1000_H2ME_ULP | E1000_H2ME_ENFORCE_SETTINGS; + E1000_WRITE_REG(hw, E1000_H2ME, mac_reg); + + goto out; + } + + if (!to_sx) { + int i = 0; + + /* Poll up to 5 seconds for Cable Disconnected indication */ + while (!(E1000_READ_REG(hw, E1000_FEXT) & + E1000_FEXT_PHY_CABLE_DISCONNECTED)) { + /* Bail if link is re-acquired */ + if (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU) + return -E1000_ERR_PHY; + + if (i++ == 100) + break; + + msec_delay(50); + } + DEBUGOUT2("CABLE_DISCONNECTED %s set after %dmsec\n", + (E1000_READ_REG(hw, E1000_FEXT) & + E1000_FEXT_PHY_CABLE_DISCONNECTED) ? "" : "not", + i * 50); + } + + ret_val = hw->phy.ops.acquire(hw); + if (ret_val) + goto out; + + /* Force SMBus mode in PHY */ + ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg); + if (ret_val) + goto release; + phy_reg |= CV_SMB_CTRL_FORCE_SMBUS; + e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg); + + /* Force SMBus mode in MAC */ + mac_reg = E1000_READ_REG(hw, E1000_CTRL_EXT); + mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS; + E1000_WRITE_REG(hw, E1000_CTRL_EXT, mac_reg); + + /* Set Inband ULP Exit, Reset to SMBus mode and + * Disable SMBus Release on PERST# in PHY + */ + ret_val = e1000_read_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, &phy_reg); + if (ret_val) + goto release; + phy_reg |= (I218_ULP_CONFIG1_RESET_TO_SMBUS | + I218_ULP_CONFIG1_DISABLE_SMB_PERST); + if (to_sx) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 21:14:42 2014 Return-Path: Delivered-To: svn-src-all@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 52E61ED7; Mon, 28 Jul 2014 21:14: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 409602473; Mon, 28 Jul 2014 21:14:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SLEgea005914; Mon, 28 Jul 2014 21:14:42 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SLEgn8005913; Mon, 28 Jul 2014 21:14:42 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201407282114.s6SLEgn8005913@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 28 Jul 2014 21:14:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269197 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 21:14:42 -0000 Author: trasz Date: Mon Jul 28 21:14:41 2014 New Revision: 269197 URL: http://svnweb.freebsd.org/changeset/base/269197 Log: Fix potential double free that could happen after connection error. MFC after: 3 days Modified: head/sys/dev/iscsi/icl.c Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Mon Jul 28 21:11:18 2014 (r269196) +++ head/sys/dev/iscsi/icl.c Mon Jul 28 21:14:41 2014 (r269197) @@ -664,7 +664,10 @@ icl_conn_receive_pdu(struct icl_conn *ic } if (error != 0) { - icl_pdu_free(request); + /* + * Don't free the PDU; it's pointed to by ic->ic_receive_pdu + * and will get freed in icl_conn_close(). + */ icl_conn_fail(ic); } From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 21:18:27 2014 Return-Path: Delivered-To: svn-src-all@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 F3751256; Mon, 28 Jul 2014 21:18:26 +0000 (UTC) Received: from mail-qg0-x236.google.com (mail-qg0-x236.google.com [IPv6:2607:f8b0:400d:c04::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EEFA24AC; Mon, 28 Jul 2014 21:18:26 +0000 (UTC) Received: by mail-qg0-f54.google.com with SMTP id z60so9650140qgd.27 for ; Mon, 28 Jul 2014 14:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=xC4y0CCiWQ4JehinQcB1i+vqTRs6jlQXBd0QnDkM4Tc=; b=Zu8lVxeFKoNovWt6L2FmsENZONepeyg2JKgkIh2hrvkieh8UtYvOj30dtC75HLzUh0 FZigCQOf3vD7+ZbFZluoXmX+CqOVhhk8WS7nONIIC9hxlrIMsX96yOM17Bv5UpQg7DB3 EJvYFqWIrNlxGCBAj8fdD9+8UmHZ8oI4ITz3V+L5ayjnSJdpwtQsJlEjL6MM2PZ8QG3Q osL+tA8OnxQCCep0qc5vBNYsk/E2iJycKLM81jJOU6GUgq97jBpABUCudubnbbIEwFdm kPTQjoaFdaeYzD0Sx2bMFnQc13a6aJy6yc1OcjD8fscAiYy0GjY4iXJH/7YcvPuLsoVZ hUMg== MIME-Version: 1.0 X-Received: by 10.224.171.197 with SMTP id i5mr64957377qaz.55.1406582305672; Mon, 28 Jul 2014 14:18:25 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.1.6 with HTTP; Mon, 28 Jul 2014 14:18:25 -0700 (PDT) In-Reply-To: <53D6BB0B.4010604@selasky.org> References: <201407261606.s6QG61le092895@svn.freebsd.org> <53D3FDEC.5040000@selasky.org> <53D55CD9.4000408@selasky.org> <53D6B784.6080102@selasky.org> <53D6BB0B.4010604@selasky.org> Date: Mon, 28 Jul 2014 14:18:25 -0700 X-Google-Sender-Auth: USTKhQzvpsddWkscgnPRKnINOGA Message-ID: Subject: Re: svn commit: r269127 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 21:18:27 -0000 On 28 July 2014 14:05, Hans Petter Selasky wrote: > On 07/28/14 22:52, Adrian Chadd wrote: >> >> The whole rate control thing from net80211 has to be upgraded. Drivers >> shouldn't be using ni->ni_txrate for anything other than informational >> purposes, yet .. well, that's not the case. > > > Hi, > > Should the rate be extracted from the NET80211 header instead, and if yes, > how? It's a little more complicated than that. The problem is that in an SMP world, ni_txrate can change at any point due to decisions made in other threads. So for control lookups, it can't just be some thing in the struct, it has to be something serialised behind locks. Ideally the ratectl API stuff will be extended to return a list of rates to use and _that_ function can do the sanity checking and locking and such. It's just unfortunate that the ni_txrate stuff was used in a lot of wifi drivers. :( -a From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 21:57:11 2014 Return-Path: Delivered-To: svn-src-all@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 03F0316B; Mon, 28 Jul 2014 21:57: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3EE52878; Mon, 28 Jul 2014 21:57:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SLvAZp028598; Mon, 28 Jul 2014 21:57:10 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SLvAJI028590; Mon, 28 Jul 2014 21:57:10 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201407282157.s6SLvAJI028590@svn.freebsd.org> From: Jack F Vogel Date: Mon, 28 Jul 2014 21:57:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269198 - in head/sys: dev/i40e modules/i40e X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 21:57:11 -0000 Author: jfv Date: Mon Jul 28 21:57:09 2014 New Revision: 269198 URL: http://svnweb.freebsd.org/changeset/base/269198 Log: Update the new 40G XL710 driver to Release version 1.0.0 Modified: head/sys/dev/i40e/i40e.h head/sys/dev/i40e/i40e_adminq.c head/sys/dev/i40e/i40e_adminq.h head/sys/dev/i40e/i40e_adminq_cmd.h head/sys/dev/i40e/i40e_common.c head/sys/dev/i40e/i40e_hmc.h head/sys/dev/i40e/i40e_lan_hmc.c head/sys/dev/i40e/i40e_lan_hmc.h head/sys/dev/i40e/i40e_nvm.c head/sys/dev/i40e/i40e_osdep.c head/sys/dev/i40e/i40e_prototype.h head/sys/dev/i40e/i40e_register.h head/sys/dev/i40e/i40e_register_x710_int.h head/sys/dev/i40e/i40e_txrx.c head/sys/dev/i40e/i40e_type.h head/sys/dev/i40e/if_i40e.c head/sys/modules/i40e/Makefile Modified: head/sys/dev/i40e/i40e.h ============================================================================== --- head/sys/dev/i40e/i40e.h Mon Jul 28 21:14:41 2014 (r269197) +++ head/sys/dev/i40e/i40e.h Mon Jul 28 21:57:09 2014 (r269198) @@ -92,13 +92,23 @@ #include "i40e_prototype.h" #ifdef I40E_DEBUG +#include + #define MAC_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x" #define MAC_FORMAT_ARGS(mac_addr) \ (mac_addr)[0], (mac_addr)[1], (mac_addr)[2], (mac_addr)[3], \ (mac_addr)[4], (mac_addr)[5] #define ON_OFF_STR(is_set) ((is_set) ? "On" : "Off") +#define DPRINTF(...) printf(__VA_ARGS__) +#define DDPRINTF(dev, ...) device_printf(dev, __VA_ARGS__) +#define IDPRINTF(ifp, ...) if_printf(ifp, __VA_ARGS__) + // static void i40e_dump_desc(void *, u8, u16); +#else +#define DPRINTF(...) +#define DDPRINTF(...) +#define IDPRINTF(...) #endif /* Tunables */ @@ -173,10 +183,21 @@ #define I40E_ITR_NONE 3 #define I40E_QUEUE_EOL 0x7FF #define I40E_MAX_FRAME 0x2600 -#define I40E_MAX_SEGS 32 -#define I40E_MAX_FILTERS 256 /* This is artificial */ +#define I40E_MAX_TX_SEGS 8 +#define I40E_MAX_TSO_SEGS 66 +#define I40E_SPARSE_CHAIN 6 +#define I40E_QUEUE_HUNG 0x80000000 + +/* ERJ: hardware can support ~1.5k filters between all functions */ +#define I40E_MAX_FILTERS 256 #define I40E_MAX_TX_BUSY 10 +#define I40E_NVM_VERSION_LO_SHIFT 0 +#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT) +#define I40E_NVM_VERSION_HI_SHIFT 12 +#define I40E_NVM_VERSION_HI_MASK (0xf << I40E_NVM_VERSION_HI_SHIFT) + + /* * Interrupt Moderation parameters */ @@ -200,7 +221,9 @@ /* used in the vlan field of the filter when not a vlan */ #define I40E_VLAN_ANY -1 -#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) +#define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) +#define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6) +#define CSUM_OFFLOAD (CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO) /* Misc flags for i40e_vsi.flags */ #define I40E_FLAGS_KEEP_TSO4 (1 << 0) @@ -238,6 +261,7 @@ struct i40e_tx_buf { u32 eop_index; struct mbuf *m_head; bus_dmamap_t map; + bus_dma_tag_t tag; }; struct i40e_rx_buf { @@ -248,15 +272,6 @@ struct i40e_rx_buf { bus_dmamap_t pmap; }; -struct i40e_pkt_info { - u16 etype; - u32 elen; - u32 iplen; - struct ip *ip; - struct ip6_hdr *ip6; - struct tcphdr *th; -}; - /* ** This struct has multiple uses, multicast ** addresses, vlans, and mac filters all use it. @@ -275,7 +290,7 @@ struct i40e_mac_filter { struct tx_ring { struct i40e_queue *que; struct mtx mtx; - int watchdog; + u32 tail; struct i40e_tx_desc *base; struct i40e_dma_mem dma; u16 next_avail; @@ -287,7 +302,8 @@ struct tx_ring { struct i40e_tx_buf *buffers; volatile u16 avail; u32 cmd; - bus_dma_tag_t tag; + bus_dma_tag_t tx_tag; + bus_dma_tag_t tso_tag; char mtx_name[16]; struct buf_ring *br; @@ -318,6 +334,7 @@ struct rx_ring { char mtx_name[16]; struct i40e_rx_buf *buffers; u32 mbuf_sz; + u32 tail; bus_dma_tag_t htag; bus_dma_tag_t ptag; @@ -407,6 +424,7 @@ struct i40e_vsi { u64 hw_filters_add; /* Misc. */ + u64 active_queues; u64 flags; }; @@ -433,8 +451,9 @@ i40e_get_filter(struct i40e_vsi *vsi) { struct i40e_mac_filter *f; - // create a new empty filter - f = malloc(sizeof(struct i40e_mac_filter) , M_DEVBUF, M_NOWAIT | M_ZERO); + /* create a new empty filter */ + f = malloc(sizeof(struct i40e_mac_filter), + M_DEVBUF, M_NOWAIT | M_ZERO); SLIST_INSERT_HEAD(&vsi->ftl, f, next); return (f); @@ -467,6 +486,25 @@ struct i40e_sysctl_info { extern int i40e_atr_rate; +/* +** i40e_fw_version_str - format the FW and NVM version strings +*/ +static inline char * +i40e_fw_version_str(struct i40e_hw *hw) +{ + static char buf[32]; + + snprintf(buf, sizeof(buf), + "f%d.%d a%d.%d n%02x.%02x e%08x", + hw->aq.fw_maj_ver, hw->aq.fw_min_ver, + hw->aq.api_maj_ver, hw->aq.api_min_ver, + (hw->nvm.version & I40E_NVM_VERSION_HI_MASK) >> + I40E_NVM_VERSION_HI_SHIFT, + (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >> + I40E_NVM_VERSION_LO_SHIFT, + hw->nvm.eetrack); + return buf; +} /********************************************************************* * TXRX Function prototypes Modified: head/sys/dev/i40e/i40e_adminq.c ============================================================================== --- head/sys/dev/i40e/i40e_adminq.c Mon Jul 28 21:14:41 2014 (r269197) +++ head/sys/dev/i40e/i40e_adminq.c Mon Jul 28 21:57:09 2014 (r269198) @@ -61,16 +61,37 @@ static void i40e_adminq_init_regs(struct hw->aq.asq.tail = I40E_VF_ATQT1; hw->aq.asq.head = I40E_VF_ATQH1; hw->aq.asq.len = I40E_VF_ATQLEN1; + hw->aq.asq.bal = I40E_VF_ATQBAL1; + hw->aq.asq.bah = I40E_VF_ATQBAH1; hw->aq.arq.tail = I40E_VF_ARQT1; hw->aq.arq.head = I40E_VF_ARQH1; hw->aq.arq.len = I40E_VF_ARQLEN1; + hw->aq.arq.bal = I40E_VF_ARQBAL1; + hw->aq.arq.bah = I40E_VF_ARQBAH1; +#ifdef I40E_QV + } else if (hw->aq_dbg_ena) { + hw->aq.asq.tail = I40E_GL_ATQT; + hw->aq.asq.head = I40E_GL_ATQH; + hw->aq.asq.len = I40E_GL_ATQLEN; + hw->aq.asq.bal = I40E_GL_ATQBAL; + hw->aq.asq.bah = I40E_GL_ATQBAH; + hw->aq.arq.tail = I40E_GL_ARQT; + hw->aq.arq.head = I40E_GL_ARQH; + hw->aq.arq.len = I40E_GL_ARQLEN; + hw->aq.arq.bal = I40E_GL_ARQBAL; + hw->aq.arq.bah = I40E_GL_ARQBAH; +#endif } else { hw->aq.asq.tail = I40E_PF_ATQT; hw->aq.asq.head = I40E_PF_ATQH; hw->aq.asq.len = I40E_PF_ATQLEN; + hw->aq.asq.bal = I40E_PF_ATQBAL; + hw->aq.asq.bah = I40E_PF_ATQBAH; hw->aq.arq.tail = I40E_PF_ARQT; hw->aq.arq.head = I40E_PF_ARQH; hw->aq.arq.len = I40E_PF_ARQLEN; + hw->aq.arq.bal = I40E_PF_ARQBAL; + hw->aq.arq.bah = I40E_PF_ARQBAH; } } @@ -148,6 +169,10 @@ void i40e_free_adminq_arq(struct i40e_hw **/ static enum i40e_status_code i40e_alloc_arq_bufs(struct i40e_hw *hw) { +#ifdef I40E_QV + struct i40e_aq_desc qv_desc; + struct i40e_aq_desc *qv_desc_on_ring; +#endif enum i40e_status_code ret_code; struct i40e_aq_desc *desc; struct i40e_dma_mem *bi; @@ -176,6 +201,13 @@ static enum i40e_status_code i40e_alloc_ /* now configure the descriptors for use */ desc = I40E_ADMINQ_DESC(hw->aq.arq, i); +#ifdef I40E_QV + /* swap the descriptor with userspace version */ + i40e_memcpy(&qv_desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + qv_desc_on_ring = desc; + desc = &qv_desc; +#endif desc->flags = CPU_TO_LE16(I40E_AQ_FLAG_BUF); if (hw->aq.arq_buf_size > I40E_AQ_LARGE_BUF) @@ -194,6 +226,11 @@ static enum i40e_status_code i40e_alloc_ CPU_TO_LE32(I40E_LO_DWORD(bi->pa)); desc->params.external.param0 = 0; desc->params.external.param1 = 0; +#ifdef I40E_QV + /* put the initialized descriptor back to the ring */ + i40e_memcpy(qv_desc_on_ring, desc, sizeof(struct i40e_aq_desc), + I40E_NONDMA_TO_DMA); +#endif } alloc_arq_bufs: @@ -306,27 +343,14 @@ static enum i40e_status_code i40e_config wr32(hw, hw->aq.asq.head, 0); wr32(hw, hw->aq.asq.tail, 0); - if (hw->mac.type == I40E_MAC_VF) { - /* configure the transmit queue */ - wr32(hw, I40E_VF_ATQBAH1, - I40E_HI_DWORD(hw->aq.asq.desc_buf.pa)); - wr32(hw, I40E_VF_ATQBAL1, - I40E_LO_DWORD(hw->aq.asq.desc_buf.pa)); - wr32(hw, I40E_VF_ATQLEN1, (hw->aq.num_asq_entries | - I40E_VF_ATQLEN1_ATQENABLE_MASK)); - reg = rd32(hw, I40E_VF_ATQBAL1); - } else { - /* configure the transmit queue */ - wr32(hw, I40E_PF_ATQBAH, - I40E_HI_DWORD(hw->aq.asq.desc_buf.pa)); - wr32(hw, I40E_PF_ATQBAL, - I40E_LO_DWORD(hw->aq.asq.desc_buf.pa)); - wr32(hw, I40E_PF_ATQLEN, (hw->aq.num_asq_entries | - I40E_PF_ATQLEN_ATQENABLE_MASK)); - reg = rd32(hw, I40E_PF_ATQBAL); - } + /* set starting point */ + wr32(hw, hw->aq.asq.len, (hw->aq.num_asq_entries | + I40E_PF_ATQLEN_ATQENABLE_MASK)); + wr32(hw, hw->aq.asq.bal, I40E_LO_DWORD(hw->aq.asq.desc_buf.pa)); + wr32(hw, hw->aq.asq.bah, I40E_HI_DWORD(hw->aq.asq.desc_buf.pa)); /* Check one register to verify that config was applied */ + reg = rd32(hw, hw->aq.asq.bal); if (reg != I40E_LO_DWORD(hw->aq.asq.desc_buf.pa)) ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; @@ -348,30 +372,17 @@ static enum i40e_status_code i40e_config wr32(hw, hw->aq.arq.head, 0); wr32(hw, hw->aq.arq.tail, 0); - if (hw->mac.type == I40E_MAC_VF) { - /* configure the receive queue */ - wr32(hw, I40E_VF_ARQBAH1, - I40E_HI_DWORD(hw->aq.arq.desc_buf.pa)); - wr32(hw, I40E_VF_ARQBAL1, - I40E_LO_DWORD(hw->aq.arq.desc_buf.pa)); - wr32(hw, I40E_VF_ARQLEN1, (hw->aq.num_arq_entries | - I40E_VF_ARQLEN1_ARQENABLE_MASK)); - reg = rd32(hw, I40E_VF_ARQBAL1); - } else { - /* configure the receive queue */ - wr32(hw, I40E_PF_ARQBAH, - I40E_HI_DWORD(hw->aq.arq.desc_buf.pa)); - wr32(hw, I40E_PF_ARQBAL, - I40E_LO_DWORD(hw->aq.arq.desc_buf.pa)); - wr32(hw, I40E_PF_ARQLEN, (hw->aq.num_arq_entries | - I40E_PF_ARQLEN_ARQENABLE_MASK)); - reg = rd32(hw, I40E_PF_ARQBAL); - } + /* set starting point */ + wr32(hw, hw->aq.arq.len, (hw->aq.num_arq_entries | + I40E_PF_ARQLEN_ARQENABLE_MASK)); + wr32(hw, hw->aq.arq.bal, I40E_LO_DWORD(hw->aq.arq.desc_buf.pa)); + wr32(hw, hw->aq.arq.bah, I40E_HI_DWORD(hw->aq.arq.desc_buf.pa)); /* Update tail in the HW to post pre-allocated buffers */ wr32(hw, hw->aq.arq.tail, hw->aq.num_arq_entries - 1); /* Check one register to verify that config was applied */ + reg = rd32(hw, hw->aq.arq.bal); if (reg != I40E_LO_DWORD(hw->aq.arq.desc_buf.pa)) ret_code = I40E_ERR_ADMIN_QUEUE_ERROR; @@ -510,9 +521,22 @@ enum i40e_status_code i40e_shutdown_asq( return I40E_ERR_NOT_READY; /* Stop firmware AdminQ processing */ +#ifdef I40E_QV + /* Do not reset registers, as Tools AQ is shared resource for QV */ + if (!hw->aq_dbg_ena) { + wr32(hw, hw->aq.asq.head, 0); + wr32(hw, hw->aq.asq.tail, 0); + wr32(hw, hw->aq.asq.len, 0); + wr32(hw, hw->aq.asq.bal, 0); + wr32(hw, hw->aq.asq.bah, 0); + } +#else wr32(hw, hw->aq.asq.head, 0); wr32(hw, hw->aq.asq.tail, 0); wr32(hw, hw->aq.asq.len, 0); + wr32(hw, hw->aq.asq.bal, 0); + wr32(hw, hw->aq.asq.bah, 0); +#endif /* make sure spinlock is available */ i40e_acquire_spinlock(&hw->aq.asq_spinlock); @@ -541,9 +565,22 @@ enum i40e_status_code i40e_shutdown_arq( return I40E_ERR_NOT_READY; /* Stop firmware AdminQ processing */ +#ifdef I40E_QV + /* Do not reset registers, as Tools AQ is shared resource for QV */ + if (!hw->aq_dbg_ena) { + wr32(hw, hw->aq.arq.head, 0); + wr32(hw, hw->aq.arq.tail, 0); + wr32(hw, hw->aq.arq.len, 0); + wr32(hw, hw->aq.arq.bal, 0); + wr32(hw, hw->aq.arq.bah, 0); + } +#else wr32(hw, hw->aq.arq.head, 0); wr32(hw, hw->aq.arq.tail, 0); wr32(hw, hw->aq.arq.len, 0); + wr32(hw, hw->aq.arq.bal, 0); + wr32(hw, hw->aq.arq.bah, 0); +#endif /* make sure spinlock is available */ i40e_acquire_spinlock(&hw->aq.arq_spinlock); @@ -591,6 +628,9 @@ enum i40e_status_code i40e_init_adminq(s /* Set up register offsets */ i40e_adminq_init_regs(hw); + /* setup ASQ command write back timeout */ + hw->aq.asq_cmd_timeout = I40E_ASQ_CMD_TIMEOUT; + /* allocate the ASQ */ ret_code = i40e_init_asq(hw); if (ret_code != I40E_SUCCESS) @@ -627,16 +667,19 @@ enum i40e_status_code i40e_init_adminq(s i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_HI, &eetrack_hi); hw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo; -#ifdef FORTVILLE_A0_SUPPORT - if (hw->aq.api_maj_ver != I40E_FW_API_VERSION_MAJOR || - !((hw->aq.api_min_ver == I40E_FW_API_VERSION_MINOR) || - (hw->aq.api_min_ver == I40E_FW_API_VERSION_A0_MINOR))) { +#ifdef I40E_QV + if (!hw->qv_force_init) { + if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { + ret_code = I40E_ERR_FIRMWARE_API_VERSION; + goto init_adminq_free_arq; + } + } #else if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { -#endif ret_code = I40E_ERR_FIRMWARE_API_VERSION; goto init_adminq_free_arq; } +#endif /* pre-emptive resource lock release */ i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL); @@ -671,8 +714,16 @@ enum i40e_status_code i40e_shutdown_admi { enum i40e_status_code ret_code = I40E_SUCCESS; +#ifdef I40E_QV + /* This command is not supported for Tools AQ */ + if (!hw->aq_dbg_ena) { + if (i40e_check_asq_alive(hw)) + i40e_aq_queue_shutdown(hw, TRUE); + } +#else if (i40e_check_asq_alive(hw)) i40e_aq_queue_shutdown(hw, TRUE); +#endif i40e_shutdown_asq(hw); i40e_shutdown_arq(hw); @@ -692,6 +743,10 @@ enum i40e_status_code i40e_shutdown_admi **/ u16 i40e_clean_asq(struct i40e_hw *hw) { +#ifdef I40E_QV + struct i40e_aq_desc qv_desc = {0}; + struct i40e_aq_desc *qv_desc_on_ring; +#endif /* I40E_QV */ struct i40e_adminq_ring *asq = &(hw->aq.asq); struct i40e_asq_cmd_details *details; u16 ntc = asq->next_to_clean; @@ -700,6 +755,13 @@ u16 i40e_clean_asq(struct i40e_hw *hw) desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); +#ifdef I40E_QV + /* copy the descriptor from ring to userspace buffer */ + i40e_memcpy(&qv_desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + qv_desc_on_ring = desc; + desc = &qv_desc; +#endif /* I40E_QV */ while (rd32(hw, hw->aq.asq.head) != ntc) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "%s: ntc %d head %d.\n", __FUNCTION__, ntc, @@ -714,11 +776,23 @@ u16 i40e_clean_asq(struct i40e_hw *hw) } i40e_memset(desc, 0, sizeof(*desc), I40E_DMA_MEM); i40e_memset(details, 0, sizeof(*details), I40E_NONDMA_MEM); +#ifdef I40E_QV + /* copy the descriptor from userspace buffer to ring */ + i40e_memcpy(qv_desc_on_ring, desc, + sizeof(struct i40e_aq_desc), I40E_NONDMA_TO_DMA); +#endif /* I40E_QV */ ntc++; if (ntc == asq->count) ntc = 0; desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); +#ifdef I40E_QV + /* copy the descriptor from ring to userspace buffer */ + i40e_memcpy(&qv_desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + qv_desc_on_ring = desc; + desc = &qv_desc; +#endif /* I40E_QV */ } asq->next_to_clean = ntc; @@ -759,6 +833,10 @@ enum i40e_status_code i40e_asq_send_comm u16 buff_size, struct i40e_asq_cmd_details *cmd_details) { +#ifdef I40E_QV + struct i40e_aq_desc qv_desc = {0}; + struct i40e_aq_desc *qv_desc_on_ring; +#endif /* I40E_QV */ enum i40e_status_code status = I40E_SUCCESS; struct i40e_dma_mem *dma_buff = NULL; struct i40e_asq_cmd_details *details; @@ -855,6 +933,13 @@ enum i40e_status_code i40e_asq_send_comm /* if the desc is available copy the temp desc to the right place */ i40e_memcpy(desc_on_ring, desc, sizeof(struct i40e_aq_desc), I40E_NONDMA_TO_DMA); +#ifdef I40E_QV + /* copy the descriptor from ring to userspace buffer */ + i40e_memcpy(&qv_desc, desc_on_ring, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + qv_desc_on_ring = desc_on_ring; + desc_on_ring = &qv_desc; +#endif /* I40E_QV */ /* if buff is not NULL assume indirect command */ if (buff != NULL) { @@ -871,11 +956,17 @@ enum i40e_status_code i40e_asq_send_comm CPU_TO_LE32(I40E_HI_DWORD(dma_buff->pa)); desc_on_ring->params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD(dma_buff->pa)); +#ifdef I40E_QV + /* copy the descriptor from userspace buffer to ring */ + i40e_memcpy(qv_desc_on_ring, desc_on_ring, + sizeof(struct i40e_aq_desc), I40E_NONDMA_TO_DMA); +#endif /* I40E_QV */ } /* bump the tail */ i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, buff); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, + buff, buff_size); (hw->aq.asq.next_to_use)++; if (hw->aq.asq.next_to_use == hw->aq.asq.count) hw->aq.asq.next_to_use = 0; @@ -890,6 +981,11 @@ enum i40e_status_code i40e_asq_send_comm u32 delay_len = 10; do { +#ifdef I40E_QV + /* copy the descriptor from ring to user buffer */ + i40e_memcpy(desc_on_ring, qv_desc_on_ring, + sizeof(struct i40e_aq_desc), I40E_DMA_TO_NONDMA); +#endif /* I40E_QV */ /* AQ designers suggest use of head for better * timing reliability than DD bit */ @@ -898,11 +994,15 @@ enum i40e_status_code i40e_asq_send_comm /* ugh! delay while spin_lock */ i40e_usec_delay(delay_len); total_delay += delay_len; - } while (total_delay < I40E_ASQ_CMD_TIMEOUT); + } while (total_delay < hw->aq.asq_cmd_timeout); } /* if ready, copy the desc back to temp */ if (i40e_asq_done(hw)) { +#ifdef I40E_QV + /* Swap pointer back */ + desc_on_ring = qv_desc_on_ring; +#endif /* I40E_QV */ i40e_memcpy(desc, desc_on_ring, sizeof(struct i40e_aq_desc), I40E_DMA_TO_NONDMA); if (buff != NULL) @@ -926,11 +1026,9 @@ enum i40e_status_code i40e_asq_send_comm hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; } - if (desc->datalen == buff_size) { - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, - "AQTX: desc and buffer writeback:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff); - } + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + "AQTX: desc and buffer writeback:\n"); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size); /* update the error if time out occurred */ if ((!cmd_completed) && @@ -981,6 +1079,10 @@ enum i40e_status_code i40e_clean_arq_ele struct i40e_arq_event_info *e, u16 *pending) { +#ifdef I40E_QV + struct i40e_aq_desc qv_desc = {0}; + struct i40e_aq_desc *qv_desc_on_ring; +#endif /* I40E_QV */ enum i40e_status_code ret_code = I40E_SUCCESS; u16 ntc = hw->aq.arq.next_to_clean; struct i40e_aq_desc *desc; @@ -1006,6 +1108,13 @@ enum i40e_status_code i40e_clean_arq_ele /* now clean the next descriptor */ desc = I40E_ADMINQ_DESC(hw->aq.arq, ntc); +#ifdef I40E_QV + /* copy the descriptor from ring to userspace buffer */ + i40e_memcpy(&qv_desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + qv_desc_on_ring = desc; + desc = &qv_desc; +#endif /* I40E_QV */ desc_idx = ntc; flags = LE16_TO_CPU(desc->flags); @@ -1017,19 +1126,20 @@ enum i40e_status_code i40e_clean_arq_ele I40E_DEBUG_AQ_MESSAGE, "AQRX: Event received with error 0x%X.\n", hw->aq.arq_last_status); - } else { - i40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc), - I40E_DMA_TO_NONDMA); - datalen = LE16_TO_CPU(desc->datalen); - e->msg_size = min(datalen, e->msg_size); - if (e->msg_buf != NULL && (e->msg_size != 0)) - i40e_memcpy(e->msg_buf, - hw->aq.arq.r.arq_bi[desc_idx].va, - e->msg_size, I40E_DMA_TO_NONDMA); } + i40e_memcpy(&e->desc, desc, sizeof(struct i40e_aq_desc), + I40E_DMA_TO_NONDMA); + datalen = LE16_TO_CPU(desc->datalen); + e->msg_size = min(datalen, e->msg_size); + if (e->msg_buf != NULL && (e->msg_size != 0)) + i40e_memcpy(e->msg_buf, + hw->aq.arq.r.arq_bi[desc_idx].va, + e->msg_size, I40E_DMA_TO_NONDMA); + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n"); - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf); + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf, + hw->aq.arq_buf_size); /* Restore the original datalen and buffer address in the desc, * FW updates datalen to indicate the event message @@ -1044,6 +1154,11 @@ enum i40e_status_code i40e_clean_arq_ele desc->datalen = CPU_TO_LE16((u16)bi->size); desc->params.external.addr_high = CPU_TO_LE32(I40E_HI_DWORD(bi->pa)); desc->params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD(bi->pa)); +#ifdef I40E_QV + /* copy the descriptor from userspace buffer to ring */ + i40e_memcpy(qv_desc_on_ring, desc, + sizeof(struct i40e_aq_desc), I40E_NONDMA_TO_DMA); +#endif /* I40E_QV */ /* set tail = the last cleaned desc index. */ wr32(hw, hw->aq.arq.tail, ntc); Modified: head/sys/dev/i40e/i40e_adminq.h ============================================================================== --- head/sys/dev/i40e/i40e_adminq.h Mon Jul 28 21:14:41 2014 (r269197) +++ head/sys/dev/i40e/i40e_adminq.h Mon Jul 28 21:57:09 2014 (r269198) @@ -64,6 +64,8 @@ struct i40e_adminq_ring { u32 head; u32 tail; u32 len; + u32 bah; + u32 bal; }; /* ASQ transaction details */ @@ -90,6 +92,7 @@ struct i40e_arq_event_info { struct i40e_adminq_info { struct i40e_adminq_ring arq; /* receive queue */ struct i40e_adminq_ring asq; /* send queue */ + u32 asq_cmd_timeout; /* send queue cmd write back timeout*/ u16 num_arq_entries; /* receive queue depth */ u16 num_asq_entries; /* send queue depth */ u16 arq_buf_size; /* receive queue buffer size */ @@ -110,8 +113,8 @@ struct i40e_adminq_info { }; /* general information */ -#define I40E_AQ_LARGE_BUF 512 -#define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */ +#define I40E_AQ_LARGE_BUF 512 +#define I40E_ASQ_CMD_TIMEOUT 100000 /* usecs */ void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc, u16 opcode); Modified: head/sys/dev/i40e/i40e_adminq_cmd.h ============================================================================== --- head/sys/dev/i40e/i40e_adminq_cmd.h Mon Jul 28 21:14:41 2014 (r269197) +++ head/sys/dev/i40e/i40e_adminq_cmd.h Mon Jul 28 21:57:09 2014 (r269198) @@ -43,9 +43,6 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 #define I40E_FW_API_VERSION_MINOR 0x0002 -#ifdef FORTVILLE_A0_SUPPORT -#define I40E_FW_API_VERSION_A0_MINOR 0x0000 -#endif struct i40e_aq_desc { __le16 flags; @@ -698,9 +695,6 @@ struct i40e_aqc_add_get_update_vsi { #define I40E_AQ_VSI_TYPE_PF 0x2 #define I40E_AQ_VSI_TYPE_EMP_MNG 0x3 #define I40E_AQ_VSI_FLAG_CASCADED_PV 0x4 -#ifdef FORTVILLE_A0_SUPPORT -#define I40E_AQ_VSI_FLAG_CLOUD_VSI 0x8 -#endif __le32 addr_high; __le32 addr_low; }; @@ -1223,11 +1217,6 @@ struct i40e_aqc_add_remove_cloud_filters #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0 #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \ I40E_AQC_ADD_CLOUD_FILTER_SHIFT) -#ifdef FORTVILLE_A0_SUPPORT -#define I40E_AQC_ADD_CLOUD_FILTER_OIP_GRE 0x0002 -#define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_GRE 0x0004 -#define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_VNL 0x0007 -#endif /* 0x0000 reserved */ #define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001 /* 0x0002 reserved */ @@ -2012,22 +2001,6 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_star /* Add Udp Tunnel command and completion (direct 0x0B00) */ struct i40e_aqc_add_udp_tunnel { -#ifdef FORTVILLE_A0_SUPPORT - __le16 udp_port; - u8 header_len; /* in DWords, 1 to 15 */ - u8 protocol_type; -#define I40E_AQC_TUNNEL_TYPE_TEREDO 0x0 -#define I40E_AQC_TUNNEL_TYPE_VXLAN 0x2 -#define I40E_AQC_TUNNEL_TYPE_NGE 0x3 - u8 variable_udp_length; -#define I40E_AQC_TUNNEL_FIXED_UDP_LENGTH 0x0 -#define I40E_AQC_TUNNEL_VARIABLE_UDP_LENGTH 0x1 - u8 udp_key_index; -#define I40E_AQC_TUNNEL_KEY_INDEX_VXLAN 0x0 -#define I40E_AQC_TUNNEL_KEY_INDEX_NGE 0x1 -#define I40E_AQC_TUNNEL_KEY_INDEX_PROPRIETARY_UDP 0x2 - u8 reserved[10]; -#else __le16 udp_port; u8 reserved0[3]; u8 protocol_type; @@ -2035,7 +2008,6 @@ struct i40e_aqc_add_udp_tunnel { #define I40E_AQC_TUNNEL_TYPE_NGE 0x01 #define I40E_AQC_TUNNEL_TYPE_TEREDO 0x10 u8 reserved1[10]; -#endif }; I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel); @@ -2056,13 +2028,7 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_t struct i40e_aqc_remove_udp_tunnel { u8 reserved[2]; u8 index; /* 0 to 15 */ -#ifdef FORTVILLE_A0_SUPPORT - u8 pf_filters; - u8 total_filters; - u8 reserved2[11]; -#else u8 reserved2[13]; -#endif }; I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel); @@ -2072,37 +2038,13 @@ struct i40e_aqc_del_udp_tunnel_completio u8 index; /* 0 to 15 */ u8 multiple_pfs; u8 total_filters_used; -#ifdef FORTVILLE_A0_SUPPORT - u8 reserved; - u8 tunnels_free; - u8 reserved1[9]; -#else u8 reserved1[11]; -#endif }; I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion); /* tunnel key structure 0x0B10 */ -#ifdef FORTVILLE_A0_SUPPORT -struct i40e_aqc_tunnel_key_structure_A0 { - __le16 key1_off; - __le16 key1_len; - __le16 key2_off; - __le16 key2_len; - __le16 flags; -#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01 -/* response flags */ -#define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01 -#define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02 -#define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03 - u8 resreved[6]; -}; - -I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure_A0); - -#endif struct i40e_aqc_tunnel_key_structure { u8 key1_off; u8 key2_off; Modified: head/sys/dev/i40e/i40e_common.c ============================================================================== --- head/sys/dev/i40e/i40e_common.c Mon Jul 28 21:14:41 2014 (r269197) +++ head/sys/dev/i40e/i40e_common.c Mon Jul 28 21:57:09 2014 (r269198) @@ -52,9 +52,6 @@ static enum i40e_status_code i40e_set_ma if (hw->vendor_id == I40E_INTEL_VENDOR_ID) { switch (hw->device_id) { -#if defined(FORTVILLE_A0_SUPPORT) || defined(I40E_FPGA_SUPPORT) - case I40E_DEV_ID_FPGA_A: -#endif case I40E_DEV_ID_SFP_XL710: case I40E_DEV_ID_QEMU: case I40E_DEV_ID_KX_A: @@ -63,9 +60,6 @@ static enum i40e_status_code i40e_set_ma case I40E_DEV_ID_QSFP_A: case I40E_DEV_ID_QSFP_B: case I40E_DEV_ID_QSFP_C: -#ifdef FORTVILLE_A0_SUPPORT - case I40E_DEV_ID_10G_BASE_T: -#endif hw->mac.type = I40E_MAC_XL710; break; case I40E_DEV_ID_VF: @@ -91,13 +85,15 @@ static enum i40e_status_code i40e_set_ma * @mask: debug mask * @desc: pointer to admin queue descriptor * @buffer: pointer to command buffer + * @buf_len: max length of buffer * * Dumps debug log about adminq command with descriptor contents. **/ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, - void *buffer) + void *buffer, u16 buf_len) { struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; + u16 len = LE16_TO_CPU(aq_desc->datalen); u8 *aq_buffer = (u8 *)buffer; u32 data[4]; u32 i = 0; @@ -121,7 +117,9 @@ void i40e_debug_aq(struct i40e_hw *hw, e if ((buffer != NULL) && (aq_desc->datalen != 0)) { i40e_memset(data, 0, sizeof(data), I40E_NONDMA_MEM); i40e_debug(hw, mask, "AQ CMD Buffer:\n"); - for (i = 0; i < LE16_TO_CPU(aq_desc->datalen); i++) { + if (buf_len < len) + len = buf_len; + for (i = 0; i < len; i++) { data[((i % 16) / 4)] |= ((u32)aq_buffer[i]) << (8 * (i % 4)); if ((i % 16) == 15) { @@ -572,7 +570,6 @@ enum i40e_status_code i40e_init_shared_c break; default: return I40E_ERR_DEVICE_NOT_SUPPORTED; - break; } hw->phy.get_link_info = TRUE; @@ -712,8 +709,10 @@ void i40e_pre_tx_queue_cfg(struct i40e_h u32 reg_block = 0; u32 reg_val; - if (abs_queue_idx >= 128) + if (abs_queue_idx >= 128) { reg_block = abs_queue_idx / 128; + abs_queue_idx %= 128; + } reg_val = rd32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block)); reg_val &= ~I40E_GLLAN_TXPRE_QDIS_QINDX_MASK; @@ -762,6 +761,8 @@ static enum i40e_media_type i40e_get_med switch (hw->phy.link_info.phy_type) { case I40E_PHY_TYPE_10GBASE_SR: case I40E_PHY_TYPE_10GBASE_LR: + case I40E_PHY_TYPE_1000BASE_SX: + case I40E_PHY_TYPE_1000BASE_LX: case I40E_PHY_TYPE_40GBASE_SR4: case I40E_PHY_TYPE_40GBASE_LR4: media = I40E_MEDIA_TYPE_FIBER; @@ -797,11 +798,7 @@ static enum i40e_media_type i40e_get_med return media; } -#ifndef FORTVILLE_A0_SUPPORT #define I40E_PF_RESET_WAIT_COUNT 100 -#else -#define I40E_PF_RESET_WAIT_COUNT 200 -#endif /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -878,6 +875,99 @@ enum i40e_status_code i40e_pf_reset(stru } /** + * i40e_clear_hw - clear out any left over hw state + * @hw: pointer to the hw struct + * + * Clear queues and interrupts, typically called at init time, + * but after the capabilities have been found so we know how many + * queues and msix vectors have been allocated. + **/ +void i40e_clear_hw(struct i40e_hw *hw) +{ + u32 num_queues, base_queue; + u32 num_pf_int; + u32 num_vf_int; + u32 num_vfs; + u32 i, j; + u32 val; + u32 eol = 0x7ff; + + /* get number of interrupts, queues, and vfs */ + val = rd32(hw, I40E_GLPCI_CNF2); + num_pf_int = (val & I40E_GLPCI_CNF2_MSI_X_PF_N_MASK) >> + I40E_GLPCI_CNF2_MSI_X_PF_N_SHIFT; + num_vf_int = (val & I40E_GLPCI_CNF2_MSI_X_VF_N_MASK) >> + I40E_GLPCI_CNF2_MSI_X_VF_N_SHIFT; + + val = rd32(hw, I40E_PFLAN_QALLOC); + base_queue = (val & I40E_PFLAN_QALLOC_FIRSTQ_MASK) >> + I40E_PFLAN_QALLOC_FIRSTQ_SHIFT; + j = (val & I40E_PFLAN_QALLOC_LASTQ_MASK) >> + I40E_PFLAN_QALLOC_LASTQ_SHIFT; + if (val & I40E_PFLAN_QALLOC_VALID_MASK) + num_queues = (j - base_queue) + 1; + else + num_queues = 0; + + val = rd32(hw, I40E_PF_VT_PFALLOC); + i = (val & I40E_PF_VT_PFALLOC_FIRSTVF_MASK) >> + I40E_PF_VT_PFALLOC_FIRSTVF_SHIFT; + j = (val & I40E_PF_VT_PFALLOC_LASTVF_MASK) >> + I40E_PF_VT_PFALLOC_LASTVF_SHIFT; + if (val & I40E_PF_VT_PFALLOC_VALID_MASK) + num_vfs = (j - i) + 1; + else + num_vfs = 0; + + /* stop all the interrupts */ + wr32(hw, I40E_PFINT_ICR0_ENA, 0); + val = 0x3 << I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT; + for (i = 0; i < num_pf_int - 2; i++) + wr32(hw, I40E_PFINT_DYN_CTLN(i), val); + + /* Set the FIRSTQ_INDX field to 0x7FF in PFINT_LNKLSTx */ + val = eol << I40E_PFINT_LNKLST0_FIRSTQ_INDX_SHIFT; + wr32(hw, I40E_PFINT_LNKLST0, val); + for (i = 0; i < num_pf_int - 2; i++) + wr32(hw, I40E_PFINT_LNKLSTN(i), val); + val = eol << I40E_VPINT_LNKLST0_FIRSTQ_INDX_SHIFT; + for (i = 0; i < num_vfs; i++) + wr32(hw, I40E_VPINT_LNKLST0(i), val); + for (i = 0; i < num_vf_int - 2; i++) + wr32(hw, I40E_VPINT_LNKLSTN(i), val); + + /* warn the HW of the coming Tx disables */ + for (i = 0; i < num_queues; i++) { + u32 abs_queue_idx = base_queue + i; + u32 reg_block = 0; + + if (abs_queue_idx >= 128) { + reg_block = abs_queue_idx / 128; + abs_queue_idx %= 128; + } + + val = rd32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block)); + val &= ~I40E_GLLAN_TXPRE_QDIS_QINDX_MASK; + val |= (abs_queue_idx << I40E_GLLAN_TXPRE_QDIS_QINDX_SHIFT); + val |= I40E_GLLAN_TXPRE_QDIS_SET_QDIS_MASK; + + wr32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block), val); + } + i40e_usec_delay(400); + + /* stop all the queues */ + for (i = 0; i < num_queues; i++) { + wr32(hw, I40E_QINT_TQCTL(i), 0); + wr32(hw, I40E_QTX_ENA(i), 0); + wr32(hw, I40E_QINT_RQCTL(i), 0); + wr32(hw, I40E_QRX_ENA(i), 0); + } + + /* short wait for all queue disables to settle */ + i40e_usec_delay(50); +} + +/** * i40e_clear_pxe_mode - clear pxe operations mode * @hw: pointer to the hw struct * @@ -886,16 +976,8 @@ enum i40e_status_code i40e_pf_reset(stru **/ void i40e_clear_pxe_mode(struct i40e_hw *hw) { -#if defined(FORTVILLE_A0_SUPPORT) || defined(I40E_FPGA_SUPPORT) - u32 reg; - - /* Clear single descriptor fetch/write-back mode */ - reg = rd32(hw, I40E_GLLAN_RCTL_0); - wr32(hw, I40E_GLLAN_RCTL_0, (reg & (~I40E_GLLAN_RCTL_0_PXE_MODE_MASK))); -#else if (i40e_check_asq_alive(hw)) i40e_aq_clear_pxe_mode(hw, NULL); -#endif } /** @@ -1120,7 +1202,7 @@ enum i40e_status_code i40e_set_fc(struct status = i40e_aq_get_phy_capabilities(hw, FALSE, false, &abilities, NULL); if (status) { - *aq_failures |= I40E_SET_FC_AQ_FAIL_GET1; + *aq_failures |= I40E_SET_FC_AQ_FAIL_GET; return status; } @@ -1145,31 +1227,19 @@ enum i40e_status_code i40e_set_fc(struct if (status) *aq_failures |= I40E_SET_FC_AQ_FAIL_SET; - - /* Get the abilities to set hw->fc.current_mode correctly */ - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, - &abilities, NULL); - if (status) { - /* Wait a little bit and try once more */ - i40e_msec_delay(1000); - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, - &abilities, NULL); - } - if (status) { - *aq_failures |= I40E_SET_FC_AQ_FAIL_GET2; - return status; - } } - /* Copy the what was returned from get capabilities into fc */ - if ((abilities.abilities & I40E_AQ_PHY_FLAG_PAUSE_TX) && - (abilities.abilities & I40E_AQ_PHY_FLAG_PAUSE_RX)) - hw->fc.current_mode = I40E_FC_FULL; - else if (abilities.abilities & I40E_AQ_PHY_FLAG_PAUSE_TX) - hw->fc.current_mode = I40E_FC_TX_PAUSE; - else if (abilities.abilities & I40E_AQ_PHY_FLAG_PAUSE_RX) - hw->fc.current_mode = I40E_FC_RX_PAUSE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 22:23:49 2014 Return-Path: Delivered-To: svn-src-all@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 B4B5B2F7; Mon, 28 Jul 2014 22:23: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 959822B9E; Mon, 28 Jul 2014 22:23:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SMNnp7045367; Mon, 28 Jul 2014 22:23:49 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SMNnEb045366; Mon, 28 Jul 2014 22:23:49 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201407282223.s6SMNnEb045366@svn.freebsd.org> From: Jack F Vogel Date: Mon, 28 Jul 2014 22:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269201 - head/sys/dev/i40e X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 22:23:49 -0000 Author: jfv Date: Mon Jul 28 22:23:49 2014 New Revision: 269201 URL: http://svnweb.freebsd.org/changeset/base/269201 Log: Add new README to the driver... Added: head/sys/dev/i40e/README (contents, props changed) Added: head/sys/dev/i40e/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/i40e/README Mon Jul 28 22:23:49 2014 (r269201) @@ -0,0 +1,342 @@ +FreeBSD Base Driver for the Intel® XL710 Ethernet Controller Family +================================================================ + +/*$FreeBSD$*/ + +July 21, 2014 + + +Contents +======== + +- Overview +- Supported Adapters +- Building and Installation +- Additional Configurations +- Known Limitations + + +Overview +======== + +This file describes the i40e FreeBSD* Base driver for the XL710 Ethernet Family of Adapters. The Driver has been developed for use with FreeBSD 10.0 or later, but should be compatible with any supported release. + +For questions related to hardware requirements, refer to the documentation supplied with your Intel XL710 adapter. All hardware requirements listed apply for use with FreeBSD. + + +Supported Adapters +================== + +The driver in this release is compatible with XL710 and X710-based Intel Ethernet Network Connections. + + +SFP+ Devices with Pluggable Optics +---------------------------------- + +SR Modules +---------- + Intel DUAL RATE 1G/10G SFP+ SR (bailed) FTLX8571D3BCV-IT + Intel DUAL RATE 1G/10G SFP+ SR (bailed) AFBR-703SDZ-IN2 + +LR Modules +---------- + Intel DUAL RATE 1G/10G SFP+ LR (bailed) FTLX1471D3BCV-IT + Intel DUAL RATE 1G/10G SFP+ LR (bailed) AFCT-701SDZ-IN2 + +QSFP+ Modules +------------- + Intel TRIPLE RATE 1G/10G/40G QSFP+ SR (bailed) E40GQSFPSR + Intel TRIPLE RATE 1G/10G/40G QSFP+ LR (bailed) E40GQSFPLR + QSFP+ 1G speed is not supported on XL710 based devices. + +X710/XL710 Based SFP+ adapters support all passive and active limiting direct attach cables that comply with SFF-8431 v4.1 and SFF-8472 v10.4 specifications. + + +Building and Installation +========================= + +NOTE: You must have kernel sources installed to compile the driver module. + +In the instructions below, x.x.x is the driver version +as indicated in thename of the driver tar. + +1. Move the base driver tar file to the directory of your choice. For example, use /home/username/i40e or /usr/local/src/i40e. + +2. Untar/unzip the archive: + tar xfz i40e-x.x.x.tar.gz + +3. To install man page: + cd i40e-x.x.x + gzip -c i40e.4 > /usr/share/man/man4/i40e.4.gz + +4. To load the driver onto a running system: + cd i40e-x.x.x/src + make load + +5. To assign an IP address to the interface, enter the following: + ifconfig ixl + +6. Verify that the interface works. Enter the following, where is the IP address for another machine on the same subnet as the interface that is being tested: + + ping + +7. If you want the driver to load automatically when the system is booted: + + cd i40e-x.x.x/src + make + make install + + Edit /boot/loader.conf, and add the following line: + if_i40e_load="YES" + + Edit /etc/rc.conf, and create the appropriate + ifconfig_ixl entry: + + ifconfig_ixl="" + + Example usage: + + ifconfig_ixl0="inet 192.168.10.1 netmask 255.255.255.0" + + NOTE: For assistance, see the ifconfig man page. + + + +Configuration and Tuning +========================= + +The driver supports Transmit/Receive Checksum Offload for IPv4 and IPv6, +TSO forIPv4 and IPv6, LRO, and Jumbo Frames on all 40 Gigabit adapters. + + Jumbo Frames + ------------ + To enable Jumbo Frames, use the ifconfig utility to increase + the MTU beyond 1500 bytes. + + - The Jumbo Frames setting on the switch must be set to at least + 22 byteslarger than that of the adapter. + + - The maximum MTU setting for Jumbo Frames is 9706. This value + coincides with the maximum jumbo frames size of 9728. + To modify the setting, enter the following: + + ifconfig ixl mtu 9000 + + - To confirm an interface's MTU value, use the ifconfig command. + To confirm the MTU used between two specific devices, use: + + route get + + VLANs + ----- + To create a new VLAN pseudo-interface: + + ifconfig create + + To associate the VLAN pseudo-interface with a physical interface + and assign a VLAN ID, IP address, and netmask: + + ifconfig netmask vlan + vlandev + + Example: + + ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev ixl0 + + In this example, all packets will be marked on egress with + 802.1Q VLAN tags, specifying a VLAN ID of 10. + + To remove a VLAN pseudo-interface: + + ifconfig destroy + + + Checksum Offload + ---------------- + + Checksum offloading supports IPv4 and IPv6 with TCP and UDP packets + and is supported for both transmit and receive. Checksum offloading + for transmit and recieve is enabled by default for both IPv4 and IPv6. + + Checksum offloading can be enabled or disabled using ifconfig. + Transmit and receive offloading for IPv4 and Ipv6 are enabled + and disabled seperately. + + NOTE: TSO requires Tx checksum, so when Tx checksum + is disabled, TSO will also be disabled. + + To enable Tx checksum offloading for ipv4: + + ifconfig ixl txcsum4 + + To disable Tx checksum offloading for ipv4: + + ifconfig ixl -txcsum4 + (NOTE: This will disable TSO4) + + To enable Rx checksum offloading for ipv6: + + ifconfig ixl rxcsum6 + + To disable Rx checksum offloading for ipv6: + + ifconfig ixl -rxcsum6 + (NOTE: This will disable TSO6) + + + To confirm the current settings: + + ifconfig ixl + + + TSO + --- + + TSO supports both IPv4 and IPv6 and is enabled by default. TSO can + be disabled and enabled using the ifconfig utility. + + NOTE: TSO requires Tx checksum, so when Tx checksum is + disabled, TSO will also be disabled. + + To disable TSO IPv4: + + ifconfig ixl -tso4 + + To enable TSO IPv4: + + ifconfig ixl tso4 + + To disable TSO IPv6: + + ifconfig ixl -tso6 + + To enable TSO IPv6: + + ifconfig ixl tso6 + + To disable BOTH TSO IPv4 and IPv6: + + ifconfig ixl -tso + + To enable BOTH TSO IPv4 and IPv6: + + ifconfig ixl tso + + + LRO + --- + + Large Receive Offload is enabled by default. It can be enabled + or disabled by using the ifconfig utility. + + NOTE: LRO should be disabled when forwarding packets. + + To disable LRO: + + ifconfig ixl -lro + + To enable LRO: + + ifconfig ixl lro + + +Flow Control +------------ +Flow control is disabled by default. To change flow control settings use sysctl. + +To enable flow control to Rx pause frames: + + sysctl dev.ixl..fc=1 + +To enable flow control to Tx pause frames: + + sysctl dev.ixl..fc=2 + +To enable flow control to Rx and Tx pause frames: + + sysctl dev.ixl..fc=3 + +To disable flow control: + + sysctl dev.ixl..fc=0 + + +NOTE: You must have a flow control capable link partner. + + + + Important system configuration changes: + ======================================= + + +-Change the file /etc/sysctl.conf, and add the line: + + hw.intr_storm_threshold: 0 (the default is 1000) + +-Best throughput results are seen with a large MTU; use 9706 if possible. + +-The default number of descriptors per ring is 1024, increasing this may improve performance depending on the use case. + + +Known Limitations +================= + +Network Memory Buffer allocation +-------------------------------- + FreeBSD may have a low number of network memory buffers (mbufs) by default. Ifyour mbuf value is too low, it may cause the driver to fail to initialize and/orcause the system to become unresponsive. You can check to see if the system is mbuf-starved by running 'netstat -m'. Increase the number of mbufs by editing the lines below in /etc/sysctl.conf: + + kern.ipc.nmbclusters + kern.ipc.nmbjumbop + kern.ipc.nmbjumbo9 + kern.ipc.nmbjumbo16 + kern.ipc.nmbufs + +The amount of memory that you allocate is system specific, and may require some trial and error. + +Also, increasing the follwing in /etc/sysctl.conf could help increase network performance: + + kern.ipc.maxsockbuf + net.inet.tcp.sendspace + net.inet.tcp.recvspace + net.inet.udp.maxdgram + net.inet.udp.recvspace + + +UDP Stress Test Dropped Packet Issue +------------------------------------ + Under small packet UDP stress test with the i40e driver, the FreeBSD system will drop UDP packets due to the fullness of socket buffers. You may want to change the driver's Flow Control variables to the minimum value for controlling packet reception. + + +Disable LRO when routing/bridging +--------------------------------- +LRO must be turned off when forwarding traffic. + + +Lower than expected performance +------------------------------- + Some PCIe x8 slots are actually configured as x4 slots. These slots have insufficient bandwidth for full line rate with dual port and quad port devices. In addition, if you put a PCIe Generation 3-capable adapter into a PCIe Generation 2 slot, you cannot get full bandwidth. The driver detects this situation and writes the following message in the system log: + + "PCI-Express bandwidth available for this card is not sufficient for optimal performance. For optimal performance a x8 PCI-Express slot is required." + +If this error occurs, moving your adapter to a true PCIe Generation 3 x8 slot will resolve the issue. + + +Support +======= + +For general information and support, go to the Intel support website at: + + http://support.intel.com + +If an issue is identified with the released source code on the supported kernel with a supported adapter, email the specific information related to the issue tofreebsdnic@mailbox.intel.com. + + +License +======= + +This software program is released under the terms of a license agreement betweenyou ('Licensee') and Intel. Do not use or load this software or any associated materials (collectively, the 'Software') until you have carefully read the full terms and conditions of the LICENSE located in this software package. By loadingor using the Software, you agree to the terms of this Agreement. If you do not +agree with the terms of this Agreement, do not install or use the Software. + +* Other names and brands may be claimed as the property of others. + + From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 22:25:27 2014 Return-Path: Delivered-To: svn-src-all@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 C8A5F459; Mon, 28 Jul 2014 22:25: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5CD42BAD; Mon, 28 Jul 2014 22:25:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SMPRHs045672; Mon, 28 Jul 2014 22:25:27 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SMPRHY045671; Mon, 28 Jul 2014 22:25:27 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201407282225.s6SMPRHY045671@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 28 Jul 2014 22:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269202 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 22:25:27 -0000 Author: trasz Date: Mon Jul 28 22:25:27 2014 New Revision: 269202 URL: http://svnweb.freebsd.org/changeset/base/269202 Log: MFC r269088: Fix ctl(4) kldload failure that manifested like this: link_elf_obj: symbol icl_pdu_new_bhs undefined PR: 192031 Submitted by: Nils Beyer (earlier version) Sponsored by: FreeBSD Foundation Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jul 28 22:23:49 2014 (r269201) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jul 28 22:25:27 2014 (r269202) @@ -183,6 +183,7 @@ static struct ctl_frontend cfiscsi_front .ioctl = cfiscsi_ioctl, }; CTL_FRONTEND_DECLARE(ctlcfiscsi, cfiscsi_frontend); +MODULE_DEPEND(ctlcfiscsi, icl, 1, 1, 1); static struct icl_pdu * cfiscsi_pdu_new_response(struct icl_pdu *request, int flags) From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 23:36:21 2014 Return-Path: Delivered-To: svn-src-all@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 A5319D96; Mon, 28 Jul 2014 23:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9321D24E8; Mon, 28 Jul 2014 23:36:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SNaLSi083934; Mon, 28 Jul 2014 23:36:21 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SNaLRA083933; Mon, 28 Jul 2014 23:36:21 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201407282336.s6SNaLRA083933@svn.freebsd.org> From: "Simon J. Gerraty" Date: Mon, 28 Jul 2014 23:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269203 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 23:36:21 -0000 Author: sjg Date: Mon Jul 28 23:36:21 2014 New Revision: 269203 URL: http://svnweb.freebsd.org/changeset/base/269203 Log: We do not ever want _srcconf_included_ as MAIN target. Modified: head/share/mk/src.sys.mk Modified: head/share/mk/src.sys.mk ============================================================================== --- head/share/mk/src.sys.mk Mon Jul 28 22:25:27 2014 (r269202) +++ head/share/mk/src.sys.mk Mon Jul 28 23:36:21 2014 (r269203) @@ -9,5 +9,5 @@ SRCCONF?= /etc/src.conf .if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_) .include "${SRCCONF}" -_srcconf_included_: +_srcconf_included_: .NOTMAIN .endif From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 00:16:34 2014 Return-Path: Delivered-To: svn-src-all@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 1BF674FF; Tue, 29 Jul 2014 00:16:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09C7D283C; Tue, 29 Jul 2014 00:16:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T0GXMF003709; Tue, 29 Jul 2014 00:16:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T0GXLM003700; Tue, 29 Jul 2014 00:16:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407290016.s6T0GXLM003700@svn.freebsd.org> From: John Baldwin Date: Tue, 29 Jul 2014 00:16:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269204 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 00:16:34 -0000 Author: jhb Date: Tue Jul 29 00:16:33 2014 New Revision: 269204 URL: http://svnweb.freebsd.org/changeset/base/269204 Log: If telldir() is called immediately after a call to seekdir(), POSIX requires the return value of telldir() to equal the value passed to seekdir(). The current seekdir code with SINGLEUSE enabled breaks this case as each call to telldir() allocates a new cookie. Instead, remove the SINGLEUSE code and change telldir() to look for an existing cookie for the directory's current location rather than always creating a new cookie. CR: https://phabric.freebsd.org/D490 PR: 121656 Reviewed by: jilles MFC after: 1 week Modified: head/lib/libc/gen/directory.3 head/lib/libc/gen/telldir.c Modified: head/lib/libc/gen/directory.3 ============================================================================== --- head/lib/libc/gen/directory.3 Mon Jul 28 23:36:21 2014 (r269203) +++ head/lib/libc/gen/directory.3 Tue Jul 29 00:16:33 2014 (r269204) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 18, 2013 +.Dd July 28, 2014 .Dt DIRECTORY 3 .Os .Sh NAME @@ -169,6 +169,10 @@ If the directory is closed and then reopened, prior values returned by .Fn telldir will no longer be valid. +Values returned by +.Fn telldir +are also invalidated by a call to +.Fn rewinddir . .Pp The .Fn seekdir @@ -182,13 +186,6 @@ The new position reverts to the one asso when the .Fn telldir operation was performed. -State associated with the token returned by -.Fn telldir is freed when it is passed to -.Fn seekdir . -If you wish return to the same location again, -then you must create a new token with another -.Fn telldir -call. .Pp The .Fn rewinddir Modified: head/lib/libc/gen/telldir.c ============================================================================== --- head/lib/libc/gen/telldir.c Mon Jul 28 23:36:21 2014 (r269203) +++ head/lib/libc/gen/telldir.c Tue Jul 29 00:16:33 2014 (r269204) @@ -47,13 +47,6 @@ __FBSDID("$FreeBSD$"); #include "telldir.h" /* - * The option SINGLEUSE may be defined to say that a telldir - * cookie may be used only once before it is freed. This option - * is used to avoid having memory usage grow without bound. - */ -#define SINGLEUSE - -/* * return a pointer into a directory */ long @@ -61,18 +54,31 @@ telldir(dirp) DIR *dirp; { struct ddloc *lp; + long idx; - if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) - return (-1); if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); - lp->loc_index = dirp->dd_td->td_loccnt++; - lp->loc_seek = dirp->dd_seek; - lp->loc_loc = dirp->dd_loc; - LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { + if (lp->loc_seek == dirp->dd_seek && + lp->loc_loc == dirp->dd_loc) + break; + } + if (lp == NULL) { + lp = malloc(sizeof(struct ddloc)); + if (lp == NULL) { + if (__isthreaded) + _pthread_mutex_unlock(&dirp->dd_lock); + return (-1); + } + lp->loc_index = dirp->dd_td->td_loccnt++; + lp->loc_seek = dirp->dd_seek; + lp->loc_loc = dirp->dd_loc; + LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + } + idx = lp->loc_index; if (__isthreaded) _pthread_mutex_unlock(&dirp->dd_lock); - return (lp->loc_index); + return (idx); } /* @@ -94,7 +100,7 @@ _seekdir(dirp, loc) if (lp == NULL) return; if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) - goto found; + return; (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET); dirp->dd_seek = lp->loc_seek; dirp->dd_loc = 0; @@ -103,11 +109,6 @@ _seekdir(dirp, loc) if (dp == NULL) break; } -found: -#ifdef SINGLEUSE - LIST_REMOVE(lp, loc_lqe); - free((caddr_t)lp); -#endif } /* From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 01:46:32 2014 Return-Path: Delivered-To: svn-src-all@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 488CE7BA; Tue, 29 Jul 2014 01:46: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 369B72133; Tue, 29 Jul 2014 01:46:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T1kWEM046370; Tue, 29 Jul 2014 01:46:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T1kWAl046369; Tue, 29 Jul 2014 01:46:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407290146.s6T1kWAl046369@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Jul 2014 01:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269205 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 01:46:32 -0000 Author: kib Date: Tue Jul 29 01:46:31 2014 New Revision: 269205 URL: http://svnweb.freebsd.org/changeset/base/269205 Log: Simplify the expression, by removing redundand calculation. Noted by: "O'Connor, Daniel" MFC after: 3 days Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Jul 29 00:16:33 2014 (r269204) +++ head/sys/kern/kern_proc.c Tue Jul 29 01:46:31 2014 (r269205) @@ -2147,7 +2147,7 @@ kern_proc_vmmap_resident(vm_map_t map, v obj = entry->object.vm_object; addr = entry->start; m_adv = NULL; - pi = OFF_TO_IDX(entry->offset + addr - entry->start); + pi = OFF_TO_IDX(entry->offset); for (; addr < entry->end; addr += IDX_TO_OFF(pi_adv), pi += pi_adv) { if (m_adv != NULL) { m = m_adv; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:31:30 2014 Return-Path: Delivered-To: svn-src-all@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 2E503E98; Tue, 29 Jul 2014 02:31:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BFD025F1; Tue, 29 Jul 2014 02:31:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2VTJU071605; Tue, 29 Jul 2014 02:31:29 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2VTSp071604; Tue, 29 Jul 2014 02:31:29 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290231.s6T2VTSp071604@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:31:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269206 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:31:30 -0000 Author: ian Date: Tue Jul 29 02:31:29 2014 New Revision: 269206 URL: http://svnweb.freebsd.org/changeset/base/269206 Log: Rename _bus_dma_can_bounce(), add new inline routines. DMA on arm can bounce for several reasons, and _bus_dma_can_bounce() only checks for the lowaddr/highaddr exclusion ranges in the dma tag, so now it's named exclusion_bounce(). The other reasons for bouncing are checked by the new functions alignment_bounce() and cacheline_bounce(). Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 01:46:31 2014 (r269205) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:31:29 2014 (r269206) @@ -241,8 +241,8 @@ SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_FO * possibly have RAM at an address higher than the highest address we can * express, so we take a fast out. */ -static __inline int -_bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) +static int +exclusion_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) { int i; @@ -258,6 +258,26 @@ _bus_dma_can_bounce(vm_offset_t lowaddr, return (0); } +/* + * Return true if the given address does not fall on the alignment boundary. + */ +static __inline int +alignment_bounce(bus_dma_tag_t dmat, bus_addr_t addr) +{ + + return (addr & (dmat->alignment - 1)); +} + +/* + * Return true if the buffer start or end does not fall on a cacheline boundary. + */ +static __inline int +cacheline_bounce(bus_addr_t addr, bus_size_t size) +{ + + return ((addr | size) & arm_dcache_align_mask); +} + static __inline struct arm32_dma_range * _bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, bus_addr_t curaddr) @@ -291,9 +311,8 @@ run_filter(bus_dma_tag_t dmat, bus_addr_ do { if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) - || ((paddr & (dmat->alignment - 1)) != 0) || - (!coherent && (size & arm_dcache_align_mask)) || - (!coherent && (paddr & arm_dcache_align_mask))) + || alignment_bounce(dmat, paddr) || + (!coherent && cacheline_bounce(paddr, size))) && (dmat->filter == NULL || (*dmat->filter)(dmat->filterarg, paddr) != 0)) retval = 1; @@ -438,8 +457,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, atomic_add_int(&parent->ref_count, 1); } - if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) - || newtag->alignment > 1) + if (exclusion_bounce(newtag->lowaddr, newtag->highaddr) + || alignment_bounce(newtag, 1)) newtag->flags |= BUS_DMA_COULD_BOUNCE; /* @@ -718,7 +737,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * constraints is something that only the contig allocator can fulfill. */ if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { + !exclusion_bounce(dmat->lowaddr, dmat->highaddr)) { *vaddr = uma_zalloc(bufzone->umazone, mflags); } else if (dmat->nsegments >= btoc(dmat->maxsize) && dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { @@ -765,7 +784,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) + !exclusion_bounce(dmat->lowaddr, dmat->highaddr)) uma_zfree(bufzone->umazone, vaddr); else kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->maxsize); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:34:32 2014 Return-Path: Delivered-To: svn-src-all@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 BF32EFF6; Tue, 29 Jul 2014 02:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACE1C2601; Tue, 29 Jul 2014 02:34:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2YWFf073799; Tue, 29 Jul 2014 02:34:32 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2YWFo073798; Tue, 29 Jul 2014 02:34:32 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290234.s6T2YWFo073798@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269207 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:34:32 -0000 Author: ian Date: Tue Jul 29 02:34:32 2014 New Revision: 269207 URL: http://svnweb.freebsd.org/changeset/base/269207 Log: The exclusion_bounce() routine compares unchanging values in the tag with unchanging values in the phys_avail array, so do the comparisons just once at tag creation time and set a flag to remember the result. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:31:29 2014 (r269206) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:34:32 2014 (r269207) @@ -64,7 +64,9 @@ __FBSDID("$FreeBSD$"); #include #define MAX_BPAGES 64 -#define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 +#define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 +#define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 +#define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) #define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 struct bounce_zone; @@ -242,7 +244,7 @@ SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_FO * express, so we take a fast out. */ static int -exclusion_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) +exclusion_bounce_check(vm_offset_t lowaddr, vm_offset_t highaddr) { int i; @@ -259,6 +261,16 @@ exclusion_bounce(vm_offset_t lowaddr, vm } /* + * Return true if the tag has an exclusion zone that could lead to bouncing. + */ +static __inline int +exclusion_bounce(bus_dma_tag_t dmat) +{ + + return (dmat->flags & BUS_DMA_EXCL_BOUNCE); +} + +/* * Return true if the given address does not fall on the alignment boundary. */ static __inline int @@ -436,17 +448,15 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (parent != NULL) { newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); + newtag->flags |= parent->flags & BUS_DMA_COULD_BOUNCE; if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) newtag->boundary = MIN(parent->boundary, newtag->boundary); - if ((newtag->filter != NULL) || - ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) - newtag->flags |= BUS_DMA_COULD_BOUNCE; if (newtag->filter == NULL) { /* - * Short circuit looking at our parent directly + * Short circuit to looking at our parent directly * since we have encapsulated all of its information */ newtag->filter = parent->filter; @@ -457,9 +467,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, atomic_add_int(&parent->ref_count, 1); } - if (exclusion_bounce(newtag->lowaddr, newtag->highaddr) - || alignment_bounce(newtag, 1)) - newtag->flags |= BUS_DMA_COULD_BOUNCE; + if (exclusion_bounce_check(newtag->lowaddr, newtag->highaddr)) + newtag->flags |= BUS_DMA_EXCL_BOUNCE; + if (alignment_bounce(newtag, 1)) + newtag->flags |= BUS_DMA_ALIGN_BOUNCE; /* * Any request can auto-bounce due to cacheline alignment, in addition @@ -737,7 +748,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * constraints is something that only the contig allocator can fulfill. */ if (bufzone != NULL && dmat->alignment <= bufzone->size && - !exclusion_bounce(dmat->lowaddr, dmat->highaddr)) { + !exclusion_bounce(dmat)) { *vaddr = uma_zalloc(bufzone->umazone, mflags); } else if (dmat->nsegments >= btoc(dmat->maxsize) && dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { @@ -784,7 +795,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); if (bufzone != NULL && dmat->alignment <= bufzone->size && - !exclusion_bounce(dmat->lowaddr, dmat->highaddr)) + !exclusion_bounce(dmat)) uma_zfree(bufzone->umazone, vaddr); else kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->maxsize); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:35:44 2014 Return-Path: Delivered-To: svn-src-all@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 BE7FA1C2; Tue, 29 Jul 2014 02:35: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC4BE2605; Tue, 29 Jul 2014 02:35:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2Zi66074011; Tue, 29 Jul 2014 02:35:44 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2ZiO9074010; Tue, 29 Jul 2014 02:35:44 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290235.s6T2ZiO9074010@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269208 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:35:44 -0000 Author: ian Date: Tue Jul 29 02:35:44 2014 New Revision: 269208 URL: http://svnweb.freebsd.org/changeset/base/269208 Log: Correct the comparison logic when looking for intersections between exclusion zones and phsyical memory. The phys_avail[i] entries are the address of the first byte of ram in the region, and phys_avail[i+1] entries are the address of the first byte of ram in the next region (i.e., they're not included in the region that starts at phys_avail[i]). Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:34:32 2014 (r269207) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:35:44 2014 (r269208) @@ -252,9 +252,9 @@ exclusion_bounce_check(vm_offset_t lowad return (0); for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { - if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1]) + if ((lowaddr >= phys_avail[i] && lowaddr < phys_avail[i + 1]) || (lowaddr < phys_avail[i] && - highaddr > phys_avail[i])) + highaddr >= phys_avail[i])) return (1); } return (0); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:36:03 2014 Return-Path: Delivered-To: svn-src-all@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 1F0862FC; Tue, 29 Jul 2014 02:36:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 000D52608; Tue, 29 Jul 2014 02:36:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2a2JN074109; Tue, 29 Jul 2014 02:36:02 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2a2EM074108; Tue, 29 Jul 2014 02:36:02 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290236.s6T2a2EM074108@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269209 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:36:03 -0000 Author: ian Date: Tue Jul 29 02:36:02 2014 New Revision: 269209 URL: http://svnweb.freebsd.org/changeset/base/269209 Log: Reformat some continuation lines. No functional changes. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:35:44 2014 (r269208) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:02 2014 (r269209) @@ -252,9 +252,8 @@ exclusion_bounce_check(vm_offset_t lowad return (0); for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { - if ((lowaddr >= phys_avail[i] && lowaddr < phys_avail[i + 1]) - || (lowaddr < phys_avail[i] && - highaddr >= phys_avail[i])) + if ((lowaddr >= phys_avail[i] && lowaddr < phys_avail[i + 1]) || + (lowaddr < phys_avail[i] && highaddr >= phys_avail[i])) return (1); } return (0); @@ -322,13 +321,12 @@ run_filter(bus_dma_tag_t dmat, bus_addr_ retval = 0; do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) - || alignment_bounce(dmat, paddr) || - (!coherent && cacheline_bounce(paddr, size))) - && (dmat->filter == NULL - || (*dmat->filter)(dmat->filterarg, paddr) != 0)) + if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) || + alignment_bounce(dmat, paddr) || + (!coherent && cacheline_bounce(paddr, size))) && + (dmat->filter == NULL || + dmat->filter(dmat->filterarg, paddr) != 0)) retval = 1; - dmat = dmat->parent; } while (retval == 0 && dmat != NULL); return (retval); @@ -580,8 +578,8 @@ static int allocate_bz_and_pages(bus_dma maxpages = MAX_BPAGES; else maxpages = 2 * bz->map_count; - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (bz->map_count > 0 && bz->total_bpages < maxpages)) { + if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || + (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; @@ -1248,12 +1246,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus while (bpage != NULL) { if (bpage->datavaddr != 0) bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); else physcopyout(bpage->dataaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); cpu_dcache_wb_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_wb_range((vm_offset_t)bpage->vaddr, @@ -1295,12 +1293,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus l2cache_inv_range(startv, startp, len); if (bpage->datavaddr != 0) bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); + (void *)bpage->datavaddr, + bpage->datacount); else physcopyin((void *)bpage->vaddr, - bpage->dataaddr, - bpage->datacount); + bpage->dataaddr, + bpage->datacount); bpage = STAILQ_NEXT(bpage, links); } dmat->bounce_zone->total_bounced++; @@ -1389,8 +1387,8 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { - if ((dmat->alignment <= bz->alignment) - && (dmat->lowaddr >= bz->lowaddr)) { + if ((dmat->alignment <= bz->alignment) && + (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); } @@ -1468,15 +1466,12 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u struct bounce_page *bpage; bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); + M_NOWAIT | M_ZERO); if (bpage == NULL) break; bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, - bz->lowaddr, - PAGE_SIZE, - 0); + M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; @@ -1582,7 +1577,7 @@ free_bounce_page(bus_dma_tag_t dmat, str if (reserve_bounce_pages(map->dmat, map, 1) == 0) { STAILQ_REMOVE_HEAD(&bounce_map_waitinglist, links); STAILQ_INSERT_TAIL(&bounce_map_callbacklist, - map, links); + map, links); busdma_swi_pending = 1; bz->total_deferred++; swi_sched(vm_ih, 0); @@ -1602,10 +1597,10 @@ busdma_swi(void) STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links); mtx_unlock(&bounce_lock); dmat = map->dmat; - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_LOCK); bus_dmamap_load_mem(map->dmat, map, &map->mem, map->callback, - map->callback_arg, BUS_DMA_WAITOK); - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK); + map->callback_arg, BUS_DMA_WAITOK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_UNLOCK); mtx_lock(&bounce_lock); } mtx_unlock(&bounce_lock); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:36:10 2014 Return-Path: Delivered-To: svn-src-all@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 89B6B43E; Tue, 29 Jul 2014 02:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7503F260D; Tue, 29 Jul 2014 02:36:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2aA3T074169; Tue, 29 Jul 2014 02:36:10 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2aAoH074168; Tue, 29 Jul 2014 02:36:10 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290236.s6T2aAoH074168@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269210 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:36:10 -0000 Author: ian Date: Tue Jul 29 02:36:09 2014 New Revision: 269210 URL: http://svnweb.freebsd.org/changeset/base/269210 Log: Propagate any alignment restriction from the parent tag to a new tag, keeping the more restrictive of the two values. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:02 2014 (r269209) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:09 2014 (r269210) @@ -446,6 +446,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (parent != NULL) { newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); + newtag->alignment = MAX(parent->alignment, newtag->alignment); newtag->flags |= parent->flags & BUS_DMA_COULD_BOUNCE; if (newtag->boundary == 0) newtag->boundary = parent->boundary; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:36:28 2014 Return-Path: Delivered-To: svn-src-all@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 6F78B57D; Tue, 29 Jul 2014 02:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 506292617; Tue, 29 Jul 2014 02:36:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2aScL074257; Tue, 29 Jul 2014 02:36:28 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2aSnm074256; Tue, 29 Jul 2014 02:36:28 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290236.s6T2aSnm074256@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269211 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:36:28 -0000 Author: ian Date: Tue Jul 29 02:36:27 2014 New Revision: 269211 URL: http://svnweb.freebsd.org/changeset/base/269211 Log: The run_filter() function doesn't just run dma tag exclusion filter functions, it has evolved to make a variety of decisions about whether the DMA needs to bounce, so rename it to must_bounce(). Rewrite it to perform checks outside of the ancestor loop if they're based on information that's wholly contained within the original tag. Now the loop only checks exclusion zones in ancestor tags. Also, add a new function, might_bounce() which does a fast inline check of flags within the tag and map to quickly eliminate the need to call the more expensive must_bounce() for each page in the DMA operation. Within the mapping loops, use map->pagesneeded != 0 as a proxy for all the various checks on whether bouncing might be required. If no pages were reserved for bouncing during the checks before the mapping loop, then there's no need to re-check any of the conditions that can lead to bouncing -- all those checks already decided there would be no bouncing. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:09 2014 (r269210) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:27 2014 (r269211) @@ -179,7 +179,6 @@ static bus_addr_t add_bounce_page(bus_dm vm_offset_t vaddr, bus_addr_t addr, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, int flags); static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, @@ -289,6 +288,69 @@ cacheline_bounce(bus_addr_t addr, bus_si return ((addr | size) & arm_dcache_align_mask); } +/* + * Return true if we might need to bounce the DMA described by addr and size. + * + * This is used to quick-check whether we need to do the more expensive work of + * checking the DMA page-by-page looking for alignment and exclusion bounces. + * + * Note that the addr argument might be either virtual or physical. It doesn't + * matter because we only look at the low-order bits, which are the same in both + * address spaces. + */ +static __inline int +might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, + bus_size_t size) +{ + return ((dmat->flags & BUS_DMA_COULD_BOUNCE) || + !((map->flags & DMAMAP_COHERENT) && cacheline_bounce(addr, size))); +} + +/* + * Return true if we must bounce the DMA described by paddr and size. + * + * Bouncing can be triggered by DMA that doesn't begin and end on cacheline + * boundaries, or doesn't begin on an alignment boundary, or falls within the + * exclusion zone of any tag in the ancestry chain. + * + * For exclusions, walk the chain of tags comparing paddr to the exclusion zone + * within each tag. If the tag has a filter function, use it to decide whether + * the DMA needs to bounce, otherwise any DMA within the zone bounces. + */ +static int +must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, + bus_size_t size) +{ + + /* Coherent memory doesn't need to bounce due to cache alignment. */ + if (!(map->flags & DMAMAP_COHERENT) && cacheline_bounce(paddr, size)) + return (1); + + /* + * The tag already contains ancestors' alignment restrictions so this + * check doesn't need to be inside the loop. + */ + if (alignment_bounce(dmat, paddr)) + return (1); + + /* + * Even though each tag has an exclusion zone that is a superset of its + * own and all its ancestors' exclusions, the exclusion zone of each tag + * up the chain must be checked within the loop, because the busdma + * rules say the filter function is called only when the address lies + * within the low-highaddr range of the tag that filterfunc belongs to. + */ + while (dmat != NULL && exclusion_bounce(dmat)) { + if ((paddr >= dmat->lowaddr && paddr <= dmat->highaddr) && + (dmat->filter == NULL || + dmat->filter(dmat->filterarg, paddr) != 0)) + return (1); + dmat = dmat->parent; + } + + return (0); +} + static __inline struct arm32_dma_range * _bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, bus_addr_t curaddr) @@ -306,33 +368,6 @@ _bus_dma_inrange(struct arm32_dma_range } /* - * Return true if a match is made. - * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. - * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. - */ -int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent) -{ - int retval; - - retval = 0; - - do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) || - alignment_bounce(dmat, paddr) || - (!coherent && cacheline_bounce(paddr, size))) && - (dmat->filter == NULL || - dmat->filter(dmat->filterarg, paddr) != 0)) - retval = 1; - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); -} - -/* * Convenience function for manipulating driver locks from busdma (during * busdma_swi, for example). Drivers that don't provide their own locks * should specify &Giant to dmat->lockfuncarg. Drivers that use their own @@ -823,8 +858,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma curaddr = buf; while (buflen != 0) { sgsize = MIN(buflen, dmat->maxsegsz); - if (run_filter(dmat, curaddr, sgsize, - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, curaddr, sgsize) != 0) { sgsize = MIN(sgsize, PAGE_SIZE); map->pagesneeded++; } @@ -860,10 +894,9 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm paddr = pmap_kextract(vaddr); else paddr = pmap_extract(map->pmap, vaddr); - if (run_filter(dmat, paddr, - min(vendaddr - vaddr, - (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK))), - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, paddr, + min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr & + PAGE_MASK)))) != 0) { map->pagesneeded++; } vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); @@ -979,8 +1012,7 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat if (segs == NULL) segs = dmat->segments; - if (((map->flags & DMAMAP_COHERENT) == 0) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { error = _bus_dmamap_reserve_pages(dmat, map, flags); @@ -992,10 +1024,8 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat while (buflen > 0) { curaddr = buf; sgsize = MIN(buflen, dmat->maxsegsz); - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { sgsize = MIN(sgsize, PAGE_SIZE); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); @@ -1052,8 +1082,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm map->pmap = pmap; - if (!(map->flags & DMAMAP_COHERENT) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { error = _bus_dmamap_reserve_pages(dmat, map, flags); @@ -1083,10 +1112,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm if (buflen < sgsize) sgsize = buflen; - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { curaddr = add_bounce_page(dmat, map, vaddr, curaddr, sgsize); } else { From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:36:41 2014 Return-Path: Delivered-To: svn-src-all@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 D77396B7; Tue, 29 Jul 2014 02:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5347261A; Tue, 29 Jul 2014 02:36:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2afx3074325; Tue, 29 Jul 2014 02:36:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2af9G074324; Tue, 29 Jul 2014 02:36:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290236.s6T2af9G074324@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269212 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:36:42 -0000 Author: ian Date: Tue Jul 29 02:36:41 2014 New Revision: 269212 URL: http://svnweb.freebsd.org/changeset/base/269212 Log: Memory belonging to an mbuf, or allocated by bus_dmamem_alloc(), never triggers a need to bounce due to cacheline alignment. These buffers are always aligned to cacheline boundaries, and even when the DMA operation starts at an offset within the buffer or doesn't extend to the end of the buffer, it's safe to flush the complete cachelines that were only partially involved in the DMA. This is because there's a very strict rule on these types of buffers that there will not be concurrent access by the CPU and one or more DMA transfers within the buffer. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:27 2014 (r269211) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:41 2014 (r269212) @@ -162,6 +162,8 @@ struct bus_dmamap { void *callback_arg; int flags; #define DMAMAP_COHERENT (1 << 0) +#define DMAMAP_DMAMEM_ALLOC (1 << 1) +#define DMAMAP_MBUF (1 << 2) STAILQ_ENTRY(bus_dmamap) links; int sync_count; struct sync_list slist[]; @@ -279,12 +281,22 @@ alignment_bounce(bus_dma_tag_t dmat, bus } /* - * Return true if the buffer start or end does not fall on a cacheline boundary. + * Return true if the DMA should bounce because the start or end does not fall + * on a cacheline boundary (which would require a partial cacheline flush). + * COHERENT memory doesn't trigger cacheline flushes. Memory allocated by + * bus_dmamem_alloc() is always aligned to cacheline boundaries, and there's a + * strict rule that such memory cannot be accessed by the CPU while DMA is in + * progress (or by multiple DMA engines at once), so that it's always safe to do + * full cacheline flushes even if that affects memory outside the range of a + * given DMA operation that doesn't involve the full allocated buffer. If we're + * mapping an mbuf, that follows the same rules as a buffer we allocated. */ static __inline int -cacheline_bounce(bus_addr_t addr, bus_size_t size) +cacheline_bounce(bus_dmamap_t map, bus_addr_t addr, bus_size_t size) { + if (map->flags & (DMAMAP_DMAMEM_ALLOC | DMAMAP_COHERENT | DMAMAP_MBUF)) + return (0); return ((addr | size) & arm_dcache_align_mask); } @@ -302,8 +314,9 @@ static __inline int might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, bus_size_t size) { - return ((dmat->flags & BUS_DMA_COULD_BOUNCE) || - !((map->flags & DMAMAP_COHERENT) && cacheline_bounce(addr, size))); + return ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || + alignment_bounce(dmat, addr) || + cacheline_bounce(map, addr, size)); } /* @@ -322,8 +335,7 @@ must_bounce(bus_dma_tag_t dmat, bus_dmam bus_size_t size) { - /* Coherent memory doesn't need to bounce due to cache alignment. */ - if (!(map->flags & DMAMAP_COHERENT) && cacheline_bounce(paddr, size)) + if (cacheline_bounce(map, paddr, size)) return (1); /* @@ -727,7 +739,9 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi return (ENOMEM); } + (*mapp)->flags = DMAMAP_DMAMEM_ALLOC; (*mapp)->sync_count = 0; + /* We may need bounce pages, even for allocated memory */ error = allocate_bz_and_pages(dmat, *mapp); if (error != 0) { @@ -1080,6 +1094,9 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm if (segs == NULL) segs = dmat->segments; + if (flags & BUS_DMA_LOAD_MBUF) + map->flags |= DMAMAP_MBUF; + map->pmap = pmap; if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { @@ -1196,6 +1213,7 @@ _bus_dmamap_unload(bus_dma_tag_t dmat, b map->pagesneeded = 0; } map->sync_count = 0; + map->flags &= ~DMAMAP_MBUF; } #ifdef notyetbounceuser From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:36:50 2014 Return-Path: Delivered-To: svn-src-all@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 C5DCC7F1; Tue, 29 Jul 2014 02:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B409B261C; Tue, 29 Jul 2014 02:36:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2ao5f074387; Tue, 29 Jul 2014 02:36:50 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2aove074386; Tue, 29 Jul 2014 02:36:50 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290236.s6T2aove074386@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269213 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:36:50 -0000 Author: ian Date: Tue Jul 29 02:36:50 2014 New Revision: 269213 URL: http://svnweb.freebsd.org/changeset/base/269213 Log: Don't clear the DMAMAP_DMAMEM_ALLOC flag set a few lines earlier. Doh! Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:41 2014 (r269212) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:50 2014 (r269213) @@ -772,7 +772,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } else { memattr = VM_MEMATTR_DEFAULT; ba = standard_allocator; - (*mapp)->flags = 0; } /* From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:37:25 2014 Return-Path: Delivered-To: svn-src-all@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 349E1955; Tue, 29 Jul 2014 02:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 229582635; Tue, 29 Jul 2014 02:37:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2bPJe074519; Tue, 29 Jul 2014 02:37:25 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2bO15074518; Tue, 29 Jul 2014 02:37:24 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290237.s6T2bO15074518@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269214 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:37:25 -0000 Author: ian Date: Tue Jul 29 02:37:24 2014 New Revision: 269214 URL: http://svnweb.freebsd.org/changeset/base/269214 Log: Replace a bunch of double-indirection with a local pointer var (that is, (*mapp)->something becomes map->something). No functional changes. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:36:50 2014 (r269213) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:24 2014 (r269214) @@ -650,16 +650,17 @@ static int allocate_bz_and_pages(bus_dma int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { + bus_dmamap_t map; int mapsize; int error = 0; - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + mapsize = sizeof(*map) + (sizeof(struct sync_list) * dmat->nsegments); + *mapp = map = malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); + if (map == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); return (ENOMEM); } - (*mapp)->sync_count = 0; + map->sync_count = 0; if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( @@ -668,7 +669,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in if (dmat->segments == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (ENOMEM); } @@ -678,9 +679,9 @@ bus_dmamap_create(bus_dma_tag_t dmat, in * exclusion region, a data alignment that is stricter than 1, and/or * an active address boundary. */ - error = allocate_bz_and_pages(dmat, *mapp); + error = allocate_bz_and_pages(dmat, map); if (error != 0) { - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (error); } @@ -719,6 +720,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi { busdma_bufalloc_t ba; struct busdma_bufzone *bufzone; + bus_dmamap_t map; vm_memattr_t memattr; int mflags; int mapsize; @@ -731,21 +733,20 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi /* ARM non-snooping caches need a map for the VA cache sync structure */ - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + mapsize = sizeof(*map) + (sizeof(struct sync_list) * dmat->nsegments); + *mapp = map = malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); + if (map == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } - - (*mapp)->flags = DMAMAP_DMAMEM_ALLOC; - (*mapp)->sync_count = 0; + map->flags = DMAMAP_DMAMEM_ALLOC; + map->sync_count = 0; /* We may need bounce pages, even for allocated memory */ - error = allocate_bz_and_pages(dmat, *mapp); + error = allocate_bz_and_pages(dmat, map); if (error != 0) { - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (error); } @@ -757,7 +758,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (dmat->segments == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (ENOMEM); } @@ -768,7 +769,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (flags & BUS_DMA_COHERENT) { memattr = VM_MEMATTR_UNCACHEABLE; ba = coherent_allocator; - (*mapp)->flags |= DMAMAP_COHERENT; + map->flags |= DMAMAP_COHERENT; } else { memattr = VM_MEMATTR_DEFAULT; ba = standard_allocator; @@ -811,7 +812,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (ENOMEM); } From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:37:32 2014 Return-Path: Delivered-To: svn-src-all@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 7178DA8D; Tue, 29 Jul 2014 02:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 593C12637; Tue, 29 Jul 2014 02:37:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2bWJJ074581; Tue, 29 Jul 2014 02:37:32 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2bWs5074580; Tue, 29 Jul 2014 02:37:32 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290237.s6T2bWs5074580@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269215 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:37:32 -0000 Author: ian Date: Tue Jul 29 02:37:31 2014 New Revision: 269215 URL: http://svnweb.freebsd.org/changeset/base/269215 Log: We never need bounce pages for memory we allocate. We cleverly allocate memory the matches all the constraints of the dma tag so that bouncing will never be required. Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:24 2014 (r269214) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:31 2014 (r269215) @@ -743,14 +743,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi map->flags = DMAMAP_DMAMEM_ALLOC; map->sync_count = 0; - /* We may need bounce pages, even for allocated memory */ - error = allocate_bz_and_pages(dmat, map); - if (error != 0) { - free(map, M_DEVBUF); - *mapp = NULL; - return (error); - } - if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:37:49 2014 Return-Path: Delivered-To: svn-src-all@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 1976CBCC; Tue, 29 Jul 2014 02:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEF51263D; Tue, 29 Jul 2014 02:37:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2bmWX074656; Tue, 29 Jul 2014 02:37:48 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2bm5P074655; Tue, 29 Jul 2014 02:37:48 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290237.s6T2bm5P074655@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269216 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:37:49 -0000 Author: ian Date: Tue Jul 29 02:37:48 2014 New Revision: 269216 URL: http://svnweb.freebsd.org/changeset/base/269216 Log: A while back, the array of segments used for a load/mapping operation was moved from the stack into the tag structure. In retrospect that was a bad idea, because nothing protects that array from concurrent access by multiple threads. This change moves the array to the map structure (actually it's allocated following the structure, but all in a single malloc() call). This also establishes a "sane" limit of 4096 segments per map. This is mostly to prevent trying to allocate all of memory if someone accidentally uses a tag with nsegments set to BUS_SPACE_UNRESTRICTED. If there's ever a genuine need for more than 4096, don't hesitate to increase this (or maybe make it tunable). Reviewed by: cognet Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:31 2014 (r269215) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:48 2014 (r269216) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #define MAX_BPAGES 64 +#define MAX_DMA_SEGMENTS 4096 #define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 #define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 #define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) @@ -96,15 +97,6 @@ struct bus_dma_tag { */ struct arm32_dma_range *ranges; int _nranges; - /* - * Most tags need one or two segments, and can use the local tagsegs - * array. For tags with a larger limit, we'll allocate a bigger array - * on first use. - */ - bus_dma_segment_t *segments; - bus_dma_segment_t tagsegs[2]; - - }; struct bounce_page { @@ -165,6 +157,7 @@ struct bus_dmamap { #define DMAMAP_DMAMEM_ALLOC (1 << 1) #define DMAMAP_MBUF (1 << 2) STAILQ_ENTRY(bus_dmamap) links; + bus_dma_segment_t *segments; int sync_count; struct sync_list slist[]; }; @@ -476,18 +469,6 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - /* - * If all the segments we need fit into the local tagsegs array, set the - * pointer now. Otherwise NULL the pointer and an array of segments - * will be allocated later, on first use. We don't pre-allocate now - * because some tags exist just to pass contraints to children in the - * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we - * sure don't want to try to allocate an array for that. - */ - if (newtag->nsegments <= nitems(newtag->tagsegs)) - newtag->segments = newtag->tagsegs; - else - newtag->segments = NULL; /* Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { @@ -584,9 +565,6 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { - if (dmat->segments != NULL && - dmat->segments != dmat->tagsegs) - free(dmat->segments, M_DEVBUF); free(dmat, M_DEVBUF); /* * Last reference count, so @@ -643,6 +621,31 @@ static int allocate_bz_and_pages(bus_dma return (0); } +static bus_dmamap_t +allocate_map(bus_dma_tag_t dmat, int mflags) +{ + int mapsize, segsize; + bus_dmamap_t map; + + /* + * Allocate the map. The map structure ends with an embedded + * variable-sized array of sync_list structures. Following that + * we allocate enough extra space to hold the array of bus_dma_segments. + */ + KASSERT(dmat->nsegments <= MAX_DMA_SEGMENTS, + ("cannot allocate %u dma segments (max is %u)", + dmat->nsegments, MAX_DMA_SEGMENTS)); + segsize = sizeof(struct bus_dma_segment) * dmat->nsegments; + mapsize = sizeof(*map) + sizeof(struct sync_list) * dmat->nsegments; + map = malloc(mapsize + segsize, M_DEVBUF, mflags | M_ZERO); + if (map == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); + return (NULL); + } + map->segments = (bus_dma_segment_t *)((uintptr_t)map + mapsize); + return (map); +} + /* * Allocate a handle for mapping from kva/uva/physical * address space into bus device space. @@ -651,33 +654,20 @@ int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { bus_dmamap_t map; - int mapsize; int error = 0; - mapsize = sizeof(*map) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = map = malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); + *mapp = map = allocate_map(dmat, M_NOWAIT); if (map == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); return (ENOMEM); } - map->sync_count = 0; - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, ENOMEM); - free(map, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } /* - * Bouncing might be required if the driver asks for an active - * exclusion region, a data alignment that is stricter than 1, and/or - * an active address boundary. + * Bouncing might be required if the driver asks for an exclusion + * region, a data alignment that is stricter than 1, or DMA that begins + * or ends with a partial cacheline. Whether bouncing will actually + * happen can't be known until mapping time, but we need to pre-allocate + * resources now because we might not be allowed to at mapping time. */ error = allocate_bz_and_pages(dmat, map); if (error != 0) { @@ -723,41 +713,23 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi bus_dmamap_t map; vm_memattr_t memattr; int mflags; - int mapsize; - int error; if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; else mflags = M_WAITOK; + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; - /* ARM non-snooping caches need a map for the VA cache sync structure */ - - mapsize = sizeof(*map) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = map = malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); + *mapp = map = allocate_map(dmat, mflags); if (map == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } map->flags = DMAMAP_DMAMEM_ALLOC; - map->sync_count = 0; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); - free(map, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; + /* Choose a busdma buffer allocator based on memory type flags. */ if (flags & BUS_DMA_COHERENT) { memattr = VM_MEMATTR_UNCACHEABLE; ba = coherent_allocator; @@ -1016,7 +988,7 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat int error; if (segs == NULL) - segs = dmat->segments; + segs = map->segments; if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); @@ -1084,7 +1056,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm int error; if (segs == NULL) - segs = dmat->segments; + segs = map->segments; if (flags & BUS_DMA_LOAD_MBUF) map->flags |= DMAMAP_MBUF; @@ -1179,7 +1151,7 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, { if (segs == NULL) - segs = dmat->segments; + segs = map->segments; return (segs); } From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 02:38:03 2014 Return-Path: Delivered-To: svn-src-all@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 1829DD10; Tue, 29 Jul 2014 02:38:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 059A92641; Tue, 29 Jul 2014 02:38:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T2c2v4074748; Tue, 29 Jul 2014 02:38:02 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T2c2sx074747; Tue, 29 Jul 2014 02:38:02 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407290238.s6T2c2sx074747@svn.freebsd.org> From: Ian Lepore Date: Tue, 29 Jul 2014 02:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269217 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 02:38:03 -0000 Author: ian Date: Tue Jul 29 02:38:02 2014 New Revision: 269217 URL: http://svnweb.freebsd.org/changeset/base/269217 Log: Export some new busdma stats via sysctl for armv6. Added: hw.busdma.tags_total: 46 hw.busdma.maps_total: 1302 hw.busdma.maps_dmamem: 851 hw.busdma.maps_coherent: 849 hw.busdma.maploads_total: 1568812 hw.busdma.maploads_bounced: 16750 hw.busdma.maploads_coherent: 920 hw.busdma.maploads_dmamem: 920 hw.busdma.maploads_mbuf: 1542766 hw.busdma.maploads_physmem: 0 Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:37:48 2014 (r269216) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Jul 29 02:38:02 2014 (r269217) @@ -137,9 +137,40 @@ struct bounce_zone { static struct mtx bounce_lock; static int total_bpages; static int busdma_zonecount; +static uint32_t tags_total; +static uint32_t maps_total; +static uint32_t maps_dmamem; +static uint32_t maps_coherent; +static uint64_t maploads_total; +static uint64_t maploads_bounced; +static uint64_t maploads_coherent; +static uint64_t maploads_dmamem; +static uint64_t maploads_mbuf; +static uint64_t maploads_physmem; + static STAILQ_HEAD(, bounce_zone) bounce_zone_list; SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, tags_total, CTLFLAG_RD, &tags_total, 0, + "Number of active tags"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_total, CTLFLAG_RD, &maps_total, 0, + "Number of active maps"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, &maps_dmamem, 0, + "Number of active maps for bus_dmamem_alloc buffers"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, + "Number of active maps with BUS_DMA_COHERENT flag set"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, 0, + "Number of load operations performed"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, &maploads_bounced, 0, + "Number of load operations that used bounce buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on BUS_DMA_COHERENT memory"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on bus_dmamem_alloc buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, &maploads_mbuf, 0, + "Number of load operations for mbufs"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, &maploads_physmem, 0, + "Number of load operations on physical buffers"); SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, "Total bounce pages"); @@ -536,6 +567,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (error != 0) { free(newtag, M_DEVBUF); } else { + atomic_add_32(&tags_total, 1); *dmat = newtag; } CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", @@ -565,6 +597,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { + atomic_subtract_32(&tags_total, 1); free(dmat, M_DEVBUF); /* * Last reference count, so @@ -675,7 +708,10 @@ bus_dmamap_create(bus_dma_tag_t dmat, in *mapp = NULL; return (error); } - return (error); + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_total, 1); + return (0); } /* @@ -692,6 +728,9 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, b } if (dmat->bounce_zone) dmat->bounce_zone->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); free(map, M_DEVBUF); dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); @@ -780,6 +819,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi *mapp = NULL; return (ENOMEM); } + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_dmamem, 1); + atomic_add_32(&maps_total, 1); dmat->map_count++; CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", @@ -813,6 +856,10 @@ bus_dmamem_free(bus_dma_tag_t dmat, void kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->maxsize); dmat->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); + atomic_subtract_32(&maps_dmamem, 1); free(map, M_DEVBUF); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); } @@ -990,9 +1037,13 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat if (segs == NULL) segs = map->segments; + maploads_total++; + maploads_physmem++; + if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1055,17 +1106,26 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm struct sync_list *sl; int error; + maploads_total++; + if (map->flags & DMAMAP_COHERENT) + maploads_coherent++; + if (map->flags & DMAMAP_DMAMEM_ALLOC) + maploads_dmamem++; + if (segs == NULL) segs = map->segments; - if (flags & BUS_DMA_LOAD_MBUF) + if (flags & BUS_DMA_LOAD_MBUF) { + maploads_mbuf++; map->flags |= DMAMAP_MBUF; + } map->pmap = pmap; if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1449,7 +1509,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_bounced", CTLFLAG_RD, &bz->total_bounced, 0, - "Total bounce requests"); + "Total bounce requests (pages bounced)"); SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_deferred", CTLFLAG_RD, &bz->total_deferred, 0, From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 03:23:47 2014 Return-Path: Delivered-To: svn-src-all@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 B872E4DB; Tue, 29 Jul 2014 03:23:47 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EBF22AF5; Tue, 29 Jul 2014 03:23:47 +0000 (UTC) Received: from pippin.baldwin.cx (75-48-77-17.lightspeed.cncrca.sbcglobal.net [75.48.77.17]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7DD03B94B; Mon, 28 Jul 2014 23:23:45 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r267937 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/... Date: Mon, 28 Jul 2014 23:23:42 -0400 Message-ID: <2037442.AGE2eZkv8p@pippin.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/11.0-CURRENT; KDE/4.12.5; amd64; ; ) In-Reply-To: <201406262145.s5QLjnJH034761@svn.freebsd.org> References: <201406262145.s5QLjnJH034761@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 28 Jul 2014 23:23:45 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 03:23:47 -0000 On Thursday 26 June 2014 21:45:49 Rui Paulo wrote: > Author: rpaulo > Date: Thu Jun 26 21:45:49 2014 > New Revision: 267937 > URL: http://svnweb.freebsd.org/changeset/base/267937 > > Log: > MFV illumos > > 4477 DTrace should speak JSON > > MFC after: 2 weeks This makes kernel builds depend on userland sources. This breaks a lot of my work trees where I only checkout 'sys', and breaks a generally long-standing feature that the kernel was self-contained (recent bmake breakage to require the '-m /usr/src/share/mk' hack aside). Perhaps you could copy strtolctype.h to sys/cddl/contrib/opensolaris/common/util? We already duplicate sys/cddl/contrib/opensolaris/common/avl/avl.c in a like manner, presumably for the same reason. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 05:41:56 2014 Return-Path: Delivered-To: svn-src-all@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 33F7BB8C; Tue, 29 Jul 2014 05:41: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14C2027CD; Tue, 29 Jul 2014 05:41:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T5ftgT061864; Tue, 29 Jul 2014 05:41:55 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T5fsOP061859; Tue, 29 Jul 2014 05:41:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290541.s6T5fsOP061859@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 05:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269218 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 05:41:56 -0000 Author: delphij Date: Tue Jul 29 05:41:54 2014 New Revision: 269218 URL: http://svnweb.freebsd.org/changeset/base/269218 Log: MFC r268713: MFV r268702: Add missing *_destroy() calls in various places with ZFS. Illumos issue: 4975 missing mutex_destroy() calls in zfs Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jul 29 02:38:02 2014 (r269217) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jul 29 05:41:54 2014 (r269218) @@ -1353,6 +1353,12 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_ if (dr->dt.dl.dr_data != db->db_buf) VERIFY(arc_buf_remove_ref(dr->dt.dl.dr_data, db)); } + + if (db->db_level != 0) { + mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); + } + kmem_free(dr, sizeof (dbuf_dirty_record_t)); ASSERT(db->db_dirtycnt > 0); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jul 29 02:38:02 2014 (r269217) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jul 29 05:41:54 2014 (r269218) @@ -1083,6 +1083,11 @@ dnode_hold_impl(objset_t *os, uint64_t o } if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL, dnode_buf_pageout)) { + + for (i = 0; i < epb; i++) { + zrl_destroy(&dnh[i].dnh_zrlock); + } + kmem_free(children_dnodes, sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t)); children_dnodes = winner; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 02:38:02 2014 (r269217) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 05:41:54 2014 (r269218) @@ -476,8 +476,8 @@ dnode_undirty_dbufs(list_t *list) dr->dt.dl.dr_data == db->db_buf); dbuf_unoverride(dr); } else { - list_destroy(&dr->dt.di.dr_children); mutex_destroy(&dr->dt.di.dr_mtx); + list_destroy(&dr->dt.di.dr_children); } kmem_free(dr, sizeof (dbuf_dirty_record_t)); dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Jul 29 02:38:02 2014 (r269217) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Jul 29 05:41:54 2014 (r269218) @@ -270,6 +270,7 @@ dsl_dataset_evict(dmu_buf_t *db, void *d if (mutex_owned(&ds->ds_opening_lock)) mutex_exit(&ds->ds_opening_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); kmem_free(ds, sizeof (dsl_dataset_t)); @@ -398,6 +399,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin if (err != 0) { mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); bplist_destroy(&ds->ds_pending_deadlist); dsl_deadlist_close(&ds->ds_deadlist); @@ -454,6 +456,7 @@ dsl_dataset_hold_obj(dsl_pool_t *dp, uin dsl_dir_rele(ds->ds_dir, ds); mutex_destroy(&ds->ds_lock); mutex_destroy(&ds->ds_opening_lock); + mutex_destroy(&ds->ds_sendstream_lock); refcount_destroy(&ds->ds_longholds); kmem_free(ds, sizeof (dsl_dataset_t)); if (err != 0) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Tue Jul 29 02:38:02 2014 (r269217) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c Tue Jul 29 05:41:54 2014 (r269218) @@ -1111,6 +1111,9 @@ fail: if (sa->sa_user_table) kmem_free(sa->sa_user_table, sa->sa_user_table_sz); mutex_exit(&sa->sa_lock); + avl_destroy(&sa->sa_layout_hash_tree); + avl_destroy(&sa->sa_layout_num_tree); + mutex_destroy(&sa->sa_lock); kmem_free(sa, sizeof (sa_os_t)); return ((error == ECKSUM) ? EIO : error); } @@ -1146,6 +1149,7 @@ sa_tear_down(objset_t *os) avl_destroy(&sa->sa_layout_hash_tree); avl_destroy(&sa->sa_layout_num_tree); + mutex_destroy(&sa->sa_lock); kmem_free(sa, sizeof (sa_os_t)); os->os_sa = NULL; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 05:49:17 2014 Return-Path: Delivered-To: svn-src-all@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 29767D54; Tue, 29 Jul 2014 05:49:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D312803; Tue, 29 Jul 2014 05:49:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T5nGlD062867; Tue, 29 Jul 2014 05:49:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T5nGjt062864; Tue, 29 Jul 2014 05:49:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290549.s6T5nGjt062864@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 05:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269219 - in stable/10: cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 05:49:17 -0000 Author: delphij Date: Tue Jul 29 05:49:16 2014 New Revision: 269219 URL: http://svnweb.freebsd.org/changeset/base/269219 Log: MFC r268720: MFV r268714: Improve extreme rewind import. When doing an "extreme rewind" import ("zpool import -XF"), we attempt to verify all data in the pool, essentially scrubbing the entire pool. The problem is that spa_load_verify_cb() issues an unbounded number of concurrent scrub i/os. This can lead to all of memory being used for these zio's, wedging the system. Like normal scrub, we need to put a cap on the number of outstanding i/os, and have the traverse thread block when we reach this cap. For this purpose the cap can be very large (10,000) to optimize the elevator algorithm. Three kernel tunables have been added: vfs.zfs.spa_load_verify_maxinflight vfs.zfs.spa_load_verify_metadata vfs.zfs.spa_load_verify_data The latter two tunables controls whether metadata and/or user data when doing extreme rewind. Make 'zpool import -T' imply scrub. Make zpool import -T accept hexadecimal values for the txg when prefixed with 0x. Skip txg's for which there is no uberblock when doing extreme rewind. Skip reading all user data twice by skipping prefetches when doing extreme rewinds as we do not access via the ARC. Illumos issues: 4970 need controls on i/o issued by zpool import -XF 4971 zpool import -T should accept hex values 4972 zpool import -T implies extreme rewind, and thus a scrub 4973 spa_load_retry retries the same txg 4974 spa_load_verify() reads all data twice Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 29 05:41:54 2014 (r269218) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 29 05:49:16 2014 (r269219) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. @@ -2033,7 +2033,7 @@ zpool_do_import(int argc, char **argv) break; case 'T': errno = 0; - txg = strtoull(optarg, &endptr, 10); + txg = strtoull(optarg, &endptr, 0); if (errno != 0 || *endptr != '\0') { (void) fprintf(stderr, gettext("invalid txg value\n")); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Jul 29 05:41:54 2014 (r269218) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Tue Jul 29 05:49:16 2014 (r269219) @@ -1874,6 +1874,7 @@ spa_load_verify_done(zio_t *zio) spa_load_error_t *sle = zio->io_private; dmu_object_type_t type = BP_GET_TYPE(bp); int error = zio->io_error; + spa_t *spa = zio->io_spa; if (error) { if ((BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)) && @@ -1883,23 +1884,65 @@ spa_load_verify_done(zio_t *zio) atomic_add_64(&sle->sle_data_count, 1); } zio_data_buf_free(zio->io_data, zio->io_size); + + mutex_enter(&spa->spa_scrub_lock); + spa->spa_scrub_inflight--; + cv_broadcast(&spa->spa_scrub_io_cv); + mutex_exit(&spa->spa_scrub_lock); } +/* + * Maximum number of concurrent scrub i/os to create while verifying + * a pool while importing it. + */ +int spa_load_verify_maxinflight = 10000; +boolean_t spa_load_verify_metadata = B_TRUE; +boolean_t spa_load_verify_data = B_TRUE; + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_maxinflight, CTLFLAG_RWTUN, + &spa_load_verify_maxinflight, 0, + "Maximum number of concurrent scrub I/Os to create while verifying a " + "pool while importing it"); + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_metadata, CTLFLAG_RWTUN, + &spa_load_verify_metadata, 0, + "Check metadata on import?"); + +SYSCTL_INT(_vfs_zfs, OID_AUTO, spa_load_verify_data, CTLFLAG_RWTUN, + &spa_load_verify_data, 0, + "Check user data on import?"); + /*ARGSUSED*/ static int spa_load_verify_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, const zbookmark_phys_t *zb, const dnode_phys_t *dnp, void *arg) { - if (!BP_IS_HOLE(bp) && !BP_IS_EMBEDDED(bp)) { - zio_t *rio = arg; - size_t size = BP_GET_PSIZE(bp); - void *data = zio_data_buf_alloc(size); - - zio_nowait(zio_read(rio, spa, bp, data, size, - spa_load_verify_done, rio->io_private, ZIO_PRIORITY_SCRUB, - ZIO_FLAG_SPECULATIVE | ZIO_FLAG_CANFAIL | - ZIO_FLAG_SCRUB | ZIO_FLAG_RAW, zb)); - } + if (BP_IS_HOLE(bp) || BP_IS_EMBEDDED(bp)) + return (0); + /* + * Note: normally this routine will not be called if + * spa_load_verify_metadata is not set. However, it may be useful + * to manually set the flag after the traversal has begun. + */ + if (!spa_load_verify_metadata) + return (0); + if (BP_GET_BUFC_TYPE(bp) == ARC_BUFC_DATA && !spa_load_verify_data) + return (0); + + zio_t *rio = arg; + size_t size = BP_GET_PSIZE(bp); + void *data = zio_data_buf_alloc(size); + + mutex_enter(&spa->spa_scrub_lock); + while (spa->spa_scrub_inflight >= spa_load_verify_maxinflight) + cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); + spa->spa_scrub_inflight++; + mutex_exit(&spa->spa_scrub_lock); + + zio_nowait(zio_read(rio, spa, bp, data, size, + spa_load_verify_done, rio->io_private, ZIO_PRIORITY_SCRUB, + ZIO_FLAG_SPECULATIVE | ZIO_FLAG_CANFAIL | + ZIO_FLAG_SCRUB | ZIO_FLAG_RAW, zb)); return (0); } @@ -1910,7 +1953,7 @@ spa_load_verify(spa_t *spa) spa_load_error_t sle = { 0 }; zpool_rewind_policy_t policy; boolean_t verify_ok = B_FALSE; - int error; + int error = 0; zpool_get_rewind_policy(spa->spa_config, &policy); @@ -1920,8 +1963,11 @@ spa_load_verify(spa_t *spa) rio = zio_root(spa, NULL, &sle, ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); - error = traverse_pool(spa, spa->spa_verify_min_txg, - TRAVERSE_PRE | TRAVERSE_PREFETCH, spa_load_verify_cb, rio); + if (spa_load_verify_metadata) { + error = traverse_pool(spa, spa->spa_verify_min_txg, + TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA, + spa_load_verify_cb, rio); + } (void) zio_wait(rio); @@ -2796,7 +2842,7 @@ spa_load_retry(spa_t *spa, spa_load_stat spa_unload(spa); spa_deactivate(spa); - spa->spa_load_max_txg--; + spa->spa_load_max_txg = spa->spa_uberblock.ub_txg - 1; spa_activate(spa, mode); spa_async_suspend(spa); @@ -2826,6 +2872,8 @@ spa_load_best(spa_t *spa, spa_load_state spa_set_log_state(spa, SPA_LOG_CLEAR); } else { spa->spa_load_max_txg = max_request; + if (max_request != UINT64_MAX) + spa->spa_extreme_rewind = B_TRUE; } load_error = rewind_error = spa_load(spa, state, SPA_IMPORT_EXISTING, From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 06:00:16 2014 Return-Path: Delivered-To: svn-src-all@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 D60331BB; Tue, 29 Jul 2014 06:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C31C028F2; Tue, 29 Jul 2014 06:00:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T60GLG067594; Tue, 29 Jul 2014 06:00:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T60GHq067593; Tue, 29 Jul 2014 06:00:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290600.s6T60GHq067593@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 06:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269220 - stable/10/libexec/save-entropy X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 06:00:16 -0000 Author: delphij Date: Tue Jul 29 06:00:16 2014 New Revision: 269220 URL: http://svnweb.freebsd.org/changeset/base/269220 Log: MFC r268979: Don't save entropy inside jails. As of r126744, we no longer feed the entropy device in jails upon start, and collecting them is no longer useful. PR: conf/126744 Submitted by: Eugene Grosbein (with minor changes) Approved by: so (des) Modified: stable/10/libexec/save-entropy/save-entropy.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/save-entropy/save-entropy.sh ============================================================================== --- stable/10/libexec/save-entropy/save-entropy.sh Tue Jul 29 05:49:16 2014 (r269219) +++ stable/10/libexec/save-entropy/save-entropy.sh Tue Jul 29 06:00:16 2014 (r269220) @@ -42,6 +42,8 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf 2>/dev/null fi +[ $(/sbin/sysctl -n security.jail.jailed) = 0 ] || exit 0 + case ${entropy_dir} in [Nn][Oo]) exit 0 From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 06:00:49 2014 Return-Path: Delivered-To: svn-src-all@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 8E4892F3; Tue, 29 Jul 2014 06:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A8A62973; Tue, 29 Jul 2014 06:00:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T60nPa069635; Tue, 29 Jul 2014 06:00:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T60nB4069508; Tue, 29 Jul 2014 06:00:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290600.s6T60nB4069508@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 06:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269221 - in stable: 8/libexec/save-entropy 9/libexec/save-entropy X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 06:00:49 -0000 Author: delphij Date: Tue Jul 29 06:00:48 2014 New Revision: 269221 URL: http://svnweb.freebsd.org/changeset/base/269221 Log: MFC r268979: Don't save entropy inside jails. As of r126744, we no longer feed the entropy device in jails upon start, and collecting them is no longer useful. PR: conf/126744 Submitted by: Eugene Grosbein (with minor changes) Approved by: so (des) Modified: stable/9/libexec/save-entropy/save-entropy.sh Directory Properties: stable/9/libexec/save-entropy/ (props changed) Changes in other areas also in this revision: Modified: stable/8/libexec/save-entropy/save-entropy.sh Directory Properties: stable/8/libexec/save-entropy/ (props changed) Modified: stable/9/libexec/save-entropy/save-entropy.sh ============================================================================== --- stable/9/libexec/save-entropy/save-entropy.sh Tue Jul 29 06:00:16 2014 (r269220) +++ stable/9/libexec/save-entropy/save-entropy.sh Tue Jul 29 06:00:48 2014 (r269221) @@ -42,6 +42,8 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf 2>/dev/null fi +[ $(/sbin/sysctl -n security.jail.jailed) = 0 ] || exit 0 + case ${entropy_dir} in [Nn][Oo]) exit 0 From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 06:00:49 2014 Return-Path: Delivered-To: svn-src-all@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 E024E2F4; Tue, 29 Jul 2014 06:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD69B2974; Tue, 29 Jul 2014 06:00:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T60nZc069720; Tue, 29 Jul 2014 06:00:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T60n8V069719; Tue, 29 Jul 2014 06:00:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290600.s6T60n8V069719@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 06:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r269221 - in stable: 8/libexec/save-entropy 9/libexec/save-entropy X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 06:00:50 -0000 Author: delphij Date: Tue Jul 29 06:00:48 2014 New Revision: 269221 URL: http://svnweb.freebsd.org/changeset/base/269221 Log: MFC r268979: Don't save entropy inside jails. As of r126744, we no longer feed the entropy device in jails upon start, and collecting them is no longer useful. PR: conf/126744 Submitted by: Eugene Grosbein (with minor changes) Approved by: so (des) Modified: stable/8/libexec/save-entropy/save-entropy.sh Directory Properties: stable/8/libexec/save-entropy/ (props changed) Changes in other areas also in this revision: Modified: stable/9/libexec/save-entropy/save-entropy.sh Directory Properties: stable/9/libexec/save-entropy/ (props changed) Modified: stable/8/libexec/save-entropy/save-entropy.sh ============================================================================== --- stable/8/libexec/save-entropy/save-entropy.sh Tue Jul 29 06:00:16 2014 (r269220) +++ stable/8/libexec/save-entropy/save-entropy.sh Tue Jul 29 06:00:48 2014 (r269221) @@ -42,6 +42,8 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf 2>/dev/null fi +[ $(/sbin/sysctl -n security.jail.jailed) = 0 ] || exit 0 + case ${entropy_dir} in [Nn][Oo]) exit 0 From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 06:57:13 2014 Return-Path: Delivered-To: svn-src-all@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 BF490DE4; Tue, 29 Jul 2014 06:57: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC26B2F16; Tue, 29 Jul 2014 06:57:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T6vDJX094810; Tue, 29 Jul 2014 06:57:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T6vDxh094809; Tue, 29 Jul 2014 06:57:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290657.s6T6vDxh094809@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 06:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269222 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 06:57:13 -0000 Author: delphij Date: Tue Jul 29 06:57:13 2014 New Revision: 269222 URL: http://svnweb.freebsd.org/changeset/base/269222 Log: Reschedule the 'deadman' callout after handling, this makes our code behave more like it is on Solaris. Reported by: avg Reviewed by: avg, mav (but bugs are mine) Differential Revision: https://phabric.freebsd.org/D457 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Tue Jul 29 06:00:48 2014 (r269221) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Tue Jul 29 06:57:13 2014 (r269222) @@ -570,6 +570,12 @@ spa_deadman(void *arg) ++spa->spa_deadman_calls); if (zfs_deadman_enabled) vdev_deadman(spa->spa_root_vdev); +#ifdef __FreeBSD__ +#ifdef _KERNEL + callout_schedule(&spa->spa_deadman_cycid, + hz * zfs_deadman_checktime_ms / MILLISEC); +#endif +#endif } /* From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:08:34 2014 Return-Path: Delivered-To: svn-src-all@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 8C98A315; Tue, 29 Jul 2014 07:08:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77434205E; Tue, 29 Jul 2014 07:08:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T78YjJ000191; Tue, 29 Jul 2014 07:08:34 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T78XTR000184; Tue, 29 Jul 2014 07:08:33 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290708.s6T78XTR000184@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 07:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r269223 - vendor-sys/illumos/dist/common/avl vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumo... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:08:34 -0000 Author: delphij Date: Tue Jul 29 07:08:32 2014 New Revision: 269223 URL: http://svnweb.freebsd.org/changeset/base/269223 Log: 4873 zvol unmap calls can take a very long time for larger datasets Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Basil Crow Reviewed by: Dan McDonald Approved by: Robert Mustacchi illumos/illumos-gate@0f6d88aded0d165f5954688a9b13bac76c38da84 Modified: vendor-sys/illumos/dist/common/avl/avl.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/illumos/dist/uts/common/sys/avl.h Changes in other areas also in this revision: Modified: vendor/illumos/dist/common/avl/avl.c Modified: vendor-sys/illumos/dist/common/avl/avl.c ============================================================================== --- vendor-sys/illumos/dist/common/avl/avl.c Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/common/avl/avl.c Tue Jul 29 07:08:32 2014 (r269223) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -864,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c Tue Jul 29 07:08:32 2014 (r269223) @@ -69,6 +69,9 @@ dbuf_cons(void *vdb, void *unused, int k mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); refcount_create(&db->db_holds); + + db->db_creation = gethrtime(); + return (0); } @@ -330,7 +333,7 @@ dbuf_verify(dmu_buf_impl_t *db) ASSERT3U(db->db_level, <, dn->dn_nlevels); ASSERT(db->db_blkid == DMU_BONUS_BLKID || db->db_blkid == DMU_SPILL_BLKID || - !list_is_empty(&dn->dn_dbufs)); + !avl_is_empty(&dn->dn_dbufs)); } if (db->db_blkid == DMU_BONUS_BLKID) { ASSERT(dn != NULL); @@ -803,18 +806,30 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) * receive; see comment below for details. */ void -dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx) +dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, + dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db, *db_next, db_search; uint64_t txg = tx->tx_txg; + avl_index_t where; - if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) - end = dn->dn_maxblkid; - dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); + if (end_blkid > dn->dn_maxblkid && (end_blkid != DMU_SPILL_BLKID)) + end_blkid = dn->dn_maxblkid; + dprintf_dnode(dn, "start=%llu end=%llu\n", start_blkid, end_blkid); + + db_search.db_level = 0; + db_search.db_blkid = start_blkid; + db_search.db_creation = 0; mutex_enter(&dn->dn_dbufs_mtx); - if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) { + if (start_blkid >= dn->dn_unlisted_l0_blkid) { /* There can't be any dbufs in this range; no need to search. */ +#ifdef DEBUG + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + ASSERT(db == NULL || db->db_level > 0); +#endif mutex_exit(&dn->dn_dbufs_mtx); return; } else if (dmu_objset_is_receiving(dn->dn_objset)) { @@ -828,14 +843,18 @@ dbuf_free_range(dnode_t *dn, uint64_t st atomic_inc_64(&zfs_free_range_recv_miss); } - for (db = list_head(&dn->dn_dbufs); db != NULL; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + + for (; db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); - if (db->db_level != 0) - continue; - if (db->db_blkid < start || db->db_blkid > end) - continue; + if (db->db_level != 0 || db->db_blkid > end_blkid) { + break; + } + ASSERT3U(db->db_blkid, >=, start_blkid); /* found a level 0 buffer in the range */ mutex_enter(&db->db_mtx); @@ -1585,7 +1604,7 @@ dbuf_clear(dmu_buf_impl_t *db) dn = DB_DNODE(db); dndb = dn->dn_dbuf; if (db->db_blkid != DMU_BONUS_BLKID && MUTEX_HELD(&dn->dn_dbufs_mtx)) { - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); membar_producer(); DB_DNODE_EXIT(db); @@ -1748,7 +1767,7 @@ dbuf_create(dnode_t *dn, uint8_t level, mutex_exit(&dn->dn_dbufs_mtx); return (odb); } - list_insert_head(&dn->dn_dbufs, db); + avl_add(&dn->dn_dbufs, db); if (db->db_level == 0 && db->db_blkid >= dn->dn_unlisted_l0_blkid) dn->dn_unlisted_l0_blkid = db->db_blkid + 1; @@ -1807,7 +1826,7 @@ dbuf_destroy(dmu_buf_impl_t *db) DB_DNODE_ENTER(db); dn = DB_DNODE(db); mutex_enter(&dn->dn_dbufs_mtx); - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); mutex_exit(&dn->dn_dbufs_mtx); DB_DNODE_EXIT(db); @@ -1825,7 +1844,6 @@ dbuf_destroy(dmu_buf_impl_t *db) db->db_parent = NULL; db->db_buf = NULL; - ASSERT(!list_link_active(&db->db_link)); ASSERT(db->db.db_data == NULL); ASSERT(db->db_hash_next == NULL); ASSERT(db->db_blkptr == NULL); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Tue Jul 29 07:08:32 2014 (r269223) @@ -59,6 +59,43 @@ int zfs_default_ibs = DN_MAX_INDBLKSHIFT static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); +static int +dbuf_compare(const void *x1, const void *x2) +{ + const dmu_buf_impl_t *d1 = x1; + const dmu_buf_impl_t *d2 = x2; + + if (d1->db_level < d2->db_level) { + return (-1); + } else if (d1->db_level > d2->db_level) { + return (1); + } + + if (d1->db_blkid < d2->db_blkid) { + return (-1); + } else if (d1->db_blkid > d2->db_blkid) { + return (1); + } + + /* + * If a dbuf is being evicted while dn_dbufs_mutex is not held, we set + * the db_state to DB_EVICTING but do not remove it from dn_dbufs. If + * another thread creates a dbuf of the same blkid before the dbuf is + * removed from dn_dbufs, we can reach a state where there are two + * dbufs of the same blkid and level in db_dbufs. To maintain the avl + * invariant that there cannot be duplicate items, we distinguish + * between these two dbufs based on the time they were created. + */ + if (d1->db_creation < d2->db_creation) { + return (-1); + } else if (d1->db_creation > d2->db_creation) { + return (1); + } else { + ASSERT3P(d1, ==, d2); + return (0); + } +} + /* ARGSUSED */ static int dnode_cons(void *arg, void *unused, int kmflag) @@ -113,7 +150,7 @@ dnode_cons(void *arg, void *unused, int dn->dn_dbufs_count = 0; dn->dn_unlisted_l0_blkid = 0; - list_create(&dn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); dn->dn_moved = 0; @@ -166,7 +203,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_dbufs_count); ASSERT0(dn->dn_unlisted_l0_blkid); - list_destroy(&dn->dn_dbufs); + avl_destroy(&dn->dn_dbufs); } void @@ -502,7 +539,7 @@ dnode_allocate(dnode_t *dn, dmu_object_t ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); for (i = 0; i < TXG_SIZE; i++) { ASSERT0(dn->dn_next_nblkptr[i]); @@ -687,8 +724,8 @@ dnode_move_impl(dnode_t *odn, dnode_t *n ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; ASSERT(refcount_count(&odn->dn_tx_holds) == 0); refcount_transfer(&ndn->dn_holds, &odn->dn_holds); - ASSERT(list_is_empty(&ndn->dn_dbufs)); - list_move_tail(&ndn->dn_dbufs, &odn->dn_dbufs); + ASSERT(avl_is_empty(&ndn->dn_dbufs)); + avl_swap(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; @@ -722,7 +759,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n */ odn->dn_dbuf = NULL; odn->dn_handle = NULL; - list_create(&odn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&odn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; odn->dn_unlisted_l0_blkid = 0; @@ -1231,7 +1268,8 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx return; } - ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs)); + ASSERT(!refcount_is_zero(&dn->dn_holds) || + !avl_is_empty(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); @@ -1304,7 +1342,7 @@ dnode_free(dnode_t *dn, dmu_tx_t *tx) int dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db; int err; if (size == 0) @@ -1327,9 +1365,8 @@ dnode_set_blksz(dnode_t *dn, uint64_t si goto fail; mutex_enter(&dn->dn_dbufs_mtx); - for (db = list_head(&dn->dn_dbufs); db; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); - + for (db = avl_first(&dn->dn_dbufs); db != NULL; + db = AVL_NEXT(&dn->dn_dbufs, db)) { if (db->db_blkid != 0 && db->db_blkid != DMU_BONUS_BLKID && db->db_blkid != DMU_SPILL_BLKID) { mutex_exit(&dn->dn_dbufs_mtx); Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 07:08:32 2014 (r269223) @@ -400,16 +400,13 @@ dnode_evict_dbufs(dnode_t *dn) int pass = 0; do { - dmu_buf_impl_t *db, marker; + dmu_buf_impl_t *db, *db_next; int evicting = FALSE; progress = FALSE; mutex_enter(&dn->dn_dbufs_mtx); - list_insert_tail(&dn->dn_dbufs, &marker); - db = list_head(&dn->dn_dbufs); - for (; db != ▮ db = list_head(&dn->dn_dbufs)) { - list_remove(&dn->dn_dbufs, db); - list_insert_tail(&dn->dn_dbufs, db); + for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); #ifdef DEBUG DB_DNODE_ENTER(db); ASSERT3P(DB_DNODE(db), ==, dn); @@ -429,7 +426,6 @@ dnode_evict_dbufs(dnode_t *dn) } } - list_remove(&dn->dn_dbufs, &marker); /* * NB: we need to drop dn_dbufs_mtx between passes so * that any DB_EVICTING dbufs can make progress. @@ -500,7 +496,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *t dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); dnode_evict_dbufs(dn); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); ASSERT3P(dn->dn_bonus, ==, NULL); /* Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h Tue Jul 29 07:08:32 2014 (r269223) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -213,11 +213,14 @@ typedef struct dmu_buf_impl { /* pointer to most recent dirty record for this buffer */ dbuf_dirty_record_t *db_last_dirty; + /* Creation time of dbuf (see comment in dbuf_compare). */ + hrtime_t db_creation; + /* * Our link on the owner dnodes's dn_dbufs list. * Protected by its dn_dbufs_mtx. */ - list_node_t db_link; + avl_node_t db_link; /* Data which is unique to data (leaf) blocks: */ Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Tue Jul 29 07:08:32 2014 (r269223) @@ -211,7 +211,7 @@ typedef struct dnode { refcount_t dn_holds; kmutex_t dn_dbufs_mtx; - list_t dn_dbufs; /* descendent dbufs */ + avl_tree_t dn_dbufs; /* descendent dbufs */ /* protected by dn_struct_rwlock */ struct dmu_buf_impl *dn_bonus; /* bonus buffer dbuf */ Modified: vendor-sys/illumos/dist/uts/common/sys/avl.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/sys/avl.h Tue Jul 29 06:57:13 2014 (r269222) +++ vendor-sys/illumos/dist/uts/common/sys/avl.h Tue Jul 29 07:08:32 2014 (r269223) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + #ifndef _AVL_H #define _AVL_H @@ -260,6 +264,11 @@ extern boolean_t avl_update_lt(avl_tree_ extern boolean_t avl_update_gt(avl_tree_t *, void *); /* + * Swaps the contents of the two trees. + */ +extern void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); + +/* * Return the number of nodes in the tree */ extern ulong_t avl_numnodes(avl_tree_t *tree); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:08:33 2014 Return-Path: Delivered-To: svn-src-all@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 18472314; Tue, 29 Jul 2014 07:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECC22205D; Tue, 29 Jul 2014 07:08:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T78WPM000178; Tue, 29 Jul 2014 07:08:32 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T78Wwv000177; Tue, 29 Jul 2014 07:08:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290708.s6T78Wwv000177@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 07:08:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r269223 - vendor-sys/illumos/dist/common/avl vendor-sys/illumos/dist/uts/common/fs/zfs vendor-sys/illumos/dist/uts/common/fs/zfs/sys vendor-sys/illumos/dist/uts/common/sys vendor/illumo... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:08:33 -0000 Author: delphij Date: Tue Jul 29 07:08:32 2014 New Revision: 269223 URL: http://svnweb.freebsd.org/changeset/base/269223 Log: 4873 zvol unmap calls can take a very long time for larger datasets Reviewed by: George Wilson Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Basil Crow Reviewed by: Dan McDonald Approved by: Robert Mustacchi illumos/illumos-gate@0f6d88aded0d165f5954688a9b13bac76c38da84 Modified: vendor/illumos/dist/common/avl/avl.c Changes in other areas also in this revision: Modified: vendor-sys/illumos/dist/common/avl/avl.c vendor-sys/illumos/dist/uts/common/fs/zfs/dbuf.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/illumos/dist/uts/common/sys/avl.h Modified: vendor/illumos/dist/common/avl/avl.c ============================================================================== --- vendor/illumos/dist/common/avl/avl.c Tue Jul 29 06:57:13 2014 (r269222) +++ vendor/illumos/dist/common/avl/avl.c Tue Jul 29 07:08:32 2014 (r269223) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -37,7 +41,7 @@ * insertion and deletion relatively efficiently. Searching the tree is * still a fast operation, roughly O(log(N)). * - * The key to insertion and deletion is a set of tree maniuplations called + * The key to insertion and deletion is a set of tree manipulations called * rotations, which bring unbalanced subtrees back into the semi-balanced state. * * This implementation of AVL trees has the following peculiarities: @@ -45,7 +49,7 @@ * - The AVL specific data structures are physically embedded as fields * in the "using" data structures. To maintain generality the code * must constantly translate between "avl_node_t *" and containing - * data structure "void *"s by adding/subracting the avl_offset. + * data structure "void *"s by adding/subtracting the avl_offset. * * - Since the AVL data is always embedded in other structures, there is * no locking or memory allocation in the AVL routines. This must be @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -94,7 +104,7 @@ #include /* - * Small arrays to translate between balance (or diff) values and child indeces. + * Small arrays to translate between balance (or diff) values and child indices. * * Code that deals with binary tree data structures will randomly use * left and right children when examining a tree. C "if()" statements @@ -114,7 +124,8 @@ static const int avl_balance2child[] = * * - If there is a left child, go to it, then to it's rightmost descendant. * - * - otherwise we return thru parent nodes until we've come from a right child. + * - otherwise we return through parent nodes until we've come from a right + * child. * * Return Value: * NULL - if at the end of the nodes @@ -863,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ @@ -919,7 +948,7 @@ avl_is_empty(avl_tree_t *tree) /* * Post-order tree walk used to visit all tree nodes and destroy the tree - * in post order. This is used for destroying a tree w/o paying any cost + * in post order. This is used for destroying a tree without paying any cost * for rebalancing it. * * example: From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:13:03 2014 Return-Path: Delivered-To: svn-src-all@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 93895599; Tue, 29 Jul 2014 07:13:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 812A920F6; Tue, 29 Jul 2014 07:13:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T7D30S004178; Tue, 29 Jul 2014 07:13:03 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T7D34Q004177; Tue, 29 Jul 2014 07:13:03 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290713.s6T7D34Q004177@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 07:13:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r269224 - vendor-sys/illumos/dist/uts/common/fs/zfs X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:13:03 -0000 Author: delphij Date: Tue Jul 29 07:13:03 2014 New Revision: 269224 URL: http://svnweb.freebsd.org/changeset/base/269224 Log: 5034 ARC's buf_hash_table is too small Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Saso Kiselkov Reviewed by: Richard Elling Approved by: Gordon Ross illumos/illumos-gate@63e911b6fce0acc8e2a1d31ebdaf0c4c12580a14 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 29 07:08:32 2014 (r269223) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/arc.c Tue Jul 29 07:13:03 2014 (r269224) @@ -200,6 +200,7 @@ int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; int zfs_disable_dup_eviction = 0; +int zfs_arc_average_blocksize = 8 * 1024; /* 8KB */ /* * Note that buffers can be in one of 6 states: @@ -938,10 +939,11 @@ buf_init(void) /* * The hash table is big enough to fill all of physical memory - * with an average 64K block size. The table will take up - * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers). + * with an average block size of zfs_arc_average_blocksize (default 8K). + * By default, the table will take up + * totalmem * sizeof(void*) / 8K (1MB per GB with 8-byte pointers). */ - while (hsize * 65536 < physmem * PAGESIZE) + while (hsize * zfs_arc_average_blocksize < physmem * PAGESIZE) hsize <<= 1; retry: buf_hash_table.ht_mask = hsize - 1; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:36:38 2014 Return-Path: Delivered-To: svn-src-all@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 ED705AFF; Tue, 29 Jul 2014 07:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA10C22AF; Tue, 29 Jul 2014 07:36:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T7acj3013543; Tue, 29 Jul 2014 07:36:38 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T7acBf013542; Tue, 29 Jul 2014 07:36:38 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201407290736.s6T7acBf013542@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 29 Jul 2014 07:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269225 - stable/10/usr.bin/mkimg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:36:39 -0000 Author: pluknet Date: Tue Jul 29 07:36:38 2014 New Revision: 269225 URL: http://svnweb.freebsd.org/changeset/base/269225 Log: MFC r268727 (by delphij): Add a bandaid to fix GCC build (on sparc64 et al). Modified: stable/10/usr.bin/mkimg/vhd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkimg/vhd.c ============================================================================== --- stable/10/usr.bin/mkimg/vhd.c Tue Jul 29 07:13:03 2014 (r269224) +++ stable/10/usr.bin/mkimg/vhd.c Tue Jul 29 07:36:38 2014 (r269225) @@ -320,6 +320,7 @@ vhd_dyn_write(int fd) blk = 0; blkcnt = VHD_BLOCK_SIZE / secsz; + error = 0; nblks = image_get_size(); while (blk < nblks) { if (!image_data(blk, blkcnt)) { From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:39:06 2014 Return-Path: Delivered-To: svn-src-all@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 95CE8C79; Tue, 29 Jul 2014 07:39:06 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C0E0D22DD; Tue, 29 Jul 2014 07:39:05 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id hi2so5622701wib.4 for ; Tue, 29 Jul 2014 00:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=a71BhEw2L7J+F2ZoqnH7+SN4cjJHgzLJdwJj339H1Sk=; b=Qw0t9PCpgm2Um+PQMMFvATrf6JrCKnFLNqEHWolhUY5T90JmqqXJsaUpeLXwHlLIun yr2D7fBi1nN+Qy3kjpGlmfMFD9VqmEWpga/+pI9/HB2R0CKlfCylzUJ9qwIm9/9Qi3xx ZLciP6UKKFumgnlkYhujrS2ebYqXaRKFztPT/H9WHrnhYIROtzfZeZRIG80WiUVVDkE/ YVMELFPYUNR1Bkbpq5r030cM7WxURR85pykPPRZCIovkjzaxWxfN7Vdor2Rt27rZii4j T1mBZ9DLGdb/cN3ze/3MIpcKP5ZuVTyxaihXN9mFeV1dYbD3Ly7W8qeqzBG4cj4/Z3kp DivA== MIME-Version: 1.0 X-Received: by 10.180.75.49 with SMTP id z17mr3562876wiv.80.1406619544065; Tue, 29 Jul 2014 00:39:04 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.217.157.137 with HTTP; Tue, 29 Jul 2014 00:39:04 -0700 (PDT) In-Reply-To: <201407272254.s6RMsE4E049551@svn.freebsd.org> References: <201407272254.s6RMsE4E049551@svn.freebsd.org> Date: Tue, 29 Jul 2014 11:39:04 +0400 X-Google-Sender-Auth: dK0vB-Sdq6ObFGslye3MRNVxh1Q Message-ID: Subject: Re: svn commit: r269162 - in head/usr.bin/m4: . lib From: Sergey Kandaurov To: Baptiste Daroussin 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:39:06 -0000 On 28 July 2014 02:54, Baptiste Daroussin wrote: > Author: bapt > Date: Sun Jul 27 22:54:13 2014 > New Revision: 269162 > URL: http://svnweb.freebsd.org/changeset/base/269162 > > Log: > Sync with OpenBSD > This brings: > - check for integer overflows in custom allocs > - fix potential integer overflows in memory allocation > - annotate regexp error messages with source string > - better error handling in mkstemp/unlink/fdopen logic > > Added: > head/usr.bin/m4/lib/ohash.c (contents, props changed) [...] This broke gcc build. In file included from /src/usr.bin/m4/look.c:49: /src/usr.bin/m4/lib/ohash.h:62: warning: '__bounded__' attribute directive ignored http://tinderbox.freebsd.org/tinderbox-head-build-HEAD-mips-mips.brief -- wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 07:40:15 2014 Return-Path: Delivered-To: svn-src-all@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 0035DE73; Tue, 29 Jul 2014 07:40:14 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E1460246B; Tue, 29 Jul 2014 07:40:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T7eE4c016806; Tue, 29 Jul 2014 07:40:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T7eE19016804; Tue, 29 Jul 2014 07:40:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407290740.s6T7eE19016804@svn.freebsd.org> From: Alexander Motin Date: Tue, 29 Jul 2014 07:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269226 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 07:40:15 -0000 Author: mav Date: Tue Jul 29 07:40:14 2014 New Revision: 269226 URL: http://svnweb.freebsd.org/changeset/base/269226 Log: MFC r269122: Fix infinite loop, when doing WRITE SAME on file-backed LUN. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Tue Jul 29 07:36:38 2014 (r269225) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Tue Jul 29 07:40:14 2014 (r269226) @@ -725,10 +725,11 @@ ctl_be_block_dispatch_file(struct ctl_be } /* - * If this is a write, we're all done. + * If this is a write or a verify, we're all done. * If this is a read, we can now send the data to the user. */ - if (ARGS(io)->flags & (CTL_LLF_WRITE | CTL_LLF_VERIFY)) { + if ((beio->bio_cmd == BIO_WRITE) || + (ARGS(io)->flags & CTL_LLF_VERIFY)) { ctl_set_success(&io->scsiio); ctl_complete_beio(beio); } else { From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 08:31:11 2014 Return-Path: Delivered-To: svn-src-all@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 F33B2702; Tue, 29 Jul 2014 08:31: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E05652994; Tue, 29 Jul 2014 08:31:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T8VAKB039441; Tue, 29 Jul 2014 08:31:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T8VAAQ039440; Tue, 29 Jul 2014 08:31:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407290831.s6T8VAAQ039440@svn.freebsd.org> From: Alexander Motin Date: Tue, 29 Jul 2014 08:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269228 - head/sys/dev/sound/pcm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 08:31:11 -0000 Author: mav Date: Tue Jul 29 08:31:10 2014 New Revision: 269228 URL: http://svnweb.freebsd.org/changeset/base/269228 Log: Add support for SOUND_MIXER_INFO IOCTL, used by gstreamer. Submitted by: Dmitry Luhtionov MFC after: 2 weeks Modified: head/sys/dev/sound/pcm/mixer.c Modified: head/sys/dev/sound/pcm/mixer.c ============================================================================== --- head/sys/dev/sound/pcm/mixer.c Tue Jul 29 08:00:13 2014 (r269227) +++ head/sys/dev/sound/pcm/mixer.c Tue Jul 29 08:31:10 2014 (r269228) @@ -1221,6 +1221,15 @@ mixer_ioctl(struct cdev *i_dev, u_long c return (ret); } +static void +mixer_mixerinfo(struct snd_mixer *m, mixer_info *mi) +{ + bzero((void *)mi, sizeof(*mi)); + strlcpy(mi->id, m->name, sizeof(mi->id)); + strlcpy(mi->name, device_get_desc(m->dev), sizeof(mi->name)); + mi->modify_counter = m->modify_counter; +} + /* * XXX Make sure you can guarantee concurrency safety before calling this * function, be it through Giant, PCM_*, etc ! @@ -1279,6 +1288,10 @@ mixer_ioctl_cmd(struct cdev *i_dev, u_lo *arg_i = SOUND_VERSION; ret = 0; goto done; + case SOUND_MIXER_INFO: + mixer_mixerinfo(m, (mixer_info *)arg); + ret = 0; + goto done; } if ((cmd & ~0xff) == MIXER_WRITE(0)) { if (j == SOUND_MIXER_RECSRC) From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 08:42:24 2014 Return-Path: Delivered-To: svn-src-all@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 DF89DA29; Tue, 29 Jul 2014 08:42:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C971F2AA0; Tue, 29 Jul 2014 08:42:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T8gOWI044822; Tue, 29 Jul 2014 08:42:24 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T8gNET044814; Tue, 29 Jul 2014 08:42:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290842.s6T8gNET044814@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 08:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269229 - in head: cddl/contrib/opensolaris/common/avl sys/cddl/contrib/opensolaris/common/avl sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 08:42:25 -0000 Author: delphij Date: Tue Jul 29 08:42:22 2014 New Revision: 269229 URL: http://svnweb.freebsd.org/changeset/base/269229 Log: MFV r269223: Change dn->dn_dbufs from linked list to AVL tree. Illumos issues: 4873 zvol unmap calls can take a very long time for larger datasets MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/common/avl/avl.c head/sys/cddl/contrib/opensolaris/common/avl/avl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- head/cddl/contrib/opensolaris/common/avl/avl.c Tue Jul 29 08:31:10 2014 (r269228) +++ head/cddl/contrib/opensolaris/common/avl/avl.c Tue Jul 29 08:42:22 2014 (r269229) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -37,7 +41,7 @@ * insertion and deletion relatively efficiently. Searching the tree is * still a fast operation, roughly O(log(N)). * - * The key to insertion and deletion is a set of tree maniuplations called + * The key to insertion and deletion is a set of tree manipulations called * rotations, which bring unbalanced subtrees back into the semi-balanced state. * * This implementation of AVL trees has the following peculiarities: @@ -45,7 +49,7 @@ * - The AVL specific data structures are physically embedded as fields * in the "using" data structures. To maintain generality the code * must constantly translate between "avl_node_t *" and containing - * data structure "void *"s by adding/subracting the avl_offset. + * data structure "void *"s by adding/subtracting the avl_offset. * * - Since the AVL data is always embedded in other structures, there is * no locking or memory allocation in the AVL routines. This must be @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -94,7 +104,7 @@ #include /* - * Small arrays to translate between balance (or diff) values and child indeces. + * Small arrays to translate between balance (or diff) values and child indices. * * Code that deals with binary tree data structures will randomly use * left and right children when examining a tree. C "if()" statements @@ -114,7 +124,8 @@ static const int avl_balance2child[] = * * - If there is a left child, go to it, then to it's rightmost descendant. * - * - otherwise we return thru parent nodes until we've come from a right child. + * - otherwise we return through parent nodes until we've come from a right + * child. * * Return Value: * NULL - if at the end of the nodes @@ -863,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ @@ -919,7 +948,7 @@ avl_is_empty(avl_tree_t *tree) /* * Post-order tree walk used to visit all tree nodes and destroy the tree - * in post order. This is used for destroying a tree w/o paying any cost + * in post order. This is used for destroying a tree without paying any cost * for rebalancing it. * * example: Modified: head/sys/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/avl/avl.c Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/common/avl/avl.c Tue Jul 29 08:42:22 2014 (r269229) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -864,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Jul 29 08:42:22 2014 (r269229) @@ -69,6 +69,9 @@ dbuf_cons(void *vdb, void *unused, int k mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); refcount_create(&db->db_holds); + + db->db_creation = gethrtime(); + return (0); } @@ -330,7 +333,7 @@ dbuf_verify(dmu_buf_impl_t *db) ASSERT3U(db->db_level, <, dn->dn_nlevels); ASSERT(db->db_blkid == DMU_BONUS_BLKID || db->db_blkid == DMU_SPILL_BLKID || - !list_is_empty(&dn->dn_dbufs)); + !avl_is_empty(&dn->dn_dbufs)); } if (db->db_blkid == DMU_BONUS_BLKID) { ASSERT(dn != NULL); @@ -803,18 +806,30 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) * receive; see comment below for details. */ void -dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx) +dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, + dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db, *db_next, db_search; uint64_t txg = tx->tx_txg; + avl_index_t where; - if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) - end = dn->dn_maxblkid; - dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); + if (end_blkid > dn->dn_maxblkid && (end_blkid != DMU_SPILL_BLKID)) + end_blkid = dn->dn_maxblkid; + dprintf_dnode(dn, "start=%llu end=%llu\n", start_blkid, end_blkid); + + db_search.db_level = 0; + db_search.db_blkid = start_blkid; + db_search.db_creation = 0; mutex_enter(&dn->dn_dbufs_mtx); - if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) { + if (start_blkid >= dn->dn_unlisted_l0_blkid) { /* There can't be any dbufs in this range; no need to search. */ +#ifdef DEBUG + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + ASSERT(db == NULL || db->db_level > 0); +#endif mutex_exit(&dn->dn_dbufs_mtx); return; } else if (dmu_objset_is_receiving(dn->dn_objset)) { @@ -828,14 +843,18 @@ dbuf_free_range(dnode_t *dn, uint64_t st atomic_inc_64(&zfs_free_range_recv_miss); } - for (db = list_head(&dn->dn_dbufs); db != NULL; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + + for (; db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); - if (db->db_level != 0) - continue; - if (db->db_blkid < start || db->db_blkid > end) - continue; + if (db->db_level != 0 || db->db_blkid > end_blkid) { + break; + } + ASSERT3U(db->db_blkid, >=, start_blkid); /* found a level 0 buffer in the range */ mutex_enter(&db->db_mtx); @@ -1585,7 +1604,7 @@ dbuf_clear(dmu_buf_impl_t *db) dn = DB_DNODE(db); dndb = dn->dn_dbuf; if (db->db_blkid != DMU_BONUS_BLKID && MUTEX_HELD(&dn->dn_dbufs_mtx)) { - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); membar_producer(); DB_DNODE_EXIT(db); @@ -1748,7 +1767,7 @@ dbuf_create(dnode_t *dn, uint8_t level, mutex_exit(&dn->dn_dbufs_mtx); return (odb); } - list_insert_head(&dn->dn_dbufs, db); + avl_add(&dn->dn_dbufs, db); if (db->db_level == 0 && db->db_blkid >= dn->dn_unlisted_l0_blkid) dn->dn_unlisted_l0_blkid = db->db_blkid + 1; @@ -1807,7 +1826,7 @@ dbuf_destroy(dmu_buf_impl_t *db) DB_DNODE_ENTER(db); dn = DB_DNODE(db); mutex_enter(&dn->dn_dbufs_mtx); - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); mutex_exit(&dn->dn_dbufs_mtx); DB_DNODE_EXIT(db); @@ -1825,7 +1844,6 @@ dbuf_destroy(dmu_buf_impl_t *db) db->db_parent = NULL; db->db_buf = NULL; - ASSERT(!list_link_active(&db->db_link)); ASSERT(db->db.db_data == NULL); ASSERT(db->db_hash_next == NULL); ASSERT(db->db_blkptr == NULL); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jul 29 08:42:22 2014 (r269229) @@ -61,6 +61,43 @@ int zfs_default_ibs = DN_MAX_INDBLKSHIFT static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); #endif +static int +dbuf_compare(const void *x1, const void *x2) +{ + const dmu_buf_impl_t *d1 = x1; + const dmu_buf_impl_t *d2 = x2; + + if (d1->db_level < d2->db_level) { + return (-1); + } else if (d1->db_level > d2->db_level) { + return (1); + } + + if (d1->db_blkid < d2->db_blkid) { + return (-1); + } else if (d1->db_blkid > d2->db_blkid) { + return (1); + } + + /* + * If a dbuf is being evicted while dn_dbufs_mutex is not held, we set + * the db_state to DB_EVICTING but do not remove it from dn_dbufs. If + * another thread creates a dbuf of the same blkid before the dbuf is + * removed from dn_dbufs, we can reach a state where there are two + * dbufs of the same blkid and level in db_dbufs. To maintain the avl + * invariant that there cannot be duplicate items, we distinguish + * between these two dbufs based on the time they were created. + */ + if (d1->db_creation < d2->db_creation) { + return (-1); + } else if (d1->db_creation > d2->db_creation) { + return (1); + } else { + ASSERT3P(d1, ==, d2); + return (0); + } +} + /* ARGSUSED */ static int dnode_cons(void *arg, void *unused, int kmflag) @@ -115,7 +152,7 @@ dnode_cons(void *arg, void *unused, int dn->dn_dbufs_count = 0; dn->dn_unlisted_l0_blkid = 0; - list_create(&dn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); dn->dn_moved = 0; @@ -169,7 +206,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_dbufs_count); ASSERT0(dn->dn_unlisted_l0_blkid); - list_destroy(&dn->dn_dbufs); + avl_destroy(&dn->dn_dbufs); } void @@ -505,7 +542,7 @@ dnode_allocate(dnode_t *dn, dmu_object_t ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); for (i = 0; i < TXG_SIZE; i++) { ASSERT0(dn->dn_next_nblkptr[i]); @@ -690,8 +727,8 @@ dnode_move_impl(dnode_t *odn, dnode_t *n ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; ASSERT(refcount_count(&odn->dn_tx_holds) == 0); refcount_transfer(&ndn->dn_holds, &odn->dn_holds); - ASSERT(list_is_empty(&ndn->dn_dbufs)); - list_move_tail(&ndn->dn_dbufs, &odn->dn_dbufs); + ASSERT(avl_is_empty(&ndn->dn_dbufs)); + avl_swap(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; @@ -725,7 +762,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n */ odn->dn_dbuf = NULL; odn->dn_handle = NULL; - list_create(&odn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&odn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; odn->dn_unlisted_l0_blkid = 0; @@ -1236,7 +1273,8 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx return; } - ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs)); + ASSERT(!refcount_is_zero(&dn->dn_holds) || + !avl_is_empty(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); @@ -1309,7 +1347,7 @@ dnode_free(dnode_t *dn, dmu_tx_t *tx) int dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db; int err; if (size == 0) @@ -1332,9 +1370,8 @@ dnode_set_blksz(dnode_t *dn, uint64_t si goto fail; mutex_enter(&dn->dn_dbufs_mtx); - for (db = list_head(&dn->dn_dbufs); db; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); - + for (db = avl_first(&dn->dn_dbufs); db != NULL; + db = AVL_NEXT(&dn->dn_dbufs, db)) { if (db->db_blkid != 0 && db->db_blkid != DMU_BONUS_BLKID && db->db_blkid != DMU_SPILL_BLKID) { mutex_exit(&dn->dn_dbufs_mtx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Jul 29 08:42:22 2014 (r269229) @@ -400,16 +400,13 @@ dnode_evict_dbufs(dnode_t *dn) int pass = 0; do { - dmu_buf_impl_t *db, marker; + dmu_buf_impl_t *db, *db_next; int evicting = FALSE; progress = FALSE; mutex_enter(&dn->dn_dbufs_mtx); - list_insert_tail(&dn->dn_dbufs, &marker); - db = list_head(&dn->dn_dbufs); - for (; db != ▮ db = list_head(&dn->dn_dbufs)) { - list_remove(&dn->dn_dbufs, db); - list_insert_tail(&dn->dn_dbufs, db); + for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); #ifdef DEBUG DB_DNODE_ENTER(db); ASSERT3P(DB_DNODE(db), ==, dn); @@ -429,7 +426,6 @@ dnode_evict_dbufs(dnode_t *dn) } } - list_remove(&dn->dn_dbufs, &marker); /* * NB: we need to drop dn_dbufs_mtx between passes so * that any DB_EVICTING dbufs can make progress. @@ -500,7 +496,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *t dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); dnode_evict_dbufs(dn); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); ASSERT3P(dn->dn_bonus, ==, NULL); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Tue Jul 29 08:42:22 2014 (r269229) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -213,11 +213,14 @@ typedef struct dmu_buf_impl { /* pointer to most recent dirty record for this buffer */ dbuf_dirty_record_t *db_last_dirty; + /* Creation time of dbuf (see comment in dbuf_compare). */ + hrtime_t db_creation; + /* * Our link on the owner dnodes's dn_dbufs list. * Protected by its dn_dbufs_mtx. */ - list_node_t db_link; + avl_node_t db_link; /* Data which is unique to data (leaf) blocks: */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Jul 29 08:42:22 2014 (r269229) @@ -211,7 +211,7 @@ typedef struct dnode { refcount_t dn_holds; kmutex_t dn_dbufs_mtx; - list_t dn_dbufs; /* descendent dbufs */ + avl_tree_t dn_dbufs; /* descendent dbufs */ /* protected by dn_struct_rwlock */ struct dmu_buf_impl *dn_bonus; /* bonus buffer dbuf */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Tue Jul 29 08:31:10 2014 (r269228) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Tue Jul 29 08:42:22 2014 (r269229) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + #ifndef _AVL_H #define _AVL_H @@ -260,6 +264,11 @@ extern boolean_t avl_update_lt(avl_tree_ extern boolean_t avl_update_gt(avl_tree_t *, void *); /* + * Swaps the contents of the two trees. + */ +extern void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); + +/* * Return the number of nodes in the tree */ extern ulong_t avl_numnodes(avl_tree_t *tree); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 09:36:48 2014 Return-Path: Delivered-To: svn-src-all@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 B8E8BB8B; Tue, 29 Jul 2014 09:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D53021D9; Tue, 29 Jul 2014 09:36:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T9amJN068438; Tue, 29 Jul 2014 09:36:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T9amcr068437; Tue, 29 Jul 2014 09:36:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407290936.s6T9amcr068437@svn.freebsd.org> From: Xin LI Date: Tue, 29 Jul 2014 09:36:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269230 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 09:36:48 -0000 Author: delphij Date: Tue Jul 29 09:36:48 2014 New Revision: 269230 URL: http://svnweb.freebsd.org/changeset/base/269230 Log: MFV r269224: Increase default ARC buf_hash_table size. When typical block size is small, the hash table could be too small, which would lead to long hash chains and limit performance for cached reads. A new loader tunable, vfs.zfs.arc_average_blocksize, have been added which allows users to override the default assumption of average (typical) block size. Old default was 65536 (64 KiB) and new default is 8192 (8 KiB). Illumos issue: 5034 ARC's buf_hash_table is too small MFC after: 2 weeks 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 Tue Jul 29 08:42:22 2014 (r269229) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Jul 29 09:36:48 2014 (r269230) @@ -203,6 +203,7 @@ int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; int zfs_disable_dup_eviction = 0; +uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */ TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit); SYSCTL_DECL(_vfs_zfs); @@ -210,6 +211,9 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max "Maximum ARC size"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0, "Minimum ARC size"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_average_blocksize, CTLFLAG_RDTUN, + &zfs_arc_average_blocksize, 0, + "ARC average blocksize"); /* * Note that buffers can be in one of 6 states: @@ -1054,10 +1058,11 @@ buf_init(void) /* * The hash table is big enough to fill all of physical memory - * with an average 64K block size. The table will take up - * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers). + * with an average block size of zfs_arc_average_blocksize (default 8K). + * By default, the table will take up + * totalmem * sizeof(void*) / 8K (1MB per GB with 8-byte pointers). */ - while (hsize * 65536 < (uint64_t)physmem * PAGESIZE) + while (hsize * zfs_arc_average_blocksize < (uint64_t)physmem * PAGESIZE) hsize <<= 1; retry: buf_hash_table.ht_mask = hsize - 1; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 09:46:09 2014 Return-Path: Delivered-To: svn-src-all@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 3CB313C5; Tue, 29 Jul 2014 09:46: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A42023D9; Tue, 29 Jul 2014 09:46:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6T9k9WN072928; Tue, 29 Jul 2014 09:46:09 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6T9k9rO072927; Tue, 29 Jul 2014 09:46:09 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407290946.s6T9k9rO072927@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 29 Jul 2014 09:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269231 - head/usr.bin/m4/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 09:46:09 -0000 Author: bapt Date: Tue Jul 29 09:46:08 2014 New Revision: 269231 URL: http://svnweb.freebsd.org/changeset/base/269231 Log: Fix build with gcc Modified: head/usr.bin/m4/lib/ohash.h Modified: head/usr.bin/m4/lib/ohash.h ============================================================================== --- head/usr.bin/m4/lib/ohash.h Tue Jul 29 09:36:48 2014 (r269230) +++ head/usr.bin/m4/lib/ohash.h Tue Jul 29 09:46:08 2014 (r269231) @@ -58,8 +58,7 @@ void ohash_delete(struct ohash *); unsigned int ohash_lookup_interval(struct ohash *, const char *, const char *, uint32_t); unsigned int ohash_lookup_memory(struct ohash *, const char *, - size_t, uint32_t) - __attribute__ ((__bounded__(__string__,2,3))); + size_t, uint32_t); void *ohash_find(struct ohash *, unsigned int); void *ohash_remove(struct ohash *, unsigned int); void *ohash_insert(struct ohash *, unsigned int, void *); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 10:38:15 2014 Return-Path: Delivered-To: svn-src-all@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 386BF28A; Tue, 29 Jul 2014 10:38:15 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7E85284C; Tue, 29 Jul 2014 10:38:14 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.82 (FreeBSD)) (envelope-from ) id 1XC4nM-000ICh-9l; Tue, 29 Jul 2014 14:38:12 +0400 Date: Tue, 29 Jul 2014 14:38:12 +0400 From: Slawa Olhovchenkov To: Alan Cox Subject: Re: svn commit: r269134 - head/sys/vm Message-ID: <20140729103812.GA64229@zxy.spb.ru> References: <201407261810.s6QIAIIj049439@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201407261810.s6QIAIIj049439@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 10:38:15 -0000 On Sat, Jul 26, 2014 at 06:10:18PM +0000, Alan Cox wrote: > Author: alc > Date: Sat Jul 26 18:10:18 2014 > New Revision: 269134 > URL: http://svnweb.freebsd.org/changeset/base/269134 > > Log: > When unwiring a region of an address space, do not assume that the > underlying physical pages are mapped by the pmap. If, for example, the > application has performed an mprotect(..., PROT_NONE) on any part of the > wired region, then those pages will no longer be mapped by the pmap. > So, using the pmap to lookup the wired pages in order to unwire them > doesn't always work, and when it doesn't work wired pages are leaked. > > To avoid the leak, introduce and use a new function vm_object_unwire() > that locates the wired pages by traversing the object and its backing > objects. MFC planed? > At the same time, switch from using pmap_change_wiring() to the recently > introduced function pmap_unwire() for unwiring the region's mappings. > pmap_unwire() is faster, because it operates a range of virtual addresses > rather than a single virtual page at a time. Moreover, by operating on > a range, it is superpage friendly. It doesn't waste time performing > unnecessary demotions. > > Reported by: markj > Reviewed by: kib > Tested by: pho, jmg (arm) > Sponsored by: EMC / Isilon Storage Division From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 12:04:11 2014 Return-Path: Delivered-To: svn-src-all@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 99A76EE0; Tue, 29 Jul 2014 12:04: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87C2E24AE; Tue, 29 Jul 2014 12:04:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TC4BmH038140; Tue, 29 Jul 2014 12:04:11 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TC4BXF038139; Tue, 29 Jul 2014 12:04:11 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407291204.s6TC4BXF038139@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 29 Jul 2014 12:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269233 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 12:04:11 -0000 Author: ray Date: Tue Jul 29 12:04:11 2014 New Revision: 269233 URL: http://svnweb.freebsd.org/changeset/base/269233 Log: Remove SC_DFLT_FONT option. vt(4) don't use it. Suggested by: emaste Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B ============================================================================== --- head/sys/arm/conf/RPI-B Tue Jul 29 11:43:45 2014 (r269232) +++ head/sys/arm/conf/RPI-B Tue Jul 29 12:04:11 2014 (r269233) @@ -72,8 +72,6 @@ device pty # Comment following lines for boot console on serial port device vt device kbdmux -options SC_DFLT_FONT # compile font in -makeoptions SC_DFLT_FONT=cp437 device ukbd device sdhci From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 12:44:20 2014 Return-Path: Delivered-To: svn-src-all@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 C979E9ED; Tue, 29 Jul 2014 12:44:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B78B1294D; Tue, 29 Jul 2014 12:44:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TCiKrg056600; Tue, 29 Jul 2014 12:44:20 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TCiKd9056598; Tue, 29 Jul 2014 12:44:20 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201407291244.s6TCiKd9056598@svn.freebsd.org> From: Ruslan Bukin Date: Tue, 29 Jul 2014 12:44:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269234 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 12:44:20 -0000 Author: br Date: Tue Jul 29 12:44:19 2014 New Revision: 269234 URL: http://svnweb.freebsd.org/changeset/base/269234 Log: Remove unused option. Modified: head/sys/arm/conf/CHROMEBOOK head/sys/arm/conf/VYBRID Modified: head/sys/arm/conf/CHROMEBOOK ============================================================================== --- head/sys/arm/conf/CHROMEBOOK Tue Jul 29 12:04:11 2014 (r269233) +++ head/sys/arm/conf/CHROMEBOOK Tue Jul 29 12:44:19 2014 (r269234) @@ -28,8 +28,6 @@ device chrome_kb # Chrome Keyboard # Framebuffer device vt device kbdmux -options SC_DFLT_FONT # compile font in -makeoptions SC_DFLT_FONT=cp437 device ukbd #FDT Modified: head/sys/arm/conf/VYBRID ============================================================================== --- head/sys/arm/conf/VYBRID Tue Jul 29 12:04:11 2014 (r269233) +++ head/sys/arm/conf/VYBRID Tue Jul 29 12:44:19 2014 (r269234) @@ -148,8 +148,6 @@ device vf_spi # Framebuffer device vt device kbdmux -options SC_DFLT_FONT # compile font in -makeoptions SC_DFLT_FONT=cp437 device ukbd options FDT From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:08:38 2014 Return-Path: Delivered-To: svn-src-all@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 ED296307; Tue, 29 Jul 2014 13:08:37 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9E6B2C8F; Tue, 29 Jul 2014 13:08:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TD8bON066901; Tue, 29 Jul 2014 13:08:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TD8bBp066899; Tue, 29 Jul 2014 13:08:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291308.s6TD8bBp066899@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 13:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269235 - stable/10/sys/i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:08:38 -0000 Author: marius Date: Tue Jul 29 13:08:37 2014 New Revision: 269235 URL: http://svnweb.freebsd.org/changeset/base/269235 Log: MFC: r269050 - Copying and zeroing pages via temporary mappings involves updating the corresponding page tables followed by accesses to the pages in question. This sequence is subject to the situation exactly described in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency Considerations" [1, p. 171 f.]. Therefore, issuing the INVLPG right after modifying the PTE bits is crucial. For pmap_copy_page(), this has been broken in r124956 and later on carried over to pmap_copy_pages() derived from the former, while all other places in the i386 PMAP code use the correct order of instructions in this regard. Fixing the latter breakage solves the problem of data corruption seen with unmapped I/O enabled when running at least bare metal on AMD R-268D APUs. However, this might also fix similar corruption reported for virtualized environments. - In pmap_copy_pages(), correctly set the cache bits on the source page being copied. This change is thought to be a NOP for the real world, though. [2] 1: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/24593_APM_v21.pdf Submitted by: kib [2] Reviewed by: alc, kib Sponsored by: Bally Wulff Games & Entertainment GmbH Modified: stable/10/sys/i386/i386/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/pmap.c ============================================================================== --- stable/10/sys/i386/i386/pmap.c Tue Jul 29 12:44:19 2014 (r269234) +++ stable/10/sys/i386/i386/pmap.c Tue Jul 29 13:08:37 2014 (r269235) @@ -1286,6 +1286,13 @@ pmap_pte_release(pt_entry_t *pte) mtx_unlock(&PMAP2mutex); } +/* + * NB: The sequence of updating a page table followed by accesses to the + * corresponding pages is subject to the situation described in the "AMD64 + * Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, + * "7.3.1 Special Coherency Considerations". Therefore, issuing the INVLPG + * right after modifying the PTE bits is crucial. + */ static __inline void invlcaddr(void *caddr) { @@ -4240,12 +4247,12 @@ pmap_copy_page(vm_page_t src, vm_page_t if (*sysmaps->CMAP2) panic("pmap_copy_page: CMAP2 busy"); sched_pin(); - invlpg((u_int)sysmaps->CADDR1); - invlpg((u_int)sysmaps->CADDR2); *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | pmap_cache_bits(src->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR1); *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | pmap_cache_bits(dst->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR2); bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); *sysmaps->CMAP1 = 0; *sysmaps->CMAP2 = 0; @@ -4273,8 +4280,6 @@ pmap_copy_pages(vm_page_t ma[], vm_offse panic("pmap_copy_pages: CMAP2 busy"); sched_pin(); while (xfersize > 0) { - invlpg((u_int)sysmaps->CADDR1); - invlpg((u_int)sysmaps->CADDR2); a_pg = ma[a_offset >> PAGE_SHIFT]; a_pg_offset = a_offset & PAGE_MASK; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); @@ -4282,9 +4287,11 @@ pmap_copy_pages(vm_page_t ma[], vm_offse b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(a_pg) | PG_A | - pmap_cache_bits(b_pg->md.pat_mode, 0); + pmap_cache_bits(a_pg->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR1); *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(b_pg) | PG_A | PG_M | pmap_cache_bits(b_pg->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR2); a_cp = sysmaps->CADDR1 + a_pg_offset; b_cp = sysmaps->CADDR2 + b_pg_offset; bcopy(a_cp, b_cp, cnt); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:08:46 2014 Return-Path: Delivered-To: svn-src-all@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 9CDD5437; Tue, 29 Jul 2014 13:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89AAB2C94; Tue, 29 Jul 2014 13:08:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TD8k4A066970; Tue, 29 Jul 2014 13:08:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TD8kL5066969; Tue, 29 Jul 2014 13:08:46 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291308.s6TD8kL5066969@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 13:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269236 - stable/9/sys/i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:08:46 -0000 Author: marius Date: Tue Jul 29 13:08:46 2014 New Revision: 269236 URL: http://svnweb.freebsd.org/changeset/base/269236 Log: MFC: r269050 - Copying and zeroing pages via temporary mappings involves updating the corresponding page tables followed by accesses to the pages in question. This sequence is subject to the situation exactly described in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency Considerations" [1, p. 171 f.]. Therefore, issuing the INVLPG right after modifying the PTE bits is crucial. For pmap_copy_page(), this has been broken in r124956 and later on carried over to pmap_copy_pages() derived from the former, while all other places in the i386 PMAP code use the correct order of instructions in this regard. Fixing the latter breakage solves the problem of data corruption seen with unmapped I/O enabled when running at least bare metal on AMD R-268D APUs. However, this might also fix similar corruption reported for virtualized environments. - In pmap_copy_pages(), correctly set the cache bits on the source page being copied. This change is thought to be a NOP for the real world, though. [2] 1: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/24593_APM_v21.pdf Submitted by: kib [2] Reviewed by: alc, kib Sponsored by: Bally Wulff Games & Entertainment GmbH Modified: stable/9/sys/i386/i386/pmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/pmap.c ============================================================================== --- stable/9/sys/i386/i386/pmap.c Tue Jul 29 13:08:37 2014 (r269235) +++ stable/9/sys/i386/i386/pmap.c Tue Jul 29 13:08:46 2014 (r269236) @@ -1302,6 +1302,13 @@ pmap_pte_release(pt_entry_t *pte) mtx_unlock(&PMAP2mutex); } +/* + * NB: The sequence of updating a page table followed by accesses to the + * corresponding pages is subject to the situation described in the "AMD64 + * Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, + * "7.3.1 Special Coherency Considerations". Therefore, issuing the INVLPG + * right after modifying the PTE bits is crucial. + */ static __inline void invlcaddr(void *caddr) { @@ -4249,12 +4256,12 @@ pmap_copy_page(vm_page_t src, vm_page_t if (*sysmaps->CMAP2) panic("pmap_copy_page: CMAP2 busy"); sched_pin(); - invlpg((u_int)sysmaps->CADDR1); - invlpg((u_int)sysmaps->CADDR2); *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | pmap_cache_bits(src->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR1); *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | pmap_cache_bits(dst->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR2); bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); *sysmaps->CMAP1 = 0; *sysmaps->CMAP2 = 0; @@ -4282,8 +4289,6 @@ pmap_copy_pages(vm_page_t ma[], vm_offse panic("pmap_copy_pages: CMAP2 busy"); sched_pin(); while (xfersize > 0) { - invlpg((u_int)sysmaps->CADDR1); - invlpg((u_int)sysmaps->CADDR2); a_pg = ma[a_offset >> PAGE_SHIFT]; a_pg_offset = a_offset & PAGE_MASK; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); @@ -4291,9 +4296,11 @@ pmap_copy_pages(vm_page_t ma[], vm_offse b_pg_offset = b_offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - b_pg_offset); *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(a_pg) | PG_A | - pmap_cache_bits(b_pg->md.pat_mode, 0); + pmap_cache_bits(a_pg->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR1); *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(b_pg) | PG_A | PG_M | pmap_cache_bits(b_pg->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR2); a_cp = sysmaps->CADDR1 + a_pg_offset; b_cp = sysmaps->CADDR2 + b_pg_offset; bcopy(a_cp, b_cp, cnt); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:08:56 2014 Return-Path: Delivered-To: svn-src-all@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 B19D3568; Tue, 29 Jul 2014 13:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8228A2C98; Tue, 29 Jul 2014 13:08:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TD8umv067037; Tue, 29 Jul 2014 13:08:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TD8uFM067036; Tue, 29 Jul 2014 13:08:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291308.s6TD8uFM067036@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 13:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r269237 - stable/8/sys/i386/i386 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:08:56 -0000 Author: marius Date: Tue Jul 29 13:08:56 2014 New Revision: 269237 URL: http://svnweb.freebsd.org/changeset/base/269237 Log: MFC: r269050 (partial) Copying and zeroing pages via temporary mappings involves updating the corresponding page tables followed by accesses to the pages in question. This sequence is subject to the situation exactly described in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency Considerations" [1, p. 171 f.]. Therefore, issuing the INVLPG right after modifying the PTE bits is crucial. For pmap_copy_page(), this has been broken in r124956. 1: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/24593_APM_v21.pdf Reviewed by: alc, kib Sponsored by: Bally Wulff Games & Entertainment GmbH Modified: stable/8/sys/i386/i386/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/i386/ (props changed) Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Tue Jul 29 13:08:46 2014 (r269236) +++ stable/8/sys/i386/i386/pmap.c Tue Jul 29 13:08:56 2014 (r269237) @@ -1263,6 +1263,13 @@ pmap_pte_release(pt_entry_t *pte) mtx_unlock(&PMAP2mutex); } +/* + * NB: The sequence of updating a page table followed by accesses to the + * corresponding pages is subject to the situation described in the "AMD64 + * Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, + * "7.3.1 Special Coherency Considerations". Therefore, issuing the INVLPG + * right after modifying the PTE bits is crucial. + */ static __inline void invlcaddr(void *caddr) { @@ -4096,12 +4103,12 @@ pmap_copy_page(vm_page_t src, vm_page_t if (*sysmaps->CMAP2) panic("pmap_copy_page: CMAP2 busy"); sched_pin(); - invlpg((u_int)sysmaps->CADDR1); - invlpg((u_int)sysmaps->CADDR2); *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | pmap_cache_bits(src->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR1); *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | pmap_cache_bits(dst->md.pat_mode, 0); + invlcaddr(sysmaps->CADDR2); bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); *sysmaps->CMAP1 = 0; *sysmaps->CMAP2 = 0; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:11:38 2014 Return-Path: Delivered-To: svn-src-all@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 80EEF890; Tue, 29 Jul 2014 13:11: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6DEBD2D3A; Tue, 29 Jul 2014 13:11:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TDBcLw070685; Tue, 29 Jul 2014 13:11:38 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TDBcnm070684; Tue, 29 Jul 2014 13:11:38 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291311.s6TDBcnm070684@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 13:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269238 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:11:38 -0000 Author: marius Date: Tue Jul 29 13:11:37 2014 New Revision: 269238 URL: http://svnweb.freebsd.org/changeset/base/269238 Log: MFC: r269051 Copying pages via temporary mappings in the !DMAP case of pmap_copy_pages() involves updating the corresponding page tables followed by accesses to the pages in question. This sequence is subject to the situation exactly described in the "AMD64 Architecture Programmer's Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special Coherency Considerations" [1, p. 171 f.]. Therefore, issuing the INVLPG right after modifying the PTE bits is crucial (see also r269050, MFCed to stable/10 in r269235). For the amd64 PMAP code, the order of instructions was already correct. The above fact still is worth documenting, though. 1: http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/24593_APM_v21.pdf Reviewed by: alc Sponsored by: Bally Wulff Games & Entertainment GmbH Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Tue Jul 29 13:08:56 2014 (r269237) +++ stable/10/sys/amd64/amd64/pmap.c Tue Jul 29 13:11:37 2014 (r269238) @@ -4984,6 +4984,14 @@ pmap_copy_pages(vm_page_t ma[], vm_offse int cnt; boolean_t pinned; + /* + * NB: The sequence of updating a page table followed by accesses + * to the corresponding pages used in the !DMAP case is subject to + * the situation described in the "AMD64 Architecture Programmer's + * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special + * Coherency Considerations". Therefore, issuing the INVLPG right + * after modifying the PTE bits is crucial. + */ pinned = FALSE; while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:26:25 2014 Return-Path: Delivered-To: svn-src-all@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 3C715387; Tue, 29 Jul 2014 13:26: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A0F52F83; Tue, 29 Jul 2014 13:26:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TDQPfR076502; Tue, 29 Jul 2014 13:26:25 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TDQP9N076501; Tue, 29 Jul 2014 13:26:25 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291326.s6TDQP9N076501@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 13:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269239 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:26:25 -0000 Author: marius Date: Tue Jul 29 13:26:24 2014 New Revision: 269239 URL: http://svnweb.freebsd.org/changeset/base/269239 Log: Fix comment typo in r269052. Submitted by: Daniel O'Connor Modified: head/sys/x86/x86/mca.c Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Tue Jul 29 13:11:37 2014 (r269238) +++ head/sys/x86/x86/mca.c Tue Jul 29 13:26:24 2014 (r269239) @@ -253,7 +253,7 @@ mca_mute(const struct mca_record *rec) /* * Skip spurious corrected parity errors generated by desktop Haswell * (see HSD131 erratum) unless reporting is enabled. - * Note that these errors also have been observed with DO-stepping, + * Note that these errors also have been observed with D0-stepping, * while the revision 014 desktop Haswell specification update only * talks about CO-stepping. */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 13:40:34 2014 Return-Path: Delivered-To: svn-src-all@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 B3407BE4; Tue, 29 Jul 2014 13:40:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A06E4210E; Tue, 29 Jul 2014 13:40:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TDeYn0082372; Tue, 29 Jul 2014 13:40:34 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TDeY1d082370; Tue, 29 Jul 2014 13:40:34 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201407291340.s6TDeY1d082370@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 29 Jul 2014 13:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269240 - in 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 13:40:34 -0000 Author: pluknet Date: Tue Jul 29 13:40:33 2014 New Revision: 269240 URL: http://svnweb.freebsd.org/changeset/base/269240 Log: Add VOP_GETVOBJECT.9 to obsolete files, un-xref. X-MFC with: r269160 Modified: head/ObsoleteFiles.inc head/share/man/man9/vnode.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Jul 29 13:26:24 2014 (r269239) +++ head/ObsoleteFiles.inc Tue Jul 29 13:40:33 2014 (r269240) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20140728: Remove an obsolete man page +OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz # 20140723: renamed to PCBGROUP.9 OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz # 20140718: Remove obsolete man pages Modified: head/share/man/man9/vnode.9 ============================================================================== --- head/share/man/man9/vnode.9 Tue Jul 29 13:26:24 2014 (r269239) +++ head/share/man/man9/vnode.9 Tue Jul 29 13:40:33 2014 (r269240) @@ -170,7 +170,6 @@ intertwining of VM Objects and Vnodes. .Xr VOP_GETACL 9 , .Xr VOP_GETEXTATTR 9 , .Xr VOP_GETPAGES 9 , -.Xr VOP_GETVOBJECT 9 , .Xr VOP_INACTIVE 9 , .Xr VOP_IOCTL 9 , .Xr VOP_LINK 9 , From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 14:41:29 2014 Return-Path: Delivered-To: svn-src-all@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 09FC7344; Tue, 29 Jul 2014 14:41: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBD67278A; Tue, 29 Jul 2014 14:41:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TEfSbo016082; Tue, 29 Jul 2014 14:41:28 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TEfSKF016081; Tue, 29 Jul 2014 14:41:28 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407291441.s6TEfSKF016081@svn.freebsd.org> From: Ed Maste Date: Tue, 29 Jul 2014 14:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269241 - head/sys/dev/terasic/mtl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 14:41:29 -0000 Author: emaste Date: Tue Jul 29 14:41:28 2014 New Revision: 269241 URL: http://svnweb.freebsd.org/changeset/base/269241 Log: Correct typo in comment Modified: head/sys/dev/terasic/mtl/terasic_mtl.h Modified: head/sys/dev/terasic/mtl/terasic_mtl.h ============================================================================== --- head/sys/dev/terasic/mtl/terasic_mtl.h Tue Jul 29 13:40:33 2014 (r269240) +++ head/sys/dev/terasic/mtl/terasic_mtl.h Tue Jul 29 14:41:28 2014 (r269241) @@ -62,7 +62,7 @@ struct terasic_mtl_softc { int mtl_reg_rid; /* - * Graphics frame buffer device -- mappable form userspace. + * Graphics frame buffer device -- mappable from userspace. */ struct cdev *mtl_pixel_cdev; struct resource *mtl_pixel_res; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 14:54:23 2014 Return-Path: Delivered-To: svn-src-all@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 A776F72C; Tue, 29 Jul 2014 14:54: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94D8F28F4; Tue, 29 Jul 2014 14:54:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TEsN9F023197; Tue, 29 Jul 2014 14:54:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TEsNUw023196; Tue, 29 Jul 2014 14:54:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201407291454.s6TEsNUw023196@svn.freebsd.org> From: Marius Strobl Date: Tue, 29 Jul 2014 14:54:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269242 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 14:54:23 -0000 Author: marius Date: Tue Jul 29 14:54:23 2014 New Revision: 269242 URL: http://svnweb.freebsd.org/changeset/base/269242 Log: Fix yet another comment typo in r269052. Modified: head/sys/x86/x86/mca.c Modified: head/sys/x86/x86/mca.c ============================================================================== --- head/sys/x86/x86/mca.c Tue Jul 29 14:41:28 2014 (r269241) +++ head/sys/x86/x86/mca.c Tue Jul 29 14:54:23 2014 (r269242) @@ -255,7 +255,7 @@ mca_mute(const struct mca_record *rec) * (see HSD131 erratum) unless reporting is enabled. * Note that these errors also have been observed with D0-stepping, * while the revision 014 desktop Haswell specification update only - * talks about CO-stepping. + * talks about C0-stepping. */ if (rec->mr_cpu_vendor_id == CPU_VENDOR_INTEL && rec->mr_cpu_id == 0x306c3 && rec->mr_bank == 0 && From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 15:01:31 2014 Return-Path: Delivered-To: svn-src-all@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 0AA96C3F; Tue, 29 Jul 2014 15:01: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF34229C2; Tue, 29 Jul 2014 15:01:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TF1UH6028345; Tue, 29 Jul 2014 15:01:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TF1TZL028335; Tue, 29 Jul 2014 15:01:29 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201407291501.s6TF1TZL028335@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 29 Jul 2014 15:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269243 - in head: share/man/man9 sys/net sys/netinet 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 15:01:31 -0000 Author: glebius Date: Tue Jul 29 15:01:29 2014 New Revision: 269243 URL: http://svnweb.freebsd.org/changeset/base/269243 Log: Garbage collect couple of unused fields from struct ifaddr: - ifa_claim_addr() unused since removal of NetAtalk - ifa_metric seems to be never utilized, always a copy of if_metric Modified: head/share/man/man9/ifnet.9 head/sys/net/if.c head/sys/net/if.h head/sys/net/if_var.h head/sys/net/rtsock.c head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/share/man/man9/ifnet.9 ============================================================================== --- head/share/man/man9/ifnet.9 Tue Jul 29 14:54:23 2014 (r269242) +++ head/share/man/man9/ifnet.9 Tue Jul 29 15:01:29 2014 (r269243) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2013 +.Dd July 29, 2014 .Dt IFNET 9 .Os .Sh NAME @@ -1084,10 +1084,6 @@ address in the route table. .It Va ifa_refcnt .Pq Vt short The reference count. -.It Va ifa_metric -.Pq Vt int -A metric associated with this interface address, for the use of some -external routing protocol. .El .Pp References to Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/net/if.c Tue Jul 29 15:01:29 2014 (r269243) @@ -1747,19 +1747,6 @@ next: continue; } } else { /* - * if we have a special address handler, - * then use it instead of the generic one. - */ - if (ifa->ifa_claim_addr) { - if ((*ifa->ifa_claim_addr)(ifa, addr)) { - ifa_ref(ifa); - IF_ADDR_RUNLOCK(ifp); - goto done; - } - continue; - } - - /* * Scan all the bits in the ifa's address. * If a bit dissagrees with what we are * looking for, mask it with the netmask Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/net/if.h Tue Jul 29 15:01:29 2014 (r269243) @@ -304,7 +304,7 @@ struct ifa_msghdr { int ifam_addrs; /* like rtm_addrs */ int ifam_flags; /* value of ifa_flags */ u_short ifam_index; /* index for associated ifp */ - int ifam_metric; /* value of ifa_metric */ + int ifam_metric; /* value of ifa_ifp->if_metric */ }; /* @@ -329,7 +329,7 @@ struct ifa_msghdrl { u_short _ifam_spare1; /* spare space to grow if_index, see if_var.h */ u_short ifam_len; /* length of ifa_msghdrl incl. if_data */ u_short ifam_data_off; /* offset of if_data from beginning */ - int ifam_metric; /* value of ifa_metric */ + int ifam_metric; /* value of ifa_ifp->if_metric */ struct if_data ifam_data;/* statistics and other data about if or * address */ }; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/net/if_var.h Tue Jul 29 15:01:29 2014 (r269243) @@ -366,9 +366,6 @@ struct ifaddr { (int, struct rtentry *, struct rt_addrinfo *); u_short ifa_flags; /* mostly rt_flags for cloning */ u_int ifa_refcnt; /* references to this structure */ - int ifa_metric; /* cost of going out this interface */ - int (*ifa_claim_addr) /* check if an addr goes to this if */ - (struct ifaddr *, struct sockaddr *); counter_u64_t ifa_ipackets; counter_u64_t ifa_opackets; Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/net/rtsock.c Tue Jul 29 15:01:29 2014 (r269243) @@ -1289,7 +1289,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i return (ENOBUFS); ifam = mtod(m, struct ifa_msghdr *); ifam->ifam_index = ifp->if_index; - ifam->ifam_metric = ifa->ifa_metric; + ifam->ifam_metric = ifa->ifa_ifp->if_metric; ifam->ifam_flags = ifa->ifa_flags; ifam->ifam_addrs = info.rti_addrs; @@ -1638,7 +1638,7 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, ifam32->ifam_len = sizeof(*ifam32); ifam32->ifam_data_off = offsetof(struct ifa_msghdrl32, ifam_data); - ifam32->ifam_metric = ifa->ifa_metric; + ifam32->ifam_metric = ifa->ifa_ifp->if_metric; ifd = &ifam32->ifam_data; } else #endif @@ -1649,7 +1649,7 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, ifam->_ifam_spare1 = 0; ifam->ifam_len = sizeof(*ifam); ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data); - ifam->ifam_metric = ifa->ifa_metric; + ifam->ifam_metric = ifa->ifa_ifp->if_metric; ifd = &ifam->ifam_data; } @@ -1677,7 +1677,7 @@ sysctl_iflist_ifam(struct ifaddr *ifa, s ifam->ifam_addrs = info->rti_addrs; ifam->ifam_flags = ifa->ifa_flags; ifam->ifam_index = ifa->ifa_ifp->if_index; - ifam->ifam_metric = ifa->ifa_metric; + ifam->ifam_metric = ifa->ifa_ifp->if_metric; return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); } Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/netinet/in.c Tue Jul 29 15:01:29 2014 (r269243) @@ -363,7 +363,6 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask; ia->ia_ifp = ifp; - ia->ia_ifa.ifa_metric = ifp->if_metric; ia->ia_addr = *addr; if (mask->sin_len != 0) { ia->ia_sockmask = *mask; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jul 29 14:54:23 2014 (r269242) +++ head/sys/netinet6/in6.c Tue Jul 29 15:01:29 2014 (r269243) @@ -1249,9 +1249,6 @@ in6_update_ifa_internal(struct ifnet *if ia->ia6_lifetime.ia6t_preferred = time_uptime; } - /* Update metric */ - ia->ia_ifa.ifa_metric = ifp->if_metric; - /* * configure address flags. */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 16:42:35 2014 Return-Path: Delivered-To: svn-src-all@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 EFBD5FCD; Tue, 29 Jul 2014 16:42:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCE2726F1; Tue, 29 Jul 2014 16:42:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TGgYwQ089548; Tue, 29 Jul 2014 16:42:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TGgY8t089547; Tue, 29 Jul 2014 16:42:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407291642.s6TGgY8t089547@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Jul 2014 16:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269244 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 16:42:35 -0000 Author: kib Date: Tue Jul 29 16:42:34 2014 New Revision: 269244 URL: http://svnweb.freebsd.org/changeset/base/269244 Log: Remove one-time use macros which check for the vnode lifecycle. More, some parts of the checks are in fact redundand in the surrounding code, and it is more clear what the conditions are by direct testing of the flags. Two of the three macros were only used in assertions. In vnlru_free(), all relevant parts of vholdl() were already inlined, except the increment of v_holdcnt itself. Do not call vholdl() to do the increment as well, this allows to make assertions in vholdl()/vhold() more strict. In v_incr_usecount(), call vholdl() before incrementing other ref counters. The change is no-op, but it makes less surprising to see the vnode state in debugger if interrupted inside v_incr_usecount(). Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Jul 29 15:01:29 2014 (r269243) +++ head/sys/kern/vfs_subr.c Tue Jul 29 16:42:34 2014 (r269244) @@ -275,14 +275,6 @@ static int vnlru_nowhere; SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW, &vnlru_nowhere, 0, "Number of times the vnlru process ran without success"); -/* - * Macros to control when a vnode is freed and recycled. All require - * the vnode interlock. - */ -#define VCANRECYCLE(vp) (((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt) -#define VSHOULDFREE(vp) (!((vp)->v_iflag & VI_FREE) && !(vp)->v_holdcnt) -#define VSHOULDBUSY(vp) (((vp)->v_iflag & VI_FREE) && (vp)->v_holdcnt) - /* Shift count for (uintptr_t)vp to initialize vp->v_hash. */ static int vnsz2log; @@ -849,11 +841,21 @@ vnlru_free(int count) TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_actfreelist); continue; } - VNASSERT(VCANRECYCLE(vp), vp, - ("vp inconsistent on freelist")); + VNASSERT((vp->v_iflag & VI_FREE) != 0 && vp->v_holdcnt == 0, + vp, ("vp inconsistent on freelist")); + + /* + * The clear of VI_FREE prevents activation of the + * vnode. There is no sense in putting the vnode on + * the mount point active list, only to remove it + * later during recycling. Inline the relevant part + * of vholdl(), to avoid triggering assertions or + * activating. + */ freevnodes--; vp->v_iflag &= ~VI_FREE; - vholdl(vp); + vp->v_holdcnt++; + mtx_unlock(&vnode_free_list_mtx); VI_UNLOCK(vp); vtryrecycle(vp); @@ -2042,13 +2044,13 @@ v_incr_usecount(struct vnode *vp) { CTR2(KTR_VFS, "%s: vp %p", __func__, vp); + vholdl(vp); vp->v_usecount++; if (vp->v_type == VCHR && vp->v_rdev != NULL) { dev_lock(); vp->v_rdev->si_usecount++; dev_unlock(); } - vholdl(vp); } /* @@ -2325,11 +2327,18 @@ vholdl(struct vnode *vp) struct mount *mp; CTR2(KTR_VFS, "%s: vp %p", __func__, vp); +#ifdef INVARIANTS + /* getnewvnode() calls v_incr_usecount() without holding interlock. */ + if (vp->v_type != VNON || vp->v_data != NULL) { + ASSERT_VI_LOCKED(vp, "vholdl"); + VNASSERT(vp->v_holdcnt > 0 || (vp->v_iflag & VI_FREE) != 0, + vp, ("vholdl: free vnode is held")); + } +#endif vp->v_holdcnt++; - if (!VSHOULDBUSY(vp)) + if ((vp->v_iflag & VI_FREE) == 0) return; - ASSERT_VI_LOCKED(vp, "vholdl"); - VNASSERT((vp->v_iflag & VI_FREE) != 0, vp, ("vnode not free")); + VNASSERT(vp->v_holdcnt == 1, vp, ("vholdl: wrong hold count")); VNASSERT(vp->v_op != NULL, vp, ("vholdl: vnode already reclaimed.")); /* * Remove a vnode from the free list, mark it as in use, @@ -2392,7 +2401,7 @@ vdropl(struct vnode *vp) ("vdropl: vnode already reclaimed.")); VNASSERT((vp->v_iflag & VI_FREE) == 0, vp, ("vnode already free")); - VNASSERT(VSHOULDFREE(vp), vp, + VNASSERT(vp->v_holdcnt == 0, vp, ("vdropl: freeing when we shouldn't")); active = vp->v_iflag & VI_ACTIVE; vp->v_iflag &= ~VI_ACTIVE; From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 18:31:27 2014 Return-Path: Delivered-To: svn-src-all@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 A72D3528; Tue, 29 Jul 2014 18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87ABD224E; Tue, 29 Jul 2014 18:31:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TIVRRZ065911; Tue, 29 Jul 2014 18:31:27 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TIVRIe065910; Tue, 29 Jul 2014 18:31:27 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407291831.s6TIVRIe065910@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 18:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269245 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 18:31:27 -0000 Author: markj Date: Tue Jul 29 18:31:27 2014 New Revision: 269245 URL: http://svnweb.freebsd.org/changeset/base/269245 Log: MFC r262669: When our linker merges .SUNW_dof sections from multiple files, it simply concatenates the DOF tables into one section. Previously, the USDT init code in drti.o would only look at the first table in the DOF section; with this change, it iterates over all the tables, passing each DOF table to the kernel. PR: 186821 Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Tue Jul 29 16:42:34 2014 (r269244) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Tue Jul 29 18:31:27 2014 (r269245) @@ -20,6 +20,7 @@ */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2013 Voxer Inc. All rights reserved. * Use is subject to license terms. */ @@ -144,7 +145,8 @@ dtrace_dof_init(void) Lmid_t lmid; #else u_long lmid = 0; - dof_sec_t *sec; + dof_sec_t *sec, *secstart, *dofstrtab, *dofprobes; + dof_provider_t *dofprovider; size_t i; #endif int fd; @@ -152,14 +154,15 @@ dtrace_dof_init(void) #if !defined(sun) Elf *e; Elf_Scn *scn = NULL; - Elf_Data *symtabdata = NULL, *dynsymdata = NULL; + Elf_Data *symtabdata = NULL, *dynsymdata = NULL, *dofdata = NULL; + dof_hdr_t *dof_next = NULL; GElf_Shdr shdr; int efd, nprobes; char *s; + char *dofstrtabraw; size_t shstridx, symtabidx = 0, dynsymidx = 0; - unsigned char *dofstrtab = NULL; unsigned char *buf; - int fixedprobes = 0; + int fixedprobes; #endif if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) @@ -209,7 +212,8 @@ dtrace_dof_init(void) } else if (shdr.sh_type == SHT_PROGBITS) { s = elf_strptr(e, shstridx, shdr.sh_name); if (s && strcmp(s, ".SUNW_dof") == 0) { - dof = elf_getdata(scn, NULL)->d_buf; + dofdata = elf_getdata(scn, NULL); + dof = dofdata->d_buf; } } } @@ -219,6 +223,10 @@ dtrace_dof_init(void) close(efd); return; } + + while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) { + fixedprobes = 0; + dof_next = (void *) ((char *) dof + dof->dofh_filesz); #endif if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 || @@ -290,34 +298,49 @@ dtrace_dof_init(void) * We are assuming the number of probes is less than the number of * symbols (libc can have 4k symbols, for example). */ - sec = (dof_sec_t *)(dof + 1); + secstart = sec = (dof_sec_t *)(dof + 1); buf = (char *)dof; for (i = 0; i < dof->dofh_secnum; i++, sec++) { - if (sec->dofs_type == DOF_SECT_STRTAB) - dofstrtab = (unsigned char *)(buf + sec->dofs_offset); - else if (sec->dofs_type == DOF_SECT_PROBES && dofstrtab) + if (sec->dofs_type != DOF_SECT_PROVIDER) + continue; + + dofprovider = (void *) (buf + sec->dofs_offset); + dofstrtab = secstart + dofprovider->dofpv_strtab; + dofprobes = secstart + dofprovider->dofpv_probes; + + if (dofstrtab->dofs_type != DOF_SECT_STRTAB) { + fprintf(stderr, "WARNING: expected STRTAB section, but got %d\n", + dofstrtab->dofs_type); break; - - } - nprobes = sec->dofs_size / sec->dofs_entsize; - fixsymbol(e, symtabdata, symtabidx, nprobes, buf, sec, &fixedprobes, - dofstrtab); - if (fixedprobes != nprobes) { - /* - * If we haven't fixed all the probes using the - * symtab section, look inside the dynsym - * section. - */ - fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, sec, - &fixedprobes, dofstrtab); - } - if (fixedprobes != nprobes) { - fprintf(stderr, "WARNING: number of probes " - "fixed does not match the number of " - "defined probes (%d != %d, " - "respectively)\n", fixedprobes, nprobes); - fprintf(stderr, "WARNING: some probes might " - "not fire or your program might crash\n"); + } + if (dofprobes->dofs_type != DOF_SECT_PROBES) { + fprintf(stderr, "WARNING: expected PROBES section, but got %d\n", + dofprobes->dofs_type); + break; + } + + dprintf(1, "found provider %p\n", dofprovider); + dofstrtabraw = (char *)(buf + dofstrtab->dofs_offset); + nprobes = dofprobes->dofs_size / dofprobes->dofs_entsize; + fixsymbol(e, symtabdata, symtabidx, nprobes, buf, dofprobes, &fixedprobes, + dofstrtabraw); + if (fixedprobes != nprobes) { + /* + * If we haven't fixed all the probes using the + * symtab section, look inside the dynsym + * section. + */ + fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, dofprobes, + &fixedprobes, dofstrtabraw); + } + if (fixedprobes != nprobes) { + fprintf(stderr, "WARNING: number of probes " + "fixed does not match the number of " + "defined probes (%d != %d, " + "respectively)\n", fixedprobes, nprobes); + fprintf(stderr, "WARNING: some probes might " + "not fire or your program might crash\n"); + } } #endif if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1) @@ -330,7 +353,12 @@ dtrace_dof_init(void) } (void) close(fd); + #if !defined(sun) + /* End of while loop */ + dof = dof_next; + } + elf_end(e); (void) close(efd); #endif From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 18:31:45 2014 Return-Path: Delivered-To: svn-src-all@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 1604865D; Tue, 29 Jul 2014 18:31: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98BB2257; Tue, 29 Jul 2014 18:31:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TIVibd066005; Tue, 29 Jul 2014 18:31:44 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TIVinj066004; Tue, 29 Jul 2014 18:31:44 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407291831.s6TIVinj066004@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 18:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269246 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 18:31:45 -0000 Author: markj Date: Tue Jul 29 18:31:44 2014 New Revision: 269246 URL: http://svnweb.freebsd.org/changeset/base/269246 Log: MFC r262669: When our linker merges .SUNW_dof sections from multiple files, it simply concatenates the DOF tables into one section. Previously, the USDT init code in drti.o would only look at the first table in the DOF section; with this change, it iterates over all the tables, passing each DOF table to the kernel. PR: 186821 Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Tue Jul 29 18:31:27 2014 (r269245) +++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Tue Jul 29 18:31:44 2014 (r269246) @@ -20,6 +20,7 @@ */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2013 Voxer Inc. All rights reserved. * Use is subject to license terms. */ @@ -144,7 +145,8 @@ dtrace_dof_init(void) Lmid_t lmid; #else u_long lmid = 0; - dof_sec_t *sec; + dof_sec_t *sec, *secstart, *dofstrtab, *dofprobes; + dof_provider_t *dofprovider; size_t i; #endif int fd; @@ -152,14 +154,15 @@ dtrace_dof_init(void) #if !defined(sun) Elf *e; Elf_Scn *scn = NULL; - Elf_Data *symtabdata = NULL, *dynsymdata = NULL; + Elf_Data *symtabdata = NULL, *dynsymdata = NULL, *dofdata = NULL; + dof_hdr_t *dof_next = NULL; GElf_Shdr shdr; int efd, nprobes; char *s; + char *dofstrtabraw; size_t shstridx, symtabidx = 0, dynsymidx = 0; - unsigned char *dofstrtab = NULL; unsigned char *buf; - int fixedprobes = 0; + int fixedprobes; #endif if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) @@ -209,7 +212,8 @@ dtrace_dof_init(void) } else if (shdr.sh_type == SHT_PROGBITS) { s = elf_strptr(e, shstridx, shdr.sh_name); if (s && strcmp(s, ".SUNW_dof") == 0) { - dof = elf_getdata(scn, NULL)->d_buf; + dofdata = elf_getdata(scn, NULL); + dof = dofdata->d_buf; } } } @@ -219,6 +223,10 @@ dtrace_dof_init(void) close(efd); return; } + + while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) { + fixedprobes = 0; + dof_next = (void *) ((char *) dof + dof->dofh_filesz); #endif if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 || @@ -290,34 +298,49 @@ dtrace_dof_init(void) * We are assuming the number of probes is less than the number of * symbols (libc can have 4k symbols, for example). */ - sec = (dof_sec_t *)(dof + 1); + secstart = sec = (dof_sec_t *)(dof + 1); buf = (char *)dof; for (i = 0; i < dof->dofh_secnum; i++, sec++) { - if (sec->dofs_type == DOF_SECT_STRTAB) - dofstrtab = (unsigned char *)(buf + sec->dofs_offset); - else if (sec->dofs_type == DOF_SECT_PROBES && dofstrtab) + if (sec->dofs_type != DOF_SECT_PROVIDER) + continue; + + dofprovider = (void *) (buf + sec->dofs_offset); + dofstrtab = secstart + dofprovider->dofpv_strtab; + dofprobes = secstart + dofprovider->dofpv_probes; + + if (dofstrtab->dofs_type != DOF_SECT_STRTAB) { + fprintf(stderr, "WARNING: expected STRTAB section, but got %d\n", + dofstrtab->dofs_type); break; - - } - nprobes = sec->dofs_size / sec->dofs_entsize; - fixsymbol(e, symtabdata, symtabidx, nprobes, buf, sec, &fixedprobes, - dofstrtab); - if (fixedprobes != nprobes) { - /* - * If we haven't fixed all the probes using the - * symtab section, look inside the dynsym - * section. - */ - fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, sec, - &fixedprobes, dofstrtab); - } - if (fixedprobes != nprobes) { - fprintf(stderr, "WARNING: number of probes " - "fixed does not match the number of " - "defined probes (%d != %d, " - "respectively)\n", fixedprobes, nprobes); - fprintf(stderr, "WARNING: some probes might " - "not fire or your program might crash\n"); + } + if (dofprobes->dofs_type != DOF_SECT_PROBES) { + fprintf(stderr, "WARNING: expected PROBES section, but got %d\n", + dofprobes->dofs_type); + break; + } + + dprintf(1, "found provider %p\n", dofprovider); + dofstrtabraw = (char *)(buf + dofstrtab->dofs_offset); + nprobes = dofprobes->dofs_size / dofprobes->dofs_entsize; + fixsymbol(e, symtabdata, symtabidx, nprobes, buf, dofprobes, &fixedprobes, + dofstrtabraw); + if (fixedprobes != nprobes) { + /* + * If we haven't fixed all the probes using the + * symtab section, look inside the dynsym + * section. + */ + fixsymbol(e, dynsymdata, dynsymidx, nprobes, buf, dofprobes, + &fixedprobes, dofstrtabraw); + } + if (fixedprobes != nprobes) { + fprintf(stderr, "WARNING: number of probes " + "fixed does not match the number of " + "defined probes (%d != %d, " + "respectively)\n", fixedprobes, nprobes); + fprintf(stderr, "WARNING: some probes might " + "not fire or your program might crash\n"); + } } #endif if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1) @@ -330,7 +353,12 @@ dtrace_dof_init(void) } (void) close(fd); + #if !defined(sun) + /* End of while loop */ + dof = dof_next; + } + elf_end(e); (void) close(efd); #endif From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 19:38:17 2014 Return-Path: Delivered-To: svn-src-all@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 97BCAF35; Tue, 29 Jul 2014 19:38:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 856B42A06; Tue, 29 Jul 2014 19:38:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TJcHhT011732; Tue, 29 Jul 2014 19:38:17 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TJcH2U011731; Tue, 29 Jul 2014 19:38:17 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201407291938.s6TJcH2U011731@svn.freebsd.org> From: Joel Dahl Date: Tue, 29 Jul 2014 19:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269247 - head/sbin/geom/class/virstor X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 19:38:17 -0000 Author: joel (doc committer) Date: Tue Jul 29 19:38:17 2014 New Revision: 269247 URL: http://svnweb.freebsd.org/changeset/base/269247 Log: mdoc: sort sections. Modified: head/sbin/geom/class/virstor/gvirstor.8 Modified: head/sbin/geom/class/virstor/gvirstor.8 ============================================================================== --- head/sbin/geom/class/virstor/gvirstor.8 Tue Jul 29 18:31:44 2014 (r269246) +++ head/sbin/geom/class/virstor/gvirstor.8 Tue Jul 29 19:38:17 2014 (r269247) @@ -257,6 +257,10 @@ The .Nm utility first appeared in .Fx 7.0 . +.Sh AUTHORS +.An Ivan Voras Aq Mt ivoras@FreeBSD.org +.Pp +Sponsored by Google Summer of Code 2006. .Sh BUGS Commands .Cm add @@ -293,7 +297,3 @@ and all their structures will be physica of the first virstor component. This could have a significant impact on file system performance .Pq which can in some rare cases be even positive . -.Sh AUTHORS -.An Ivan Voras Aq Mt ivoras@FreeBSD.org -.Pp -Sponsored by Google Summer of Code 2006. From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 19:41:01 2014 Return-Path: Delivered-To: svn-src-all@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 6B0C14A1; Tue, 29 Jul 2014 19:41: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 408EC2A8A; Tue, 29 Jul 2014 19:41:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TJf1Cu013210; Tue, 29 Jul 2014 19:41:01 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TJf1mt013209; Tue, 29 Jul 2014 19:41:01 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201407291941.s6TJf1mt013209@svn.freebsd.org> From: Joel Dahl Date: Tue, 29 Jul 2014 19:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269248 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 19:41:01 -0000 Author: joel (doc committer) Date: Tue Jul 29 19:41:00 2014 New Revision: 269248 URL: http://svnweb.freebsd.org/changeset/base/269248 Log: Silence mandoc lint. Modified: head/share/man/man3/offsetof.3 Modified: head/share/man/man3/offsetof.3 ============================================================================== --- head/share/man/man3/offsetof.3 Tue Jul 29 19:38:17 2014 (r269247) +++ head/share/man/man3/offsetof.3 Tue Jul 29 19:41:00 2014 (r269248) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 18 2010 +.Dd February 18, 2010 .Dt OFFSETOF 3 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 19:43:01 2014 Return-Path: Delivered-To: svn-src-all@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 30B817F2; Tue, 29 Jul 2014 19:43: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E4CD2B4A; Tue, 29 Jul 2014 19:43:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TJh09H015712; Tue, 29 Jul 2014 19:43:00 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TJh03p015711; Tue, 29 Jul 2014 19:43:00 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201407291943.s6TJh03p015711@svn.freebsd.org> From: Joel Dahl Date: Tue, 29 Jul 2014 19:43:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269249 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 19:43:01 -0000 Author: joel (doc committer) Date: Tue Jul 29 19:43:00 2014 New Revision: 269249 URL: http://svnweb.freebsd.org/changeset/base/269249 Log: mdoc: remove superfluous paragraph macro. Modified: head/share/man/man9/pmap_unwire.9 Modified: head/share/man/man9/pmap_unwire.9 ============================================================================== --- head/share/man/man9/pmap_unwire.9 Tue Jul 29 19:41:00 2014 (r269248) +++ head/share/man/man9/pmap_unwire.9 Tue Jul 29 19:43:00 2014 (r269249) @@ -40,7 +40,6 @@ .Fa "pmap_t pmap" "vm_offset_t start" "vm_offset_t end" .Fc .Sh DESCRIPTION -.Pp The function .Fn pmap_unwire removes the wired attribute from each of the virtual-to-physical page mappings From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 19:46:14 2014 Return-Path: Delivered-To: svn-src-all@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 38FE0B0F; Tue, 29 Jul 2014 19:46:14 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 254E32B75; Tue, 29 Jul 2014 19:46:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TJkEBM016312; Tue, 29 Jul 2014 19:46:14 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TJkDSA016309; Tue, 29 Jul 2014 19:46:13 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201407291946.s6TJkDSA016309@svn.freebsd.org> From: Joel Dahl Date: Tue, 29 Jul 2014 19:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269250 - in head/usr.bin/m4: . lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 19:46:14 -0000 Author: joel (doc committer) Date: Tue Jul 29 19:46:13 2014 New Revision: 269250 URL: http://svnweb.freebsd.org/changeset/base/269250 Log: mdoc: fix date. Modified: head/usr.bin/m4/lib/ohash_init.3 head/usr.bin/m4/lib/ohash_interval.3 head/usr.bin/m4/m4.1 Modified: head/usr.bin/m4/lib/ohash_init.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_init.3 Tue Jul 29 19:43:00 2014 (r269249) +++ head/usr.bin/m4/lib/ohash_init.3 Tue Jul 29 19:46:13 2014 (r269250) @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12 2014 +.Dd May 12, 2014 .Dt OHASH_INIT 3 .Os .Sh NAME Modified: head/usr.bin/m4/lib/ohash_interval.3 ============================================================================== --- head/usr.bin/m4/lib/ohash_interval.3 Tue Jul 29 19:43:00 2014 (r269249) +++ head/usr.bin/m4/lib/ohash_interval.3 Tue Jul 29 19:46:13 2014 (r269250) @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5 2013 +.Dd June 5, 2013 .Dt OHASH_INTERVAL 3 .Os .Sh NAME Modified: head/usr.bin/m4/m4.1 ============================================================================== --- head/usr.bin/m4/m4.1 Tue Jul 29 19:43:00 2014 (r269249) +++ head/usr.bin/m4/m4.1 Tue Jul 29 19:46:13 2014 (r269250) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12 2014 $ +.Dd January 12, 2014 .Dt M4 1 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 19:49:28 2014 Return-Path: Delivered-To: svn-src-all@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 AFBE2D54; Tue, 29 Jul 2014 19:49: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 909DA2B97; Tue, 29 Jul 2014 19:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TJnSc2016742; Tue, 29 Jul 2014 19:49:28 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TJnRjn016735; Tue, 29 Jul 2014 19:49:27 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201407291949.s6TJnRjn016735@svn.freebsd.org> From: Joel Dahl Date: Tue, 29 Jul 2014 19:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269251 - in head: usr.bin/systat usr.sbin/binmiscctl usr.sbin/config usr.sbin/pmcstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 19:49:28 -0000 Author: joel (doc committer) Date: Tue Jul 29 19:49:27 2014 New Revision: 269251 URL: http://svnweb.freebsd.org/changeset/base/269251 Log: mdoc: kill EOL whitespace. Modified: head/usr.bin/systat/systat.1 head/usr.sbin/binmiscctl/binmiscctl.8 head/usr.sbin/config/config.8 head/usr.sbin/pmcstat/pmcstat.8 Modified: head/usr.bin/systat/systat.1 ============================================================================== --- head/usr.bin/systat/systat.1 Tue Jul 29 19:46:13 2014 (r269250) +++ head/usr.bin/systat/systat.1 Tue Jul 29 19:49:27 2014 (r269251) @@ -119,7 +119,7 @@ of the list. For example: .Pp .Dl Nm Fl ifstat Fl match Ar bge0,em1 Fl pps .Pp -This will display statistics of packets per second for network interfaces +This will display statistics of packets per second for network interfaces named as bge0 and em1. .Pp .Dl Nm Fl iostat Fl numeric Fl - Ar 2.1 Modified: head/usr.sbin/binmiscctl/binmiscctl.8 ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.8 Tue Jul 29 19:46:13 2014 (r269250) +++ head/usr.sbin/binmiscctl/binmiscctl.8 Tue Jul 29 19:49:27 2014 (r269251) @@ -28,7 +28,7 @@ .\" Support for miscellaneous binary image activators .\" .Dd April 10, 2014 -.Dt BINMISCCTL 8 +.Dt BINMISCCTL 8 .Os .Sh NAME .Nm binmiscctl @@ -142,7 +142,7 @@ Enable the activator entry identified wi .It Cm lookup Ar name Look up and print out the activator entry identified with .Ar name . -.It Cm list +.It Cm list Take a snapshot and print all the activator entries currently configured. .El .Sh EXAMPLES @@ -162,13 +162,13 @@ Set its state to enabled. .Pp .Dl # binmiscctl disable llvmbc .Pp -Set the state of the +Set the state of the .Ar llvmbc image activator to disabled. .Pp .Dl # binmiscctl enable llvmbc .Pp -Set the state of the +Set the state of the .Ar llvmbc image activator to enabled. .Pp Modified: head/usr.sbin/config/config.8 ============================================================================== --- head/usr.sbin/config/config.8 Tue Jul 29 19:46:13 2014 (r269250) +++ head/usr.sbin/config/config.8 Tue Jul 29 19:49:27 2014 (r269251) @@ -73,7 +73,7 @@ This flag is kept for backward compatibi .It Fl I Ar path Search in .Ar path -for any file included by the +for any file included by the .Ic include directive. This option may be specified more than once. .It Fl d Ar destdir Modified: head/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.8 Tue Jul 29 19:46:13 2014 (r269250) +++ head/usr.sbin/pmcstat/pmcstat.8 Tue Jul 29 19:49:27 2014 (r269251) @@ -235,7 +235,7 @@ lookup information is available. This option requires the .Fl R option to read in samples that were previously collected and -saved with the +saved with the .Fl o option. .It Fl c Ar cpu-spec From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 20:33:19 2014 Return-Path: Delivered-To: svn-src-all@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 75823C34; Tue, 29 Jul 2014 20:33: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55A1A2190; Tue, 29 Jul 2014 20:33:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TKXJKF039656; Tue, 29 Jul 2014 20:33:19 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TKXI78039654; Tue, 29 Jul 2014 20:33:18 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292033.s6TKXI78039654@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 20:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269253 - in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:33:19 -0000 Author: markj Date: Tue Jul 29 20:33:18 2014 New Revision: 269253 URL: http://svnweb.freebsd.org/changeset/base/269253 Log: MFC r263329: Only invoke fasttrap hooks for traps from user mode, and ensure that they're called with interrupts enabled. Calling fasttrap_pid_probe() with interrupts disabled can lead to deadlock if fasttrap writes to the process' address space. Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Tue Jul 29 19:49:38 2014 (r269252) +++ stable/10/sys/amd64/amd64/trap.c Tue Jul 29 20:33:18 2014 (r269253) @@ -193,6 +193,9 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_s void trap(struct trapframe *frame) { +#ifdef KDTRACE_HOOKS + struct reg regs; +#endif struct thread *td = curthread; struct proc *p = td->td_proc; int i = 0, ucode = 0, code; @@ -244,28 +247,10 @@ trap(struct trapframe *frame) /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. - * - * If the DTrace kernel module has registered a trap handler, - * call it and if it returns non-zero, assume that it has - * handled the trap and modified the trap frame so that this - * function can return normally. */ - if (type == T_DTRACE_RET || type == T_BPTFLT) { - struct reg regs; - - fill_frame_regs(frame, ®s); - if (type == T_BPTFLT && - dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) - goto out; - else if (type == T_DTRACE_RET && - dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - } if (dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) goto out; #endif @@ -320,6 +305,14 @@ trap(struct trapframe *frame) case T_BPTFLT: /* bpt instruction fault */ case T_TRCTRAP: /* trace trap */ enable_intr(); +#ifdef KDTRACE_HOOKS + if (type == T_BPTFLT) { + fill_frame_regs(frame, ®s); + if (dtrace_pid_probe_ptr != NULL && + dtrace_pid_probe_ptr(®s) == 0) + goto out; + } +#endif frame->tf_rflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -449,6 +442,15 @@ trap(struct trapframe *frame) goto userout; i = SIGFPE; break; +#ifdef KDTRACE_HOOKS + case T_DTRACE_RET: + enable_intr(); + fill_frame_regs(frame, ®s); + if (dtrace_return_probe_ptr != NULL && + dtrace_return_probe_ptr(®s) == 0) + goto out; + break; +#endif } } else { /* kernel trap */ Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Tue Jul 29 19:49:38 2014 (r269252) +++ stable/10/sys/i386/i386/trap.c Tue Jul 29 20:33:18 2014 (r269253) @@ -207,6 +207,9 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_s void trap(struct trapframe *frame) { +#ifdef KDTRACE_HOOKS + struct reg regs; +#endif struct thread *td = curthread; struct proc *p = td->td_proc; int i = 0, ucode = 0, code; @@ -263,28 +266,10 @@ trap(struct trapframe *frame) /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. - * - * If the DTrace kernel module has registered a trap handler, - * call it and if it returns non-zero, assume that it has - * handled the trap and modified the trap frame so that this - * function can return normally. */ - if (type == T_DTRACE_RET || type == T_BPTFLT) { - struct reg regs; - - fill_frame_regs(frame, ®s); - if (type == T_BPTFLT && - dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) - goto out; - if (type == T_DTRACE_RET && - dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - } if ((type == T_PROTFLT || type == T_PAGEFLT) && dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) goto out; @@ -358,6 +343,14 @@ trap(struct trapframe *frame) case T_BPTFLT: /* bpt instruction fault */ case T_TRCTRAP: /* trace trap */ enable_intr(); +#ifdef KDTRACE_HOOKS + if (type == T_BPTFLT) { + fill_frame_regs(frame, ®s); + if (dtrace_pid_probe_ptr != NULL && + dtrace_pid_probe_ptr(®s) == 0) + goto out; + } +#endif frame->tf_eflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -541,6 +534,15 @@ trap(struct trapframe *frame) #endif i = SIGFPE; break; +#ifdef KDTRACE_HOOKS + case T_DTRACE_RET: + enable_intr(); + fill_frame_regs(frame, ®s); + if (dtrace_return_probe_ptr != NULL && + dtrace_return_probe_ptr(®s) == 0) + goto out; + break; +#endif } } else { /* kernel trap */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 20:34:11 2014 Return-Path: Delivered-To: svn-src-all@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 A05E2D75; Tue, 29 Jul 2014 20:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81219219A; Tue, 29 Jul 2014 20:34:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TKYBQu039842; Tue, 29 Jul 2014 20:34:11 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TKYBPu039840; Tue, 29 Jul 2014 20:34:11 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292034.s6TKYBPu039840@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 20:34:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269254 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:34:11 -0000 Author: markj Date: Tue Jul 29 20:34:10 2014 New Revision: 269254 URL: http://svnweb.freebsd.org/changeset/base/269254 Log: MFC r263329: Only invoke fasttrap hooks for traps from user mode, and ensure that they're called with interrupts enabled. Calling fasttrap_pid_probe() with interrupts disabled can lead to deadlock if fasttrap writes to the process' address space. Modified: stable/9/sys/amd64/amd64/trap.c stable/9/sys/i386/i386/trap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Tue Jul 29 20:33:18 2014 (r269253) +++ stable/9/sys/amd64/amd64/trap.c Tue Jul 29 20:34:10 2014 (r269254) @@ -193,6 +193,9 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_s void trap(struct trapframe *frame) { +#ifdef KDTRACE_HOOKS + struct reg regs; +#endif struct thread *td = curthread; struct proc *p = td->td_proc; int i = 0, ucode = 0, code; @@ -244,28 +247,10 @@ trap(struct trapframe *frame) /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. - * - * If the DTrace kernel module has registered a trap handler, - * call it and if it returns non-zero, assume that it has - * handled the trap and modified the trap frame so that this - * function can return normally. */ - if (type == T_DTRACE_RET || type == T_BPTFLT) { - struct reg regs; - - fill_frame_regs(frame, ®s); - if (type == T_BPTFLT && - dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) - goto out; - else if (type == T_DTRACE_RET && - dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - } if (dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) goto out; #endif @@ -320,6 +305,14 @@ trap(struct trapframe *frame) case T_BPTFLT: /* bpt instruction fault */ case T_TRCTRAP: /* trace trap */ enable_intr(); +#ifdef KDTRACE_HOOKS + if (type == T_BPTFLT) { + fill_frame_regs(frame, ®s); + if (dtrace_pid_probe_ptr != NULL && + dtrace_pid_probe_ptr(®s) == 0) + goto out; + } +#endif frame->tf_rflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -449,6 +442,15 @@ trap(struct trapframe *frame) goto userout; i = SIGFPE; break; +#ifdef KDTRACE_HOOKS + case T_DTRACE_RET: + enable_intr(); + fill_frame_regs(frame, ®s); + if (dtrace_return_probe_ptr != NULL && + dtrace_return_probe_ptr(®s) == 0) + goto out; + break; +#endif } } else { /* kernel trap */ Modified: stable/9/sys/i386/i386/trap.c ============================================================================== --- stable/9/sys/i386/i386/trap.c Tue Jul 29 20:33:18 2014 (r269253) +++ stable/9/sys/i386/i386/trap.c Tue Jul 29 20:34:10 2014 (r269254) @@ -207,6 +207,9 @@ SYSCTL_INT(_machdep, OID_AUTO, uprintf_s void trap(struct trapframe *frame) { +#ifdef KDTRACE_HOOKS + struct reg regs; +#endif struct thread *td = curthread; struct proc *p = td->td_proc; int i = 0, ucode = 0, code; @@ -263,28 +266,10 @@ trap(struct trapframe *frame) /* * A trap can occur while DTrace executes a probe. Before * executing the probe, DTrace blocks re-scheduling and sets - * a flag in it's per-cpu flags to indicate that it doesn't + * a flag in its per-cpu flags to indicate that it doesn't * want to fault. On returning from the probe, the no-fault * flag is cleared and finally re-scheduling is enabled. - * - * If the DTrace kernel module has registered a trap handler, - * call it and if it returns non-zero, assume that it has - * handled the trap and modified the trap frame so that this - * function can return normally. */ - if (type == T_DTRACE_RET || type == T_BPTFLT) { - struct reg regs; - - fill_frame_regs(frame, ®s); - if (type == T_BPTFLT && - dtrace_pid_probe_ptr != NULL && - dtrace_pid_probe_ptr(®s) == 0) - goto out; - if (type == T_DTRACE_RET && - dtrace_return_probe_ptr != NULL && - dtrace_return_probe_ptr(®s) == 0) - goto out; - } if ((type == T_PROTFLT || type == T_PAGEFLT) && dtrace_trap_func != NULL && (*dtrace_trap_func)(frame, type)) goto out; @@ -357,6 +342,14 @@ trap(struct trapframe *frame) case T_BPTFLT: /* bpt instruction fault */ case T_TRCTRAP: /* trace trap */ enable_intr(); +#ifdef KDTRACE_HOOKS + if (type == T_BPTFLT) { + fill_frame_regs(frame, ®s); + if (dtrace_pid_probe_ptr != NULL && + dtrace_pid_probe_ptr(®s) == 0) + goto out; + } +#endif frame->tf_eflags &= ~PSL_T; i = SIGTRAP; ucode = (type == T_TRCTRAP ? TRAP_TRACE : TRAP_BRKPT); @@ -540,6 +533,15 @@ trap(struct trapframe *frame) #endif i = SIGFPE; break; +#ifdef KDTRACE_HOOKS + case T_DTRACE_RET: + enable_intr(); + fill_frame_regs(frame, ®s); + if (dtrace_return_probe_ptr != NULL && + dtrace_return_probe_ptr(®s) == 0) + goto out; + break; +#endif } } else { /* kernel trap */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 20:37:22 2014 Return-Path: Delivered-To: svn-src-all@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 DB6AC198; Tue, 29 Jul 2014 20:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8DBF21DC; Tue, 29 Jul 2014 20:37:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TKbMh0040569; Tue, 29 Jul 2014 20:37:22 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TKbMZn040568; Tue, 29 Jul 2014 20:37:22 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292037.s6TKbMZn040568@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 20:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269255 - stable/10/share/man/man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:37:23 -0000 Author: markj Date: Tue Jul 29 20:37:22 2014 New Revision: 269255 URL: http://svnweb.freebsd.org/changeset/base/269255 Log: MFC r264363: Update the SDT(9) example to reflect the removal of the sname parameter in r258622. Modified: stable/10/share/man/man9/SDT.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/SDT.9 ============================================================================== --- stable/10/share/man/man9/SDT.9 Tue Jul 29 20:34:10 2014 (r269254) +++ stable/10/share/man/man9/SDT.9 Tue Jul 29 20:37:22 2014 (r269255) @@ -200,7 +200,7 @@ of type Destination Unreachable: .Bd -literal -offset indent SDT_PROVIDER_DECLARE(icmp); -SDT_PROBE_DEFINE1(icmp, , unreach, pkt_receive, pkt-receive, +SDT_PROBE_DEFINE1(icmp, , unreach, pkt__receive, "struct icmp *"); .Ed @@ -212,7 +212,7 @@ Consider a DTrace probe which fires when packet. Such a probe would be defined by multiple tracepoints: .Bd -literal -offset indent -SDT_PROBE_DEFINE3(ip, , , receive, receive, "struct ifnet *", +SDT_PROBE_DEFINE3(ip, , , receive, "struct ifnet *", "struct ip *", "struct ip6_hdr *"); int @@ -268,7 +268,7 @@ all in the library path. Then the FreeBSD probe above can be defined with: .Bd -literal -offset indent -SDT_PROBE_DEFINE1_XLATE(ip, , , receive, receive, "struct icmp *", +SDT_PROBE_DEFINE1_XLATE(ip, , , receive, "struct icmp *", "struct icmp_hdr_dt *"); .Ed .Sh SEE ALSO From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 20:38:09 2014 Return-Path: Delivered-To: svn-src-all@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 89E322FD; Tue, 29 Jul 2014 20:38: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7726A21EB; Tue, 29 Jul 2014 20:38:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TKc9iE040727; Tue, 29 Jul 2014 20:38:09 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TKc9dC040726; Tue, 29 Jul 2014 20:38:09 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292038.s6TKc9dC040726@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 20:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269256 - stable/9/share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:38:09 -0000 Author: markj Date: Tue Jul 29 20:38:08 2014 New Revision: 269256 URL: http://svnweb.freebsd.org/changeset/base/269256 Log: MFC r264363: Update the SDT(9) examples to reflect the removal of the sname parameter in r258622. Modified: stable/9/share/man/man9/SDT.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/SDT.9 ============================================================================== --- stable/9/share/man/man9/SDT.9 Tue Jul 29 20:37:22 2014 (r269255) +++ stable/9/share/man/man9/SDT.9 Tue Jul 29 20:38:08 2014 (r269256) @@ -203,7 +203,7 @@ of type Destination Unreachable: .Bd -literal -offset indent SDT_PROVIDER_DECLARE(icmp); -SDT_PROBE_DEFINE1(icmp, , unreach, pkt_receive, pkt-receive, +SDT_PROBE_DEFINE1(icmp, , unreach, pkt__receive, "struct icmp *"); .Ed @@ -215,7 +215,7 @@ Consider a DTrace probe which fires when packet. Such a probe would be defined by multiple tracepoints: .Bd -literal -offset indent -SDT_PROBE_DEFINE3(ip, , , receive, receive, "struct ifnet *", +SDT_PROBE_DEFINE3(ip, , , receive, "struct ifnet *", "struct ip *", "struct ip6_hdr *"); int @@ -271,7 +271,7 @@ all in the library path. Then the FreeBSD probe above can be defined with: .Bd -literal -offset indent -SDT_PROBE_DEFINE1_XLATE(ip, , , receive, receive, "struct icmp *", +SDT_PROBE_DEFINE1_XLATE(ip, , , receive, "struct icmp *", "struct icmp_hdr_dt *"); .Ed .Sh SEE ALSO From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 20:57:40 2014 Return-Path: Delivered-To: svn-src-all@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 11374B13; Tue, 29 Jul 2014 20:57: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED6E724C5; Tue, 29 Jul 2014 20:57:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TKvdpg050752; Tue, 29 Jul 2014 20:57:39 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TKvcLF050746; Tue, 29 Jul 2014 20:57:38 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201407292057.s6TKvcLF050746@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 29 Jul 2014 20:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269257 - in stable/10: contrib/ldns contrib/ldns/compat contrib/ldns/drill contrib/ldns/ldns contrib/ldns/m4 contrib/unbound contrib/unbound/compat contrib/unbound/daemon contrib/unbou... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 20:57:40 -0000 Author: des Date: Tue Jul 29 20:57:38 2014 New Revision: 269257 URL: http://svnweb.freebsd.org/changeset/base/269257 Log: MFH (r266114, r266138): upgrade to latest ldns and unbound MFH (r266139-r266143, r266145, r266149, r266150): fix props MFH (r266179, r266180, r266193, r266238, r266777): misc cleanup MFH (r266863): create and use /var/unbound/conf.d MFH (r268839): import unblock-lan-zones patch from upstream MFH (r268840): fix reverse lookups on private networks MFH (r268883): avoid spamming source tree during build PR: 190739 (for r268883) Added: stable/10/contrib/ldns/README.git - copied unchanged from r266114, head/contrib/ldns/README.git - copied unchanged from r266114, head/contrib/ldns/ldns/radix.h stable/10/contrib/ldns/m4/ - copied from r266114, head/contrib/ldns/m4/ - copied unchanged from r266114, head/contrib/ldns/radix.c stable/10/contrib/unbound/ax_pthread.m4 - copied unchanged from r266114, head/contrib/unbound/ax_pthread.m4 - copied unchanged from r266114, head/contrib/unbound/compat/strlcat.c stable/10/contrib/unbound/ldns/ - copied from r266114, head/contrib/unbound/ldns/ - copied unchanged from r266114, head/contrib/unbound/libunbound/unbound-event.h Directory Properties: stable/10/contrib/ldns/ldns/radix.h (props changed) stable/10/contrib/ldns/radix.c (props changed) stable/10/contrib/unbound/compat/strlcat.c (props changed) stable/10/contrib/unbound/libunbound/unbound-event.h (props changed) Deleted: stable/10/contrib/ldns/README.svn stable/10/contrib/ldns/compat/b32_ntop.c stable/10/contrib/ldns/compat/b32_pton.c stable/10/contrib/unbound/acx_pthread.m4 stable/10/contrib/unbound/util/configlexer.c stable/10/contrib/unbound/util/configparser.c stable/10/contrib/unbound/util/configparser.h Modified: stable/10/contrib/ldns/Changelog stable/10/contrib/ldns/Makefile.in stable/10/contrib/ldns/README stable/10/contrib/ldns/acx_nlnetlabs.m4 stable/10/contrib/ldns/ax_python_devel.m4 stable/10/contrib/ldns/compat/b64_ntop.c stable/10/contrib/ldns/compat/b64_pton.c stable/10/contrib/ldns/compat/snprintf.c stable/10/contrib/ldns/configure stable/10/contrib/ldns/configure.ac stable/10/contrib/ldns/dane.c (contents, props changed) stable/10/contrib/ldns/dnssec.c stable/10/contrib/ldns/dnssec_sign.c stable/10/contrib/ldns/dnssec_zone.c stable/10/contrib/ldns/drill/chasetrace.c stable/10/contrib/ldns/drill/configure stable/10/contrib/ldns/drill/configure.ac stable/10/contrib/ldns/drill/drill.1.in stable/10/contrib/ldns/drill/drill.c stable/10/contrib/ldns/drill/drill_util.c stable/10/contrib/ldns/drill/securetrace.c stable/10/contrib/ldns/drill/work.c stable/10/contrib/ldns/error.c stable/10/contrib/ldns/higher.c stable/10/contrib/ldns/host2str.c stable/10/contrib/ldns/host2wire.c stable/10/contrib/ldns/install-sh stable/10/contrib/ldns/keys.c stable/10/contrib/ldns/ldns/common.h stable/10/contrib/ldns/ldns/common.h.in stable/10/contrib/ldns/ldns/config.h stable/10/contrib/ldns/ldns/config.h.in stable/10/contrib/ldns/ldns/dane.h (contents, props changed) stable/10/contrib/ldns/ldns/dnssec.h stable/10/contrib/ldns/ldns/dnssec_sign.h stable/10/contrib/ldns/ldns/dnssec_zone.h stable/10/contrib/ldns/ldns/error.h stable/10/contrib/ldns/ldns/host2str.h stable/10/contrib/ldns/ldns/ldns.h stable/10/contrib/ldns/ldns/net.h stable/10/contrib/ldns/ldns/net.h.in stable/10/contrib/ldns/ldns/packet.h stable/10/contrib/ldns/ldns/rdata.h stable/10/contrib/ldns/ldns/resolver.h stable/10/contrib/ldns/ldns/rr.h stable/10/contrib/ldns/ldns/str2host.h stable/10/contrib/ldns/ldns/util.h stable/10/contrib/ldns/ldns/util.h.in stable/10/contrib/ldns/net.c stable/10/contrib/ldns/packet.c stable/10/contrib/ldns/parse.c stable/10/contrib/ldns/rdata.c stable/10/contrib/ldns/resolver.c stable/10/contrib/ldns/rr.c stable/10/contrib/ldns/sha1.c stable/10/contrib/ldns/sha2.c stable/10/contrib/ldns/str2host.c stable/10/contrib/ldns/tsig.c stable/10/contrib/ldns/util.c stable/10/contrib/ldns/wire2host.c stable/10/contrib/unbound/LICENSE stable/10/contrib/unbound/Makefile.in stable/10/contrib/unbound/acx_nlnetlabs.m4 stable/10/contrib/unbound/compat/snprintf.c stable/10/contrib/unbound/config.h stable/10/contrib/unbound/config.h.in stable/10/contrib/unbound/configure stable/10/contrib/unbound/configure.ac stable/10/contrib/unbound/daemon/acl_list.c stable/10/contrib/unbound/daemon/acl_list.h stable/10/contrib/unbound/daemon/cachedump.c stable/10/contrib/unbound/daemon/cachedump.h stable/10/contrib/unbound/daemon/daemon.c stable/10/contrib/unbound/daemon/daemon.h stable/10/contrib/unbound/daemon/remote.c stable/10/contrib/unbound/daemon/remote.h stable/10/contrib/unbound/daemon/stats.c stable/10/contrib/unbound/daemon/stats.h stable/10/contrib/unbound/daemon/unbound.c stable/10/contrib/unbound/daemon/worker.c stable/10/contrib/unbound/daemon/worker.h stable/10/contrib/unbound/doc/Changelog stable/10/contrib/unbound/doc/FEATURES stable/10/contrib/unbound/doc/LICENSE stable/10/contrib/unbound/doc/README stable/10/contrib/unbound/doc/example.conf.in stable/10/contrib/unbound/doc/libunbound.3 stable/10/contrib/unbound/doc/libunbound.3.in stable/10/contrib/unbound/doc/unbound-anchor.8 stable/10/contrib/unbound/doc/unbound-anchor.8.in stable/10/contrib/unbound/doc/unbound-checkconf.8 stable/10/contrib/unbound/doc/unbound-checkconf.8.in stable/10/contrib/unbound/doc/unbound-control.8 stable/10/contrib/unbound/doc/unbound-control.8.in stable/10/contrib/unbound/doc/unbound-host.1 stable/10/contrib/unbound/doc/unbound.8 stable/10/contrib/unbound/doc/unbound.8.in stable/10/contrib/unbound/doc/unbound.conf.5 stable/10/contrib/unbound/doc/unbound.conf.5.in stable/10/contrib/unbound/freebsd-configure.sh stable/10/contrib/unbound/iterator/iter_delegpt.c stable/10/contrib/unbound/iterator/iter_delegpt.h stable/10/contrib/unbound/iterator/iter_donotq.c stable/10/contrib/unbound/iterator/iter_donotq.h stable/10/contrib/unbound/iterator/iter_fwd.c stable/10/contrib/unbound/iterator/iter_fwd.h stable/10/contrib/unbound/iterator/iter_hints.c stable/10/contrib/unbound/iterator/iter_hints.h stable/10/contrib/unbound/iterator/iter_priv.c stable/10/contrib/unbound/iterator/iter_priv.h stable/10/contrib/unbound/iterator/iter_resptype.c stable/10/contrib/unbound/iterator/iter_resptype.h stable/10/contrib/unbound/iterator/iter_scrub.c stable/10/contrib/unbound/iterator/iter_scrub.h stable/10/contrib/unbound/iterator/iter_utils.c stable/10/contrib/unbound/iterator/iter_utils.h stable/10/contrib/unbound/iterator/iterator.c stable/10/contrib/unbound/iterator/iterator.h stable/10/contrib/unbound/libunbound/context.c stable/10/contrib/unbound/libunbound/context.h stable/10/contrib/unbound/libunbound/libunbound.c stable/10/contrib/unbound/libunbound/libworker.c stable/10/contrib/unbound/libunbound/libworker.h stable/10/contrib/unbound/libunbound/ubsyms.def stable/10/contrib/unbound/libunbound/unbound.h stable/10/contrib/unbound/libunbound/worker.h stable/10/contrib/unbound/services/cache/dns.c stable/10/contrib/unbound/services/cache/dns.h stable/10/contrib/unbound/services/cache/infra.c stable/10/contrib/unbound/services/cache/infra.h stable/10/contrib/unbound/services/cache/rrset.c stable/10/contrib/unbound/services/cache/rrset.h stable/10/contrib/unbound/services/listen_dnsport.c stable/10/contrib/unbound/services/listen_dnsport.h stable/10/contrib/unbound/services/localzone.c stable/10/contrib/unbound/services/localzone.h stable/10/contrib/unbound/services/mesh.c stable/10/contrib/unbound/services/mesh.h stable/10/contrib/unbound/services/modstack.c stable/10/contrib/unbound/services/modstack.h stable/10/contrib/unbound/services/outbound_list.c stable/10/contrib/unbound/services/outbound_list.h stable/10/contrib/unbound/services/outside_network.c stable/10/contrib/unbound/services/outside_network.h stable/10/contrib/unbound/smallapp/unbound-anchor.c stable/10/contrib/unbound/smallapp/unbound-checkconf.c stable/10/contrib/unbound/smallapp/unbound-control-setup.sh stable/10/contrib/unbound/smallapp/unbound-control-setup.sh.in stable/10/contrib/unbound/smallapp/unbound-control.c stable/10/contrib/unbound/smallapp/unbound-host.c stable/10/contrib/unbound/smallapp/worker_cb.c stable/10/contrib/unbound/util/alloc.c stable/10/contrib/unbound/util/alloc.h stable/10/contrib/unbound/util/config_file.c stable/10/contrib/unbound/util/config_file.h stable/10/contrib/unbound/util/configlexer.lex stable/10/contrib/unbound/util/configparser.y stable/10/contrib/unbound/util/data/dname.c stable/10/contrib/unbound/util/data/dname.h stable/10/contrib/unbound/util/data/msgencode.c stable/10/contrib/unbound/util/data/msgencode.h stable/10/contrib/unbound/util/data/msgparse.c stable/10/contrib/unbound/util/data/msgparse.h stable/10/contrib/unbound/util/data/msgreply.c stable/10/contrib/unbound/util/data/msgreply.h stable/10/contrib/unbound/util/data/packed_rrset.c stable/10/contrib/unbound/util/data/packed_rrset.h stable/10/contrib/unbound/util/fptr_wlist.c stable/10/contrib/unbound/util/fptr_wlist.h stable/10/contrib/unbound/util/iana_ports.inc stable/10/contrib/unbound/util/locks.c stable/10/contrib/unbound/util/locks.h stable/10/contrib/unbound/util/log.c stable/10/contrib/unbound/util/log.h stable/10/contrib/unbound/util/mini_event.c stable/10/contrib/unbound/util/mini_event.h stable/10/contrib/unbound/util/module.c stable/10/contrib/unbound/util/module.h stable/10/contrib/unbound/util/net_help.c stable/10/contrib/unbound/util/net_help.h stable/10/contrib/unbound/util/netevent.c stable/10/contrib/unbound/util/netevent.h stable/10/contrib/unbound/util/random.c stable/10/contrib/unbound/util/random.h stable/10/contrib/unbound/util/rbtree.c stable/10/contrib/unbound/util/rbtree.h stable/10/contrib/unbound/util/regional.c stable/10/contrib/unbound/util/regional.h stable/10/contrib/unbound/util/rtt.c stable/10/contrib/unbound/util/rtt.h stable/10/contrib/unbound/util/storage/dnstree.c stable/10/contrib/unbound/util/storage/dnstree.h stable/10/contrib/unbound/util/storage/lookup3.c stable/10/contrib/unbound/util/storage/lookup3.h stable/10/contrib/unbound/util/storage/lruhash.c stable/10/contrib/unbound/util/storage/lruhash.h stable/10/contrib/unbound/util/storage/slabhash.c stable/10/contrib/unbound/util/storage/slabhash.h stable/10/contrib/unbound/util/timehist.c stable/10/contrib/unbound/util/timehist.h stable/10/contrib/unbound/util/tube.c stable/10/contrib/unbound/util/tube.h stable/10/contrib/unbound/util/winsock_event.c stable/10/contrib/unbound/util/winsock_event.h stable/10/contrib/unbound/validator/autotrust.c stable/10/contrib/unbound/validator/autotrust.h stable/10/contrib/unbound/validator/val_anchor.c stable/10/contrib/unbound/validator/val_anchor.h stable/10/contrib/unbound/validator/val_kcache.c stable/10/contrib/unbound/validator/val_kcache.h stable/10/contrib/unbound/validator/val_kentry.c stable/10/contrib/unbound/validator/val_kentry.h stable/10/contrib/unbound/validator/val_neg.c stable/10/contrib/unbound/validator/val_neg.h stable/10/contrib/unbound/validator/val_nsec.c stable/10/contrib/unbound/validator/val_nsec.h stable/10/contrib/unbound/validator/val_nsec3.c stable/10/contrib/unbound/validator/val_nsec3.h stable/10/contrib/unbound/validator/val_secalgo.c stable/10/contrib/unbound/validator/val_secalgo.h stable/10/contrib/unbound/validator/val_sigcrypt.c stable/10/contrib/unbound/validator/val_sigcrypt.h stable/10/contrib/unbound/validator/val_utils.c stable/10/contrib/unbound/validator/val_utils.h stable/10/contrib/unbound/validator/validator.c stable/10/contrib/unbound/validator/validator.h stable/10/etc/mtree/BSD.var.dist stable/10/lib/libldns/Makefile stable/10/lib/libunbound/Makefile stable/10/usr.sbin/unbound/local-setup/local-unbound-setup.sh Directory Properties: stable/10/ (props changed) stable/10/contrib/ldns/drill/drill.1 (props changed) stable/10/contrib/unbound/ldns/keyraw.c (props changed) stable/10/contrib/unbound/ldns/keyraw.h (props changed) stable/10/contrib/unbound/ldns/parse.c (props changed) stable/10/contrib/unbound/ldns/parse.h (props changed) stable/10/contrib/unbound/ldns/parseutil.c (props changed) stable/10/contrib/unbound/ldns/parseutil.h (props changed) stable/10/contrib/unbound/ldns/pkthdr.h (props changed) stable/10/contrib/unbound/ldns/rrdef.c (props changed) stable/10/contrib/unbound/ldns/rrdef.h (props changed) stable/10/contrib/unbound/ldns/sbuffer.c (props changed) stable/10/contrib/unbound/ldns/sbuffer.h (props changed) stable/10/contrib/unbound/ldns/str2wire.c (props changed) stable/10/contrib/unbound/ldns/str2wire.h (props changed) stable/10/contrib/unbound/ldns/wire2str.c (props changed) stable/10/contrib/unbound/ldns/wire2str.h (props changed) Modified: stable/10/contrib/ldns/Changelog ============================================================================== --- stable/10/contrib/ldns/Changelog Tue Jul 29 20:38:08 2014 (r269256) +++ stable/10/contrib/ldns/Changelog Tue Jul 29 20:57:38 2014 (r269257) @@ -1,3 +1,61 @@ +1.6.17 2014-01-10 + * Fix ldns_dnssec_zone_new_frm_fp_l to allow the last parsed line of a + zone to be an NSEC3 (or its RRSIG) covering an empty non terminal. + * Add --disable-dane option to configure and check availability of the + for dane needed X509_check_ca function in openssl. + * bugfix #490: Get rid of type-punned pointer warnings. + Thanks Adam Tkac. + * Make sure executables are linked against libcrypto with the + LIBSSL_LDFLAGS. Thanks Leo Baltus. + * Miscellaneous prototype fixes. Thanks Dag-Erling Smørgrav. + * README now shows preferred way to configure for examples and drill. + * Bind to source address for resolvers. drill binds to source with -I. + Thanks Bryan Duff. + * -T option for ldns-dane that has specific exit status for PKIX + validated connections without (secure) TLSA records. + * Fix b{32,64}_{ntop,pton} detection and handling. + * New RR type TKEY, but without operational practice. + * New RR types HIP, NINFO, RKEY, CDS, EUI48, EUI64, URI, CAA and TA. + * New output format flag (and accompanying functions) to print certain + RR's as unknown type + * -u and -U parameter for ldns-read-zone to mark/unmark a RR type + for printing as unknown type + * bugfix #504: GPOS RR has three rdata fields. Thanks Jelte Jansen. + * bugfix #497: Properly test for EOF when reading key files with drill. + * New functions: ldns_pkt_ixfr_request_new and + ldns_pkt_ixfr_request_new_frm_str. + * Use SNI with ldns-dane + * bugfix #507: ldnsx Fix use of non-existent variables and not + properly referring to instance variable. Patch from shussain. + * bugfix #508: ldnsx Adding NSEC3PARAM to known/allowable RR type + dictionary. Patch from shussain. + * bugfix #517: ldns_resolver_new_frm_fp error when invoked using a NULL + file pointer. + * Fix memory leak in contrib/python: ldns_pkt.new_query. + * Fix buffer overflow in fget_token and bget_token. + * ldns-verify-zone NSEC3 checking from quadratic to linear performance. + Thanks NIC MX (nicmexico.mx) + * ldns-dane setup new ssl session for each new connect to prevent hangs + * bugfix #521: drill trace continue on empty non-terminals with NSEC3 + * bugfix #525: Fix documentation of ldns_resolver_set_retry + * Remove unused LDNS_RDF_TYPE_TSIG and associated functions. + * Fix ldns_nsec_covers_name for zones with an apex only. Thanks Miek. + * Configure option to build perl bindings: --with-p5-dns-ldns + (DNS::LDNS is a contribution from Erik Ostlyngen) + * bugfix #527: Move -lssl before -lcrypto when linking + * Optimize TSIG digest function name comparison (Thanks Marc Buijsman) + * Compare names case insensitive with ldns_pkt_rr_list_by_name and + ldns_pkt_rr_list_by_name_and_type (thanks Johannes Naab) + * A separate --enable for each draft RR type: --enable-rrtype-ninfo, + --enable-rrtype-rkey, --enable-rrtype-cds, --enable-rrtype-uri and + --enable-rrtype-ta + * bugfix #530: Don't sign and verify duplicate RRs (Thanks Jelte Jansen) + * bugfix #505: Manpage and usage output fixes (Thanks Tomas Hozza) + * Adjust ldns_sha1() so that the input data is not modified (Thanks + Marc Buijsman) + * Messages to stderr are now off by default and can be reenabled with + the --enable-stderr-msgs configure option. + 1.6.16 2012-11-13 * Fix Makefile to build pyldns with BSD make * Fix typo in exporting b32_* symbols to make pyldns load again Modified: stable/10/contrib/ldns/Makefile.in ============================================================================== --- stable/10/contrib/ldns/Makefile.in Tue Jul 29 20:38:08 2014 (r269256) +++ stable/10/contrib/ldns/Makefile.in Tue Jul 29 20:57:38 2014 (r269257) @@ -2,7 +2,7 @@ # See the file LICENSE for the license SHELL = @SHELL@ VERSION = @PACKAGE_VERSION@ -version_info = @LIBTOOL_VERSION_INFO@ +version_info = @VERSION_INFO@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -13,8 +13,10 @@ datadir = @datadir@ libdir = @libdir@ includedir = @includedir@ doxygen = @doxygen@ -pywrapdir = ${srcdir}/contrib/python -pyldnsxwrapdir = ${srcdir}/contrib/ldnsx +pywrapdir = $(srcdir)/contrib/python +pyldnsxwrapdir = $(srcdir)/contrib/ldnsx +p5_dns_ldns_dir = $(srcdir)/contrib/DNS-LDNS +PERL = @PERL@ swig = @swig@ swigpy_flags = -python @SWIGPY3@ python_site = @PYTHON_SITE_PKG@ @@ -57,17 +59,19 @@ LINTFLAGS += "-Dsigset_t=long" LINTFLAGS += "-D__uint16_t=uint16_t" -D"__pure2=" -D"__wchar_t=wchar_t" -D"__packed=" -D"__aligned(x)=" # Ubuntu oneiric" LINTFLAGS += -D"__BEGIN_DECLS=" -D"__ssize_t=ssize_t" -D"__intptr_t=intptr_t" -D"__nonnull(x)=" -D"__THROW=" -D"__wur=" -D"__off_t=unsigned" -D"__off64_t=unsigned" -D"__useconds_t=unsigned" -D"__uid_t=unsigned" -D"__gid_t=unsigned" -D"__attribute_deprecated__=" -D"__pid_t=unsigned" -D"__restrict=" -D"__END_DECLS=" -D"__BEGIN_NAMESPACE_STD=" -D"__END_NAMESPACE_STD=" -D"__BEGIN_NAMESPACE_C99=" -D"__END_NAMESPACE_C99=" -D"__socklen_t=unsigned" -D"sa_family_t=unsigned " -D"__mode_t=unsigned" -D"u_int16_t=uint16_t" -D"u_int32_t=uint32_t" -D"u_int8_t=uint8_t" -D"u_short=unsigned short" -D"__u16=uint16_t" -D"__u32=uint32_t" -D"__u64=uint64_t" +# FreeBSD 9 +LINTFLAGS += -D"_RuneLocale=int" DEPFLAG = @DEPFLAG@ INSTALL = $(srcdir)/install-sh LIBLOBJS = $(LIBOBJS:.o=.lo) -LDNS_LOBJS = buffer.lo dane.lo dname.lo dnssec.lo dnssec_sign.lo dnssec_verify.lo dnssec_zone.lo duration.lo error.lo higher.lo host2str.lo host2wire.lo keys.lo net.lo packet.lo parse.lo rbtree.lo rdata.lo resolver.lo rr.lo rr_functions.lo sha1.lo sha2.lo str2host.lo tsig.lo update.lo util.lo wire2host.lo zone.lo +LDNS_LOBJS = buffer.lo dane.lo dname.lo dnssec.lo dnssec_sign.lo dnssec_verify.lo dnssec_zone.lo duration.lo error.lo higher.lo host2str.lo host2wire.lo keys.lo net.lo packet.lo parse.lo radix.lo rbtree.lo rdata.lo resolver.lo rr.lo rr_functions.lo sha1.lo sha2.lo str2host.lo tsig.lo update.lo util.lo wire2host.lo zone.lo LDNS_LOBJS_EX = ^linktest\.c$$ LDNS_ALL_LOBJS = $(LDNS_LOBJS) $(LIBLOBJS) LIB = libldns.la -LDNS_HEADERS = buffer.h dane.h dname.h dnssec.h dnssec_sign.h dnssec_verify.h dnssec_zone.h duration.h error.h higher.h host2str.h host2wire.h keys.h ldns.h packet.h parse.h rbtree.h rdata.h resolver.h rr_functions.h rr.h sha1.h sha2.h str2host.h tsig.h update.h wire2host.h zone.h +LDNS_HEADERS = buffer.h dane.h dname.h dnssec.h dnssec_sign.h dnssec_verify.h dnssec_zone.h duration.h error.h higher.h host2str.h host2wire.h keys.h ldns.h packet.h parse.h radix.h rbtree.h rdata.h resolver.h rr_functions.h rr.h sha1.h sha2.h str2host.h tsig.h update.h wire2host.h zone.h LDNS_HEADERS_EX = ^config\.h|common\.h|util\.h|net\.h$$ LDNS_HEADERS_GEN= common.h util.h net.h @@ -92,16 +96,14 @@ EX_SSL_LOBJS = examples/ldns-nsec3-hash. COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) COMP_LIB = $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -LINK_LIB = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) \ - $(LIBS) -version-number $(version_info) -no-undefined -LINK_EXE = $(LIBTOOL) --mode=link $(CC) $(CPPFLAGS) \ - $(LIBSSL_CPPFLAGS) $(CFLAGS) $(LDFLAGS) +LINK_LIB = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -version-number $(version_info) -no-undefined +LINK_EXE = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBSSL_LDFLAGS) .PHONY: clean realclean docclean manpages doc lint all lib pyldns test .PHONY: install uninstall install-doc uninstall-doc uninstall-pyldns .PHONY: install-h uninstall-h install-lib uninstall-lib install-pyldns -all: setup-builddir lib linktest manpages @PYLDNS@ @DRILL@ @EXAMPLES@ +all: setup-builddir lib linktest manpages @P5_DNS_LDNS@ @PYLDNS@ @DRILL@ @EXAMPLES@ .SUFFIXES: .c .o .a .lo .h .i @@ -205,7 +207,8 @@ clean-examples: $(LIBTOOL) --mode clean rm -f $(EXAMPLE_LOBJS) linktest: $(srcdir)/linktest.c libldns.la - $(LIBTOOL) --mode=link $(CC) $(srcdir)/linktest.c $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) -lldns $(LIBS) -o linktest + $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $(srcdir)/linktest.c -o linktest.lo + $(LINK_EXE) linktest.lo $(LIBS) $(LIBSSL_LIBS) -lldns -o linktest lib: libldns.la @@ -247,9 +250,29 @@ ldns_wrapper.lo: $(pywrapdir)/ldns_wrapp _ldns.la: ldns_wrapper.lo libldns.la $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) $(PYTHON_LDFLAGS) -module -version-number $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_site) -L. -L.libs -lldns $(LIBS) -install: install-h install-lib @INSTALL_CONFIG@ install-manpages $(pyldns_inst) $(pyldnsx_inst) @INSTALL_DRILL@ @INSTALL_EXAMPLES@ +$(p5_dns_ldns_dir)/Makefile: $(p5_dns_ldns_dir)/Makefile.PL + BUILDDIR=`pwd`; cd $(p5_dns_ldns_dir); $(PERL) Makefile.PL PREFIX="$(prefix)" LIBS="-L$$BUILDDIR/.libs -lldns" INC="-I$$BUILDDIR" -uninstall: uninstall-manpages @UNINSTALL_CONFIG@ uninstall-h uninstall-lib $(pyldns_uninst) $(pyldnsx_uninst) @UNINSTALL_DRILL@ @UNINSTALL_EXAMPLES@ +$(p5_dns_ldns_dir)/blib/arch/auto/DNS/LDNS/LDNS.so: $(p5_dns_ldns_dir)/Makefile + cd $(p5_dns_ldns_dir); $(MAKE) + +p5-dns-ldns: $(p5_dns_ldns_dir)/blib/arch/auto/DNS/LDNS/LDNS.so + +install-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile + cd $(p5_dns_ldns_dir); $(MAKE) install + +uninstall-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile + cd $(p5_dns_ldns_dir); $(MAKE) uninstall + +clean-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile + cd $(p5_dns_ldns_dir); $(MAKE) clean + +test-p5-dns-ldns: $(p5_dns_ldns_dir)/Makefile + cd $(p5_dns_ldns_dir); $(MAKE) test + +install: install-h install-lib @INSTALL_CONFIG@ install-manpages $(pyldns_inst) $(pyldnsx_inst) @INSTALL_P5_DNS_LDNS@ @INSTALL_DRILL@ @INSTALL_EXAMPLES@ + +uninstall: uninstall-manpages @UNINSTALL_CONFIG@ uninstall-h uninstall-lib $(pyldns_uninst) $(pyldnsx_uninst) @UNINSTALL_P5_DNS_LDNS@ @UNINSTALL_DRILL@ @UNINSTALL_EXAMPLES@ destclean: uninstall @@ -331,7 +354,7 @@ clean-lib: $(LIBTOOL) --mode clean rm -f $(pywrapdir)/ldns_wrapper.c $(LIBTOOL) --mode clean rm -f $(pywrapdir)/ldns.py -clean: @CLEAN_DRILL@ @CLEAN_EXAMPLES@ clean-manpages clean-lib putdown-builddir +clean: @CLEAN_DRILL@ @CLEAN_EXAMPLES@ @CLEAN_P5_DNS_LDNS@ clean-manpages clean-lib putdown-builddir realclean: clean docclean rm -f config.status @@ -396,7 +419,7 @@ allclean: test-clean clean test-clean: tpkg -b test clean -test: +test: @TEST_P5_DNS_LDNS@ if test -x "`which bash`"; then bash test/test_all.sh; else sh test/test_all.sh; fi @@ -481,56 +504,56 @@ buffer.lo buffer.o: $(srcdir)/buffer.c l $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dane.lo dane.o: $(srcdir)/dane.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dname.lo dname.o: $(srcdir)/dname.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dnssec.lo dnssec.o: $(srcdir)/dnssec.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dnssec_sign.lo dnssec_sign.o: $(srcdir)/dnssec_sign.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dnssec_verify.lo dnssec_verify.o: $(srcdir)/dnssec_verify.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h dnssec_zone.lo dnssec_zone.o: $(srcdir)/dnssec_zone.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h duration.lo duration.o: $(srcdir)/duration.c ldns/config.h $(srcdir)/ldns/duration.h error.lo error.o: $(srcdir)/error.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ @@ -538,72 +561,74 @@ error.lo error.o: $(srcdir)/error.c ldns $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h higher.lo higher.o: $(srcdir)/higher.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h host2str.lo host2str.o: $(srcdir)/host2str.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h host2wire.lo host2wire.o: $(srcdir)/host2wire.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h keys.lo keys.o: $(srcdir)/keys.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h linktest.lo linktest.o: $(srcdir)/linktest.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h net.lo net.o: $(srcdir)/net.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h packet.lo packet.o: $(srcdir)/packet.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h parse.lo parse.o: $(srcdir)/parse.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h +radix.lo radix.o: $(srcdir)/radix.c ldns/config.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/error.h ldns/util.h \ + ldns/common.h rbtree.lo rbtree.o: $(srcdir)/rbtree.c ldns/config.h $(srcdir)/ldns/rbtree.h ldns/util.h ldns/common.h rdata.lo rdata.o: $(srcdir)/rdata.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ @@ -611,40 +636,40 @@ rdata.lo rdata.o: $(srcdir)/rdata.c ldns $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h resolver.lo resolver.o: $(srcdir)/resolver.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h rr.lo rr.o: $(srcdir)/rr.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h rr_functions.lo rr_functions.o: $(srcdir)/rr_functions.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h sha1.lo sha1.o: $(srcdir)/sha1.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h sha2.lo sha2.o: $(srcdir)/sha2.c ldns/config.h $(srcdir)/ldns/sha2.h str2host.lo str2host.o: $(srcdir)/str2host.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ @@ -652,24 +677,24 @@ str2host.lo str2host.o: $(srcdir)/str2ho $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h tsig.lo tsig.o: $(srcdir)/tsig.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h update.lo update.o: $(srcdir)/update.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h util.lo util.o: $(srcdir)/util.c ldns/config.h $(srcdir)/ldns/rdata.h ldns/common.h $(srcdir)/ldns/error.h \ ldns/util.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/buffer.h wire2host.lo wire2host.o: $(srcdir)/wire2host.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ @@ -678,18 +703,16 @@ wire2host.lo wire2host.o: $(srcdir)/wire $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h zone.lo zone.o: $(srcdir)/zone.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h -compat/b32_ntop.lo compat/b32_ntop.o: $(srcdir)/compat/b32_ntop.c ldns/config.h -compat/b32_pton.lo compat/b32_pton.o: $(srcdir)/compat/b32_pton.c ldns/config.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h compat/b64_ntop.lo compat/b64_ntop.o: $(srcdir)/compat/b64_ntop.c ldns/config.h compat/b64_pton.lo compat/b64_pton.o: $(srcdir)/compat/b64_pton.c ldns/config.h compat/calloc.lo compat/calloc.o: $(srcdir)/compat/calloc.c ldns/config.h @@ -715,8 +738,8 @@ examples/ldns-chaos.lo examples/ldns-cha $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-compare-zones.lo examples/ldns-compare-zones.o: $(srcdir)/examples/ldns-compare-zones.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -724,31 +747,31 @@ examples/ldns-compare-zones.lo examples/ $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-dane.lo examples/ldns-dane.o: $(srcdir)/examples/ldns-dane.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldnsd.lo examples/ldnsd.o: $(srcdir)/examples/ldnsd.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h \ $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h \ $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h \ $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-dpa.lo examples/ldns-dpa.o: $(srcdir)/examples/ldns-dpa.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-dpa.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-dpa.h examples/ldns-gen-zone.lo examples/ldns-gen-zone.o: $(srcdir)/examples/ldns-gen-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -756,15 +779,15 @@ examples/ldns-gen-zone.lo examples/ldns- $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-key2ds.lo examples/ldns-key2ds.o: $(srcdir)/examples/ldns-key2ds.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-keyfetcher.lo examples/ldns-keyfetcher.o: $(srcdir)/examples/ldns-keyfetcher.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -772,31 +795,31 @@ examples/ldns-keyfetcher.lo examples/ldn $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-keygen.lo examples/ldns-keygen.o: $(srcdir)/examples/ldns-keygen.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-mx.lo examples/ldns-mx.o: $(srcdir)/examples/ldns-mx.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-notify.lo examples/ldns-notify.o: $(srcdir)/examples/ldns-notify.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-nsec3-hash.lo examples/ldns-nsec3-hash.o: $(srcdir)/examples/ldns-nsec3-hash.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -804,7 +827,7 @@ examples/ldns-nsec3-hash.lo examples/ldn $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-read-zone.lo examples/ldns-read-zone.o: $(srcdir)/examples/ldns-read-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -812,7 +835,7 @@ examples/ldns-read-zone.lo examples/ldns $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-resolver.lo examples/ldns-resolver.o: $(srcdir)/examples/ldns-resolver.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -820,23 +843,23 @@ examples/ldns-resolver.lo examples/ldns- $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-revoke.lo examples/ldns-revoke.o: $(srcdir)/examples/ldns-revoke.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-rrsig.lo examples/ldns-rrsig.o: $(srcdir)/examples/ldns-rrsig.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-signzone.lo examples/ldns-signzone.o: $(srcdir)/examples/ldns-signzone.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -844,7 +867,7 @@ examples/ldns-signzone.lo examples/ldns- $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-test-edns.lo examples/ldns-test-edns.o: $(srcdir)/examples/ldns-test-edns.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -852,15 +875,15 @@ examples/ldns-test-edns.lo examples/ldns $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-testns.lo examples/ldns-testns.o: $(srcdir)/examples/ldns-testns.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h examples/ldns-testpkts.lo examples/ldns-testpkts.o: $(srcdir)/examples/ldns-testpkts.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -868,15 +891,16 @@ examples/ldns-testpkts.lo examples/ldns- $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h $(srcdir)/examples/ldns-testpkts.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h \ + $(srcdir)/examples/ldns-testpkts.h examples/ldns-update.lo examples/ldns-update.o: $(srcdir)/examples/ldns-update.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-verify-zone.lo examples/ldns-verify-zone.o: $(srcdir)/examples/ldns-verify-zone.c ldns/config.h $(srcdir)/ldns/ldns.h \ ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h \ $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h \ @@ -884,39 +908,39 @@ examples/ldns-verify-zone.lo examples/ld $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \ $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h \ $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-version.lo examples/ldns-version.o: $(srcdir)/examples/ldns-version.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-walk.lo examples/ldns-walk.o: $(srcdir)/examples/ldns-walk.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-zcat.lo examples/ldns-zcat.o: $(srcdir)/examples/ldns-zcat.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-zsplit.lo examples/ldns-zsplit.o: $(srcdir)/examples/ldns-zsplit.c ldns/config.h $(srcdir)/ldns/ldns.h ldns/util.h \ ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h \ $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/keys.h \ $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h \ $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h \ $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/chasetrace.lo drill/chasetrace.o: $(srcdir)/drill/chasetrace.c $(srcdir)/drill/drill.h ldns/config.h \ $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \ $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \ @@ -924,8 +948,8 @@ drill/chasetrace.lo drill/chasetrace.o: $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \ $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \ $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/dnssec.lo drill/dnssec.o: $(srcdir)/drill/dnssec.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \ $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \ $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \ @@ -933,7 +957,7 @@ drill/dnssec.lo drill/dnssec.o: $(srcdir $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \ $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \ ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/drill.lo drill/drill.o: $(srcdir)/drill/drill.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \ $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \ $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \ @@ -941,7 +965,7 @@ drill/drill.lo drill/drill.o: $(srcdir)/ $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \ $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \ ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/drill_util.lo drill/drill_util.o: $(srcdir)/drill/drill_util.c $(srcdir)/drill/drill.h ldns/config.h \ $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \ $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \ @@ -949,8 +973,8 @@ drill/drill_util.lo drill/drill_util.o: $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \ $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \ $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/error.lo drill/error.o: $(srcdir)/drill/error.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \ $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \ $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \ @@ -958,7 +982,7 @@ drill/error.lo drill/error.o: $(srcdir)/ $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \ $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \ ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/root.lo drill/root.o: $(srcdir)/drill/root.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \ $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \ $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \ @@ -966,7 +990,7 @@ drill/root.lo drill/root.o: $(srcdir)/dr $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \ $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \ ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/securetrace.lo drill/securetrace.o: $(srcdir)/drill/securetrace.c $(srcdir)/drill/drill.h ldns/config.h \ $(srcdir)/drill/drill_util.h $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h \ $(srcdir)/ldns/error.h $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h \ @@ -974,8 +998,8 @@ drill/securetrace.lo drill/securetrace.o $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h \ $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h \ $(srcdir)/ldns/host2wire.h ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h \ + $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h drill/work.lo drill/work.o: $(srcdir)/drill/work.c $(srcdir)/drill/drill.h ldns/config.h $(srcdir)/drill/drill_util.h \ $(srcdir)/ldns/ldns.h ldns/util.h ldns/common.h $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \ $(srcdir)/ldns/dane.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/rr.h $(srcdir)/ldns/dname.h $(srcdir)/ldns/dnssec.h \ @@ -983,7 +1007,7 @@ drill/work.lo drill/work.o: $(srcdir)/dr $(srcdir)/ldns/dnssec_zone.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h \ $(srcdir)/ldns/dnssec_sign.h $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \ ldns/net.h $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h + $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/radix.h $(srcdir)/ldns/sha1.h $(srcdir)/ldns/sha2.h examples/ldns-chaos: examples/ldns-chaos.lo examples/ldns-chaos.o $(LIB) examples/ldns-compare-zones: examples/ldns-compare-zones.lo examples/ldns-compare-zones.o $(LIB) examples/ldnsd: examples/ldnsd.lo examples/ldnsd.o $(LIB) Modified: stable/10/contrib/ldns/README ============================================================================== --- stable/10/contrib/ldns/README Tue Jul 29 20:38:08 2014 (r269256) +++ stable/10/contrib/ldns/README Tue Jul 29 20:57:38 2014 (r269257) @@ -37,11 +37,11 @@ INSTALLATION 5. make install -* Building from subversion repository +* Building from repository If you are building from the repository you will need to have (gnu) autotools like libtool and autoreconf installed. A list of all the commands -needed to build everything can be found in README.svn. Note that the actual +needed to build everything can be found in README.git. Note that the actual commands may be a little bit different on your machine. Most notable, you'll need to run libtoolize (or glibtoolize), if you skip this step, you'll get an error about missing config.sub. * Developers Copied: stable/10/contrib/ldns/README.git (from r266114, head/contrib/ldns/README.git) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/ldns/README.git Tue Jul 29 20:57:38 2014 (r269257, copy of r266114, head/contrib/ldns/README.git) @@ -0,0 +1,22 @@ +# The ldns git repository can found at: +# git.nlnetlabs.nl/ldns/ + +# small list of commands to build all on a linux system +# libtoolize is needed for most other targets + +# on Solaris, and other systems that may not have +# the default 'automake' and 'aclocal' script aliases, +# the correct versions may need to be set. On those +# systems, the 'autoreconf' line should be changed to: +# AUTOMAKE=automake-1.10 ACLOCAL=aclocal-1.10 autoreconf + +# older versions of libtoolize do not support --install +# so you might need to remove that (with newer versions +# it is needed) +libtoolize -c --install +autoreconf --install +./configure --with-examples --with-drill # --with-pyldns --with-p5-dns-ldns +make +make doc # needs doxygen for the html pages +(cd pcat && autoreconf && ./configure && make) +(cd examples/nsd-test && autoreconf && ./configure && make) Modified: stable/10/contrib/ldns/acx_nlnetlabs.m4 ============================================================================== --- stable/10/contrib/ldns/acx_nlnetlabs.m4 Tue Jul 29 20:38:08 2014 (r269256) +++ stable/10/contrib/ldns/acx_nlnetlabs.m4 Tue Jul 29 20:57:38 2014 (r269257) @@ -2,7 +2,12 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 21 +# Version 26 +# 2013-09-19 FLTO help text improved. +# 2013-07-18 Enable ACX_CHECK_COMPILER_FLAG to test for -Wstrict-prototypes +# 2013-06-25 FLTO has --disable-flto option. +# 2013-05-03 Update W32_SLEEP for newer mingw that links but not defines it. +# 2013-03-22 Fix ACX_RSRC_VERSION for long version numbers. # 2012-02-09 Fix AHX_MEMCMP_BROKEN with undef in compat/memcmp.h. # 2012-01-20 Fix COMPILER_FLAGS_UNBOUND for gcc 4.6.2 assigned-not-used-warns. # 2011-12-05 Fix getaddrinfowithincludes on windows with fedora16 mingw32-gcc. @@ -17,7 +22,7 @@ # 2010-07-02 Add check for ss_family (for minix). # 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. # 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. -# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS separate, -ldl # 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN # 2010-01-20 added AHX_COONFIG_STRLCAT # 2009-07-14 U_CHAR detection improved for windows crosscompile. @@ -101,7 +106,7 @@ dnl Calculate comma separated windows-re dnl Picks the first three(,0) or four numbers out of the name. dnl $1: variable for the result AC_DEFUN([ACX_RSRC_VERSION], -[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `] +[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9][^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1,\2,\3,0/' `] ]) dnl Routine to help check for compiler flags. @@ -116,7 +121,7 @@ AC_MSG_CHECKING(whether $CC supports -$1 cache=`echo $1 | sed 'y%.=/+-%___p_%'` AC_CACHE_VAL(cv_prog_cc_flag_$cache, [ -echo 'void f(){}' >conftest.c +echo 'void f(void){}' >conftest.c if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then eval "cv_prog_cc_flag_$cache=yes" else @@ -405,19 +410,22 @@ int test() { dnl Check if CC supports -flto. dnl in a way that supports clang and suncc (that flag does something else, dnl but fails to link). It sets it in CFLAGS if it works. -AC_DEFUN([ACX_CHECK_FLTO], -[AC_MSG_CHECKING([if $CC supports -flto]) -BAKCFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -flto" -AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ - if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then - CFLAGS="$BAKCFLAGS" - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - fi - rm -f conftest conftest.c conftest.o -], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)]) +AC_DEFUN([ACX_CHECK_FLTO], [ + AC_ARG_ENABLE([flto], AS_HELP_STRING([--disable-flto], [Disable link-time optimization (gcc specific option)])) + AS_IF([test "x$enable_flto" != "xno"], [ + AC_MSG_CHECKING([if $CC supports -flto]) + BAKCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -flto" + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [ + if $CC $CFLAGS -o conftest conftest.c 2>&1 | grep "warning: no debug symbols in executable" >/dev/null; then + CFLAGS="$BAKCFLAGS" + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi + rm -f conftest conftest.c conftest.o + ], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)]) + ]) ]) dnl Check the printf-format attribute (if any) @@ -1208,7 +1216,7 @@ struct tm *gmtime_r(const time_t *timep, dnl provide w32 compat definition for sleep AC_DEFUN([AHX_CONFIG_W32_SLEEP], [ -#ifndef HAVE_SLEEP +#if !defined(HAVE_SLEEP) || defined(HAVE_WINDOWS_H) #define sleep(x) Sleep((x)*1000) /* on win32 */ #endif /* HAVE_SLEEP */ ]) Modified: stable/10/contrib/ldns/ax_python_devel.m4 ============================================================================== --- stable/10/contrib/ldns/ax_python_devel.m4 Tue Jul 29 20:38:08 2014 (r269256) +++ stable/10/contrib/ldns/ax_python_devel.m4 Tue Jul 29 20:57:38 2014 (r269257) @@ -34,11 +34,12 @@ # LICENSE # # Copyright (c) 2009 Sebastian Huber -# Copyright (c) 2009 Alan W. Irwin +# Copyright (c) 2009 Alan W. Irwin # Copyright (c) 2009 Rafael Laboissiere -# Copyright (c) 2009 Andrew Collier +# Copyright (c) 2009 Andrew Collier # Copyright (c) 2009 Matteo Settenvini # Copyright (c) 2009 Horst Knorr +# Copyright (c) 2013 Daniel Mullner # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -66,7 +67,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 8 +#serial 16 AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) AC_DEFUN([AX_PYTHON_DEVEL],[ @@ -153,8 +154,14 @@ $ac_distutils_result]) if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_inc ());"` + plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ + print (distutils.sysconfig.get_python_inc (plat_specific=1));"` if test -n "${python_path}"; then - python_path="-I$python_path" + if test "${plat_python_path}" != "${python_path}"; then + python_path="-I$python_path -I$plat_python_path" + else + python_path="-I$python_path" + fi fi PYTHON_CPPFLAGS=$python_path fi @@ -173,13 +180,10 @@ $ac_distutils_result]) # join all versioning strings, on some systems # major/minor numbers could be in different list elements from distutils.sysconfig import * -ret = '' -for e in get_config_vars ('VERSION'): - if (e != None): - ret += e -print (ret) -EOD -` +e = get_config_var('VERSION') +if e is not None: + print(e) +EOD` if test -z "$ac_python_version"; then if test -n "$PYTHON_VERSION"; then @@ -199,34 +203,27 @@ EOD # There should be only one import distutils.sysconfig -for e in distutils.sysconfig.get_config_vars ('LIBDIR'): - if e != None: - print (e) - break -EOD -` - - # Before checking for libpythonX.Y, we need to know - # the extension the OS we're on uses for libraries - # (we take the first one, if there's more than one fix me!): - ac_python_soext=`$PYTHON -c \ - "import distutils.sysconfig; \ - print (distutils.sysconfig.get_config_vars('SO')[[0]])"` +e = distutils.sysconfig.get_config_var('LIBDIR') +if e is not None: + print (e) +EOD` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:05:52 2014 Return-Path: Delivered-To: svn-src-all@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 F33E81A9; Tue, 29 Jul 2014 21:05:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E047225A4; Tue, 29 Jul 2014 21:05:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TL5pX2055553; Tue, 29 Jul 2014 21:05:51 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TL5pT4055552; Tue, 29 Jul 2014 21:05:51 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201407292105.s6TL5pT4055552@svn.freebsd.org> From: Rick Macklem Date: Tue, 29 Jul 2014 21:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269258 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:05:52 -0000 Author: rmacklem Date: Tue Jul 29 21:05:51 2014 New Revision: 269258 URL: http://svnweb.freebsd.org/changeset/base/269258 Log: MFC: r268726 Move the "retry:" label so that the calls to m_pullup() are not done after the call to m_defrag(). This fixes a problem where m_pullup() would prepend an mbuf to the list created by m_defrag() making the chain greater than 32 again. Modified: stable/10/sys/dev/e1000/if_em.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Tue Jul 29 20:57:38 2014 (r269257) +++ stable/10/sys/dev/e1000/if_em.c Tue Jul 29 21:05:51 2014 (r269258) @@ -1830,7 +1830,6 @@ em_xmit(struct tx_ring *txr, struct mbuf int nsegs, i, j, first, last = 0; int error, do_tso, tso_desc = 0, remap = 1; -retry: m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0); @@ -1956,6 +1955,7 @@ retry: tx_buffer_mapped = tx_buffer; map = tx_buffer->map; +retry: error = bus_dmamap_load_mbuf_sg(txr->txtag, map, *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:10:10 2014 Return-Path: Delivered-To: svn-src-all@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 D038C3FE for ; Tue, 29 Jul 2014 21:10:10 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 555C225DA for ; Tue, 29 Jul 2014 21:10:10 +0000 (UTC) Received: by mail-la0-f41.google.com with SMTP id s18so198048lam.14 for ; Tue, 29 Jul 2014 14:10:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=bqkODvUJHRYURJJViPrHRH2vt/UcZdH7EPQ5fq8/pBs=; b=EYqHSFL/EnBEK7edp6P/UU6FpApg6gJ9TlZvrNGhAK11rrlcXrfJkKBEVrZxXipATh 8cUMvq9SGxTMr1MOj+QthPqN00viu2FnoTFRpmk3F/2H+eBq4wUCIHJMEcuE2EEo0Tc9 Sx5K5oXCEypbgSHoteg28sU6dxbnjZWIfi18E0qPYLSEaGsZnaxNGLeKLfMIYrLyxhlW YQmpm3CdA6kxAaRrm7SJ7dj4mi/om65obEvcgZIRcyj+nFc/OgMu+Ya4lMMzzq7hZ28l RVwyCQ5LieqR81kWKc/ACalSMOgIcjYQovh7dSvUBdxlC+V/Q9lYq2WqyRpVda41djFp aH6w== X-Gm-Message-State: ALoCoQmrxf0Wwo3ZJL7bjJmCkpFDwx94X62LshFFhMqg9wpC5iYC+8sd78Sm0a9KLe41/9s3PndZ X-Received: by 10.112.150.106 with SMTP id uh10mr4836944lbb.11.1406668202136; Tue, 29 Jul 2014 14:10:02 -0700 (PDT) Received: from raynote.ddteam.net (91-93-133-95.pool.ukrtel.net. [95.133.93.91]) by mx.google.com with ESMTPSA id la6sm72478lac.12.2014.07.29.14.10.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jul 2014 14:10:01 -0700 (PDT) Date: Wed, 30 Jul 2014 00:07:43 +0300 From: Aleksandr Rybalko To: Stefan Farfeleder Subject: Re: svn commit: r269188 - head/sys/dev/vt Message-Id: <20140730000743.1713fc43ec90a20c888e2511@ddteam.net> In-Reply-To: <20140728143722.GB1263@mole.fafoe.narf.at> References: <201407281422.s6SEMYuC087922@svn.freebsd.org> <20140728143722.GB1263@mole.fafoe.narf.at> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.22; amd64-portbld-freebsd11.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Aleksandr Rybalko , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:10:10 -0000 On Mon, 28 Jul 2014 16:37:23 +0200 Stefan Farfeleder wrote: > On Mon, Jul 28, 2014 at 02:22:34PM +0000, Aleksandr Rybalko wrote: > > Author: ray > > Date: Mon Jul 28 14:22:34 2014 > > New Revision: 269188 > > URL: http://svnweb.freebsd.org/changeset/base/269188 > > > > Log: > > Avoid embedding buffers into static virtual terminal window. > > > > MFC after: 1 week > > Sponsored by: The FreeBSD Foundation > > > > Modified: > > head/sys/dev/vt/vt_core.c > > > > Modified: head/sys/dev/vt/vt_core.c > > ============================================================================== > > --- head/sys/dev/vt/vt_core.c Mon Jul 28 14:20:31 2014 (r269187) > > +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:22:34 2014 (r269188) > > @@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = > > .vw_number = VT_CONSWINDOW, > > .vw_flags = VWF_CONSOLE, > > .vw_buf = { > > - .vb_buffer = vt_constextbuf, > > - .vb_rows = vt_constextbufrows, > > + .vb_buffer = &vt_constextbuf[0], > > + .vb_rows = &vt_constextbufrows[0], > > .vb_history_size = VBF_DEFAULT_HISTORY_SIZE, > > .vb_curroffset = 0, > > .vb_roffset = 0, > > > > Hi Aleksandr, > > What's that supposed to change exactly? I'd be very surprised if it > didn't produce the same binary code. > > BR, > Stefan Hi Stefan! yeah, you a right, it's change nothing. I did wrong assumption, confuse with other things. But will left it. It looks better for me :) Thanks for review! WBW -- Aleksandr Rybalko From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:15:24 2014 Return-Path: Delivered-To: svn-src-all@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 D36FA693; Tue, 29 Jul 2014 21:15:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0A452686; Tue, 29 Jul 2014 21:15:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TLFOWv063260; Tue, 29 Jul 2014 21:15:24 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TLFOmr063259; Tue, 29 Jul 2014 21:15:24 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292115.s6TLFOmr063259@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 21:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269259 - stable/9/lib/libc/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:15:24 -0000 Author: markj Date: Tue Jul 29 21:15:24 2014 New Revision: 269259 URL: http://svnweb.freebsd.org/changeset/base/269259 Log: MFC r268446: Fix a typo. Modified: stable/9/lib/libc/sys/procctl.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/procctl.2 ============================================================================== --- stable/9/lib/libc/sys/procctl.2 Tue Jul 29 21:05:51 2014 (r269258) +++ stable/9/lib/libc/sys/procctl.2 Tue Jul 29 21:15:24 2014 (r269259) @@ -50,7 +50,7 @@ If multiple processes match the identifi .Nm will make a .Dq best effort -to control as many of the selected possibles as possible. +to control as many of the selected processes as possible. An error is only returned if no selected processes successfully complete the request. The following identifier types are supported: From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:15:26 2014 Return-Path: Delivered-To: svn-src-all@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 D9D87769; Tue, 29 Jul 2014 21:15: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C51B32687; Tue, 29 Jul 2014 21:15:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TLFQjx063307; Tue, 29 Jul 2014 21:15:26 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TLFQaT063306; Tue, 29 Jul 2014 21:15:26 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292115.s6TLFQaT063306@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 21:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269260 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:15:26 -0000 Author: markj Date: Tue Jul 29 21:15:26 2014 New Revision: 269260 URL: http://svnweb.freebsd.org/changeset/base/269260 Log: MFC r268446: Fix a typo. Modified: stable/10/lib/libc/sys/procctl.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/procctl.2 ============================================================================== --- stable/10/lib/libc/sys/procctl.2 Tue Jul 29 21:15:24 2014 (r269259) +++ stable/10/lib/libc/sys/procctl.2 Tue Jul 29 21:15:26 2014 (r269260) @@ -50,7 +50,7 @@ If multiple processes match the identifi .Nm will make a .Dq best effort -to control as many of the selected possibles as possible. +to control as many of the selected processes as possible. An error is only returned if no selected processes successfully complete the request. The following identifier types are supported: From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:21:15 2014 Return-Path: Delivered-To: svn-src-all@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 9B155E23; Tue, 29 Jul 2014 21:21: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87B84274A; Tue, 29 Jul 2014 21:21:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TLLFhD065783; Tue, 29 Jul 2014 21:21:15 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TLLFrX065782; Tue, 29 Jul 2014 21:21:15 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292121.s6TLLFrX065782@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 21:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269262 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:21:15 -0000 Author: markj Date: Tue Jul 29 21:21:15 2014 New Revision: 269262 URL: http://svnweb.freebsd.org/changeset/base/269262 Log: MFC r264486: Use the correct format specifiers for wide characters and strings of wide characters. Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue Jul 29 21:16:35 2014 (r269261) +++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue Jul 29 21:21:15 2014 (r269262) @@ -694,8 +694,13 @@ static const dt_pfconv_t _dtrace_convers { "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr }, { "T", "s", "int64_t", pfcheck_time, pfprint_time822 }, { "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint }, +#if defined(sun) { "wc", "wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */ { "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, +#else +{ "wc", "lc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */ +{ "ws", "ls", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, +#endif { "x", "x", pfproto_xint, pfcheck_xint, pfprint_uint }, { "X", "X", pfproto_xint, pfcheck_xint, pfprint_uint }, { "Y", "s", "int64_t", pfcheck_time, pfprint_time }, From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:21:18 2014 Return-Path: Delivered-To: svn-src-all@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 C4730EF8; Tue, 29 Jul 2014 21:21:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D281274F; Tue, 29 Jul 2014 21:21:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TLLG7u065829; Tue, 29 Jul 2014 21:21:16 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TLLGli065827; Tue, 29 Jul 2014 21:21:16 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292121.s6TLLGli065827@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 21:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269263 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:21:18 -0000 Author: markj Date: Tue Jul 29 21:21:16 2014 New Revision: 269263 URL: http://svnweb.freebsd.org/changeset/base/269263 Log: MFC r264486: Use the correct format specifiers for wide characters and strings of wide characters. Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue Jul 29 21:21:15 2014 (r269262) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c Tue Jul 29 21:21:16 2014 (r269263) @@ -694,8 +694,13 @@ static const dt_pfconv_t _dtrace_convers { "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr }, { "T", "s", "int64_t", pfcheck_time, pfprint_time822 }, { "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint }, +#if defined(sun) { "wc", "wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */ { "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, +#else +{ "wc", "lc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */ +{ "ws", "ls", pfproto_wstr, pfcheck_wstr, pfprint_wstr }, +#endif { "x", "x", pfproto_xint, pfcheck_xint, pfprint_uint }, { "X", "X", pfproto_xint, pfcheck_xint, pfprint_uint }, { "Y", "s", "int64_t", pfcheck_time, pfprint_time }, From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 21:59:25 2014 Return-Path: Delivered-To: svn-src-all@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 E04CF7D7; Tue, 29 Jul 2014 21:59: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B35A32AD4; Tue, 29 Jul 2014 21:59:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TLxPOk086971; Tue, 29 Jul 2014 21:59:25 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TLxO7h086966; Tue, 29 Jul 2014 21:59:24 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292159.s6TLxO7h086966@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 21:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269266 - stable/10/sys/dev/usb/wlan X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:59:26 -0000 Author: hselasky Date: Tue Jul 29 21:59:24 2014 New Revision: 269266 URL: http://svnweb.freebsd.org/changeset/base/269266 Log: MFC r269127: Fix for division by zero. Modified: stable/10/sys/dev/usb/wlan/if_rum.c stable/10/sys/dev/usb/wlan/if_ural.c stable/10/sys/dev/usb/wlan/if_zyd.c stable/10/sys/dev/usb/wlan/if_zydreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/wlan/if_rum.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_rum.c Tue Jul 29 21:38:06 2014 (r269265) +++ stable/10/sys/dev/usb/wlan/if_rum.c Tue Jul 29 21:59:24 2014 (r269266) @@ -1034,6 +1034,8 @@ rum_setup_tx_desc(struct rum_softc *sc, desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/10/sys/dev/usb/wlan/if_ural.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_ural.c Tue Jul 29 21:38:06 2014 (r269265) +++ stable/10/sys/dev/usb/wlan/if_ural.c Tue Jul 29 21:59:24 2014 (r269266) @@ -1037,6 +1037,8 @@ ural_setup_tx_desc(struct ural_softc *sc desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/10/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 21:38:06 2014 (r269265) +++ stable/10/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 21:59:24 2014 (r269266) @@ -2479,7 +2479,7 @@ zyd_tx_start(struct zyd_softc *sc, struc const struct ieee80211_txparam *tp; struct ieee80211_key *k; int rate, totlen; - static uint8_t ratediv[] = ZYD_TX_RATEDIV; + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; uint8_t phy; uint16_t pktlen; uint32_t bits; Modified: stable/10/sys/dev/usb/wlan/if_zydreg.h ============================================================================== --- stable/10/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 21:38:06 2014 (r269265) +++ stable/10/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 21:59:24 2014 (r269266) @@ -970,7 +970,7 @@ #define ZYD_TX_RATEDIV \ { \ - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ 0x36, 0x24, 0x12, 0x9 \ } From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:00:56 2014 Return-Path: Delivered-To: svn-src-all@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 0D3F1A11; Tue, 29 Jul 2014 22:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D48662AF8; Tue, 29 Jul 2014 22:00:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TM0txf089343; Tue, 29 Jul 2014 22:00:55 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TM0tet089173; Tue, 29 Jul 2014 22:00:55 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292200.s6TM0tet089173@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 22:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269267 - stable/9/sys/dev/usb/wlan X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:00:56 -0000 Author: hselasky Date: Tue Jul 29 22:00:54 2014 New Revision: 269267 URL: http://svnweb.freebsd.org/changeset/base/269267 Log: MFC r269127: Fix for division by zero. Modified: stable/9/sys/dev/usb/wlan/if_rum.c stable/9/sys/dev/usb/wlan/if_ural.c stable/9/sys/dev/usb/wlan/if_zyd.c stable/9/sys/dev/usb/wlan/if_zydreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/wlan/if_rum.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_rum.c Tue Jul 29 21:59:24 2014 (r269266) +++ stable/9/sys/dev/usb/wlan/if_rum.c Tue Jul 29 22:00:54 2014 (r269267) @@ -1034,6 +1034,8 @@ rum_setup_tx_desc(struct rum_softc *sc, desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/9/sys/dev/usb/wlan/if_ural.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_ural.c Tue Jul 29 21:59:24 2014 (r269266) +++ stable/9/sys/dev/usb/wlan/if_ural.c Tue Jul 29 22:00:54 2014 (r269267) @@ -1037,6 +1037,8 @@ ural_setup_tx_desc(struct ural_softc *sc desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/9/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 21:59:24 2014 (r269266) +++ stable/9/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 22:00:54 2014 (r269267) @@ -2479,7 +2479,7 @@ zyd_tx_start(struct zyd_softc *sc, struc const struct ieee80211_txparam *tp; struct ieee80211_key *k; int rate, totlen; - static uint8_t ratediv[] = ZYD_TX_RATEDIV; + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; uint8_t phy; uint16_t pktlen; uint32_t bits; Modified: stable/9/sys/dev/usb/wlan/if_zydreg.h ============================================================================== --- stable/9/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 21:59:24 2014 (r269266) +++ stable/9/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 22:00:54 2014 (r269267) @@ -970,7 +970,7 @@ #define ZYD_TX_RATEDIV \ { \ - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ 0x36, 0x24, 0x12, 0x9 \ } From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:02:29 2014 Return-Path: Delivered-To: svn-src-all@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 1671AB5F; Tue, 29 Jul 2014 22:02: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD9592B80; Tue, 29 Jul 2014 22:02:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TM2S4w090790; Tue, 29 Jul 2014 22:02:28 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TM2SG6090783; Tue, 29 Jul 2014 22:02:28 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292202.s6TM2SG6090783@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 22:02:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r269268 - stable/8/sys/dev/usb/wlan X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:02:29 -0000 Author: hselasky Date: Tue Jul 29 22:02:27 2014 New Revision: 269268 URL: http://svnweb.freebsd.org/changeset/base/269268 Log: MFC r269127: Fix for division by zero. Modified: stable/8/sys/dev/usb/wlan/if_rum.c stable/8/sys/dev/usb/wlan/if_ural.c stable/8/sys/dev/usb/wlan/if_zyd.c stable/8/sys/dev/usb/wlan/if_zydreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/wlan/if_rum.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_rum.c Tue Jul 29 22:00:54 2014 (r269267) +++ stable/8/sys/dev/usb/wlan/if_rum.c Tue Jul 29 22:02:27 2014 (r269268) @@ -1019,6 +1019,8 @@ rum_setup_tx_desc(struct rum_softc *sc, desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/8/sys/dev/usb/wlan/if_ural.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_ural.c Tue Jul 29 22:00:54 2014 (r269267) +++ stable/8/sys/dev/usb/wlan/if_ural.c Tue Jul 29 22:02:27 2014 (r269268) @@ -1022,6 +1022,8 @@ ural_setup_tx_desc(struct ural_softc *sc desc->plcp_length_hi = plcp_length >> 6; desc->plcp_length_lo = plcp_length & 0x3f; } else { + if (rate == 0) + rate = 2; /* avoid division by zero */ plcp_length = (16 * len + rate - 1) / rate; if (rate == 22) { remainder = (16 * len) % 22; Modified: stable/8/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 22:00:54 2014 (r269267) +++ stable/8/sys/dev/usb/wlan/if_zyd.c Tue Jul 29 22:02:27 2014 (r269268) @@ -2457,7 +2457,7 @@ zyd_tx_start(struct zyd_softc *sc, struc const struct ieee80211_txparam *tp; struct ieee80211_key *k; int rate, totlen; - static uint8_t ratediv[] = ZYD_TX_RATEDIV; + static const uint8_t ratediv[] = ZYD_TX_RATEDIV; uint8_t phy; uint16_t pktlen; uint32_t bits; Modified: stable/8/sys/dev/usb/wlan/if_zydreg.h ============================================================================== --- stable/8/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 22:00:54 2014 (r269267) +++ stable/8/sys/dev/usb/wlan/if_zydreg.h Tue Jul 29 22:02:27 2014 (r269268) @@ -970,7 +970,7 @@ #define ZYD_TX_RATEDIV \ { \ - 0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6, \ + 0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6, \ 0x36, 0x24, 0x12, 0x9 \ } From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:04:07 2014 Return-Path: Delivered-To: svn-src-all@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 08891CAA; Tue, 29 Jul 2014 22:04:07 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9AF12B90; Tue, 29 Jul 2014 22:04:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TM468W091160; Tue, 29 Jul 2014 22:04:06 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TM46gU091158; Tue, 29 Jul 2014 22:04:06 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292204.s6TM46gU091158@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 22:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269269 - in stable/9/sys/dev/usb: . serial X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:04:07 -0000 Author: hselasky Date: Tue Jul 29 22:04:06 2014 New Revision: 269269 URL: http://svnweb.freebsd.org/changeset/base/269269 Log: MFC r268929: Add new device ID. PR: 191959 Modified: stable/9/sys/dev/usb/serial/u3g.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/9/sys/dev/usb/serial/u3g.c Tue Jul 29 22:02:27 2014 (r269268) +++ stable/9/sys/dev/usb/serial/u3g.c Tue Jul 29 22:04:06 2014 (r269269) @@ -343,6 +343,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(NOVATEL, EU870D, 0), U3G_DEV(NOVATEL, MC760, 0), U3G_DEV(NOVATEL, MC547, 0), + U3G_DEV(NOVATEL, MC679, 0), U3G_DEV(NOVATEL, MC950D, 0), U3G_DEV(NOVATEL, MIFI2200, U3GINIT_SCSIEJECT), U3G_DEV(NOVATEL, MIFI2200V, U3GINIT_SCSIEJECT), Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Tue Jul 29 22:02:27 2014 (r269268) +++ stable/9/sys/dev/usb/usbdevs Tue Jul 29 22:04:06 2014 (r269269) @@ -3237,6 +3237,7 @@ product NOVATEL U727_2 0x5100 Merlin U7 product NOVATEL U760 0x6000 Novatel U760 product NOVATEL MC760 0x6002 Novatel MC760 product NOVATEL MC547 0x7042 Novatel MC547 +product NOVATEL MC679 0x7031 Novatel MC679 product NOVATEL2 FLEXPACKGPS 0x0100 NovAtel FlexPack GPS receiver /* Merlin products */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:05:34 2014 Return-Path: Delivered-To: svn-src-all@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 9C4B6E25; Tue, 29 Jul 2014 22:05:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88DF92BA1; Tue, 29 Jul 2014 22:05:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TM5YZ4091511; Tue, 29 Jul 2014 22:05:34 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TM5YO5091508; Tue, 29 Jul 2014 22:05:34 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292205.s6TM5YO5091508@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 22:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269270 - in stable/10/sys/dev/usb: . serial X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:05:34 -0000 Author: hselasky Date: Tue Jul 29 22:05:33 2014 New Revision: 269270 URL: http://svnweb.freebsd.org/changeset/base/269270 Log: MFC r268929: Add new device ID. PR: 191959 Modified: stable/10/sys/dev/usb/serial/u3g.c stable/10/sys/dev/usb/usbdevs Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/10/sys/dev/usb/serial/u3g.c Tue Jul 29 22:04:06 2014 (r269269) +++ stable/10/sys/dev/usb/serial/u3g.c Tue Jul 29 22:05:33 2014 (r269270) @@ -343,6 +343,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(NOVATEL, EU870D, 0), U3G_DEV(NOVATEL, MC760, 0), U3G_DEV(NOVATEL, MC547, 0), + U3G_DEV(NOVATEL, MC679, 0), U3G_DEV(NOVATEL, MC950D, 0), U3G_DEV(NOVATEL, MIFI2200, U3GINIT_SCSIEJECT), U3G_DEV(NOVATEL, MIFI2200V, U3GINIT_SCSIEJECT), Modified: stable/10/sys/dev/usb/usbdevs ============================================================================== --- stable/10/sys/dev/usb/usbdevs Tue Jul 29 22:04:06 2014 (r269269) +++ stable/10/sys/dev/usb/usbdevs Tue Jul 29 22:05:33 2014 (r269270) @@ -3238,6 +3238,7 @@ product NOVATEL U727_2 0x5100 Merlin U7 product NOVATEL U760 0x6000 Novatel U760 product NOVATEL MC760 0x6002 Novatel MC760 product NOVATEL MC547 0x7042 Novatel MC547 +product NOVATEL MC679 0x7031 Novatel MC679 product NOVATEL2 FLEXPACKGPS 0x0100 NovAtel FlexPack GPS receiver /* Merlin products */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:07:53 2014 Return-Path: Delivered-To: svn-src-all@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 6EE9BFB6; Tue, 29 Jul 2014 22:07: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B47A2BC9; Tue, 29 Jul 2014 22:07:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TM7roG091953; Tue, 29 Jul 2014 22:07:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TM7qpf091951; Tue, 29 Jul 2014 22:07:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407292207.s6TM7qpf091951@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 29 Jul 2014 22:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r269271 - in stable/8/sys/dev/usb: . serial X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:07:53 -0000 Author: hselasky Date: Tue Jul 29 22:07:52 2014 New Revision: 269271 URL: http://svnweb.freebsd.org/changeset/base/269271 Log: MFC r268929: Add new device ID. PR: 191959 Modified: stable/8/sys/dev/usb/serial/u3g.c stable/8/sys/dev/usb/usbdevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/8/sys/dev/usb/serial/u3g.c Tue Jul 29 22:05:33 2014 (r269270) +++ stable/8/sys/dev/usb/serial/u3g.c Tue Jul 29 22:07:52 2014 (r269271) @@ -339,6 +339,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(NOVATEL, EU870D, 0), U3G_DEV(NOVATEL, MC760, 0), U3G_DEV(NOVATEL, MC547, 0), + U3G_DEV(NOVATEL, MC679, 0), U3G_DEV(NOVATEL, MC950D, 0), U3G_DEV(NOVATEL, MIFI2200V, U3GINIT_SCSIEJECT), U3G_DEV(NOVATEL, U720, 0), Modified: stable/8/sys/dev/usb/usbdevs ============================================================================== --- stable/8/sys/dev/usb/usbdevs Tue Jul 29 22:05:33 2014 (r269270) +++ stable/8/sys/dev/usb/usbdevs Tue Jul 29 22:07:52 2014 (r269271) @@ -3235,6 +3235,7 @@ product NOVATEL U727_2 0x5100 Merlin U7 product NOVATEL U760 0x6000 Novatel U760 product NOVATEL MC760 0x6002 Novatel MC760 product NOVATEL MC547 0x7042 Novatel MC547 +product NOVATEL MC679 0x7031 Novatel MC679 product NOVATEL2 FLEXPACKGPS 0x0100 NovAtel FlexPack GPS receiver /* Merlin products */ From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:26:42 2014 Return-Path: Delivered-To: svn-src-all@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 2EF21588; Tue, 29 Jul 2014 22:26: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C3162EFB; Tue, 29 Jul 2014 22:26:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TMQfbn001468; Tue, 29 Jul 2014 22:26:41 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TMQfv0001467; Tue, 29 Jul 2014 22:26:41 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292226.s6TMQfv0001467@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 22:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269272 - stable/10/sys/cddl/dev/systrace X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:26:42 -0000 Author: markj Date: Tue Jul 29 22:26:41 2014 New Revision: 269272 URL: http://svnweb.freebsd.org/changeset/base/269272 Log: MFC r264435: Ensure that all eight syscall arguments are available to dtrace_probe(), rather than just the first five. Modified: stable/10/sys/cddl/dev/systrace/systrace.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/dev/systrace/systrace.c ============================================================================== --- stable/10/sys/cddl/dev/systrace/systrace.c Tue Jul 29 22:07:52 2014 (r269271) +++ stable/10/sys/cddl/dev/systrace/systrace.c Tue Jul 29 22:26:41 2014 (r269272) @@ -168,6 +168,9 @@ static dtrace_pops_t systrace_pops = { static struct cdev *systrace_cdev; static dtrace_provider_id_t systrace_id; +typedef void (*systrace_dtrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t, + uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + #if !defined(LINUX_SYSTRACE) /* * Probe callback function. @@ -180,6 +183,7 @@ static void systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params, int ret) { + systrace_dtrace_probe_t probe; int n_args = 0; u_int64_t uargs[8]; @@ -211,7 +215,9 @@ systrace_probe(u_int32_t id, int sysnum, } /* Process the probe using the converted argments. */ - dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]); + probe = (systrace_dtrace_probe_t)dtrace_probe; + probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4], uargs[5], + uargs[6], uargs[7]); } #endif From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:26:43 2014 Return-Path: Delivered-To: svn-src-all@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 8551D589; Tue, 29 Jul 2014 22:26:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 72AB92EFC; Tue, 29 Jul 2014 22:26:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TMQh03001519; Tue, 29 Jul 2014 22:26:43 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TMQhk2001518; Tue, 29 Jul 2014 22:26:43 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292226.s6TMQhk2001518@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 22:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269273 - stable/9/sys/cddl/dev/systrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:26:43 -0000 Author: markj Date: Tue Jul 29 22:26:42 2014 New Revision: 269273 URL: http://svnweb.freebsd.org/changeset/base/269273 Log: MFC r264435: Ensure that all eight syscall arguments are available to dtrace_probe(), rather than just the first five. Modified: stable/9/sys/cddl/dev/systrace/systrace.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/systrace/systrace.c ============================================================================== --- stable/9/sys/cddl/dev/systrace/systrace.c Tue Jul 29 22:26:41 2014 (r269272) +++ stable/9/sys/cddl/dev/systrace/systrace.c Tue Jul 29 22:26:42 2014 (r269273) @@ -168,6 +168,9 @@ static dtrace_pops_t systrace_pops = { static struct cdev *systrace_cdev; static dtrace_provider_id_t systrace_id; +typedef void (*systrace_dtrace_probe_t)(dtrace_id_t, uintptr_t, uintptr_t, + uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + #if !defined(LINUX_SYSTRACE) /* * Probe callback function. @@ -180,6 +183,7 @@ static void systrace_probe(u_int32_t id, int sysnum, struct sysent *sysent, void *params, int ret) { + systrace_dtrace_probe_t probe; int n_args = 0; u_int64_t uargs[8]; @@ -211,7 +215,9 @@ systrace_probe(u_int32_t id, int sysnum, } /* Process the probe using the converted argments. */ - dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]); + probe = (systrace_dtrace_probe_t)dtrace_probe; + probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4], uargs[5], + uargs[6], uargs[7]); } #endif From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:29:31 2014 Return-Path: Delivered-To: svn-src-all@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 C162A7FC; Tue, 29 Jul 2014 22:29: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE87A2F09; Tue, 29 Jul 2014 22:29:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TMTVe5001965; Tue, 29 Jul 2014 22:29:31 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TMTVkY001964; Tue, 29 Jul 2014 22:29:31 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292229.s6TMTVkY001964@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 22:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269274 - stable/10/lib/libutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:29:31 -0000 Author: markj Date: Tue Jul 29 22:29:31 2014 New Revision: 269274 URL: http://svnweb.freebsd.org/changeset/base/269274 Log: MFC r265276: Fix a typo. Modified: stable/10/lib/libutil/kinfo_getfile.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/kinfo_getfile.3 ============================================================================== --- stable/10/lib/libutil/kinfo_getfile.3 Tue Jul 29 22:26:42 2014 (r269273) +++ stable/10/lib/libutil/kinfo_getfile.3 Tue Jul 29 22:29:31 2014 (r269274) @@ -48,7 +48,7 @@ field contains the process identifier. This should be the a process that you have privilege to access. The .Ar cntp -field is allows the caller to know how many records are returned. +field allows the caller to know how many records are returned. .Pp This function is a wrapper around .Xr sysctl 3 From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 22:29:32 2014 Return-Path: Delivered-To: svn-src-all@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 C2F1D7FE; Tue, 29 Jul 2014 22:29: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0B312F0A; Tue, 29 Jul 2014 22:29:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TMTWAp002006; Tue, 29 Jul 2014 22:29:32 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TMTWPp002005; Tue, 29 Jul 2014 22:29:32 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407292229.s6TMTWPp002005@svn.freebsd.org> From: Mark Johnston Date: Tue, 29 Jul 2014 22:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269275 - stable/9/lib/libutil X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 22:29:32 -0000 Author: markj Date: Tue Jul 29 22:29:32 2014 New Revision: 269275 URL: http://svnweb.freebsd.org/changeset/base/269275 Log: MFC r265276: Fix a typo. Modified: stable/9/lib/libutil/kinfo_getfile.3 Directory Properties: stable/9/lib/libutil/ (props changed) Modified: stable/9/lib/libutil/kinfo_getfile.3 ============================================================================== --- stable/9/lib/libutil/kinfo_getfile.3 Tue Jul 29 22:29:31 2014 (r269274) +++ stable/9/lib/libutil/kinfo_getfile.3 Tue Jul 29 22:29:32 2014 (r269275) @@ -48,7 +48,7 @@ field contains the process identifier. This should be the a process that you have privilege to access. The .Ar cntp -field is allows the caller to know how many records are returned. +field allows the caller to know how many records are returned. .Pp This function is a wrapper around .Xr sysctl 3 From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 23:11:06 2014 Return-Path: Delivered-To: svn-src-all@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 4F849950; Tue, 29 Jul 2014 23:11:06 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF9C2464; Tue, 29 Jul 2014 23:11:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TNB6Wu023704; Tue, 29 Jul 2014 23:11:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TNB5Ag023701; Tue, 29 Jul 2014 23:11:05 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201407292311.s6TNB5Ag023701@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 29 Jul 2014 23:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269278 - in head: . sys/dev/vt/hw/ofwfb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 23:11:06 -0000 Author: nwhitehorn Date: Tue Jul 29 23:11:05 2014 New Revision: 269278 URL: http://svnweb.freebsd.org/changeset/base/269278 Log: Make mmap() of the console device when using ofwfb work like other supported framebuffer drivers. This lets ofwfb work with xf86-video-scfb and makes the driver much more generic and less PCI-centric. This changes some user-visible behavior and will require updates to the xorg-server port on PowerPC when using ATI graphics cards. Modified: head/UPDATING head/sys/dev/vt/hw/ofwfb/ofwfb.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Jul 29 23:06:06 2014 (r269277) +++ head/UPDATING Tue Jul 29 23:11:05 2014 (r269278) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20140729: + The ofwfb driver, used to provide a graphics console on PowerPC when + using vt(4), no longer allows mmap() of all of physical memory. This + will prevent Xorg on PowerPC with some ATI graphics cards from + initializing properly unless x11-servers/xorg-server is updated to + 1.12.4_8 or newer. + 20140723: The xdev targets have been converted to using TARGET and TARGET_ARCH instead of XDEV and XDEV_ARCH. Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- head/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Jul 29 23:06:06 2014 (r269277) +++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Jul 29 23:11:05 2014 (r269278) @@ -52,16 +52,13 @@ struct ofwfb_softc { struct fb_info fb; phandle_t sc_node; + ihandle_t sc_handle; bus_space_tag_t sc_memt; - - struct ofw_pci_register sc_pciaddrs[8]; - int sc_num_pciaddrs; }; static vd_probe_t ofwfb_probe; static vd_init_t ofwfb_init; static vd_bitbltchr_t ofwfb_bitbltchr; -static vd_fb_mmap_t ofwfb_mmap; static const struct vt_driver vt_ofwfb_driver = { .vd_name = "ofwfb", @@ -70,7 +67,8 @@ static const struct vt_driver vt_ofwfb_d .vd_blank = vt_fb_blank, .vd_bitbltchr = ofwfb_bitbltchr, .vd_maskbitbltchr = ofwfb_bitbltchr, - .vd_fb_mmap = ofwfb_mmap, + .vd_fb_ioctl = vt_fb_ioctl, + .vd_fb_mmap = vt_fb_mmap, .vd_priority = VD_PRIORITY_GENERIC+1, }; @@ -198,17 +196,10 @@ static void ofwfb_initialize(struct vt_device *vd) { struct ofwfb_softc *sc = vd->vd_softc; - char name[64]; - ihandle_t ih; int i; cell_t retval; uint32_t oldpix; - /* Open display device, thereby initializing it */ - memset(name, 0, sizeof(name)); - OF_package_to_path(sc->sc_node, name, sizeof(name)); - ih = OF_open(name); - /* * Set up the color map */ @@ -219,7 +210,7 @@ ofwfb_initialize(struct vt_device *vd) 0, 255, 8, 255, 16); for (i = 0; i < 16; i++) { - OF_call_method("color!", ih, 4, 1, + OF_call_method("color!", sc->sc_handle, 4, 1, (cell_t)((sc->fb.fb_cmap[i] >> 16) & 0xff), (cell_t)((sc->fb.fb_cmap[i] >> 8) & 0xff), (cell_t)((sc->fb.fb_cmap[i] >> 0) & 0xff), @@ -260,7 +251,6 @@ ofwfb_init(struct vt_device *vd) struct ofwfb_softc *sc; char type[64]; phandle_t chosen; - ihandle_t stdout; phandle_t node; uint32_t depth, height, width, stride; uint32_t fb_phys; @@ -275,14 +265,15 @@ ofwfb_init(struct vt_device *vd) vd->vd_softc = sc = &ofwfb_conssoftc; chosen = OF_finddevice("/chosen"); - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); - node = OF_instance_to_package(stdout); + OF_getprop(chosen, "stdout", &sc->sc_handle, sizeof(ihandle_t)); + node = OF_instance_to_package(sc->sc_handle); if (node == -1) { /* * The "/chosen/stdout" does not exist try * using "screen" directly. */ node = OF_finddevice("screen"); + sc->sc_handle = OF_open("screen"); } OF_getprop(node, "device_type", type, sizeof(type)); if (strcmp(type, "display") != 0) @@ -291,6 +282,13 @@ ofwfb_init(struct vt_device *vd) /* Keep track of the OF node */ sc->sc_node = node; + /* + * Try to use a 32-bit framebuffer if possible. This may be + * unimplemented and fail. That's fine -- it just means we are + * stuck with the defaults. + */ + OF_call_method("set-depth", sc->sc_handle, 1, 1, (cell_t)32, &i); + /* Make sure we have needed properties */ if (OF_getproplen(node, "height") != sizeof(height) || OF_getproplen(node, "width") != sizeof(width) || @@ -302,7 +300,7 @@ ofwfb_init(struct vt_device *vd) OF_getprop(node, "depth", &depth, sizeof(depth)); if (depth != 8 && depth != 32) return (CN_DEAD); - sc->fb.fb_bpp = depth; + sc->fb.fb_bpp = sc->fb.fb_depth = depth; OF_getprop(node, "height", &height, sizeof(height)); OF_getprop(node, "width", &width, sizeof(width)); @@ -314,21 +312,6 @@ ofwfb_init(struct vt_device *vd) sc->fb.fb_size = sc->fb.fb_height * sc->fb.fb_stride; /* - * Get the PCI addresses of the adapter, if present. The node may be the - * child of the PCI device: in that case, try the parent for - * the assigned-addresses property. - */ - len = OF_getprop(node, "assigned-addresses", sc->sc_pciaddrs, - sizeof(sc->sc_pciaddrs)); - if (len == -1) { - len = OF_getprop(OF_parent(node), "assigned-addresses", - sc->sc_pciaddrs, sizeof(sc->sc_pciaddrs)); - } - if (len == -1) - len = 0; - sc->sc_num_pciaddrs = len / sizeof(struct ofw_pci_register); - - /* * Grab the physical address of the framebuffer, and then map it * into our memory space. If the MMU is not yet up, it will be * remapped for us when relocation turns on. @@ -339,13 +322,18 @@ ofwfb_init(struct vt_device *vd) #if defined(__powerpc__) sc->sc_memt = &bs_be_tag; - bus_space_map(sc->sc_memt, fb_phys, height * sc->fb.fb_stride, + bus_space_map(sc->sc_memt, fb_phys, sc->fb.fb_size, BUS_SPACE_MAP_PREFETCHABLE, &sc->fb.fb_vbase); #elif defined(__sparc64__) OF_decode_addr(node, 0, &space, &phys); sc->sc_memt = &ofwfb_memt[0]; sc->fb.fb_vbase = sparc64_fake_bustag(space, fb_phys, sc->sc_memt); + #elif defined(__arm__) + sc->sc_memt = fdtbus_bs_tag; + bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size, + BUS_SPACE_MAP_PREFETCHABLE, + (bus_space_handle_t *)&sc->fb.fb_vbase); #else #error Unsupported platform! #endif @@ -357,14 +345,31 @@ ofwfb_init(struct vt_device *vd) * Linux does the same thing. */ - fb_phys = sc->sc_num_pciaddrs; - for (i = 0; i < sc->sc_num_pciaddrs; i++) { + struct ofw_pci_register pciaddrs[8]; + int num_pciaddrs = 0; + + /* + * Get the PCI addresses of the adapter, if present. The node + * may be the child of the PCI device: in that case, try the + * parent for the assigned-addresses property. + */ + len = OF_getprop(node, "assigned-addresses", pciaddrs, + sizeof(pciaddrs)); + if (len == -1) { + len = OF_getprop(OF_parent(node), "assigned-addresses", + pciaddrs, sizeof(pciaddrs)); + } + if (len == -1) + len = 0; + num_pciaddrs = len / sizeof(struct ofw_pci_register); + + fb_phys = num_pciaddrs; + for (i = 0; i < num_pciaddrs; i++) { /* If it is too small, not the framebuffer */ - if (sc->sc_pciaddrs[i].size_lo < - sc->fb.fb_stride * height) + if (pciaddrs[i].size_lo < sc->fb.fb_stride * height) continue; /* If it is not memory, it isn't either */ - if (!(sc->sc_pciaddrs[i].phys_hi & + if (!(pciaddrs[i].phys_hi & OFW_PCI_PHYS_HI_SPACE_MEM32)) continue; @@ -372,12 +377,11 @@ ofwfb_init(struct vt_device *vd) fb_phys = i; /* If it is prefetchable, it certainly is */ - if (sc->sc_pciaddrs[i].phys_hi & - OFW_PCI_PHYS_HI_PREFETCHABLE) + if (pciaddrs[i].phys_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) break; } - if (fb_phys == sc->sc_num_pciaddrs) /* No candidates found */ + if (fb_phys == num_pciaddrs) /* No candidates found */ return (CN_DEAD); #if defined(__powerpc__) @@ -385,7 +389,10 @@ ofwfb_init(struct vt_device *vd) #elif defined(__sparc64__) OF_decode_addr(node, fb_phys, &space, &phys); sc->sc_memt = &ofwfb_memt[0]; - sc->sc_addr = sparc64_fake_bustag(space, phys, sc->sc_memt); + sc->fb.fb_vbase = sparc64_fake_bustag(space, phys, sc->sc_memt); + #else + /* No ability to interpret assigned-addresses otherwise */ + return (CN_DEAD); #endif } @@ -398,39 +405,3 @@ ofwfb_init(struct vt_device *vd) return (CN_INTERNAL); } -static int -ofwfb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - struct ofwfb_softc *sc = vd->vd_softc; - int i; - - /* - * Make sure the requested address lies within the PCI device's - * assigned addrs - */ - for (i = 0; i < sc->sc_num_pciaddrs; i++) - if (offset >= sc->sc_pciaddrs[i].phys_lo && - offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo)) - { -#ifdef VM_MEMATTR_WRITE_COMBINING - /* - * If this is a prefetchable BAR, we can (and should) - * enable write-combining. - */ - if (sc->sc_pciaddrs[i].phys_hi & - OFW_PCI_PHYS_HI_PREFETCHABLE) - *memattr = VM_MEMATTR_WRITE_COMBINING; -#endif - - *paddr = offset; - return (0); - } - - /* - * Hack for Radeon... - */ - *paddr = offset; - return (0); -} - From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 23:40:16 2014 Return-Path: Delivered-To: svn-src-all@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 A2A5D2C9; Tue, 29 Jul 2014 23:40: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9088C2687; Tue, 29 Jul 2014 23:40:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TNeGSe035815; Tue, 29 Jul 2014 23:40:16 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TNeGVI035810; Tue, 29 Jul 2014 23:40:16 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407292340.s6TNeGVI035810@svn.freebsd.org> From: Glen Barber Date: Tue, 29 Jul 2014 23:40:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r269279 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 23:40:16 -0000 Author: gjb Date: Tue Jul 29 23:40:15 2014 New Revision: 269279 URL: http://svnweb.freebsd.org/changeset/base/269279 Log: Turn releng/9.3 over to secteam. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Tue Jul 29 23:11:05 2014 (r269278) +++ svnadmin/conf/approvers Tue Jul 29 23:40:15 2014 (r269279) @@ -22,8 +22,7 @@ #^stable/8/ re #^stable/7/ re ^releng/10.0/ (security-officer|so) -^releng/9.3/ re -^releng/9.[0-2]/ (security-officer|so) +^releng/9.[0-3]/ (security-officer|so) ^releng/8.[0-4]/ (security-officer|so) ^releng/7.[0-4]/ (security-officer|so) ^releng/6.[0-4]/ (security-officer|so) From owner-svn-src-all@FreeBSD.ORG Tue Jul 29 23:42:52 2014 Return-Path: Delivered-To: svn-src-all@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 628B8669; Tue, 29 Jul 2014 23:42:52 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 503CC2726; Tue, 29 Jul 2014 23:42:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6TNgq5d039198; Tue, 29 Jul 2014 23:42:52 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6TNgqgN039197; Tue, 29 Jul 2014 23:42:52 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201407292342.s6TNgqgN039197@svn.freebsd.org> From: Hiren Panchasara Date: Tue, 29 Jul 2014 23:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269280 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 23:42:52 -0000 Author: hiren Date: Tue Jul 29 23:42:51 2014 New Revision: 269280 URL: http://svnweb.freebsd.org/changeset/base/269280 Log: Add a comment and while there, fix trailing whitespace. Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jul 29 23:40:15 2014 (r269279) +++ head/sys/netinet/in_pcb.c Tue Jul 29 23:42:51 2014 (r269280) @@ -349,6 +349,9 @@ in_pcbbind(struct inpcb *inp, struct soc } #endif +/* + * Select a local port (number) to use. + */ #if defined(INET) || defined(INET6) int in_pcb_lport(struct inpcb *inp, struct in_addr *laddrp, u_short *lportp, @@ -462,7 +465,7 @@ in_pcb_lport(struct inpcb *inp, struct i #ifdef INET if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) laddrp->s_addr = laddr.s_addr; -#endif +#endif *lportp = lport; return (0); From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 00:00:13 2014 Return-Path: Delivered-To: svn-src-all@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 8EC82DEC; Wed, 30 Jul 2014 00:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F854285C; Wed, 30 Jul 2014 00:00:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U00Dpk045447; Wed, 30 Jul 2014 00:00:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U00C6Y045439; Wed, 30 Jul 2014 00:00:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201407300000.s6U00C6Y045439@svn.freebsd.org> From: John Baldwin Date: Wed, 30 Jul 2014 00:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269281 - in head/sys: amd64/amd64 amd64/vmm/intel x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 00:00:13 -0000 Author: jhb Date: Wed Jul 30 00:00:12 2014 New Revision: 269281 URL: http://svnweb.freebsd.org/changeset/base/269281 Log: - Output a summary of optional VT-x features in dmesg similar to CPU features. If bootverbose is enabled, a detailed list is provided; otherwise, a single-line summary is displayed. - Add read-only sysctls for optional VT-x capabilities used by bhyve under a new hw.vmm.vmx.cap node. Move a few exiting sysctls that indicate the presence of optional capabilities under this node. CR: https://phabric.freebsd.org/D498 Reviewed by: grehan, neel MFC after: 1 week Modified: head/sys/amd64/amd64/identcpu.c head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/intel/vmx_msr.c head/sys/amd64/vmm/intel/vmx_msr.h head/sys/x86/include/specialreg.h Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Tue Jul 29 23:42:51 2014 (r269280) +++ head/sys/amd64/amd64/identcpu.c Wed Jul 30 00:00:12 2014 (r269281) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include /* XXX - should be in header file: */ @@ -73,6 +74,7 @@ static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_AMD_assoc(int i); static void print_via_padlock_info(void); +static void print_vmx_info(void); int cpu_class; char machine[] = "amd64"; @@ -428,6 +430,9 @@ printcpuinfo(void) if (via_feature_rng != 0 || via_feature_xcrypt != 0) print_via_padlock_info(); + if (cpu_feature2 & CPUID2_VMX) + print_vmx_info(); + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; @@ -722,3 +727,197 @@ print_via_padlock_info(void) "\015RSA" /* PMM */ ); } + +static uint32_t +vmx_settable(uint64_t basic, int msr, int true_msr) +{ + uint64_t val; + + if (basic & (1UL << 55)) + val = rdmsr(true_msr); + else + val = rdmsr(msr); + + /* Just report the controls that can be set to 1. */ + return (val >> 32); +} + +static void +print_vmx_info(void) +{ + uint64_t basic, msr; + uint32_t entry, exit, mask, pin, proc, proc2; + int comma; + + printf("\n VT-x: "); + msr = rdmsr(MSR_IA32_FEATURE_CONTROL); + if (!(msr & IA32_FEATURE_CONTROL_VMX_EN)) + printf("(disabled in BIOS) "); + basic = rdmsr(MSR_VMX_BASIC); + pin = vmx_settable(basic, MSR_VMX_PINBASED_CTLS, + MSR_VMX_TRUE_PINBASED_CTLS); + proc = vmx_settable(basic, MSR_VMX_PROCBASED_CTLS, + MSR_VMX_TRUE_PROCBASED_CTLS); + if (proc & PROCBASED_SECONDARY_CONTROLS) + proc2 = vmx_settable(basic, MSR_VMX_PROCBASED_CTLS2, + MSR_VMX_PROCBASED_CTLS2); + else + proc2 = 0; + exit = vmx_settable(basic, MSR_VMX_EXIT_CTLS, MSR_VMX_TRUE_EXIT_CTLS); + entry = vmx_settable(basic, MSR_VMX_ENTRY_CTLS, MSR_VMX_TRUE_ENTRY_CTLS); + + if (!bootverbose) { + comma = 0; + if (exit & VM_EXIT_SAVE_PAT && exit & VM_EXIT_LOAD_PAT && + entry & VM_ENTRY_LOAD_PAT) { + printf("%sPAT", comma ? "," : ""); + comma = 1; + } + if (proc & PROCBASED_HLT_EXITING) { + printf("%sHLT", comma ? "," : ""); + comma = 1; + } + if (proc & PROCBASED_MTF) { + printf("%sMTF", comma ? "," : ""); + comma = 1; + } + if (proc & PROCBASED_PAUSE_EXITING) { + printf("%sPAUSE", comma ? "," : ""); + comma = 1; + } + if (proc2 & PROCBASED2_ENABLE_EPT) { + printf("%sEPT", comma ? "," : ""); + comma = 1; + } + if (proc2 & PROCBASED2_UNRESTRICTED_GUEST) { + printf("%sUG", comma ? "," : ""); + comma = 1; + } + if (proc2 & PROCBASED2_ENABLE_VPID) { + printf("%sVPID", comma ? "," : ""); + comma = 1; + } + if (proc & PROCBASED_USE_TPR_SHADOW && + proc2 & PROCBASED2_VIRTUALIZE_APIC_ACCESSES && + proc2 & PROCBASED2_VIRTUALIZE_X2APIC_MODE && + proc2 & PROCBASED2_APIC_REGISTER_VIRTUALIZATION && + proc2 & PROCBASED2_VIRTUAL_INTERRUPT_DELIVERY) { + printf("%sVID", comma ? "," : ""); + comma = 1; + if (pin & PINBASED_POSTED_INTERRUPT) + printf(",PostIntr"); + } + return; + } + + mask = basic >> 32; + printf("Basic Features=0x%b", mask, + "\020" + "\02132PA" /* 32-bit physical addresses */ + "\022SMM" /* SMM dual-monitor */ + "\027INS/OUTS" /* VM-exit info for INS and OUTS */ + "\030TRUE" /* TRUE_CTLS MSRs */ + ); + printf("\n Pin-Based Controls=0x%b", pin, + "\020" + "\001ExtINT" /* External-interrupt exiting */ + "\004NMI" /* NMI exiting */ + "\006VNMI" /* Virtual NMIs */ + "\007PreTmr" /* Activate VMX-preemption timer */ + "\010PostIntr" /* Process posted interrupts */ + ); + printf("\n Primary Processor Controls=0x%b", proc, + "\020" + "\003INTWIN" /* Interrupt-window exiting */ + "\004TSCOff" /* Use TSC offsetting */ + "\010HLT" /* HLT exiting */ + "\012INVLPG" /* INVLPG exiting */ + "\013MWAIT" /* MWAIT exiting */ + "\014RDPMC" /* RDPMC exiting */ + "\015RDTSC" /* RDTSC exiting */ + "\020CR3-LD" /* CR3-load exiting */ + "\021CR3-ST" /* CR3-store exiting */ + "\024CR8-LD" /* CR8-load exiting */ + "\025CR8-ST" /* CR8-store exiting */ + "\026TPR" /* Use TPR shadow */ + "\027NMIWIN" /* NMI-window exiting */ + "\030MOV-DR" /* MOV-DR exiting */ + "\031IO" /* Unconditional I/O exiting */ + "\032IOmap" /* Use I/O bitmaps */ + "\034MTF" /* Monitor trap flag */ + "\035MSRmap" /* Use MSR bitmaps */ + "\036MONITOR" /* MONITOR exiting */ + "\037PAUSE" /* PAUSE exiting */ + ); + if (proc & PROCBASED_SECONDARY_CONTROLS) + printf("\n Secondary Processor Controls=0x%b", proc2, + "\020" + "\001APIC" /* Virtualize APIC accesses */ + "\002EPT" /* Enable EPT */ + "\003DT" /* Descriptor-table exiting */ + "\004RDTSCP" /* Enable RDTSCP */ + "\005x2APIC" /* Virtualize x2APIC mode */ + "\006VPID" /* Enable VPID */ + "\007WBINVD" /* WBINVD exiting */ + "\010UG" /* Unrestricted guest */ + "\011APIC-reg" /* APIC-register virtualization */ + "\012VID" /* Virtual-interrupt delivery */ + "\013PAUSE-loop" /* PAUSE-loop exiting */ + "\014RDRAND" /* RDRAND exiting */ + "\015INVPCID" /* Enable INVPCID */ + "\016VMFUNC" /* Enable VM functions */ + "\017VMCS" /* VMCS shadowing */ + "\020EPT#VE" /* EPT-violation #VE */ + "\021XSAVES" /* Enable XSAVES/XRSTORS */ + ); + printf("\n Exit Controls=0x%b", mask, + "\020" + "\003DR" /* Save debug controls */ + /* Ignore Host address-space size */ + "\015PERF" /* Load MSR_PERF_GLOBAL_CTRL */ + "\020AckInt" /* Acknowledge interrupt on exit */ + "\023PAT-SV" /* Save MSR_PAT */ + "\024PAT-LD" /* Load MSR_PAT */ + "\025EFER-SV" /* Save MSR_EFER */ + "\026EFER-LD" /* Load MSR_EFER */ + "\027PTMR-SV" /* Save VMX-preemption timer value */ + ); + printf("\n Entry Controls=0x%b", mask, + "\020" + "\003DR" /* Save debug controls */ + /* Ignore IA-32e mode guest */ + /* Ignore Entry to SMM */ + /* Ignore Deactivate dual-monitor treatment */ + "\016PERF" /* Load MSR_PERF_GLOBAL_CTRL */ + "\017PAT" /* Load MSR_PAT */ + "\020EFER" /* Load MSR_EFER */ + ); + if (proc & PROCBASED_SECONDARY_CONTROLS && + (proc2 & (PROCBASED2_ENABLE_EPT | PROCBASED2_ENABLE_VPID)) != 0) { + msr = rdmsr(MSR_VMX_EPT_VPID_CAP); + mask = msr; + printf("\n EPT Features=0x%b", mask, + "\020" + "\001XO" /* Execute-only translations */ + "\007PW4" /* Page-walk length of 4 */ + "\011UC" /* EPT paging-structure mem can be UC */ + "\017WB" /* EPT paging-structure mem can be WB */ + "\0212M" /* EPT PDE can map a 2-Mbyte page */ + "\0221G" /* EPT PDPTE can map a 1-Gbyte page */ + "\025INVEPT" /* INVEPT is supported */ + "\026AD" /* Accessed and dirty flags for EPT */ + "\032single" /* INVEPT single-context type */ + "\033all" /* INVEPT all-context type */ + ); + mask = msr >> 32; + printf("\n VPID Features=0x%b", mask, + "\020" + "\001INVVPID" /* INVVPID is supported */ + "\011individual" /* INVVPID individual-address type */ + "\012single" /* INVVPID single-context type */ + "\013all" /* INVVPID all-context type */ + /* INVVPID single-context-retaining-globals type */ + "\014single-globals" + ); + } +} Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Tue Jul 29 23:42:51 2014 (r269280) +++ head/sys/amd64/vmm/intel/vmx.c Wed Jul 30 00:00:12 2014 (r269281) @@ -149,8 +149,6 @@ SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr4_ SYSCTL_ULONG(_hw_vmm_vmx, OID_AUTO, cr4_zeros_mask, CTLFLAG_RD, &cr4_zeros_mask, 0, NULL); -static int vmx_no_patmsr; - static int vmx_initialized; SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, initialized, CTLFLAG_RD, &vmx_initialized, 0, "Intel VMX initialized"); @@ -158,18 +156,38 @@ SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, initia /* * Optional capabilities */ +static SYSCTL_NODE(_hw_vmm_vmx, OID_AUTO, cap, CTLFLAG_RW, NULL, NULL); + +static int vmx_patmsr; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, patmsr, CTLFLAG_RD, &vmx_patmsr, 0, + "PAT MSR saved and restored in VCMS"); + static int cap_halt_exit; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, halt_exit, CTLFLAG_RD, &cap_halt_exit, 0, + "HLT triggers a VM-exit"); + static int cap_pause_exit; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, pause_exit, CTLFLAG_RD, &cap_pause_exit, + 0, "PAUSE triggers a VM-exit"); + static int cap_unrestricted_guest; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, unrestricted_guest, CTLFLAG_RD, + &cap_unrestricted_guest, 0, "Unrestricted guests"); + static int cap_monitor_trap; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, monitor_trap, CTLFLAG_RD, + &cap_monitor_trap, 0, "Monitor trap flag"); + static int cap_invpcid; +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, invpcid, CTLFLAG_RD, &cap_invpcid, + 0, "Guests are allowed to use INVPCID"); static int virtual_interrupt_delivery; -SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, virtual_interrupt_delivery, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, virtual_interrupt_delivery, CTLFLAG_RD, &virtual_interrupt_delivery, 0, "APICv virtual interrupt delivery support"); static int posted_interrupts; -SYSCTL_INT(_hw_vmm_vmx, OID_AUTO, posted_interrupts, CTLFLAG_RD, +SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, posted_interrupts, CTLFLAG_RD, &posted_interrupts, 0, "APICv posted interrupt support"); static int pirvec; @@ -618,6 +636,7 @@ vmx_init(int ipinum) } /* Check support for VM-exit controls */ + vmx_patmsr = 1; error = vmx_set_ctlreg(MSR_VMX_EXIT_CTLS, MSR_VMX_TRUE_EXIT_CTLS, VM_EXIT_CTLS_ONE_SETTING, VM_EXIT_CTLS_ZERO_SETTING, @@ -637,12 +656,12 @@ vmx_init(int ipinum) if (bootverbose) printf("vmm: PAT MSR access not supported\n"); guest_msr_valid(MSR_PAT); - vmx_no_patmsr = 1; + vmx_patmsr = 0; } } /* Check support for VM-entry controls */ - if (!vmx_no_patmsr) { + if (vmx_patmsr) { error = vmx_set_ctlreg(MSR_VMX_ENTRY_CTLS, MSR_VMX_TRUE_ENTRY_CTLS, VM_ENTRY_CTLS_ONE_SETTING, @@ -918,7 +937,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) * MSR_PAT save/restore support, leave access disabled so accesses * will be trapped. */ - if (!vmx_no_patmsr && guest_msr_rw(vmx, MSR_PAT)) + if (vmx_patmsr && guest_msr_rw(vmx, MSR_PAT)) panic("vmx_vminit: error setting guest pat msr access"); vpid_alloc(vpid, VM_MAXCPU); Modified: head/sys/amd64/vmm/intel/vmx_msr.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_msr.c Tue Jul 29 23:42:51 2014 (r269280) +++ head/sys/amd64/vmm/intel/vmx_msr.c Wed Jul 30 00:00:12 2014 (r269281) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "vmx_msr.h" Modified: head/sys/amd64/vmm/intel/vmx_msr.h ============================================================================== --- head/sys/amd64/vmm/intel/vmx_msr.h Tue Jul 29 23:42:51 2014 (r269280) +++ head/sys/amd64/vmm/intel/vmx_msr.h Wed Jul 30 00:00:12 2014 (r269281) @@ -29,29 +29,6 @@ #ifndef _VMX_MSR_H_ #define _VMX_MSR_H_ -#define MSR_VMX_BASIC 0x480 -#define MSR_VMX_EPT_VPID_CAP 0x48C - -#define MSR_VMX_PROCBASED_CTLS 0x482 -#define MSR_VMX_TRUE_PROCBASED_CTLS 0x48E - -#define MSR_VMX_PINBASED_CTLS 0x481 -#define MSR_VMX_TRUE_PINBASED_CTLS 0x48D - -#define MSR_VMX_PROCBASED_CTLS2 0x48B - -#define MSR_VMX_EXIT_CTLS 0x483 -#define MSR_VMX_TRUE_EXIT_CTLS 0x48f - -#define MSR_VMX_ENTRY_CTLS 0x484 -#define MSR_VMX_TRUE_ENTRY_CTLS 0x490 - -#define MSR_VMX_CR0_FIXED0 0x486 -#define MSR_VMX_CR0_FIXED1 0x487 - -#define MSR_VMX_CR4_FIXED0 0x488 -#define MSR_VMX_CR4_FIXED1 0x489 - uint32_t vmx_revision(void); int vmx_set_ctlreg(int ctl_reg, int true_ctl_reg, uint32_t ones_mask, Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Tue Jul 29 23:42:51 2014 (r269280) +++ head/sys/x86/include/specialreg.h Wed Jul 30 00:00:12 2014 (r269281) @@ -436,6 +436,25 @@ #define MSR_MC4_MISC 0x413 /* + * VMX MSRs + */ +#define MSR_VMX_BASIC 0x480 +#define MSR_VMX_PINBASED_CTLS 0x481 +#define MSR_VMX_PROCBASED_CTLS 0x482 +#define MSR_VMX_EXIT_CTLS 0x483 +#define MSR_VMX_ENTRY_CTLS 0x484 +#define MSR_VMX_CR0_FIXED0 0x486 +#define MSR_VMX_CR0_FIXED1 0x487 +#define MSR_VMX_CR4_FIXED0 0x488 +#define MSR_VMX_CR4_FIXED1 0x489 +#define MSR_VMX_PROCBASED_CTLS2 0x48b +#define MSR_VMX_EPT_VPID_CAP 0x48c +#define MSR_VMX_TRUE_PINBASED_CTLS 0x48d +#define MSR_VMX_TRUE_PROCBASED_CTLS 0x48e +#define MSR_VMX_TRUE_EXIT_CTLS 0x48f +#define MSR_VMX_TRUE_ENTRY_CTLS 0x490 + +/* * X2APIC MSRs */ #define MSR_APIC_ID 0x802 From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 00:28:30 2014 Return-Path: Delivered-To: svn-src-all@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 1B5F63DE; Wed, 30 Jul 2014 00:28:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0967B2AC5; Wed, 30 Jul 2014 00:28:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U0STUi060232; Wed, 30 Jul 2014 00:28:29 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U0STKH060231; Wed, 30 Jul 2014 00:28:29 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407300028.s6U0STKH060231@svn.freebsd.org> From: Ed Maste Date: Wed, 30 Jul 2014 00:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269282 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 00:28:30 -0000 Author: emaste Date: Wed Jul 30 00:28:29 2014 New Revision: 269282 URL: http://svnweb.freebsd.org/changeset/base/269282 Log: Correct typo in comment PR: 192231 Submitted by: Ron Dahlgren MFC after: 1 week Modified: head/sys/sys/procdesc.h Modified: head/sys/sys/procdesc.h ============================================================================== --- head/sys/sys/procdesc.h Wed Jul 30 00:00:12 2014 (r269281) +++ head/sys/sys/procdesc.h Wed Jul 30 00:28:29 2014 (r269282) @@ -48,7 +48,7 @@ * Locking key: * (c) - Constant after initial setup. * (p) - Protected by the process descriptor mutex. - * (r) - Atomic eference count. + * (r) - Atomic reference count. * (s) - Protected by selinfo. * (t) - Protected by the proctree_lock */ From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 03:24:26 2014 Return-Path: Delivered-To: svn-src-all@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 66F9881F; Wed, 30 Jul 2014 03:24:26 +0000 (UTC) Received: from felyko.com (felyko.com [IPv6:2001:470:1:2d5:26:3:1337:ca7]) by mx1.freebsd.org (Postfix) with ESMTP id 45A4B2CC8; Wed, 30 Jul 2014 03:24:26 +0000 (UTC) Received: from [100.215.125.113] (unknown [172.56.16.80]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by felyko.com (Postfix) with ESMTPSA id 5799734A9D8; Tue, 29 Jul 2014 20:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=felyko.com; s=mail; t=1406690665; bh=R3JgALrTAtS9ePUNQuKjkVOR1yt3WujykEsr04LQn8c=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=bGtQ1C7i/aa8uydlp9QRGJxu9n18gYjom2ux0JJ4JiUktwBNzwA4CCBdlbM3ifzkL 0DxUtlTbmWeKOSTLnqUAo+yDIcKFKrDseOXvWM40YexYcaCO9s3Qug4sRvGFtOygXP 1cBSqoKUUUX5PfgQSB5Q+NEX+5m/skbc/8XFJx2g= Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r267937 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/... From: Rui Paulo X-Mailer: iPhone Mail (11D257) In-Reply-To: <2037442.AGE2eZkv8p@pippin.baldwin.cx> Date: Tue, 29 Jul 2014 20:24:24 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <62E3E179-67EA-41DC-B7A1-9323B4649C53@felyko.com> References: <201406262145.s5QLjnJH034761@svn.freebsd.org> <2037442.AGE2eZkv8p@pippin.baldwin.cx> To: John Baldwin Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Rui Paulo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 03:24:26 -0000 > On 28 Jul 2014, at 20:23, John Baldwin wrote: >=20 >> On Thursday 26 June 2014 21:45:49 Rui Paulo wrote: >> Author: rpaulo >> Date: Thu Jun 26 21:45:49 2014 >> New Revision: 267937 >> URL: http://svnweb.freebsd.org/changeset/base/267937 >>=20 >> Log: >> MFV illumos >>=20 >> 4477 DTrace should speak JSON >>=20 >> MFC after: 2 weeks >=20 > This makes kernel builds depend on userland sources. This breaks a lot of= my=20 > work trees where I only checkout 'sys', and breaks a generally long-standi= ng=20 > feature that the kernel was self-contained (recent bmake breakage to requi= re=20 > the '-m /usr/src/share/mk' hack aside). Perhaps you could copy strtolctyp= e.h > to sys/cddl/contrib/opensolaris/common/util? We already duplicate=20 > sys/cddl/contrib/opensolaris/common/avl/avl.c in a like manner, presumably= for=20 > the same reason. I didn't know that was a long standing feature. I'll copy the file.=20 From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 03:56:19 2014 Return-Path: Delivered-To: svn-src-all@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 E6A4FDFE; Wed, 30 Jul 2014 03:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C75AD2048; Wed, 30 Jul 2014 03:56:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U3uJwa059495; Wed, 30 Jul 2014 03:56:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U3uISV059484; Wed, 30 Jul 2014 03:56:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300356.s6U3uISV059484@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 03:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269283 - in stable/10/sys: fs/ext2fs fs/nandfs fs/nfsclient fs/nullfs fs/tmpfs kern ufs/ufs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 03:56:20 -0000 Author: kib Date: Wed Jul 30 03:56:17 2014 New Revision: 269283 URL: http://svnweb.freebsd.org/changeset/base/269283 Log: MFC r268764: Check for the cross-device cross-link attempt in the VFS, instead of VOP_LINK() implemenations. Modified: stable/10/sys/fs/ext2fs/ext2_vnops.c stable/10/sys/fs/nandfs/nandfs_vnops.c stable/10/sys/fs/nfsclient/nfs_clvnops.c stable/10/sys/fs/nullfs/null_vnops.c stable/10/sys/fs/tmpfs/tmpfs_vnops.c stable/10/sys/kern/vfs_syscalls.c stable/10/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_vnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/fs/ext2fs/ext2_vnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -666,10 +666,6 @@ ext2_link(struct vop_link_args *ap) if ((cnp->cn_flags & HASBUF) == 0) panic("ext2_link: no name"); #endif - if (tdvp->v_mount != vp->v_mount) { - error = EXDEV; - goto out; - } ip = VTOI(vp); if ((nlink_t)ip->i_nlink >= EXT2_LINK_MAX) { error = EMLINK; Modified: stable/10/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- stable/10/sys/fs/nandfs/nandfs_vnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/fs/nandfs/nandfs_vnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -1355,9 +1355,6 @@ nandfs_link(struct vop_link_args *ap) struct nandfs_inode *inode = &node->nn_inode; int error; - if (tdvp->v_mount != vp->v_mount) - return (EXDEV); - if (inode->i_links_count >= LINK_MAX) return (EMLINK); Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -1977,10 +1977,6 @@ nfs_link(struct vop_link_args *ap) struct nfsvattr nfsva, dnfsva; int error = 0, attrflag, dattrflag; - if (vp->v_mount != tdvp->v_mount) { - return (EXDEV); - } - /* * Push all writes to the server, so that the attribute cache * doesn't get "out of sync" with the server. Modified: stable/10/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/10/sys/fs/nullfs/null_vnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/fs/nullfs/null_vnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -858,15 +858,6 @@ null_vptocnp(struct vop_vptocnp_args *ap return (error); } -static int -null_link(struct vop_link_args *ap) -{ - - if (ap->a_tdvp->v_mount != ap->a_vp->v_mount) - return (EXDEV); - return (null_bypass((struct vop_generic_args *)ap)); -} - /* * Global vfs data structures */ @@ -880,7 +871,6 @@ struct vop_vector null_vnodeops = { .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, .vop_islocked = vop_stdislocked, - .vop_link = null_link, .vop_lock1 = null_lock, .vop_lookup = null_lookup, .vop_open = null_open, Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -573,21 +573,6 @@ tmpfs_link(struct vop_link_args *v) MPASS(VOP_ISLOCKED(dvp)); MPASS(cnp->cn_flags & HASBUF); MPASS(dvp != vp); /* XXX When can this be false? */ - - /* XXX: Why aren't the following two tests done by the caller? */ - - /* Hard links of directories are forbidden. */ - if (vp->v_type == VDIR) { - error = EPERM; - goto out; - } - - /* Cannot create cross-device links. */ - if (dvp->v_mount != vp->v_mount) { - error = EXDEV; - goto out; - } - node = VP_TO_TMPFS_NODE(vp); /* Ensure that we do not overflow the maximum number of links imposed Modified: stable/10/sys/kern/vfs_syscalls.c ============================================================================== --- stable/10/sys/kern/vfs_syscalls.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/kern/vfs_syscalls.c Wed Jul 30 03:56:17 2014 (r269283) @@ -1579,7 +1579,15 @@ again: vrele(nd.ni_vp); error = EEXIST; } else if ((error = vn_lock(vp, LK_EXCLUSIVE)) == 0) { - error = can_hardlink(vp, td->td_ucred); + /* + * Check for cross-device links. No need to + * recheck vp->v_type, since it cannot change + * for non-doomed vnode. + */ + if (nd.ni_dvp->v_mount != vp->v_mount) + error = EXDEV; + else + error = can_hardlink(vp, td->td_ucred); if (error == 0) #ifdef MAC error = mac_vnode_check_link(td->td_ucred, Modified: stable/10/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/10/sys/ufs/ufs/ufs_vnops.c Wed Jul 30 00:28:29 2014 (r269282) +++ stable/10/sys/ufs/ufs/ufs_vnops.c Wed Jul 30 03:56:17 2014 (r269283) @@ -968,10 +968,6 @@ ufs_link(ap) if ((cnp->cn_flags & HASBUF) == 0) panic("ufs_link: no name"); #endif - if (tdvp->v_mount != vp->v_mount) { - error = EXDEV; - goto out; - } if (VTOI(tdvp)->i_effnlink < 2) panic("ufs_link: Bad link count %d on parent", VTOI(tdvp)->i_effnlink); From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 03:58:30 2014 Return-Path: Delivered-To: svn-src-all@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 43EA5C0; Wed, 30 Jul 2014 03:58:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30FC42058; Wed, 30 Jul 2014 03:58:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U3wUBe061165; Wed, 30 Jul 2014 03:58:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U3wUAh061164; Wed, 30 Jul 2014 03:58:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300358.s6U3wUAh061164@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 03:58:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269284 - stable/10/sys/fs/tmpfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 03:58:30 -0000 Author: kib Date: Wed Jul 30 03:58:29 2014 New Revision: 269284 URL: http://svnweb.freebsd.org/changeset/base/269284 Log: MFC r268765: Remove unused header. Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 30 03:56:17 2014 (r269283) +++ stable/10/sys/fs/tmpfs/tmpfs_vnops.c Wed Jul 30 03:58:29 2014 (r269284) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:00:24 2014 Return-Path: Delivered-To: svn-src-all@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 09A8A207; Wed, 30 Jul 2014 04:00:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAC1D206A; Wed, 30 Jul 2014 04:00:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U40Nhu061662; Wed, 30 Jul 2014 04:00:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U40NPW061661; Wed, 30 Jul 2014 04:00:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300400.s6U40NPW061661@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 04:00:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269285 - stable/10/share/man/man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:00:24 -0000 Author: kib Date: Wed Jul 30 04:00:23 2014 New Revision: 269285 URL: http://svnweb.freebsd.org/changeset/base/269285 Log: MFC r269159: Correct the locking statement. MFC r269161: Explicitely mention that inactivated or reclaimed vnode is locked exclusively. Modified: stable/10/share/man/man9/VOP_INACTIVE.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/VOP_INACTIVE.9 ============================================================================== --- stable/10/share/man/man9/VOP_INACTIVE.9 Wed Jul 30 03:58:29 2014 (r269284) +++ stable/10/share/man/man9/VOP_INACTIVE.9 Wed Jul 30 04:00:23 2014 (r269285) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd July 27, 2014 .Dt VOP_INACTIVE 9 .Os .Sh NAME @@ -63,17 +63,14 @@ is called when a vnode is being reused f Any file system specific resources associated with the vnode should be freed. .Sh LOCKS -For VOP_INACTIVE, the -.Fa vp -will be locked on entry. -Your VOP_INACTIVE code -must unlock the -.Fa vp -prior to returning. -.Pp -For VOP_RECLAIM, the +For both +.Fn VOP_INACTIVE +and +.Fn VOP_RECLAIM , +the .Fa vp -will not be locked on entry and should be left unlocked on return. +will be exclusively locked on entry, and must be left exclusively +locked on return. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:04:00 2014 Return-Path: Delivered-To: svn-src-all@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 55AA0361; Wed, 30 Jul 2014 04:04: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28A2420F8; Wed, 30 Jul 2014 04:04:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U440Yx065378; Wed, 30 Jul 2014 04:04:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U43xhU065372; Wed, 30 Jul 2014 04:03:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300403.s6U43xhU065372@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 04:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269286 - in stable/10: . share/man/man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:04:00 -0000 Author: kib Date: Wed Jul 30 04:03:59 2014 New Revision: 269286 URL: http://svnweb.freebsd.org/changeset/base/269286 Log: MFC r269160: Remove man page for non-existent VOPs. MFC r269240 (by pluknet): Add VOP_GETVOBJECT.9 to obsolete files, un-xref. Deleted: stable/10/share/man/man9/VOP_GETVOBJECT.9 Modified: stable/10/ObsoleteFiles.inc stable/10/share/man/man9/Makefile stable/10/share/man/man9/vnode.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Wed Jul 30 04:00:23 2014 (r269285) +++ stable/10/ObsoleteFiles.inc Wed Jul 30 04:03:59 2014 (r269286) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20140728: Remove an obsolete man page +OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz # 20140614: send-pr removal OLD_FILES+=usr/share/man/man1/send-pr.1.gz OLD_FILES+=etc/gnats/freefall Modified: stable/10/share/man/man9/Makefile ============================================================================== --- stable/10/share/man/man9/Makefile Wed Jul 30 04:00:23 2014 (r269285) +++ stable/10/share/man/man9/Makefile Wed Jul 30 04:03:59 2014 (r269286) @@ -355,7 +355,6 @@ MAN= accept_filter.9 \ VOP_GETACL.9 \ VOP_GETEXTATTR.9 \ VOP_GETPAGES.9 \ - VOP_GETVOBJECT.9 \ VOP_INACTIVE.9 \ VOP_IOCTL.9 \ VOP_LINK.9 \ @@ -1517,8 +1516,6 @@ MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \ VOP_CREATE.9 VOP_MKNOD.9 \ VOP_CREATE.9 VOP_SYMLINK.9 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9 -MLINKS+=VOP_GETVOBJECT.9 VOP_CREATEVOBJECT.9 \ - VOP_GETVOBJECT.9 VOP_DESTROYVOBJECT.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 MLINKS+=VOP_LOCK.9 vn_lock.9 \ VOP_LOCK.9 VOP_ISLOCKED.9 \ Modified: stable/10/share/man/man9/vnode.9 ============================================================================== --- stable/10/share/man/man9/vnode.9 Wed Jul 30 04:00:23 2014 (r269285) +++ stable/10/share/man/man9/vnode.9 Wed Jul 30 04:03:59 2014 (r269286) @@ -170,7 +170,6 @@ intertwining of VM Objects and Vnodes. .Xr VOP_GETACL 9 , .Xr VOP_GETEXTATTR 9 , .Xr VOP_GETPAGES 9 , -.Xr VOP_GETVOBJECT 9 , .Xr VOP_INACTIVE 9 , .Xr VOP_IOCTL 9 , .Xr VOP_LINK 9 , From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:05:20 2014 Return-Path: Delivered-To: svn-src-all@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 457A8499; Wed, 30 Jul 2014 04:05:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 329EF20FF; Wed, 30 Jul 2014 04:05:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U45K0r065773; Wed, 30 Jul 2014 04:05:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U45KBa065772; Wed, 30 Jul 2014 04:05:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300405.s6U45KBa065772@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 04:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269287 - stable/9/share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:05:20 -0000 Author: kib Date: Wed Jul 30 04:05:19 2014 New Revision: 269287 URL: http://svnweb.freebsd.org/changeset/base/269287 Log: MFC r269159: Correct the locking statement. MFC r269161: Explicitely mention that inactivated or reclaimed vnode is locked exclusively. Modified: stable/9/share/man/man9/VOP_INACTIVE.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/VOP_INACTIVE.9 ============================================================================== --- stable/9/share/man/man9/VOP_INACTIVE.9 Wed Jul 30 04:03:59 2014 (r269286) +++ stable/9/share/man/man9/VOP_INACTIVE.9 Wed Jul 30 04:05:19 2014 (r269287) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd July 27, 2014 .Dt VOP_INACTIVE 9 .Os .Sh NAME @@ -63,17 +63,14 @@ is called when a vnode is being reused f Any file system specific resources associated with the vnode should be freed. .Sh LOCKS -For VOP_INACTIVE, the -.Fa vp -will be locked on entry. -Your VOP_INACTIVE code -must unlock the -.Fa vp -prior to returning. -.Pp -For VOP_RECLAIM, the +For both +.Fn VOP_INACTIVE +and +.Fn VOP_RECLAIM , +the .Fa vp -will not be locked on entry and should be left unlocked on return. +will be exclusively locked on entry, and must be left exclusively +locked on return. .Sh SEE ALSO .Xr vnode 9 .Sh AUTHORS From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:09:21 2014 Return-Path: Delivered-To: svn-src-all@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 DB0AD60F; Wed, 30 Jul 2014 04:09: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE88D212D; Wed, 30 Jul 2014 04:09:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U49LLY066518; Wed, 30 Jul 2014 04:09:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U49Ldu066513; Wed, 30 Jul 2014 04:09:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407300409.s6U49Ldu066513@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jul 2014 04:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269288 - in stable/9: . share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:09:22 -0000 Author: kib Date: Wed Jul 30 04:09:20 2014 New Revision: 269288 URL: http://svnweb.freebsd.org/changeset/base/269288 Log: MFC r269160: Remove man page for non-existent VOPs. MFC r269240 (by pluknet): Add VOP_GETVOBJECT.9 to obsolete files, un-xref. Deleted: stable/9/share/man/man9/VOP_GETVOBJECT.9 Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/share/man/man9/Makefile stable/9/share/man/man9/vnode.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Wed Jul 30 04:05:19 2014 (r269287) +++ stable/9/ObsoleteFiles.inc Wed Jul 30 04:09:20 2014 (r269288) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20140728: Remove an obsolete man page +OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz +OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz # 20140614: send-pr removal OLD_FILES+=usr/share/man/man1/send-pr.1.gz OLD_FILES+=etc/gnats/freefall Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Wed Jul 30 04:05:19 2014 (r269287) +++ stable/9/share/man/man9/Makefile Wed Jul 30 04:09:20 2014 (r269288) @@ -351,7 +351,6 @@ MAN= accept_filter.9 \ VOP_GETACL.9 \ VOP_GETEXTATTR.9 \ VOP_GETPAGES.9 \ - VOP_GETVOBJECT.9 \ VOP_INACTIVE.9 \ VOP_IOCTL.9 \ VOP_LINK.9 \ @@ -1463,8 +1462,6 @@ MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \ VOP_CREATE.9 VOP_MKNOD.9 \ VOP_CREATE.9 VOP_SYMLINK.9 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9 -MLINKS+=VOP_GETVOBJECT.9 VOP_CREATEVOBJECT.9 \ - VOP_GETVOBJECT.9 VOP_DESTROYVOBJECT.9 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9 MLINKS+=VOP_LOCK.9 vn_lock.9 \ VOP_LOCK.9 VOP_ISLOCKED.9 \ Modified: stable/9/share/man/man9/vnode.9 ============================================================================== --- stable/9/share/man/man9/vnode.9 Wed Jul 30 04:05:19 2014 (r269287) +++ stable/9/share/man/man9/vnode.9 Wed Jul 30 04:09:20 2014 (r269288) @@ -168,7 +168,6 @@ intertwining of VM Objects and Vnodes. .Xr VOP_GETACL 9 , .Xr VOP_GETEXTATTR 9 , .Xr VOP_GETPAGES 9 , -.Xr VOP_GETVOBJECT 9 , .Xr VOP_INACTIVE 9 , .Xr VOP_IOCTL 9 , .Xr VOP_LINK 9 , From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:40:51 2014 Return-Path: Delivered-To: svn-src-all@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 5316CD34; Wed, 30 Jul 2014 04:40:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40FFB251D; Wed, 30 Jul 2014 04:40:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U4epb1080835; Wed, 30 Jul 2014 04:40:51 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U4epI8080834; Wed, 30 Jul 2014 04:40:51 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407300440.s6U4epI8080834@svn.freebsd.org> From: Glen Barber Date: Wed, 30 Jul 2014 04:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269289 - head/usr.bin/sort X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:40:51 -0000 Author: gjb Date: Wed Jul 30 04:40:50 2014 New Revision: 269289 URL: http://svnweb.freebsd.org/changeset/base/269289 Log: Remove trailing '.' from See Also section. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/sort/sort.1.in Modified: head/usr.bin/sort/sort.1.in ============================================================================== --- head/usr.bin/sort/sort.1.in Wed Jul 30 04:09:20 2014 (r269288) +++ head/usr.bin/sort/sort.1.in Wed Jul 30 04:40:50 2014 (r269289) @@ -581,7 +581,7 @@ An error occurred. .Sh SEE ALSO .Xr comm 1 , .Xr join 1 , -.Xr uniq 1 . +.Xr uniq 1 .Sh STANDARDS The .Nm From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:46:53 2014 Return-Path: Delivered-To: svn-src-all@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 9DD3F34D; Wed, 30 Jul 2014 04:46: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BB2C256F; Wed, 30 Jul 2014 04:46:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U4kr3K084629; Wed, 30 Jul 2014 04:46:53 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U4krZc084628; Wed, 30 Jul 2014 04:46:53 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407300446.s6U4krZc084628@svn.freebsd.org> From: Glen Barber Date: Wed, 30 Jul 2014 04:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269290 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:46:53 -0000 Author: gjb Date: Wed Jul 30 04:46:53 2014 New Revision: 269290 URL: http://svnweb.freebsd.org/changeset/base/269290 Log: Remove trailing comma from standalone Xref. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/acpi_wmi.4 Modified: head/share/man/man4/acpi_wmi.4 ============================================================================== --- head/share/man/man4/acpi_wmi.4 Wed Jul 30 04:40:50 2014 (r269289) +++ head/share/man/man4/acpi_wmi.4 Wed Jul 30 04:46:53 2014 (r269290) @@ -74,7 +74,7 @@ GUID IN {8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI .Ed .Sh SEE ALSO -.Xr acpi 4 , +.Xr acpi 4 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:47:39 2014 Return-Path: Delivered-To: svn-src-all@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 C86E84EA; Wed, 30 Jul 2014 04:47: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B66D0257C; Wed, 30 Jul 2014 04:47:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U4ldxX084787; Wed, 30 Jul 2014 04:47:39 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U4ldcp084786; Wed, 30 Jul 2014 04:47:39 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407300447.s6U4ldcp084786@svn.freebsd.org> From: Glen Barber Date: Wed, 30 Jul 2014 04:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269291 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:47:39 -0000 Author: gjb Date: Wed Jul 30 04:47:39 2014 New Revision: 269291 URL: http://svnweb.freebsd.org/changeset/base/269291 Log: Remove trailing comma from ending Xref. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/hptiop.4 Modified: head/share/man/man4/hptiop.4 ============================================================================== --- head/share/man/man4/hptiop.4 Wed Jul 30 04:46:53 2014 (r269290) +++ head/share/man/man4/hptiop.4 Wed Jul 30 04:47:39 2014 (r269291) @@ -126,7 +126,7 @@ The driver has only been tested on the i386 and amd64 platforms. .Sh SEE ALSO .Xr cam 4 , -.Xr hptmv 4 , +.Xr hptmv 4 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:48:21 2014 Return-Path: Delivered-To: svn-src-all@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 39803659; Wed, 30 Jul 2014 04: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27A592586; Wed, 30 Jul 2014 04:48:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U4mLgr084946; Wed, 30 Jul 2014 04:48:21 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U4mKqL084945; Wed, 30 Jul 2014 04:48:21 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407300448.s6U4mKqL084945@svn.freebsd.org> From: Glen Barber Date: Wed, 30 Jul 2014 04:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269292 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:48:21 -0000 Author: gjb Date: Wed Jul 30 04:48:20 2014 New Revision: 269292 URL: http://svnweb.freebsd.org/changeset/base/269292 Log: Remove trailing comma from ending Xref MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man5/pf.conf.5 Modified: head/share/man/man5/pf.conf.5 ============================================================================== --- head/share/man/man5/pf.conf.5 Wed Jul 30 04:47:39 2014 (r269291) +++ head/share/man/man5/pf.conf.5 Wed Jul 30 04:48:20 2014 (r269292) @@ -3051,7 +3051,7 @@ Service name database. .Xr services 5 , .Xr ftp-proxy 8 , .Xr pfctl 8 , -.Xr pflogd 8 , +.Xr pflogd 8 .Sh HISTORY The .Nm From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 04:48:57 2014 Return-Path: Delivered-To: svn-src-all@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 8907E80C; Wed, 30 Jul 2014 04:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7743E259B; Wed, 30 Jul 2014 04:48:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U4mvwD085065; Wed, 30 Jul 2014 04:48:57 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U4mvGf085064; Wed, 30 Jul 2014 04:48:57 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407300448.s6U4mvGf085064@svn.freebsd.org> From: Glen Barber Date: Wed, 30 Jul 2014 04:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269293 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 04:48:57 -0000 Author: gjb Date: Wed Jul 30 04:48:56 2014 New Revision: 269293 URL: http://svnweb.freebsd.org/changeset/base/269293 Log: Remove trailing comma from ending Xref MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/share/man/man9/kernel_mount.9 Modified: head/share/man/man9/kernel_mount.9 ============================================================================== --- head/share/man/man9/kernel_mount.9 Wed Jul 30 04:48:20 2014 (r269292) +++ head/share/man/man9/kernel_mount.9 Wed Jul 30 04:48:56 2014 (r269293) @@ -194,7 +194,7 @@ must come in pairs, e.g., .Ed .Sh SEE ALSO .Xr VFS 9 , -.Xr VFS_MOUNT 9 , +.Xr VFS_MOUNT 9 .Sh HISTORY The .Fn kernel_mount From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 07:09:00 2014 Return-Path: Delivered-To: svn-src-all@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 DA6EC71D; Wed, 30 Jul 2014 07:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAF192461; Wed, 30 Jul 2014 07:08:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U78xek049032; Wed, 30 Jul 2014 07:08:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U78x65049031; Wed, 30 Jul 2014 07:08:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407300708.s6U78x65049031@svn.freebsd.org> From: Alexander Motin Date: Wed, 30 Jul 2014 07:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269294 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 07:09:00 -0000 Author: mav Date: Wed Jul 30 07:08:59 2014 New Revision: 269294 URL: http://svnweb.freebsd.org/changeset/base/269294 Log: MFC r269149: Fix several cases of NULL dereference when INQUIRY sent to absent LUN. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 04:48:56 2014 (r269293) +++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:08:59 2014 (r269294) @@ -10041,7 +10041,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; - if (ctl_map_lun_back(port->targ_port, lun->lun) >= + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= CTL_MAX_LUNS) continue; num_target_ports++; @@ -10095,7 +10096,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; - if (ctl_map_lun_back(port->targ_port, lun->lun) >= + if (lun != NULL && + ctl_map_lun_back(port->targ_port, lun->lun) >= CTL_MAX_LUNS) continue; p = port->targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS; @@ -10135,7 +10137,6 @@ ctl_inquiry_evpd_block_limits(struct ctl int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*bl_ptr), M_CTL, M_WAITOK | M_ZERO); bl_ptr = (struct scsi_vpd_block_limits *)ctsio->kern_data_ptr; @@ -10169,10 +10170,13 @@ ctl_inquiry_evpd_block_limits(struct ctl scsi_ulto2b(sizeof(*bl_ptr), bl_ptr->page_length); bl_ptr->max_cmp_write_len = 0xff; scsi_ulto4b(0xffffffff, bl_ptr->max_txfer_len); - scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); - scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + if (lun != NULL) { + bs = lun->be_lun->blocksize; + scsi_ulto4b(MAXPHYS / bs, bl_ptr->opt_txfer_len); + if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) { + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_lba_cnt); + scsi_ulto4b(0xffffffff, bl_ptr->max_unmap_blk_cnt); + } } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); @@ -10189,10 +10193,8 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * { struct scsi_vpd_logical_block_prov *lbp_ptr; struct ctl_lun *lun; - int bs; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - bs = lun->be_lun->blocksize; ctsio->kern_data_ptr = malloc(sizeof(*lbp_ptr), M_CTL, M_WAITOK | M_ZERO); lbp_ptr = (struct scsi_vpd_logical_block_prov *)ctsio->kern_data_ptr; @@ -10223,7 +10225,7 @@ ctl_inquiry_evpd_lbp(struct ctl_scsiio * lbp_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; lbp_ptr->page_code = SVPD_LBP; - if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) + if (lun != NULL && lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) lbp_ptr->flags = SVPD_LBP_UNMAP | SVPD_LBP_WS16 | SVPD_LBP_WS10; ctsio->scsi_status = SCSI_STATUS_OK; From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 07:16:09 2014 Return-Path: Delivered-To: svn-src-all@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 A8118B4D; Wed, 30 Jul 2014 07:16: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8834C251C; Wed, 30 Jul 2014 07:16:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U7G9uZ053718; Wed, 30 Jul 2014 07:16:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U7G84k053715; Wed, 30 Jul 2014 07:16:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407300716.s6U7G84k053715@svn.freebsd.org> From: Alexander Motin Date: Wed, 30 Jul 2014 07:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269295 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 07:16:09 -0000 Author: mav Date: Wed Jul 30 07:16:08 2014 New Revision: 269295 URL: http://svnweb.freebsd.org/changeset/base/269295 Log: MFC r268581: Merge several equal serialization indexes. Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_ser_table.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Wed Jul 30 07:08:59 2014 (r269294) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Wed Jul 30 07:16:08 2014 (r269295) @@ -66,7 +66,7 @@ const struct ctl_cmd_entry ctl_cmd_table_5e[32] = { /* 00 READ KEYS */ -{ctl_persistent_reserve_in, CTL_SERIDX_PRES_IN, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | @@ -77,7 +77,7 @@ const struct ctl_cmd_entry ctl_cmd_table 10, { 0x00, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, /* 01 READ RESERVATION */ -{ctl_persistent_reserve_in, CTL_SERIDX_PRES_IN, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | @@ -116,57 +116,57 @@ const struct ctl_cmd_entry ctl_cmd_table const struct ctl_cmd_entry ctl_cmd_table_5f[32] = { /* 00 REGISTER */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x00, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 01 RESERVE */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x01, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 02 RELEASE */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x02, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 03 CLEAR */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x03, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, /* 04 PREEMPT */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x04, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, @@ -174,13 +174,13 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 06 REGISTER AND IGNORE EXISTING KEY */ -{ctl_persistent_reserve_out, CTL_SERIDX_PRES_OUT, CTL_CMD_FLAG_ALLOW_ON_RESV | - CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, +{ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 10, { 0x06, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x07}}, @@ -288,11 +288,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0A REPORT TARGET PORT GROUPS */ -{ctl_report_tagret_port_groups, CTL_SERIDX_MAIN_IN, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, +{ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, 12, {0x0a, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -300,20 +300,20 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0C REPORT SUPPORTED_OPCODES */ -{ctl_report_supported_opcodes, CTL_SERIDX_MAIN_IN, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, +{ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, 12, {0x0c, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 0D REPORT SUPPORTED_TASK MANAGEMENT FUNCTIONS */ -{ctl_report_supported_tmf, CTL_SERIDX_MAIN_IN, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, +{ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, 12, {0x0d, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -321,11 +321,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0F REPORT TIMESTAMP */ -{ctl_report_timestamp, CTL_SERIDX_MAIN_IN, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | - CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, +{ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, 12, {0x0f, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -435,7 +435,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, /* 16 RESERVE(6) */ -{ctl_scsi_reserve, CTL_SERIDX_RESV, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | @@ -444,7 +444,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, /* 17 RELEASE(6) */ -{ctl_scsi_release, CTL_SERIDX_REL, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_release, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | @@ -689,7 +689,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 56 RESERVE(10) */ -{ctl_scsi_reserve, CTL_SERIDX_RESV, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | @@ -698,7 +698,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 57 RELEASE(10) */ -{ctl_scsi_release, CTL_SERIDX_REL, CTL_CMD_FLAG_ALLOW_ON_RESV | +{ctl_scsi_release, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:08:59 2014 (r269294) +++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:16:08 2014 (r269295) @@ -163,14 +163,10 @@ typedef enum { CTL_SERIDX_RQ_SNS, CTL_SERIDX_INQ, CTL_SERIDX_RD_CAP, - CTL_SERIDX_RESV, - CTL_SERIDX_REL, + CTL_SERIDX_RES, CTL_SERIDX_LOG_SNS, CTL_SERIDX_FORMAT, CTL_SERIDX_START, - CTL_SERIDX_PRES_IN, - CTL_SERIDX_PRES_OUT, - CTL_SERIDX_MAIN_IN, /* TBD: others to be filled in as needed */ CTL_SERIDX_COUNT, /* LAST, not a normal code, provides # codes */ CTL_SERIDX_INVLD = CTL_SERIDX_COUNT Modified: stable/10/sys/cam/ctl/ctl_ser_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_ser_table.c Wed Jul 30 07:08:59 2014 (r269294) +++ stable/10/sys/cam/ctl/ctl_ser_table.c Wed Jul 30 07:16:08 2014 (r269295) @@ -60,23 +60,19 @@ static ctl_serialize_action ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = { -/**>IDX_ :: 2nd:TUR RD WRT UNM MDSN MDSL RQSN INQ RDCP RES REL LSNS FMT STR PRIN PROT MAININ*/ -/*TUR */{ pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*READ */{ pS, pS, xT, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*WRITE */{ pS, xT, xT, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*UNMAP */{ pS, bK, bK, pS, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*MD_SNS */{ bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*INQ */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*RESV */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*REL */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*LOG_SNS */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, bK, pS, bK, bK, bK, bK, bK}, -/*FORMAT */{ pS, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*START */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*PRES_IN */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*PRES_OUT*/{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, -/*MAIN_IN */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK, bK, bK, bK, pS} +/**>IDX_ :: 2nd:TUR RD WRT UNM MDSN MDSL RQSN INQ RDCP RES LSNS FMT STR*/ +/*TUR */{ pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*READ */{ pS, pS, xT, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*WRITE */{ pS, xT, xT, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*UNMAP */{ pS, bK, bK, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*MD_SNS */{ bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, pS, bK, bK}, +/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, +/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, +/*INQ */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, +/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, +/*RES */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, +/*LOG_SNS */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, pS, bK, bK}, +/*FORMAT */{ pS, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, +/*START */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, }; From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 07:18:34 2014 Return-Path: Delivered-To: svn-src-all@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 8EBB4D2C; Wed, 30 Jul 2014 07:18:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A449253A; Wed, 30 Jul 2014 07:18:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U7IYkK054069; Wed, 30 Jul 2014 07:18:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U7IW26054060; Wed, 30 Jul 2014 07:18:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407300718.s6U7IW26054060@svn.freebsd.org> From: Alexander Motin Date: Wed, 30 Jul 2014 07:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269296 - in stable/10: sys/cam/ctl sys/cam/scsi sys/conf sys/modules/ctl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 07:18:34 -0000 Author: mav Date: Wed Jul 30 07:18:32 2014 New Revision: 269296 URL: http://svnweb.freebsd.org/changeset/base/269296 Log: MFC r268767: Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone. This allows to clone VMs and move them between LUNs inside one storage host without generating extra network traffic to the initiator and back, and without being limited by network bandwidth. LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set. For LUNs without these IDs VMWare will use traditional copy operations. Beware: the above LUN IDs explicitly set to values non-unique from the VM cluster point of view may cause data corruption if wrong LUN is addressed! Sponsored by: iXsystems, Inc. Added: stable/10/sys/cam/ctl/ctl_tpc.c - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc.c stable/10/sys/cam/ctl/ctl_tpc.h - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc.h stable/10/sys/cam/ctl/ctl_tpc_local.c - copied unchanged from r268767, head/sys/cam/ctl/ctl_tpc_local.c Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend.h stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_ser_table.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_all.h stable/10/sys/conf/files stable/10/sys/modules/ctl/Makefile stable/10/usr.sbin/ctladm/ctladm.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:18:32 2014 (r269296) @@ -322,10 +322,10 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), - * SCSI Ports (0x88), Block limits (0xB0) and + * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0) and * Logical Block Provisioning (0xB2) */ -#define SCSI_EVPD_NUM_SUPPORTED_PAGES 6 +#define SCSI_EVPD_NUM_SUPPORTED_PAGES 7 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event, int param); @@ -351,8 +351,6 @@ static int ctl_ioctl_fill_ooa(struct ctl struct ctl_ooa_entry *kern_entries); static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); -uint32_t ctl_get_resindex(struct ctl_nexus *nexus); -uint32_t ctl_port_idx(int port_num); static uint32_t ctl_map_lun(int port_num, uint32_t lun); static uint32_t ctl_map_lun_back(int port_num, uint32_t lun); #ifdef unused @@ -4600,6 +4598,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); STAILQ_INIT(&lun->error_list); + ctl_tpc_init(lun); /* * Initialize the mode page index. @@ -4751,6 +4750,7 @@ ctl_free_lun(struct ctl_lun *lun) atomic_subtract_int(&lun->be_lun->be->num_luns, 1); lun->be_lun->lun_shutdown(lun->be_lun->be_lun); + ctl_tpc_shutdown(lun); mtx_destroy(&lun->lun_lock); free(lun->lun_devid, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) @@ -9823,10 +9823,12 @@ ctl_inquiry_evpd_supported(struct ctl_sc pages->page_list[2] = SVPD_DEVICE_ID; /* SCSI Ports */ pages->page_list[3] = SVPD_SCSI_PORTS; + /* Third-party Copy */ + pages->page_list[4] = SVPD_SCSI_TPC; /* Block limits */ - pages->page_list[4] = SVPD_BLOCK_LIMITS; + pages->page_list[5] = SVPD_BLOCK_LIMITS; /* Logical Block Provisioning */ - pages->page_list[5] = SVPD_LBP; + pages->page_list[6] = SVPD_LBP; ctsio->scsi_status = SCSI_STATUS_OK; @@ -10025,7 +10027,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s struct scsi_vpd_port_designation_cont *pdc; struct ctl_lun *lun; struct ctl_port *port; - int data_len, num_target_ports, id_len, g, pg, p; + int data_len, num_target_ports, iid_len, id_len, g, pg, p; int num_target_port_groups, single; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; @@ -10036,6 +10038,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s else num_target_port_groups = NUM_TARGET_PORT_GROUPS; num_target_ports = 0; + iid_len = 0; id_len = 0; mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(port, &softc->port_list, links) { @@ -10046,6 +10049,8 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s CTL_MAX_LUNS) continue; num_target_ports++; + if (port->init_devid) + iid_len += port->init_devid->len; if (port->port_devid) id_len += port->port_devid->len; } @@ -10053,7 +10058,7 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s data_len = sizeof(struct scsi_vpd_scsi_ports) + num_target_port_groups * num_target_ports * (sizeof(struct scsi_vpd_port_designation) + - sizeof(struct scsi_vpd_port_designation_cont)) + id_len; + sizeof(struct scsi_vpd_port_designation_cont)) + iid_len + id_len; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sp = (struct scsi_vpd_scsi_ports *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; @@ -10102,19 +10107,22 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_s continue; p = port->targ_port % CTL_MAX_PORTS + g * CTL_MAX_PORTS; scsi_ulto2b(p, pd->relative_port_id); - scsi_ulto2b(0, pd->initiator_transportid_length); + if (port->init_devid && g == pg) { + iid_len = port->init_devid->len; + memcpy(pd->initiator_transportid, + port->init_devid->data, port->init_devid->len); + } else + iid_len = 0; + scsi_ulto2b(iid_len, pd->initiator_transportid_length); pdc = (struct scsi_vpd_port_designation_cont *) - &pd->initiator_transportid[0]; + (&pd->initiator_transportid[iid_len]); if (port->port_devid && g == pg) { id_len = port->port_devid->len; - scsi_ulto2b(port->port_devid->len, - pdc->target_port_descriptors_length); memcpy(pdc->target_port_descriptors, port->port_devid->data, port->port_devid->len); - } else { + } else id_len = 0; - scsi_ulto2b(0, pdc->target_port_descriptors_length); - } + scsi_ulto2b(id_len, pdc->target_port_descriptors_length); pd = (struct scsi_vpd_port_designation *) ((uint8_t *)pdc->target_port_descriptors + id_len); } @@ -10263,6 +10271,9 @@ ctl_inquiry_evpd(struct ctl_scsiio *ctsi case SVPD_SCSI_PORTS: retval = ctl_inquiry_evpd_scsi_ports(ctsio, alloc_len); break; + case SVPD_SCSI_TPC: + retval = ctl_inquiry_evpd_tpc(ctsio, alloc_len); + break; case SVPD_BLOCK_LIMITS: retval = ctl_inquiry_evpd_block_limits(ctsio, alloc_len); break; @@ -10293,7 +10304,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio struct ctl_lun *lun; char *val; uint32_t alloc_len; - int is_fc; + ctl_port_type port_type; ctl_softc = control_softc; @@ -10302,11 +10313,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio * We treat the ioctl front end, and any SCSI adapters, as packetized * SCSI front ends. */ - if (ctl_softc->ctl_ports[ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]->port_type != - CTL_PORT_FC) - is_fc = 0; - else - is_fc = 1; + port_type = ctl_softc->ctl_ports[ + ctl_port_idx(ctsio->io_hdr.nexus.targ_port)]->port_type; + if (port_type == CTL_PORT_IOCTL || port_type == CTL_PORT_INTERNAL) + port_type = CTL_PORT_SCSI; lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; @@ -10385,7 +10395,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE; /* RMB in byte 2 is 0 */ - inq_ptr->version = SCSI_REV_SPC3; + inq_ptr->version = SCSI_REV_SPC4; /* * According to SAM-3, even if a device only supports a single @@ -10410,17 +10420,18 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio CTL_DEBUG_PRINT(("additional_length = %d\n", inq_ptr->additional_length)); - inq_ptr->spc3_flags = SPC3_SID_TPGS_IMPLICIT; + inq_ptr->spc3_flags = SPC3_SID_3PC; + if (!ctl_is_single) + inq_ptr->spc3_flags |= SPC3_SID_TPGS_IMPLICIT; /* 16 bit addressing */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->spc2_flags = SPC2_SID_ADDR16; /* XXX set the SID_MultiP bit here if we're actually going to respond on multiple ports */ inq_ptr->spc2_flags |= SPC2_SID_MultiP; /* 16 bit data bus, synchronous transfers */ - /* XXX these flags don't apply for FC */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->flags = SID_WBus16 | SID_Sync; /* * XXX KDM do we want to support tagged queueing on the control @@ -10481,33 +10492,36 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio * and Selection) and Information Unit transfers on both the * control and array devices. */ - if (is_fc == 0) + if (port_type == CTL_PORT_SCSI) inq_ptr->spi3data = SID_SPI_CLOCK_DT_ST | SID_SPI_QAS | SID_SPI_IUS; - /* SAM-3 */ - scsi_ulto2b(0x0060, inq_ptr->version1); - /* SPC-3 (no version claimed) XXX should we claim a version? */ - scsi_ulto2b(0x0300, inq_ptr->version2); - if (is_fc) { + /* SAM-5 (no version claimed) */ + scsi_ulto2b(0x00A0, inq_ptr->version1); + /* SPC-4 (no version claimed) */ + scsi_ulto2b(0x0460, inq_ptr->version2); + if (port_type == CTL_PORT_FC) { /* FCP-2 ANSI INCITS.350:2003 */ scsi_ulto2b(0x0917, inq_ptr->version3); - } else { + } else if (port_type == CTL_PORT_SCSI) { /* SPI-4 ANSI INCITS.362:200x */ scsi_ulto2b(0x0B56, inq_ptr->version3); + } else if (port_type == CTL_PORT_ISCSI) { + /* iSCSI (no version claimed) */ + scsi_ulto2b(0x0960, inq_ptr->version3); + } else if (port_type == CTL_PORT_SAS) { + /* SAS (no version claimed) */ + scsi_ulto2b(0x0BE0, inq_ptr->version3); } if (lun == NULL) { - /* SBC-2 (no version claimed) XXX should we claim a version? */ - scsi_ulto2b(0x0320, inq_ptr->version4); + /* SBC-3 (no version claimed) */ + scsi_ulto2b(0x04C0, inq_ptr->version4); } else { switch (lun->be_lun->lun_type) { case T_DIRECT: - /* - * SBC-2 (no version claimed) XXX should we claim a - * version? - */ - scsi_ulto2b(0x0320, inq_ptr->version4); + /* SBC-3 (no version claimed) */ + scsi_ulto2b(0x04C0, inq_ptr->version4); break; case T_PROCESSOR: default: Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Wed Jul 30 07:18:32 2014 (r269296) @@ -190,6 +190,156 @@ const struct ctl_cmd_entry ctl_cmd_table /* 08-1f */ }; +/* 83 EXTENDED COPY */ +const struct ctl_cmd_entry ctl_cmd_table_83[32] = +{ +/* 00 EXTENDED COPY (LID1) */ +{ctl_extended_copy_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 16, { 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 01 EXTENDED COPY (LID4) */ +{ctl_extended_copy_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_NONE, + 16, { 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 04 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 05 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 06 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 09 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0C */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0D */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0E */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 0F */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 10 POPULATE TOKEN */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 11 WRITE USING TOKEN */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 12 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 13 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 14 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 15 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 16 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 17 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 18 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 19 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1A */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1B */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 1C COPY OPERATION ABORT */ +{ctl_copy_operation_abort, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_NONE, + CTL_LUN_PAT_NONE, + 16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, +}; + +/* 84 RECEIVE COPY STATUS */ +const struct ctl_cmd_entry ctl_cmd_table_84[32] = +{ +/* 00 RECEIVE COPY STATUS (LID1) */ +{ctl_receive_copy_status_lid1, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x00, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 01 RECEIVE COPY DATA (LID1) */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 02 */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 03 RECEIVE COPY OPERATING PARAMETERS */ +{ctl_receive_copy_operating_parameters, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_SECONDARY | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 04 RECEIVE COPY FAILURE DETAILS (LID1) */ +{ctl_receive_copy_failure_details, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x04, 0xff, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 05 RECEIVE COPY STATUS (LID4) */ +{ctl_receive_copy_status_lid4, CTL_SERIDX_RD_CAP, + CTL_CMD_FLAG_OK_ON_BOTH | + CTL_FLAG_DATA_IN, + CTL_LUN_PAT_NONE, + 16, {0x05, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, + +/* 06 RECEIVE COPY DATA (LID4)*/ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 07 RECEIVE ROD TOKEN INFORMATION */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, + +/* 08 REPORT ALL ROD TOKENS */ +{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +}; + /* 9E SERVICE ACTION IN(16) */ const struct ctl_cmd_entry ctl_cmd_table_9e[32] = { @@ -844,10 +994,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 83 EXTENDED COPY */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_83), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 84 RECEIVE COPY RESULTS */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{__DECONST(ctl_opfunc *, ctl_cmd_table_84), CTL_SERIDX_INVLD, CTL_CMD_FLAG_SA5, + CTL_LUN_PAT_NONE}, /* 85 */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_frontend.c Wed Jul 30 07:18:32 2014 (r269296) @@ -234,6 +234,8 @@ ctl_port_deregister(struct ctl_port *por port->port_devid = NULL; free(port->target_devid, M_CTL); port->target_devid = NULL; + free(port->init_devid, M_CTL); + port->init_devid = NULL; for (i = 0; i < port->max_initiators; i++) free(port->wwpn_iid[i].name, M_CTL); free(port->wwpn_iid, M_CTL); Modified: stable/10/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.h Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_frontend.h Wed Jul 30 07:18:32 2014 (r269296) @@ -242,6 +242,7 @@ struct ctl_port { ctl_options_t options; /* passed to CTL */ struct ctl_devid *port_devid; /* passed to CTL */ struct ctl_devid *target_devid; /* passed to CTL */ + struct ctl_devid *init_devid; /* passed to CTL */ STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ STAILQ_ENTRY(ctl_port) links; /* used by CTL */ }; Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Wed Jul 30 07:18:32 2014 (r269296) @@ -2707,7 +2707,7 @@ cfiscsi_scsi_command_done(union ctl_io * * Do not return status for aborted commands. * There are exceptions, but none supported by CTL yet. */ - if (io->io_hdr.status == CTL_CMD_ABORTED && + if ((io->io_hdr.flags & CTL_FLAG_ABORT) && (io->io_hdr.flags & CTL_FLAG_ABORT_STATUS) == 0) { ctl_free_io(io); icl_pdu_free(request); Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:18:32 2014 (r269296) @@ -373,6 +373,7 @@ struct ctl_devid { */ #define NUM_TARGET_PORT_GROUPS 2 +struct tpc_list; struct ctl_lun { struct mtx lun_lock; struct ctl_id target; @@ -403,6 +404,7 @@ struct ctl_lun { uint8_t res_type; uint8_t write_buffer[524288]; struct ctl_devid *lun_devid; + TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; }; typedef enum { @@ -467,6 +469,8 @@ struct ctl_softc { extern const struct ctl_cmd_entry ctl_cmd_table[256]; uint32_t ctl_get_initindex(struct ctl_nexus *nexus); +uint32_t ctl_get_resindex(struct ctl_nexus *nexus); +uint32_t ctl_port_idx(int port_num); int ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, uint32_t total_ctl_io, struct ctl_io_pool **npool); void ctl_pool_free(struct ctl_io_pool *pool); @@ -498,6 +502,17 @@ int ctl_report_supported_tmf(struct ctl_ int ctl_report_timestamp(struct ctl_scsiio *ctsio); int ctl_isc(struct ctl_scsiio *ctsio); +void ctl_tpc_init(struct ctl_lun *lun); +void ctl_tpc_shutdown(struct ctl_lun *lun); +int ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len); +int ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio); +int ctl_receive_copy_failure_details(struct ctl_scsiio *ctsio); +int ctl_receive_copy_status_lid4(struct ctl_scsiio *ctsio); +int ctl_receive_copy_operating_parameters(struct ctl_scsiio *ctsio); +int ctl_extended_copy_lid1(struct ctl_scsiio *ctsio); +int ctl_extended_copy_lid4(struct ctl_scsiio *ctsio); +int ctl_copy_operation_abort(struct ctl_scsiio *ctsio); + #endif /* _KERNEL */ #endif /* _CTL_PRIVATE_H_ */ Modified: stable/10/sys/cam/ctl/ctl_ser_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_ser_table.c Wed Jul 30 07:16:08 2014 (r269295) +++ stable/10/sys/cam/ctl/ctl_ser_table.c Wed Jul 30 07:18:32 2014 (r269296) @@ -69,7 +69,7 @@ ctl_serialize_table[CTL_SERIDX_COUNT][CT /*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, /*RQ_SNS */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, /*INQ */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, -/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, +/*RD_CAP */{ pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, /*RES */{ bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, /*LOG_SNS */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, pS, bK, bK}, /*FORMAT */{ pS, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, Copied: stable/10/sys/cam/ctl/ctl_tpc.c (from r268767, head/sys/cam/ctl/ctl_tpc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/cam/ctl/ctl_tpc.c Wed Jul 30 07:18:32 2014 (r269296, copy of r268767, head/sys/cam/ctl/ctl_tpc.c) @@ -0,0 +1,1370 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TPC_MAX_CSCDS 64 +#define TPC_MAX_SEGS 64 +#define TPC_MAX_SEG 0 +#define TPC_MAX_LIST 8192 +#define TPC_MAX_INLINE 0 +#define TPC_MAX_LISTS 255 +#define TPC_MAX_IO_SIZE (1024 * 1024) + +MALLOC_DEFINE(M_CTL_TPC, "ctltpc", "CTL TPC"); + +typedef enum { + TPC_ERR_RETRY = 0x000, + TPC_ERR_FAIL = 0x001, + TPC_ERR_MASK = 0x0ff, + TPC_ERR_NO_DECREMENT = 0x100 +} tpc_error_action; + +struct tpc_list; +TAILQ_HEAD(runl, tpc_io); +struct tpc_io { + union ctl_io *io; + uint64_t lun; + struct tpc_list *list; + struct runl run; + TAILQ_ENTRY(tpc_io) rlinks; + TAILQ_ENTRY(tpc_io) links; +}; + +struct tpc_list { + uint8_t service_action; + int init_port; + uint16_t init_idx; + uint32_t list_id; + uint8_t flags; + uint8_t *params; + struct scsi_ec_cscd *cscd; + struct scsi_ec_segment *seg[TPC_MAX_SEGS]; + uint8_t *inl; + int ncscd; + int nseg; + int leninl; + int curseg; + off_t curbytes; + int curops; + int stage; + uint8_t *buf; + int segbytes; + int tbdio; + int error; + int abort; + int completed; + TAILQ_HEAD(, tpc_io) allio; + struct scsi_sense_data sense_data; + uint8_t sense_len; + uint8_t scsi_status; + struct ctl_scsiio *ctsio; + struct ctl_lun *lun; + TAILQ_ENTRY(tpc_list) links; +}; + +void +ctl_tpc_init(struct ctl_lun *lun) +{ + + TAILQ_INIT(&lun->tpc_lists); +} + +void +ctl_tpc_shutdown(struct ctl_lun *lun) +{ + struct tpc_list *list; + + while ((list = TAILQ_FIRST(&lun->tpc_lists)) != NULL) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + KASSERT(list->completed, + ("Not completed TPC (%p) on shutdown", list)); + free(list, M_CTL); + } +} + +int +ctl_inquiry_evpd_tpc(struct ctl_scsiio *ctsio, int alloc_len) +{ + struct scsi_vpd_tpc *tpc_ptr; + struct scsi_vpd_tpc_descriptor *d_ptr; + struct scsi_vpd_tpc_descriptor_sc *sc_ptr; + struct scsi_vpd_tpc_descriptor_sc_descr *scd_ptr; + struct scsi_vpd_tpc_descriptor_pd *pd_ptr; + struct scsi_vpd_tpc_descriptor_sd *sd_ptr; + struct scsi_vpd_tpc_descriptor_sdid *sdid_ptr; + struct scsi_vpd_tpc_descriptor_gco *gco_ptr; + struct ctl_lun *lun; + int data_len; + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + data_len = sizeof(struct scsi_vpd_tpc) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sc) + + 2 * sizeof(struct scsi_vpd_tpc_descriptor_sc_descr) + 7, 4) + + sizeof(struct scsi_vpd_tpc_descriptor_pd) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sd) + 4, 4) + + roundup2(sizeof(struct scsi_vpd_tpc_descriptor_sdid) + 2, 4) + + sizeof(struct scsi_vpd_tpc_descriptor_gco); + + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + tpc_ptr = (struct scsi_vpd_tpc *)ctsio->kern_data_ptr; + ctsio->kern_sg_entries = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + /* + * The control device is always connected. The disk device, on the + * other hand, may not be online all the time. + */ + if (lun != NULL) + tpc_ptr->device = (SID_QUAL_LU_CONNECTED << 5) | + lun->be_lun->lun_type; + else + tpc_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; + tpc_ptr->page_code = SVPD_SCSI_TPC; + scsi_ulto2b(data_len - 4, tpc_ptr->page_length); + + /* Supported commands */ + d_ptr = (struct scsi_vpd_tpc_descriptor *)&tpc_ptr->descr[0]; + sc_ptr = (struct scsi_vpd_tpc_descriptor_sc *)d_ptr; + scsi_ulto2b(SVPD_TPC_SC, sc_ptr->desc_type); + sc_ptr->list_length = 2 * sizeof(*scd_ptr) + 7; + scsi_ulto2b(roundup2(1 + sc_ptr->list_length, 4), sc_ptr->desc_length); + scd_ptr = &sc_ptr->descr[0]; + scd_ptr->opcode = EXTENDED_COPY; + scd_ptr->sa_length = 3; + scd_ptr->supported_service_actions[0] = EC_EC_LID1; + scd_ptr->supported_service_actions[1] = EC_EC_LID4; + scd_ptr->supported_service_actions[2] = EC_COA; + scd_ptr = (struct scsi_vpd_tpc_descriptor_sc_descr *) + &scd_ptr->supported_service_actions[scd_ptr->sa_length]; + scd_ptr->opcode = RECEIVE_COPY_STATUS; + scd_ptr->sa_length = 4; + scd_ptr->supported_service_actions[0] = RCS_RCS_LID1; + scd_ptr->supported_service_actions[1] = RCS_RCFD; + scd_ptr->supported_service_actions[2] = RCS_RCS_LID4; + scd_ptr->supported_service_actions[3] = RCS_RCOP; + + /* Parameter data. */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + pd_ptr = (struct scsi_vpd_tpc_descriptor_pd *)d_ptr; + scsi_ulto2b(SVPD_TPC_PD, pd_ptr->desc_type); + scsi_ulto2b(sizeof(*pd_ptr) - 4, pd_ptr->desc_length); + scsi_ulto2b(TPC_MAX_CSCDS, pd_ptr->maximum_cscd_descriptor_count); + scsi_ulto2b(TPC_MAX_SEGS, pd_ptr->maximum_segment_descriptor_count); + scsi_ulto4b(TPC_MAX_LIST, pd_ptr->maximum_descriptor_list_length); + scsi_ulto4b(TPC_MAX_INLINE, pd_ptr->maximum_inline_data_length); + + /* Supported Descriptors */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + sd_ptr = (struct scsi_vpd_tpc_descriptor_sd *)d_ptr; + scsi_ulto2b(SVPD_TPC_SD, sd_ptr->desc_type); + scsi_ulto2b(roundup2(sizeof(*sd_ptr) - 4 + 4, 4), sd_ptr->desc_length); + sd_ptr->list_length = 4; + sd_ptr->supported_descriptor_codes[0] = EC_SEG_B2B; + sd_ptr->supported_descriptor_codes[1] = EC_SEG_VERIFY; + sd_ptr->supported_descriptor_codes[2] = EC_SEG_REGISTER_KEY; + sd_ptr->supported_descriptor_codes[3] = EC_CSCD_ID; + + /* Supported CSCD Descriptor IDs */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + sdid_ptr = (struct scsi_vpd_tpc_descriptor_sdid *)d_ptr; + scsi_ulto2b(SVPD_TPC_SDID, sdid_ptr->desc_type); + scsi_ulto2b(roundup2(sizeof(*sdid_ptr) - 4 + 2, 4), sdid_ptr->desc_length); + scsi_ulto2b(2, sdid_ptr->list_length); + scsi_ulto2b(0xffff, &sdid_ptr->supported_descriptor_ids[0]); + + /* General Copy Operations */ + d_ptr = (struct scsi_vpd_tpc_descriptor *) + (&d_ptr->parameters[0] + scsi_2btoul(d_ptr->desc_length)); + gco_ptr = (struct scsi_vpd_tpc_descriptor_gco *)d_ptr; + scsi_ulto2b(SVPD_TPC_GCO, gco_ptr->desc_type); + scsi_ulto2b(sizeof(*gco_ptr) - 4, gco_ptr->desc_length); + scsi_ulto4b(TPC_MAX_LISTS, gco_ptr->total_concurrent_copies); + scsi_ulto4b(TPC_MAX_LISTS, gco_ptr->maximum_identified_concurrent_copies); + scsi_ulto4b(TPC_MAX_SEG, gco_ptr->maximum_segment_length); + gco_ptr->data_segment_granularity = 0; + gco_ptr->inline_data_granularity = 0; + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_receive_copy_operating_parameters(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_operating_parameters *cdb; + struct scsi_receive_copy_operating_parameters_data *data; + int retval; + int alloc_len, total_len; + + CTL_DEBUG_PRINT(("ctl_report_supported_tmf\n")); + + cdb = (struct scsi_receive_copy_operating_parameters *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + total_len = sizeof(*data) + 4; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_operating_parameters_data *)ctsio->kern_data_ptr; + scsi_ulto4b(sizeof(*data) - 4 + 4, data->length); + data->snlid = RCOP_SNLID; + scsi_ulto2b(TPC_MAX_CSCDS, data->maximum_cscd_descriptor_count); + scsi_ulto2b(TPC_MAX_SEGS, data->maximum_segment_descriptor_count); + scsi_ulto4b(TPC_MAX_LIST, data->maximum_descriptor_list_length); + scsi_ulto4b(TPC_MAX_SEG, data->maximum_segment_length); + scsi_ulto4b(TPC_MAX_INLINE, data->maximum_inline_data_length); + scsi_ulto4b(0, data->held_data_limit); + scsi_ulto4b(0, data->maximum_stream_device_transfer_size); + scsi_ulto2b(TPC_MAX_LISTS, data->total_concurrent_copies); + data->maximum_concurrent_copies = TPC_MAX_LISTS; + data->data_segment_granularity = 0; + data->inline_data_granularity = 0; + data->held_data_granularity = 0; + data->implemented_descriptor_list_length = 4; + data->list_of_implemented_descriptor_type_codes[0] = EC_SEG_B2B; + data->list_of_implemented_descriptor_type_codes[1] = EC_SEG_VERIFY; + data->list_of_implemented_descriptor_type_codes[2] = EC_SEG_REGISTER_KEY; + data->list_of_implemented_descriptor_type_codes[3] = EC_CSCD_ID; + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_status_lid1 *cdb; + struct scsi_receive_copy_status_lid1_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; + int alloc_len, total_len; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_receive_copy_status_lid1\n")); + + cdb = (struct scsi_receive_copy_status_lid1 *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = cdb->list_identifier; + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if ((list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list_copy = *list; + if (list->completed) { + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + } + mtx_unlock(&lun->lun_lock); + + total_len = sizeof(*data); + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_status_lid1_data *)ctsio->kern_data_ptr; + scsi_ulto4b(sizeof(*data) - 4, data->available_data); + if (list_copy.completed) { + if (list_copy.error || list_copy.abort) + data->copy_command_status = RCS_CCS_ERROR; + else + data->copy_command_status = RCS_CCS_COMPLETED; + } else + data->copy_command_status = RCS_CCS_INPROG; + scsi_ulto2b(list_copy.curseg, data->segments_processed); + if (list_copy.curbytes <= UINT32_MAX) { + data->transfer_count_units = RCS_TC_BYTES; + scsi_ulto4b(list_copy.curbytes, data->transfer_count); + } else { + data->transfer_count_units = RCS_TC_MBYTES; + scsi_ulto4b(list_copy.curbytes >> 20, data->transfer_count); + } + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_failure_details(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_failure_details *cdb; + struct scsi_receive_copy_failure_details_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; + int alloc_len, total_len; + uint32_t list_id; + + CTL_DEBUG_PRINT(("ctl_receive_copy_failure_details\n")); + + cdb = (struct scsi_receive_copy_failure_details *)ctsio->cdb; + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + retval = CTL_RETVAL_COMPLETE; + + list_id = cdb->list_identifier; + mtx_lock(&lun->lun_lock); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if (list->completed && (list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id) + break; + } + if (list == NULL) { + mtx_unlock(&lun->lun_lock); + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (retval); + } + list_copy = *list; + TAILQ_REMOVE(&lun->tpc_lists, list, links); + free(list, M_CTL); + mtx_unlock(&lun->lun_lock); + + total_len = sizeof(*data) + list_copy.sense_len; + alloc_len = scsi_4btoul(cdb->length); + + ctsio->kern_data_ptr = malloc(total_len, M_CTL, M_WAITOK | M_ZERO); + + ctsio->kern_sg_entries = 0; + + if (total_len < alloc_len) { + ctsio->residual = alloc_len - total_len; + ctsio->kern_data_len = total_len; + ctsio->kern_total_len = total_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + data = (struct scsi_receive_copy_failure_details_data *)ctsio->kern_data_ptr; + if (list_copy.completed && (list_copy.error || list_copy.abort)) { + scsi_ulto4b(sizeof(*data) - 4, data->available_data); + data->copy_command_status = RCS_CCS_ERROR; + } else + scsi_ulto4b(0, data->available_data); + scsi_ulto2b(list_copy.sense_len, data->sense_data_length); + memcpy(data->sense_data, &list_copy.sense_data, list_copy.sense_len); + + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + + ctl_datamove((union ctl_io *)ctsio); + return (retval); +} + +int +ctl_receive_copy_status_lid4(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + struct scsi_receive_copy_status_lid4 *cdb; + struct scsi_receive_copy_status_lid4_data *data; + struct tpc_list *list; + struct tpc_list list_copy; + int retval; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 07:20:36 2014 Return-Path: Delivered-To: svn-src-all@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 B418FB6; Wed, 30 Jul 2014 07:20:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A03B62554; Wed, 30 Jul 2014 07:20:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U7Kajn054843; Wed, 30 Jul 2014 07:20:36 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U7Ka80054841; Wed, 30 Jul 2014 07:20:36 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407300720.s6U7Ka80054841@svn.freebsd.org> From: Alexander Motin Date: Wed, 30 Jul 2014 07:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269297 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 07:20:36 -0000 Author: mav Date: Wed Jul 30 07:20:36 2014 New Revision: 269297 URL: http://svnweb.freebsd.org/changeset/base/269297 Log: MFC r268807: Reduce per-LUN memory usage from 18MB to 1.8MB. CTL never had use for CA support code since SPI has gone, and there is no even frontends supporting that. But it still was reserving 256 bytes of memory per LUN per every possible initiator on every possible port. Wrap unused code with ifdef's in case somebody ever need it. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:18:32 2014 (r269296) +++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:20:36 2014 (r269297) @@ -4609,7 +4609,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft * Set the poweron UA for all initiators on this LUN only. */ for (i = 0; i < CTL_MAX_INITIATORS; i++) - lun->pending_sense[i].ua_pending = CTL_UA_POWERON; + lun->pending_ua[i] = CTL_UA_POWERON; /* * Now, before we insert this lun on the lun list, set the lun @@ -4617,7 +4617,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft */ STAILQ_FOREACH(nlun, &ctl_softc->lun_list, links) { for (i = 0; i < CTL_MAX_INITIATORS; i++) { - nlun->pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE; + nlun->pending_ua[i] |= CTL_UA_LUN_CHANGE; } } @@ -4758,7 +4758,7 @@ ctl_free_lun(struct ctl_lun *lun) STAILQ_FOREACH(nlun, &softc->lun_list, links) { for (i = 0; i < CTL_MAX_INITIATORS; i++) { - nlun->pending_sense[i].ua_pending |= CTL_UA_LUN_CHANGE; + nlun->pending_ua[i] |= CTL_UA_LUN_CHANGE; } } @@ -5137,7 +5137,7 @@ ctl_lun_capacity_changed(struct ctl_be_l mtx_lock(&lun->lun_lock); for (i = 0; i < CTL_MAX_INITIATORS; i++) - lun->pending_sense[i].ua_pending |= CTL_UA_CAPACITY_CHANGED; + lun->pending_ua[i] |= CTL_UA_CAPACITY_CHANGED; mtx_unlock(&lun->lun_lock); } @@ -6239,8 +6239,7 @@ ctl_control_page_handler(struct ctl_scsi if (i == initidx) continue; - lun->pending_sense[i].ua_pending |= - CTL_UA_MODE_CHANGE; + lun->pending_ua[i] |= CTL_UA_MODE_CHANGE; } } mtx_unlock(&lun->lun_lock); @@ -8005,12 +8004,11 @@ ctl_pro_preempt(struct ctl_softc *softc, if (!persis_offset && i pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset - ].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; lun->per_res[i].registered = 0; memset(&lun->per_res[i].res_key, 0, @@ -8092,13 +8090,10 @@ ctl_pro_preempt(struct ctl_softc *softc, sizeof(struct scsi_per_res_key)); lun->pr_key_count--; - if (!persis_offset - && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= - CTL_UA_REG_PREEMPT; - else if (persis_offset - && i >= persis_offset) - lun->pending_sense[i-persis_offset].ua_pending|= + if (!persis_offset && i < CTL_MAX_INITIATORS) + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; + else if (persis_offset && i >= persis_offset) + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } if (!found) { @@ -8189,27 +8184,23 @@ ctl_pro_preempt(struct ctl_softc *softc, if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } else if (type != lun->res_type && (lun->res_type == SPR_TYPE_WR_EX_RO || lun->res_type ==SPR_TYPE_EX_AC_RO)){ if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset - ].ua_pending |= + lun->pending_ua[ + i-persis_offset] |= CTL_UA_RES_RELEASE; } } @@ -8258,12 +8249,11 @@ ctl_pro_preempt(struct ctl_softc *softc, if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[ - i-persis_offset].ua_pending |= + lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; } @@ -8325,11 +8315,10 @@ ctl_pro_preempt_other(struct ctl_lun *lu if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; lun->per_res[i].registered = 0; memset(&lun->per_res[i].res_key, 0, @@ -8356,12 +8345,11 @@ ctl_pro_preempt_other(struct ctl_lun *lu if (!persis_offset && i < persis_offset) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; } } @@ -8384,25 +8372,22 @@ ctl_pro_preempt_other(struct ctl_lun *lu lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_REG_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; } else if (msg->pr.pr_info.res_type != lun->res_type && (lun->res_type == SPR_TYPE_WR_EX_RO || lun->res_type == SPR_TYPE_EX_AC_RO)) { if (!persis_offset && i < persis_offset) - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i - - persis_offset].ua_pending |= + lun->pending_ua[i - persis_offset] |= CTL_UA_RES_RELEASE; } } @@ -8619,8 +8604,7 @@ ctl_persistent_reserve_out(struct ctl_sc i+persis_offset].registered == 0) continue; - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } } @@ -8778,7 +8762,7 @@ ctl_persistent_reserve_out(struct ctl_sc if (lun->per_res[i+persis_offset].registered == 0) continue; - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -8813,11 +8797,11 @@ ctl_persistent_reserve_out(struct ctl_sc for (i=0; i < 2*CTL_MAX_INITIATORS; i++) if (lun->per_res[i].registered) { if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset - ].ua_pending |= CTL_UA_RES_PREEMPT; + lun->pending_ua[i-persis_offset] |= + CTL_UA_RES_PREEMPT; memset(&lun->per_res[i].res_key, 0, sizeof(struct scsi_per_res_key)); @@ -8915,8 +8899,7 @@ ctl_hndl_per_res_out_on_other_sc(union c persis_offset].registered == 0) continue; - lun->pending_sense[i - ].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } } @@ -8947,7 +8930,7 @@ ctl_hndl_per_res_out_on_other_sc(union c && lun->res_type != SPR_TYPE_WR_EX) { for (i = 0; i < CTL_MAX_INITIATORS; i++) if (lun->per_res[i+persis_offset].registered) - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -8970,11 +8953,10 @@ ctl_hndl_per_res_out_on_other_sc(union c continue; if (!persis_offset && i < CTL_MAX_INITIATORS) - lun->pending_sense[i].ua_pending |= - CTL_UA_RES_PREEMPT; + lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; else if (persis_offset && i >= persis_offset) - lun->pending_sense[i-persis_offset].ua_pending|= + lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; memset(&lun->per_res[i].res_key, 0, sizeof(struct scsi_per_res_key)); @@ -9542,8 +9524,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio */ if (request_lun != NULL) { mtx_lock(&lun->lun_lock); - lun->pending_sense[initidx].ua_pending &= - ~CTL_UA_LUN_CHANGE; + lun->pending_ua[initidx] &= ~CTL_UA_LUN_CHANGE; mtx_unlock(&lun->lun_lock); } } @@ -9645,6 +9626,7 @@ ctl_request_sense(struct ctl_scsiio *cts * Pending sense gets returned first, then pending unit attentions. */ mtx_lock(&lun->lun_lock); +#ifdef CTL_WITH_CA if (ctl_is_set(lun->have_ca, initidx)) { scsi_sense_data_type stored_format; @@ -9652,8 +9634,7 @@ ctl_request_sense(struct ctl_scsiio *cts * Check to see which sense format was used for the stored * sense data. */ - stored_format = scsi_sense_type( - &lun->pending_sense[initidx].sense); + stored_format = scsi_sense_type(&lun->pending_sense[initidx]); /* * If the user requested a different sense format than the @@ -9668,29 +9649,31 @@ ctl_request_sense(struct ctl_scsiio *cts if ((stored_format == SSD_TYPE_FIXED) && (sense_format == SSD_TYPE_DESC)) ctl_sense_to_desc((struct scsi_sense_data_fixed *) - &lun->pending_sense[initidx].sense, + &lun->pending_sense[initidx], (struct scsi_sense_data_desc *)sense_ptr); else if ((stored_format == SSD_TYPE_DESC) && (sense_format == SSD_TYPE_FIXED)) ctl_sense_to_fixed((struct scsi_sense_data_desc *) - &lun->pending_sense[initidx].sense, + &lun->pending_sense[initidx], (struct scsi_sense_data_fixed *)sense_ptr); else - memcpy(sense_ptr, &lun->pending_sense[initidx].sense, + memcpy(sense_ptr, &lun->pending_sense[initidx], ctl_min(sizeof(*sense_ptr), - sizeof(lun->pending_sense[initidx].sense))); + sizeof(lun->pending_sense[initidx]))); ctl_clear_mask(lun->have_ca, initidx); have_error = 1; - } else if (lun->pending_sense[initidx].ua_pending != CTL_UA_NONE) { + } else +#endif + if (lun->pending_ua[initidx] != CTL_UA_NONE) { ctl_ua_type ua_type; - ua_type = ctl_build_ua(lun->pending_sense[initidx].ua_pending, + ua_type = ctl_build_ua(lun->pending_ua[initidx], sense_ptr, sense_format); if (ua_type != CTL_UA_NONE) { have_error = 1; /* We're reporting this UA, so clear it */ - lun->pending_sense[initidx].ua_pending &= ~ua_type; + lun->pending_ua[initidx] &= ~ua_type; } } mtx_unlock(&lun->lun_lock); @@ -11308,7 +11291,7 @@ ctl_failover(void) * Build Unit Attention */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_ASYM_ACC_CHANGE; } } else if (((lun->flags & CTL_LUN_PRIMARY_SC) == 0) @@ -11403,7 +11386,7 @@ ctl_failover(void) * Build Unit Attention */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - lun->pending_sense[i].ua_pending |= + lun->pending_ua[i] |= CTL_UA_ASYM_ACC_CHANGE; } } else { @@ -11503,6 +11486,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); +#ifdef CTL_WITH_CA /* * If we've got a request sense, it'll clear the contingent * allegiance condition. Otherwise, if we have a CA condition for @@ -11512,6 +11496,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct if ((ctsio->cdb[0] != REQUEST_SENSE) && (ctl_is_set(lun->have_ca, initidx))) ctl_clear_mask(lun->have_ca, initidx); +#endif /* * If the command has this flag set, it handles its own unit @@ -11538,7 +11523,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct if ((entry->flags & CTL_CMD_FLAG_NO_SENSE) == 0) { ctl_ua_type ua_type; - ua_type = lun->pending_sense[initidx].ua_pending; + ua_type = lun->pending_ua[initidx]; if (ua_type != CTL_UA_NONE) { scsi_sense_data_type sense_format; @@ -11556,8 +11541,7 @@ ctl_scsiio_precheck(struct ctl_softc *ct ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; ctsio->sense_len = SSD_FULL_SIZE; - lun->pending_sense[initidx].ua_pending &= - ~ua_type; + lun->pending_ua[initidx] &= ~ua_type; mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); return (retval); @@ -11852,7 +11836,7 @@ ctl_lun_reset(struct ctl_lun *lun, union for (i = 0; i < CTL_MAX_INITIATORS; i++) { if (initindex == i) continue; - lun->pending_sense[i].ua_pending |= ua_type; + lun->pending_ua[i] |= ua_type; } #endif @@ -11867,8 +11851,10 @@ ctl_lun_reset(struct ctl_lun *lun, union lun->flags &= ~CTL_LUN_RESERVED; for (i = 0; i < CTL_MAX_INITIATORS; i++) { +#ifdef CTL_WITH_CA ctl_clear_mask(lun->have_ca, i); - lun->pending_sense[i].ua_pending |= ua_type; +#endif + lun->pending_ua[i] |= ua_type; } mtx_unlock(&lun->lun_lock); @@ -11968,8 +11954,10 @@ ctl_i_t_nexus_reset(union ctl_io *io) ctl_abort_tasks_lun(lun, io->io_hdr.nexus.targ_port, io->io_hdr.nexus.initid.id, (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) != 0); +#ifdef CTL_WITH_CA ctl_clear_mask(lun->have_ca, initindex); - lun->pending_sense[initindex].ua_pending |= CTL_UA_I_T_NEXUS_LOSS; +#endif + lun->pending_ua[initindex] |= CTL_UA_I_T_NEXUS_LOSS; mtx_unlock(&lun->lun_lock); } mtx_unlock(&softc->ctl_lock); @@ -13651,6 +13639,7 @@ bailout: return (CTL_RETVAL_COMPLETE); } +#ifdef CTL_WITH_CA /* * Front end should call this if it doesn't do autosense. When the request * sense comes back in from the initiator, we'll dequeue this and send it. @@ -13698,8 +13687,8 @@ ctl_queue_sense(union ctl_io *io) goto bailout; } - memcpy(&lun->pending_sense[initidx].sense, &io->scsiio.sense_data, - ctl_min(sizeof(lun->pending_sense[initidx].sense), + memcpy(&lun->pending_sense[initidx], &io->scsiio.sense_data, + ctl_min(sizeof(lun->pending_sense[initidx]), sizeof(io->scsiio.sense_data))); ctl_set_mask(lun->have_ca, initidx); mtx_unlock(&lun->lun_lock); @@ -13711,6 +13700,7 @@ bailout: return (CTL_RETVAL_COMPLETE); } +#endif /* * Primary command inlet from frontend ports. All SCSI and task I/O Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:18:32 2014 (r269296) +++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:20:36 2014 (r269297) @@ -332,11 +332,6 @@ struct ctl_mode_pages { struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; -struct ctl_pending_sense { - ctl_ua_type ua_pending; - struct scsi_sense_data sense; -}; - struct ctl_lun_delay_info { ctl_delay_type datamove_type; uint32_t datamove_delay; @@ -393,8 +388,11 @@ struct ctl_lun { STAILQ_ENTRY(ctl_lun) links; STAILQ_ENTRY(ctl_lun) run_links; struct ctl_nexus rsv_nexus; +#ifdef CTL_WITH_CA uint32_t have_ca[CTL_MAX_INITIATORS >> 5]; - struct ctl_pending_sense pending_sense[CTL_MAX_INITIATORS]; + struct scsi_sense_data pending_sense[CTL_MAX_INITIATORS]; +#endif + ctl_ua_type pending_ua[CTL_MAX_INITIATORS]; struct ctl_mode_pages mode_pages; struct ctl_lun_io_stats stats; struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; @@ -402,7 +400,7 @@ struct ctl_lun { int pr_key_count; uint16_t pr_res_idx; uint8_t res_type; - uint8_t write_buffer[524288]; + uint8_t write_buffer[262144]; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; }; From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 07:21:32 2014 Return-Path: Delivered-To: svn-src-all@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 4F07E1EF; Wed, 30 Jul 2014 07:21: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B87025D7; Wed, 30 Jul 2014 07:21:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6U7LWtX055033; Wed, 30 Jul 2014 07:21:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6U7LVK4055023; Wed, 30 Jul 2014 07:21:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201407300721.s6U7LVK4055023@svn.freebsd.org> From: Alexander Motin Date: Wed, 30 Jul 2014 07:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269298 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 07:21:32 -0000 Author: mav Date: Wed Jul 30 07:21:30 2014 New Revision: 269298 URL: http://svnweb.freebsd.org/changeset/base/269298 Log: MFC r268808: Increase maximal number of SCSI ports in CTL from 32 to 128. After I gave each iSCSI target its own port, the old limit appeared to be not so big. This change almost proportionally increases per-LUN memory use, but it is still three times better then it was before r268807. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_io.h stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_tpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:20:36 2014 (r269297) +++ stable/10/sys/cam/ctl/ctl.c Wed Jul 30 07:21:30 2014 (r269298) @@ -8210,8 +8210,7 @@ ctl_pro_preempt(struct ctl_softc *softc, && lun->res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; else - lun->pr_res_idx = - CTL_PR_ALL_REGISTRANTS; + lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; Modified: stable/10/sys/cam/ctl/ctl_io.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_io.h Wed Jul 30 07:20:36 2014 (r269297) +++ stable/10/sys/cam/ctl/ctl_io.h Wed Jul 30 07:21:30 2014 (r269298) @@ -407,7 +407,7 @@ struct ctl_pr_info { ctl_pr_action action; uint8_t sa_res_key[8]; uint8_t res_type; - uint16_t residx; + uint32_t residx; }; struct ctl_ha_msg_hdr { Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Wed Jul 30 07:20:36 2014 (r269297) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Wed Jul 30 07:21:30 2014 (r269298) @@ -70,7 +70,7 @@ /* * Maximum number of ports registered at one time. */ -#define CTL_MAX_PORTS 32 +#define CTL_MAX_PORTS 128 /* * Maximum number of initiators we support. Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:20:36 2014 (r269297) +++ stable/10/sys/cam/ctl/ctl_private.h Wed Jul 30 07:21:30 2014 (r269298) @@ -355,8 +355,8 @@ struct ctl_per_res_info { uint8_t registered; }; -#define CTL_PR_ALL_REGISTRANTS 0xFFFF -#define CTL_PR_NO_RESERVATION 0xFFF0 +#define CTL_PR_ALL_REGISTRANTS 0xFFFFFFFF +#define CTL_PR_NO_RESERVATION 0xFFFFFFF0 struct ctl_devid { int len; @@ -398,7 +398,7 @@ struct ctl_lun { struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; unsigned int PRGeneration; int pr_key_count; - uint16_t pr_res_idx; + uint32_t pr_res_idx; uint8_t res_type; uint8_t write_buffer[262144]; struct ctl_devid *lun_devid; Modified: stable/10/sys/cam/ctl/ctl_tpc.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_tpc.c Wed Jul 30 07:20:36 2014 (r269297) +++ stable/10/sys/cam/ctl/ctl_tpc.c Wed Jul 30 07:21:30 2014 (r269298) @@ -89,7 +89,7 @@ struct tpc_io { struct tpc_list { uint8_t service_action; int init_port; - uint16_t init_idx; + uint32_t init_idx; uint32_t list_id; uint8_t flags; uint8_t *params; From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 09:08:58 2014 Return-Path: Delivered-To: svn-src-all@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 53902507; Wed, 30 Jul 2014 09:08:58 +0000 (UTC) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C7512067; Wed, 30 Jul 2014 09:08:57 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5690225D3815; Wed, 30 Jul 2014 09:08:48 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 7CD49C256BE; Wed, 30 Jul 2014 09:08:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id OTR9o8iTPnDj; Wed, 30 Jul 2014 09:08:44 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (unknown [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6F85DC22B9C; Wed, 30 Jul 2014 09:08:43 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269231 - head/usr.bin/m4/lib From: "Bjoern A. Zeeb" In-Reply-To: <201407290946.s6T9k9rO072927@svn.freebsd.org> Date: Wed, 30 Jul 2014 09:08:40 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <98D8945B-7D51-45C7-9BF6-0DA677FCA2B3@FreeBSD.org> References: <201407290946.s6T9k9rO072927@svn.freebsd.org> To: Baptiste Daroussin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 09:08:58 -0000 On 29 Jul 2014, at 09:46 , Baptiste Daroussin wrote: > Author: bapt > Date: Tue Jul 29 09:46:08 2014 > New Revision: 269231 > URL: http://svnweb.freebsd.org/changeset/base/269231 >=20 > Log: > Fix build with gcc >=20 I fear that was not enough; this is on arm: =3D=3D=3D> usr.bin/m4 (all) = = = =20 =3D=3D=3D> usr.bin/m4/tests (all) = = = =20 cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/usr.bin/m4/misc.c: In function 'm4errx': /scratch/tmp/bz/head.svn/usr.bin/m4/misc.c:268: warning: declaration of = 'eval' shadows a global declaration /scratch/tmp/bz/head.svn/usr.bin/m4/extern.h:40: warning: shadowed = declaration is here --- misc.o --- *** [misc.o] Error code 1 = = = =20 bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin/m4 cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function = 'ohash_remove': /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:123: warning: cast = discards qualifiers from pointer target type /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function = 'ohash_find': /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:144: warning: cast = discards qualifiers from pointer target type /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c: In function = 'ohash_next': /scratch/tmp/bz/head.svn/usr.bin/m4/lib/ohash.c:183: warning: cast = discards qualifiers from pointer target type --- ohash.o --- *** [ohash.o] Error code 1 = = = =20 bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin/m4 --- all_subdir_m4 --- = = = =20 *** [all_subdir_m4] Error code 1 bmake: stopped in /scratch/tmp/bz/head.svn/usr.bin > Modified: > head/usr.bin/m4/lib/ohash.h >=20 > Modified: head/usr.bin/m4/lib/ohash.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=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/usr.bin/m4/lib/ohash.h Tue Jul 29 09:36:48 2014 = (r269230) > +++ head/usr.bin/m4/lib/ohash.h Tue Jul 29 09:46:08 2014 = (r269231) > @@ -58,8 +58,7 @@ void ohash_delete(struct ohash *); > unsigned int ohash_lookup_interval(struct ohash *, const char *, > const char *, uint32_t); > unsigned int ohash_lookup_memory(struct ohash *, const char *, > - size_t, uint32_t) > - __attribute__ ((__bounded__(__string__,2,3))); > + size_t, uint32_t); > void *ohash_find(struct ohash *, unsigned int); > void *ohash_remove(struct ohash *, unsigned int); > void *ohash_insert(struct ohash *, unsigned int, void *); >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 14:46:40 2014 Return-Path: Delivered-To: svn-src-all@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 9D99857A; Wed, 30 Jul 2014 14:46: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71E5A2801; Wed, 30 Jul 2014 14:46:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UEkeOO060520; Wed, 30 Jul 2014 14:46:40 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UEkeQ6060519; Wed, 30 Jul 2014 14:46:40 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201407301446.s6UEkeQ6060519@svn.freebsd.org> From: Jeremie Le Hen Date: Wed, 30 Jul 2014 14:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269302 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 14:46:40 -0000 Author: jlh Date: Wed Jul 30 14:46:39 2014 New Revision: 269302 URL: http://svnweb.freebsd.org/changeset/base/269302 Log: Fix relative numerical addressing (addr,+N). As a bonus the patch untangles a bit the logic and makes the code easier to grasp. PR: 192108 MFC after: 1 week Modified: head/usr.bin/sed/process.c Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Wed Jul 30 12:39:49 2014 (r269301) +++ head/usr.bin/sed/process.c Wed Jul 30 14:46:39 2014 (r269302) @@ -288,24 +288,32 @@ applies(struct s_command *cp) r = 1; else if (cp->a2) if (cp->startline > 0) { - if (MATCH(cp->a2)) { - cp->startline = 0; - lastaddr = 1; - r = 1; - } else if (linenum - cp->startline <= cp->a2->u.l) - r = 1; - else if ((cp->a2->type == AT_LINE && - linenum > cp->a2->u.l) || - (cp->a2->type == AT_RELLINE && - linenum - cp->startline > cp->a2->u.l)) { - /* - * We missed the 2nd address due to a branch, - * so just close the range and return false. - */ - cp->startline = 0; - r = 0; - } else - r = 1; + switch (cp->a2->type) { + case AT_RELLINE: + if (linenum - cp->startline <= cp->a2->u.l) + r = 1; + else { + cp->startline = 0; + r = 0; + } + break; + default: + if (MATCH(cp->a2)) { + cp->startline = 0; + lastaddr = 1; + r = 1; + } else if (cp->a2->type == AT_LINE && + linenum > cp->a2->u.l) { + /* + * We missed the 2nd address due to a + * branch, so just close the range and + * return false. + */ + cp->startline = 0; + r = 0; + } else + r = 1; + } } else if (MATCH(cp->a1)) { /* * If the second address is a number less than or From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 14:52:05 2014 Return-Path: Delivered-To: svn-src-all@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 112408AC; Wed, 30 Jul 2014 14:52: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F332128E9; Wed, 30 Jul 2014 14:52:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UEq4ad064549; Wed, 30 Jul 2014 14:52:04 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UEq4Jv064548; Wed, 30 Jul 2014 14:52:04 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201407301452.s6UEq4Jv064548@svn.freebsd.org> From: Kirk McKusick Date: Wed, 30 Jul 2014 14:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269303 - head/sbin/restore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 14:52:05 -0000 Author: mckusick Date: Wed Jul 30 14:52:04 2014 New Revision: 269303 URL: http://svnweb.freebsd.org/changeset/base/269303 Log: When restoring a UFS dump onto a ZFS filesystem, an assertion in restore was failing because ZFS was reporting a blocksize that was not a multiple of 1024. Replace restore's failed assertion with code that writes restored files in a blocksize that works for restore (a multiple of 1024) despite being non-optimal for ZFS. Submitted by: Dmitry Morozovsky Tested by: Dmitry Morozovsky MFC after: 1 week Modified: head/sbin/restore/tape.c Modified: head/sbin/restore/tape.c ============================================================================== --- head/sbin/restore/tape.c Wed Jul 30 14:46:39 2014 (r269302) +++ head/sbin/restore/tape.c Wed Jul 30 14:52:04 2014 (r269303) @@ -260,9 +260,11 @@ setup(void) fssize = TP_BSIZE; if (stbuf.st_blksize >= TP_BSIZE && stbuf.st_blksize <= MAXBSIZE) fssize = stbuf.st_blksize; - if (((fssize - 1) & fssize) != 0) { - fprintf(stderr, "bad block size %ld\n", fssize); - done(1); + if (((TP_BSIZE - 1) & stbuf.st_blksize) != 0) { + fprintf(stderr, "Warning: filesystem with non-multiple-of-%d " + "blocksize (%d);\n", TP_BSIZE, stbuf.st_blksize); + fssize = roundup(fssize, TP_BSIZE); + fprintf(stderr, "\twriting using blocksize %ld\n", fssize); } if (spcl.c_volume != 1) { fprintf(stderr, "Tape is not volume 1 of the dump\n"); From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 15:08:13 2014 Return-Path: Delivered-To: svn-src-all@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 1D966256; Wed, 30 Jul 2014 15:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BA162AA1; Wed, 30 Jul 2014 15:08:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UF8Cp2070347; Wed, 30 Jul 2014 15:08:12 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UF8CKr070346; Wed, 30 Jul 2014 15:08:12 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201407301508.s6UF8CKr070346@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 30 Jul 2014 15:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269306 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 15:08:13 -0000 Author: ae Date: Wed Jul 30 15:08:12 2014 New Revision: 269306 URL: http://svnweb.freebsd.org/changeset/base/269306 Log: Add new rule to source address selection algorithm. It prefers address with better virtual status. Use ifa_preferred() to choose better address. PR: 187341 Tested by: des MFC after: 1 week Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Wed Jul 30 15:01:32 2014 (r269305) +++ head/sys/netinet6/in6_src.c Wed Jul 30 15:08:12 2014 (r269306) @@ -444,6 +444,12 @@ in6_selectsrc(struct sockaddr_in6 *dstso REPLACE(8); /* + * Rule 9: prefer address with better virtual status. + */ + if (ifa_preferred(&ia_best->ia_ifa, &ia->ia_ifa)) + REPLACE(9); + + /* * Rule 14: Use longest matching prefix. * Note: in the address selection draft, this rule is * documented as "Rule 8". However, since it is also From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 15:43:18 2014 Return-Path: Delivered-To: svn-src-all@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 803DFE9C; Wed, 30 Jul 2014 15:43: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8E32068; Wed, 30 Jul 2014 15:43:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UFhIc9087985; Wed, 30 Jul 2014 15:43:18 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UFhI8p087984; Wed, 30 Jul 2014 15:43:18 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407301543.s6UFhI8p087984@svn.freebsd.org> From: Ed Maste Date: Wed, 30 Jul 2014 15:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269307 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 15:43:18 -0000 Author: emaste Date: Wed Jul 30 15:43:17 2014 New Revision: 269307 URL: http://svnweb.freebsd.org/changeset/base/269307 Log: files.mips: the kbd driver is used by vt(4) too Sponsored by: DARPA, AFRL Modified: head/sys/conf/files.mips Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Wed Jul 30 15:08:12 2014 (r269306) +++ head/sys/conf/files.mips Wed Jul 30 15:43:17 2014 (r269307) @@ -68,7 +68,7 @@ dev/cfe/cfe_env.c optional cfe_env # syscons support dev/fb/fb.c optional sc -dev/kbd/kbd.c optional sc +dev/kbd/kbd.c optional sc | vt dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 16:08:16 2014 Return-Path: Delivered-To: svn-src-all@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 C1BCD519; Wed, 30 Jul 2014 16:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF866229D; Wed, 30 Jul 2014 16:08:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UG8GBq097898; Wed, 30 Jul 2014 16:08:16 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UG8GcW097896; Wed, 30 Jul 2014 16:08:16 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407301608.s6UG8GcW097896@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 30 Jul 2014 16:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269308 - head/lib/libstand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 16:08:16 -0000 Author: marcel Date: Wed Jul 30 16:08:16 2014 New Revision: 269308 URL: http://svnweb.freebsd.org/changeset/base/269308 Log: Provide a means for loaders to control which file system to use. This to counteract the default behaviour of always trying each and every file system until one succeeds, or the open fails. The problem with the loader is that we've implemented features based on this behavior. The handling of compressed files is a good example of this. However, it is in general highly undesirable to not have a one-time probe (or taste in the geom lingo), followed by something similar to a mount whenever we (first) read from a device. Everytime we go to the same device, we can reasonably assume it (still) has the same file system. For file systems that need to do far more that a trivial read of a super block, not having something similar to a mount operation is disastrous from a performance (and thus usability) perspective. But, again, since we've implemented features based on this stateless approach, things can get complicated quickly if and when we want to change this. And yet, we sometimes do need stateful behaviour. For this reason, this change simply introduces exclusive_file_system. When set to the fsops of the file system to use, the open call will only try this file system. Setting it to NULL restores the default behaviour. It's a low-cost (low-brow?) approach to provide enough control without re-implementing the guts of the loader. A good example of when this is useful is when we're trying to load files out of a container (say, a software packaga) that itself lives on a file system or is fetched over the network. While opening the container can be done in the normal stateless manner, once it is opened, subsequent opens should only consider the container. Obtained from: Juniper Networks, Inc. Modified: head/lib/libstand/open.c head/lib/libstand/stand.h Modified: head/lib/libstand/open.c ============================================================================== --- head/lib/libstand/open.c Wed Jul 30 15:43:17 2014 (r269307) +++ head/lib/libstand/open.c Wed Jul 30 16:08:16 2014 (r269308) @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); #include "stand.h" +struct fs_ops *exclusive_file_system; + struct open_file files[SOPEN_MAX]; static int @@ -89,6 +91,7 @@ o_rainit(struct open_file *f) int open(const char *fname, int mode) { + struct fs_ops *fs; struct open_file *f; int fd, i, error, besterror; const char *file; @@ -105,6 +108,15 @@ open(const char *fname, int mode) f->f_offset = 0; f->f_devdata = NULL; file = (char *)0; + + if (exclusive_file_system != NULL) { + fs = exclusive_file_system; + error = (fs->fo_open)(fname, f); + if (error == 0) + goto ok; + goto fail; + } + error = devopen(f, fname, &file); if (error || (((f->f_flags & F_NODEV) == 0) && f->f_dev == (struct devsw *)0)) @@ -120,20 +132,17 @@ open(const char *fname, int mode) /* pass file name to the different filesystem open routines */ besterror = ENOENT; for (i = 0; file_system[i] != NULL; i++) { - - error = ((*file_system[i]).fo_open)(file, f); - if (error == 0) { - - f->f_ops = file_system[i]; - o_rainit(f); - return (fd); - } + fs = file_system[i]; + error = (fs->fo_open)(file, f); + if (error == 0) + goto ok; if (error != EINVAL) besterror = error; } error = besterror; - if ((f->f_flags & F_NODEV) == 0) + fail: + if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL) f->f_dev->dv_close(f); if (error) devclose(f); @@ -142,4 +151,9 @@ open(const char *fname, int mode) f->f_flags = 0; errno = error; return (-1); + + ok: + f->f_ops = fs; + o_rainit(f); + return (fd); } Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Wed Jul 30 15:43:17 2014 (r269307) +++ head/lib/libstand/stand.h Wed Jul 30 16:08:16 2014 (r269308) @@ -364,6 +364,7 @@ extern int devopen(struct open_file *, extern int devclose(struct open_file *f); extern void panic(const char *, ...) __dead2 __printflike(1, 2); extern struct fs_ops *file_system[]; +extern struct fs_ops *exclusive_file_system; extern struct devsw *devsw[]; /* From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 17:19:12 2014 Return-Path: Delivered-To: svn-src-all@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 776289C5; Wed, 30 Jul 2014 17:19: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65B622A91; Wed, 30 Jul 2014 17:19:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UHJCYS030534; Wed, 30 Jul 2014 17:19:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UHJCTe030533; Wed, 30 Jul 2014 17:19:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407301719.s6UHJCTe030533@svn.freebsd.org> From: Xin LI Date: Wed, 30 Jul 2014 17:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269309 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 17:19:12 -0000 Author: delphij Date: Wed Jul 30 17:19:11 2014 New Revision: 269309 URL: http://svnweb.freebsd.org/changeset/base/269309 Log: Follow up r269179 and remove the libsbuf.so.7 library. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jul 30 16:08:16 2014 (r269308) +++ head/ObsoleteFiles.inc Wed Jul 30 17:19:11 2014 (r269309) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20140728: libsbuf restored to old version. +OLD_LIBS+=lib/libsbuf.so.7 # 20140728: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 17:58:18 2014 Return-Path: Delivered-To: svn-src-all@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 6CC3EC17; Wed, 30 Jul 2014 17:58: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59D362053; Wed, 30 Jul 2014 17:58:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UHwISC048531; Wed, 30 Jul 2014 17:58:18 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UHwHII048526; Wed, 30 Jul 2014 17:58:17 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201407301758.s6UHwHII048526@svn.freebsd.org> From: Steven Hartland Date: Wed, 30 Jul 2014 17:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269314 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 17:58:18 -0000 Author: smh Date: Wed Jul 30 17:58:17 2014 New Revision: 269314 URL: http://svnweb.freebsd.org/changeset/base/269314 Log: Bring in LSI's phase16 - phase18 changes * Implements Start Stop Unit for SATA direct-attach devices in IR mode to avoid data corruption. * Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT and CAM_TID_INVALID Obtained from: LSI MFC after: 2 weeks Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mps_sas.h head/sys/dev/mps/mps_sas_lsi.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Wed Jul 30 17:57:36 2014 (r269313) +++ head/sys/dev/mps/mps.c Wed Jul 30 17:58:17 2014 (r269314) @@ -140,6 +140,7 @@ mps_diag_reset(struct mps_softc *sc,int { uint32_t reg; int i, error, tries = 0; + uint8_t first_wait_done = FALSE; mps_dprint(sc, MPS_TRACE, "%s\n", __func__); @@ -182,15 +183,32 @@ mps_diag_reset(struct mps_softc *sc,int /* Wait up to 300 seconds in 50ms intervals */ error = ETIMEDOUT; - for (i = 0; i < 60000; i++) { - /* wait 50 msec */ - if (mtx_owned(&sc->mps_mtx) && sleep_flag == CAN_SLEEP) - msleep(&sc->msleep_fake_chan, &sc->mps_mtx, 0, - "mpsdiag", hz/20); - else if (sleep_flag == CAN_SLEEP) - pause("mpsdiag", hz/20); - else - DELAY(50 * 1000); + for (i = 0; i < 6000; i++) { + /* + * Wait 50 msec. If this is the first time through, wait 256 + * msec to satisfy Diag Reset timing requirements. + */ + if (first_wait_done) { + if (mtx_owned(&sc->mps_mtx) && sleep_flag == CAN_SLEEP) + msleep(&sc->msleep_fake_chan, &sc->mps_mtx, 0, + "mpsdiag", hz/20); + else if (sleep_flag == CAN_SLEEP) + pause("mpsdiag", hz/20); + else + DELAY(50 * 1000); + } else { + DELAY(256 * 1000); + first_wait_done = TRUE; + } + /* + * Check for the RESET_ADAPTER bit to be cleared first, then + * wait for the RESET state to be cleared, which takes a little + * longer. + */ + reg = mps_regread(sc, MPI2_HOST_DIAGNOSTIC_OFFSET); + if (reg & MPI2_DIAG_RESET_ADAPTER) { + continue; + } reg = mps_regread(sc, MPI2_DOORBELL_OFFSET); if ((reg & MPI2_IOC_STATE_MASK) != MPI2_IOC_STATE_RESET) { error = 0; @@ -236,7 +254,7 @@ mps_transition_ready(struct mps_softc *s sleep_flags = (sc->mps_flags & MPS_FLAGS_ATTACH_DONE) ? CAN_SLEEP:NO_SLEEP; error = 0; - while (tries++ < 5) { + while (tries++ < 1200) { reg = mps_regread(sc, MPI2_DOORBELL_OFFSET); mps_dprint(sc, MPS_INIT, "Doorbell= 0x%x\n", reg); @@ -656,6 +674,9 @@ int mps_reinit(struct mps_softc *sc) { int error; + struct mpssas_softc *sassc; + + sassc = sc->sassc; MPS_FUNCTRACE(sc); @@ -736,6 +757,8 @@ mps_reinit(struct mps_softc *sc) mps_dprint(sc, MPS_INFO, "%s finished sc %p post %u free %u\n", __func__, sc, sc->replypostindex, sc->replyfreeindex); + mpssas_release_simq_reinit(sassc); + return 0; } @@ -2510,6 +2533,7 @@ int mps_request_polled(struct mps_softc *sc, struct mps_command *cm) { int error, timeout = 0, rc; + struct timeval cur_time, start_time; error = 0; @@ -2517,22 +2541,33 @@ mps_request_polled(struct mps_softc *sc, cm->cm_complete = NULL; mps_map_command(sc, cm); + getmicrotime(&start_time); while ((cm->cm_flags & MPS_CM_FLAGS_COMPLETE) == 0) { mps_intr_locked(sc); - DELAY(50 * 1000); - if (timeout++ > 1000) { + if (mtx_owned(&sc->mps_mtx)) + msleep(&sc->msleep_fake_chan, &sc->mps_mtx, 0, + "mpspoll", hz/20); + else + pause("mpsdiag", hz/20); + + /* + * Check for real-time timeout and fail if more than 60 seconds. + */ + getmicrotime(&cur_time); + timeout = cur_time.tv_sec - start_time.tv_sec; + if (timeout > 60) { mps_dprint(sc, MPS_FAULT, "polling failed\n"); error = ETIMEDOUT; break; } } - + if (error) { mps_dprint(sc, MPS_FAULT, "Calling Reinit from %s\n", __func__); rc = mps_reinit(sc); - mps_dprint(sc, MPS_FAULT, "Reinit %s\n", - (rc == 0) ? "success" : "failed"); + mps_dprint(sc, MPS_FAULT, "Reinit %s\n", (rc == 0) ? "success" : + "failed"); } return (error); Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Wed Jul 30 17:57:36 2014 (r269313) +++ head/sys/dev/mps/mps_sas.c Wed Jul 30 17:58:17 2014 (r269314) @@ -191,6 +191,16 @@ mpssas_startup_increment(struct mpssas_s } void +mpssas_release_simq_reinit(struct mpssas_softc *sassc) +{ + if (sassc->flags & MPSSAS_QUEUE_FROZEN) { + sassc->flags &= ~MPSSAS_QUEUE_FROZEN; + xpt_release_simq(sassc->sim, 1); + mps_dprint(sassc->sc, MPS_INFO, "Unfreezing SIM queue\n"); + } +} + +void mpssas_startup_decrement(struct mpssas_softc *sassc) { MPS_FUNCTRACE(sassc->sc); @@ -1003,7 +1013,7 @@ mpssas_action(struct cam_sim *sim, union cts->ccb_h.target_id)); targ = &sassc->targets[cts->ccb_h.target_id]; if (targ->handle == 0x0) { - mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); break; } @@ -1120,6 +1130,14 @@ mpssas_complete_all_commands(struct mps_ wakeup(cm); completed = 1; } + + if (cm->cm_sc->io_cmds_active != 0) { + cm->cm_sc->io_cmds_active--; + } else { + mps_dprint(cm->cm_sc, MPS_INFO, "Warning: " + "io_cmds_active is out of sync - resynching to " + "0\n"); + } if ((completed == 0) && (cm->cm_state != MPS_CM_STATE_FREE)) { /* this should never happen, but if it does, log */ @@ -1647,14 +1665,14 @@ mpssas_action_scsiio(struct mpssas_softc if (targ->handle == 0x0) { mps_dprint(sc, MPS_ERROR, "%s NULL handle for target %u\n", __func__, csio->ccb_h.target_id); - mpssas_set_ccbstatus(ccb, CAM_SEL_TIMEOUT); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); xpt_done(ccb); return; } if (targ->flags & MPS_TARGET_FLAGS_RAID_COMPONENT) { mps_dprint(sc, MPS_ERROR, "%s Raid component no SCSI IO " "supported %u\n", __func__, csio->ccb_h.target_id); - mpssas_set_ccbstatus(ccb, CAM_TID_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); xpt_done(ccb); return; } @@ -1685,13 +1703,16 @@ mpssas_action_scsiio(struct mpssas_softc if ((sc->mps_flags & MPS_FLAGS_SHUTDOWN) != 0) { mps_dprint(sc, MPS_INFO, "%s shutting down\n", __func__); - mpssas_set_ccbstatus(ccb, CAM_TID_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); xpt_done(ccb); return; } cm = mps_alloc_command(sc); - if (cm == NULL) { + if (cm == NULL || (sc->mps_flags & MPS_FLAGS_DIAGRESET)) { + if (cm != NULL) { + mps_free_command(sc, cm); + } if ((sassc->flags & MPSSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPSSAS_QUEUE_FROZEN; @@ -2170,6 +2191,18 @@ mpssas_scsiio_complete(struct mps_softc } } + /* + * If this is a Start Stop Unit command and it was issued by the driver + * during shutdown, decrement the refcount to account for all of the + * commands that were sent. All SSU commands should be completed before + * shutdown completes, meaning SSU_refcount will be 0 after SSU_started + * is TRUE. + */ + if (sc->SSU_started && (csio->cdb_io.cdb_bytes[0] == START_STOP_UNIT)) { + mps_dprint(sc, MPS_INFO, "Decrementing SSU count.\n"); + sc->SSU_refcount--; + } + /* Take the fast path to completion */ if (cm->cm_reply == NULL) { if (mpssas_get_ccbstatus(ccb) == CAM_REQ_INPROG) { @@ -2999,7 +3032,7 @@ mpssas_action_smpio(struct mpssas_softc mps_dprint(sc, MPS_ERROR, "%s: handle %d does not have a valid " "parent handle!\n", __func__, targ->handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } #ifdef OLD_MPS_PROBE @@ -3010,7 +3043,7 @@ mpssas_action_smpio(struct mpssas_softc mps_dprint(sc, MPS_ERROR, "%s: handle %d does not have a valid " "parent target!\n", __func__, targ->handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } @@ -3020,7 +3053,7 @@ mpssas_action_smpio(struct mpssas_softc "%s: handle %d parent %d does not " "have an SMP target!\n", __func__, targ->handle, parent_target->handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } @@ -3033,7 +3066,7 @@ mpssas_action_smpio(struct mpssas_softc "%s: handle %d parent %d does not " "have an SMP target!\n", __func__, targ->handle, targ->parent_handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } @@ -3042,7 +3075,7 @@ mpssas_action_smpio(struct mpssas_softc "%s: handle %d parent handle %d does " "not have a valid SAS address!\n", __func__, targ->handle, targ->parent_handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } @@ -3055,7 +3088,7 @@ mpssas_action_smpio(struct mpssas_softc mps_dprint(sc, MPS_INFO, "%s: unable to find SAS address for handle %d\n", __func__, targ->handle); - mpssas_set_ccbstatus(ccb, CAM_REQ_INVALID); + mpssas_set_ccbstatus(ccb, CAM_DEV_NOT_THERE); goto bailout; } mpssas_send_smpcmd(sassc, ccb, sasaddr); @@ -3366,6 +3399,20 @@ mpssas_check_eedp(struct mps_softc *sc, } xpt_path_string(local_path, path_str, sizeof(path_str)); + + /* + * If this is a SATA direct-access end device, + * mark it so that a SCSI StartStopUnit command + * will be sent to it when the driver is being + * shutdown. + */ + if ((cgd.inq_data.device == T_DIRECT) && + (target->devinfo & MPI2_SAS_DEVICE_INFO_SATA_DEVICE) && + ((target->devinfo & MPI2_SAS_DEVICE_INFO_MASK_DEVICE_TYPE) == + MPI2_SAS_DEVICE_INFO_END_DEVICE)) { + lun->stop_at_shutdown = TRUE; + } + mps_dprint(sc, MPS_INFO, "Sending read cap: path %s handle %d\n", path_str, target->handle); Modified: head/sys/dev/mps/mps_sas.h ============================================================================== --- head/sys/dev/mps/mps_sas.h Wed Jul 30 17:57:36 2014 (r269313) +++ head/sys/dev/mps/mps_sas.h Wed Jul 30 17:58:17 2014 (r269314) @@ -35,6 +35,7 @@ struct mpssas_lun { lun_id_t lun_id; uint8_t eedp_formatted; uint32_t eedp_block_size; + uint8_t stop_at_shutdown; }; struct mpssas_target { Modified: head/sys/dev/mps/mps_sas_lsi.c ============================================================================== --- head/sys/dev/mps/mps_sas_lsi.c Wed Jul 30 17:57:36 2014 (r269313) +++ head/sys/dev/mps/mps_sas_lsi.c Wed Jul 30 17:58:17 2014 (r269314) @@ -120,6 +120,9 @@ int mpssas_get_sas_address_for_sata_disk u64 *sas_address, u16 handle, u32 device_info); static int mpssas_volume_add(struct mps_softc *sc, u16 handle); +static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc); +static void mpssas_stop_unit_done(struct cam_periph *periph, + union ccb *done_ccb); void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data, @@ -910,6 +913,138 @@ out: } /** + * mpssas_SSU_to_SATA_devices + * @sc: per adapter object + * + * Looks through the target list and issues a StartStopUnit SCSI command to each + * SATA direct-access device. This helps to ensure that data corruption is + * avoided when the system is being shut down. This must be called after the IR + * System Shutdown RAID Action is sent if in IR mode. + * + * Return nothing. + */ +static void +mpssas_SSU_to_SATA_devices(struct mps_softc *sc) +{ + struct mpssas_softc *sassc = sc->sassc; + union ccb *ccb; + path_id_t pathid = cam_sim_path(sassc->sim); + target_id_t targetid; + struct mpssas_target *target; + struct mpssas_lun *lun; + char path_str[64]; + struct timeval cur_time, start_time; + + /* + * For each LUN of each target, issue a StartStopUnit command to stop + * the device. + */ + sc->SSU_started = TRUE; + sc->SSU_refcount = 0; + for (targetid = 0; targetid < sc->facts->MaxTargets; targetid++) { + target = &sassc->targets[targetid]; + if (target->handle == 0x0) { + continue; + } + + SLIST_FOREACH(lun, &target->luns, lun_link) { + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + mps_dprint(sc, MPS_FAULT, "Unable to alloc CCB " + "to stop unit.\n"); + return; + } + + /* + * The stop_at_shutdown flag will be set if this LUN is + * a SATA direct-access end device. + */ + if (lun->stop_at_shutdown) { + if (xpt_create_path(&ccb->ccb_h.path, + xpt_periph, pathid, targetid, + lun->lun_id) != CAM_REQ_CMP) { + mps_dprint(sc, MPS_FAULT, "Unable to " + "create LUN path to stop unit.\n"); + xpt_free_ccb(ccb); + return; + } + xpt_path_string(ccb->ccb_h.path, path_str, + sizeof(path_str)); + + mps_dprint(sc, MPS_INFO, "Sending StopUnit: " + "path %s handle %d\n", path_str, + target->handle); + + /* + * Issue a START STOP UNIT command for the LUN. + * Increment the SSU counter to be used to + * count the number of required replies. + */ + mps_dprint(sc, MPS_INFO, "Incrementing SSU " + "count\n"); + sc->SSU_refcount++; + ccb->ccb_h.target_id = + xpt_path_target_id(ccb->ccb_h.path); + ccb->ccb_h.target_lun = lun->lun_id; + ccb->ccb_h.ppriv_ptr1 = sassc; + scsi_start_stop(&ccb->csio, + /*retries*/0, + mpssas_stop_unit_done, + MSG_SIMPLE_Q_TAG, + /*start*/FALSE, + /*load/eject*/0, + /*immediate*/FALSE, + MPS_SENSE_LEN, + /*timeout*/10000); + xpt_action(ccb); + } + } + } + + /* + * Wait until all of the SSU commands have completed or time has + * expired (60 seconds). pause for 100ms each time through. If any + * command times out, the target will be reset in the SCSI command + * timeout routine. + */ + getmicrotime(&start_time); + while (sc->SSU_refcount) { + pause("mpswait", hz/10); + + getmicrotime(&cur_time); + if ((cur_time.tv_sec - start_time.tv_sec) > 60) { + mps_dprint(sc, MPS_FAULT, "Time has expired waiting " + "for SSU commands to complete.\n"); + break; + } + } +} + +static void +mpssas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb) +{ + struct mpssas_softc *sassc; + char path_str[64]; + + sassc = (struct mpssas_softc *)done_ccb->ccb_h.ppriv_ptr1; + + xpt_path_string(done_ccb->ccb_h.path, path_str, sizeof(path_str)); + mps_dprint(sassc->sc, MPS_INFO, "Completing stop unit for %s\n", + path_str); + + if (done_ccb == NULL) + return; + + /* + * Nothing more to do except free the CCB and path. If the command + * timed out, an abort reset, then target reset will be issued during + * the SCSI Command process. + */ + xpt_free_path(done_ccb->ccb_h.path); + xpt_free_ccb(done_ccb); +} + +/** * mpssas_ir_shutdown - IR shutdown notification * @sc: per adapter object * @@ -933,7 +1068,7 @@ mpssas_ir_shutdown(struct mps_softc *sc) /* is IR firmware build loaded? */ if (!sc->ir_firmware) - return; + goto out; /* are there any volumes? Look at IR target IDs. */ // TODO-later, this should be looked up in the RAID config structure @@ -958,11 +1093,11 @@ mpssas_ir_shutdown(struct mps_softc *sc) } if (!found_volume) - return; + goto out; if ((cm = mps_alloc_command(sc)) == NULL) { printf("%s: command alloc failed\n", __func__); - return; + goto out; } action = (MPI2_RAID_ACTION_REQUEST *)cm->cm_req; @@ -978,4 +1113,7 @@ mpssas_ir_shutdown(struct mps_softc *sc) */ if (cm) mps_free_command(sc, cm); + +out: + mpssas_SSU_to_SATA_devices(sc); } Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Wed Jul 30 17:57:36 2014 (r269313) +++ head/sys/dev/mps/mpsvar.h Wed Jul 30 17:58:17 2014 (r269314) @@ -32,7 +32,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "16.00.00.00-fbsd" +#define MPS_DRIVER_VERSION "18.00.00.00-fbsd" #define MPS_DB_MAX_WAIT 2500 @@ -417,6 +417,10 @@ struct mps_softc { char exclude_ids[80]; struct timeval lastfail; + + /* StartStopUnit command handling at shutdown */ + uint32_t SSU_refcount; + uint8_t SSU_started; }; struct mps_config_params { @@ -759,6 +763,7 @@ struct mpssas_target * mpssas_find_targe void mpssas_realloc_targets(struct mps_softc *sc, int maxtargets); struct mps_command * mpssas_alloc_tm(struct mps_softc *sc); void mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm); +void mpssas_release_simq_reinit(struct mpssas_softc *sassc); SYSCTL_DECL(_hw_mps); From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 18:21:08 2014 Return-Path: Delivered-To: svn-src-all@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 DF6DE2CA; Wed, 30 Jul 2014 18:21:07 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDBC22289; Wed, 30 Jul 2014 18:21:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UIL7JY059453; Wed, 30 Jul 2014 18:21:07 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UIL7O9059449; Wed, 30 Jul 2014 18:21:07 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201407301821.s6UIL7O9059449@svn.freebsd.org> From: Steven Hartland Date: Wed, 30 Jul 2014 18:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269316 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 18:21:08 -0000 Author: smh Date: Wed Jul 30 18:21:06 2014 New Revision: 269316 URL: http://svnweb.freebsd.org/changeset/base/269316 Log: Bring in LSI's phase19 changes * Removed unused mpssas_discovery_timeout function. * Don't alter mapping boundaries if not raid firmware. * Check free_busaddr instead of post_busaddr (diff minimisation really) MFC after: 2 weeks Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_mapping.c head/sys/dev/mps/mps_sas.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Wed Jul 30 17:59:37 2014 (r269315) +++ head/sys/dev/mps/mps.c Wed Jul 30 18:21:06 2014 (r269316) @@ -610,7 +610,7 @@ mps_iocfacts_free(struct mps_softc *sc) mps_dprint(sc, MPS_TRACE, "%s\n", __func__); - if (sc->post_busaddr != 0) + if (sc->free_busaddr != 0) bus_dmamap_unload(sc->queues_dmat, sc->queues_map); if (sc->free_queue != NULL) bus_dmamem_free(sc->queues_dmat, sc->free_queue, Modified: head/sys/dev/mps/mps_mapping.c ============================================================================== --- head/sys/dev/mps/mps_mapping.c Wed Jul 30 17:59:37 2014 (r269315) +++ head/sys/dev/mps/mps_mapping.c Wed Jul 30 18:21:06 2014 (r269316) @@ -336,12 +336,13 @@ _mapping_get_high_missing_mt_idx(struct end_idx = sc->max_devices; if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0) start_idx = 1; - if (sc->ir_firmware) + if (sc->ir_firmware) { _mapping_get_ir_maprange(sc, &start_idx_ir, &end_idx_ir); - if (start_idx == start_idx_ir) - start_idx = end_idx_ir + 1; - else - end_idx = start_idx_ir; + if (start_idx == start_idx_ir) + start_idx = end_idx_ir + 1; + else + end_idx = start_idx_ir; + } mt_entry = &sc->mapping_table[start_idx]; for (map_idx = start_idx; map_idx < end_idx; map_idx++, mt_entry++) { if (mt_entry->missing_count > high_missing_count) { Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Wed Jul 30 17:59:37 2014 (r269315) +++ head/sys/dev/mps/mps_sas.c Wed Jul 30 18:21:06 2014 (r269316) @@ -115,7 +115,6 @@ static uint8_t op_code_prot[256] = { MALLOC_DEFINE(M_MPSSAS, "MPSSAS", "MPS SAS memory"); -static void mpssas_discovery_timeout(void *data); static void mpssas_remove_device(struct mps_softc *, struct mps_command *); static void mpssas_remove_complete(struct mps_softc *, struct mps_command *); static void mpssas_action(struct cam_sim *sim, union ccb *ccb); @@ -910,46 +909,6 @@ mpssas_discovery_end(struct mpssas_softc } static void -mpssas_discovery_timeout(void *data) -{ - struct mpssas_softc *sassc = data; - struct mps_softc *sc; - - sc = sassc->sc; - MPS_FUNCTRACE(sc); - - mps_lock(sc); - mps_dprint(sc, MPS_INFO, - "Timeout waiting for discovery, interrupts may not be working!\n"); - sassc->flags &= ~MPSSAS_DISCOVERY_TIMEOUT_PENDING; - - /* Poll the hardware for events in case interrupts aren't working */ - mps_intr_locked(sc); - - mps_dprint(sassc->sc, MPS_INFO, - "Finished polling after discovery timeout at %d\n", ticks); - - if ((sassc->flags & MPSSAS_IN_DISCOVERY) == 0) { - mpssas_discovery_end(sassc); - } else { - if (sassc->discovery_timeouts < MPSSAS_MAX_DISCOVERY_TIMEOUTS) { - sassc->flags |= MPSSAS_DISCOVERY_TIMEOUT_PENDING; - callout_reset(&sassc->discovery_callout, - MPSSAS_DISCOVERY_TIMEOUT * hz, - mpssas_discovery_timeout, sassc); - sassc->discovery_timeouts++; - } else { - mps_dprint(sassc->sc, MPS_FAULT, - "Discovery timed out, continuing.\n"); - sassc->flags &= ~MPSSAS_IN_DISCOVERY; - mpssas_discovery_end(sassc); - } - } - - mps_unlock(sc); -} - -static void mpssas_action(struct cam_sim *sim, union ccb *ccb) { struct mpssas_softc *sassc; Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Wed Jul 30 17:59:37 2014 (r269315) +++ head/sys/dev/mps/mpsvar.h Wed Jul 30 18:21:06 2014 (r269316) @@ -32,7 +32,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "18.00.00.00-fbsd" +#define MPS_DRIVER_VERSION "19.00.00.00-fbsd" #define MPS_DB_MAX_WAIT 2500 From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 18:47:31 2014 Return-Path: Delivered-To: svn-src-all@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 A7DD1C0B; Wed, 30 Jul 2014 18:47: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BCDE2612; Wed, 30 Jul 2014 18:47:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6UIlVgn072758; Wed, 30 Jul 2014 18:47:31 GMT (envelope-from tychon@svn.freebsd.org) Received: (from tychon@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6UIlVNd072757; Wed, 30 Jul 2014 18:47:31 GMT (envelope-from tychon@svn.freebsd.org) Message-Id: <201407301847.s6UIlVNd072757@svn.freebsd.org> From: Tycho Nightingale Date: Wed, 30 Jul 2014 18:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269317 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 18:47:31 -0000 Author: tychon Date: Wed Jul 30 18:47:31 2014 New Revision: 269317 URL: http://svnweb.freebsd.org/changeset/base/269317 Log: Commands which encounter a fatal error shouldn't be marked as completed. Furthermore, provide an indication of the current command so it can be determined which one actually failed. Reviewed by: grehan Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Wed Jul 30 18:21:06 2014 (r269316) +++ head/usr.sbin/bhyve/pci_ahci.c Wed Jul 30 18:47:31 2014 (r269317) @@ -336,8 +336,9 @@ ahci_write_fis_d2h(struct ahci_port *p, fis[13] = cfis[13]; if (fis[2] & ATA_S_ERROR) p->is |= AHCI_P_IX_TFE; + else + p->ci &= ~(1 << slot); p->tfd = tfd; - p->ci &= ~(1 << slot); ahci_write_fis(p, FIS_TYPE_REGD2H, fis); } @@ -651,8 +652,8 @@ handle_identify(struct ahci_port *p, int write_prdt(p, slot, cfis, (void *)buf, sizeof(buf)); p->tfd = ATA_S_DSC | ATA_S_READY; p->is |= AHCI_P_IX_DP; + p->ci &= ~(1 << slot); } - p->ci &= ~(1 << slot); ahci_generate_intr(p->pr_sc); } @@ -694,8 +695,8 @@ handle_atapi_identify(struct ahci_port * write_prdt(p, slot, cfis, (void *)buf, sizeof(buf)); p->tfd = ATA_S_DSC | ATA_S_READY; p->is |= AHCI_P_IX_DHR; + p->ci &= ~(1 << slot); } - p->ci &= ~(1 << slot); ahci_generate_intr(p->pr_sc); } @@ -1298,7 +1299,6 @@ ahci_handle_cmd(struct ahci_port *p, int if (!p->atapi) { p->tfd = (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR; p->is |= AHCI_P_IX_TFE; - p->ci &= ~(1 << slot); ahci_generate_intr(p->pr_sc); } else handle_packet_cmd(p, slot, cfis); @@ -1307,7 +1307,6 @@ ahci_handle_cmd(struct ahci_port *p, int WPRINTF("Unsupported cmd:%02x\n", cfis[2]); p->tfd = (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR; p->is |= AHCI_P_IX_TFE; - p->ci &= ~(1 << slot); ahci_generate_intr(p->pr_sc); break; } @@ -1375,8 +1374,11 @@ ahci_handle_port(struct ahci_port *p) * are already in-flight. */ for (i = 0; (i < 32) && p->ci; i++) { - if ((p->ci & (1 << i)) && !(p->pending & (1 << i))) + if ((p->ci & (1 << i)) && !(p->pending & (1 << i))) { + p->cmd &= ~AHCI_P_CMD_CCS_MASK; + p->cmd |= i << AHCI_P_CMD_CCS_SHIFT; ahci_handle_slot(p, i); + } } } From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 18:59:04 2014 Return-Path: Delivered-To: svn-src-all@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 13348147; Wed, 30 Jul 2014 18:59:04 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5F72728; Wed, 30 Jul 2014 18:59:02 +0000 (UTC) Received: from [192.168.225.11] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s6UIwoKQ065644; Wed, 30 Jul 2014 20:58:53 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <53D9406A.3060101@FreeBSD.org> Date: Wed, 30 Jul 2014 20:58:50 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> In-Reply-To: <201407261810.s6QIAIIj049439@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 18:59:04 -0000 Hi Alan, On 26.07.14 20:10, Alan Cox wrote: > Author: alc > Date: Sat Jul 26 18:10:18 2014 > New Revision: 269134 > URL: http://svnweb.freebsd.org/changeset/base/269134 > > Log: > When unwiring a region of an address space, do not assume that the > underlying physical pages are mapped by the pmap. If, for example, the > application has performed an mprotect(..., PROT_NONE) on any part of the > wired region, then those pages will no longer be mapped by the pmap. > So, using the pmap to lookup the wired pages in order to unwire them > doesn't always work, and when it doesn't work wired pages are leaked. > > To avoid the leak, introduce and use a new function vm_object_unwire() > that locates the wired pages by traversing the object and its backing > objects. > > At the same time, switch from using pmap_change_wiring() to the recently > introduced function pmap_unwire() for unwiring the region's mappings. > pmap_unwire() is faster, because it operates a range of virtual addresses > rather than a single virtual page at a time. Moreover, by operating on > a range, it is superpage friendly. It doesn't waste time performing > unnecessary demotions. > > Reported by: markj > Reviewed by: kib > Tested by: pho, jmg (arm) > Sponsored by: EMC / Isilon Storage Division This commit brings my 32- and 64-bit PowerMac's into panic. Unfortunately I'm not able to give you a backtrace in the form of a textdump nor of a core dump. The only thing I have is this picture: http://people.freebsd.org/~andreast/r269134_panic.jpg Exactly this revision gives a panic and breaks the textdump/coredump facility. How can I help debugging? TIA, Andreas > > Modified: > head/sys/vm/vm_extern.h > head/sys/vm/vm_fault.c > head/sys/vm/vm_map.c > head/sys/vm/vm_object.c > head/sys/vm/vm_object.h > > Modified: head/sys/vm/vm_extern.h > ============================================================================== > --- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014 (r269133) > +++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014 (r269134) > @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse > int fault_flags, vm_page_t *m_hold); > int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, > vm_prot_t prot, vm_page_t *ma, int max_count); > -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); > int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); > int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int); > void vm_waitproc(struct proc *); > > Modified: head/sys/vm/vm_fault.c > ============================================================================== > --- head/sys/vm/vm_fault.c Sat Jul 26 17:59:25 2014 (r269133) > +++ head/sys/vm/vm_fault.c Sat Jul 26 18:10:18 2014 (r269134) > @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); > #define PFFOR 4 > > static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *); > +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); > > #define VM_FAULT_READ_BEHIND 8 > #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) > @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t > * > * Unwire a range of virtual addresses in a map. > */ > -void > +static void > vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, > boolean_t fictitious) > { > > Modified: head/sys/vm/vm_map.c > ============================================================================== > --- head/sys/vm/vm_map.c Sat Jul 26 17:59:25 2014 (r269133) > +++ head/sys/vm/vm_map.c Sat Jul 26 18:10:18 2014 (r269134) > @@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p > vm_offset_t max); > static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t system_map); > static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); > +static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); > #ifdef INVARIANTS > static void vm_map_zdtor(void *mem, int size, void *arg); > static void vmspace_zdtor(void *mem, int size, void *arg); > @@ -2393,16 +2394,10 @@ done: > (entry->eflags & MAP_ENTRY_USER_WIRED))) { > if (user_unwire) > entry->eflags &= ~MAP_ENTRY_USER_WIRED; > - entry->wired_count--; > - if (entry->wired_count == 0) { > - /* > - * Retain the map lock. > - */ > - vm_fault_unwire(map, entry->start, entry->end, > - entry->object.vm_object != NULL && > - (entry->object.vm_object->flags & > - OBJ_FICTITIOUS) != 0); > - } > + if (entry->wired_count == 1) > + vm_map_entry_unwire(map, entry); > + else > + entry->wired_count--; > } > KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, > ("vm_map_unwire: in-transition flag missing %p", entry)); > @@ -2635,19 +2630,12 @@ done: > * unnecessary. > */ > entry->wired_count = 0; > - } else { > - if (!user_wire || > - (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) > + } else if (!user_wire || > + (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { > + if (entry->wired_count == 1) > + vm_map_entry_unwire(map, entry); > + else > entry->wired_count--; > - if (entry->wired_count == 0) { > - /* > - * Retain the map lock. > - */ > - vm_fault_unwire(map, entry->start, entry->end, > - entry->object.vm_object != NULL && > - (entry->object.vm_object->flags & > - OBJ_FICTITIOUS) != 0); > - } > } > next_entry_done: > KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, > @@ -2783,9 +2771,13 @@ vm_map_sync( > static void > vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) > { > - vm_fault_unwire(map, entry->start, entry->end, > - entry->object.vm_object != NULL && > - (entry->object.vm_object->flags & OBJ_FICTITIOUS) != 0); > + > + VM_MAP_ASSERT_LOCKED(map); > + KASSERT(entry->wired_count > 0, > + ("vm_map_entry_unwire: entry %p isn't wired", entry)); > + pmap_unwire(map->pmap, entry->start, entry->end); > + vm_object_unwire(entry->object.vm_object, entry->offset, entry->end - > + entry->start, PQ_ACTIVE); > entry->wired_count = 0; > } > > > Modified: head/sys/vm/vm_object.c > ============================================================================== > --- head/sys/vm/vm_object.c Sat Jul 26 17:59:25 2014 (r269133) > +++ head/sys/vm/vm_object.c Sat Jul 26 18:10:18 2014 (r269134) > @@ -2202,6 +2202,78 @@ vm_object_set_writeable_dirty(vm_object_ > vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); > } > > +/* > + * vm_object_unwire: > + * > + * For each page offset within the specified range of the given object, > + * find the highest-level page in the shadow chain and unwire it. A page > + * must exist at every page offset, and the highest-level page must be > + * wired. > + */ > +void > +vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t length, > + uint8_t queue) > +{ > + vm_object_t tobject; > + vm_page_t m, tm; > + vm_pindex_t end_pindex, pindex, tpindex; > + int depth, locked_depth; > + > + KASSERT((offset & PAGE_MASK) == 0, > + ("vm_object_unwire: offset is not page aligned")); > + KASSERT((length & PAGE_MASK) == 0, > + ("vm_object_unwire: length is not a multiple of PAGE_SIZE")); > + /* The wired count of a fictitious page never changes. */ > + if ((object->flags & OBJ_FICTITIOUS) != 0) > + return; > + pindex = OFF_TO_IDX(offset); > + end_pindex = pindex + atop(length); > + locked_depth = 1; > + VM_OBJECT_RLOCK(object); > + m = vm_page_find_least(object, pindex); > + while (pindex < end_pindex) { > + if (m == NULL || pindex < m->pindex) { > + /* > + * The first object in the shadow chain doesn't > + * contain a page at the current index. Therefore, > + * the page must exist in a backing object. > + */ > + tobject = object; > + tpindex = pindex; > + depth = 0; > + do { > + tpindex += > + OFF_TO_IDX(tobject->backing_object_offset); > + tobject = tobject->backing_object; > + KASSERT(tobject != NULL, > + ("vm_object_unwire: missing page")); > + if ((tobject->flags & OBJ_FICTITIOUS) != 0) > + goto next_page; > + depth++; > + if (depth == locked_depth) { > + locked_depth++; > + VM_OBJECT_RLOCK(tobject); > + } > + } while ((tm = vm_page_lookup(tobject, tpindex)) == > + NULL); > + } else { > + tm = m; > + m = TAILQ_NEXT(m, listq); > + } > + vm_page_lock(tm); > + vm_page_unwire(tm, queue); > + vm_page_unlock(tm); > +next_page: > + pindex++; > + } > + /* Release the accumulated object locks. */ > + for (depth = 0; depth < locked_depth; depth++) { > + tobject = object->backing_object; > + VM_OBJECT_RUNLOCK(object); > + object = tobject; > + } > +} > + > #include "opt_ddb.h" > #ifdef DDB > #include > > Modified: head/sys/vm/vm_object.h > ============================================================================== > --- head/sys/vm/vm_object.h Sat Jul 26 17:59:25 2014 (r269133) > +++ head/sys/vm/vm_object.h Sat Jul 26 18:10:18 2014 (r269134) > @@ -291,6 +291,8 @@ void vm_object_shadow (vm_object_t *, vm > void vm_object_split(vm_map_entry_t); > boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t, > boolean_t); > +void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, > + vm_size_t length, uint8_t queue); > #endif /* _KERNEL */ > > #endif /* _VM_OBJECT_ */ > > > From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 19:41:02 2014 Return-Path: Delivered-To: svn-src-all@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 D77E71FD; Wed, 30 Jul 2014 19:41:02 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 997712B79; Wed, 30 Jul 2014 19:41:01 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id s6UJBnN2030080; Wed, 30 Jul 2014 14:14:48 -0500 Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by pp2.rice.edu with ESMTP id 1necy9gq8r-1; Wed, 30 Jul 2014 14:14:47 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 549094601E2; Wed, 30 Jul 2014 14:14:47 -0500 (CDT) Message-ID: <53D94426.3010301@rice.edu> Date: Wed, 30 Jul 2014 14:14:46 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> In-Reply-To: <53D9406A.3060101@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407300225 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 19:41:03 -0000 On 07/30/2014 13:58, Andreas Tobler wrote: > Hi Alan, > > On 26.07.14 20:10, Alan Cox wrote: >> Author: alc >> Date: Sat Jul 26 18:10:18 2014 >> New Revision: 269134 >> URL: http://svnweb.freebsd.org/changeset/base/269134 >> >> Log: >> When unwiring a region of an address space, do not assume that the >> underlying physical pages are mapped by the pmap. If, for >> example, the >> application has performed an mprotect(..., PROT_NONE) on any part >> of the >> wired region, then those pages will no longer be mapped by the pmap. >> So, using the pmap to lookup the wired pages in order to unwire them >> doesn't always work, and when it doesn't work wired pages are leaked. >> >> To avoid the leak, introduce and use a new function >> vm_object_unwire() >> that locates the wired pages by traversing the object and its backing >> objects. >> >> At the same time, switch from using pmap_change_wiring() to the >> recently >> introduced function pmap_unwire() for unwiring the region's mappings. >> pmap_unwire() is faster, because it operates a range of virtual >> addresses >> rather than a single virtual page at a time. Moreover, by >> operating on >> a range, it is superpage friendly. It doesn't waste time performing >> unnecessary demotions. >> >> Reported by: markj >> Reviewed by: kib >> Tested by: pho, jmg (arm) >> Sponsored by: EMC / Isilon Storage Division > > This commit brings my 32- and 64-bit PowerMac's into panic. > Unfortunately I'm not able to give you a backtrace in the form of a > textdump nor of a core dump. > > The only thing I have is this picture: > > http://people.freebsd.org/~andreast/r269134_panic.jpg > > Exactly this revision gives a panic and breaks the textdump/coredump > facility. > > How can I help debugging? > For now, that's all I need to know. > >> >> Modified: >> head/sys/vm/vm_extern.h >> head/sys/vm/vm_fault.c >> head/sys/vm/vm_map.c >> head/sys/vm/vm_object.c >> head/sys/vm/vm_object.h >> >> Modified: head/sys/vm/vm_extern.h >> ============================================================================== >> >> --- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014 (r269134) >> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >> int fault_flags, vm_page_t *m_hold); >> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, >> vm_size_t len, >> vm_prot_t prot, vm_page_t *ma, int max_count); >> -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> int vm_forkproc(struct thread *, struct proc *, struct thread *, >> struct vmspace *, int); >> void vm_waitproc(struct proc *); >> >> Modified: head/sys/vm/vm_fault.c >> ============================================================================== >> >> --- head/sys/vm/vm_fault.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_fault.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); >> #define PFFOR 4 >> >> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t >> *, int *); >> +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, >> boolean_t); >> >> #define VM_FAULT_READ_BEHIND 8 >> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >> @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t >> * >> * Unwire a range of virtual addresses in a map. >> */ >> -void >> +static void >> vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >> boolean_t fictitious) >> { >> >> Modified: head/sys/vm/vm_map.c >> ============================================================================== >> >> --- head/sys/vm/vm_map.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_map.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p >> vm_offset_t max); >> static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t >> system_map); >> static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); >> +static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); >> #ifdef INVARIANTS >> static void vm_map_zdtor(void *mem, int size, void *arg); >> static void vmspace_zdtor(void *mem, int size, void *arg); >> @@ -2393,16 +2394,10 @@ done: >> (entry->eflags & MAP_ENTRY_USER_WIRED))) { >> if (user_unwire) >> entry->eflags &= ~MAP_ENTRY_USER_WIRED; >> - entry->wired_count--; >> - if (entry->wired_count == 0) { >> - /* >> - * Retain the map lock. >> - */ >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & >> - OBJ_FICTITIOUS) != 0); >> - } >> + if (entry->wired_count == 1) >> + vm_map_entry_unwire(map, entry); >> + else >> + entry->wired_count--; >> } >> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >> ("vm_map_unwire: in-transition flag missing %p", entry)); >> @@ -2635,19 +2630,12 @@ done: >> * unnecessary. >> */ >> entry->wired_count = 0; >> - } else { >> - if (!user_wire || >> - (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) >> + } else if (!user_wire || >> + (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { >> + if (entry->wired_count == 1) >> + vm_map_entry_unwire(map, entry); >> + else >> entry->wired_count--; >> - if (entry->wired_count == 0) { >> - /* >> - * Retain the map lock. >> - */ >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & >> - OBJ_FICTITIOUS) != 0); >> - } >> } >> next_entry_done: >> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >> @@ -2783,9 +2771,13 @@ vm_map_sync( >> static void >> vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) >> { >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & OBJ_FICTITIOUS) != 0); >> + >> + VM_MAP_ASSERT_LOCKED(map); >> + KASSERT(entry->wired_count > 0, >> + ("vm_map_entry_unwire: entry %p isn't wired", entry)); >> + pmap_unwire(map->pmap, entry->start, entry->end); >> + vm_object_unwire(entry->object.vm_object, entry->offset, >> entry->end - >> + entry->start, PQ_ACTIVE); >> entry->wired_count = 0; >> } >> >> >> Modified: head/sys/vm/vm_object.c >> ============================================================================== >> >> --- head/sys/vm/vm_object.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_object.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -2202,6 +2202,78 @@ vm_object_set_writeable_dirty(vm_object_ >> vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); >> } >> >> +/* >> + * vm_object_unwire: >> + * >> + * For each page offset within the specified range of the given >> object, >> + * find the highest-level page in the shadow chain and unwire >> it. A page >> + * must exist at every page offset, and the highest-level page >> must be >> + * wired. >> + */ >> +void >> +vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t >> length, >> + uint8_t queue) >> +{ >> + vm_object_t tobject; >> + vm_page_t m, tm; >> + vm_pindex_t end_pindex, pindex, tpindex; >> + int depth, locked_depth; >> + >> + KASSERT((offset & PAGE_MASK) == 0, >> + ("vm_object_unwire: offset is not page aligned")); >> + KASSERT((length & PAGE_MASK) == 0, >> + ("vm_object_unwire: length is not a multiple of PAGE_SIZE")); >> + /* The wired count of a fictitious page never changes. */ >> + if ((object->flags & OBJ_FICTITIOUS) != 0) >> + return; >> + pindex = OFF_TO_IDX(offset); >> + end_pindex = pindex + atop(length); >> + locked_depth = 1; >> + VM_OBJECT_RLOCK(object); >> + m = vm_page_find_least(object, pindex); >> + while (pindex < end_pindex) { >> + if (m == NULL || pindex < m->pindex) { >> + /* >> + * The first object in the shadow chain doesn't >> + * contain a page at the current index. Therefore, >> + * the page must exist in a backing object. >> + */ >> + tobject = object; >> + tpindex = pindex; >> + depth = 0; >> + do { >> + tpindex += >> + OFF_TO_IDX(tobject->backing_object_offset); >> + tobject = tobject->backing_object; >> + KASSERT(tobject != NULL, >> + ("vm_object_unwire: missing page")); >> + if ((tobject->flags & OBJ_FICTITIOUS) != 0) >> + goto next_page; >> + depth++; >> + if (depth == locked_depth) { >> + locked_depth++; >> + VM_OBJECT_RLOCK(tobject); >> + } >> + } while ((tm = vm_page_lookup(tobject, tpindex)) == >> + NULL); >> + } else { >> + tm = m; >> + m = TAILQ_NEXT(m, listq); >> + } >> + vm_page_lock(tm); >> + vm_page_unwire(tm, queue); >> + vm_page_unlock(tm); >> +next_page: >> + pindex++; >> + } >> + /* Release the accumulated object locks. */ >> + for (depth = 0; depth < locked_depth; depth++) { >> + tobject = object->backing_object; >> + VM_OBJECT_RUNLOCK(object); >> + object = tobject; >> + } >> +} >> + >> #include "opt_ddb.h" >> #ifdef DDB >> #include >> >> Modified: head/sys/vm/vm_object.h >> ============================================================================== >> >> --- head/sys/vm/vm_object.h Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_object.h Sat Jul 26 18:10:18 2014 (r269134) >> @@ -291,6 +291,8 @@ void vm_object_shadow (vm_object_t *, vm >> void vm_object_split(vm_map_entry_t); >> boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, >> boolean_t, >> boolean_t); >> +void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, >> + vm_size_t length, uint8_t queue); >> #endif /* _KERNEL */ >> >> #endif /* _VM_OBJECT_ */ >> >> >> > > From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 19:46:58 2014 Return-Path: Delivered-To: svn-src-all@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 55208525; Wed, 30 Jul 2014 19:46:58 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17AB02BBD; Wed, 30 Jul 2014 19:46:57 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id s6UJhsdW011789; Wed, 30 Jul 2014 14:46:57 -0500 Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by pp2.rice.edu with ESMTP id 1necy9gqvq-1; Wed, 30 Jul 2014 14:46:56 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id D35E74601D5; Wed, 30 Jul 2014 14:46:55 -0500 (CDT) Message-ID: <53D94BAF.8050102@rice.edu> Date: Wed, 30 Jul 2014 14:46:55 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> In-Reply-To: <53D9406A.3060101@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407300232 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 19:46:58 -0000 On 07/30/2014 13:58, Andreas Tobler wrote: > Hi Alan, > > On 26.07.14 20:10, Alan Cox wrote: >> Author: alc >> Date: Sat Jul 26 18:10:18 2014 >> New Revision: 269134 >> URL: http://svnweb.freebsd.org/changeset/base/269134 >> >> Log: >> When unwiring a region of an address space, do not assume that the >> underlying physical pages are mapped by the pmap. If, for >> example, the >> application has performed an mprotect(..., PROT_NONE) on any part >> of the >> wired region, then those pages will no longer be mapped by the pmap. >> So, using the pmap to lookup the wired pages in order to unwire them >> doesn't always work, and when it doesn't work wired pages are leaked. >> >> To avoid the leak, introduce and use a new function >> vm_object_unwire() >> that locates the wired pages by traversing the object and its backing >> objects. >> >> At the same time, switch from using pmap_change_wiring() to the >> recently >> introduced function pmap_unwire() for unwiring the region's mappings. >> pmap_unwire() is faster, because it operates a range of virtual >> addresses >> rather than a single virtual page at a time. Moreover, by >> operating on >> a range, it is superpage friendly. It doesn't waste time performing >> unnecessary demotions. >> >> Reported by: markj >> Reviewed by: kib >> Tested by: pho, jmg (arm) >> Sponsored by: EMC / Isilon Storage Division > > This commit brings my 32- and 64-bit PowerMac's into panic. > Unfortunately I'm not able to give you a backtrace in the form of a > textdump nor of a core dump. > > The only thing I have is this picture: > > http://people.freebsd.org/~andreast/r269134_panic.jpg > > Exactly this revision gives a panic and breaks the textdump/coredump > facility. > > How can I help debugging? > It appears to me that moea64_pvo_enter() had a pre-existing bug that got tickled by this change. Specifically, moea64_pvo_enter() doesn't set the PVO_WIRED flag when an unwired mapping already exists. It just returns with the mapping still in an unwired state. Consequently, when pmap_unwire() finally runs, it doesn't find a wired mapping. Try this: Index: powerpc/aim/mmu_oea64.c =================================================================== --- powerpc/aim/mmu_oea64.c (revision 269127) +++ powerpc/aim/mmu_oea64.c (working copy) @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | LPTE_PP)) - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { if (!(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID)) { /* Re-insert if spilled */ i = MOEA64_PTE_INSERT(mmu, ptegidx, >> >> Modified: >> head/sys/vm/vm_extern.h >> head/sys/vm/vm_fault.c >> head/sys/vm/vm_map.c >> head/sys/vm/vm_object.c >> head/sys/vm/vm_object.h >> >> Modified: head/sys/vm/vm_extern.h >> ============================================================================== >> >> --- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014 (r269134) >> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >> int fault_flags, vm_page_t *m_hold); >> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, >> vm_size_t len, >> vm_prot_t prot, vm_page_t *ma, int max_count); >> -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> int vm_forkproc(struct thread *, struct proc *, struct thread *, >> struct vmspace *, int); >> void vm_waitproc(struct proc *); >> >> Modified: head/sys/vm/vm_fault.c >> ============================================================================== >> >> --- head/sys/vm/vm_fault.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_fault.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); >> #define PFFOR 4 >> >> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t >> *, int *); >> +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, >> boolean_t); >> >> #define VM_FAULT_READ_BEHIND 8 >> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >> @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t >> * >> * Unwire a range of virtual addresses in a map. >> */ >> -void >> +static void >> vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >> boolean_t fictitious) >> { >> >> Modified: head/sys/vm/vm_map.c >> ============================================================================== >> >> --- head/sys/vm/vm_map.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_map.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p >> vm_offset_t max); >> static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t >> system_map); >> static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); >> +static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); >> #ifdef INVARIANTS >> static void vm_map_zdtor(void *mem, int size, void *arg); >> static void vmspace_zdtor(void *mem, int size, void *arg); >> @@ -2393,16 +2394,10 @@ done: >> (entry->eflags & MAP_ENTRY_USER_WIRED))) { >> if (user_unwire) >> entry->eflags &= ~MAP_ENTRY_USER_WIRED; >> - entry->wired_count--; >> - if (entry->wired_count == 0) { >> - /* >> - * Retain the map lock. >> - */ >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & >> - OBJ_FICTITIOUS) != 0); >> - } >> + if (entry->wired_count == 1) >> + vm_map_entry_unwire(map, entry); >> + else >> + entry->wired_count--; >> } >> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >> ("vm_map_unwire: in-transition flag missing %p", entry)); >> @@ -2635,19 +2630,12 @@ done: >> * unnecessary. >> */ >> entry->wired_count = 0; >> - } else { >> - if (!user_wire || >> - (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) >> + } else if (!user_wire || >> + (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { >> + if (entry->wired_count == 1) >> + vm_map_entry_unwire(map, entry); >> + else >> entry->wired_count--; >> - if (entry->wired_count == 0) { >> - /* >> - * Retain the map lock. >> - */ >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & >> - OBJ_FICTITIOUS) != 0); >> - } >> } >> next_entry_done: >> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >> @@ -2783,9 +2771,13 @@ vm_map_sync( >> static void >> vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) >> { >> - vm_fault_unwire(map, entry->start, entry->end, >> - entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & OBJ_FICTITIOUS) != 0); >> + >> + VM_MAP_ASSERT_LOCKED(map); >> + KASSERT(entry->wired_count > 0, >> + ("vm_map_entry_unwire: entry %p isn't wired", entry)); >> + pmap_unwire(map->pmap, entry->start, entry->end); >> + vm_object_unwire(entry->object.vm_object, entry->offset, >> entry->end - >> + entry->start, PQ_ACTIVE); >> entry->wired_count = 0; >> } >> >> >> Modified: head/sys/vm/vm_object.c >> ============================================================================== >> >> --- head/sys/vm/vm_object.c Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_object.c Sat Jul 26 18:10:18 2014 (r269134) >> @@ -2202,6 +2202,78 @@ vm_object_set_writeable_dirty(vm_object_ >> vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); >> } >> >> +/* >> + * vm_object_unwire: >> + * >> + * For each page offset within the specified range of the given >> object, >> + * find the highest-level page in the shadow chain and unwire >> it. A page >> + * must exist at every page offset, and the highest-level page >> must be >> + * wired. >> + */ >> +void >> +vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t >> length, >> + uint8_t queue) >> +{ >> + vm_object_t tobject; >> + vm_page_t m, tm; >> + vm_pindex_t end_pindex, pindex, tpindex; >> + int depth, locked_depth; >> + >> + KASSERT((offset & PAGE_MASK) == 0, >> + ("vm_object_unwire: offset is not page aligned")); >> + KASSERT((length & PAGE_MASK) == 0, >> + ("vm_object_unwire: length is not a multiple of PAGE_SIZE")); >> + /* The wired count of a fictitious page never changes. */ >> + if ((object->flags & OBJ_FICTITIOUS) != 0) >> + return; >> + pindex = OFF_TO_IDX(offset); >> + end_pindex = pindex + atop(length); >> + locked_depth = 1; >> + VM_OBJECT_RLOCK(object); >> + m = vm_page_find_least(object, pindex); >> + while (pindex < end_pindex) { >> + if (m == NULL || pindex < m->pindex) { >> + /* >> + * The first object in the shadow chain doesn't >> + * contain a page at the current index. Therefore, >> + * the page must exist in a backing object. >> + */ >> + tobject = object; >> + tpindex = pindex; >> + depth = 0; >> + do { >> + tpindex += >> + OFF_TO_IDX(tobject->backing_object_offset); >> + tobject = tobject->backing_object; >> + KASSERT(tobject != NULL, >> + ("vm_object_unwire: missing page")); >> + if ((tobject->flags & OBJ_FICTITIOUS) != 0) >> + goto next_page; >> + depth++; >> + if (depth == locked_depth) { >> + locked_depth++; >> + VM_OBJECT_RLOCK(tobject); >> + } >> + } while ((tm = vm_page_lookup(tobject, tpindex)) == >> + NULL); >> + } else { >> + tm = m; >> + m = TAILQ_NEXT(m, listq); >> + } >> + vm_page_lock(tm); >> + vm_page_unwire(tm, queue); >> + vm_page_unlock(tm); >> +next_page: >> + pindex++; >> + } >> + /* Release the accumulated object locks. */ >> + for (depth = 0; depth < locked_depth; depth++) { >> + tobject = object->backing_object; >> + VM_OBJECT_RUNLOCK(object); >> + object = tobject; >> + } >> +} >> + >> #include "opt_ddb.h" >> #ifdef DDB >> #include >> >> Modified: head/sys/vm/vm_object.h >> ============================================================================== >> >> --- head/sys/vm/vm_object.h Sat Jul 26 17:59:25 2014 (r269133) >> +++ head/sys/vm/vm_object.h Sat Jul 26 18:10:18 2014 (r269134) >> @@ -291,6 +291,8 @@ void vm_object_shadow (vm_object_t *, vm >> void vm_object_split(vm_map_entry_t); >> boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, >> boolean_t, >> boolean_t); >> +void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, >> + vm_size_t length, uint8_t queue); >> #endif /* _KERNEL */ >> >> #endif /* _VM_OBJECT_ */ >> >> >> > > From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 19:54:37 2014 Return-Path: Delivered-To: svn-src-all@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 C686A70F; Wed, 30 Jul 2014 19:54:37 +0000 (UTC) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88F672CF8; Wed, 30 Jul 2014 19:54:36 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id s6UJqTDE014387; Wed, 30 Jul 2014 14:54:29 -0500 Received: from mh1.mail.rice.edu (mh1.mail.rice.edu [128.42.201.20]) by pp1.rice.edu with ESMTP id 1ndwdn908n-1; Wed, 30 Jul 2014 14:54:28 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh1.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh1.mail.rice.edu (Postfix) with ESMTPSA id 366854601D5; Wed, 30 Jul 2014 14:54:28 -0500 (CDT) Message-ID: <53D94D73.3050808@rice.edu> Date: Wed, 30 Jul 2014 14:54:27 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> In-Reply-To: <53D94BAF.8050102@rice.edu> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407300234 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 19:54:38 -0000 On 07/30/2014 14:46, Alan Cox wrote: > On 07/30/2014 13:58, Andreas Tobler wrote: >> Hi Alan, >> >> On 26.07.14 20:10, Alan Cox wrote: >>> Author: alc >>> Date: Sat Jul 26 18:10:18 2014 >>> New Revision: 269134 >>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>> >>> Log: >>> When unwiring a region of an address space, do not assume that the >>> underlying physical pages are mapped by the pmap. If, for >>> example, the >>> application has performed an mprotect(..., PROT_NONE) on any part >>> of the >>> wired region, then those pages will no longer be mapped by the pmap. >>> So, using the pmap to lookup the wired pages in order to unwire them >>> doesn't always work, and when it doesn't work wired pages are leaked. >>> >>> To avoid the leak, introduce and use a new function >>> vm_object_unwire() >>> that locates the wired pages by traversing the object and its backing >>> objects. >>> >>> At the same time, switch from using pmap_change_wiring() to the >>> recently >>> introduced function pmap_unwire() for unwiring the region's mappings. >>> pmap_unwire() is faster, because it operates a range of virtual >>> addresses >>> rather than a single virtual page at a time. Moreover, by >>> operating on >>> a range, it is superpage friendly. It doesn't waste time performing >>> unnecessary demotions. >>> >>> Reported by: markj >>> Reviewed by: kib >>> Tested by: pho, jmg (arm) >>> Sponsored by: EMC / Isilon Storage Division >> This commit brings my 32- and 64-bit PowerMac's into panic. >> Unfortunately I'm not able to give you a backtrace in the form of a >> textdump nor of a core dump. >> >> The only thing I have is this picture: >> >> http://people.freebsd.org/~andreast/r269134_panic.jpg >> >> Exactly this revision gives a panic and breaks the textdump/coredump >> facility. >> >> How can I help debugging? >> > It appears to me that moea64_pvo_enter() had a pre-existing bug that got > tickled by this change. Specifically, moea64_pvo_enter() doesn't set > the PVO_WIRED flag when an unwired mapping already exists. It just > returns with the mapping still in an unwired state. Consequently, when > pmap_unwire() finally runs, it doesn't find a wired mapping. > > Try this: > > Index: powerpc/aim/mmu_oea64.c > =================================================================== > --- powerpc/aim/mmu_oea64.c (revision 269127) > +++ powerpc/aim/mmu_oea64.c (working copy) > @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t > if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { > if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && > (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | > LPTE_PP)) > - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { > + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && > + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { > if (!(pvo->pvo_pte.lpte.pte_hi & > LPTE_VALID)) { > /* Re-insert if spilled */ > i = MOEA64_PTE_INSERT(mmu, ptegidx, > The new conditional test needs to be inverted. Try this instead: Index: powerpc/aim/mmu_oea64.c =================================================================== --- powerpc/aim/mmu_oea64.c (revision 269127) +++ powerpc/aim/mmu_oea64.c (working copy) @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | LPTE_PP)) - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == 0) { if (!(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID)) { /* Re-insert if spilled */ i = MOEA64_PTE_INSERT(mmu, ptegidx, >>> Modified: >>> head/sys/vm/vm_extern.h >>> head/sys/vm/vm_fault.c >>> head/sys/vm/vm_map.c >>> head/sys/vm/vm_object.c >>> head/sys/vm/vm_object.h >>> >>> Modified: head/sys/vm/vm_extern.h >>> ============================================================================== >>> >>> --- head/sys/vm/vm_extern.h Sat Jul 26 17:59:25 2014 (r269133) >>> +++ head/sys/vm/vm_extern.h Sat Jul 26 18:10:18 2014 (r269134) >>> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >>> int fault_flags, vm_page_t *m_hold); >>> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, >>> vm_size_t len, >>> vm_prot_t prot, vm_page_t *ma, int max_count); >>> -void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >>> int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >>> int vm_forkproc(struct thread *, struct proc *, struct thread *, >>> struct vmspace *, int); >>> void vm_waitproc(struct proc *); >>> >>> Modified: head/sys/vm/vm_fault.c >>> ============================================================================== >>> >>> --- head/sys/vm/vm_fault.c Sat Jul 26 17:59:25 2014 (r269133) >>> +++ head/sys/vm/vm_fault.c Sat Jul 26 18:10:18 2014 (r269134) >>> @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); >>> #define PFFOR 4 >>> >>> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t >>> *, int *); >>> +static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, >>> boolean_t); >>> >>> #define VM_FAULT_READ_BEHIND 8 >>> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >>> @@ -1186,7 +1187,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t >>> * >>> * Unwire a range of virtual addresses in a map. >>> */ >>> -void >>> +static void >>> vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >>> boolean_t fictitious) >>> { >>> >>> Modified: head/sys/vm/vm_map.c >>> ============================================================================== >>> >>> --- head/sys/vm/vm_map.c Sat Jul 26 17:59:25 2014 (r269133) >>> +++ head/sys/vm/vm_map.c Sat Jul 26 18:10:18 2014 (r269134) >>> @@ -132,6 +132,7 @@ static void _vm_map_init(vm_map_t map, p >>> vm_offset_t max); >>> static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t >>> system_map); >>> static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); >>> +static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); >>> #ifdef INVARIANTS >>> static void vm_map_zdtor(void *mem, int size, void *arg); >>> static void vmspace_zdtor(void *mem, int size, void *arg); >>> @@ -2393,16 +2394,10 @@ done: >>> (entry->eflags & MAP_ENTRY_USER_WIRED))) { >>> if (user_unwire) >>> entry->eflags &= ~MAP_ENTRY_USER_WIRED; >>> - entry->wired_count--; >>> - if (entry->wired_count == 0) { >>> - /* >>> - * Retain the map lock. >>> - */ >>> - vm_fault_unwire(map, entry->start, entry->end, >>> - entry->object.vm_object != NULL && >>> - (entry->object.vm_object->flags & >>> - OBJ_FICTITIOUS) != 0); >>> - } >>> + if (entry->wired_count == 1) >>> + vm_map_entry_unwire(map, entry); >>> + else >>> + entry->wired_count--; >>> } >>> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >>> ("vm_map_unwire: in-transition flag missing %p", entry)); >>> @@ -2635,19 +2630,12 @@ done: >>> * unnecessary. >>> */ >>> entry->wired_count = 0; >>> - } else { >>> - if (!user_wire || >>> - (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) >>> + } else if (!user_wire || >>> + (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { >>> + if (entry->wired_count == 1) >>> + vm_map_entry_unwire(map, entry); >>> + else >>> entry->wired_count--; >>> - if (entry->wired_count == 0) { >>> - /* >>> - * Retain the map lock. >>> - */ >>> - vm_fault_unwire(map, entry->start, entry->end, >>> - entry->object.vm_object != NULL && >>> - (entry->object.vm_object->flags & >>> - OBJ_FICTITIOUS) != 0); >>> - } >>> } >>> next_entry_done: >>> KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0, >>> @@ -2783,9 +2771,13 @@ vm_map_sync( >>> static void >>> vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) >>> { >>> - vm_fault_unwire(map, entry->start, entry->end, >>> - entry->object.vm_object != NULL && >>> - (entry->object.vm_object->flags & OBJ_FICTITIOUS) != 0); >>> + >>> + VM_MAP_ASSERT_LOCKED(map); >>> + KASSERT(entry->wired_count > 0, >>> + ("vm_map_entry_unwire: entry %p isn't wired", entry)); >>> + pmap_unwire(map->pmap, entry->start, entry->end); >>> + vm_object_unwire(entry->object.vm_object, entry->offset, >>> entry->end - >>> + entry->start, PQ_ACTIVE); >>> entry->wired_count = 0; >>> } >>> >>> >>> Modified: head/sys/vm/vm_object.c >>> ============================================================================== >>> >>> --- head/sys/vm/vm_object.c Sat Jul 26 17:59:25 2014 (r269133) >>> +++ head/sys/vm/vm_object.c Sat Jul 26 18:10:18 2014 (r269134) >>> @@ -2202,6 +2202,78 @@ vm_object_set_writeable_dirty(vm_object_ >>> vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); >>> } >>> >>> +/* >>> + * vm_object_unwire: >>> + * >>> + * For each page offset within the specified range of the given >>> object, >>> + * find the highest-level page in the shadow chain and unwire >>> it. A page >>> + * must exist at every page offset, and the highest-level page >>> must be >>> + * wired. >>> + */ >>> +void >>> +vm_object_unwire(vm_object_t object, vm_ooffset_t offset, vm_size_t >>> length, >>> + uint8_t queue) >>> +{ >>> + vm_object_t tobject; >>> + vm_page_t m, tm; >>> + vm_pindex_t end_pindex, pindex, tpindex; >>> + int depth, locked_depth; >>> + >>> + KASSERT((offset & PAGE_MASK) == 0, >>> + ("vm_object_unwire: offset is not page aligned")); >>> + KASSERT((length & PAGE_MASK) == 0, >>> + ("vm_object_unwire: length is not a multiple of PAGE_SIZE")); >>> + /* The wired count of a fictitious page never changes. */ >>> + if ((object->flags & OBJ_FICTITIOUS) != 0) >>> + return; >>> + pindex = OFF_TO_IDX(offset); >>> + end_pindex = pindex + atop(length); >>> + locked_depth = 1; >>> + VM_OBJECT_RLOCK(object); >>> + m = vm_page_find_least(object, pindex); >>> + while (pindex < end_pindex) { >>> + if (m == NULL || pindex < m->pindex) { >>> + /* >>> + * The first object in the shadow chain doesn't >>> + * contain a page at the current index. Therefore, >>> + * the page must exist in a backing object. >>> + */ >>> + tobject = object; >>> + tpindex = pindex; >>> + depth = 0; >>> + do { >>> + tpindex += >>> + OFF_TO_IDX(tobject->backing_object_offset); >>> + tobject = tobject->backing_object; >>> + KASSERT(tobject != NULL, >>> + ("vm_object_unwire: missing page")); >>> + if ((tobject->flags & OBJ_FICTITIOUS) != 0) >>> + goto next_page; >>> + depth++; >>> + if (depth == locked_depth) { >>> + locked_depth++; >>> + VM_OBJECT_RLOCK(tobject); >>> + } >>> + } while ((tm = vm_page_lookup(tobject, tpindex)) == >>> + NULL); >>> + } else { >>> + tm = m; >>> + m = TAILQ_NEXT(m, listq); >>> + } >>> + vm_page_lock(tm); >>> + vm_page_unwire(tm, queue); >>> + vm_page_unlock(tm); >>> +next_page: >>> + pindex++; >>> + } >>> + /* Release the accumulated object locks. */ >>> + for (depth = 0; depth < locked_depth; depth++) { >>> + tobject = object->backing_object; >>> + VM_OBJECT_RUNLOCK(object); >>> + object = tobject; >>> + } >>> +} >>> + >>> #include "opt_ddb.h" >>> #ifdef DDB >>> #include >>> >>> Modified: head/sys/vm/vm_object.h >>> ============================================================================== >>> >>> --- head/sys/vm/vm_object.h Sat Jul 26 17:59:25 2014 (r269133) >>> +++ head/sys/vm/vm_object.h Sat Jul 26 18:10:18 2014 (r269134) >>> @@ -291,6 +291,8 @@ void vm_object_shadow (vm_object_t *, vm >>> void vm_object_split(vm_map_entry_t); >>> boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, >>> boolean_t, >>> boolean_t); >>> +void vm_object_unwire(vm_object_t object, vm_ooffset_t offset, >>> + vm_size_t length, uint8_t queue); >>> #endif /* _KERNEL */ >>> >>> #endif /* _VM_OBJECT_ */ >>> >>> >>> >> > From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 20:15:42 2014 Return-Path: Delivered-To: svn-src-all@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 A96C7B2; Wed, 30 Jul 2014 20:15:42 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 339E92FF7; Wed, 30 Jul 2014 20:15:40 +0000 (UTC) Received: from [192.168.225.11] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s6UKFXV7057579; Wed, 30 Jul 2014 22:15:36 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <53D95265.9010406@FreeBSD.org> Date: Wed, 30 Jul 2014 22:15:33 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alan Cox , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> In-Reply-To: <53D94D73.3050808@rice.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 20:15:42 -0000 On 30.07.14 21:54, Alan Cox wrote: > On 07/30/2014 14:46, Alan Cox wrote: >> On 07/30/2014 13:58, Andreas Tobler wrote: >>> Hi Alan, >>> >>> On 26.07.14 20:10, Alan Cox wrote: >>>> Author: alc >>>> Date: Sat Jul 26 18:10:18 2014 >>>> New Revision: 269134 >>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>> >>>> Log: >>>> When unwiring a region of an address space, do not assume that the >>>> underlying physical pages are mapped by the pmap. If, for >>>> example, the >>>> application has performed an mprotect(..., PROT_NONE) on any part >>>> of the >>>> wired region, then those pages will no longer be mapped by the pmap. >>>> So, using the pmap to lookup the wired pages in order to unwire them >>>> doesn't always work, and when it doesn't work wired pages are leaked. >>>> >>>> To avoid the leak, introduce and use a new function >>>> vm_object_unwire() >>>> that locates the wired pages by traversing the object and its backing >>>> objects. >>>> >>>> At the same time, switch from using pmap_change_wiring() to the >>>> recently >>>> introduced function pmap_unwire() for unwiring the region's mappings. >>>> pmap_unwire() is faster, because it operates a range of virtual >>>> addresses >>>> rather than a single virtual page at a time. Moreover, by >>>> operating on >>>> a range, it is superpage friendly. It doesn't waste time performing >>>> unnecessary demotions. >>>> >>>> Reported by: markj >>>> Reviewed by: kib >>>> Tested by: pho, jmg (arm) >>>> Sponsored by: EMC / Isilon Storage Division >>> This commit brings my 32- and 64-bit PowerMac's into panic. >>> Unfortunately I'm not able to give you a backtrace in the form of a >>> textdump nor of a core dump. >>> >>> The only thing I have is this picture: >>> >>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>> >>> Exactly this revision gives a panic and breaks the textdump/coredump >>> facility. >>> >>> How can I help debugging? >>> >> It appears to me that moea64_pvo_enter() had a pre-existing bug that got >> tickled by this change. Specifically, moea64_pvo_enter() doesn't set >> the PVO_WIRED flag when an unwired mapping already exists. It just >> returns with the mapping still in an unwired state. Consequently, when >> pmap_unwire() finally runs, it doesn't find a wired mapping. >> >> Try this: >> >> Index: powerpc/aim/mmu_oea64.c >> =================================================================== >> --- powerpc/aim/mmu_oea64.c (revision 269127) >> +++ powerpc/aim/mmu_oea64.c (working copy) >> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t >> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && >> (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | >> LPTE_PP)) >> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { >> if (!(pvo->pvo_pte.lpte.pte_hi & >> LPTE_VALID)) { >> /* Re-insert if spilled */ >> i = MOEA64_PTE_INSERT(mmu, ptegidx, >> > > The new conditional test needs to be inverted. Try this instead: > > Index: powerpc/aim/mmu_oea64.c > =================================================================== > --- powerpc/aim/mmu_oea64.c (revision 269127) > +++ powerpc/aim/mmu_oea64.c (working copy) > @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t > if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { > if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && > (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | > LPTE_PP)) > - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { > + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && > + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == 0) { > if (!(pvo->pvo_pte.lpte.pte_hi & > LPTE_VALID)) { > /* Re-insert if spilled */ > i = MOEA64_PTE_INSERT(mmu, ptegidx, > The panic stays, but the message is different: panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in moea64_pteg_table but valid in pvo. Andreas From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 21:17:33 2014 Return-Path: Delivered-To: svn-src-all@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 DC8EE322; Wed, 30 Jul 2014 21:17:32 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D0A02655; Wed, 30 Jul 2014 21:17:32 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id s6ULGt15022860; Wed, 30 Jul 2014 16:17:30 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1nf7d801n8-1; Wed, 30 Jul 2014 16:17:30 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id A0AE8500119; Wed, 30 Jul 2014 16:17:29 -0500 (CDT) Message-ID: <53D960E9.50905@rice.edu> Date: Wed, 30 Jul 2014 16:17:29 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> In-Reply-To: <53D95265.9010406@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=1.05876107880931e-09 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.714301145562988 urlsuspect_oldscore=0.714301145562988 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.714301145562988 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407300244 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 21:17:33 -0000 On 07/30/2014 15:15, Andreas Tobler wrote: > On 30.07.14 21:54, Alan Cox wrote: >> On 07/30/2014 14:46, Alan Cox wrote: >>> On 07/30/2014 13:58, Andreas Tobler wrote: >>>> Hi Alan, >>>> >>>> On 26.07.14 20:10, Alan Cox wrote: >>>>> Author: alc >>>>> Date: Sat Jul 26 18:10:18 2014 >>>>> New Revision: 269134 >>>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>>> >>>>> Log: >>>>> When unwiring a region of an address space, do not assume that >>>>> the >>>>> underlying physical pages are mapped by the pmap. If, for >>>>> example, the >>>>> application has performed an mprotect(..., PROT_NONE) on any part >>>>> of the >>>>> wired region, then those pages will no longer be mapped by the >>>>> pmap. >>>>> So, using the pmap to lookup the wired pages in order to >>>>> unwire them >>>>> doesn't always work, and when it doesn't work wired pages are >>>>> leaked. >>>>> >>>>> To avoid the leak, introduce and use a new function >>>>> vm_object_unwire() >>>>> that locates the wired pages by traversing the object and its >>>>> backing >>>>> objects. >>>>> >>>>> At the same time, switch from using pmap_change_wiring() to the >>>>> recently >>>>> introduced function pmap_unwire() for unwiring the region's >>>>> mappings. >>>>> pmap_unwire() is faster, because it operates a range of virtual >>>>> addresses >>>>> rather than a single virtual page at a time. Moreover, by >>>>> operating on >>>>> a range, it is superpage friendly. It doesn't waste time >>>>> performing >>>>> unnecessary demotions. >>>>> >>>>> Reported by: markj >>>>> Reviewed by: kib >>>>> Tested by: pho, jmg (arm) >>>>> Sponsored by: EMC / Isilon Storage Division >>>> This commit brings my 32- and 64-bit PowerMac's into panic. >>>> Unfortunately I'm not able to give you a backtrace in the form of a >>>> textdump nor of a core dump. >>>> >>>> The only thing I have is this picture: >>>> >>>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>>> >>>> Exactly this revision gives a panic and breaks the textdump/coredump >>>> facility. >>>> >>>> How can I help debugging? >>>> >>> It appears to me that moea64_pvo_enter() had a pre-existing bug that >>> got >>> tickled by this change. Specifically, moea64_pvo_enter() doesn't set >>> the PVO_WIRED flag when an unwired mapping already exists. It just >>> returns with the mapping still in an unwired state. Consequently, when >>> pmap_unwire() finally runs, it doesn't find a wired mapping. >>> >>> Try this: >>> >>> Index: powerpc/aim/mmu_oea64.c >>> =================================================================== >>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>> +++ powerpc/aim/mmu_oea64.c (working copy) >>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t >>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>> == pa && >>> (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | >>> LPTE_PP)) >>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { >>> if (!(pvo->pvo_pte.lpte.pte_hi & >>> LPTE_VALID)) { >>> /* Re-insert if spilled */ >>> i = MOEA64_PTE_INSERT(mmu, >>> ptegidx, >>> >> >> The new conditional test needs to be inverted. Try this instead: >> >> Index: powerpc/aim/mmu_oea64.c >> =================================================================== >> --- powerpc/aim/mmu_oea64.c (revision 269127) >> +++ powerpc/aim/mmu_oea64.c (working copy) >> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t >> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >> == pa && >> (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | >> LPTE_PP)) >> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == >> 0) { >> if (!(pvo->pvo_pte.lpte.pte_hi & >> LPTE_VALID)) { >> /* Re-insert if spilled */ >> i = MOEA64_PTE_INSERT(mmu, >> ptegidx, >> > > > The panic stays, but the message is different: > > panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in > moea64_pteg_table but valid in pvo. > My attempted fix is doing something else wrong. Do you have a stack trace? From owner-svn-src-all@FreeBSD.ORG Wed Jul 30 21:26:48 2014 Return-Path: Delivered-To: svn-src-all@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 F0C44603; Wed, 30 Jul 2014 21:26:47 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83F742730; Wed, 30 Jul 2014 21:26:46 +0000 (UTC) Received: from [192.168.225.11] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s6ULQYCD004228; Wed, 30 Jul 2014 23:26:42 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <53D9630A.5050500@FreeBSD.org> Date: Wed, 30 Jul 2014 23:26:34 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alan Cox , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> <53D960E9.50905@rice.edu> In-Reply-To: <53D960E9.50905@rice.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2014 21:26:48 -0000 On 30.07.14 23:17, Alan Cox wrote: > On 07/30/2014 15:15, Andreas Tobler wrote: >> On 30.07.14 21:54, Alan Cox wrote: >>> On 07/30/2014 14:46, Alan Cox wrote: >>>> On 07/30/2014 13:58, Andreas Tobler wrote: >>>>> Hi Alan, >>>>> >>>>> On 26.07.14 20:10, Alan Cox wrote: >>>>>> Author: alc >>>>>> Date: Sat Jul 26 18:10:18 2014 >>>>>> New Revision: 269134 >>>>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>>>> >>>>>> Log: >>>>>> When unwiring a region of an address space, do not assume that >>>>>> the >>>>>> underlying physical pages are mapped by the pmap. If, for >>>>>> example, the >>>>>> application has performed an mprotect(..., PROT_NONE) on any part >>>>>> of the >>>>>> wired region, then those pages will no longer be mapped by the >>>>>> pmap. >>>>>> So, using the pmap to lookup the wired pages in order to >>>>>> unwire them >>>>>> doesn't always work, and when it doesn't work wired pages are >>>>>> leaked. >>>>>> >>>>>> To avoid the leak, introduce and use a new function >>>>>> vm_object_unwire() >>>>>> that locates the wired pages by traversing the object and its >>>>>> backing >>>>>> objects. >>>>>> >>>>>> At the same time, switch from using pmap_change_wiring() to the >>>>>> recently >>>>>> introduced function pmap_unwire() for unwiring the region's >>>>>> mappings. >>>>>> pmap_unwire() is faster, because it operates a range of virtual >>>>>> addresses >>>>>> rather than a single virtual page at a time. Moreover, by >>>>>> operating on >>>>>> a range, it is superpage friendly. It doesn't waste time >>>>>> performing >>>>>> unnecessary demotions. >>>>>> >>>>>> Reported by: markj >>>>>> Reviewed by: kib >>>>>> Tested by: pho, jmg (arm) >>>>>> Sponsored by: EMC / Isilon Storage Division >>>>> This commit brings my 32- and 64-bit PowerMac's into panic. >>>>> Unfortunately I'm not able to give you a backtrace in the form of a >>>>> textdump nor of a core dump. >>>>> >>>>> The only thing I have is this picture: >>>>> >>>>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>>>> >>>>> Exactly this revision gives a panic and breaks the textdump/coredump >>>>> facility. >>>>> >>>>> How can I help debugging? >>>>> >>>> It appears to me that moea64_pvo_enter() had a pre-existing bug that >>>> got >>>> tickled by this change. Specifically, moea64_pvo_enter() doesn't set >>>> the PVO_WIRED flag when an unwired mapping already exists. It just >>>> returns with the mapping still in an unwired state. Consequently, when >>>> pmap_unwire() finally runs, it doesn't find a wired mapping. >>>> >>>> Try this: >>>> >>>> Index: powerpc/aim/mmu_oea64.c >>>> =================================================================== >>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t >>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>>> == pa && >>>> (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | >>>> LPTE_PP)) >>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { >>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>> LPTE_VALID)) { >>>> /* Re-insert if spilled */ >>>> i = MOEA64_PTE_INSERT(mmu, >>>> ptegidx, >>>> >>> >>> The new conditional test needs to be inverted. Try this instead: >>> >>> Index: powerpc/aim/mmu_oea64.c >>> =================================================================== >>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>> +++ powerpc/aim/mmu_oea64.c (working copy) >>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t >>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>> == pa && >>> (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | >>> LPTE_PP)) >>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == >>> 0) { >>> if (!(pvo->pvo_pte.lpte.pte_hi & >>> LPTE_VALID)) { >>> /* Re-insert if spilled */ >>> i = MOEA64_PTE_INSERT(mmu, >>> ptegidx, >>> >> >> >> The panic stays, but the message is different: >> >> panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in >> moea64_pteg_table but valid in pvo. >> > > My attempted fix is doing something else wrong. Do you have a stack trace? iPhone sei Dank: http://people.freebsd.org/~andreast/r269134-1_panic.jpg Thanks! Andreas From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 02:07:49 2014 Return-Path: Delivered-To: svn-src-all@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 80801AF0; Thu, 31 Jul 2014 02:07: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D51D23D9; Thu, 31 Jul 2014 02:07:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V27nq0077737; Thu, 31 Jul 2014 02:07:49 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V27nZ8077736; Thu, 31 Jul 2014 02:07:49 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201407310207.s6V27nZ8077736@svn.freebsd.org> From: Glen Barber Date: Thu, 31 Jul 2014 02:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269318 - head/contrib/subversion/subversion/svn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 02:07:49 -0000 Author: gjb Date: Thu Jul 31 02:07:48 2014 New Revision: 269318 URL: http://svnweb.freebsd.org/changeset/base/269318 Log: Replace 'GNATS' with 'Bugzilla' in the base subversion commit template. Approved by: peter Sponsored by: The FreeBSD Foundation Modified: head/contrib/subversion/subversion/svn/util.c Modified: head/contrib/subversion/subversion/svn/util.c ============================================================================== --- head/contrib/subversion/subversion/svn/util.c Wed Jul 30 18:47:31 2014 (r269317) +++ head/contrib/subversion/subversion/svn/util.c Thu Jul 31 02:07:48 2014 (r269318) @@ -419,7 +419,7 @@ svn_cl__get_log_message(const char **log svn_stringbuf_appendcstr(default_msg, EDITOR_EOF_PREFIX); svn_stringbuf_appendcstr(default_msg, APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Description of fields to fill in above: 76 columns --|" APR_EOL_STR); - svn_stringbuf_appendcstr(default_msg, "> PR: If a GNATS PR is affected by the change." APR_EOL_STR); + svn_stringbuf_appendcstr(default_msg, "> PR: If a Bugzilla PR is affected by the change." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Submitted by: If someone else sent in the change." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Reviewed by: If someone else reviewed your modification." APR_EOL_STR); svn_stringbuf_appendcstr(default_msg, "> Approved by: If you needed approval for this commit." APR_EOL_STR); From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 03:34:26 2014 Return-Path: Delivered-To: svn-src-all@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 0B6F6D45; Thu, 31 Jul 2014 03:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E979E2BA5; Thu, 31 Jul 2014 03:34:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V3YPSo018669; Thu, 31 Jul 2014 03:34:25 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V3YP4Q018668; Thu, 31 Jul 2014 03:34:25 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201407310334.s6V3YP4Q018668@svn.freebsd.org> From: Kevin Lo Date: Thu, 31 Jul 2014 03:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269319 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 03:34:26 -0000 Author: kevlo Date: Thu Jul 31 03:34:25 2014 New Revision: 269319 URL: http://svnweb.freebsd.org/changeset/base/269319 Log: In copyright statement correct that the author is me, not Bill Paul. Modified: head/sys/dev/usb/net/if_axgereg.h Modified: head/sys/dev/usb/net/if_axgereg.h ============================================================================== --- head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 02:07:48 2014 (r269318) +++ head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 03:34:25 2014 (r269319) @@ -11,10 +11,10 @@ * 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 Bill Paul AND CONTRIBUTORS ``AS IS'' AND + * 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 Bill Paul OR THE VOICES IN HIS HEAD + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD * 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 From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 03:36:04 2014 Return-Path: Delivered-To: svn-src-all@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 81D36EBE; Thu, 31 Jul 2014 03:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FAE92BBB; Thu, 31 Jul 2014 03:36:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V3a45X018948; Thu, 31 Jul 2014 03:36:04 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V3a4gr018947; Thu, 31 Jul 2014 03:36:04 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201407310336.s6V3a4gr018947@svn.freebsd.org> From: Kevin Lo Date: Thu, 31 Jul 2014 03:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269320 - head/usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 03:36:04 -0000 Author: kevlo Date: Thu Jul 31 03:36:03 2014 New Revision: 269320 URL: http://svnweb.freebsd.org/changeset/base/269320 Log: Remove an unsed variable. Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Thu Jul 31 03:34:25 2014 (r269319) +++ head/usr.bin/gcore/elfcore.c Thu Jul 31 03:36:03 2014 (r269320) @@ -618,7 +618,7 @@ elf_note_thrmisc(void *arg, size_t *size static void * procstat_sysctl(void *arg, int what, size_t structsz, size_t *sizep) { - size_t len, oldlen; + size_t len; pid_t pid; int name[4], structsize; void *buf, *p; From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 03:59:01 2014 Return-Path: Delivered-To: svn-src-all@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 45D90400; Thu, 31 Jul 2014 03:59: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3367F2EF1; Thu, 31 Jul 2014 03:59:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V3x1gM028084; Thu, 31 Jul 2014 03:59:01 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V3x1E5028083; Thu, 31 Jul 2014 03:59:01 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407310359.s6V3x1E5028083@svn.freebsd.org> From: Ian Lepore Date: Thu, 31 Jul 2014 03:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269321 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 03:59:01 -0000 Author: ian Date: Thu Jul 31 03:59:00 2014 New Revision: 269321 URL: http://svnweb.freebsd.org/changeset/base/269321 Log: Switch to using counter(9) for the new 64-bit stats kept by armv6 busdma. Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Thu Jul 31 03:36:03 2014 (r269320) +++ head/sys/arm/arm/busdma_machdep-v6.c Thu Jul 31 03:59:00 2014 (r269321) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -141,38 +142,38 @@ static uint32_t tags_total; static uint32_t maps_total; static uint32_t maps_dmamem; static uint32_t maps_coherent; -static uint64_t maploads_total; -static uint64_t maploads_bounced; -static uint64_t maploads_coherent; -static uint64_t maploads_dmamem; -static uint64_t maploads_mbuf; -static uint64_t maploads_physmem; +static counter_u64_t maploads_total; +static counter_u64_t maploads_bounced; +static counter_u64_t maploads_coherent; +static counter_u64_t maploads_dmamem; +static counter_u64_t maploads_mbuf; +static counter_u64_t maploads_physmem; static STAILQ_HEAD(, bounce_zone) bounce_zone_list; SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); SYSCTL_UINT(_hw_busdma, OID_AUTO, tags_total, CTLFLAG_RD, &tags_total, 0, - "Number of active tags"); + "Number of active tags"); SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_total, CTLFLAG_RD, &maps_total, 0, - "Number of active maps"); + "Number of active maps"); SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, &maps_dmamem, 0, - "Number of active maps for bus_dmamem_alloc buffers"); + "Number of active maps for bus_dmamem_alloc buffers"); SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, - "Number of active maps with BUS_DMA_COHERENT flag set"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, 0, - "Number of load operations performed"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, &maploads_bounced, 0, - "Number of load operations that used bounce buffers"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, &maploads_dmamem, 0, - "Number of load operations on BUS_DMA_COHERENT memory"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, &maploads_dmamem, 0, - "Number of load operations on bus_dmamem_alloc buffers"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, &maploads_mbuf, 0, - "Number of load operations for mbufs"); -SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, &maploads_physmem, 0, - "Number of load operations on physical buffers"); + "Number of active maps with BUS_DMA_COHERENT flag set"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, + &maploads_total, "Number of load operations performed"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, + &maploads_bounced, "Number of load operations that used bounce buffers"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, + &maploads_dmamem, "Number of load operations on BUS_DMA_COHERENT memory"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, + &maploads_dmamem, "Number of load operations on bus_dmamem_alloc buffers"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, + &maploads_mbuf, "Number of load operations for mbufs"); +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, + &maploads_physmem, "Number of load operations on physical buffers"); SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, - "Total bounce pages"); + "Total bounce pages"); struct bus_dmamap { struct bp_list bpages; @@ -219,6 +220,13 @@ busdma_init(void *dummy) { int uma_flags; + maploads_total = counter_u64_alloc(M_WAITOK); + maploads_bounced = counter_u64_alloc(M_WAITOK); + maploads_coherent = counter_u64_alloc(M_WAITOK); + maploads_dmamem = counter_u64_alloc(M_WAITOK); + maploads_mbuf = counter_u64_alloc(M_WAITOK); + maploads_physmem = counter_u64_alloc(M_WAITOK); + uma_flags = 0; /* Create a cache of buffers in standard (cacheable) memory. */ @@ -250,11 +258,11 @@ busdma_init(void *dummy) /* * This init historically used SI_SUB_VM, but now the init code requires - * malloc(9) using M_DEVBUF memory, which is set up later than SI_SUB_VM, by - * SI_SUB_KMEM and SI_ORDER_THIRD, so we'll go right after that by using - * SI_SUB_KMEM and SI_ORDER_FOURTH. + * malloc(9) using M_DEVBUF memory and the pcpu zones for counter(9), which get + * set up by SI_SUB_KMEM and SI_ORDER_LAST, so we'll go right after that by + * using SI_SUB_KMEM+1. */ -SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_FOURTH, busdma_init, NULL); +SYSINIT(busdma, SI_SUB_KMEM+1, SI_ORDER_FIRST, busdma_init, NULL); /* * This routine checks the exclusion zone constraints from a tag against the @@ -1037,13 +1045,13 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat if (segs == NULL) segs = map->segments; - maploads_total++; - maploads_physmem++; + counter_u64_add(maploads_total, 1); + counter_u64_add(maploads_physmem, 1); if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { - maploads_bounced++; + counter_u64_add(maploads_bounced, 1); error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1106,17 +1114,17 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm struct sync_list *sl; int error; - maploads_total++; + counter_u64_add(maploads_total, 1); if (map->flags & DMAMAP_COHERENT) - maploads_coherent++; + counter_u64_add(maploads_coherent, 1); if (map->flags & DMAMAP_DMAMEM_ALLOC) - maploads_dmamem++; + counter_u64_add(maploads_dmamem, 1); if (segs == NULL) segs = map->segments; if (flags & BUS_DMA_LOAD_MBUF) { - maploads_mbuf++; + counter_u64_add(maploads_mbuf, 1); map->flags |= DMAMAP_MBUF; } @@ -1125,7 +1133,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { - maploads_bounced++; + counter_u64_add(maploads_bounced, 1); error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 04:35:50 2014 Return-Path: Delivered-To: svn-src-all@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 F3109C06; Thu, 31 Jul 2014 04:35:49 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B154E224C; Thu, 31 Jul 2014 04:35:49 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id s6V4XHOe014049; Wed, 30 Jul 2014 23:35:47 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1nf7d804yd-1; Wed, 30 Jul 2014 23:35:47 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 6158B500122; Wed, 30 Jul 2014 23:35:46 -0500 (CDT) Message-ID: <53D9C7A0.4010100@rice.edu> Date: Wed, 30 Jul 2014 23:35:44 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> <53D960E9.50905@rice.edu> <53D9630A.5050500@FreeBSD.org> In-Reply-To: <53D9630A.5050500@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------010001050408000309070408" X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407310058 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 04:35:50 -0000 This is a multi-part message in MIME format. --------------010001050408000309070408 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 07/30/2014 16:26, Andreas Tobler wrote: > On 30.07.14 23:17, Alan Cox wrote: >> On 07/30/2014 15:15, Andreas Tobler wrote: >>> On 30.07.14 21:54, Alan Cox wrote: >>>> On 07/30/2014 14:46, Alan Cox wrote: >>>>> On 07/30/2014 13:58, Andreas Tobler wrote: >>>>>> Hi Alan, >>>>>> >>>>>> On 26.07.14 20:10, Alan Cox wrote: >>>>>>> Author: alc >>>>>>> Date: Sat Jul 26 18:10:18 2014 >>>>>>> New Revision: 269134 >>>>>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>>>>> >>>>>>> Log: >>>>>>> When unwiring a region of an address space, do not assume that >>>>>>> the >>>>>>> underlying physical pages are mapped by the pmap. If, for >>>>>>> example, the >>>>>>> application has performed an mprotect(..., PROT_NONE) on >>>>>>> any part >>>>>>> of the >>>>>>> wired region, then those pages will no longer be mapped by the >>>>>>> pmap. >>>>>>> So, using the pmap to lookup the wired pages in order to >>>>>>> unwire them >>>>>>> doesn't always work, and when it doesn't work wired pages are >>>>>>> leaked. >>>>>>> >>>>>>> To avoid the leak, introduce and use a new function >>>>>>> vm_object_unwire() >>>>>>> that locates the wired pages by traversing the object and its >>>>>>> backing >>>>>>> objects. >>>>>>> >>>>>>> At the same time, switch from using pmap_change_wiring() to >>>>>>> the >>>>>>> recently >>>>>>> introduced function pmap_unwire() for unwiring the region's >>>>>>> mappings. >>>>>>> pmap_unwire() is faster, because it operates a range of >>>>>>> virtual >>>>>>> addresses >>>>>>> rather than a single virtual page at a time. Moreover, by >>>>>>> operating on >>>>>>> a range, it is superpage friendly. It doesn't waste time >>>>>>> performing >>>>>>> unnecessary demotions. >>>>>>> >>>>>>> Reported by: markj >>>>>>> Reviewed by: kib >>>>>>> Tested by: pho, jmg (arm) >>>>>>> Sponsored by: EMC / Isilon Storage Division >>>>>> This commit brings my 32- and 64-bit PowerMac's into panic. >>>>>> Unfortunately I'm not able to give you a backtrace in the form of a >>>>>> textdump nor of a core dump. >>>>>> >>>>>> The only thing I have is this picture: >>>>>> >>>>>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>>>>> >>>>>> Exactly this revision gives a panic and breaks the textdump/coredump >>>>>> facility. >>>>>> >>>>>> How can I help debugging? >>>>>> >>>>> It appears to me that moea64_pvo_enter() had a pre-existing bug that >>>>> got >>>>> tickled by this change. Specifically, moea64_pvo_enter() doesn't set >>>>> the PVO_WIRED flag when an unwired mapping already exists. It just >>>>> returns with the mapping still in an unwired state. Consequently, >>>>> when >>>>> pmap_unwire() finally runs, it doesn't find a wired mapping. >>>>> >>>>> Try this: >>>>> >>>>> Index: powerpc/aim/mmu_oea64.c >>>>> =================================================================== >>>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>>> uma_zone_t >>>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>>>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>>>> == pa && >>>>> (pvo->pvo_pte.lpte.pte_lo & >>>>> (LPTE_NOEXEC | >>>>> LPTE_PP)) >>>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { >>>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>>> LPTE_VALID)) { >>>>> /* Re-insert if spilled */ >>>>> i = MOEA64_PTE_INSERT(mmu, >>>>> ptegidx, >>>>> >>>> >>>> The new conditional test needs to be inverted. Try this instead: >>>> >>>> Index: powerpc/aim/mmu_oea64.c >>>> =================================================================== >>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>> uma_zone_t >>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>>> == pa && >>>> (pvo->pvo_pte.lpte.pte_lo & >>>> (LPTE_NOEXEC | >>>> LPTE_PP)) >>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == >>>> 0) { >>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>> LPTE_VALID)) { >>>> /* Re-insert if spilled */ >>>> i = MOEA64_PTE_INSERT(mmu, >>>> ptegidx, >>>> >>> >>> >>> The panic stays, but the message is different: >>> >>> panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in >>> moea64_pteg_table but valid in pvo. >>> >> >> My attempted fix is doing something else wrong. Do you have a stack >> trace? > > iPhone sei Dank: > > http://people.freebsd.org/~andreast/r269134-1_panic.jpg Ok, this patch should fix both the original panic and the new one. They are two distinct problems. --------------010001050408000309070408 Content-Type: text/plain; charset=ISO-8859-15; name="mmu_oea64_fixes.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="mmu_oea64_fixes.patch" SW5kZXg6IHBvd2VycGMvYWltL21tdV9vZWE2NC5jCj09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHBvd2Vy cGMvYWltL21tdV9vZWE2NC5jCShyZXZpc2lvbiAyNjkxMjcpCisrKyBwb3dlcnBjL2FpbS9t bXVfb2VhNjQuYwkod29ya2luZyBjb3B5KQpAQCAtMTA5MCw2ICsxMDkwLDcgQEAgbW9lYTY0 X3Vud2lyZShtbXVfdCBtbXUsIHBtYXBfdCBwbSwgdm1fb2Zmc2V0X3Qgc3YKIAlmb3IgKHB2 byA9IFJCX05GSU5EKHB2b190cmVlLCAmcG0tPnBtYXBfcHZvLCAma2V5KTsKIAkgICAgcHZv ICE9IE5VTEwgJiYgUFZPX1ZBRERSKHB2bykgPCBldmE7CiAJICAgIHB2byA9IFJCX05FWFQo cHZvX3RyZWUsICZwbS0+cG1hcF9wdm8sIHB2bykpIHsKKwkJcHQgPSBNT0VBNjRfUFZPX1RP X1BURShtbXUsIHB2byk7CiAJCWlmICgocHZvLT5wdm9fdmFkZHIgJiBQVk9fV0lSRUQpID09 IDApCiAJCQlwYW5pYygibW9lYTY0X3Vud2lyZTogcHZvICVwIGlzIG1pc3NpbmcgUFZPX1dJ UkVEIiwKIAkJCSAgICBwdm8pOwpAQCAtMTA5OCw3ICsxMDk5LDcgQEAgbW9lYTY0X3Vud2ly ZShtbXVfdCBtbXUsIHBtYXBfdCBwbSwgdm1fb2Zmc2V0X3Qgc3YKIAkJCXBhbmljKCJtb2Vh NjRfdW53aXJlOiBwdGUgJXAgaXMgbWlzc2luZyBMUFRFX1dJUkVEIiwKIAkJCSAgICAmcHZv LT5wdm9fcHRlLmxwdGUpOwogCQlwdm8tPnB2b19wdGUubHB0ZS5wdGVfaGkgJj0gfkxQVEVf V0lSRUQ7Ci0JCWlmICgocHQgPSBNT0VBNjRfUFZPX1RPX1BURShtbXUsIHB2bykpICE9IC0x KSB7CisJCWlmIChwdCAhPSAtMSkgewogCQkJLyoKIAkJCSAqIFRoZSBQVEUncyB3aXJlZCBh dHRyaWJ1dGUgaXMgbm90IGEgaGFyZHdhcmUKIAkJCSAqIGZlYXR1cmUsIHNvIHRoZXJlIGlz IG5vIG5lZWQgdG8gaW52YWxpZGF0ZSBhbnkgVExCCkBAIC0yMjc0LDcgKzIyNzUsOCBAQCBt b2VhNjRfcHZvX2VudGVyKG1tdV90IG1tdSwgcG1hcF90IHBtLCB1bWFfem9uZV90CiAJCWlm IChwdm8tPnB2b19wbWFwID09IHBtICYmIFBWT19WQUREUihwdm8pID09IHZhKSB7CiAJCQlp ZiAoKHB2by0+cHZvX3B0ZS5scHRlLnB0ZV9sbyAmIExQVEVfUlBHTikgPT0gcGEgJiYKIAkJ CSAgICAocHZvLT5wdm9fcHRlLmxwdGUucHRlX2xvICYgKExQVEVfTk9FWEVDIHwgTFBURV9Q UCkpCi0JCQkgICAgPT0gKHB0ZV9sbyAmIChMUFRFX05PRVhFQyB8IExQVEVfUFApKSkgewor CQkJICAgID09IChwdGVfbG8gJiAoTFBURV9OT0VYRUMgfCBMUFRFX1BQKSkgJiYKKwkJCSAg ICAoKHB2by0+cHZvX3ZhZGRyIF4gZmxhZ3MpICYgUFZPX1dJUkVEKSA9PSAwKSB7CiAJCQkg ICAgCWlmICghKHB2by0+cHZvX3B0ZS5scHRlLnB0ZV9oaSAmIExQVEVfVkFMSUQpKSB7CiAJ CQkJCS8qIFJlLWluc2VydCBpZiBzcGlsbGVkICovCiAJCQkJCWkgPSBNT0VBNjRfUFRFX0lO U0VSVChtbXUsIHB0ZWdpZHgsCg== --------------010001050408000309070408-- From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 05:12:22 2014 Return-Path: Delivered-To: svn-src-all@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 460A9136; Thu, 31 Jul 2014 05:12: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33C6E2611; Thu, 31 Jul 2014 05:12:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V5CLe9062651; Thu, 31 Jul 2014 05:12:21 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V5CLg8062650; Thu, 31 Jul 2014 05:12:21 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201407310512.s6V5CLg8062650@svn.freebsd.org> From: Kevin Lo Date: Thu, 31 Jul 2014 05:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269322 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 05:12:22 -0000 Author: kevlo Date: Thu Jul 31 05:12:21 2014 New Revision: 269322 URL: http://svnweb.freebsd.org/changeset/base/269322 Log: Replace the whole license block with the standard one. Suggested by: emaste Modified: head/sys/dev/usb/net/if_axgereg.h Modified: head/sys/dev/usb/net/if_axgereg.h ============================================================================== --- head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 03:59:00 2014 (r269321) +++ head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 05:12:21 2014 (r269322) @@ -14,14 +14,14 @@ * 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 THE VOICES IN HIS HEAD - * 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. + * 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$ */ From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 05:56:16 2014 Return-Path: Delivered-To: svn-src-all@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 4FE7F76C; Thu, 31 Jul 2014 05:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E3E52984; Thu, 31 Jul 2014 05:56:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V5uGN0080857; Thu, 31 Jul 2014 05:56:16 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V5uGWX080856; Thu, 31 Jul 2014 05:56:16 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201407310556.s6V5uGWX080856@svn.freebsd.org> From: Baptiste Daroussin Date: Thu, 31 Jul 2014 05:56:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269323 - head/usr.bin/m4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 05:56:16 -0000 Author: bapt Date: Thu Jul 31 05:56:15 2014 New Revision: 269323 URL: http://svnweb.freebsd.org/changeset/base/269323 Log: lower warning level to fix build with gcc Modified: head/usr.bin/m4/Makefile Modified: head/usr.bin/m4/Makefile ============================================================================== --- head/usr.bin/m4/Makefile Thu Jul 31 05:12:21 2014 (r269322) +++ head/usr.bin/m4/Makefile Thu Jul 31 05:56:15 2014 (r269323) @@ -16,6 +16,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS= SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l .PATH: ${.CURDIR}/lib SRCS+= ohash.c +WARNS= 3 tokenizer.o: parser.h From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 07:28:00 2014 Return-Path: Delivered-To: svn-src-all@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 B222AF84; Thu, 31 Jul 2014 07:28: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F4FD2436; Thu, 31 Jul 2014 07:28:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V7S0ol022026; Thu, 31 Jul 2014 07:28:00 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V7S0Q2022025; Thu, 31 Jul 2014 07:28:00 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201407310728.s6V7S0Q2022025@svn.freebsd.org> From: Rui Paulo Date: Thu, 31 Jul 2014 07:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269324 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 07:28:00 -0000 Author: rpaulo Date: Thu Jul 31 07:27:59 2014 New Revision: 269324 URL: http://svnweb.freebsd.org/changeset/base/269324 Log: MFC r268300: bsd.dep.mk: add support for generating DTrace header files from .d files. Modified: stable/10/share/mk/bsd.dep.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.dep.mk ============================================================================== --- stable/10/share/mk/bsd.dep.mk Thu Jul 31 05:56:15 2014 (r269323) +++ stable/10/share/mk/bsd.dep.mk Thu Jul 31 07:27:59 2014 (r269324) @@ -78,6 +78,7 @@ ${_S:R}.o: ${_S} .endfor .endif +# Lexical analyzers .for _LSRC in ${SRCS:M*.l:N*/*} .for _LC in ${_LSRC:R}.c ${_LC}: ${_LSRC} @@ -90,6 +91,7 @@ CLEANFILES+= ${_LC} .endfor .endfor +# Yacc grammars .for _YSRC in ${SRCS:M*.y:N*/*} .for _YC in ${_YSRC:R}.c SRCS:= ${SRCS:S/${_YSRC}/${_YC}/} @@ -117,6 +119,16 @@ ${_YC:R}.o: ${_YC} .endif .endfor .endfor + +# DTrace probe definitions +.for _DSRC in ${SRCS:M*.d:N*/*} +.for _DH in ${_DSRC:R}.h +${_DH}: ${_DSRC} + ${DTRACE} -xnolibs -h -s ${.ALLSRC} +SRCS:= ${SRCS:S/${_DSRC}/${_DH}/} +CLEANFILES+= ${_DH} +.endfor +.endfor .endif .if !target(depend) From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 07:51:26 2014 Return-Path: Delivered-To: svn-src-all@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 6DD98948; Thu, 31 Jul 2014 07:51:26 +0000 (UTC) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [IPv6:2a00:1450:400c:c05::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 926962681; Thu, 31 Jul 2014 07:51:25 +0000 (UTC) Received: by mail-wi0-f175.google.com with SMTP id ho1so8843108wib.8 for ; Thu, 31 Jul 2014 00:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Pq1Ux9zOcqiXCsSgrHEwDGLmP0WD8nX0Rm5CmE23aN8=; b=vM4mLDf1wZ+FHMcfxHGixza88+Eze10J9v5qIQsgON/n2kMs/MDUpjmAceJH35RoPa MdlYz808IyfJmUcaxz6cSA1CZ2QJQlvqRKiuk8gRHBTmeYraE4AeNUchIsSb5Oj6mYi1 CgzAqEPINP379okK3rLysuwASVFiZJcbY2fYUtOIjQWQtUNdN5dajtj12uoU22qgQYIc SBSQ/1ustL+6nHqlkJOrE3zbjBX7UG8MsO0Jk8diBCR9NQgJgTmM6+97Bxy/HprSIytP JpOg6CikZN8YBMl1D1OBXER2h73DPGZkZDXpOjHai38ztv6YEWvyuJDYjYTVaL7Q7936 zj2Q== MIME-Version: 1.0 X-Received: by 10.194.110.7 with SMTP id hw7mr14216986wjb.38.1406793083817; Thu, 31 Jul 2014 00:51:23 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.217.157.137 with HTTP; Thu, 31 Jul 2014 00:51:23 -0700 (PDT) In-Reply-To: <201407310556.s6V5uGWX080856@svn.freebsd.org> References: <201407310556.s6V5uGWX080856@svn.freebsd.org> Date: Thu, 31 Jul 2014 11:51:23 +0400 X-Google-Sender-Auth: ECLG5nfO3vSzX-rL3lzUIiacPys Message-ID: Subject: Re: svn commit: r269323 - head/usr.bin/m4 From: Sergey Kandaurov To: Baptiste Daroussin 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 07:51:26 -0000 On 31 July 2014 09:56, Baptiste Daroussin wrote: > Author: bapt > Date: Thu Jul 31 05:56:15 2014 > New Revision: 269323 > URL: http://svnweb.freebsd.org/changeset/base/269323 > > Log: > lower warning level to fix build with gcc > > Modified: > head/usr.bin/m4/Makefile > > Modified: head/usr.bin/m4/Makefile > ============================================================================== > --- head/usr.bin/m4/Makefile Thu Jul 31 05:12:21 2014 (r269322) > +++ head/usr.bin/m4/Makefile Thu Jul 31 05:56:15 2014 (r269323) > @@ -16,6 +16,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS= > SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l > .PATH: ${.CURDIR}/lib > SRCS+= ohash.c > +WARNS= 3 > > tokenizer.o: parser.h > > I am suspicious of this approach. Unless objections, I'd like to commit the following one (it also follows the NetBSD way in fixing up .Ox m4 import). Although it is low quality as well, it allows to keep WARNS. Index: lib/ohash.c =================================================================== --- lib/ohash.c (revision 269324) +++ lib/ohash.c (working copy) @@ -120,7 +120,7 @@ void * ohash_remove(struct ohash *h, unsigned int i) { - void *result = (void *)h->t[i].p; + void *result = __DECONST(void *, h->t[i].p); if (result == NULL || result == DELETED) return NULL; @@ -141,7 +141,7 @@ if (h->t[i].p == DELETED) return NULL; else - return (void *)h->t[i].p; + return __DECONST(void *, h->t[i].p); } void * @@ -180,7 +180,7 @@ { for (; *pos < h->size; (*pos)++) if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL) - return (void *)h->t[(*pos)++].p; + return __DECONST(void *, h->t[(*pos)++].p); return NULL; } Index: misc.c =================================================================== --- misc.c (revision 269324) +++ misc.c (working copy) @@ -265,7 +265,7 @@ extern char *__progname; void -m4errx(int eval, const char *fmt, ...) +m4errx(int exval, const char *fmt, ...) { fprintf(stderr, "%s: ", __progname); fprintf(stderr, "%s at line %lu: ", CURRENT_NAME, CURRENT_LINE); @@ -277,7 +277,7 @@ va_end(ap); } fprintf(stderr, "\n"); - exit(eval); + exit(exval); } /* -- wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 08:07:24 2014 Return-Path: Delivered-To: svn-src-all@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 676AED95; Thu, 31 Jul 2014 08:07:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 545F227A4; Thu, 31 Jul 2014 08:07:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V87OMc040413; Thu, 31 Jul 2014 08:07:24 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V87N4Q040411; Thu, 31 Jul 2014 08:07:23 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201407310807.s6V87N4Q040411@svn.freebsd.org> From: Rui Paulo Date: Thu, 31 Jul 2014 08:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269325 - in head/sys: cddl/contrib/opensolaris/common/util modules/dtrace/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 08:07:24 -0000 Author: rpaulo Date: Thu Jul 31 08:07:23 2014 New Revision: 269325 URL: http://svnweb.freebsd.org/changeset/base/269325 Log: Copy strtolctype.h to sys/cddl/contrib/opensolaris/common/util to keep the kernel self-contained. Requested by: jhb Added: head/sys/cddl/contrib/opensolaris/common/util/ head/sys/cddl/contrib/opensolaris/common/util/strtolctype.h - copied unchanged from r268542, head/cddl/contrib/opensolaris/common/util/strtolctype.h Modified: head/sys/modules/dtrace/dtrace/Makefile Copied: head/sys/cddl/contrib/opensolaris/common/util/strtolctype.h (from r268542, head/cddl/contrib/opensolaris/common/util/strtolctype.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/common/util/strtolctype.h Thu Jul 31 08:07:23 2014 (r269325, copy of r268542, head/cddl/contrib/opensolaris/common/util/strtolctype.h) @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +#ifndef _COMMON_UTIL_CTYPE_H +#define _COMMON_UTIL_CTYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This header file contains a collection of macros that the strtou?ll? + * functions in common/util use to test characters. What we need is a kernel + * version of ctype.h. + * + * NOTE: These macros are used within several DTrace probe context functions. + * They must not be altered to make function calls or perform actions not + * safe in probe context. + */ + +#if defined(sun) && (defined(_KERNEL) || defined(_BOOT)) + +#define isalnum(ch) (isalpha(ch) || isdigit(ch)) +#define isalpha(ch) (isupper(ch) || islower(ch)) +#define isdigit(ch) ((ch) >= '0' && (ch) <= '9') +#define islower(ch) ((ch) >= 'a' && (ch) <= 'z') +#define isspace(ch) (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \ + ((ch) == '\t') || ((ch) == '\f')) +#define isupper(ch) ((ch) >= 'A' && (ch) <= 'Z') +#define isxdigit(ch) (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \ + ((ch) >= 'A' && (ch) <= 'F')) + +#endif /* _KERNEL || _BOOT */ + +#define DIGIT(x) \ + (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A') + +#define MBASE ('z' - 'a' + 1 + 10) + +/* + * The following macro is a version of isalnum() that limits alphabetic + * characters to the ranges a-z and A-Z; locale dependent characters will not + * return 1. The members of a-z and A-Z are assumed to be in ascending order + * and contiguous. + */ +#define lisalnum(x) \ + (isdigit(x) || ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) + +#ifdef __cplusplus +} +#endif + +#endif /* _COMMON_UTIL_CTYPE_H */ Modified: head/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- head/sys/modules/dtrace/dtrace/Makefile Thu Jul 31 07:27:59 2014 (r269324) +++ head/sys/modules/dtrace/dtrace/Makefile Thu Jul 31 08:07:23 2014 (r269325) @@ -4,8 +4,6 @@ SYSDIR?= ${.CURDIR}/../../.. ARCHDIR= ${MACHINE_CPUARCH} -SUNW= ${SYSDIR}/../cddl/contrib/opensolaris - .PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/common/dtrace .PATH: ${SYSDIR}/cddl/compat/opensolaris/kern .PATH: ${SYSDIR}/cddl/kern @@ -44,7 +42,7 @@ CFLAGS+= -I${SYSDIR}/cddl/compat/opensol -I${SYSDIR}/cddl/dev/dtrace \ -I${SYSDIR}/cddl/dev/dtrace/${ARCHDIR} \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ - -I${SUNW}/common/util \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/util \ -I${SYSDIR} -DDIS_MEM CFLAGS+= -DSMP From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 08:28:43 2014 Return-Path: Delivered-To: svn-src-all@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 251994E7; Thu, 31 Jul 2014 08:28:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 129F12979; Thu, 31 Jul 2014 08:28:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V8Sg6n049702; Thu, 31 Jul 2014 08:28:42 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V8Sghg049701; Thu, 31 Jul 2014 08:28:42 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <201407310828.s6V8Sghg049701@svn.freebsd.org> From: Nick Hibma Date: Thu, 31 Jul 2014 08:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269326 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 08:28:43 -0000 Author: n_hibma Date: Thu Jul 31 08:28:42 2014 New Revision: 269326 URL: http://svnweb.freebsd.org/changeset/base/269326 Log: Fix the example: free the memory that was allocated by getline(). Modified: head/lib/libc/stdio/getline.3 Modified: head/lib/libc/stdio/getline.3 ============================================================================== --- head/lib/libc/stdio/getline.3 Thu Jul 31 08:07:23 2014 (r269325) +++ head/lib/libc/stdio/getline.3 Thu Jul 31 08:28:42 2014 (r269326) @@ -95,6 +95,7 @@ size_t linecap = 0; ssize_t linelen; while ((linelen = getline(&line, &linecap, fp)) > 0) fwrite(line, linelen, 1, stdout); +free(line); .Ed .Sh COMPATIBILITY Many application writers used the name From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 08:29:09 2014 Return-Path: Delivered-To: svn-src-all@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 CEA9A625; Thu, 31 Jul 2014 08:29:09 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E609D297C; Thu, 31 Jul 2014 08:29:08 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id n3so3656032wiv.13 for ; Thu, 31 Jul 2014 01:29:07 -0700 (PDT) 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=fYQjCu/JXKfHdRoEz+TqpDfhPBjxnP3E86SQvkrO0Kk=; b=bx+glNtDyICgsIlemk3p5q77bOYVg/TEyQaIYOIIkY6JQ57Ij0Djuh87vOAOnlhkA0 qQ+9gTea40C+TVnNGT0Pkc9IoI3XbN1GFxRnfJ8ikuxHNuJP80GTgH2aGsnelzgAxtz6 oypK550VtSoS2JnoBvR1mUkuZ0jTgYthalu22kshT1TPyWb5mAL9cRCLTu1Uq1/N3AQt EIXqWGPEgPMUTnSQ3AEQ+olLPNfK/8tQv+FBmiYw0EJ/JOvI7CLxeRYYHvaPuvkwhszv RlCAK24hP4JtOirnB0uCiNLV7ny6+zRXd47M4KcsRDoDTrjAqte47Z4g98H0bxO5/+DE aVsA== X-Received: by 10.180.108.1 with SMTP id hg1mr14974825wib.25.1406795347145; Thu, 31 Jul 2014 01:29:07 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id ca8sm11736724wjc.0.2014.07.31.01.29.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 01:29:06 -0700 (PDT) Sender: Baptiste Daroussin Date: Thu, 31 Jul 2014 10:29:04 +0200 From: Baptiste Daroussin To: Sergey Kandaurov Subject: Re: svn commit: r269323 - head/usr.bin/m4 Message-ID: <20140731082903.GT37672@ivaldir.etoilebsd.net> References: <201407310556.s6V5uGWX080856@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FJ0JV+AOCbvjFtNn" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 08:29:09 -0000 --FJ0JV+AOCbvjFtNn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jul 31, 2014 at 11:51:23AM +0400, Sergey Kandaurov wrote: > On 31 July 2014 09:56, Baptiste Daroussin wrote: > > Author: bapt > > Date: Thu Jul 31 05:56:15 2014 > > New Revision: 269323 > > URL: http://svnweb.freebsd.org/changeset/base/269323 > > > > Log: > > lower warning level to fix build with gcc > > I tried to stay as close a possible to the OpenBSD version but sure go ahead I'll talk to upstream about it regards, Bapt --FJ0JV+AOCbvjFtNn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlPZ/k8ACgkQ8kTtMUmk6EwW0wCdGi+hjByXuwEAg7T+ijYsi6mS vykAoJKquu/c0Rqbxc17jgR158C9PpKv =9Xme -----END PGP SIGNATURE----- --FJ0JV+AOCbvjFtNn-- From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 09:00:37 2014 Return-Path: Delivered-To: svn-src-all@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 ADD642DB; Thu, 31 Jul 2014 09:00:37 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF5E62D3A; Thu, 31 Jul 2014 09:00:36 +0000 (UTC) Received: from [192.168.225.11] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s6V90Okk054182; Thu, 31 Jul 2014 11:00:30 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <53DA05A8.3020400@FreeBSD.org> Date: Thu, 31 Jul 2014 11:00:24 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alan Cox , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> <53D960E9.50905@rice.edu> <53D9630A.5050500@FreeBSD.org> <53D9C7A0.4010100@rice.edu> In-Reply-To: <53D9C7A0.4010100@rice.edu> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 09:00:37 -0000 On 31.07.14 06:35, Alan Cox wrote: > On 07/30/2014 16:26, Andreas Tobler wrote: >> On 30.07.14 23:17, Alan Cox wrote: >>> On 07/30/2014 15:15, Andreas Tobler wrote: >>>> On 30.07.14 21:54, Alan Cox wrote: >>>>> On 07/30/2014 14:46, Alan Cox wrote: >>>>>> On 07/30/2014 13:58, Andreas Tobler wrote: >>>>>>> Hi Alan, >>>>>>> >>>>>>> On 26.07.14 20:10, Alan Cox wrote: >>>>>>>> Author: alc >>>>>>>> Date: Sat Jul 26 18:10:18 2014 >>>>>>>> New Revision: 269134 >>>>>>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>>>>>> >>>>>>>> Log: >>>>>>>> When unwiring a region of an address space, do not assume that >>>>>>>> the >>>>>>>> underlying physical pages are mapped by the pmap. If, for >>>>>>>> example, the >>>>>>>> application has performed an mprotect(..., PROT_NONE) on >>>>>>>> any part >>>>>>>> of the >>>>>>>> wired region, then those pages will no longer be mapped by the >>>>>>>> pmap. >>>>>>>> So, using the pmap to lookup the wired pages in order to >>>>>>>> unwire them >>>>>>>> doesn't always work, and when it doesn't work wired pages are >>>>>>>> leaked. >>>>>>>> >>>>>>>> To avoid the leak, introduce and use a new function >>>>>>>> vm_object_unwire() >>>>>>>> that locates the wired pages by traversing the object and its >>>>>>>> backing >>>>>>>> objects. >>>>>>>> >>>>>>>> At the same time, switch from using pmap_change_wiring() to >>>>>>>> the >>>>>>>> recently >>>>>>>> introduced function pmap_unwire() for unwiring the region's >>>>>>>> mappings. >>>>>>>> pmap_unwire() is faster, because it operates a range of >>>>>>>> virtual >>>>>>>> addresses >>>>>>>> rather than a single virtual page at a time. Moreover, by >>>>>>>> operating on >>>>>>>> a range, it is superpage friendly. It doesn't waste time >>>>>>>> performing >>>>>>>> unnecessary demotions. >>>>>>>> >>>>>>>> Reported by: markj >>>>>>>> Reviewed by: kib >>>>>>>> Tested by: pho, jmg (arm) >>>>>>>> Sponsored by: EMC / Isilon Storage Division >>>>>>> This commit brings my 32- and 64-bit PowerMac's into panic. >>>>>>> Unfortunately I'm not able to give you a backtrace in the form of a >>>>>>> textdump nor of a core dump. >>>>>>> >>>>>>> The only thing I have is this picture: >>>>>>> >>>>>>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>>>>>> >>>>>>> Exactly this revision gives a panic and breaks the textdump/coredump >>>>>>> facility. >>>>>>> >>>>>>> How can I help debugging? >>>>>>> >>>>>> It appears to me that moea64_pvo_enter() had a pre-existing bug that >>>>>> got >>>>>> tickled by this change. Specifically, moea64_pvo_enter() doesn't set >>>>>> the PVO_WIRED flag when an unwired mapping already exists. It just >>>>>> returns with the mapping still in an unwired state. Consequently, >>>>>> when >>>>>> pmap_unwire() finally runs, it doesn't find a wired mapping. >>>>>> >>>>>> Try this: >>>>>> >>>>>> Index: powerpc/aim/mmu_oea64.c >>>>>> =================================================================== >>>>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>>>> uma_zone_t >>>>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>>>>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>>>>> == pa && >>>>>> (pvo->pvo_pte.lpte.pte_lo & >>>>>> (LPTE_NOEXEC | >>>>>> LPTE_PP)) >>>>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>>>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED)) { >>>>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>>>> LPTE_VALID)) { >>>>>> /* Re-insert if spilled */ >>>>>> i = MOEA64_PTE_INSERT(mmu, >>>>>> ptegidx, >>>>>> >>>>> >>>>> The new conditional test needs to be inverted. Try this instead: >>>>> >>>>> Index: powerpc/aim/mmu_oea64.c >>>>> =================================================================== >>>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>>> uma_zone_t >>>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { >>>>> if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) >>>>> == pa && >>>>> (pvo->pvo_pte.lpte.pte_lo & >>>>> (LPTE_NOEXEC | >>>>> LPTE_PP)) >>>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>>> + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == >>>>> 0) { >>>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>>> LPTE_VALID)) { >>>>> /* Re-insert if spilled */ >>>>> i = MOEA64_PTE_INSERT(mmu, >>>>> ptegidx, >>>>> >>>> >>>> >>>> The panic stays, but the message is different: >>>> >>>> panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in >>>> moea64_pteg_table but valid in pvo. >>>> >>> >>> My attempted fix is doing something else wrong. Do you have a stack >>> trace? >> >> iPhone sei Dank: >> >> http://people.freebsd.org/~andreast/r269134-1_panic.jpg > > Ok, this patch should fix both the original panic and the new one. They > are two distinct problems. Yep, thank you! Additionally I tried to adapt the 32-bit path and successfully booted the below, ok? Again, thanks a lot! Andreas Index: powerpc/aim/mmu_oea.c =================================================================== --- powerpc/aim/mmu_oea.c (revision 269326) +++ powerpc/aim/mmu_oea.c (working copy) @@ -1950,7 +1950,8 @@ if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { if ((pvo->pvo_pte.pte.pte_lo & PTE_RPGN) == pa && (pvo->pvo_pte.pte.pte_lo & PTE_PP) == - (pte_lo & PTE_PP)) { + (pte_lo & PTE_PP) && + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == 0) { mtx_unlock(&moea_table_mutex); return (0); } From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 09:18:16 2014 Return-Path: Delivered-To: svn-src-all@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 B961F94E; Thu, 31 Jul 2014 09:18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B7262F8B; Thu, 31 Jul 2014 09:18:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V9IGGi072169; Thu, 31 Jul 2014 09:18:16 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V9IG8O072166; Thu, 31 Jul 2014 09:18:16 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201407310918.s6V9IG8O072166@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 31 Jul 2014 09:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269327 - head/share/examples/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 09:18:16 -0000 Author: gnn Date: Thu Jul 31 09:18:15 2014 New Revision: 269327 URL: http://svnweb.freebsd.org/changeset/base/269327 Log: Add an example program to show how to use libpmc from a program. This particular program attempts to use the TSC to measure how long certainly libpmc operations take. Depending on the quality of the rdtsc() macro on a particular architecture this may work more or less well. Added: head/share/examples/hwpmc/Makefile (contents, props changed) head/share/examples/hwpmc/overhead.c (contents, props changed) Modified: head/share/examples/hwpmc/README Added: head/share/examples/hwpmc/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/hwpmc/Makefile Thu Jul 31 09:18:15 2014 (r269327) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG= overhead +LDFLAGS+= -lpmc +MAN= + +install: + +.include Modified: head/share/examples/hwpmc/README ============================================================================== --- head/share/examples/hwpmc/README Thu Jul 31 08:28:42 2014 (r269326) +++ head/share/examples/hwpmc/README Thu Jul 31 09:18:15 2014 (r269327) @@ -3,6 +3,4 @@ Examples illustrating the use of the hwpmc(4) driver and pmc(3) library interface. -While there is nothing here yet, the source code for pmccontrol(8) -and pmcstat(8) could serve as examples. Added: head/share/examples/hwpmc/overhead.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/hwpmc/overhead.c Thu Jul 31 09:18:15 2014 (r269327) @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014, Neville-Neil Consulting + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Neville-Neil Consulting nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + * Author: George V. Neville-Neil + * + * + */ + +#ifndef lint +static char rcsid [] = "$Header:$" ; +#endif + +/* + * Calculate the time overhead of starting, stopping, and recording + * pmc counters. + * + * The only argument is a counter name, such as "instruction-retired" + * which is CPU dependent and can be found with pmmcontrol(8) using + * pmccontrol -L. + * + * The start, stop, read and write operations are timed using the + * rdtsc() macro which reads the Time Stamp Counter on the CPU. + */ + +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + pmc_id_t pmcid; + pmc_value_t read_value; + pmc_value_t read_clear_value; + uint64_t tsc1, write_cyc, start_cyc, read_cyc, stop_cyc; + char *counter_name; + + if (argc != 2) + err(EX_USAGE, "counter-name required"); + + counter_name = argv[1]; + + if (pmc_init() != 0) + err(EX_OSERR, "hwpmc(4) not loaded, kldload or update your kernel"); + + if (pmc_allocate(counter_name, PMC_MODE_SC, 0, 0, &pmcid) < 0) + err(EX_OSERR, "failed to allocate %s as a system counter in counting mode", + counter_name); + + tsc1 = rdtsc(); + if (pmc_write(pmcid, 0) < 0) + err(EX_OSERR, "failed to zero counter %s", counter_name); + write_cyc = rdtsc() - tsc1; + + tsc1 = rdtsc(); + if (pmc_start(pmcid) < 0) + err(EX_OSERR, "failed to start counter %s", counter_name); + start_cyc = rdtsc() - tsc1; + + tsc1 = rdtsc(); + if (pmc_read(pmcid, &read_value) < 0) + err(EX_OSERR, "failed to read counter %s", counter_name); + read_cyc = rdtsc() - tsc1; + + tsc1 = rdtsc(); + if (pmc_stop(pmcid) < 0) + err(EX_OSERR, "failed to stop counter %s", counter_name); + stop_cyc = rdtsc() - tsc1; + + if (pmc_rw(pmcid, 0, &read_clear_value)) + err(EX_OSERR, "failed to read and zero %s", counter_name); + + if (pmc_release(pmcid) < 0) + err(EX_OSERR, "failed to release %s as a system counter in counting mode", + counter_name); + + printf("Counter %s, read value %ld, read/clear value %ld\n", + counter_name, read_value, read_clear_value); + printf("Cycles to start: %ld\tstop: %ld\tread: %ld\twrite: %ld\n", + start_cyc, stop_cyc, read_cyc, stop_cyc); + +} + From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 09:18:29 2014 Return-Path: Delivered-To: svn-src-all@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 E488EAB2; Thu, 31 Jul 2014 09:18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D291A2F8F; Thu, 31 Jul 2014 09:18:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6V9ITNf072232; Thu, 31 Jul 2014 09:18:29 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6V9IThb072231; Thu, 31 Jul 2014 09:18:29 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201407310918.s6V9IThb072231@svn.freebsd.org> From: Steven Hartland Date: Thu, 31 Jul 2014 09:18:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269328 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 09:18:30 -0000 Author: smh Date: Thu Jul 31 09:18:29 2014 New Revision: 269328 URL: http://svnweb.freebsd.org/changeset/base/269328 Log: Only check error if one could have been generated Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jul 31 09:18:15 2014 (r269327) +++ head/sys/netinet/in.c Thu Jul 31 09:18:29 2014 (r269328) @@ -418,20 +418,22 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, ia_hash); IN_IFADDR_WUNLOCK(); - if (vhid != 0) + if (vhid != 0) { error = (*carp_attach_p)(&ia->ia_ifa, vhid); - if (error) - goto fail1; + if (error) + goto fail1; + } /* * Give the interface a chance to initialize * if this is its first address, * and to validate the address if necessary. */ - if (ifp->if_ioctl != NULL) + if (ifp->if_ioctl != NULL) { error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia); - if (error) - goto fail2; + if (error) + goto fail2; + } /* * Add route for the network. From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 14:53:07 2014 Return-Path: Delivered-To: svn-src-all@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 D360A95C; Thu, 31 Jul 2014 14:53:07 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE491296E; Thu, 31 Jul 2014 14:53:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VEr7f4031076; Thu, 31 Jul 2014 14:53:07 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VEr7Js031072; Thu, 31 Jul 2014 14:53:07 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201407311453.s6VEr7Js031072@svn.freebsd.org> From: Warren Block Date: Thu, 31 Jul 2014 14:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269334 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 14:53:07 -0000 Author: wblock (doc committer) Date: Thu Jul 31 14:53:07 2014 New Revision: 269334 URL: http://svnweb.freebsd.org/changeset/base/269334 Log: MFC 268931: Correct spelling errors in ctld.8. While here, correct similar errors in ctl.conf.5 and fix a couple of contractions. Modified: stable/10/usr.sbin/ctld/ctl.conf.5 stable/10/usr.sbin/ctld/ctld.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Thu Jul 31 14:48:35 2014 (r269333) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Thu Jul 31 14:53:07 2014 (r269334) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2014 +.Dd July 20, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -104,14 +104,14 @@ The following statements are available a .It Ic auth-type Ao Ar type Ac Specifies authentication type. Type can be either "none", "deny", "chap", or "chap-mutual". -In most cases it is not neccessary to set the type using this clause; +In most cases it is not necessary to set the type using this clause; it is usually used to disable authentication for a given auth-group. .It Ic chap Ao Ar user Ac Aq Ar secret Specifies CHAP authentication credentials. .It Ic chap-mutual Ao Ar user Ac Ao Ar secret Ac Ao Ar mutualuser Ac Aq Ar mutualsecret Specifies mutual CHAP authentication credentials. Note that for any auth-group, configuration may contain either chap, -or chap-mutual entries; it's an error to mix them. +or chap-mutual entries; it is an error to mix them. .It Ic initiator-name Ao Ar initiator-name Ac Specifies iSCSI initiator name. If not defined, there will be no restrictions based on initiator @@ -158,18 +158,18 @@ without authentication. .It Ic auth-type Ao Ar type Ac Specifies authentication type. Type can be either "none", "deny", "chap", or "chap-mutual". -In most cases it is not neccessary to set the type using this clause; +In most cases it is not necessary to set the type using this clause; it is usually used to disable authentication for a given target. This clause is mutually exclusive with auth-group; one cannot use both in a single target. .It Ic chap Ao Ar user Ac Aq Ar secret Specifies CHAP authentication credentials. Note that targets must use either auth-group, or chap, -or chap-mutual clauses; it's a configuration error to mix them in one target. +or chap-mutual clauses; it is a configuration error to mix them in one target. .It Ic chap-mutual Ao Ar user Ac Ao Ar secret Ac Ao Ar mutualuser Ac Aq Ar mutualsecret Specifies mutual CHAP authentication credentials. Note that targets must use either auth-group, chap, or -chap-mutual clauses; it's a configuration error to mix them in one target. +chap-mutual clauses; it is a configuration error to mix them in one target. .It Ic initiator-name Ao Ar initiator-name Ac Specifies iSCSI initiator name. If not defined, there will be no restrictions based on initiator Modified: stable/10/usr.sbin/ctld/ctld.8 ============================================================================== --- stable/10/usr.sbin/ctld/ctld.8 Thu Jul 31 14:48:35 2014 (r269333) +++ stable/10/usr.sbin/ctld/ctld.8 Thu Jul 31 14:53:07 2014 (r269334) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 20, 2012 +.Dd July 20, 2014 .Dt CTLD 8 .Os .Sh NAME @@ -51,7 +51,7 @@ Then it compares the configuration with by previously running .Nm instances, removes LUNs no longer existing in the configuration file, -and creates new LUNs as neccessary. +and creates new LUNs as necessary. After that it listens for the incoming iSCSI connections, performs authentication, and, if successful, passes the connections to the kernel part of CTL iSCSI target, which handles it from that point. @@ -59,13 +59,13 @@ of CTL iSCSI target, which handles it fr When it receives a SIGHUP signal, the .Nm reloads its configuration and applies the changes to the kernel. -Changes are applied in a way that avoids unneccessary disruptions; +Changes are applied in a way that avoids unnecessary disruptions; for example removing one LUN does not affect other LUNs. .Pp When exiting gracefully, the .Nm daemon removes LUNs it managed and forcibly disconnects all the clients. -Otherwise - e.g. when killed with SIGKILL - LUNs stay configured +Otherwise - for example, when killed with SIGKILL - LUNs stay configured and clients remain connected. .Pp To perform administrative actions that apply to already connected From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 15:25:13 2014 Return-Path: Delivered-To: svn-src-all@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 03F91C9C; Thu, 31 Jul 2014 15:25: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E57832D2D; Thu, 31 Jul 2014 15:25:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VFPCFe049275; Thu, 31 Jul 2014 15:25:12 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VFPCQe049272; Thu, 31 Jul 2014 15:25:12 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407311525.s6VFPCQe049272@svn.freebsd.org> From: Ed Maste Date: Thu, 31 Jul 2014 15:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269337 - in head: sys/sys 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 15:25:13 -0000 Author: emaste Date: Thu Jul 31 15:25:12 2014 New Revision: 269337 URL: http://svnweb.freebsd.org/changeset/base/269337 Log: elfdump: add EM_AARCH64 64-bit ARM machine architecture Modified: head/sys/sys/elf_common.h head/usr.bin/elfdump/elfdump.c Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Thu Jul 31 15:15:46 2014 (r269336) +++ head/sys/sys/elf_common.h Thu Jul 31 15:25:12 2014 (r269337) @@ -237,6 +237,7 @@ typedef struct { #define EM_ARCA 109 /* Arca RISC Microprocessor. */ #define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */ +#define EM_AARCH64 183 /* AArch64 (64-bit ARM) */ /* Non-standard or deprecated. */ #define EM_486 6 /* Intel i486. */ Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Thu Jul 31 15:15:46 2014 (r269336) +++ head/usr.bin/elfdump/elfdump.c Thu Jul 31 15:25:12 2014 (r269337) @@ -267,6 +267,7 @@ e_machines(u_int mach) case EM_SPARCV9:return "EM_SPARCV9"; case EM_IA_64: return "EM_IA_64"; case EM_X86_64: return "EM_X86_64"; + case EM_AARCH64:return "EM_AARCH64"; } snprintf(machdesc, sizeof(machdesc), "(unknown machine) -- type 0x%x", mach); From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 15:40:03 2014 Return-Path: Delivered-To: svn-src-all@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 D18EE34F; Thu, 31 Jul 2014 15:40:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF3D12FA9; Thu, 31 Jul 2014 15:40:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VFe3Mg054358; Thu, 31 Jul 2014 15:40:03 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VFe38H054357; Thu, 31 Jul 2014 15:40:03 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201407311540.s6VFe38H054357@svn.freebsd.org> From: Ed Maste Date: Thu, 31 Jul 2014 15:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269338 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 15:40:03 -0000 Author: emaste Date: Thu Jul 31 15:40:03 2014 New Revision: 269338 URL: http://svnweb.freebsd.org/changeset/base/269338 Log: elfdump: use existing ELF constants where available Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/elfdump/elfdump.c Modified: head/usr.bin/elfdump/elfdump.c ============================================================================== --- head/usr.bin/elfdump/elfdump.c Thu Jul 31 15:25:12 2014 (r269337) +++ head/usr.bin/elfdump/elfdump.c Thu Jul 31 15:40:03 2014 (r269338) @@ -172,74 +172,74 @@ d_tags(u_int64_t tag) static char unknown_tag[48]; switch (tag) { - case 0: return "DT_NULL"; - case 1: return "DT_NEEDED"; - case 2: return "DT_PLTRELSZ"; - case 3: return "DT_PLTGOT"; - case 4: return "DT_HASH"; - case 5: return "DT_STRTAB"; - case 6: return "DT_SYMTAB"; - case 7: return "DT_RELA"; - case 8: return "DT_RELASZ"; - case 9: return "DT_RELAENT"; - case 10: return "DT_STRSZ"; - case 11: return "DT_SYMENT"; - case 12: return "DT_INIT"; - case 13: return "DT_FINI"; - case 14: return "DT_SONAME"; - case 15: return "DT_RPATH"; - case 16: return "DT_SYMBOLIC"; - case 17: return "DT_REL"; - case 18: return "DT_RELSZ"; - case 19: return "DT_RELENT"; - case 20: return "DT_PLTREL"; - case 21: return "DT_DEBUG"; - case 22: return "DT_TEXTREL"; - case 23: return "DT_JMPREL"; - case 24: return "DT_BIND_NOW"; - case 25: return "DT_INIT_ARRAY"; - case 26: return "DT_FINI_ARRAY"; - case 27: return "DT_INIT_ARRAYSZ"; - case 28: return "DT_FINI_ARRAYSZ"; - case 29: return "DT_RUNPATH"; - case 30: return "DT_FLAGS"; - case 32: return "DT_PREINIT_ARRAY"; /* XXX: DT_ENCODING */ - case 33: return "DT_PREINIT_ARRAYSZ"; + case DT_NULL: return "DT_NULL"; + case DT_NEEDED: return "DT_NEEDED"; + case DT_PLTRELSZ: return "DT_PLTRELSZ"; + case DT_PLTGOT: return "DT_PLTGOT"; + case DT_HASH: return "DT_HASH"; + case DT_STRTAB: return "DT_STRTAB"; + case DT_SYMTAB: return "DT_SYMTAB"; + case DT_RELA: return "DT_RELA"; + case DT_RELASZ: return "DT_RELASZ"; + case DT_RELAENT: return "DT_RELAENT"; + case DT_STRSZ: return "DT_STRSZ"; + case DT_SYMENT: return "DT_SYMENT"; + case DT_INIT: return "DT_INIT"; + case DT_FINI: return "DT_FINI"; + case DT_SONAME: return "DT_SONAME"; + case DT_RPATH: return "DT_RPATH"; + case DT_SYMBOLIC: return "DT_SYMBOLIC"; + case DT_REL: return "DT_REL"; + case DT_RELSZ: return "DT_RELSZ"; + case DT_RELENT: return "DT_RELENT"; + case DT_PLTREL: return "DT_PLTREL"; + case DT_DEBUG: return "DT_DEBUG"; + case DT_TEXTREL: return "DT_TEXTREL"; + case DT_JMPREL: return "DT_JMPREL"; + case DT_BIND_NOW: return "DT_BIND_NOW"; + case DT_INIT_ARRAY: return "DT_INIT_ARRAY"; + case DT_FINI_ARRAY: return "DT_FINI_ARRAY"; + case DT_INIT_ARRAYSZ: return "DT_INIT_ARRAYSZ"; + case DT_FINI_ARRAYSZ: return "DT_FINI_ARRAYSZ"; + case DT_RUNPATH: return "DT_RUNPATH"; + case DT_FLAGS: return "DT_FLAGS"; + case DT_PREINIT_ARRAY: return "DT_PREINIT_ARRAY"; /* XXX DT_ENCODING */ + case DT_PREINIT_ARRAYSZ:return "DT_PREINIT_ARRAYSZ"; /* 0x6000000D - 0x6ffff000 operating system-specific semantics */ - case 0x6ffffdf5: return "DT_GNU_PRELINKED"; - case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ"; - case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ"; - case 0x6ffffdf8: return "DT_SUNW_CHECKSUM"; - case 0x6ffffdf9: return "DT_PLTPADSZ"; - case 0x6ffffdfa: return "DT_MOVEENT"; - case 0x6ffffdfb: return "DT_MOVESZ"; - case 0x6ffffdfc: return "DT_FEATURE"; - case 0x6ffffdfd: return "DT_POSFLAG_1"; - case 0x6ffffdfe: return "DT_SYMINSZ"; - case 0x6ffffdff: return "DT_SYMINENT (DT_VALRNGHI)"; - case 0x6ffffe00: return "DT_ADDRRNGLO"; - case 0x6ffffef5: return "DT_GNU_HASH"; - case 0x6ffffef8: return "DT_GNU_CONFLICT"; - case 0x6ffffef9: return "DT_GNU_LIBLIST"; - case 0x6ffffefa: return "DT_SUNW_CONFIG"; - case 0x6ffffefb: return "DT_SUNW_DEPAUDIT"; - case 0x6ffffefc: return "DT_SUNW_AUDIT"; - case 0x6ffffefd: return "DT_SUNW_PLTPAD"; - case 0x6ffffefe: return "DT_SUNW_MOVETAB"; - case 0x6ffffeff: return "DT_SYMINFO (DT_ADDRRNGHI)"; - case 0x6ffffff9: return "DT_RELACOUNT"; - case 0x6ffffffa: return "DT_RELCOUNT"; - case 0x6ffffffb: return "DT_FLAGS_1"; - case 0x6ffffffc: return "DT_VERDEF"; - case 0x6ffffffd: return "DT_VERDEFNUM"; - case 0x6ffffffe: return "DT_VERNEED"; - case 0x6fffffff: return "DT_VERNEEDNUM"; - case 0x6ffffff0: return "DT_GNU_VERSYM"; + case 0x6ffffdf5: return "DT_GNU_PRELINKED"; + case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ"; + case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ"; + case 0x6ffffdf8: return "DT_SUNW_CHECKSUM"; + case DT_PLTPADSZ: return "DT_PLTPADSZ"; + case DT_MOVEENT: return "DT_MOVEENT"; + case DT_MOVESZ: return "DT_MOVESZ"; + case 0x6ffffdfc: return "DT_FEATURE"; + case DT_POSFLAG_1: return "DT_POSFLAG_1"; + case DT_SYMINSZ: return "DT_SYMINSZ"; + case DT_SYMINENT : return "DT_SYMINENT (DT_VALRNGHI)"; + case DT_ADDRRNGLO: return "DT_ADDRRNGLO"; + case DT_GNU_HASH: return "DT_GNU_HASH"; + case 0x6ffffef8: return "DT_GNU_CONFLICT"; + case 0x6ffffef9: return "DT_GNU_LIBLIST"; + case 0x6ffffefa: return "DT_SUNW_CONFIG"; + case 0x6ffffefb: return "DT_SUNW_DEPAUDIT"; + case 0x6ffffefc: return "DT_SUNW_AUDIT"; + case 0x6ffffefd: return "DT_SUNW_PLTPAD"; + case 0x6ffffefe: return "DT_SUNW_MOVETAB"; + case DT_SYMINFO : return "DT_SYMINFO (DT_ADDRRNGHI)"; + case DT_RELACOUNT: return "DT_RELACOUNT"; + case DT_RELCOUNT: return "DT_RELCOUNT"; + case DT_FLAGS_1: return "DT_FLAGS_1"; + case DT_VERDEF: return "DT_VERDEF"; + case DT_VERDEFNUM: return "DT_VERDEFNUM"; + case DT_VERNEED: return "DT_VERNEED"; + case DT_VERNEEDNUM: return "DT_VERNEEDNUM"; + case 0x6ffffff0: return "DT_GNU_VERSYM"; /* 0x70000000 - 0x7fffffff processor-specific semantics */ - case 0x70000000: return "DT_IA_64_PLT_RESERVE"; - case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; - case 0x7ffffffe: return "DT_SUNW_USED"; - case 0x7fffffff: return "DT_SUNW_FILTER"; + case 0x70000000: return "DT_IA_64_PLT_RESERVE"; + case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; + case 0x7ffffffe: return "DT_SUNW_USED"; + case 0x7fffffff: return "DT_SUNW_FILTER"; } snprintf(unknown_tag, sizeof(unknown_tag), "ERROR: TAG NOT DEFINED -- tag 0x%jx", (uintmax_t)tag); @@ -315,23 +315,23 @@ sh_types(uint64_t machine, uint64_t sht) if (sht < 0x60000000) { switch (sht) { - case 0: return "SHT_NULL"; - case 1: return "SHT_PROGBITS"; - case 2: return "SHT_SYMTAB"; - case 3: return "SHT_STRTAB"; - case 4: return "SHT_RELA"; - case 5: return "SHT_HASH"; - case 6: return "SHT_DYNAMIC"; - case 7: return "SHT_NOTE"; - case 8: return "SHT_NOBITS"; - case 9: return "SHT_REL"; - case 10: return "SHT_SHLIB"; - case 11: return "SHT_DYNSYM"; - case 14: return "SHT_INIT_ARRAY"; - case 15: return "SHT_FINI_ARRAY"; - case 16: return "SHT_PREINIT_ARRAY"; - case 17: return "SHT_GROUP"; - case 18: return "SHT_SYMTAB_SHNDX"; + case SHT_NULL: return "SHT_NULL"; + case SHT_PROGBITS: return "SHT_PROGBITS"; + case SHT_SYMTAB: return "SHT_SYMTAB"; + case SHT_STRTAB: return "SHT_STRTAB"; + case SHT_RELA: return "SHT_RELA"; + case SHT_HASH: return "SHT_HASH"; + case SHT_DYNAMIC: return "SHT_DYNAMIC"; + case SHT_NOTE: return "SHT_NOTE"; + case SHT_NOBITS: return "SHT_NOBITS"; + case SHT_REL: return "SHT_REL"; + case SHT_SHLIB: return "SHT_SHLIB"; + case SHT_DYNSYM: return "SHT_DYNSYM"; + case SHT_INIT_ARRAY: return "SHT_INIT_ARRAY"; + case SHT_FINI_ARRAY: return "SHT_FINI_ARRAY"; + case SHT_PREINIT_ARRAY: return "SHT_PREINIT_ARRAY"; + case SHT_GROUP: return "SHT_GROUP"; + case SHT_SYMTAB_SHNDX: return "SHT_SYMTAB_SHNDX"; } snprintf(unknown_buf, sizeof(unknown_buf), "ERROR: SHT %ju NOT DEFINED", (uintmax_t)sht); @@ -339,14 +339,14 @@ sh_types(uint64_t machine, uint64_t sht) } else if (sht < 0x70000000) { /* 0x60000000-0x6fffffff operating system-specific semantics */ switch (sht) { - case 0x6ffffff0: return "XXX:VERSYM"; - case 0x6ffffff4: return "SHT_SUNW_dof"; - case 0x6ffffff6: return "SHT_GNU_HASH"; - case 0x6ffffff7: return "SHT_GNU_LIBLIST"; - case 0x6ffffffc: return "XXX:VERDEF"; - case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef"; - case 0x6ffffffe: return "SHT_SUNW(GNU)_verneed"; - case 0x6fffffff: return "SHT_SUNW(GNU)_versym"; + case 0x6ffffff0: return "XXX:VERSYM"; + case SHT_SUNW_dof: return "SHT_SUNW_dof"; + case SHT_GNU_HASH: return "SHT_GNU_HASH"; + case 0x6ffffff7: return "SHT_GNU_LIBLIST"; + case 0x6ffffffc: return "XXX:VERDEF"; + case SHT_SUNW_verdef: return "SHT_SUNW(GNU)_verdef"; + case SHT_SUNW_verneed: return "SHT_SUNW(GNU)_verneed"; + case SHT_SUNW_versym: return "SHT_SUNW(GNU)_versym"; } snprintf(unknown_buf, sizeof(unknown_buf), "ERROR: OS-SPECIFIC SHT 0x%jx NOT DEFINED", @@ -357,16 +357,13 @@ sh_types(uint64_t machine, uint64_t sht) switch (machine) { case EM_ARM: switch (sht) { - case 0x70000001: return "SHT_ARM_EXIDX"; - case 0x70000002: return "SHT_ARM_PREEMPTMAP"; - case 0x70000003: return "SHT_ARM_ATTRIBUTES"; - case 0x70000004: return "SHT_ARM_DEBUGOVERLAY"; - case 0x70000005: return "SHT_ARM_OVERLAYSECTION"; - } - break; - case EM_MIPS: - switch (sht) { - case 0x7000000d: return "SHT_MIPS_OPTIONS"; + case SHT_ARM_EXIDX: return "SHT_ARM_EXIDX"; + case SHT_ARM_PREEMPTMAP:return "SHT_ARM_PREEMPTMAP"; + case SHT_ARM_ATTRIBUTES:return "SHT_ARM_ATTRIBUTES"; + case SHT_ARM_DEBUGOVERLAY: + return "SHT_ARM_DEBUGOVERLAY"; + case SHT_ARM_OVERLAYSECTION: + return "SHT_ARM_OVERLAYSECTION"; } break; case EM_IA_64: @@ -375,6 +372,11 @@ sh_types(uint64_t machine, uint64_t sht) case 0x70000001: return "SHT_IA_64_UNWIND"; } break; + case EM_MIPS: + switch (sht) { + case SHT_MIPS_OPTIONS: return "SHT_MIPS_OPTIONS"; + } + break; } switch (sht) { case 0x7ffffffd: return "XXX:AUXILIARY"; From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 15:43:52 2014 Return-Path: Delivered-To: svn-src-all@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 90E93518; Thu, 31 Jul 2014 15:43:52 +0000 (UTC) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39ECB20B0; Thu, 31 Jul 2014 15:43:52 +0000 (UTC) Received: by mail-ig0-f174.google.com with SMTP id c1so9663942igq.13 for ; Thu, 31 Jul 2014 08:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=foNpRrmk0X0Rkk8zm+VDqMpzpbB40CcnebGJ9CM7zAQ=; b=03tenDxvtFPpDo6oyPfanymBeMOJmDUvobLP4+sdPRTd55juYOAt5NJyShyfdxsnC2 Z60FDXR9srkkCrsE2SkVjZpNn4YNdeCziOST3xyjMdGaEeeS+HLIUz787zox5DNGMugg HCI9zoUfaFWmcaldfSpRrn7zYDjApTlHScHvSghPrOFa8+aKvzURgEibOWq2qvvTVpZf BslyFVY96DoedsPtMVzgmRX2FLVQlhl5BbW2Bu78bXG9hk+b8HTAWDiEE/04SHTYkSi0 JWQCyN2g+HKWwOwXyc7NBEDHIg+50ABoxAMQofHsdDz+QluzEPZZeYxEMo6PXFlafmrH uZ+g== MIME-Version: 1.0 X-Received: by 10.50.134.232 with SMTP id pn8mr67549151igb.11.1406821430037; Thu, 31 Jul 2014 08:43:50 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.107.131.38 with HTTP; Thu, 31 Jul 2014 08:43:49 -0700 (PDT) In-Reply-To: <1406404842.56408.26.camel@revolution.hippie.lan> References: <201407261944.s6QJikAI024004@svn.freebsd.org> <1406404842.56408.26.camel@revolution.hippie.lan> Date: Thu, 31 Jul 2014 11:43:49 -0400 X-Google-Sender-Auth: AQCtPWpHEhspetq_zRQ4Z0Ursxk Message-ID: Subject: Re: svn commit: r269143 - head/usr.bin/elfdump From: Ed Maste To: Ian Lepore Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Andreas Tobler X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 15:43:52 -0000 On 26 July 2014 16:00, Ian Lepore wrote: >> + case EM_ARM: >> + switch (sht) { >> + case 0x70000001: return "SHT_ARM_EXIDX"; >> + case 0x70000002: return "SHT_ARM_PREEMPTMAP"; >> + case 0x70000003: return "SHT_ARM_ATTRIBUTES"; >> + case 0x70000004: return "SHT_ARM_DEBUGOVERLAY"; >> + case 0x70000005: return "SHT_ARM_OVERLAYSECTION"; >> + } >> + break; >> case EM_MIPS: >> switch (sht) { >> case 0x7000000d: return "SHT_MIPS_OPTIONS"; >> > > I'm curious why this code is all full of 0xnnnnnnnn numbers when there > are named constants defined for all this stuff. I don't think there's a good reason for it. It seems to have just evolved that way after sh_types() and d_tags() switched from an array of names, when the first non-contiguous entries were added. In r269338 I've replaced the constants with #defines that exist. From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 16:17:30 2014 Return-Path: Delivered-To: svn-src-all@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 BDAC2C44; Thu, 31 Jul 2014 16:17:30 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB5DE25AB; Thu, 31 Jul 2014 16:17:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VGHUL1073266; Thu, 31 Jul 2014 16:17:30 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VGHUex073265; Thu, 31 Jul 2014 16:17:30 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201407311617.s6VGHUex073265@svn.freebsd.org> From: Alan Cox Date: Thu, 31 Jul 2014 16:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269339 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 16:17:30 -0000 Author: alc Date: Thu Jul 31 16:17:30 2014 New Revision: 269339 URL: http://svnweb.freebsd.org/changeset/base/269339 Log: Correct a defect in r268591. In the implementation of the new function pmap_unwire(), the call to MOEA64_PVO_TO_PTE() must be performed before any changes are made to the PVO. Otherwise, MOEA64_PVO_TO_PTE() will panic. Reported by: andreast Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Jul 31 15:40:03 2014 (r269338) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Jul 31 16:17:30 2014 (r269339) @@ -1090,6 +1090,7 @@ moea64_unwire(mmu_t mmu, pmap_t pm, vm_o for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); pvo != NULL && PVO_VADDR(pvo) < eva; pvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo)) { + pt = MOEA64_PVO_TO_PTE(mmu, pvo); if ((pvo->pvo_vaddr & PVO_WIRED) == 0) panic("moea64_unwire: pvo %p is missing PVO_WIRED", pvo); @@ -1098,7 +1099,7 @@ moea64_unwire(mmu_t mmu, pmap_t pm, vm_o panic("moea64_unwire: pte %p is missing LPTE_WIRED", &pvo->pvo_pte.lpte); pvo->pvo_pte.lpte.pte_hi &= ~LPTE_WIRED; - if ((pt = MOEA64_PVO_TO_PTE(mmu, pvo)) != -1) { + if (pt != -1) { /* * The PTE's wired attribute is not a hardware * feature, so there is no need to invalidate any TLB From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 16:43:57 2014 Return-Path: Delivered-To: svn-src-all@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 0BBA581D; Thu, 31 Jul 2014 16:43: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D42ED289D; Thu, 31 Jul 2014 16:43:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VGhuPL086178; Thu, 31 Jul 2014 16:43:56 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VGhucH086177; Thu, 31 Jul 2014 16:43:56 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201407311643.s6VGhucH086177@svn.freebsd.org> From: Steven Hartland Date: Thu, 31 Jul 2014 16:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269340 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 16:43:57 -0000 Author: smh Date: Thu Jul 31 16:43:56 2014 New Revision: 269340 URL: http://svnweb.freebsd.org/changeset/base/269340 Log: Ensure that IP's added to CARP always use the CARP MAC Previously there was a race condition between the address addition and associating it with the CARP which resulted in the interface MAC, instead of the CARP MAC, being used for a brief amount of time. This caused "is using my IP address" warnings as well as data being sent to the wrong machine due to incorrect ARP entries being recorded by other devices on the network. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jul 31 16:17:30 2014 (r269339) +++ head/sys/netinet/in.c Thu Jul 31 16:43:56 2014 (r269340) @@ -407,6 +407,12 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat if (ifp->if_flags & IFF_LOOPBACK) ia->ia_dstaddr = ia->ia_addr; + if (vhid != 0) { + error = (*carp_attach_p)(&ia->ia_ifa, vhid); + if (error) + return (error); + } + /* if_addrhead is already referenced by ifa_alloc() */ IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); @@ -418,12 +424,6 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, ia_hash); IN_IFADDR_WUNLOCK(); - if (vhid != 0) { - error = (*carp_attach_p)(&ia->ia_ifa, vhid); - if (error) - goto fail1; - } - /* * Give the interface a chance to initialize * if this is its first address, @@ -432,7 +432,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat if (ifp->if_ioctl != NULL) { error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia); if (error) - goto fail2; + goto fail1; } /* @@ -446,7 +446,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat error = in_addprefix(ia, flags); if (error) - goto fail2; + goto fail1; } /* @@ -464,7 +464,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat error = ifa_add_loopback_route((struct ifaddr *)ia, (struct sockaddr *)&ia->ia_addr); if (error) - goto fail3; + goto fail2; } else ifa_free(&eia->ia_ifa); } @@ -484,15 +484,14 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat return (error); -fail3: +fail2: if (vhid == 0) (void )in_scrubprefix(ia, LLE_STATIC); -fail2: +fail1: if (ia->ia_ifa.ifa_carp) (*carp_detach_p)(&ia->ia_ifa); -fail1: IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 16:54:55 2014 Return-Path: Delivered-To: svn-src-all@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 CBDE9BCA; Thu, 31 Jul 2014 16:54: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B906229A4; Thu, 31 Jul 2014 16:54:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VGstwt090734; Thu, 31 Jul 2014 16:54:55 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VGstu4090731; Thu, 31 Jul 2014 16:54:55 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201407311654.s6VGstu4090731@svn.freebsd.org> From: Ian Lepore Date: Thu, 31 Jul 2014 16:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269341 - head/sys/dev/mmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 16:54:55 -0000 Author: ian Date: Thu Jul 31 16:54:54 2014 New Revision: 269341 URL: http://svnweb.freebsd.org/changeset/base/269341 Log: Export an mmc or sd card's serial number from the mmc layer as an ivar. In the mmcsd layer use this value to populate disk->d_ident. Also set disk->d_descr to the full set of card identification info (includes vendor, model, manufacturing date, etc). Modified: head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmcsd.c head/sys/dev/mmc/mmcvar.h Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Thu Jul 31 16:43:56 2014 (r269340) +++ head/sys/dev/mmc/mmc.c Thu Jul 31 16:54:54 2014 (r269341) @@ -102,6 +102,7 @@ struct mmc_ivars { uint32_t hs_tran_speed; /* Max speed in high speed mode */ uint32_t erase_sector; /* Card native erase sector size */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ + char card_sn_string[16];/* Formatted serial # for disk->d_ident */ }; #define CMD_RETRIES 3 @@ -887,6 +888,9 @@ mmc_format_card_id_string(struct mmc_iva * mmcsd0: 968MB at mmc0 * 22.5MHz/4bit/128-block * + * Also format just the card serial number, which the mmcsd driver will + * use as the disk->d_ident string. + * * The card_id_string in mmc_ivars is currently allocated as 64 bytes, * and our max formatted length is currently 55 bytes if every field * contains the largest value. @@ -900,8 +904,10 @@ mmc_format_card_id_string(struct mmc_iva snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2); else snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid); + snprintf(ivar->card_sn_string, sizeof(ivar->card_sn_string), + "%08X", ivar->cid.psn); snprintf(ivar->card_id_string, sizeof(ivar->card_id_string), - "%s%s %s %d.%d SN %u MFG %02d/%04d by %d %s", + "%s%s %s %d.%d SN %08X MFG %02d/%04d by %d %s", ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "", ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f, ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year, @@ -1698,6 +1704,9 @@ mmc_read_ivar(device_t bus, device_t chi case MMC_IVAR_CARD_ID_STRING: *(char **)result = ivar->card_id_string; break; + case MMC_IVAR_CARD_SN_STRING: + *(char **)result = ivar->card_sn_string; + break; } return (0); } Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Thu Jul 31 16:43:56 2014 (r269340) +++ head/sys/dev/mmc/mmcsd.c Thu Jul 31 16:54:54 2014 (r269341) @@ -163,6 +163,9 @@ mmcsd_attach(device_t dev) d->d_unit = device_get_unit(dev); d->d_flags = DISKFLAG_CANDELETE; d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize * 1; /* conservative */ + strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); + strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr)); + /* * Display in most natural units. There's no cards < 1MB. The SD * standard goes to 2GiB due to its reliance on FAT, but the data @@ -188,7 +191,7 @@ mmcsd_attach(device_t dev) speed = mmcbr_get_clock(device_get_parent(dev)); maxblocks = mmc_get_max_data(dev); device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n", - mb, unit, mmc_get_card_id_string(dev), + mb, unit, d->d_descr, mmc_get_read_only(dev) ? " (read-only)" : "", device_get_nameunit(device_get_parent(dev)), speed / 1000000, (speed / 100000) % 10, Modified: head/sys/dev/mmc/mmcvar.h ============================================================================== --- head/sys/dev/mmc/mmcvar.h Thu Jul 31 16:43:56 2014 (r269340) +++ head/sys/dev/mmc/mmcvar.h Thu Jul 31 16:54:54 2014 (r269341) @@ -69,11 +69,12 @@ enum mmc_device_ivars { MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, MMC_IVAR_MAX_DATA, - MMC_IVAR_CARD_ID_STRING + MMC_IVAR_CARD_ID_STRING, + MMC_IVAR_CARD_SN_STRING, }; /* - * Simplified accessors for pci devices + * Simplified accessors for mmc devices */ #define MMC_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(mmc, var, MMC, ivar, type) @@ -90,5 +91,6 @@ MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) MMC_ACCESSOR(max_data, MAX_DATA, int) MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *) +MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *) #endif /* DEV_MMC_MMCVAR_H */ From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 17:10:04 2014 Return-Path: Delivered-To: svn-src-all@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 49629483; Thu, 31 Jul 2014 17:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3385B2B1E; Thu, 31 Jul 2014 17:10:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VHA41p097076; Thu, 31 Jul 2014 17:10:04 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VHA3Oj097059; Thu, 31 Jul 2014 17:10:03 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407311710.s6VHA3Oj097059@svn.freebsd.org> From: Mark Johnston Date: Thu, 31 Jul 2014 17:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269342 - in stable/10/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys contrib/opensolaris/uts/intel/dtrace dev/dtrace X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 17:10:04 -0000 Author: markj Date: Thu Jul 31 17:10:03 2014 New Revision: 269342 URL: http://svnweb.freebsd.org/changeset/base/269342 Log: MFC r264434: DTrace's pid provider works by inserting breakpoint instructions at probe sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some common cases, but otherwise copies it out into some scratch space in the traced process' address space and ensures that it's executed after returning from the trap. In Solaris and illumos, this (per-thread) scratch space comes from some reserved space in TLS, accessible via the fs segment register. This approach is somewhat unappealing on FreeBSD since it would require some modifications to rtld and jemalloc (for static TLS) to ensure that TLS is executable, and would thus introduce dependencies on their implementation details. I think it would also be impossible to safely trace static binaries compiled without these modifications. This change implements the functionality in a different way, by having fasttrap map pages into the target process' address space on demand. Each page is divided into 64-byte chunks for use by individual threads, and fasttrap's process descriptor struct has been extended to keep track of any scratch space allocated for the corresponding process. With this change it's possible to trace all libc functions in a program, e.g. with pid$target:libc.so.*::entry {@[probefunc] = count();} Previously this would generally cause the victim process to crash, as tracing memcpy on amd64 requires the functionality described above. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c stable/10/sys/cddl/dev/dtrace/dtrace_cddl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Jul 31 16:54:54 2014 (r269341) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Jul 31 17:10:03 2014 (r269342) @@ -61,8 +61,13 @@ #include #include #if !defined(sun) -#include #include +#include +#include +#include +#include +#include +#include #include #include #endif @@ -207,6 +212,10 @@ static void fasttrap_provider_free(fastt static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); static void fasttrap_proc_release(fasttrap_proc_t *); +#if !defined(sun) +static void fasttrap_thread_dtor(void *, struct thread *); +#endif + #define FASTTRAP_PROVS_INDEX(pid, name) \ ((fasttrap_hash_str(name) + (pid)) & fasttrap_provs.fth_mask) @@ -214,6 +223,7 @@ static void fasttrap_proc_release(fasttr #if !defined(sun) static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; +static eventhandler_tag fasttrap_thread_dtor_tag; #endif static int @@ -290,6 +300,118 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t #endif } +#if !defined(sun) +/* + * Obtain a chunk of scratch space in the address space of the target process. + */ +fasttrap_scrspace_t * +fasttrap_scraddr(struct thread *td, fasttrap_proc_t *fprc) +{ + fasttrap_scrblock_t *scrblk; + fasttrap_scrspace_t *scrspc; + struct proc *p; + vm_offset_t addr; + int error, i; + + scrspc = NULL; + if (td->t_dtrace_sscr != NULL) { + /* If the thread already has scratch space, we're done. */ + scrspc = (fasttrap_scrspace_t *)td->t_dtrace_sscr; + return (scrspc); + } + + p = td->td_proc; + + mutex_enter(&fprc->ftpc_mtx); + if (LIST_EMPTY(&fprc->ftpc_fscr)) { + /* + * No scratch space is available, so we'll map a new scratch + * space block into the traced process' address space. + */ + addr = 0; + error = vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &addr, + FASTTRAP_SCRBLOCK_SIZE, 0, VMFS_ANY_SPACE, VM_PROT_ALL, + VM_PROT_ALL, 0); + if (error != KERN_SUCCESS) + goto done; + + scrblk = malloc(sizeof(*scrblk), M_SOLARIS, M_WAITOK); + scrblk->ftsb_addr = addr; + LIST_INSERT_HEAD(&fprc->ftpc_scrblks, scrblk, ftsb_next); + + /* + * Carve the block up into chunks and put them on the free list. + */ + for (i = 0; + i < FASTTRAP_SCRBLOCK_SIZE / FASTTRAP_SCRSPACE_SIZE; i++) { + scrspc = malloc(sizeof(*scrspc), M_SOLARIS, M_WAITOK); + scrspc->ftss_addr = addr + + i * FASTTRAP_SCRSPACE_SIZE; + LIST_INSERT_HEAD(&fprc->ftpc_fscr, scrspc, + ftss_next); + } + } + + /* + * Take the first scratch chunk off the free list, put it on the + * allocated list, and return its address. + */ + scrspc = LIST_FIRST(&fprc->ftpc_fscr); + LIST_REMOVE(scrspc, ftss_next); + LIST_INSERT_HEAD(&fprc->ftpc_ascr, scrspc, ftss_next); + + /* + * This scratch space is reserved for use by td until the thread exits. + */ + td->t_dtrace_sscr = scrspc; + +done: + mutex_exit(&fprc->ftpc_mtx); + + return (scrspc); +} + +/* + * Return any allocated per-thread scratch space chunks back to the process' + * free list. + */ +static void +fasttrap_thread_dtor(void *arg __unused, struct thread *td) +{ + fasttrap_bucket_t *bucket; + fasttrap_proc_t *fprc; + fasttrap_scrspace_t *scrspc; + pid_t pid; + + if (td->t_dtrace_sscr == NULL) + return; + + pid = td->td_proc->p_pid; + bucket = &fasttrap_procs.fth_table[FASTTRAP_PROCS_INDEX(pid)]; + fprc = NULL; + + /* Look up the fasttrap process handle for this process. */ + mutex_enter(&bucket->ftb_mtx); + for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) { + if (fprc->ftpc_pid == pid) { + mutex_enter(&fprc->ftpc_mtx); + mutex_exit(&bucket->ftb_mtx); + break; + } + } + if (fprc == NULL) { + mutex_exit(&bucket->ftb_mtx); + return; + } + + scrspc = (fasttrap_scrspace_t *)td->t_dtrace_sscr; + LIST_REMOVE(scrspc, ftss_next); + LIST_INSERT_HEAD(&fprc->ftpc_fscr, scrspc, ftss_next); + + mutex_exit(&fprc->ftpc_mtx); +} +#endif + /* * This function ensures that no threads are actively using the memory * associated with probes that were formerly live. @@ -450,6 +572,10 @@ fasttrap_pid_cleanup(void) static void fasttrap_fork(proc_t *p, proc_t *cp) { +#if !defined(sun) + fasttrap_scrblock_t *scrblk; + fasttrap_proc_t *fprc = NULL; +#endif pid_t ppid = p->p_pid; int i; @@ -535,9 +661,28 @@ fasttrap_fork(proc_t *p, proc_t *cp) * mid-fork. */ ASSERT(tp->ftt_proc->ftpc_acount != 0); +#if !defined(sun) + fprc = tp->ftt_proc; +#endif } } mutex_exit(&bucket->ftb_mtx); + +#if !defined(sun) + /* + * Unmap any scratch space inherited from the parent's address + * space. + */ + if (fprc != NULL) { + mutex_enter(&fprc->ftpc_mtx); + LIST_FOREACH(scrblk, &fprc->ftpc_scrblks, ftsb_next) { + vm_map_remove(&cp->p_vmspace->vm_map, + scrblk->ftsb_addr, + scrblk->ftsb_addr + FASTTRAP_SCRBLOCK_SIZE); + } + mutex_exit(&fprc->ftpc_mtx); + } +#endif } #if defined(sun) @@ -558,12 +703,24 @@ fasttrap_fork(proc_t *p, proc_t *cp) static void fasttrap_exec_exit(proc_t *p) { +#if !defined(sun) + struct thread *td; +#endif + #if defined(sun) ASSERT(p == curproc); -#endif +#else PROC_LOCK_ASSERT(p, MA_OWNED); _PHOLD(p); + /* + * Since struct threads may be recycled, we cannot rely on t_dtrace_sscr + * fields to be zeroed by kdtrace_thread_ctor. Thus we must zero it + * ourselves when a process exits. + */ + FOREACH_THREAD_IN_PROC(p, td) + td->t_dtrace_sscr = NULL; PROC_UNLOCK(p); +#endif /* * We clean up the pid provider for this process here; user-land @@ -573,9 +730,9 @@ fasttrap_exec_exit(proc_t *p) #if !defined(sun) if (p->p_dtrace_helpers) dtrace_helpers_destroy(p); -#endif PROC_LOCK(p); _PRELE(p); +#endif } @@ -1368,6 +1525,12 @@ fasttrap_proc_release(fasttrap_proc_t *p fasttrap_bucket_t *bucket; fasttrap_proc_t *fprc, **fprcp; pid_t pid = proc->ftpc_pid; +#if !defined(sun) + fasttrap_scrblock_t *scrblk, *scrblktmp; + fasttrap_scrspace_t *scrspc, *scrspctmp; + struct proc *p; + struct thread *td; +#endif mutex_enter(&proc->ftpc_mtx); @@ -1379,6 +1542,31 @@ fasttrap_proc_release(fasttrap_proc_t *p return; } +#if !defined(sun) + /* + * Free all structures used to manage per-thread scratch space. + */ + LIST_FOREACH_SAFE(scrblk, &proc->ftpc_scrblks, ftsb_next, + scrblktmp) { + LIST_REMOVE(scrblk, ftsb_next); + free(scrblk, M_SOLARIS); + } + LIST_FOREACH_SAFE(scrspc, &proc->ftpc_fscr, ftss_next, scrspctmp) { + LIST_REMOVE(scrspc, ftss_next); + free(scrspc, M_SOLARIS); + } + LIST_FOREACH_SAFE(scrspc, &proc->ftpc_ascr, ftss_next, scrspctmp) { + LIST_REMOVE(scrspc, ftss_next); + free(scrspc, M_SOLARIS); + } + + if ((p = pfind(pid)) != NULL) { + FOREACH_THREAD_IN_PROC(p, td) + td->t_dtrace_sscr = NULL; + PROC_UNLOCK(p); + } +#endif + mutex_exit(&proc->ftpc_mtx); /* @@ -2362,6 +2550,13 @@ fasttrap_load(void) mutex_init(&fasttrap_cpuc_pid_lock[i], "fasttrap barrier", MUTEX_DEFAULT, NULL); } + + /* + * This event handler must run before kdtrace_thread_dtor() since it + * accesses the thread's struct kdtrace_thread. + */ + fasttrap_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + fasttrap_thread_dtor, NULL, EVENTHANDLER_PRI_FIRST); #endif /* @@ -2463,6 +2658,8 @@ fasttrap_unload(void) #endif #if !defined(sun) + EVENTHANDLER_DEREGISTER(thread_dtor, fasttrap_thread_dtor_tag); + for (i = 0; i < fasttrap_tpoints.fth_nent; i++) mutex_destroy(&fasttrap_tpoints.fth_table[i].ftb_mtx); for (i = 0; i < fasttrap_provs.fth_nent; i++) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jul 31 16:54:54 2014 (r269341) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jul 31 17:10:03 2014 (r269342) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -68,14 +69,41 @@ extern "C" { * then disabled, ownership of that tracepoint may be exchanged for an * unused tracepoint belonging to another probe that was attached to the * enabled tracepoint. + * + * On FreeBSD, fasttrap providers also maintain per-thread scratch space for use + * by the ISA-specific fasttrap code. The fasttrap_scrblock_t type stores the + * virtual address of a page-sized memory block that is mapped into a process' + * address space. Each block is carved up into chunks (fasttrap_scrspace_t) for + * use by individual threads, which keep the address of their scratch space + * chunk in their struct kdtrace_thread. A thread's scratch space isn't released + * until it exits. */ +#if !defined(sun) +typedef struct fasttrap_scrblock { + vm_offset_t ftsb_addr; /* address of a scratch block */ + LIST_ENTRY(fasttrap_scrblock) ftsb_next;/* next block in list */ +} fasttrap_scrblock_t; +#define FASTTRAP_SCRBLOCK_SIZE PAGE_SIZE + +typedef struct fasttrap_scrspace { + uintptr_t ftss_addr; /* scratch space address */ + LIST_ENTRY(fasttrap_scrspace) ftss_next;/* next in list */ +} fasttrap_scrspace_t; +#define FASTTRAP_SCRSPACE_SIZE 64 +#endif + typedef struct fasttrap_proc { pid_t ftpc_pid; /* process ID for this proc */ uint64_t ftpc_acount; /* count of active providers */ uint64_t ftpc_rcount; /* count of extant providers */ kmutex_t ftpc_mtx; /* lock on all but acount */ struct fasttrap_proc *ftpc_next; /* next proc in hash chain */ +#if !defined(sun) + LIST_HEAD(, fasttrap_scrblock) ftpc_scrblks; /* mapped scratch blocks */ + LIST_HEAD(, fasttrap_scrspace) ftpc_fscr; /* free scratch space */ + LIST_HEAD(, fasttrap_scrspace) ftpc_ascr; /* used scratch space */ +#endif } fasttrap_proc_t; typedef struct fasttrap_provider { @@ -170,6 +198,10 @@ typedef struct fasttrap_hash { #endif extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t); +#if !defined(sun) +extern fasttrap_scrspace_t *fasttrap_scraddr(struct thread *, + fasttrap_proc_t *); +#endif extern dtrace_id_t fasttrap_probe_id; extern fasttrap_hash_t fasttrap_tpoints; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jul 31 16:54:54 2014 (r269341) +++ stable/10/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jul 31 17:10:03 2014 (r269342) @@ -1526,7 +1526,6 @@ fasttrap_pid_probe(struct reg *rp) uint_t i = 0; #if defined(sun) klwp_t *lwp = ttolwp(curthread); -#endif /* * Compute the address of the ulwp_t and step over the @@ -1534,7 +1533,6 @@ fasttrap_pid_probe(struct reg *rp) * thread pointer is very different on 32- and 64-bit * kernels. */ -#if defined(sun) #if defined(__amd64) if (p->p_model == DATAMODEL_LP64) { addr = lwp->lwp_pcb.pcb_fsbase; @@ -1547,13 +1545,23 @@ fasttrap_pid_probe(struct reg *rp) addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc); addr += sizeof (void *); #endif -#endif /* sun */ -#ifdef __i386__ - addr = USD_GETBASE(&curthread->td_pcb->pcb_gsd); #else - addr = curthread->td_pcb->pcb_gsbase; -#endif - addr += sizeof (void *); + fasttrap_scrspace_t *scrspace; + scrspace = fasttrap_scraddr(curthread, tp->ftt_proc); + if (scrspace == NULL) { + /* + * We failed to allocate scratch space for this thread. + * Try to write the original instruction back out and + * reset the pc. + */ + if (fasttrap_copyout(tp->ftt_instr, (void *)pc, + tp->ftt_size)) + fasttrap_sigtrap(p, curthread, pc); + new_pc = pc; + break; + } + addr = scrspace->ftss_addr; +#endif /* sun */ /* * Generic Instruction Tracing Modified: stable/10/sys/cddl/dev/dtrace/dtrace_cddl.h ============================================================================== --- stable/10/sys/cddl/dev/dtrace/dtrace_cddl.h Thu Jul 31 16:54:54 2014 (r269341) +++ stable/10/sys/cddl/dev/dtrace/dtrace_cddl.h Thu Jul 31 17:10:03 2014 (r269342) @@ -84,6 +84,7 @@ typedef struct kdtrace_thread { #endif u_int64_t td_hrtime; /* Last time on cpu. */ int td_errno; /* Syscall return value. */ + void *td_dtrace_sscr; /* Saved scratch space location. */ } kdtrace_thread_t; /* @@ -108,10 +109,12 @@ typedef struct kdtrace_thread { #define t_dtrace_scrpc td_dtrace->td_dtrace_scrpc #define t_dtrace_astpc td_dtrace->td_dtrace_astpc #define t_dtrace_regv td_dtrace->td_dtrace_regv +#define t_dtrace_sscr td_dtrace->td_dtrace_sscr #define p_dtrace_helpers p_dtrace->p_dtrace_helpers #define p_dtrace_count p_dtrace->p_dtrace_count #define p_dtrace_probes p_dtrace->p_dtrace_probes #define p_model p_dtrace->p_dtrace_model + #define DATAMODEL_NATIVE 0 #ifdef __amd64__ #define DATAMODEL_LP64 0 From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 17:10:06 2014 Return-Path: Delivered-To: svn-src-all@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 F3202484; Thu, 31 Jul 2014 17:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD8762B1F; Thu, 31 Jul 2014 17:10:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VHA57d097666; Thu, 31 Jul 2014 17:10:05 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VHA5nG097321; Thu, 31 Jul 2014 17:10:05 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201407311710.s6VHA5nG097321@svn.freebsd.org> From: Mark Johnston Date: Thu, 31 Jul 2014 17:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269343 - in stable/9/sys/cddl: contrib/opensolaris/uts/common/dtrace contrib/opensolaris/uts/common/sys contrib/opensolaris/uts/intel/dtrace dev/dtrace X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 17:10:06 -0000 Author: markj Date: Thu Jul 31 17:10:04 2014 New Revision: 269343 URL: http://svnweb.freebsd.org/changeset/base/269343 Log: MFC r264434: DTrace's pid provider works by inserting breakpoint instructions at probe sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some common cases, but otherwise copies it out into some scratch space in the traced process' address space and ensures that it's executed after returning from the trap. In Solaris and illumos, this (per-thread) scratch space comes from some reserved space in TLS, accessible via the fs segment register. This approach is somewhat unappealing on FreeBSD since it would require some modifications to rtld and jemalloc (for static TLS) to ensure that TLS is executable, and would thus introduce dependencies on their implementation details. I think it would also be impossible to safely trace static binaries compiled without these modifications. This change implements the functionality in a different way, by having fasttrap map pages into the target process' address space on demand. Each page is divided into 64-byte chunks for use by individual threads, and fasttrap's process descriptor struct has been extended to keep track of any scratch space allocated for the corresponding process. With this change it's possible to trace all libc functions in a program, e.g. with pid$target:libc.so.*::entry {@[probefunc] = count();} Previously this would generally cause the victim process to crash, as tracing memcpy on amd64 requires the functionality described above. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c stable/9/sys/cddl/dev/dtrace/dtrace_cddl.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Jul 31 17:10:03 2014 (r269342) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Jul 31 17:10:04 2014 (r269343) @@ -61,8 +61,13 @@ #include #include #if !defined(sun) -#include #include +#include +#include +#include +#include +#include +#include #include #endif @@ -206,6 +211,10 @@ static void fasttrap_provider_free(fastt static fasttrap_proc_t *fasttrap_proc_lookup(pid_t); static void fasttrap_proc_release(fasttrap_proc_t *); +#if !defined(sun) +static void fasttrap_thread_dtor(void *, struct thread *); +#endif + #define FASTTRAP_PROVS_INDEX(pid, name) \ ((fasttrap_hash_str(name) + (pid)) & fasttrap_provs.fth_mask) @@ -213,6 +222,7 @@ static void fasttrap_proc_release(fasttr #if !defined(sun) static kmutex_t fasttrap_cpuc_pid_lock[MAXCPU]; +static eventhandler_tag fasttrap_thread_dtor_tag; #endif static int @@ -289,6 +299,118 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t #endif } +#if !defined(sun) +/* + * Obtain a chunk of scratch space in the address space of the target process. + */ +fasttrap_scrspace_t * +fasttrap_scraddr(struct thread *td, fasttrap_proc_t *fprc) +{ + fasttrap_scrblock_t *scrblk; + fasttrap_scrspace_t *scrspc; + struct proc *p; + vm_offset_t addr; + int error, i; + + scrspc = NULL; + if (td->t_dtrace_sscr != NULL) { + /* If the thread already has scratch space, we're done. */ + scrspc = (fasttrap_scrspace_t *)td->t_dtrace_sscr; + return (scrspc); + } + + p = td->td_proc; + + mutex_enter(&fprc->ftpc_mtx); + if (LIST_EMPTY(&fprc->ftpc_fscr)) { + /* + * No scratch space is available, so we'll map a new scratch + * space block into the traced process' address space. + */ + addr = 0; + error = vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &addr, + FASTTRAP_SCRBLOCK_SIZE, VMFS_ANY_SPACE, VM_PROT_ALL, + VM_PROT_ALL, 0); + if (error != KERN_SUCCESS) + goto done; + + scrblk = malloc(sizeof(*scrblk), M_SOLARIS, M_WAITOK); + scrblk->ftsb_addr = addr; + LIST_INSERT_HEAD(&fprc->ftpc_scrblks, scrblk, ftsb_next); + + /* + * Carve the block up into chunks and put them on the free list. + */ + for (i = 0; + i < FASTTRAP_SCRBLOCK_SIZE / FASTTRAP_SCRSPACE_SIZE; i++) { + scrspc = malloc(sizeof(*scrspc), M_SOLARIS, M_WAITOK); + scrspc->ftss_addr = addr + + i * FASTTRAP_SCRSPACE_SIZE; + LIST_INSERT_HEAD(&fprc->ftpc_fscr, scrspc, + ftss_next); + } + } + + /* + * Take the first scratch chunk off the free list, put it on the + * allocated list, and return its address. + */ + scrspc = LIST_FIRST(&fprc->ftpc_fscr); + LIST_REMOVE(scrspc, ftss_next); + LIST_INSERT_HEAD(&fprc->ftpc_ascr, scrspc, ftss_next); + + /* + * This scratch space is reserved for use by td until the thread exits. + */ + td->t_dtrace_sscr = scrspc; + +done: + mutex_exit(&fprc->ftpc_mtx); + + return (scrspc); +} + +/* + * Return any allocated per-thread scratch space chunks back to the process' + * free list. + */ +static void +fasttrap_thread_dtor(void *arg __unused, struct thread *td) +{ + fasttrap_bucket_t *bucket; + fasttrap_proc_t *fprc; + fasttrap_scrspace_t *scrspc; + pid_t pid; + + if (td->t_dtrace_sscr == NULL) + return; + + pid = td->td_proc->p_pid; + bucket = &fasttrap_procs.fth_table[FASTTRAP_PROCS_INDEX(pid)]; + fprc = NULL; + + /* Look up the fasttrap process handle for this process. */ + mutex_enter(&bucket->ftb_mtx); + for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) { + if (fprc->ftpc_pid == pid) { + mutex_enter(&fprc->ftpc_mtx); + mutex_exit(&bucket->ftb_mtx); + break; + } + } + if (fprc == NULL) { + mutex_exit(&bucket->ftb_mtx); + return; + } + + scrspc = (fasttrap_scrspace_t *)td->t_dtrace_sscr; + LIST_REMOVE(scrspc, ftss_next); + LIST_INSERT_HEAD(&fprc->ftpc_fscr, scrspc, ftss_next); + + mutex_exit(&fprc->ftpc_mtx); +} +#endif + /* * This function ensures that no threads are actively using the memory * associated with probes that were formerly live. @@ -449,6 +571,10 @@ fasttrap_pid_cleanup(void) static void fasttrap_fork(proc_t *p, proc_t *cp) { +#if !defined(sun) + fasttrap_scrblock_t *scrblk; + fasttrap_proc_t *fprc = NULL; +#endif pid_t ppid = p->p_pid; int i; @@ -528,9 +654,28 @@ fasttrap_fork(proc_t *p, proc_t *cp) * mid-fork. */ ASSERT(tp->ftt_proc->ftpc_acount != 0); +#if !defined(sun) + fprc = tp->ftt_proc; +#endif } } mutex_exit(&bucket->ftb_mtx); + +#if !defined(sun) + /* + * Unmap any scratch space inherited from the parent's address + * space. + */ + if (fprc != NULL) { + mutex_enter(&fprc->ftpc_mtx); + LIST_FOREACH(scrblk, &fprc->ftpc_scrblks, ftsb_next) { + vm_map_remove(&cp->p_vmspace->vm_map, + scrblk->ftsb_addr, + scrblk->ftsb_addr + FASTTRAP_SCRBLOCK_SIZE); + } + mutex_exit(&fprc->ftpc_mtx); + } +#endif } #if defined(sun) @@ -549,12 +694,24 @@ fasttrap_fork(proc_t *p, proc_t *cp) static void fasttrap_exec_exit(proc_t *p) { +#if !defined(sun) + struct thread *td; +#endif + #if defined(sun) ASSERT(p == curproc); -#endif +#else PROC_LOCK_ASSERT(p, MA_OWNED); _PHOLD(p); + /* + * Since struct threads may be recycled, we cannot rely on t_dtrace_sscr + * fields to be zeroed by kdtrace_thread_ctor. Thus we must zero it + * ourselves when a process exits. + */ + FOREACH_THREAD_IN_PROC(p, td) + td->t_dtrace_sscr = NULL; PROC_UNLOCK(p); +#endif /* * We clean up the pid provider for this process here; user-land @@ -564,9 +721,9 @@ fasttrap_exec_exit(proc_t *p) #if !defined(sun) if (p->p_dtrace_helpers) dtrace_helpers_destroy(p); -#endif PROC_LOCK(p); _PRELE(p); +#endif } @@ -1359,6 +1516,12 @@ fasttrap_proc_release(fasttrap_proc_t *p fasttrap_bucket_t *bucket; fasttrap_proc_t *fprc, **fprcp; pid_t pid = proc->ftpc_pid; +#if !defined(sun) + fasttrap_scrblock_t *scrblk, *scrblktmp; + fasttrap_scrspace_t *scrspc, *scrspctmp; + struct proc *p; + struct thread *td; +#endif mutex_enter(&proc->ftpc_mtx); @@ -1370,6 +1533,31 @@ fasttrap_proc_release(fasttrap_proc_t *p return; } +#if !defined(sun) + /* + * Free all structures used to manage per-thread scratch space. + */ + LIST_FOREACH_SAFE(scrblk, &proc->ftpc_scrblks, ftsb_next, + scrblktmp) { + LIST_REMOVE(scrblk, ftsb_next); + free(scrblk, M_SOLARIS); + } + LIST_FOREACH_SAFE(scrspc, &proc->ftpc_fscr, ftss_next, scrspctmp) { + LIST_REMOVE(scrspc, ftss_next); + free(scrspc, M_SOLARIS); + } + LIST_FOREACH_SAFE(scrspc, &proc->ftpc_ascr, ftss_next, scrspctmp) { + LIST_REMOVE(scrspc, ftss_next); + free(scrspc, M_SOLARIS); + } + + if ((p = pfind(pid)) != NULL) { + FOREACH_THREAD_IN_PROC(p, td) + td->t_dtrace_sscr = NULL; + PROC_UNLOCK(p); + } +#endif + mutex_exit(&proc->ftpc_mtx); /* @@ -2355,6 +2543,13 @@ fasttrap_load(void) mutex_init(&fasttrap_cpuc_pid_lock[i], "fasttrap barrier", MUTEX_DEFAULT, NULL); } + + /* + * This event handler must run before kdtrace_thread_dtor() since it + * accesses the thread's struct kdtrace_thread. + */ + fasttrap_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + fasttrap_thread_dtor, NULL, EVENTHANDLER_PRI_FIRST); #endif /* @@ -2456,6 +2651,8 @@ fasttrap_unload(void) #endif #if !defined(sun) + EVENTHANDLER_DEREGISTER(thread_dtor, fasttrap_thread_dtor_tag); + for (i = 0; i < fasttrap_tpoints.fth_nent; i++) mutex_destroy(&fasttrap_tpoints.fth_table[i].ftb_mtx); for (i = 0; i < fasttrap_provs.fth_nent; i++) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jul 31 17:10:03 2014 (r269342) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap_impl.h Thu Jul 31 17:10:04 2014 (r269343) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -68,14 +69,41 @@ extern "C" { * then disabled, ownership of that tracepoint may be exchanged for an * unused tracepoint belonging to another probe that was attached to the * enabled tracepoint. + * + * On FreeBSD, fasttrap providers also maintain per-thread scratch space for use + * by the ISA-specific fasttrap code. The fasttrap_scrblock_t type stores the + * virtual address of a page-sized memory block that is mapped into a process' + * address space. Each block is carved up into chunks (fasttrap_scrspace_t) for + * use by individual threads, which keep the address of their scratch space + * chunk in their struct kdtrace_thread. A thread's scratch space isn't released + * until it exits. */ +#if !defined(sun) +typedef struct fasttrap_scrblock { + vm_offset_t ftsb_addr; /* address of a scratch block */ + LIST_ENTRY(fasttrap_scrblock) ftsb_next;/* next block in list */ +} fasttrap_scrblock_t; +#define FASTTRAP_SCRBLOCK_SIZE PAGE_SIZE + +typedef struct fasttrap_scrspace { + uintptr_t ftss_addr; /* scratch space address */ + LIST_ENTRY(fasttrap_scrspace) ftss_next;/* next in list */ +} fasttrap_scrspace_t; +#define FASTTRAP_SCRSPACE_SIZE 64 +#endif + typedef struct fasttrap_proc { pid_t ftpc_pid; /* process ID for this proc */ uint64_t ftpc_acount; /* count of active providers */ uint64_t ftpc_rcount; /* count of extant providers */ kmutex_t ftpc_mtx; /* lock on all but acount */ struct fasttrap_proc *ftpc_next; /* next proc in hash chain */ +#if !defined(sun) + LIST_HEAD(, fasttrap_scrblock) ftpc_scrblks; /* mapped scratch blocks */ + LIST_HEAD(, fasttrap_scrspace) ftpc_fscr; /* free scratch space */ + LIST_HEAD(, fasttrap_scrspace) ftpc_ascr; /* used scratch space */ +#endif } fasttrap_proc_t; typedef struct fasttrap_provider { @@ -170,6 +198,10 @@ typedef struct fasttrap_hash { #endif extern void fasttrap_sigtrap(proc_t *, kthread_t *, uintptr_t); +#if !defined(sun) +extern fasttrap_scrspace_t *fasttrap_scraddr(struct thread *, + fasttrap_proc_t *); +#endif extern dtrace_id_t fasttrap_probe_id; extern fasttrap_hash_t fasttrap_tpoints; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jul 31 17:10:03 2014 (r269342) +++ stable/9/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Thu Jul 31 17:10:04 2014 (r269343) @@ -1526,7 +1526,6 @@ fasttrap_pid_probe(struct reg *rp) uint_t i = 0; #if defined(sun) klwp_t *lwp = ttolwp(curthread); -#endif /* * Compute the address of the ulwp_t and step over the @@ -1534,7 +1533,6 @@ fasttrap_pid_probe(struct reg *rp) * thread pointer is very different on 32- and 64-bit * kernels. */ -#if defined(sun) #if defined(__amd64) if (p->p_model == DATAMODEL_LP64) { addr = lwp->lwp_pcb.pcb_fsbase; @@ -1547,13 +1545,23 @@ fasttrap_pid_probe(struct reg *rp) addr = USD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc); addr += sizeof (void *); #endif -#endif /* sun */ -#ifdef __i386__ - addr = USD_GETBASE(&curthread->td_pcb->pcb_gsd); #else - addr = curthread->td_pcb->pcb_gsbase; -#endif - addr += sizeof (void *); + fasttrap_scrspace_t *scrspace; + scrspace = fasttrap_scraddr(curthread, tp->ftt_proc); + if (scrspace == NULL) { + /* + * We failed to allocate scratch space for this thread. + * Try to write the original instruction back out and + * reset the pc. + */ + if (fasttrap_copyout(tp->ftt_instr, (void *)pc, + tp->ftt_size)) + fasttrap_sigtrap(p, curthread, pc); + new_pc = pc; + break; + } + addr = scrspace->ftss_addr; +#endif /* sun */ /* * Generic Instruction Tracing Modified: stable/9/sys/cddl/dev/dtrace/dtrace_cddl.h ============================================================================== --- stable/9/sys/cddl/dev/dtrace/dtrace_cddl.h Thu Jul 31 17:10:03 2014 (r269342) +++ stable/9/sys/cddl/dev/dtrace/dtrace_cddl.h Thu Jul 31 17:10:04 2014 (r269343) @@ -84,6 +84,7 @@ typedef struct kdtrace_thread { #endif u_int64_t td_hrtime; /* Last time on cpu. */ int td_errno; /* Syscall return value. */ + void *td_dtrace_sscr; /* Saved scratch space location. */ } kdtrace_thread_t; /* @@ -108,10 +109,12 @@ typedef struct kdtrace_thread { #define t_dtrace_scrpc td_dtrace->td_dtrace_scrpc #define t_dtrace_astpc td_dtrace->td_dtrace_astpc #define t_dtrace_regv td_dtrace->td_dtrace_regv +#define t_dtrace_sscr td_dtrace->td_dtrace_sscr #define p_dtrace_helpers p_dtrace->p_dtrace_helpers #define p_dtrace_count p_dtrace->p_dtrace_count #define p_dtrace_probes p_dtrace->p_dtrace_probes #define p_model p_dtrace->p_dtrace_model + #define DATAMODEL_NATIVE 0 #ifdef __amd64__ #define DATAMODEL_LP64 0 From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 17:18:41 2014 Return-Path: Delivered-To: svn-src-all@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 66541923; Thu, 31 Jul 2014 17:18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 515BF2C95; Thu, 31 Jul 2014 17:18:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VHIfIF002036; Thu, 31 Jul 2014 17:18:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VHIe78002031; Thu, 31 Jul 2014 17:18:40 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201407311718.s6VHIe78002031@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 31 Jul 2014 17:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269344 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 17:18:41 -0000 Author: hselasky Date: Thu Jul 31 17:18:40 2014 New Revision: 269344 URL: http://svnweb.freebsd.org/changeset/base/269344 Log: - Updated SYSCTL manual pages after recent changes to the kernel SYSCTL code. Added description of new macros and functions. - Merged dynamic and static SYSCTL related content into a single manual page, hence parameters and functionality is very much the same. - Uppercased all occurrences of "OID". - Updated all SYSCTL examples. PR: 192101 Modified: head/share/man/man9/Makefile head/share/man/man9/sysctl.9 head/share/man/man9/sysctl_add_oid.9 head/share/man/man9/sysctl_ctx_init.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Thu Jul 31 17:10:04 2014 (r269343) +++ head/share/man/man9/Makefile Thu Jul 31 17:18:40 2014 (r269344) @@ -1351,33 +1351,36 @@ MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_xlocked.9 \ sx.9 sx_xunlock.9 MLINKS+=sysctl.9 SYSCTL_DECL.9 \ + sysctl.9 SYSCTL_ADD_INT.9 \ + sysctl.9 SYSCTL_ADD_LONG.9 \ + sysctl.9 SYSCTL_ADD_NODE.9 \ + sysctl.9 SYSCTL_ADD_OPAQUE.9 \ + sysctl.9 SYSCTL_ADD_PROC.9 \ + sysctl.9 SYSCTL_ADD_QUAD.9 \ + sysctl.9 SYSCTL_ADD_ROOT_NODE.9 \ + sysctl.9 SYSCTL_ADD_STRING.9 \ + sysctl.9 SYSCTL_ADD_STRUCT.9 \ + sysctl.9 SYSCTL_ADD_UINT.9 \ + sysctl.9 SYSCTL_ADD_ULONG.9 \ + sysctl.9 SYSCTL_ADD_UQUAD.9 \ + sysctl.9 SYSCTL_CHILDREN.9 \ + sysctl.9 SYSCTL_STATIC_CHILDREN.9 \ + sysctl.9 SYSCTL_NODE_CHILDREN.9 \ + sysctl.9 SYSCTL_PARENT.9 \ sysctl.9 SYSCTL_INT.9 \ sysctl.9 SYSCTL_LONG.9 \ sysctl.9 SYSCTL_NODE.9 \ sysctl.9 SYSCTL_OPAQUE.9 \ sysctl.9 SYSCTL_PROC.9 \ sysctl.9 SYSCTL_QUAD.9 \ + sysctl.9 SYSCTL_ROOT_NODE.9 \ sysctl.9 SYSCTL_STRING.9 \ sysctl.9 SYSCTL_STRUCT.9 \ sysctl.9 SYSCTL_UINT.9 \ sysctl.9 SYSCTL_ULONG.9 \ sysctl.9 SYSCTL_UQUAD.9 -MLINKS+=sysctl_add_oid.9 SYSCTL_ADD_INT.9 \ - sysctl_add_oid.9 SYSCTL_ADD_LONG.9 \ - sysctl_add_oid.9 SYSCTL_ADD_NODE.9 \ - sysctl_add_oid.9 SYSCTL_ADD_OID.9 \ - sysctl_add_oid.9 SYSCTL_ADD_OPAQUE.9 \ - sysctl_add_oid.9 SYSCTL_ADD_PROC.9 \ - sysctl_add_oid.9 SYSCTL_ADD_QUAD.9 \ - sysctl_add_oid.9 SYSCTL_ADD_STRING.9 \ - sysctl_add_oid.9 SYSCTL_ADD_STRUCT.9 \ - sysctl_add_oid.9 SYSCTL_ADD_UINT.9 \ - sysctl_add_oid.9 SYSCTL_ADD_ULONG.9 \ - sysctl_add_oid.9 SYSCTL_ADD_UQUAD.9 \ - sysctl_add_oid.9 SYSCTL_CHILDREN.9 \ - sysctl_add_oid.9 sysctl_move_oid.9 \ - sysctl_add_oid.9 sysctl_remove_oid.9 \ - sysctl_add_oid.9 SYSCTL_STATIC_CHILDREN.9 +MLINKS+=sysctl_add_oid.9 sysctl_move_oid.9 \ + sysctl_add_oid.9 sysctl_remove_oid.9 MLINKS+=sysctl_ctx_init.9 sysctl_ctx_entry_add.9 \ sysctl_ctx_init.9 sysctl_ctx_entry_del.9 \ sysctl_ctx_init.9 sysctl_ctx_entry_find.9 \ Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Thu Jul 31 17:10:04 2014 (r269343) +++ head/share/man/man9/sysctl.9 Thu Jul 31 17:18:40 2014 (r269344) @@ -25,79 +25,421 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 2013 +.Dd July 31, 2014 .Dt SYSCTL 9 .Os .Sh NAME .Nm SYSCTL_DECL , +.Nm SYSCTL_ADD_INT , +.Nm SYSCTL_ADD_LONG , +.Nm SYSCTL_ADD_NODE , +.Nm SYSCTL_ADD_OPAQUE , +.Nm SYSCTL_ADD_PROC , +.Nm SYSCTL_ADD_QUAD , +.Nm SYSCTL_ADD_ROOT_NODE , +.Nm SYSCTL_ADD_STRING , +.Nm SYSCTL_ADD_STRUCT , +.Nm SYSCTL_ADD_UINT , +.Nm SYSCTL_ADD_ULONG , +.Nm SYSCTL_ADD_UQUAD , +.Nm SYSCTL_CHILDREN , +.Nm SYSCTL_STATIC_CHILDREN , +.Nm SYSCTL_NODE_CHILDREN , +.Nm SYSCTL_PARENT , .Nm SYSCTL_INT , .Nm SYSCTL_LONG , .Nm SYSCTL_NODE , .Nm SYSCTL_OPAQUE , .Nm SYSCTL_PROC , .Nm SYSCTL_QUAD , +.Nm SYSCTL_ROOT_NODE , .Nm SYSCTL_STRING , .Nm SYSCTL_STRUCT , .Nm SYSCTL_UINT , .Nm SYSCTL_ULONG , .Nm SYSCTL_UQUAD -.Nd Static sysctl declaration functions +.Nd Dynamic and static sysctl MIB creation functions .Sh SYNOPSIS .In sys/types.h .In sys/sysctl.h .Fn SYSCTL_DECL name -.Fn SYSCTL_INT parent nbr name access ptr val descr -.Fn SYSCTL_LONG parent nbr name access ptr val descr -.Fn SYSCTL_NODE parent nbr name access handler descr -.Fn SYSCTL_OPAQUE parent nbr name access ptr len fmt descr -.Fn SYSCTL_PROC parent nbr name access ptr arg handler fmt descr -.Fn SYSCTL_QUAD parent nbr name access ptr val descr -.Fn SYSCTL_STRING parent nbr name access arg len descr -.Fn SYSCTL_STRUCT parent nbr name access ptr type descr -.Fn SYSCTL_UINT parent nbr name access ptr val descr -.Fn SYSCTL_ULONG parent nbr name access ptr val descr -.Fn SYSCTL_UQUAD parent nbr name access ptr val descr +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_INT +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "int *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_LONG +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "long *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_NODE +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "int (*handler)(SYSCTL_HANDLER_ARGS)" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_OPAQUE +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *ptr" +.Fa "intptr_t len" +.Fa "const char *format" +.Fa "const char *descr +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_PROC +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *arg1" +.Fa "intptr_t arg2" +.Fa "int (*handler) (SYSCTL_HANDLERARGS)" +.Fa "const char *format" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_QUAD +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "quad_t *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_ROOT_NODE +.Fa "struct sysctl_ctx_list *ctx" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "int (*handler)(SYSCTL_HANDLER_ARGS)" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_STRING +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "char *ptr" +.Fa "intptr_t len" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_STRUCT +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *ptr" +.Fa struct_type +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_UINT +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "unsigned int *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_ULONG +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "unsigned long *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_UQUAD +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "u_quad_t *ptr" +.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid_list * +.Fo SYSCTL_CHILDREN +.Fa "struct sysctl_oid *oidp" +.Fc +.Ft struct sysctl_oid_list * +.Fo SYSCTL_STATIC_CHILDREN +.Fa "struct sysctl_oid_list OID_NAME" +.Fc +.Ft struct sysctl_oid_list * +.Fo SYSCTL_NODE_CHILDREN +.Fa "parent" +.Fa "name" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_PARENT +.Fa "struct sysctl_oid *oid" +.Fc +.Fn SYSCTL_INT parent number name ctlflags ptr val descr +.Fn SYSCTL_LONG parent number name ctlflags ptr val descr +.Fn SYSCTL_NODE parent number name ctlflags handler descr +.Fn SYSCTL_OPAQUE parent number name ctlflags ptr len format descr +.Fn SYSCTL_PROC parent number name ctlflags arg1 arg2 handler format descr +.Fn SYSCTL_QUAD parent number name ctlflags ptr val descr +.Fn SYSCTL_STRING parent number name ctlflags arg len descr +.Fn SYSCTL_STRUCT parent number name ctlflags ptr struct_type descr +.Fn SYSCTL_ROOT_NODE number name ctlflags handler descr +.Fn SYSCTL_UINT parent number name ctlflags ptr val descr +.Fn SYSCTL_ULONG parent number name ctlflags ptr val descr +.Fn SYSCTL_UQUAD parent number name ctlflags ptr val descr .Sh DESCRIPTION The .Nm SYSCTL -kernel interfaces allow code to statically declare +kernel interface allows dynamic or static creation of .Xr sysctl 8 -MIB entries, which will be initialized when the kernel module containing the -declaration is initialized. -When the module is unloaded, the sysctl will be automatically destroyed. -.Pp -Sysctl nodes are created in a hierarchical tree, with all static nodes being -represented by named C data structures; in order to create a new node under -an existing node in the tree, the structure representing the desired parent -node must be declared in the current context using -.Fn SYSCTL_DECL . -.Pp -New nodes are declared using one of +MIB entries. +All static sysctls are automatically destroyed when the module which +they are part of is unloaded. +Most top level categories are created statically and are available to +all kernel code and its modules. +.Sh DESCRIPTION OF ARGUMENTS +.Bl -tag -width ctlflags +.It Fa ctx +Pointer to sysctl context or NULL, if no context. +See +.Xr sysctl_ctx_init 9 +for how to create a new sysctl context. +Programmers are strongly advised to use contexts to organize the +dynamic OIDs which they create because when a context is destroyed all +belonging sysctls are destroyed aswell. +This makes the sysctl cleanup code much simpler. +Else deletion of all created OIDs is required at module unload typically. +.It Fa parent +A pointer to a +.Li struct sysctl_oid_list , +which is the head of the parent's list of children. +This pointer is retrieved by using the +.Fn SYSCTL_STATIC_CHILDREN +macro for static sysctls and the +.Fn SYSCTL_CHILDREN +macro for dynamic sysctls. +To get the parent of an OID the +.Fn SYSCTL_PARENT +macro shall be used. +If there is no parent this macro returns NULL. +.It Fa number +The OID number that will be assigned to this OID. +In almost all cases this should be set to +.Dv OID_AUTO , +which will result in the assignment of the next available OID number. +.It Fa name +The name of the OID. +The newly created OID will contain a copy of the name. +.It Fa ctlflags +A bit mask of sysctl control flags. +See the section below describing all the control flags. +.It Fa arg1 +First callback argument for procedure sysctls. +.It Fa arg2 +Second callback argument for procedure sysctls. +.It Fa len +The length of the data pointed to by the +.Fa ptr +argument. +For string type OIDs a length of zero means that +.Xr strlen 3 +will be used to get the length of the string at each access to the OID. +.It Fa ptr +Pointer to sysctl variable or string data. +For sysctl values the pointer can be NULL which means the OID is read-only and the returned value should be taken from the +.Fa val +argument. +.It Fa val +If the +.Fa ptr +argument is NULL, gives the constant value returned by this OID. +Else this argument is not used. +.It Fa struct_type +Name of structure type. +.It Fa handler +A pointer to the function +that is responsible for handling read and write requests +to this OID. +There are several standard handlers +that support operations on nodes, +integers, strings and opaque objects. +It is possible to define custom handlers using the +.Fn SYSCTL_PROC +macro or the +.Fn SYSCTL_ADD_PROC +function. +.It Fa format +A pointer to a string +which specifies the format of the OID in a symbolic way. +This format is used as a hint by +.Xr sysctl 8 +to apply proper data formatting for display purposes. +Currently used format names are: +.Dq N +for node, +.Dq A +for +.Li "char *" , +.Dq I +for +.Li "int" , +.Dq IU +for +.Li "unsigned int" , +.Dq L +for +.Li "long" , +.Dq LU +for +.Li "unsigned long" , +.Dq Q +for +.Li "quad_t" , +.Dq QU +for +.Li "u_quad_t" +and +.Dq S,TYPE +for +.Li "struct TYPE" +structures. +.It Fa descr +A pointer to a textual description of the OID. +.El +.Sh CREATING ROOT NODES +Sysctl MIBs or OIDs are created in a hierarchical tree. +The nodes at the bottom of the tree are called root nodes, and have no +parent OID. +To create bottom tree nodes the +.Fn SYSCTL_ROOT_NODE +macro or the +.Fn SYSCTL_ADD_ROOT_NODE +function needs to be used. +By default all static sysctl node OIDs are global and need a +.Fn SYSCTL_DECL +statement prior to their +.Fn SYSCTL_NODE +definition statement, typically in a so-called header file. +.Sh CREATING SYSCTL STRINGS +Zero terminated character strings sysctls are created either using the +.Fn SYSCTL_STRING +macro or the +.Fn SYSCTL_ADD_STRING +function. +If the +.Fa len +argument in zero, the string length is computed at every access to the OID using +.Xr strlen 3 . +.Sh CREATING OPAQUE SYSCTLS +The +.Fn SYSCTL_OPAQUE +or +.Fn SYSCTL_STRUCT +macros or the +.Fn SYSCTL_ADD_OPAQUE +or +.Fn SYSCTL_ADD_STRUCT +functions create an OID that handle any chunk of data +of the size specified by the +.Fa len +argument and data pointed to by the +.Fa ptr +argument. +When using the structure version the type is encoded as part of the +created sysctl. +.Sh CREATING CUSTOM SYSCTLS +The +.Fn SYSCTL_PROC +macro and the +.Fn SYSCTL_ADD_PROC +function +create OIDs with the specified +.Pa handler +function. +The handler is responsible for handling all read and write requests to +the OID. +This OID type is especially useful if the kernel data is not easily +accessible, or needs to be processed before exporting. +.Sh CREATING A STATIC SYSCTL +Static sysctls are declared using one of the .Fn SYSCTL_INT , .Fn SYSCTL_LONG , .Fn SYSCTL_NODE , .Fn SYSCTL_OPAQUE , .Fn SYSCTL_PROC , .Fn SYSCTL_QUAD , +.Fn SYSCTL_ROOT_NODE , .Fn SYSCTL_STRING , .Fn SYSCTL_STRUCT , .Fn SYSCTL_UINT , -.Fn SYSCTL_ULONG , -and -.Fn SYSCTL_UQUAD . -Each macro accepts a parent name, as declared using -.Fn SYSCTL_DECL , -an OID number, typically -.Dv OID_AUTO , -a node name, a set of control and access flags, and a description. -Depending on the macro, a pointer to a variable supporting the MIB entry, a -size, a value, and a function pointer implementing the MIB entry may also be -present. -.Pp -For most of the above macros, declaring a type as part of the access flags is -not necessary \[em] however, when declaring a sysctl implemented by a function, -including a type in the access mask is required: -.Bl -tag -width ".Dv CTLTYPE_STRING" +.Fn SYSCTL_ULONG +or +.Fn SYSCTL_UQUAD +macros. +.Sh CREATING A DYNAMIC SYSCTL +Dynamic nodes are created using one of the +.Fn SYSCTL_ADD_INT , +.Fn SYSCTL_ADD_LONG , +.Fn SYSCTL_ADD_NODE , +.Fn SYSCTL_ADD_OPAQUE , +.Fn SYSCTL_ADD_PROC , +.Fn SYSCTL_ADD_QUAD , +.Fn SYSCTL_ADD_ROOT_NODE , +.Fn SYSCTL_ADD_STRING , +.Fn SYSCTL_ADD_STRUCT , +.Fn SYSCTL_ADD_UINT , +.Fn SYSCTL_ADD_ULONG +or +.Fn SYSCTL_UQUAD +functions. +See +.Xr sysctl_remove_oid 9 +or +.Xr sysctl_ctx_free 9 +for more information on how to destroy a dynamically created OID. +.Sh CONTROL FLAGS +For most of the above functions and macros, declaring a type as part +of the access flags is not necessary \[em] however, when declaring a +sysctl implemented by a function, including a type in the access mask +is required: +.Bl -tag -width ".Dv CTLTYPE_NOFETCH" .It Dv CTLTYPE_NODE This is a node intended to be a parent for other nodes. .It Dv CTLTYPE_INT @@ -127,13 +469,21 @@ flags to be set indicating the read and .It Dv CTLFLAG_RD This is a read-only sysctl. .It Dv CTLFLAG_RDTUN -This is a read-only sysctl which can be set by a system tunable. +This is a read-only sysctl and tunable which is tried fetched once +from the system enviroment early during module load or system boot. .It Dv CTLFLAG_WR This is a writable sysctl. .It Dv CTLFLAG_RW This sysctl is readable and writable. .It Dv CTLFLAG_RWTUN -This sysctl is readable and writable and can also be set by a system tunable. +This is a readable and writeable sysctl and tunable which is tried +fetched once from the system enviroment early during module load or +system boot. +.It Dv CTLFLAG_NOFETCH +In case the node is marked as a tunable using the CTLFLAG_[XX]TUN, +this flag will prevent fetching the initial value from the system +environment. Typically this flag should only be used for very early +low level system setup code, and not by common drivers and modules. .El .Pp Additionally, any of the following optional flags may also be specified: @@ -150,8 +500,12 @@ This sysctl can be written to by process When iterating the sysctl name space, do not list this sysctl. .It Dv CTLFLAG_TUN Advisory flag that a system tunable also exists for this variable. +The initial sysctl value is tried fetched once from the system +enviroment early during module load or system boot. +.It Dv CTLFLAG_DYN +Dynamically created OIDs automatically get this flag set. .El -.Pp +.Sh SECURITY CONSIDERATIONS When creating new sysctls, careful attention should be paid to the security implications of the monitoring or management interface being created. Most sysctls present in the kernel are read-only or writable only by the @@ -252,6 +606,45 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, CTLFLAG_RW, NULL, 0, sysctl_kern_timecounter_hardware, "A", ""); .Ed +.Pp +The following is an example of +how to create a new top-level category +and how to hook up another subtree to an existing static node. +This example does not use contexts, +which results in tedious management of all intermediate oids, +as they need to be freed later on: +.Bd -literal -offset indent +#include + ... +/* + * Need to preserve pointers to newly created subtrees, + * to be able to free them later: + */ +static struct sysctl_oid *root1; +static struct sysctl_oid *root2; +static struct sysctl_oid *oidp; +static int a_int; +static char *string = "dynamic sysctl"; + ... + +root1 = SYSCTL_ADD_ROOT_NODE(NULL, + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new top level tree"); +oidp = SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(root1), + OID_AUTO, "newint", CTLFLAG_RW, &a_int, 0, "new int leaf"); + ... +root2 = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_debug), + OID_AUTO, "newtree", CTLFLAG_RW, 0, "new tree under debug"); +oidp = SYSCTL_ADD_STRING(NULL, SYSCTL_CHILDREN(root2), + OID_AUTO, "newstring", CTLFLAG_RD, string, 0, "new string leaf"); +.Ed +.Pp +This example creates the following subtrees: +.Bd -literal -offset indent +debug.newtree.newstring +newtree.newint +.Ed +.Pp +.Em "Care should be taken to free all OIDs once they are no longer needed!" .Sh SYSCTL NAMING When adding, modifying, or removing sysctl names, it is important to be aware that these interfaces may be used by users, libraries, applications, @@ -281,8 +674,8 @@ Use positive logic instead: .Va foobar , .Va foobar_enable . .Pp -A temporary sysctl node that should not be relied upon must be designated -as such by a leading underscore character in its name. For example: +A temporary sysctl node OID that should not be relied upon must be designated +as such by a leading underscore character in its name. For example: .Va _dirty_hack . .Sh SEE ALSO .Xr sysctl 3 , Modified: head/share/man/man9/sysctl_add_oid.9 ============================================================================== --- head/share/man/man9/sysctl_add_oid.9 Thu Jul 31 17:10:04 2014 (r269343) +++ head/share/man/man9/sysctl_add_oid.9 Thu Jul 31 17:18:40 2014 (r269344) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 12, 2013 +.Dd July 31, 2014 .Dt SYSCTL_ADD_OID 9 .Os .Sh NAME @@ -46,7 +46,7 @@ .Fa "const char *name" .Fa "int kind" .Fa "void *arg1" -.Fa "int arg2" +.Fa "intptr_t arg2" .Fa "int (*handler) (SYSCTL_HANDLER_ARGS)" .Fa "const char *format" .Fa "const char *descr" @@ -62,160 +62,16 @@ .Fa "int del" .Fa "int recurse" .Fc -.Ft struct sysctl_oid_list * -.Fo SYSCTL_CHILDREN -.Fa "struct sysctl_oid *oidp" -.Fc -.Ft struct sysctl_oid_list * -.Fo SYSCTL_STATIC_CHILDREN -.Fa "struct sysctl_oid_list OID_NAME" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_OID -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int kind" -.Fa "void *arg1" -.Fa "int arg2" -.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)" -.Fa "const char *format" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_NODE -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_STRING -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "char *arg" -.Fa "int len" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_INT -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "int *arg" -.Fa "int len" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_UINT -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "unsigned int *arg" -.Fa "int len" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_LONG -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "long *arg" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_ULONG -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "unsigned long *arg" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_QUAD -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "int64_t *arg" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_UQUAD -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "uint64_t *arg" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_OPAQUE -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "void *arg" -.Fa "int len" -.Fa "const char *format" -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_STRUCT -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "void *arg" -.Fa STRUCT_NAME -.Fa "const char *descr" -.Fc -.Ft struct sysctl_oid * -.Fo SYSCTL_ADD_PROC -.Fa "struct sysctl_ctx_list *ctx" -.Fa "struct sysctl_oid_list *parent" -.Fa "int number" -.Fa "const char *name" -.Fa "int access" -.Fa "void *arg1" -.Fa "int arg2" -.Fa "int (*handler) (SYSCTL_HANDLER_ARGS)" -.Fa "const char *format" -.Fa "const char *descr" -.Fc .Sh DESCRIPTION -These functions and macros provide an interface -for creating and deleting sysctl oids at runtime -(e.g.\& during lifetime of a module). -The alternative method, -based on linker sets (see -.In sys/linker_set.h -and -.\" XXX Manual pages should avoid referencing source files -.Pa src/sys/kern/kern_sysctl.c -for details), only allows creation and deletion -on module load and unload respectively. +These functions provide the interface for creating and deleting sysctl +OIDs at runtime for example during the lifetime of a module. +The wrapper macros defined by +.Xr sysctl 9 +are recommended when creating new OIDs. +.Fn sysctl_add_oid +should not be called directly from the code. .Pp -Dynamic oids of type +Dynamic OIDs of type .Dv CTLTYPE_NODE are reusable so that several code sections can create and delete them, @@ -227,170 +83,51 @@ to create partially overlapping trees th It is not possible to create overlapping leaves, nor to create different child types with the same name and parent. .Pp -Newly created oids are connected to their parent nodes. -In all these functions and macros -(with the exception of -.Fn sysctl_remove_oid ) , -one of the required parameters is -.Fa parent , -which points to the head of the parent's list of children. -.Pp -Most top level categories are created statically. -When connecting to existing static oids, -this pointer can be obtained with the -.Fn SYSCTL_STATIC_CHILDREN -macro, where the -.Fa OID_NAME -argument is name of the parent oid of type -.Dv CTLTYPE_NODE -(i.e., the name displayed by -.Xr sysctl 8 , -preceded by underscore, and with all dots replaced with underscores). -.Pp -When connecting to an existing dynamic oid, this pointer -can be obtained with the -.Fn SYSCTL_CHILDREN -macro, where the -.Fa oidp -argument points to the parent oid of type -.Dv CTLTYPE_NODE . -.Pp The .Fn sysctl_add_oid -function creates raw oids of any type. -If the oid is successfully created, -the function returns a pointer to it; -otherwise it returns +function creates a raw OID of any type and connects it to its parent node, if any. +If the OID is successfully created, +the function returns a pointer to it else +it returns .Dv NULL . Many of the arguments for .Fn sysctl_add_oid -are common to the macros. -The arguments are as follows: -.Bl -tag -width handler -.It Fa ctx -A pointer to an optional sysctl context, or -.Dv NULL . -See -.Xr sysctl_ctx_init 9 -for details. -Programmers are strongly advised to use contexts -to organize the dynamic oids which they create, -unless special creation and deletion sequences are required. -If -.Fa ctx -is not -.Dv NULL , -the newly created oid will be added to this context -as its first entry. -.It Fa parent -A pointer to a -.Li struct sysctl_oid_list , -which is the head of the parent's list of children. -.It Fa number -The oid number that will be assigned to this oid. -In almost all cases this should be set to -.Dv OID_AUTO , -which will result in the assignment of the next available oid number. -.It Fa name -The name of the oid. -The newly created oid will contain a copy of the name. -.It Fa kind -The kind of oid, -specified as a bit mask of the type and access values defined in the -.In sys/sysctl.h -header file. -Oids created dynamically always have the -.Dv CTLFLAG_DYN -flag set. -Access flags specify whether this oid is read-only or read-write, -and whether it may be modified by all users -or by the superuser only. -.It Fa arg1 -A pointer to any data that the oid should reference, or -.Dv NULL . -.It Fa arg2 -The size of -.Fa arg1 , -or 0 if -.Fa arg1 -is -.Dv NULL . -.It Fa handler -A pointer to the function -that is responsible for handling read and write requests -to this oid. -There are several standard handlers -that support operations on nodes, -integers, strings and opaque objects. -It is possible also to define new handlers using the -.Fn SYSCTL_ADD_PROC -macro. -.It Fa format -A pointer to a string -which specifies the format of the oid symbolically. -This format is used as a hint by -.Xr sysctl 8 -to apply proper data formatting for display purposes. -Currently used format names are: -.Dq N -for node, -.Dq A -for -.Li "char *" , -.Dq I -for -.Li "int" , -.Dq IU -for -.Li "unsigned int" , -.Dq L -for -.Li "long" , -.Dq LU -for -.Li "unsigned long" -and -.Dq S,TYPE -for -.Li "struct TYPE" -structures. -.It Fa descr -A pointer to a textual description of the oid. -.El +are common to the wrapper macros defined by +.Xr sysctl 9 . .Pp The .Fn sysctl_move_oid -function reparents an existing oid. -The oid is assigned a new number as if it had been created with +function reparents an existing OID. +The OID is assigned a new number as if it had been created with .Fa number set to .Dv OID_AUTO . .Pp The .Fn sysctl_remove_oid -function removes a dynamically created oid from the tree, +function removes a dynamically created OID from the tree and optionally freeing its resources. It takes the following arguments: .Bl -tag -width recurse .It Fa oidp -A pointer to the dynamic oid to be removed. -If the oid is not dynamic, or the pointer is +A pointer to the dynamic OID to be removed. +If the OID is not dynamic, or the pointer is .Dv NULL , the function returns .Er EINVAL . .It Fa del If non-zero, .Fn sysctl_remove_oid -will try to free the oid's resources -when the reference count of the oid becomes zero. +will try to free the OID's resources +when the reference count of the OID becomes zero. However, if .Fa del is set to 0, -the routine will only deregister the oid from the tree, +the routine will only deregister the OID from the tree, without freeing its resources. This behaviour is useful when the caller expects to rollback (possibly partially failed) -deletion of many oids later. +deletion of many OIDs later. .It Fa recurse If non-zero, attempt to remove the node and all its children. If @@ -412,112 +149,11 @@ Be aware, though, that this may result i if other code sections continue to use removed subtrees. .El .Pp -.\" XXX sheldonh finished up to here Again, in most cases the programmer should use contexts, as described in .Xr sysctl_ctx_init 9 , -to keep track of created oids, +to keep track of created OIDs, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 18:02:39 2014 Return-Path: Delivered-To: svn-src-all@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 C0065EF1; Thu, 31 Jul 2014 18:02: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACA232284; Thu, 31 Jul 2014 18:02:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VI2dIQ024993; Thu, 31 Jul 2014 18:02:39 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VI2dPI024992; Thu, 31 Jul 2014 18:02:39 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201407311802.s6VI2dPI024992@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 31 Jul 2014 18:02:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269345 - head/share/examples/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 18:02:39 -0000 Author: gnn Date: Thu Jul 31 18:02:38 2014 New Revision: 269345 URL: http://svnweb.freebsd.org/changeset/base/269345 Log: Various style(9) and related fixes. Update the copyright to be more in line with the current version in our tree. Remove the ancient rcsid. Add a proper return from the main function Pointed out by: bz Modified: head/share/examples/hwpmc/overhead.c Modified: head/share/examples/hwpmc/overhead.c ============================================================================== --- head/share/examples/hwpmc/overhead.c Thu Jul 31 17:18:40 2014 (r269344) +++ head/share/examples/hwpmc/overhead.c Thu Jul 31 18:02:38 2014 (r269345) @@ -1,45 +1,34 @@ -/* +/*- * Copyright (c) 2014, Neville-Neil Consulting * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Neville-Neil Consulting nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * 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$ * * Author: George V. Neville-Neil * - * */ -#ifndef lint -static char rcsid [] = "$Header:$" ; -#endif - /* * Calculate the time overhead of starting, stopping, and recording * pmc counters. @@ -59,7 +48,8 @@ static char rcsid [] = "$Header:$" ; #include #include -int main(int argc, char **argv) +int +main(int argc, char **argv) { pmc_id_t pmcid; pmc_value_t read_value; @@ -111,5 +101,6 @@ int main(int argc, char **argv) printf("Cycles to start: %ld\tstop: %ld\tread: %ld\twrite: %ld\n", start_cyc, stop_cyc, read_cyc, stop_cyc); + return(0); } From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 18:35:01 2014 Return-Path: Delivered-To: svn-src-all@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 4E39E901; Thu, 31 Jul 2014 18:35:01 +0000 (UTC) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A63D266E; Thu, 31 Jul 2014 18:35:00 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id s6VIVu4X021255; Thu, 31 Jul 2014 13:34:58 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp1.rice.edu with ESMTP id 1ndwdn9f2v-1; Thu, 31 Jul 2014 13:34:58 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 98331500122; Thu, 31 Jul 2014 13:34:57 -0500 (CDT) Message-ID: <53DA8C51.6050103@rice.edu> Date: Thu, 31 Jul 2014 13:34:57 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> <53D960E9.50905@rice.edu> <53D9630A.5050500@FreeBSD.org> <53D9C7A0.4010100@rice.edu> <53DA05A8.3020400@FreeBSD.org> In-Reply-To: <53DA05A8.3020400@FreeBSD.org> X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------010407020806060306050209" X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1407310229 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 18:35:01 -0000 This is a multi-part message in MIME format. --------------010407020806060306050209 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit On 07/31/2014 04:00, Andreas Tobler wrote: > On 31.07.14 06:35, Alan Cox wrote: >> On 07/30/2014 16:26, Andreas Tobler wrote: >>> On 30.07.14 23:17, Alan Cox wrote: >>>> On 07/30/2014 15:15, Andreas Tobler wrote: >>>>> On 30.07.14 21:54, Alan Cox wrote: >>>>>> On 07/30/2014 14:46, Alan Cox wrote: >>>>>>> On 07/30/2014 13:58, Andreas Tobler wrote: >>>>>>>> Hi Alan, >>>>>>>> >>>>>>>> On 26.07.14 20:10, Alan Cox wrote: >>>>>>>>> Author: alc >>>>>>>>> Date: Sat Jul 26 18:10:18 2014 >>>>>>>>> New Revision: 269134 >>>>>>>>> URL: http://svnweb.freebsd.org/changeset/base/269134 >>>>>>>>> >>>>>>>>> Log: >>>>>>>>> When unwiring a region of an address space, do not >>>>>>>>> assume that >>>>>>>>> the >>>>>>>>> underlying physical pages are mapped by the pmap. If, for >>>>>>>>> example, the >>>>>>>>> application has performed an mprotect(..., PROT_NONE) on >>>>>>>>> any part >>>>>>>>> of the >>>>>>>>> wired region, then those pages will no longer be mapped >>>>>>>>> by the >>>>>>>>> pmap. >>>>>>>>> So, using the pmap to lookup the wired pages in order to >>>>>>>>> unwire them >>>>>>>>> doesn't always work, and when it doesn't work wired >>>>>>>>> pages are >>>>>>>>> leaked. >>>>>>>>> >>>>>>>>> To avoid the leak, introduce and use a new function >>>>>>>>> vm_object_unwire() >>>>>>>>> that locates the wired pages by traversing the object >>>>>>>>> and its >>>>>>>>> backing >>>>>>>>> objects. >>>>>>>>> >>>>>>>>> At the same time, switch from using pmap_change_wiring() to >>>>>>>>> the >>>>>>>>> recently >>>>>>>>> introduced function pmap_unwire() for unwiring the region's >>>>>>>>> mappings. >>>>>>>>> pmap_unwire() is faster, because it operates a range of >>>>>>>>> virtual >>>>>>>>> addresses >>>>>>>>> rather than a single virtual page at a time. Moreover, by >>>>>>>>> operating on >>>>>>>>> a range, it is superpage friendly. It doesn't waste time >>>>>>>>> performing >>>>>>>>> unnecessary demotions. >>>>>>>>> >>>>>>>>> Reported by: markj >>>>>>>>> Reviewed by: kib >>>>>>>>> Tested by: pho, jmg (arm) >>>>>>>>> Sponsored by: EMC / Isilon Storage Division >>>>>>>> This commit brings my 32- and 64-bit PowerMac's into panic. >>>>>>>> Unfortunately I'm not able to give you a backtrace in the form >>>>>>>> of a >>>>>>>> textdump nor of a core dump. >>>>>>>> >>>>>>>> The only thing I have is this picture: >>>>>>>> >>>>>>>> http://people.freebsd.org/~andreast/r269134_panic.jpg >>>>>>>> >>>>>>>> Exactly this revision gives a panic and breaks the >>>>>>>> textdump/coredump >>>>>>>> facility. >>>>>>>> >>>>>>>> How can I help debugging? >>>>>>>> >>>>>>> It appears to me that moea64_pvo_enter() had a pre-existing bug >>>>>>> that >>>>>>> got >>>>>>> tickled by this change. Specifically, moea64_pvo_enter() >>>>>>> doesn't set >>>>>>> the PVO_WIRED flag when an unwired mapping already exists. It just >>>>>>> returns with the mapping still in an unwired state. Consequently, >>>>>>> when >>>>>>> pmap_unwire() finally runs, it doesn't find a wired mapping. >>>>>>> >>>>>>> Try this: >>>>>>> >>>>>>> Index: powerpc/aim/mmu_oea64.c >>>>>>> =================================================================== >>>>>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>>>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>>>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>>>>> uma_zone_t >>>>>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == >>>>>>> va) { >>>>>>> if ((pvo->pvo_pte.lpte.pte_lo & >>>>>>> LPTE_RPGN) >>>>>>> == pa && >>>>>>> (pvo->pvo_pte.lpte.pte_lo & >>>>>>> (LPTE_NOEXEC | >>>>>>> LPTE_PP)) >>>>>>> - == (pte_lo & (LPTE_NOEXEC | >>>>>>> LPTE_PP))) { >>>>>>> + == (pte_lo & (LPTE_NOEXEC | >>>>>>> LPTE_PP)) && >>>>>>> + ((pvo->pvo_vaddr ^ flags) & >>>>>>> PVO_WIRED)) { >>>>>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>>>>> LPTE_VALID)) { >>>>>>> /* Re-insert if >>>>>>> spilled */ >>>>>>> i = >>>>>>> MOEA64_PTE_INSERT(mmu, >>>>>>> ptegidx, >>>>>>> >>>>>> >>>>>> The new conditional test needs to be inverted. Try this instead: >>>>>> >>>>>> Index: powerpc/aim/mmu_oea64.c >>>>>> =================================================================== >>>>>> --- powerpc/aim/mmu_oea64.c (revision 269127) >>>>>> +++ powerpc/aim/mmu_oea64.c (working copy) >>>>>> @@ -2274,7 +2274,8 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, >>>>>> uma_zone_t >>>>>> if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == >>>>>> va) { >>>>>> if ((pvo->pvo_pte.lpte.pte_lo & >>>>>> LPTE_RPGN) >>>>>> == pa && >>>>>> (pvo->pvo_pte.lpte.pte_lo & >>>>>> (LPTE_NOEXEC | >>>>>> LPTE_PP)) >>>>>> - == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { >>>>>> + == (pte_lo & (LPTE_NOEXEC | LPTE_PP)) && >>>>>> + ((pvo->pvo_vaddr ^ flags) & >>>>>> PVO_WIRED) == >>>>>> 0) { >>>>>> if (!(pvo->pvo_pte.lpte.pte_hi & >>>>>> LPTE_VALID)) { >>>>>> /* Re-insert if >>>>>> spilled */ >>>>>> i = >>>>>> MOEA64_PTE_INSERT(mmu, >>>>>> ptegidx, >>>>>> >>>>> >>>>> >>>>> The panic stays, but the message is different: >>>>> >>>>> panic: moea64_pvo_to_pte: pvo 0x10147ea0 has invalid pte 0xb341180 in >>>>> moea64_pteg_table but valid in pvo. >>>>> >>>> >>>> My attempted fix is doing something else wrong. Do you have a stack >>>> trace? >>> >>> iPhone sei Dank: >>> >>> http://people.freebsd.org/~andreast/r269134-1_panic.jpg >> >> Ok, this patch should fix both the original panic and the new one. They >> are two distinct problems. > > Yep, thank you! > > Additionally I tried to adapt the 32-bit path and successfully booted > the below, ok? > > Again, thanks a lot! > Andreas > > Index: powerpc/aim/mmu_oea.c > =================================================================== > --- powerpc/aim/mmu_oea.c (revision 269326) > +++ powerpc/aim/mmu_oea.c (working copy) > @@ -1950,7 +1950,8 @@ > if (pvo->pvo_pmap == pm && PVO_VADDR(pvo) == va) { > if ((pvo->pvo_pte.pte.pte_lo & PTE_RPGN) == pa && > (pvo->pvo_pte.pte.pte_lo & PTE_PP) == > - (pte_lo & PTE_PP)) { > + (pte_lo & PTE_PP) && > + ((pvo->pvo_vaddr ^ flags) & PVO_WIRED) == 0) { > mtx_unlock(&moea_table_mutex); > return (0); > } > > Here is a better fix for the problem in moea64_pvo_enter(). The original fix destroys and recreates the PTE in order to wire it. This new fix simply updates the PTE. In the case of moea_pvo_enter(), there is also no need to destroy and recreate the PTE. --------------010407020806060306050209 Content-Type: text/plain; charset=ISO-8859-15; name="moeaX_pvo_enter_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="moeaX_pvo_enter_fix.patch" Index: powerpc/aim/mmu_oea.c =================================================================== --- powerpc/aim/mmu_oea.c (revision 269127) +++ powerpc/aim/mmu_oea.c (working copy) @@ -1951,7 +1951,21 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zone, struct if ((pvo->pvo_pte.pte.pte_lo & PTE_RPGN) == pa && (pvo->pvo_pte.pte.pte_lo & PTE_PP) == (pte_lo & PTE_PP)) { + /* + * The PTE is not changing. Instead, this may + * be a request to change the mapping's wired + * attribute. + */ mtx_unlock(&moea_table_mutex); + if ((flags & PVO_WIRED) != 0 && + (pvo->pvo_vaddr & PVO_WIRED) == 0) { + pvo->pvo_vaddr |= PVO_WIRED; + pm->pm_stats.wired_count++; + } else if ((flags & PVO_WIRED) == 0 && + (pvo->pvo_vaddr & PVO_WIRED) != 0) { + pvo->pvo_vaddr &= ~PVO_WIRED; + pm->pm_stats.wired_count--; + } return (0); } moea_pvo_remove(pvo, -1); Index: powerpc/aim/mmu_oea64.c =================================================================== --- powerpc/aim/mmu_oea64.c (revision 269339) +++ powerpc/aim/mmu_oea64.c (working copy) @@ -2234,6 +2234,7 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t uint64_t pte_lo, int flags) { struct pvo_entry *pvo; + uintptr_t pt; uint64_t vsid; int first; u_int ptegidx; @@ -2276,7 +2277,28 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | LPTE_PP)) == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { + /* + * The physical page and protection are not + * changing. Instead, this may be a request + * to change the mapping's wired attribute. + */ + pt = -1; + if ((flags & PVO_WIRED) != 0 && + (pvo->pvo_vaddr & PVO_WIRED) == 0) { + pt = MOEA64_PVO_TO_PTE(mmu, pvo); + pvo->pvo_vaddr |= PVO_WIRED; + pvo->pvo_pte.lpte.pte_hi |= LPTE_WIRED; + pm->pm_stats.wired_count++; + } else if ((flags & PVO_WIRED) == 0 && + (pvo->pvo_vaddr & PVO_WIRED) != 0) { + pt = MOEA64_PVO_TO_PTE(mmu, pvo); + pvo->pvo_vaddr &= ~PVO_WIRED; + pvo->pvo_pte.lpte.pte_hi &= ~LPTE_WIRED; + pm->pm_stats.wired_count--; + } if (!(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID)) { + KASSERT(pt == -1, + ("moea64_pvo_enter: valid pt")); /* Re-insert if spilled */ i = MOEA64_PTE_INSERT(mmu, ptegidx, &pvo->pvo_pte.lpte); @@ -2283,6 +2305,14 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, uma_zone_t if (i >= 0) PVO_PTEGIDX_SET(pvo, i); moea64_pte_overflow--; + } else if (pt != -1) { + /* + * The PTE's wired attribute is not a + * hardware feature, so there is no + * need to invalidate any TLB entries. + */ + MOEA64_PTE_CHANGE(mmu, pt, + &pvo->pvo_pte.lpte, pvo->pvo_vpn); } return (0); } --------------010407020806060306050209-- From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 19:24:45 2014 Return-Path: Delivered-To: svn-src-all@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 8A735869; Thu, 31 Jul 2014 19:24: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D61E2B8F; Thu, 31 Jul 2014 19:24:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VJOjk8064970; Thu, 31 Jul 2014 19:24:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VJOjwZ064968; Thu, 31 Jul 2014 19:24:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201407311924.s6VJOjwZ064968@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 31 Jul 2014 19:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269347 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 19:24:45 -0000 Author: kib Date: Thu Jul 31 19:24:44 2014 New Revision: 269347 URL: http://svnweb.freebsd.org/changeset/base/269347 Log: Do not generate 1000 unique lock names for nfsrc hash chain locks. It overflows witness. Shorten the names of some nfs mutexes. Reported and tested by: pho No objections from: rmacklem, mav Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfs/nfsrvcache.h head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfs/nfsrvcache.h ============================================================================== --- head/sys/fs/nfs/nfsrvcache.h Thu Jul 31 18:54:40 2014 (r269346) +++ head/sys/fs/nfs/nfsrvcache.h Thu Jul 31 19:24:44 2014 (r269347) @@ -116,7 +116,6 @@ LIST_HEAD(nfsrvhashhead, nfsrvcache); /* The fine-grained locked cache hash table for TCP. */ struct nfsrchash_bucket { struct mtx mtx; - char lock_name[16]; struct nfsrvhashhead tbl; }; Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Thu Jul 31 18:54:40 2014 (r269346) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Thu Jul 31 19:24:44 2014 (r269347) @@ -3321,23 +3321,16 @@ nfsd_modevent(module_t mod, int type, vo goto out; newnfs_portinit(); for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { - snprintf(nfsrchash_table[i].lock_name, - sizeof(nfsrchash_table[i].lock_name), "nfsrc_tcp%d", - i); - mtx_init(&nfsrchash_table[i].mtx, - nfsrchash_table[i].lock_name, NULL, MTX_DEF); - snprintf(nfsrcahash_table[i].lock_name, - sizeof(nfsrcahash_table[i].lock_name), "nfsrc_tcpa%d", - i); - mtx_init(&nfsrcahash_table[i].mtx, - nfsrcahash_table[i].lock_name, NULL, MTX_DEF); + mtx_init(&nfsrchash_table[i].mtx, "nfsrtc", NULL, + MTX_DEF); + mtx_init(&nfsrcahash_table[i].mtx, "nfsrtca", NULL, + MTX_DEF); } - mtx_init(&nfsrc_udpmtx, "nfs_udpcache_mutex", NULL, MTX_DEF); - mtx_init(&nfs_v4root_mutex, "nfs_v4root_mutex", NULL, MTX_DEF); - mtx_init(&nfsv4root_mnt.mnt_mtx, "struct mount mtx", NULL, - MTX_DEF); + mtx_init(&nfsrc_udpmtx, "nfsuc", NULL, MTX_DEF); + mtx_init(&nfs_v4root_mutex, "nfs4rt", NULL, MTX_DEF); + mtx_init(&nfsv4root_mnt.mnt_mtx, "nfs4mnt", NULL, MTX_DEF); for (i = 0; i < NFSSESSIONHASHSIZE; i++) - mtx_init(&nfssessionhash[i].mtx, "nfs_session_mutex", + mtx_init(&nfssessionhash[i].mtx, "nfssm", NULL, MTX_DEF); lockinit(&nfsv4root_mnt.mnt_explock, PVFS, "explock", 0, 0); nfsrvd_initcache(); From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 19:25:31 2014 Return-Path: Delivered-To: svn-src-all@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 9062E9D1; Thu, 31 Jul 2014 19:25:31 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 247542BA1; Thu, 31 Jul 2014 19:25:30 +0000 (UTC) Received: from [192.168.225.11] (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s6VJPK67052112; Thu, 31 Jul 2014 21:25:20 +0200 (CEST) (envelope-from andreast@FreeBSD.org) Message-ID: <53DA981F.6000405@FreeBSD.org> Date: Thu, 31 Jul 2014 21:25:19 +0200 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Alan Cox , Alan Cox , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <53D9406A.3060101@FreeBSD.org> <53D94BAF.8050102@rice.edu> <53D94D73.3050808@rice.edu> <53D95265.9010406@FreeBSD.org> <53D960E9.50905@rice.edu> <53D9630A.5050500@FreeBSD.org> <53D9C7A0.4010100@rice.edu> <53DA05A8.3020400@FreeBSD.org> <53DA8C51.6050103@rice.edu> In-Reply-To: <53DA8C51.6050103@rice.edu> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 19:25:31 -0000 On 31.07.14 20:34, Alan Cox wrote: > Here is a better fix for the problem in moea64_pvo_enter(). The > original fix destroys and recreates the PTE in order to wire it. This > new fix simply updates the PTE. > > In the case of moea_pvo_enter(), there is also no need to destroy and > recreate the PTE. Awesome! All with no runtime tests? Nothing to say beside it works, on PowerMac G5 (64-bit)(2/4-CPU's) and MacMini G4 (32-bit)(1-CPU). Thank you again! Andreas From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 22:00:37 2014 Return-Path: Delivered-To: svn-src-all@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 C1CECFD4; Thu, 31 Jul 2014 22:00:37 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE3A2EAD; Thu, 31 Jul 2014 22:00:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VM0bQk034693; Thu, 31 Jul 2014 22:00:37 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VM0bKt034692; Thu, 31 Jul 2014 22:00:37 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201407312200.s6VM0bKt034692@svn.freebsd.org> From: Devin Teske Date: Thu, 31 Jul 2014 22:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269351 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 22:00:37 -0000 Author: dteske Date: Thu Jul 31 22:00:36 2014 New Revision: 269351 URL: http://svnweb.freebsd.org/changeset/base/269351 Log: Define a setvar() function for platforms using a shell unlike FreeBSD's sh(1) for `/bin/sh' (e.g., bash(1) which lacks a setvar definition). This is to improve portability to other Operating Systems (e.g., Linux). Modified: head/usr.sbin/bsdconfig/share/common.subr Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Thu Jul 31 20:55:05 2014 (r269350) +++ head/usr.sbin/bsdconfig/share/common.subr Thu Jul 31 22:00:36 2014 (r269351) @@ -220,6 +220,32 @@ f_have() f_quietly type "$@" } +# setvar $var_to_set [$value] +# +# Implement setvar for shells such as unlike FreeBSD sh(1). +# +if ! f_have setvar; then +setvar() +{ + [ $# -gt 0 ] || return $SUCCESS + local __setvar_var_to_set="$1" __setvar_right="$2" __setvar_left= + case $# in + 1) unset "$__setvar_var_to_set" + return $? ;; + 2) : fall through ;; + *) f_err "setvar: too many arguments\n" + return $FAILURE + esac + while case "$__setvar_r" in *\'*) : ;; *) false ; esac + do + __setvar_left="$__setvar_left${__setvar_right%%\'*}'\\''" + __setvar_right="${__setvar_right#*\'}" + done + __setvar_left="$__setvar_left${__setvar_right#*\'}" + eval "$__setvar_var_to_set='$__setvar_left'" +} +fi + # f_which $anything [$var_to_set] # # A fast built-in replacement for syntaxes such as foo=$( which bar ). In a From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 22:05:18 2014 Return-Path: Delivered-To: svn-src-all@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 CB57E2A3; Thu, 31 Jul 2014 22:05: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8CB32EF1; Thu, 31 Jul 2014 22:05:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VM5IFw038683; Thu, 31 Jul 2014 22:05:18 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VM5Ia8038682; Thu, 31 Jul 2014 22:05:18 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201407312205.s6VM5Ia8038682@svn.freebsd.org> From: Devin Teske Date: Thu, 31 Jul 2014 22:05:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269352 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 22:05:18 -0000 Author: dteske Date: Thu Jul 31 22:05:18 2014 New Revision: 269352 URL: http://svnweb.freebsd.org/changeset/base/269352 Log: Fix a syntax error when running under bash(1) for portability. Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Thu Jul 31 22:00:36 2014 (r269351) +++ head/usr.sbin/bsdconfig/share/dialog.subr Thu Jul 31 22:05:18 2014 (r269352) @@ -2099,9 +2099,13 @@ f_dialog_init() # # Process stored command-line arguments # + # NB: Using backticks instead of $(...) for portability since Linux + # bash(1) balks at the right parentheses encountered in the case- + # statement (incorrectly interpreting it as the close of $(...)). + # f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" - SECURE=$( set -- $ARGV + SECURE=`set -- $ARGV while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2109,8 +2113,8 @@ f_dialog_init() S) echo 1 ;; esac done - ) - USE_XDIALOG=$( set -- $ARGV + ` # END-BACKTICK + USE_XDIALOG=`set -- $ARGV while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2118,7 +2122,7 @@ f_dialog_init() S|X) echo 1 ;; esac done - ) + ` # END-BACKTICK f_dprintf "f_dialog_init: SECURE=[%s] USE_XDIALOG=[%s]" \ "$SECURE" "$USE_XDIALOG" From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 22:09:51 2014 Return-Path: Delivered-To: svn-src-all@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 10690679; Thu, 31 Jul 2014 22:09:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F20AE2F49; Thu, 31 Jul 2014 22:09:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VM9oiG039646; Thu, 31 Jul 2014 22:09:50 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VM9oJT039644; Thu, 31 Jul 2014 22:09:50 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <201407312209.s6VM9oJT039644@svn.freebsd.org> From: Joerg Wunsch Date: Thu, 31 Jul 2014 22:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269353 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 22:09:51 -0000 Author: joerg Date: Thu Jul 31 22:09:50 2014 New Revision: 269353 URL: http://svnweb.freebsd.org/changeset/base/269353 Log: Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO being random. As a result, propagation of the residual information for the SPACE command was broken, so the number of filemarks encountered during a SPACE operation was miscalculated. Consequently, systems relying on properly tracked filemark counters (like Bacula) fell apart. The change also removes a switch/case in sadone() which r256843 degraded to a single remaining case label. PR: 192285 Approved by: ken MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Thu Jul 31 22:05:18 2014 (r269352) +++ head/sys/cam/scsi/scsi_sa.c Thu Jul 31 22:09:50 2014 (r269353) @@ -113,16 +113,8 @@ typedef enum { #define ccb_pflags ppriv_field0 #define ccb_bp ppriv_ptr1 -#define SA_CCB_BUFFER_IO 0x0 -#define SA_CCB_TYPEMASK 0x1 -#define SA_POSITION_UPDATED 0x2 - -#define Set_CCB_Type(x, type) \ - x->ccb_h.ccb_pflags &= ~SA_CCB_TYPEMASK; \ - x->ccb_h.ccb_pflags |= type - -#define CCB_Type(x) (x->ccb_h.ccb_pflags & SA_CCB_TYPEMASK) - +/* bits in ccb_pflags */ +#define SA_POSITION_UPDATED 0x1 typedef enum { @@ -1835,7 +1827,6 @@ again: bp->bio_data, bp->bio_bcount, SSD_FULL_SIZE, IO_TIMEOUT); start_ccb->ccb_h.ccb_pflags &= ~SA_POSITION_UPDATED; - Set_CCB_Type(start_ccb, SA_CCB_BUFFER_IO); start_ccb->ccb_h.ccb_bp = bp; bp = bioq_first(&softc->bio_queue); xpt_action(start_ccb); @@ -1860,92 +1851,86 @@ sadone(struct cam_periph *periph, union { struct sa_softc *softc; struct ccb_scsiio *csio; + struct bio *bp; + int error; softc = (struct sa_softc *)periph->softc; csio = &done_ccb->csio; - switch (CCB_Type(csio)) { - case SA_CCB_BUFFER_IO: - { - struct bio *bp; - int error; - softc->dsreg = MTIO_DSREG_REST; - bp = (struct bio *)done_ccb->ccb_h.ccb_bp; - error = 0; - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if ((error = saerror(done_ccb, 0, 0)) == ERESTART) { - /* - * A retry was scheduled, so just return. - */ - return; - } + softc->dsreg = MTIO_DSREG_REST; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; + error = 0; + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if ((error = saerror(done_ccb, 0, 0)) == ERESTART) { + /* + * A retry was scheduled, so just return. + */ + return; } + } - if (error == EIO) { + if (error == EIO) { - /* - * Catastrophic error. Mark the tape as frozen - * (we no longer know tape position). - * - * Return all queued I/O with EIO, and unfreeze - * our queue so that future transactions that - * attempt to fix this problem can get to the - * device. - * - */ + /* + * Catastrophic error. Mark the tape as frozen + * (we no longer know tape position). + * + * Return all queued I/O with EIO, and unfreeze + * our queue so that future transactions that + * attempt to fix this problem can get to the + * device. + * + */ - softc->flags |= SA_FLAG_TAPE_FROZEN; - bioq_flush(&softc->bio_queue, NULL, EIO); - } - if (error != 0) { - bp->bio_resid = bp->bio_bcount; - bp->bio_error = error; + softc->flags |= SA_FLAG_TAPE_FROZEN; + bioq_flush(&softc->bio_queue, NULL, EIO); + } + if (error != 0) { + bp->bio_resid = bp->bio_bcount; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; + /* + * In the error case, position is updated in saerror. + */ + } else { + bp->bio_resid = csio->resid; + bp->bio_error = 0; + if (csio->resid != 0) { bp->bio_flags |= BIO_ERROR; - /* - * In the error case, position is updated in saerror. - */ - } else { - bp->bio_resid = csio->resid; - bp->bio_error = 0; - if (csio->resid != 0) { - bp->bio_flags |= BIO_ERROR; - } - if (bp->bio_cmd == BIO_WRITE) { - softc->flags |= SA_FLAG_TAPE_WRITTEN; - softc->filemarks = 0; - } - if (!(csio->ccb_h.ccb_pflags & SA_POSITION_UPDATED) && - (softc->blkno != (daddr_t) -1)) { - if ((softc->flags & SA_FLAG_FIXED) != 0) { - u_int32_t l; - if (softc->blk_shift != 0) { - l = bp->bio_bcount >> - softc->blk_shift; - } else { - l = bp->bio_bcount / - softc->media_blksize; - } - softc->blkno += (daddr_t) l; + } + if (bp->bio_cmd == BIO_WRITE) { + softc->flags |= SA_FLAG_TAPE_WRITTEN; + softc->filemarks = 0; + } + if (!(csio->ccb_h.ccb_pflags & SA_POSITION_UPDATED) && + (softc->blkno != (daddr_t) -1)) { + if ((softc->flags & SA_FLAG_FIXED) != 0) { + u_int32_t l; + if (softc->blk_shift != 0) { + l = bp->bio_bcount >> + softc->blk_shift; } else { - softc->blkno++; + l = bp->bio_bcount / + softc->media_blksize; } + softc->blkno += (daddr_t) l; + } else { + softc->blkno++; } } - /* - * If we had an error (immediate or pending), - * release the device queue now. - */ - if (error || (softc->flags & SA_FLAG_ERR_PENDING)) - cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); - if (error || bp->bio_resid) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, - ("error %d resid %ld count %ld\n", error, - bp->bio_resid, bp->bio_bcount)); - } - biofinish(bp, softc->device_stats, 0); - break; } + /* + * If we had an error (immediate or pending), + * release the device queue now. + */ + if (error || (softc->flags & SA_FLAG_ERR_PENDING)) + cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); + if (error || bp->bio_resid) { + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, + ("error %d resid %ld count %ld\n", error, + bp->bio_resid, bp->bio_bcount)); } + biofinish(bp, softc->device_stats, 0); xpt_release_ccb(done_ccb); } @@ -2498,7 +2483,8 @@ saerror(union ccb *ccb, u_int32_t cflgs, info /= softc->media_blksize; } } - if (CCB_Type(csio) == SA_CCB_BUFFER_IO) { + if (csio->cdb_io.cdb_bytes[0] == SA_READ || + csio->cdb_io.cdb_bytes[0] == SA_WRITE) { bcopy((caddr_t) sense, (caddr_t) &softc->last_io_sense, sizeof (struct scsi_sense_data)); bcopy(csio->cdb_io.cdb_bytes, softc->last_io_cdb, From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 22:13:32 2014 Return-Path: Delivered-To: svn-src-all@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 5397A941; Thu, 31 Jul 2014 22:13: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4102B204A; Thu, 31 Jul 2014 22:13:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VMDW2v043419; Thu, 31 Jul 2014 22:13:32 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VMDWWv043418; Thu, 31 Jul 2014 22:13:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201407312213.s6VMDWWv043418@svn.freebsd.org> From: Devin Teske Date: Thu, 31 Jul 2014 22:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269354 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 22:13:32 -0000 Author: dteske Date: Thu Jul 31 22:13:31 2014 New Revision: 269354 URL: http://svnweb.freebsd.org/changeset/base/269354 Log: Update command and add check for edge-case. Modified: head/usr.sbin/bsdconfig/share/common.subr Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Thu Jul 31 22:09:50 2014 (r269353) +++ head/usr.sbin/bsdconfig/share/common.subr Thu Jul 31 22:13:31 2014 (r269354) @@ -222,7 +222,7 @@ f_have() # setvar $var_to_set [$value] # -# Implement setvar for shells such as unlike FreeBSD sh(1). +# Implement setvar for shells unlike FreeBSD sh(1). # if ! f_have setvar; then setvar() @@ -236,6 +236,10 @@ setvar() *) f_err "setvar: too many arguments\n" return $FAILURE esac + case "$__setvar_var_to_set" in *[!0-9A-Za-z_]*) + f_err "setvar: %s: bad variable name\n" "$__setvar_var_to_set" + return 2 + esac while case "$__setvar_r" in *\'*) : ;; *) false ; esac do __setvar_left="$__setvar_left${__setvar_right%%\'*}'\\''" From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 22:32:40 2014 Return-Path: Delivered-To: svn-src-all@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 791D7211; Thu, 31 Jul 2014 22:32: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 671EA226B; Thu, 31 Jul 2014 22:32:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VMWe0I052372; Thu, 31 Jul 2014 22:32:40 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VMWewg052371; Thu, 31 Jul 2014 22:32:40 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201407312232.s6VMWewg052371@svn.freebsd.org> From: Warner Losh Date: Thu, 31 Jul 2014 22:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269355 - head/tools/tools/nanobsd/dhcpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 22:32:40 -0000 Author: imp Date: Thu Jul 31 22:32:39 2014 New Revision: 269355 URL: http://svnweb.freebsd.org/changeset/base/269355 Log: Fix a typo in the example script. Modified: head/tools/tools/nanobsd/dhcpd/README Modified: head/tools/tools/nanobsd/dhcpd/README ============================================================================== --- head/tools/tools/nanobsd/dhcpd/README Thu Jul 31 22:13:31 2014 (r269354) +++ head/tools/tools/nanobsd/dhcpd/README Thu Jul 31 22:32:39 2014 (r269355) @@ -9,6 +9,6 @@ and DHCPd. This is a work in progress. Generally, to build this you should cd tools/tools/nanobsd/dhcpd - sudo sh ../nandobsd.sh -C os-base + sudo sh ../nanobsd.sh -C os-base but do be careful if things are interrupted. There may still be bugs lurking that cause your entire FreeBSD tree to disappear. From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:04:42 2014 Return-Path: Delivered-To: svn-src-all@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 2BEC8B66; Thu, 31 Jul 2014 23:04: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C9A826E7; Thu, 31 Jul 2014 23:04:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VN4fYR066724; Thu, 31 Jul 2014 23:04:41 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VN4fer066720; Thu, 31 Jul 2014 23:04:41 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407312304.s6VN4fer066720@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 31 Jul 2014 23:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269356 - stable/10/sys/dev/cxgbe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:04:42 -0000 Author: np Date: Thu Jul 31 23:04:41 2014 New Revision: 269356 URL: http://svnweb.freebsd.org/changeset/base/269356 Log: MFC r268971 and r269032. r268971: Simplify r267600, there's no need to distinguish between allocated and inlined mbufs. r269032: cxgbe(4): Keep track of the clusters that have to be freed by the custom free routine (rxb_free) in the driver. Fail MOD_UNLOAD with EBUSY if any such cluster has been handed up to the kernel but hasn't been freed yet. This prevents a panic later when the cluster finally needs to be freed but rxb_free is gone from the kernel. Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Thu Jul 31 22:32:39 2014 (r269355) +++ stable/10/sys/dev/cxgbe/adapter.h Thu Jul 31 23:04:41 2014 (r269356) @@ -254,8 +254,7 @@ struct cluster_metadata { struct fl_sdesc { caddr_t cl; - uint8_t nimbuf; /* # of inline mbufs with ref on the cluster */ - uint8_t nembuf; /* # of allocated mbufs with ref */ + uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */ struct cluster_layout cll; }; @@ -852,6 +851,8 @@ void end_synchronized_op(struct adapter /* t4_sge.c */ void t4_sge_modload(void); +void t4_sge_modunload(void); +uint64_t t4_sge_extfree_refs(void); void t4_init_sge_cpl_handlers(struct adapter *); void t4_tweak_chip_settings(struct adapter *); int t4_read_chip_settings(struct adapter *); Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Thu Jul 31 22:32:39 2014 (r269355) +++ stable/10/sys/dev/cxgbe/t4_main.c Thu Jul 31 23:04:41 2014 (r269356) @@ -8090,6 +8090,9 @@ tweak_tunables(void) t4_intr_types &= INTR_MSIX | INTR_MSI | INTR_INTX; } +static struct sx mlu; /* mod load unload */ +SX_SYSINIT(cxgbe_mlu, &mlu, "cxgbe mod load/unload"); + static int mod_event(module_t mod, int cmd, void *arg) { @@ -8098,41 +8101,67 @@ mod_event(module_t mod, int cmd, void *a switch (cmd) { case MOD_LOAD: - if (atomic_fetchadd_int(&loaded, 1)) - break; - t4_sge_modload(); - sx_init(&t4_list_lock, "T4/T5 adapters"); - SLIST_INIT(&t4_list); + sx_xlock(&mlu); + if (loaded++ == 0) { + t4_sge_modload(); + sx_init(&t4_list_lock, "T4/T5 adapters"); + SLIST_INIT(&t4_list); #ifdef TCP_OFFLOAD - sx_init(&t4_uld_list_lock, "T4/T5 ULDs"); - SLIST_INIT(&t4_uld_list); + sx_init(&t4_uld_list_lock, "T4/T5 ULDs"); + SLIST_INIT(&t4_uld_list); #endif - t4_tracer_modload(); - tweak_tunables(); + t4_tracer_modload(); + tweak_tunables(); + } + sx_xunlock(&mlu); break; case MOD_UNLOAD: - if (atomic_fetchadd_int(&loaded, -1) > 1) - break; - t4_tracer_modunload(); + sx_xlock(&mlu); + if (--loaded == 0) { + int tries; + + sx_slock(&t4_list_lock); + if (!SLIST_EMPTY(&t4_list)) { + rc = EBUSY; + sx_sunlock(&t4_list_lock); + goto done_unload; + } +#ifdef TCP_OFFLOAD + sx_slock(&t4_uld_list_lock); + if (!SLIST_EMPTY(&t4_uld_list)) { + rc = EBUSY; + sx_sunlock(&t4_uld_list_lock); + sx_sunlock(&t4_list_lock); + goto done_unload; + } +#endif + tries = 0; + while (tries++ < 5 && t4_sge_extfree_refs() != 0) { + uprintf("%ju clusters with custom free routine " + "still is use.\n", t4_sge_extfree_refs()); + pause("t4unload", 2 * hz); + } #ifdef TCP_OFFLOAD - sx_slock(&t4_uld_list_lock); - if (!SLIST_EMPTY(&t4_uld_list)) { - rc = EBUSY; sx_sunlock(&t4_uld_list_lock); - break; - } - sx_sunlock(&t4_uld_list_lock); - sx_destroy(&t4_uld_list_lock); #endif - sx_slock(&t4_list_lock); - if (!SLIST_EMPTY(&t4_list)) { - rc = EBUSY; sx_sunlock(&t4_list_lock); - break; + + if (t4_sge_extfree_refs() == 0) { + t4_tracer_modunload(); +#ifdef TCP_OFFLOAD + sx_destroy(&t4_uld_list_lock); +#endif + sx_destroy(&t4_list_lock); + t4_sge_modunload(); + loaded = 0; + } else { + rc = EBUSY; + loaded++; /* undo earlier decrement */ + } } - sx_sunlock(&t4_list_lock); - sx_destroy(&t4_list_lock); +done_unload: + sx_xunlock(&mlu); break; } Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Thu Jul 31 22:32:39 2014 (r269355) +++ stable/10/sys/dev/cxgbe/t4_sge.c Thu Jul 31 23:04:41 2014 (r269356) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -242,6 +243,9 @@ static int handle_fw_msg(struct sge_iq * static int sysctl_uint16(SYSCTL_HANDLER_ARGS); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); +static counter_u64_t extfree_refs; +static counter_u64_t extfree_rels; + /* * Called on MOD_LOAD. Validates and calculates the SGE tunables. */ @@ -313,6 +317,30 @@ t4_sge_modload(void) " using 0 instead.\n", cong_drop); cong_drop = 0; } + + extfree_refs = counter_u64_alloc(M_WAITOK); + extfree_rels = counter_u64_alloc(M_WAITOK); + counter_u64_zero(extfree_refs); + counter_u64_zero(extfree_rels); +} + +void +t4_sge_modunload(void) +{ + + counter_u64_free(extfree_refs); + counter_u64_free(extfree_rels); +} + +uint64_t +t4_sge_extfree_refs(void) +{ + uint64_t refs, rels; + + rels = counter_u64_fetch(extfree_rels); + refs = counter_u64_fetch(extfree_refs); + + return (refs - rels); } void @@ -1450,6 +1478,7 @@ rxb_free(struct mbuf *m, void *arg1, voi caddr_t cl = arg2; uma_zfree(zone, cl); + counter_u64_add(extfree_rels, 1); return (EXT_FREE_OK); } @@ -1498,7 +1527,7 @@ get_scatter_segment(struct adapter *sc, /* copy data to mbuf */ bcopy(payload, mtod(m, caddr_t), len); - } else if (sd->nimbuf * MSIZE < cll->region1) { + } else if (sd->nmbuf * MSIZE < cll->region1) { /* * There's spare room in the cluster for an mbuf. Create one @@ -1506,14 +1535,15 @@ get_scatter_segment(struct adapter *sc, */ MPASS(clm != NULL); - m = (struct mbuf *)(sd->cl + sd->nimbuf * MSIZE); + m = (struct mbuf *)(sd->cl + sd->nmbuf * MSIZE); /* No bzero required */ if (m_init(m, NULL, 0, M_NOWAIT, MT_DATA, flags | M_NOFREE)) return (NULL); fl->mbuf_inlined++; m_extaddref(m, payload, padded_len, &clm->refcount, rxb_free, swz->zone, sd->cl); - sd->nimbuf++; + if (sd->nmbuf++ == 0) + counter_u64_add(extfree_refs, 1); } else { @@ -1530,7 +1560,8 @@ get_scatter_segment(struct adapter *sc, if (clm != NULL) { m_extaddref(m, payload, padded_len, &clm->refcount, rxb_free, swz->zone, sd->cl); - sd->nembuf++; + if (sd->nmbuf++ == 0) + counter_u64_add(extfree_refs, 1); } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ @@ -3055,7 +3086,7 @@ refill_fl(struct adapter *sc, struct sge if (sd->cl != NULL) { - if (sd->nimbuf + sd->nembuf == 0) { + if (sd->nmbuf == 0) { /* * Fast recycle without involving any atomics on * the cluster's metadata (if the cluster has @@ -3082,6 +3113,7 @@ refill_fl(struct adapter *sc, struct sge if (atomic_fetchadd_int(&clm->refcount, -1) == 1) { fl->cl_recycled++; + counter_u64_add(extfree_rels, 1); goto recycled; } sd->cl = NULL; /* gave up my reference */ @@ -3114,8 +3146,7 @@ recycled: #endif clm->refcount = 1; } - sd->nimbuf = 0; - sd->nembuf = 0; + sd->nmbuf = 0; recycled_fast: fl->pending++; fl->needed--; @@ -3184,9 +3215,11 @@ free_fl_sdesc(struct adapter *sc, struct cll = &sd->cll; clm = cl_metadata(sc, fl, cll, sd->cl); - if (sd->nimbuf + sd->nembuf == 0 || - (clm && atomic_fetchadd_int(&clm->refcount, -1) == 1)) { + if (sd->nmbuf == 0) + uma_zfree(sc->sge.sw_zone_info[cll->zidx].zone, sd->cl); + else if (clm && atomic_fetchadd_int(&clm->refcount, -1) == 1) { uma_zfree(sc->sge.sw_zone_info[cll->zidx].zone, sd->cl); + counter_u64_add(extfree_rels, 1); } sd->cl = NULL; } From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:09:23 2014 Return-Path: Delivered-To: svn-src-all@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 1F1A3D5E; Thu, 31 Jul 2014 23:09: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BF4B2743; Thu, 31 Jul 2014 23:09:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VN9MMJ067586; Thu, 31 Jul 2014 23:09:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VN9M4v067585; Thu, 31 Jul 2014 23:09:22 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407312309.s6VN9M4v067585@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 31 Jul 2014 23:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269357 - stable/10/tools/tools/cxgbetool X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:09:23 -0000 Author: np Date: Thu Jul 31 23:09:22 2014 New Revision: 269357 URL: http://svnweb.freebsd.org/changeset/base/269357 Log: MFC r269106: Add a 'raw' parameter to the 'modinfo' subcommand. This is handy when trying to figure out why a QSFP+/SFP+ connector or cable wasn't identified correctly by cxgbe(4). Its output looks like this: # cxgbetool t5nex0 modinfo 0 raw 00: 03 04 21 00 00 00 00 00 ..!. .... 08: 04 00 00 00 67 00 00 00 .... g... 10: 00 00 05 00 41 6d 70 68 .... Amph 18: 65 6e 6f 6c 20 20 20 20 enol 20: 20 20 20 20 00 41 50 48 .APH 28: 35 37 31 35 34 30 30 30 5715 4000 30: 33 20 20 20 20 20 20 20 3 38: 4b 20 20 20 01 00 00 fa K .... 40: 00 00 00 00 41 50 46 31 .... APF1 48: 30 30 34 30 30 33 30 30 0040 0300 50: 30 33 20 20 31 30 30 31 03 1001 58: 33 30 20 20 00 00 00 97 30 .... Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/10/tools/tools/cxgbetool/cxgbetool.c Thu Jul 31 23:04:41 2014 (r269356) +++ stable/10/tools/tools/cxgbetool/cxgbetool.c Thu Jul 31 23:09:22 2014 (r269357) @@ -95,7 +95,7 @@ usage(FILE *fp) "\ti2c [] read from i2c device\n" "\tloadfw install firmware\n" "\tmemdump dump a memory range\n" - "\tmodinfo optics/cable information\n" + "\tmodinfo [raw] optics/cable information\n" "\treg
[=] read/write register\n" "\treg64
[=] read/write 64 bit register\n" "\tregdump [] ... dump registers\n" @@ -1873,6 +1873,41 @@ tracer_cmd(int argc, const char *argv[]) } static int +modinfo_raw(int port_id) +{ + uint8_t offset; + struct t4_i2c_data i2cd; + int rc; + + for (offset = 0; offset < 96; offset += sizeof(i2cd.data)) { + bzero(&i2cd, sizeof(i2cd)); + i2cd.port_id = port_id; + i2cd.dev_addr = 0xa0; + i2cd.offset = offset; + i2cd.len = sizeof(i2cd.data); + rc = doit(CHELSIO_T4_GET_I2C, &i2cd); + if (rc != 0) + return (rc); + printf("%02x: %02x %02x %02x %02x %02x %02x %02x %02x", + offset, i2cd.data[0], i2cd.data[1], i2cd.data[2], + i2cd.data[3], i2cd.data[4], i2cd.data[5], i2cd.data[6], + i2cd.data[7]); + + printf(" %c%c%c%c %c%c%c%c\n", + isprint(i2cd.data[0]) ? i2cd.data[0] : '.', + isprint(i2cd.data[1]) ? i2cd.data[1] : '.', + isprint(i2cd.data[2]) ? i2cd.data[2] : '.', + isprint(i2cd.data[3]) ? i2cd.data[3] : '.', + isprint(i2cd.data[4]) ? i2cd.data[4] : '.', + isprint(i2cd.data[5]) ? i2cd.data[5] : '.', + isprint(i2cd.data[6]) ? i2cd.data[6] : '.', + isprint(i2cd.data[7]) ? i2cd.data[7] : '.'); + } + + return (0); +} + +static int modinfo(int argc, const char *argv[]) { long port; @@ -1881,17 +1916,31 @@ modinfo(int argc, const char *argv[]) int rc, i; uint16_t temp, vcc, tx_bias, tx_power, rx_power; - if (argc != 1) { + if (argc < 1) { warnx("must supply a port"); return (EINVAL); } + if (argc > 2) { + warnx("too many arguments"); + return (EINVAL); + } + p = str_to_number(argv[0], &port, NULL); if (*p || port > UCHAR_MAX) { warnx("invalid port id \"%s\"", argv[0]); return (EINVAL); } + if (argc == 2) { + if (!strcmp(argv[1], "raw")) + return (modinfo_raw(port)); + else { + warnx("second argument can only be \"raw\""); + return (EINVAL); + } + } + bzero(&i2cd, sizeof(i2cd)); i2cd.len = 1; i2cd.port_id = port; From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:15:00 2014 Return-Path: Delivered-To: svn-src-all@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 689ACEE5; Thu, 31 Jul 2014 23:15: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AF2827E1; Thu, 31 Jul 2014 23:15:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VNF0Ru072173; Thu, 31 Jul 2014 23:15:00 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VNExRG072151; Thu, 31 Jul 2014 23:14:59 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407312314.s6VNExRG072151@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 31 Jul 2014 23:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269358 - stable/9/sys/dev/cxgbe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:15:00 -0000 Author: np Date: Thu Jul 31 23:14:59 2014 New Revision: 269358 URL: http://svnweb.freebsd.org/changeset/base/269358 Log: MFC r268971: Simplify r267600, there's no need to distinguish between allocated and inlined mbufs. Modified: stable/9/sys/dev/cxgbe/adapter.h stable/9/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/9/sys/dev/cxgbe/adapter.h Thu Jul 31 23:09:22 2014 (r269357) +++ stable/9/sys/dev/cxgbe/adapter.h Thu Jul 31 23:14:59 2014 (r269358) @@ -253,8 +253,7 @@ struct cluster_metadata { struct fl_sdesc { caddr_t cl; - uint8_t nimbuf; /* # of inline mbufs with ref on the cluster */ - uint8_t nembuf; /* # of allocated mbufs with ref */ + uint16_t nmbuf; /* # of driver originated mbufs with ref on cluster */ struct cluster_layout cll; }; Modified: stable/9/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/9/sys/dev/cxgbe/t4_sge.c Thu Jul 31 23:09:22 2014 (r269357) +++ stable/9/sys/dev/cxgbe/t4_sge.c Thu Jul 31 23:14:59 2014 (r269358) @@ -1469,7 +1469,7 @@ get_scatter_segment(struct adapter *sc, /* copy data to mbuf */ bcopy(payload, mtod(m, caddr_t), len); - } else if (sd->nimbuf * MSIZE < cll->region1) { + } else if (sd->nmbuf * MSIZE < cll->region1) { /* * There's spare room in the cluster for an mbuf. Create one @@ -1477,14 +1477,14 @@ get_scatter_segment(struct adapter *sc, */ MPASS(clm != NULL); - m = (struct mbuf *)(sd->cl + sd->nimbuf * MSIZE); + m = (struct mbuf *)(sd->cl + sd->nmbuf * MSIZE); /* No bzero required */ if (m_init(m, NULL, 0, M_NOWAIT, MT_DATA, flags | M_NOFREE)) return (NULL); fl->mbuf_inlined++; m_extaddref(m, payload, padded_len, &clm->refcount, rxb_free, swz->zone, sd->cl); - sd->nimbuf++; + sd->nmbuf++; } else { @@ -1501,7 +1501,7 @@ get_scatter_segment(struct adapter *sc, if (clm != NULL) { m_extaddref(m, payload, padded_len, &clm->refcount, rxb_free, swz->zone, sd->cl); - sd->nembuf++; + sd->nmbuf++; } else { m_cljset(m, sd->cl, swz->type); sd->cl = NULL; /* consumed, not a recycle candidate */ @@ -3026,7 +3026,7 @@ refill_fl(struct adapter *sc, struct sge if (sd->cl != NULL) { - if (sd->nimbuf + sd->nembuf == 0) { + if (sd->nmbuf == 0) { /* * Fast recycle without involving any atomics on * the cluster's metadata (if the cluster has @@ -3085,8 +3085,7 @@ recycled: #endif clm->refcount = 1; } - sd->nimbuf = 0; - sd->nembuf = 0; + sd->nmbuf = 0; recycled_fast: fl->pending++; fl->needed--; @@ -3155,7 +3154,7 @@ free_fl_sdesc(struct adapter *sc, struct cll = &sd->cll; clm = cl_metadata(sc, fl, cll, sd->cl); - if (sd->nimbuf + sd->nembuf == 0 || + if (sd->nmbuf == 0 || (clm && atomic_fetchadd_int(&clm->refcount, -1) == 1)) { uma_zfree(sc->sge.sw_zone_info[cll->zidx].zone, sd->cl); } From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:18:00 2014 Return-Path: Delivered-To: svn-src-all@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 8145C118; Thu, 31 Jul 2014 23:18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E77D2803; Thu, 31 Jul 2014 23:18:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VNI029072929; Thu, 31 Jul 2014 23:18:00 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VNI0Ho072928; Thu, 31 Jul 2014 23:18:00 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201407312318.s6VNI0Ho072928@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 31 Jul 2014 23:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269359 - stable/9/tools/tools/cxgbetool X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:18:00 -0000 Author: np Date: Thu Jul 31 23:17:59 2014 New Revision: 269359 URL: http://svnweb.freebsd.org/changeset/base/269359 Log: MFC r269106: Add a 'raw' parameter to the 'modinfo' subcommand. This is handy when trying to figure out why a QSFP+/SFP+ connector or cable wasn't identified correctly by cxgbe(4). Its output looks like this: # cxgbetool t5nex0 modinfo 0 raw 00: 03 04 21 00 00 00 00 00 ..!. .... 08: 04 00 00 00 67 00 00 00 .... g... 10: 00 00 05 00 41 6d 70 68 .... Amph 18: 65 6e 6f 6c 20 20 20 20 enol 20: 20 20 20 20 00 41 50 48 .APH 28: 35 37 31 35 34 30 30 30 5715 4000 30: 33 20 20 20 20 20 20 20 3 38: 4b 20 20 20 01 00 00 fa K .... 40: 00 00 00 00 41 50 46 31 .... APF1 48: 30 30 34 30 30 33 30 30 0040 0300 50: 30 33 20 20 31 30 30 31 03 1001 58: 33 30 20 20 00 00 00 97 30 .... Modified: stable/9/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/9/tools/tools/cxgbetool/ (props changed) Modified: stable/9/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/9/tools/tools/cxgbetool/cxgbetool.c Thu Jul 31 23:14:59 2014 (r269358) +++ stable/9/tools/tools/cxgbetool/cxgbetool.c Thu Jul 31 23:17:59 2014 (r269359) @@ -95,7 +95,7 @@ usage(FILE *fp) "\ti2c [] read from i2c device\n" "\tloadfw install firmware\n" "\tmemdump dump a memory range\n" - "\tmodinfo optics/cable information\n" + "\tmodinfo [raw] optics/cable information\n" "\treg
[=] read/write register\n" "\treg64
[=] read/write 64 bit register\n" "\tregdump [] ... dump registers\n" @@ -1673,6 +1673,41 @@ clearstats(int argc, const char *argv[]) } static int +modinfo_raw(int port_id) +{ + uint8_t offset; + struct t4_i2c_data i2cd; + int rc; + + for (offset = 0; offset < 96; offset += sizeof(i2cd.data)) { + bzero(&i2cd, sizeof(i2cd)); + i2cd.port_id = port_id; + i2cd.dev_addr = 0xa0; + i2cd.offset = offset; + i2cd.len = sizeof(i2cd.data); + rc = doit(CHELSIO_T4_GET_I2C, &i2cd); + if (rc != 0) + return (rc); + printf("%02x: %02x %02x %02x %02x %02x %02x %02x %02x", + offset, i2cd.data[0], i2cd.data[1], i2cd.data[2], + i2cd.data[3], i2cd.data[4], i2cd.data[5], i2cd.data[6], + i2cd.data[7]); + + printf(" %c%c%c%c %c%c%c%c\n", + isprint(i2cd.data[0]) ? i2cd.data[0] : '.', + isprint(i2cd.data[1]) ? i2cd.data[1] : '.', + isprint(i2cd.data[2]) ? i2cd.data[2] : '.', + isprint(i2cd.data[3]) ? i2cd.data[3] : '.', + isprint(i2cd.data[4]) ? i2cd.data[4] : '.', + isprint(i2cd.data[5]) ? i2cd.data[5] : '.', + isprint(i2cd.data[6]) ? i2cd.data[6] : '.', + isprint(i2cd.data[7]) ? i2cd.data[7] : '.'); + } + + return (0); +} + +static int modinfo(int argc, const char *argv[]) { long port; @@ -1681,17 +1716,31 @@ modinfo(int argc, const char *argv[]) int rc, i; uint16_t temp, vcc, tx_bias, tx_power, rx_power; - if (argc != 1) { + if (argc < 1) { warnx("must supply a port"); return (EINVAL); } + if (argc > 2) { + warnx("too many arguments"); + return (EINVAL); + } + p = str_to_number(argv[0], &port, NULL); if (*p || port > UCHAR_MAX) { warnx("invalid port id \"%s\"", argv[0]); return (EINVAL); } + if (argc == 2) { + if (!strcmp(argv[1], "raw")) + return (modinfo_raw(port)); + else { + warnx("second argument can only be \"raw\""); + return (EINVAL); + } + } + bzero(&i2cd, sizeof(i2cd)); i2cd.len = 1; i2cd.port_id = port; From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:19:02 2014 Return-Path: Delivered-To: svn-src-all@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 717AA25D; Thu, 31 Jul 2014 23:19: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EFC12811; Thu, 31 Jul 2014 23:19:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VNJ2j1073230; Thu, 31 Jul 2014 23:19:02 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VNJ2pp073229; Thu, 31 Jul 2014 23:19:02 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201407312319.s6VNJ2pp073229@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 31 Jul 2014 23:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269360 - head/cddl/contrib/dtracetoolkit/Apps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:19:02 -0000 Author: gnn Date: Thu Jul 31 23:19:01 2014 New Revision: 269360 URL: http://svnweb.freebsd.org/changeset/base/269360 Log: Update shellsnoop to work on FreeBSD. Contributed by: skreuzer Modified: head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Modified: head/cddl/contrib/dtracetoolkit/Apps/shellsnoop ============================================================================== --- head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Thu Jul 31 23:17:59 2014 (r269359) +++ head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Thu Jul 31 23:19:01 2014 (r269360) @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/bin/sh # # shellsnoop - A program to print read/write details from shells, # such as keystrokes and command outputs. @@ -140,18 +140,14 @@ dtrace -n ' /* * Remember this PID is a shell child */ - syscall::exec:entry, syscall::exece:entry + syscall::execve:entry /execname == "sh" || execname == "ksh" || execname == "csh" || execname == "tcsh" || execname == "zsh" || execname == "bash"/ { child[pid] = 1; - /* debug */ - this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm; - OPT_debug == 1 ? printf("PID %d CMD %s started. (%s)\n", - pid, execname, stringof(this->parent)) : 1; } - syscall::exec:entry, syscall::exece:entry + syscall::execve:entry /(OPT_pid == 1 && PID != ppid) || (OPT_uid == 1 && UID != uid)/ { /* forget if filtered */ @@ -256,12 +252,12 @@ dtrace -n ' /* * Cleanup */ - syscall::rexit:entry + syscall::exit:entry { child[pid] = 0; /* debug */ - this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm; + this->parent = (char *)curthread->td_proc->p_pptr->p_comm; OPT_debug == 1 ? printf("PID %d CMD %s exited. (%s)\n", pid, execname, stringof(this->parent)) : 1; } From owner-svn-src-all@FreeBSD.ORG Thu Jul 31 23:25:15 2014 Return-Path: Delivered-To: svn-src-all@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 180D953B; Thu, 31 Jul 2014 23:25: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECD0228DD; Thu, 31 Jul 2014 23:25:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6VNPEUf078078; Thu, 31 Jul 2014 23:25:14 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6VNPEn6078072; Thu, 31 Jul 2014 23:25:14 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407312325.s6VNPEn6078072@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 31 Jul 2014 23:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269361 - in head: lib/libstand sys/boot/libstand32 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 23:25:15 -0000 Author: marcel Date: Thu Jul 31 23:25:13 2014 New Revision: 269361 URL: http://svnweb.freebsd.org/changeset/base/269361 Log: Add pkgfs, a file system implementation for reading files out of a compressed tarball, aka package. The file system assumes that the files are layed-out in the same order as needed to allow for the package to be streamed. As such, it does not read an entire package into memory first. Some properties of the file system: o Files that start with '+' are silently skipped. These are found in FreeBSD package files. o Files smaller than or equal to 4KB will be cached in memory and as such allow for some flexibility in accessing files out of order. o Files with the .tgz suffix are assumed to be (sub-)packages and signal the end for a directory scan. Obtained from: Juniper Networks, Inc. Added: head/lib/libstand/pkgfs.c (contents, props changed) Modified: head/lib/libstand/Makefile head/lib/libstand/stand.h head/sys/boot/libstand32/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Thu Jul 31 23:19:01 2014 (r269360) +++ head/lib/libstand/Makefile Thu Jul 31 23:25:13 2014 (r269361) @@ -161,6 +161,7 @@ SRCS+= bootp.c rarp.c bootparam.c SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c SRCS+= dosfs.c ext2fs.c SRCS+= splitfs.c +SRCS+= pkgfs.c .if ${MK_NAND} != "no" SRCS+= nandfs.c .endif Added: head/lib/libstand/pkgfs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libstand/pkgfs.c Thu Jul 31 23:25:13 2014 (r269361) @@ -0,0 +1,791 @@ +/*- + * Copyright (c) 2007-2014, Juniper Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "stand.h" + +#include +#include +#include +#include + +#ifdef PKGFS_DEBUG +#define DBG(x) printf x +#else +#define DBG(x) +#endif + +static int pkg_open(const char *, struct open_file *); +static int pkg_close(struct open_file *); +static int pkg_read(struct open_file *, void *, size_t, size_t *); +static off_t pkg_seek(struct open_file *, off_t, int); +static int pkg_stat(struct open_file *, struct stat *); +static int pkg_readdir(struct open_file *, struct dirent *); + +struct fs_ops pkgfs_fsops = { + "pkg", + pkg_open, + pkg_close, + pkg_read, + null_write, + pkg_seek, + pkg_stat, + pkg_readdir +}; + +#define PKG_BUFSIZE 512 +#define PKG_MAXCACHESZ 4096 + +#define PKG_FILEEXT ".tgz" + +/* + * Layout of POSIX 'ustar' header. + */ +struct ustar_hdr { + char ut_name[100]; + char ut_mode[8]; + char ut_uid[8]; + char ut_gid[8]; + char ut_size[12]; + char ut_mtime[12]; + char ut_checksum[8]; + char ut_typeflag[1]; + char ut_linkname[100]; + char ut_magic[6]; /* For POSIX: "ustar\0" */ + char ut_version[2]; /* For POSIX: "00" */ + char ut_uname[32]; + char ut_gname[32]; + char ut_rdevmajor[8]; + char ut_rdevminor[8]; + union { + struct { + char prefix[155]; + } posix; + struct { + char atime[12]; + char ctime[12]; + char offset[12]; + char longnames[4]; + char unused[1]; + struct gnu_sparse { + char offset[12]; + char numbytes[12]; + } sparse[4]; + char isextended[1]; + char realsize[12]; + } gnu; + } u; + u_char __padding[12]; +}; + +struct package; + +struct tarfile +{ + struct package *tf_pkg; + struct tarfile *tf_next; + struct ustar_hdr tf_hdr; + off_t tf_ofs; + off_t tf_size; + off_t tf_fp; + size_t tf_cachesz; + void *tf_cache; +}; + +struct package +{ + struct package *pkg_chain; + int pkg_fd; + off_t pkg_ofs; + z_stream pkg_zs; + struct tarfile *pkg_first; + struct tarfile *pkg_last; + u_char pkg_buf[PKG_BUFSIZE]; +}; + +static struct package *package = NULL; + +static int new_package(int, struct package **); + +void +pkgfs_cleanup(void) +{ + struct package *chain; + struct tarfile *tf, *tfn; + + while (package != NULL) { + inflateEnd(&package->pkg_zs); + close(package->pkg_fd); + + tf = package->pkg_first; + while (tf != NULL) { + tfn = tf->tf_next; + if (tf->tf_cachesz > 0) + free(tf->tf_cache); + free(tf); + tf = tfn; + } + + chain = package->pkg_chain; + free(package); + package = chain; + } +} + +int +pkgfs_init(const char *pkgname, struct fs_ops *proto) +{ + struct package *pkg; + int error, fd; + + if (proto != &pkgfs_fsops) + pkgfs_cleanup(); + + exclusive_file_system = proto; + + fd = open(pkgname, O_RDONLY); + + exclusive_file_system = NULL; + + if (fd == -1) + return (errno); + + error = new_package(fd, &pkg); + if (error) { + close(fd); + return (error); + } + + if (pkg == NULL) + return (EDOOFUS); + + pkg->pkg_chain = package; + package = pkg; + exclusive_file_system = &pkgfs_fsops; + return (0); +} + +static int get_mode(struct tarfile *); +static int get_zipped(struct package *, void *, size_t); +static int new_package(int, struct package **); +static struct tarfile *scan_tarfile(struct package *, struct tarfile *); + +static int +pkg_open(const char *fn, struct open_file *f) +{ + struct tarfile *tf; + + if (fn == NULL || f == NULL) + return (EINVAL); + + if (package == NULL) + return (ENXIO); + + /* + * We can only read from a package, so reject request to open + * for write-only or read-write. + */ + if (f->f_flags != F_READ) + return (EPERM); + + /* + * Scan the file headers for the named file. We stop scanning + * at the first filename that has the .pkg extension. This is + * a package within a package. We assume we have all the files + * we need up-front and without having to dig within nested + * packages. + * + * Note that we preserve streaming properties as much as possible. + */ + while (*fn == '/') + fn++; + + /* + * Allow opening of the root directory for use by readdir() + * to support listing files in the package. + */ + if (*fn == '\0') { + f->f_fsdata = NULL; + return (0); + } + + tf = scan_tarfile(package, NULL); + while (tf != NULL) { + if (strcmp(fn, tf->tf_hdr.ut_name) == 0) { + f->f_fsdata = tf; + tf->tf_fp = 0; /* Reset the file pointer. */ + return (0); + } + tf = scan_tarfile(package, tf); + } + return (errno); +} + +static int +pkg_close(struct open_file *f) +{ + struct tarfile *tf; + + tf = (struct tarfile *)f->f_fsdata; + if (tf == NULL) + return (0); + + /* + * Free up the cache if we read all of the file. + */ + if (tf->tf_fp == tf->tf_size && tf->tf_cachesz > 0) { + free(tf->tf_cache); + tf->tf_cachesz = 0; + } + return (0); +} + +static int +pkg_read(struct open_file *f, void *buf, size_t size, size_t *res) +{ + struct tarfile *tf; + char *p; + off_t fp; + size_t sz; + + tf = (struct tarfile *)f->f_fsdata; + if (tf == NULL) { + if (res != NULL) + *res = size; + return (EBADF); + } + + fp = tf->tf_fp; + p = buf; + sz = 0; + while (size > 0) { + sz = tf->tf_size - fp; + if (fp < tf->tf_cachesz && tf->tf_cachesz < tf->tf_size) + sz = tf->tf_cachesz - fp; + if (size < sz) + sz = size; + if (sz == 0) + break; + + if (fp < tf->tf_cachesz) { + /* Satisfy the request from cache. */ + memcpy(p, tf->tf_cache + fp, sz); + fp += sz; + p += sz; + size -= sz; + continue; + } + + if (get_zipped(tf->tf_pkg, p, sz) == -1) { + sz = -1; + break; + } + + fp += sz; + p += sz; + size -= sz; + + if (tf->tf_cachesz != 0) + continue; + + tf->tf_cachesz = (sz <= PKG_MAXCACHESZ) ? sz : PKG_MAXCACHESZ; + tf->tf_cache = malloc(tf->tf_cachesz); + if (tf->tf_cache != NULL) + memcpy(tf->tf_cache, buf, tf->tf_cachesz); + else + tf->tf_cachesz = 0; + } + + tf->tf_fp = fp; + if (res != NULL) + *res = size; + return ((sz == -1) ? errno : 0); +} + +static off_t +pkg_seek(struct open_file *f, off_t ofs, int whence) +{ + char buf[512]; + struct tarfile *tf; + off_t delta; + size_t sz, res; + int error; + + tf = (struct tarfile *)f->f_fsdata; + if (tf == NULL) { + errno = EBADF; + return (-1); + } + + switch (whence) { + case SEEK_SET: + delta = ofs - tf->tf_fp; + break; + case SEEK_CUR: + delta = ofs; + break; + case SEEK_END: + delta = tf->tf_size - tf->tf_fp + ofs; + break; + default: + errno = EINVAL; + return (-1); + } + + if (delta < 0) { + DBG(("%s: negative file seek (%jd)\n", __func__, + (intmax_t)delta)); + errno = ESPIPE; + return (-1); + } + + while (delta > 0 && tf->tf_fp < tf->tf_size) { + sz = (delta > sizeof(buf)) ? sizeof(buf) : delta; + error = pkg_read(f, buf, sz, &res); + if (error != 0) { + errno = error; + return (-1); + } + delta -= sz - res; + } + + return (tf->tf_fp); +} + +static int +pkg_stat(struct open_file *f, struct stat *sb) +{ + struct tarfile *tf; + + tf = (struct tarfile *)f->f_fsdata; + if (tf == NULL) + return (EBADF); + memset(sb, 0, sizeof(*sb)); + sb->st_mode = get_mode(tf); + sb->st_size = tf->tf_size; + sb->st_blocks = (tf->tf_size + 511) / 512; + return (0); +} + +static int +pkg_readdir(struct open_file *f, struct dirent *d) +{ + struct tarfile *tf; + + tf = (struct tarfile *)f->f_fsdata; + if (tf != NULL) + return (EBADF); + + tf = scan_tarfile(package, NULL); + if (tf == NULL) + return (ENOENT); + + d->d_fileno = 0; + d->d_reclen = sizeof(*d); + d->d_type = DT_REG; + memcpy(d->d_name, tf->tf_hdr.ut_name, sizeof(d->d_name)); + return (0); +} + +/* + * Low-level support functions. + */ + +static int +get_byte(struct package *pkg, off_t *op) +{ + int c; + + if (pkg->pkg_zs.avail_in == 0) { + c = read(pkg->pkg_fd, pkg->pkg_buf, PKG_BUFSIZE); + if (c <= 0) + return (-1); + pkg->pkg_zs.avail_in = c; + pkg->pkg_zs.next_in = pkg->pkg_buf; + } + + c = *pkg->pkg_zs.next_in; + pkg->pkg_zs.next_in++; + pkg->pkg_zs.avail_in--; + (*op)++; + return (c); +} + +static int +get_zipped(struct package *pkg, void *buf, size_t bufsz) +{ + int c; + + pkg->pkg_zs.next_out = buf; + pkg->pkg_zs.avail_out = bufsz; + + while (pkg->pkg_zs.avail_out) { + if (pkg->pkg_zs.avail_in == 0) { + c = read(pkg->pkg_fd, pkg->pkg_buf, PKG_BUFSIZE); + if (c <= 0) { + errno = EIO; + return (-1); + } + pkg->pkg_zs.avail_in = c; + pkg->pkg_zs.next_in = pkg->pkg_buf; + } + + c = inflate(&pkg->pkg_zs, Z_SYNC_FLUSH); + if (c != Z_OK && c != Z_STREAM_END) { + errno = EIO; + return (-1); + } + } + + pkg->pkg_ofs += bufsz; + return (0); +} + +static int +cache_data(struct tarfile *tf) +{ + struct package *pkg; + size_t sz; + + if (tf == NULL) { + DBG(("%s: no file to cache data for?\n", __func__)); + errno = EINVAL; + return (-1); + } + + pkg = tf->tf_pkg; + if (pkg == NULL) { + DBG(("%s: no package associated with file?\n", __func__)); + errno = EINVAL; + return (-1); + } + + if (tf->tf_ofs != pkg->pkg_ofs) { + DBG(("%s: caching after partial read of file %s?\n", + __func__, tf->tf_hdr.ut_name)); + errno = EINVAL; + return (-1); + } + + /* We don't cache everything... */ + if (tf->tf_size > PKG_MAXCACHESZ) { + errno = ENOMEM; + return (-1); + } + + /* All files are padded to a multiple of 512 bytes. */ + sz = (tf->tf_size + 0x1ff) & ~0x1ff; + + tf->tf_cache = malloc(sz); + if (tf->tf_cache == NULL) { + DBG(("%s: could not allocate %d bytes\n", __func__, (int)sz)); + errno = ENOMEM; + return (-1); + } + + tf->tf_cachesz = sz; + return (get_zipped(pkg, tf->tf_cache, sz)); +} + +/* + * Note that this implementation does not (and should not!) obey + * locale settings; you cannot simply substitute strtol here, since + * it does obey locale. + */ +static off_t +pkg_atol8(const char *p, unsigned char_cnt) +{ + int64_t l, limit, last_digit_limit; + int digit, sign, base; + + base = 8; + limit = INT64_MAX / base; + last_digit_limit = INT64_MAX % base; + + while (*p == ' ' || *p == '\t') + p++; + if (*p == '-') { + sign = -1; + p++; + } else + sign = 1; + + l = 0; + digit = *p - '0'; + while (digit >= 0 && digit < base && char_cnt-- > 0) { + if (l>limit || (l == limit && digit > last_digit_limit)) { + l = UINT64_MAX; /* Truncate on overflow. */ + break; + } + l = (l * base) + digit; + digit = *++p - '0'; + } + return (sign < 0) ? -l : l; +} + +/* + * Parse a base-256 integer. This is just a straight signed binary + * value in big-endian order, except that the high-order bit is + * ignored. Remember that "int64_t" may or may not be exactly 64 + * bits; the implementation here tries to avoid making any assumptions + * about the actual size of an int64_t. It does assume we're using + * twos-complement arithmetic, though. + */ +static int64_t +pkg_atol256(const char *_p, unsigned char_cnt) +{ + int64_t l, upper_limit, lower_limit; + const unsigned char *p = (const unsigned char *)_p; + + upper_limit = INT64_MAX / 256; + lower_limit = INT64_MIN / 256; + + /* Pad with 1 or 0 bits, depending on sign. */ + if ((0x40 & *p) == 0x40) + l = (int64_t)-1; + else + l = 0; + l = (l << 6) | (0x3f & *p++); + while (--char_cnt > 0) { + if (l > upper_limit) { + l = INT64_MAX; /* Truncate on overflow */ + break; + } else if (l < lower_limit) { + l = INT64_MIN; + break; + } + l = (l << 8) | (0xff & (int64_t)*p++); + } + return (l); +} + +static off_t +pkg_atol(const char *p, unsigned char_cnt) +{ + /* + * Technically, GNU pkg considers a field to be in base-256 + * only if the first byte is 0xff or 0x80. + */ + if (*p & 0x80) + return (pkg_atol256(p, char_cnt)); + return (pkg_atol8(p, char_cnt)); +} + +static int +get_mode(struct tarfile *tf) +{ + return (pkg_atol(tf->tf_hdr.ut_mode, sizeof(tf->tf_hdr.ut_mode))); +} + +/* GZip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +static int +new_package(int fd, struct package **pp) +{ + struct package *pkg; + off_t ofs; + int flags, i, error; + + pkg = malloc(sizeof(*pkg)); + if (pkg == NULL) + return (ENOMEM); + + bzero(pkg, sizeof(*pkg)); + pkg->pkg_fd = fd; + + /* + * Parse the header. + */ + error = EFTYPE; + ofs = 0; + + /* Check megic. */ + if (get_byte(pkg, &ofs) != 0x1f || get_byte(pkg, &ofs) != 0x8b) + goto fail; + /* Check method. */ + if (get_byte(pkg, &ofs) != Z_DEFLATED) + goto fail; + /* Check flags. */ + flags = get_byte(pkg, &ofs); + if (flags & RESERVED) + goto fail; + + /* Skip time, xflags and OS code. */ + for (i = 0; i < 6; i++) { + if (get_byte(pkg, &ofs) == -1) + goto fail; + } + + /* Skip extra field. */ + if (flags & EXTRA_FIELD) { + i = (get_byte(pkg, &ofs) & 0xff) | + ((get_byte(pkg, &ofs) << 8) & 0xff); + while (i-- > 0) { + if (get_byte(pkg, &ofs) == -1) + goto fail; + } + } + + /* Skip original file name. */ + if (flags & ORIG_NAME) { + do { + i = get_byte(pkg, &ofs); + } while (i != 0 && i != -1); + if (i == -1) + goto fail; + } + + /* Print the comment if it's there. */ + if (flags & COMMENT) { + while (1) { + i = get_byte(pkg, &ofs); + if (i == -1) + goto fail; + if (i == 0) + break; + putchar(i); + } + } + + /* Skip the CRC. */ + if (flags & HEAD_CRC) { + if (get_byte(pkg, &ofs) == -1) + goto fail; + if (get_byte(pkg, &ofs) == -1) + goto fail; + } + + /* + * Done parsing the ZIP header. Spkgt the inflation engine. + */ + error = inflateInit2(&pkg->pkg_zs, -15); + if (error != Z_OK) + goto fail; + + *pp = pkg; + return (0); + + fail: + free(pkg); + return (error); +} + +static struct tarfile * +scan_tarfile(struct package *pkg, struct tarfile *last) +{ + char buf[512]; + struct tarfile *cur; + off_t ofs; + size_t sz; + + cur = (last != NULL) ? last->tf_next : pkg->pkg_first; + if (cur == NULL) { + ofs = (last != NULL) ? last->tf_ofs + last->tf_size : + pkg->pkg_ofs; + ofs = (ofs + 0x1ff) & ~0x1ff; + + /* Check if we've reached EOF. */ + if (ofs < pkg->pkg_ofs) { + errno = ENOSPC; + return (NULL); + } + + if (ofs != pkg->pkg_ofs) { + if (last != NULL && pkg->pkg_ofs == last->tf_ofs) { + if (cache_data(last) == -1) + return (NULL); + } else { + sz = ofs - pkg->pkg_ofs; + while (sz != 0) { + if (sz > sizeof(buf)) + sz = sizeof(buf); + if (get_zipped(pkg, buf, sz) == -1) + return (NULL); + sz = ofs - pkg->pkg_ofs; + } + } + } + + cur = malloc(sizeof(*cur)); + if (cur == NULL) + return (NULL); + memset(cur, 0, sizeof(*cur)); + cur->tf_pkg = pkg; + + while (1) { + if (get_zipped(pkg, &cur->tf_hdr, + sizeof(cur->tf_hdr)) == -1) { + free(cur); + return (NULL); + } + + /* + * There are always 2 empty blocks appended to + * a PKG. It marks the end of the archive. + */ + if (strncmp(cur->tf_hdr.ut_magic, "ustar", 5) != 0) { + free(cur); + errno = ENOSPC; + return (NULL); + } + + cur->tf_ofs = pkg->pkg_ofs; + cur->tf_size = pkg_atol(cur->tf_hdr.ut_size, + sizeof(cur->tf_hdr.ut_size)); + + if (cur->tf_hdr.ut_name[0] != '+') + break; + + /* + * Skip package meta-files. + */ + ofs = cur->tf_ofs + cur->tf_size; + ofs = (ofs + 0x1ff) & ~0x1ff; + while (pkg->pkg_ofs < ofs) { + if (get_zipped(pkg, buf, sizeof(buf)) == -1) { + free(cur); + return (NULL); + } + } + } + + if (last != NULL) + last->tf_next = cur; + else + pkg->pkg_first = cur; + pkg->pkg_last = cur; + } + + return (cur); +} Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Thu Jul 31 23:19:01 2014 (r269360) +++ head/lib/libstand/stand.h Thu Jul 31 23:25:13 2014 (r269361) @@ -124,6 +124,7 @@ extern struct fs_ops bzipfs_fsops; extern struct fs_ops dosfs_fsops; extern struct fs_ops ext2fs_fsops; extern struct fs_ops splitfs_fsops; +extern struct fs_ops pkgfs_fsops; /* where values for lseek(2) */ #define SEEK_SET 0 /* set file offset to offset */ Modified: head/sys/boot/libstand32/Makefile ============================================================================== --- head/sys/boot/libstand32/Makefile Thu Jul 31 23:19:01 2014 (r269360) +++ head/sys/boot/libstand32/Makefile Thu Jul 31 23:25:13 2014 (r269361) @@ -166,6 +166,7 @@ SRCS+= bootp.c rarp.c bootparam.c SRCS+= ufs.c nfs.c cd9660.c tftp.c gzipfs.c bzipfs.c SRCS+= dosfs.c ext2fs.c SRCS+= splitfs.c +SRCS+= pkgfs.c .if ${MK_NAND} != "no" SRCS+= nandfs.c .endif From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 00:00:47 2014 Return-Path: Delivered-To: svn-src-all@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 0CA00BC9; Fri, 1 Aug 2014 00:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEC912BB5; Fri, 1 Aug 2014 00:00:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7100k32098809; Fri, 1 Aug 2014 00:00:46 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7100kxm098806; Fri, 1 Aug 2014 00:00:46 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408010000.s7100kxm098806@svn.freebsd.org> From: Warner Losh Date: Fri, 1 Aug 2014 00:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269362 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 00:00:47 -0000 Author: imp Date: Fri Aug 1 00:00:46 2014 New Revision: 269362 URL: http://svnweb.freebsd.org/changeset/base/269362 Log: Use rm -x only on FreeBSD 10 and newer. Many people still build from older hosts, which still works, so don't break that gratuitously. MFC After: 3 days Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Thu Jul 31 23:25:13 2014 (r269361) +++ head/tools/tools/nanobsd/nanobsd.sh Fri Aug 1 00:00:46 2014 (r269362) @@ -178,6 +178,15 @@ SRCCONF=${SRCCONF:=/dev/null} # ####################################################################### +# rm doesn't know -x prior to FreeBSD 10, so cope with a variety of build +# hosts for now. +nano_rm ( ) { + case $(uname -r) in + 7*|8*|9*) rm $* ;; + *) rm -x $* ;; + esac +} + # run in the world chroot, errors fatal CR() { @@ -200,9 +209,9 @@ nano_cleanup ( ) ( clean_build ( ) ( pprint 2 "Clean and create object directory (${MAKEOBJDIRPREFIX})" - if ! rm -xrf ${MAKEOBJDIRPREFIX}/ > /dev/null 2>&1 ; then + if ! nano_rm -rf ${MAKEOBJDIRPREFIX}/ > /dev/null 2>&1 ; then chflags -R noschg ${MAKEOBJDIRPREFIX}/ - rm -xr ${MAKEOBJDIRPREFIX}/ + nano_rm -r ${MAKEOBJDIRPREFIX}/ fi mkdir -p ${MAKEOBJDIRPREFIX} printenv > ${MAKEOBJDIRPREFIX}/_.env @@ -256,17 +265,17 @@ build_kernel ( ) ( clean_world ( ) ( if [ "${NANO_OBJ}" != "${MAKEOBJDIRPREFIX}" ]; then pprint 2 "Clean and create object directory (${NANO_OBJ})" - if ! rm -rxf ${NANO_OBJ}/ > /dev/null 2>&1 ; then + if ! nano_rm -rf ${NANO_OBJ}/ > /dev/null 2>&1 ; then chflags -R noschg ${NANO_OBJ} - rm -xr ${NANO_OBJ}/ + nano_rm -r ${NANO_OBJ}/ fi mkdir -p ${NANO_OBJ} ${NANO_WORLDDIR} printenv > ${NANO_OBJ}/_.env else pprint 2 "Clean and create world directory (${NANO_WORLDDIR})" - if ! rm -rxf ${NANO_WORLDDIR}/ > /dev/null 2>&1 ; then + if ! nano_rm -rf ${NANO_WORLDDIR}/ > /dev/null 2>&1 ; then chflags -R noschg ${NANO_WORLDDIR} - rm -rxf ${NANO_WORLDDIR}/ + nano_rm -rf ${NANO_WORLDDIR}/ fi mkdir -p ${NANO_WORLDDIR} fi @@ -378,7 +387,7 @@ setup_nanobsd ( ) ( cd usr/local/etc find . -print | cpio -dumpl ../../../etc/local cd .. - rm -rf etc + nano_rm -rf etc ln -s ../../etc/local etc ) fi @@ -400,7 +409,7 @@ setup_nanobsd ( ) ( echo "mount -o ro /dev/${NANO_DRIVE}s3" > conf/default/etc/remount # Put /tmp on the /var ramdisk (could be symlink already) - test -d tmp && rmdir tmp || rm -f tmp + test -d tmp && rmdir tmp || nano_rm -f tmp ln -s var/tmp tmp ) > ${NANO_OBJ}/_.dl 2>&1 @@ -560,7 +569,7 @@ create_i386_diskimage ( ) ( -y ${NANO_HEADS}` else echo "Creating md backing file..." - rm -f ${IMG} + nano_rm -f ${IMG} dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ -y ${NANO_HEADS}` @@ -785,7 +794,7 @@ cust_pkg () ( exit 2 fi done - rm -rxf ${NANO_WORLDDIR}/Pkg + nano_rm -rf ${NANO_WORLDDIR}/Pkg ) cust_pkgng () ( @@ -820,7 +829,7 @@ cust_pkgng () ( echo "FAILED: pkg bootstrapping faied" exit 2 fi - rm -f ${NANO_WORLDDIR}/Pkg/pkg-* + nano_rm -f ${NANO_WORLDDIR}/Pkg/pkg-* # Count & report how many we have to install todo=`ls ${NANO_WORLDDIR}/Pkg | /usr/bin/wc -l` @@ -849,7 +858,7 @@ cust_pkgng () ( exit 2 fi done - rm -rxf ${NANO_WORLDDIR}/Pkg + nano_rm -rf ${NANO_WORLDDIR}/Pkg ) ####################################################################### From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 00:00:54 2014 Return-Path: Delivered-To: svn-src-all@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 DDC9CD03; Fri, 1 Aug 2014 00:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACB9E2BB8; Fri, 1 Aug 2014 00:00:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7100s5w098953; Fri, 1 Aug 2014 00:00:54 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7100sNQ098952; Fri, 1 Aug 2014 00:00:54 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408010000.s7100sNQ098952@svn.freebsd.org> From: Warner Losh Date: Fri, 1 Aug 2014 00:00:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269363 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 00:00:55 -0000 Author: imp Date: Fri Aug 1 00:00:54 2014 New Revision: 269363 URL: http://svnweb.freebsd.org/changeset/base/269363 Log: NANO_OBJ shouldn't end with a '/', so remove it here. This makes the pathnames printed not have the dreaded // which makes it hard to cut and paste into an emacs find file command... MFC After: 3 days Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Fri Aug 1 00:00:46 2014 (r269362) +++ head/tools/tools/nanobsd/nanobsd.sh Fri Aug 1 00:00:54 2014 (r269363) @@ -992,7 +992,7 @@ trap nano_cleanup EXIT ####################################################################### # Setup and Export Internal variables # -test -n "${NANO_OBJ}" || NANO_OBJ=/usr/obj/nanobsd.${NANO_NAME}/ +test -n "${NANO_OBJ}" || NANO_OBJ=/usr/obj/nanobsd.${NANO_NAME} test -n "${MAKEOBJDIRPREFIX}" || MAKEOBJDIRPREFIX=${NANO_OBJ} test -n "${NANO_DISKIMGDIR}" || NANO_DISKIMGDIR=${NANO_OBJ} From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 00:37:21 2014 Return-Path: Delivered-To: svn-src-all@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 B9A73342; Fri, 1 Aug 2014 00:37:21 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 718C1209D; Fri, 1 Aug 2014 00:37:21 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 227B525D3897; Fri, 1 Aug 2014 00:37:19 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3B039C22E55; Fri, 1 Aug 2014 00:37:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id QuoM2Gjxy5ox; Fri, 1 Aug 2014 00:37:15 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:ccf7:cad:ed3d:dbb0] (unknown [IPv6:fde9:577b:c1a9:4410:ccf7:cad:ed3d:dbb0]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 7FD02C22E53; Fri, 1 Aug 2014 00:37:11 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269319 - head/sys/dev/usb/net From: "Bjoern A. Zeeb" In-Reply-To: <201407310334.s6V3YP4Q018668@svn.freebsd.org> Date: Fri, 1 Aug 2014 00:37:06 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <0841AC77-B2A7-47DD-8A9D-1AC8DEB79854@FreeBSD.org> References: <201407310334.s6V3YP4Q018668@svn.freebsd.org> To: Kevin Lo X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 00:37:21 -0000 On 31 Jul 2014, at 03:34 , Kevin Lo wrote: > Author: kevlo > Date: Thu Jul 31 03:34:25 2014 > New Revision: 269319 > URL: http://svnweb.freebsd.org/changeset/base/269319 >=20 > Log: > In copyright statement correct that the author is me, not Bill Paul. And you still hear the voices in his (now your) head? If this is not = intentional either /usr/share/examples/etc/bsd-style-copyright is = probably what you are looking for. We should really stop copying and pasting license from one file to = another and copying and pasting network drivers around . . . >=20 > Modified: > head/sys/dev/usb/net/if_axgereg.h >=20 > Modified: head/sys/dev/usb/net/if_axgereg.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 02:07:48 2014 = (r269318) > +++ head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 03:34:25 2014 = (r269319) > @@ -11,10 +11,10 @@ > * 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 Bill Paul AND CONTRIBUTORS ``AS IS'' = AND > + * 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 Bill Paul OR THE VOICES IN HIS = HEAD > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS = HEAD > * 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 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 01:30:18 2014 Return-Path: Delivered-To: svn-src-all@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 09F6EBE6; Fri, 1 Aug 2014 01:30: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF1CF25A3; Fri, 1 Aug 2014 01:30:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s711UHVh055995; Fri, 1 Aug 2014 01:30:17 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s711UGEC055984; Fri, 1 Aug 2014 01:30:16 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408010130.s711UGEC055984@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 1 Aug 2014 01:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269364 - in head/sys/modules/cxgbe: . if_cxgbe iw_cxgbe t4_firmware t5_firmware tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 01:30:18 -0000 Author: np Date: Fri Aug 1 01:30:16 2014 New Revision: 269364 URL: http://svnweb.freebsd.org/changeset/base/269364 Log: Improve compliance with style.Makefile(5). MFC after: 2 weeks Modified: head/sys/modules/cxgbe/Makefile head/sys/modules/cxgbe/if_cxgbe/Makefile head/sys/modules/cxgbe/iw_cxgbe/Makefile head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/tom/Makefile Modified: head/sys/modules/cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -4,21 +4,21 @@ .include -SUBDIR = if_cxgbe -SUBDIR+= t4_firmware -SUBDIR+= t5_firmware -SUBDIR+= ${_tom} -SUBDIR+= ${_iw_cxgbe} +SUBDIR= if_cxgbe +SUBDIR+= t4_firmware +SUBDIR+= t5_firmware +SUBDIR+= ${_tom} +SUBDIR+= ${_iw_cxgbe} .if ${MACHINE_CPUARCH} == "amd64" -_tom= tom +_tom= tom .if ${MK_OFED} != "no" || defined(ALL_MODULES) _iw_cxgbe= iw_cxgbe .endif .endif .if ${MACHINE_CPUARCH} == "i386" -_tom= tom +_tom= tom .endif .include Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -4,21 +4,22 @@ .include -CXGBE = ${.CURDIR}/../../../dev/cxgbe +CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE} ${CXGBE}/common -KMOD = if_cxgbe -SRCS = t4_main.c t4_sge.c t4_l2t.c t4_tracer.c t4_netmap.c -SRCS+= t4_hw.c -SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h -SRCS+= opt_ofed.h - -CFLAGS+= -I${CXGBE} +KMOD= if_cxgbe +SRCS= t4_main.c t4_sge.c t4_l2t.c t4_tracer.c t4_netmap.c +SRCS+= t4_hw.c +SRCS+= device_if.h bus_if.h pci_if.h +SRCS+= opt_inet.h opt_inet6.h +SRCS+= opt_ofed.h # Provide the timestamp of a packet in its header mbuf. #CFLAGS+= -DT4_PKT_TIMESTAMP +CFLAGS+= -I${CXGBE} + + .if !defined(KERNBUILDDIR) .if ${MK_INET_SUPPORT} != "no" opt_inet.h: Modified: head/sys/modules/cxgbe/iw_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/iw_cxgbe/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/iw_cxgbe/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -2,13 +2,13 @@ .include -CXGBE = ${.CURDIR}/../../../dev/cxgbe +CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE}/iw_cxgbe -KMOD= iw_cxgbe -SRCS= device.c cm.c provider.c mem.c cq.c qp.c resource.c ev.c id_table.c -SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h opt_ktr.h -SRCS+= opt_inet.h opt_ofed.h vnode_if.h +KMOD= iw_cxgbe +SRCS= device.c cm.c provider.c mem.c cq.c qp.c resource.c ev.c id_table.c +SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h opt_ktr.h +SRCS+= opt_inet.h opt_ofed.h vnode_if.h CFLAGS+= -I${CXGBE} -I${.CURDIR}/../../../ofed/include -DLINUX_TYPES_DEFINED .if !defined(KERNBUILDDIR) Modified: head/sys/modules/cxgbe/t4_firmware/Makefile ============================================================================== --- head/sys/modules/cxgbe/t4_firmware/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/t4_firmware/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -2,24 +2,24 @@ # $FreeBSD$ # -T4FW = ${.CURDIR}/../../../dev/cxgbe/firmware +T4FW= ${.CURDIR}/../../../dev/cxgbe/firmware .PATH: ${T4FW} -KMOD = t4fw_cfg -FIRMWS = ${KMOD}.txt:${KMOD}:1.0.0.0 +KMOD= t4fw_cfg +FIRMWS= ${KMOD}.txt:${KMOD}:1.0.0.0 # You can have additional configuration files in the ${T4FW} directory. # t4fw_cfg_.txt CFG_FILES != cd ${T4FW} && echo ${KMOD}_*.txt .for F in ${CFG_FILES} .if exists(${F}) -FIRMWS += ${F}:${F:C/.txt//}:1.0.0.0 +FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER = 1.11.27.0 -FIRMWS += t4fw.fw:t4fw:${T4FW_VER} -CLEANFILES += t4fw.fw +T4FW_VER= 1.11.27.0 +FIRMWS+= t4fw.fw:t4fw:${T4FW_VER} +CLEANFILES+= t4fw.fw t4fw.fw: t4fw-${T4FW_VER}.bin.uu uudecode -o ${.TARGET} ${.ALLSRC} Modified: head/sys/modules/cxgbe/t5_firmware/Makefile ============================================================================== --- head/sys/modules/cxgbe/t5_firmware/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/t5_firmware/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -2,24 +2,24 @@ # $FreeBSD$ # -T5FW = ${.CURDIR}/../../../dev/cxgbe/firmware +T5FW= ${.CURDIR}/../../../dev/cxgbe/firmware .PATH: ${T5FW} -KMOD = t5fw_cfg -FIRMWS = ${KMOD}.txt:${KMOD}:1.0.0.0 +KMOD= t5fw_cfg +FIRMWS= ${KMOD}.txt:${KMOD}:1.0.0.0 # You can have additional configuration files in the ${T5FW} directory. # t5fw_cfg_.txt CFG_FILES != cd ${T5FW} && echo ${KMOD}_*.txt .for F in ${CFG_FILES} .if exists(${F}) -FIRMWS += ${F}:${F:C/.txt//}:1.0.0.0 +FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER = 1.11.27.0 -FIRMWS += t5fw.fw:t5fw:${T5FW_VER} -CLEANFILES += t5fw.fw +T5FW_VER= 1.11.27.0 +FIRMWS+= t5fw.fw:t5fw:${T5FW_VER} +CLEANFILES+= t5fw.fw t5fw.fw: t5fw-${T5FW_VER}.bin.uu uudecode -o ${.TARGET} ${.ALLSRC} Modified: head/sys/modules/cxgbe/tom/Makefile ============================================================================== --- head/sys/modules/cxgbe/tom/Makefile Fri Aug 1 00:00:54 2014 (r269363) +++ head/sys/modules/cxgbe/tom/Makefile Fri Aug 1 01:30:16 2014 (r269364) @@ -4,13 +4,13 @@ .include -CXGBE = ${.CURDIR}/../../../dev/cxgbe +CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE}/tom -KMOD = t4_tom -SRCS = t4_tom.c t4_connect.c t4_listen.c t4_cpl_io.c t4_tom_l2t.c t4_ddp.c -SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h +KMOD= t4_tom +SRCS= t4_tom.c t4_connect.c t4_listen.c t4_cpl_io.c t4_tom_l2t.c t4_ddp.c +SRCS+= device_if.h bus_if.h pci_if.h +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -I${CXGBE} From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 01:48:42 2014 Return-Path: Delivered-To: svn-src-all@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 35EC7EB3; Fri, 1 Aug 2014 01:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 237B32732; Fri, 1 Aug 2014 01:48:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s711mgmn067998; Fri, 1 Aug 2014 01:48:42 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s711mfDj067996; Fri, 1 Aug 2014 01:48:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201408010148.s711mfDj067996@svn.freebsd.org> From: Alan Cox Date: Fri, 1 Aug 2014 01:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269365 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 01:48:42 -0000 Author: alc Date: Fri Aug 1 01:48:41 2014 New Revision: 269365 URL: http://svnweb.freebsd.org/changeset/base/269365 Log: Correct a long-standing problem in moea{,64}_pvo_enter() that was revealed by the combination of r268591 and r269134: When we attempt to add the wired attribute to an existing mapping, moea{,64}_pvo_enter() do nothing. (They only set the wired attribute on newly created mappings.) Tested by: andreast Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 01:30:16 2014 (r269364) +++ head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 01:48:41 2014 (r269365) @@ -1951,7 +1951,21 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zon if ((pvo->pvo_pte.pte.pte_lo & PTE_RPGN) == pa && (pvo->pvo_pte.pte.pte_lo & PTE_PP) == (pte_lo & PTE_PP)) { + /* + * The PTE is not changing. Instead, this may + * be a request to change the mapping's wired + * attribute. + */ mtx_unlock(&moea_table_mutex); + if ((flags & PVO_WIRED) != 0 && + (pvo->pvo_vaddr & PVO_WIRED) == 0) { + pvo->pvo_vaddr |= PVO_WIRED; + pm->pm_stats.wired_count++; + } else if ((flags & PVO_WIRED) == 0 && + (pvo->pvo_vaddr & PVO_WIRED) != 0) { + pvo->pvo_vaddr &= ~PVO_WIRED; + pm->pm_stats.wired_count--; + } return (0); } moea_pvo_remove(pvo, -1); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Aug 1 01:30:16 2014 (r269364) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Aug 1 01:48:41 2014 (r269365) @@ -2234,6 +2234,7 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u uint64_t pte_lo, int flags) { struct pvo_entry *pvo; + uintptr_t pt; uint64_t vsid; int first; u_int ptegidx; @@ -2276,13 +2277,42 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u if ((pvo->pvo_pte.lpte.pte_lo & LPTE_RPGN) == pa && (pvo->pvo_pte.lpte.pte_lo & (LPTE_NOEXEC | LPTE_PP)) == (pte_lo & (LPTE_NOEXEC | LPTE_PP))) { + /* + * The physical page and protection are not + * changing. Instead, this may be a request + * to change the mapping's wired attribute. + */ + pt = -1; + if ((flags & PVO_WIRED) != 0 && + (pvo->pvo_vaddr & PVO_WIRED) == 0) { + pt = MOEA64_PVO_TO_PTE(mmu, pvo); + pvo->pvo_vaddr |= PVO_WIRED; + pvo->pvo_pte.lpte.pte_hi |= LPTE_WIRED; + pm->pm_stats.wired_count++; + } else if ((flags & PVO_WIRED) == 0 && + (pvo->pvo_vaddr & PVO_WIRED) != 0) { + pt = MOEA64_PVO_TO_PTE(mmu, pvo); + pvo->pvo_vaddr &= ~PVO_WIRED; + pvo->pvo_pte.lpte.pte_hi &= ~LPTE_WIRED; + pm->pm_stats.wired_count--; + } if (!(pvo->pvo_pte.lpte.pte_hi & LPTE_VALID)) { + KASSERT(pt == -1, + ("moea64_pvo_enter: valid pt")); /* Re-insert if spilled */ i = MOEA64_PTE_INSERT(mmu, ptegidx, &pvo->pvo_pte.lpte); if (i >= 0) PVO_PTEGIDX_SET(pvo, i); moea64_pte_overflow--; + } else if (pt != -1) { + /* + * The PTE's wired attribute is not a + * hardware feature, so there is no + * need to invalidate any TLB entries. + */ + MOEA64_PTE_CHANGE(mmu, pt, + &pvo->pvo_pte.lpte, pvo->pvo_vpn); } return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 01:53:40 2014 Return-Path: Delivered-To: svn-src-all@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 8F223F0; Fri, 1 Aug 2014 01:53: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 701C527E2; Fri, 1 Aug 2014 01:53:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s711reUU072619; Fri, 1 Aug 2014 01:53:40 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s711rdJY072615; Fri, 1 Aug 2014 01:53:39 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408010153.s711rdJY072615@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 1 Aug 2014 01:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269366 - in head/sys/modules/cxgbe: if_cxgbe iw_cxgbe tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 01:53:40 -0000 Author: np Date: Fri Aug 1 01:53:39 2014 New Revision: 269366 URL: http://svnweb.freebsd.org/changeset/base/269366 Log: List one file per line in the Makefiles. This makes it easier to read diffs when a file is added or removed. MFC after: 2 weeks Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile head/sys/modules/cxgbe/iw_cxgbe/Makefile head/sys/modules/cxgbe/tom/Makefile Modified: head/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Aug 1 01:48:41 2014 (r269365) +++ head/sys/modules/cxgbe/if_cxgbe/Makefile Fri Aug 1 01:53:39 2014 (r269366) @@ -8,18 +8,24 @@ CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE} ${CXGBE}/common KMOD= if_cxgbe -SRCS= t4_main.c t4_sge.c t4_l2t.c t4_tracer.c t4_netmap.c -SRCS+= t4_hw.c -SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h +SRCS= bus_if.h +SRCS+= device_if.h +SRCS+= opt_inet.h +SRCS+= opt_inet6.h SRCS+= opt_ofed.h +SRCS+= pci_if.h +SRCS+= t4_hw.c +SRCS+= t4_l2t.c +SRCS+= t4_main.c +SRCS+= t4_netmap.c +SRCS+= t4_sge.c +SRCS+= t4_tracer.c # Provide the timestamp of a packet in its header mbuf. #CFLAGS+= -DT4_PKT_TIMESTAMP CFLAGS+= -I${CXGBE} - .if !defined(KERNBUILDDIR) .if ${MK_INET_SUPPORT} != "no" opt_inet.h: Modified: head/sys/modules/cxgbe/iw_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/iw_cxgbe/Makefile Fri Aug 1 01:48:41 2014 (r269365) +++ head/sys/modules/cxgbe/iw_cxgbe/Makefile Fri Aug 1 01:53:39 2014 (r269366) @@ -6,9 +6,25 @@ CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE}/iw_cxgbe KMOD= iw_cxgbe -SRCS= device.c cm.c provider.c mem.c cq.c qp.c resource.c ev.c id_table.c -SRCS+= bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h opt_ktr.h -SRCS+= opt_inet.h opt_ofed.h vnode_if.h +SRCS= bus_if.h +SRCS+= cm.c +SRCS+= cq.c +SRCS+= device.c +SRCS+= device_if.h +SRCS+= ev.c +SRCS+= id_table.c +SRCS+= mem.c +SRCS+= opt_inet.h +SRCS+= opt_ktr.h +SRCS+= opt_ofed.h +SRCS+= opt_sched.h +SRCS+= pci_if.h +SRCS+= pcib_if.h +SRCS+= provider.c +SRCS+= qp.c +SRCS+= resource.c +SRCS+= vnode_if.h + CFLAGS+= -I${CXGBE} -I${.CURDIR}/../../../ofed/include -DLINUX_TYPES_DEFINED .if !defined(KERNBUILDDIR) Modified: head/sys/modules/cxgbe/tom/Makefile ============================================================================== --- head/sys/modules/cxgbe/tom/Makefile Fri Aug 1 01:48:41 2014 (r269365) +++ head/sys/modules/cxgbe/tom/Makefile Fri Aug 1 01:53:39 2014 (r269366) @@ -8,9 +8,17 @@ CXGBE= ${.CURDIR}/../../../dev/cxgbe .PATH: ${CXGBE}/tom KMOD= t4_tom -SRCS= t4_tom.c t4_connect.c t4_listen.c t4_cpl_io.c t4_tom_l2t.c t4_ddp.c -SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h +SRCS= bus_if.h +SRCS+= device_if.h +SRCS+= opt_inet.h +SRCS+= opt_inet6.h +SRCS+= pci_if.h +SRCS+= t4_connect.c +SRCS+= t4_cpl_io.c +SRCS+= t4_ddp.c +SRCS+= t4_listen.c +SRCS+= t4_tom.c +SRCS+= t4_tom_l2t.c CFLAGS+= -I${CXGBE} From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 02:20:18 2014 Return-Path: Delivered-To: svn-src-all@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 F25EF434; Fri, 1 Aug 2014 02:20:17 +0000 (UTC) Received: from ns.kevlo.org (220-135-115-6.HINET-IP.hinet.net [220.135.115.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "ns.kevlo.org", Issuer "ns.kevlo.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 93F132A2C; Fri, 1 Aug 2014 02:20:16 +0000 (UTC) Received: from ns.kevlo.org (localhost [127.0.0.1]) by ns.kevlo.org (8.14.8/8.14.8) with ESMTP id s712JtK1063609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 1 Aug 2014 10:19:56 +0800 (CST) (envelope-from kevlo@ns.kevlo.org) Received: (from kevlo@localhost) by ns.kevlo.org (8.14.8/8.14.8/Submit) id s712JtNq063608; Fri, 1 Aug 2014 10:19:55 +0800 (CST) (envelope-from kevlo) Date: Fri, 1 Aug 2014 10:19:54 +0800 From: Kevin Lo To: "Bjoern A. Zeeb" Subject: Re: svn commit: r269319 - head/sys/dev/usb/net Message-ID: <20140801021954.GA63598@ns.kevlo.org> References: <201407310334.s6V3YP4Q018668@svn.freebsd.org> <0841AC77-B2A7-47DD-8A9D-1AC8DEB79854@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0841AC77-B2A7-47DD-8A9D-1AC8DEB79854@FreeBSD.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 02:20:18 -0000 On Fri, Aug 01, 2014 at 12:37:06AM +0000, Bjoern A. Zeeb wrote: > > > On 31 Jul 2014, at 03:34 , Kevin Lo wrote: > > > Author: kevlo > > Date: Thu Jul 31 03:34:25 2014 > > New Revision: 269319 > > URL: http://svnweb.freebsd.org/changeset/base/269319 > > > > Log: > > In copyright statement correct that the author is me, not Bill Paul. > > And you still hear the voices in his (now your) head? If this is not intentional either /usr/share/examples/etc/bsd-style-copyright is probably what you are looking for. > > We should really stop copying and pasting license from one file to another and copying and pasting network drivers around . . . > Didn't I fix it in r269322 ? > > > > Modified: > > head/sys/dev/usb/net/if_axgereg.h > > > > Modified: head/sys/dev/usb/net/if_axgereg.h > > ============================================================================== > > --- head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 02:07:48 2014 (r269318) > > +++ head/sys/dev/usb/net/if_axgereg.h Thu Jul 31 03:34:25 2014 (r269319) > > @@ -11,10 +11,10 @@ > > * 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 Bill Paul AND CONTRIBUTORS ``AS IS'' AND > > + * 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 Bill Paul OR THE VOICES IN HIS HEAD > > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD > > * 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 > > > > — > Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 Kevin From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 04:05:14 2014 Return-Path: Delivered-To: svn-src-all@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 1153E61E; Fri, 1 Aug 2014 04:05:14 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2A562620; Fri, 1 Aug 2014 04:05:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7145D0T032885; Fri, 1 Aug 2014 04:05:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7145DHx032884; Fri, 1 Aug 2014 04:05:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201408010405.s7145DHx032884@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 1 Aug 2014 04:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269367 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 04:05:14 -0000 Author: kib Date: Fri Aug 1 04:05:13 2014 New Revision: 269367 URL: http://svnweb.freebsd.org/changeset/base/269367 Log: MFC r269205: Simplify the expression. Modified: stable/10/sys/kern/kern_proc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_proc.c ============================================================================== --- stable/10/sys/kern/kern_proc.c Fri Aug 1 01:53:39 2014 (r269366) +++ stable/10/sys/kern/kern_proc.c Fri Aug 1 04:05:13 2014 (r269367) @@ -2148,7 +2148,7 @@ kern_proc_vmmap_resident(vm_map_t map, v obj = entry->object.vm_object; addr = entry->start; m_adv = NULL; - pi = OFF_TO_IDX(entry->offset + addr - entry->start); + pi = OFF_TO_IDX(entry->offset); for (; addr < entry->end; addr += IDX_TO_OFF(pi_adv), pi += pi_adv) { if (m_adv != NULL) { m = m_adv; From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 04:53:36 2014 Return-Path: Delivered-To: svn-src-all@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 52660B32; Fri, 1 Aug 2014 04:53:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2657429A3; Fri, 1 Aug 2014 04:53:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s714ra2J055320; Fri, 1 Aug 2014 04:53:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s714rZuc055316; Fri, 1 Aug 2014 04:53:35 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201408010453.s714rZuc055316@svn.freebsd.org> From: Alan Cox Date: Fri, 1 Aug 2014 04:53:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269368 - in head/sys/powerpc: aim include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 04:53:36 -0000 Author: alc Date: Fri Aug 1 04:53:35 2014 New Revision: 269368 URL: http://svnweb.freebsd.org/changeset/base/269368 Log: Retire PVO_EXECUTABLE. It's neither used nor set correctly. Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/include/pmap.h Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 04:05:13 2014 (r269367) +++ head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 04:53:35 2014 (r269368) @@ -1184,9 +1184,6 @@ moea_enter_locked(pmap_t pmap, vm_offset } else pte_lo |= PTE_BR; - if (prot & VM_PROT_EXECUTE) - pvo_flags |= PVO_EXECUTABLE; - if (wired) pvo_flags |= PVO_WIRED; @@ -1742,8 +1739,6 @@ moea_protect(mmu_t mmu, pmap_t pm, vm_of for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); pvo != NULL && PVO_VADDR(pvo) < eva; pvo = tpvo) { tpvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo); - if ((prot & VM_PROT_EXECUTE) == 0) - pvo->pvo_vaddr &= ~PVO_EXECUTABLE; /* * Grab the PTE pointer before we diddle with the cached PTE @@ -1999,8 +1994,6 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zon pvo->pvo_pmap = pm; LIST_INSERT_HEAD(&moea_pvo_table[ptegidx], pvo, pvo_olink); pvo->pvo_vaddr &= ~ADDR_POFF; - if (flags & VM_PROT_EXECUTE) - pvo->pvo_vaddr |= PVO_EXECUTABLE; if (flags & PVO_WIRED) pvo->pvo_vaddr |= PVO_WIRED; if (pvo_head != &moea_pvo_kunmanaged) Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Fri Aug 1 04:05:13 2014 (r269367) +++ head/sys/powerpc/include/pmap.h Fri Aug 1 04:53:35 2014 (r269368) @@ -112,7 +112,6 @@ RB_PROTOTYPE(pvo_tree, pvo_entry, pvo_pl #define PVO_PTEGIDX_VALID 0x008UL /* slot is valid */ #define PVO_WIRED 0x010UL /* PVO entry is wired */ #define PVO_MANAGED 0x020UL /* PVO entry is managed */ -#define PVO_EXECUTABLE 0x040UL /* PVO entry is executable */ #define PVO_BOOTSTRAP 0x080UL /* PVO entry allocated during bootstrap */ #define PVO_LARGE 0x200UL /* large page */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 06:20:27 2014 Return-Path: Delivered-To: svn-src-all@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 E0C64E6D; Fri, 1 Aug 2014 06:20: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCE492B54; Fri, 1 Aug 2014 06:20:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s716KRst095219; Fri, 1 Aug 2014 06:20:27 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s716KPuM095202; Fri, 1 Aug 2014 06:20:25 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201408010620.s716KPuM095202@svn.freebsd.org> From: Ruslan Bukin Date: Fri, 1 Aug 2014 06:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269369 - in head/sys: arm/conf arm/samsung/exynos boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 06:20:28 -0000 Author: br Date: Fri Aug 1 06:20:25 2014 New Revision: 269369 URL: http://svnweb.freebsd.org/changeset/base/269369 Log: Add support for Chromebook2 -- next-generation 8-core (4 in operation), 4GB ram (3.5 usable) ARM machine. Support covers device drivers for: - Serial Peripheral Interface (SPI) - Chrome Embedded Controller (EC) - SPI-based version - XHCI and USB 3.0 dual-role device PHY Also: - Add support for Exynos5420 in Pad module - Move power-related functions to separate driver -- Power Management Unit (PMU) - Enable XHCI for Chromebook1 Special thanks to grehan@ for hardware, and to hselasky@ for r269139. Added: head/sys/arm/conf/CHROMEBOOK-PEACH-PIT (contents, props changed) head/sys/arm/conf/CHROMEBOOK-PEACH-PIT.hints (contents, props changed) head/sys/arm/samsung/exynos/chrome_ec_spi.c (contents, props changed) head/sys/arm/samsung/exynos/exynos5_pmu.c (contents, props changed) head/sys/arm/samsung/exynos/exynos5_pmu.h (contents, props changed) head/sys/arm/samsung/exynos/exynos5_spi.c (contents, props changed) head/sys/arm/samsung/exynos/exynos5_usb_phy.c (contents, props changed) head/sys/arm/samsung/exynos/exynos5_xhci.c (contents, props changed) head/sys/boot/fdt/dts/arm/exynos5420-peach-pit.dts (contents, props changed) Modified: head/sys/arm/conf/CHROMEBOOK head/sys/arm/conf/EXYNOS5.common head/sys/arm/samsung/exynos/chrome_ec.c head/sys/arm/samsung/exynos/chrome_ec.h head/sys/arm/samsung/exynos/exynos5_combiner.c head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/arm/samsung/exynos/exynos5_pad.c head/sys/arm/samsung/exynos/files.exynos5 head/sys/boot/fdt/dts/arm/exynos5.dtsi head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts head/sys/boot/fdt/dts/arm/exynos5250.dtsi head/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts head/sys/boot/fdt/dts/arm/exynos5420.dtsi Modified: head/sys/arm/conf/CHROMEBOOK ============================================================================== --- head/sys/arm/conf/CHROMEBOOK Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/conf/CHROMEBOOK Fri Aug 1 06:20:25 2014 (r269369) @@ -22,7 +22,7 @@ ident CHROMEBOOK hints "CHROMEBOOK.hints" -device chrome_ec # Chrome Embedded Controller +device chrome_ec_i2c # Chrome Embedded Controller device chrome_kb # Chrome Keyboard # Framebuffer Added: head/sys/arm/conf/CHROMEBOOK-PEACH-PIT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/CHROMEBOOK-PEACH-PIT Fri Aug 1 06:20:25 2014 (r269369) @@ -0,0 +1,47 @@ +# Kernel configuration for Chromebook2 (Exynos5 Octa machine). +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "EXYNOS5420" +ident CHROMEBOOK-PEACH-PIT + +hints "CHROMEBOOK-PEACH-PIT.hints" + +device chrome_ec_spi # Chrome Embedded Controller +device chrome_kb # Chrome Keyboard + +# Framebuffer +device vt +device kbdmux +device ukbd + +# Uncomment this for NFS root +#options NFS_ROOT # NFS usable as /, requires NFSCL +#options BOOTP_NFSROOT +#options BOOTP_COMPAT +#options BOOTP +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 +#options ROOTDEVNAME=\"nfs:10.5.0.1:/tftpboot/root\" + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=exynos5420-peach-pit.dts Added: head/sys/arm/conf/CHROMEBOOK-PEACH-PIT.hints ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/CHROMEBOOK-PEACH-PIT.hints Fri Aug 1 06:20:25 2014 (r269369) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# Chrome Embedded Controller +hint.chrome_ec.0.at="spibus0" +hint.chrome_ec.0.addr=0x00 Modified: head/sys/arm/conf/EXYNOS5.common ============================================================================== --- head/sys/arm/conf/EXYNOS5.common Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/conf/EXYNOS5.common Fri Aug 1 06:20:25 2014 (r269369) @@ -101,6 +101,7 @@ options USB_DEBUG #device musb device ehci #device ohci +device xhci device umass device scbus # SCSI bus (required for SCSI) @@ -119,6 +120,10 @@ device uart device iic device iicbus +# SPI +device spibus +device exynos_spi + # Ethernet device ether device mii Modified: head/sys/arm/samsung/exynos/chrome_ec.c ============================================================================== --- head/sys/arm/samsung/exynos/chrome_ec.c Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/samsung/exynos/chrome_ec.c Fri Aug 1 06:20:25 2014 (r269369) @@ -95,7 +95,7 @@ bus_claim(struct ec_softc *sc) /* Say we want the bus */ GPIO_PIN_SET(gpio_dev, sc->our_gpio, GPIO_PIN_LOW); - /* TODO(imax): insert a delay to allow EC to react. */ + /* TODO: insert a delay to allow EC to react. */ /* Check EC decision */ GPIO_PIN_GET(gpio_dev, sc->ec_gpio, &status); @@ -214,7 +214,7 @@ int ec_hello(void) data_in[2] = 0x20; data_in[3] = 0x10; - ec_command(EC_CMD_MKBP_STATE, data_in, 4, + ec_command(EC_CMD_HELLO, data_in, 4, data_out, 4); return (0); @@ -225,7 +225,7 @@ configure_i2c_arbitrator(struct ec_softc { phandle_t arbitrator; - /* TODO(imax): look for compatible entry instead of hard-coded path */ + /* TODO: look for compatible entry instead of hard-coded path */ arbitrator = OF_finddevice("/i2c-arbitrator"); if (arbitrator > 0 && OF_hasprop(arbitrator, "freebsd,our-gpio") && Modified: head/sys/arm/samsung/exynos/chrome_ec.h ============================================================================== --- head/sys/arm/samsung/exynos/chrome_ec.h Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/samsung/exynos/chrome_ec.h Fri Aug 1 06:20:25 2014 (r269369) @@ -30,6 +30,8 @@ #define EC_CMD_GET_VERSION 0x02 #define EC_CMD_MKBP_STATE 0x60 #define EC_CMD_VERSION0 0xdc +#define EC_CMD_RESEND_RESPONSE 0xdb +#define EC_CMD_GET_COMMS_STATUS 0x09 int ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, uint8_t *dinp, uint8_t dinp_len); Added: head/sys/arm/samsung/exynos/chrome_ec_spi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/samsung/exynos/chrome_ec_spi.c Fri Aug 1 06:20:25 2014 (r269369) @@ -0,0 +1,230 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * 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 EXPREC OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNEC 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 BUSINEC 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. + */ + +/* + * Samsung Chromebook Embedded Controller (EC) + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "spibus_if.h" +#include "gpio_if.h" + +#include + +struct ec_softc { + device_t dev; + device_t dev_gpio; +}; + +struct ec_softc *ec_sc; + +#define EC_SPI_CS 200 + +static int +assert_cs(struct ec_softc *sc, int enable) +{ + /* Get the GPIO device */ + sc->dev_gpio = devclass_get_device(devclass_find("gpio"), 0); + if (sc->dev_gpio == NULL) { + device_printf(sc->dev, "Error: failed to get the GPIO dev\n"); + return (1); + } + + GPIO_PIN_SETFLAGS(sc->dev_gpio, EC_SPI_CS, GPIO_PIN_OUTPUT); + + if (enable) { + GPIO_PIN_SET(sc->dev_gpio, EC_SPI_CS, GPIO_PIN_LOW); + } else { + GPIO_PIN_SET(sc->dev_gpio, EC_SPI_CS, GPIO_PIN_HIGH); + } + + return (0); +} + +static int +ec_probe(device_t dev) +{ + + device_set_desc(dev, "Chromebook Embedded Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +fill_checksum(uint8_t *data_out, int len) +{ + int res; + int i; + + res = 0; + for (i = 0; i < len; i++) { + res += data_out[i]; + } + + data_out[len] = (res & 0xff); + + return (0); +} + +int +ec_command(uint8_t cmd, uint8_t *dout, uint8_t dout_len, + uint8_t *dinp, uint8_t dinp_len) +{ + struct spi_command spi_cmd; + struct ec_softc *sc; + uint8_t *msg_dout; + uint8_t *msg_dinp; + int ret; + int i; + + memset(&spi_cmd, 0, sizeof(spi_cmd)); + + msg_dout = malloc(dout_len + 4, M_DEVBUF, M_NOWAIT | M_ZERO); + msg_dinp = malloc(dinp_len + 4, M_DEVBUF, M_NOWAIT | M_ZERO); + + spi_cmd.tx_cmd = msg_dout; + spi_cmd.rx_cmd = msg_dinp; + + if (ec_sc == NULL) + return (-1); + + sc = ec_sc; + + msg_dout[0] = EC_CMD_VERSION0; + msg_dout[1] = cmd; + msg_dout[2] = dout_len; + + for (i = 0; i < dout_len; i++) { + msg_dout[i + 3] = dout[i]; + }; + + fill_checksum(msg_dout, dout_len + 3); + + assert_cs(sc, 1); + spi_cmd.rx_cmd_sz = spi_cmd.tx_cmd_sz = dout_len + 4; + ret = SPIBUS_TRANSFER(device_get_parent(sc->dev), sc->dev, &spi_cmd); + + /* Wait 0xec */ + for (i = 0; i < 1000; i++) { + DELAY(10); + msg_dout[0] = 0xff; + spi_cmd.rx_cmd_sz = spi_cmd.tx_cmd_sz = 1; + SPIBUS_TRANSFER(device_get_parent(sc->dev), sc->dev, &spi_cmd); + if (msg_dinp[0] == 0xec) + break; + } + + /* Get the rest */ + for (i = 0; i < (dout_len + 4); i++) + msg_dout[i] = 0xff; + spi_cmd.rx_cmd_sz = spi_cmd.tx_cmd_sz = dout_len + 4 - 1; + ret = SPIBUS_TRANSFER(device_get_parent(sc->dev), sc->dev, &spi_cmd); + assert_cs(sc, 0); + + if (ret != 0) { + device_printf(sc->dev, "spibus_transfer returned %d\n", ret); + free(msg_dout, M_DEVBUF); + free(msg_dinp, M_DEVBUF); + return (-1); + } + + for (i = 0; i < dinp_len; i++) { + dinp[i] = msg_dinp[i + 2]; + }; + + free(msg_dout, M_DEVBUF); + free(msg_dinp, M_DEVBUF); + + return (0); +} + +static int +ec_attach(device_t dev) +{ + struct ec_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + ec_sc = sc; + + return (0); +} + +static int +ec_detach(device_t dev) +{ + struct ec_softc *sc; + + sc = device_get_softc(dev); + + return (0); +} + +static device_method_t ec_methods[] = { + DEVMETHOD(device_probe, ec_probe), + DEVMETHOD(device_attach, ec_attach), + DEVMETHOD(device_detach, ec_detach), + { 0, 0 } +}; + +static driver_t ec_driver = { + "chrome_ec", + ec_methods, + sizeof(struct ec_softc), +}; + +static devclass_t ec_devclass; + +DRIVER_MODULE(chrome_ec, spibus, ec_driver, ec_devclass, 0, 0); +MODULE_VERSION(chrome_ec, 1); +MODULE_DEPEND(chrome_ec, spibus, 1, 1, 1); Modified: head/sys/arm/samsung/exynos/exynos5_combiner.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_combiner.c Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/samsung/exynos/exynos5_combiner.c Fri Aug 1 06:20:25 2014 (r269369) @@ -353,6 +353,9 @@ static int combiner_probe(device_t dev) { + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (!ofw_bus_is_compatible(dev, "exynos,combiner")) return (ENXIO); Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_ehci.c Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Fri Aug 1 06:20:25 2014 (r269369) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013 Ruslan Bukin + * Copyright (c) 2013-2014 Ruslan Bukin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include "gpio_if.h" #include "opt_platform.h" @@ -64,11 +67,6 @@ __FBSDID("$FreeBSD$"); #define GPIO_INPUT 0 #define PIN_USB 161 -/* PWR control */ -#define EXYNOS5_PWR_USBHOST_PHY 0x708 -#define PHY_POWER_ON 1 -#define PHY_POWER_OFF 0 - /* SYSREG */ #define EXYNOS5_SYSREG_USB2_PHY 0x0 #define USB2_MODE_HOST 0x1 @@ -91,12 +89,10 @@ static int exynos_ehci_probe(device_t de struct exynos_ehci_softc { device_t dev; ehci_softc_t base; - struct resource *res[5]; + struct resource *res[4]; bus_space_tag_t host_bst; - bus_space_tag_t pwr_bst; bus_space_tag_t sysreg_bst; bus_space_handle_t host_bsh; - bus_space_handle_t pwr_bsh; bus_space_handle_t sysreg_bsh; }; @@ -105,7 +101,6 @@ static struct resource_spec exynos_ehci_ { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_MEMORY, 1, RF_ACTIVE }, { SYS_RES_MEMORY, 2, RF_ACTIVE }, - { SYS_RES_MEMORY, 3, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, { -1, 0 } }; @@ -185,10 +180,8 @@ reset_hsic_hub(struct exynos_ehci_softc device_t gpio_dev; pcell_t pin; - /* TODO(imax): check that hub is compatible with "smsc,usb3503" */ + /* TODO: check that hub is compatible with "smsc,usb3503" */ if (!OF_hasprop(hub, "freebsd,reset-gpio")) { - device_printf(esc->dev, - "cannot detect reset GPIO pin for HSIC hub\n"); return (1); } @@ -201,7 +194,7 @@ reset_hsic_hub(struct exynos_ehci_softc /* Get the GPIO device, we need this to give power to USB */ gpio_dev = devclass_get_device(devclass_find("gpio"), 0); if (gpio_dev == NULL) { - device_printf(esc->dev, "cant find gpio_dev\n"); + device_printf(esc->dev, "Cant find gpio device\n"); return (1); } @@ -225,8 +218,7 @@ phy_init(struct exynos_ehci_softc *esc) EXYNOS5_SYSREG_USB2_PHY, USB2_MODE_HOST); /* Power ON phy */ - bus_space_write_4(esc->pwr_bst, esc->pwr_bsh, - EXYNOS5_PWR_USBHOST_PHY, PHY_POWER_ON); + usb2_phy_power_on(); reg = bus_space_read_4(esc->host_bst, esc->host_bsh, 0x0); reg &= ~(HOST_CTRL_CLK_MASK | @@ -284,13 +276,9 @@ exynos_ehci_attach(device_t dev) esc->host_bst = rman_get_bustag(esc->res[1]); esc->host_bsh = rman_get_bushandle(esc->res[1]); - /* PWR registers */ - esc->pwr_bst = rman_get_bustag(esc->res[2]); - esc->pwr_bsh = rman_get_bushandle(esc->res[2]); - /* SYSREG */ - esc->sysreg_bst = rman_get_bustag(esc->res[3]); - esc->sysreg_bsh = rman_get_bushandle(esc->res[3]); + esc->sysreg_bst = rman_get_bustag(esc->res[2]); + esc->sysreg_bsh = rman_get_bushandle(esc->res[2]); /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev), @@ -309,7 +297,7 @@ exynos_ehci_attach(device_t dev) phy_init(esc); /* Setup interrupt handler */ - err = bus_setup_intr(dev, esc->res[4], INTR_TYPE_BIO | INTR_MPSAFE, + err = bus_setup_intr(dev, esc->res[3], INTR_TYPE_BIO | INTR_MPSAFE, NULL, (driver_intr_t *)ehci_interrupt, sc, &sc->sc_intr_hdl); if (err) { @@ -322,7 +310,7 @@ exynos_ehci_attach(device_t dev) sc->sc_bus.bdev = device_add_child(dev, "usbus", -1); if (!sc->sc_bus.bdev) { device_printf(dev, "Could not add USB device\n"); - err = bus_teardown_intr(dev, esc->res[4], + err = bus_teardown_intr(dev, esc->res[3], sc->sc_intr_hdl); if (err) device_printf(dev, "Could not tear down irq," @@ -343,7 +331,7 @@ exynos_ehci_attach(device_t dev) device_delete_child(dev, sc->sc_bus.bdev); sc->sc_bus.bdev = NULL; - err = bus_teardown_intr(dev, esc->res[4], + err = bus_teardown_intr(dev, esc->res[3], sc->sc_intr_hdl); if (err) device_printf(dev, "Could not tear down irq," @@ -382,8 +370,8 @@ exynos_ehci_detach(device_t dev) bus_space_write_4(sc->sc_io_tag, sc->sc_io_hdl, EHCI_USBINTR, 0); - if (esc->res[4] && sc->sc_intr_hdl) { - err = bus_teardown_intr(dev, esc->res[4], + if (esc->res[3] && sc->sc_intr_hdl) { + err = bus_teardown_intr(dev, esc->res[3], sc->sc_intr_hdl); if (err) { device_printf(dev, "Could not tear down irq," Modified: head/sys/arm/samsung/exynos/exynos5_pad.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_pad.c Fri Aug 1 04:53:35 2014 (r269368) +++ head/sys/arm/samsung/exynos/exynos5_pad.c Fri Aug 1 06:20:25 2014 (r269369) @@ -65,10 +65,13 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) -#define NPORTS 4 -#define NGRP 40 -#define NGPIO 253 -#define NINTS 16 +#define MAX_PORTS 5 +#define MAX_NGPIO 253 + +#define N_EXT_INTS 16 + +#define EXYNOS5250 1 +#define EXYNOS5420 2 #define PIN_IN 0 #define PIN_OUT 1 @@ -90,20 +93,36 @@ static int pad_pin_set(device_t, uint32_ static int pad_pin_get(device_t, uint32_t, unsigned int *); static int pad_pin_toggle(device_t, uint32_t pin); +struct gpio_bank { + char *name; + uint32_t port; + uint32_t con; + uint32_t ngpio; + uint32_t ext_con; + uint32_t ext_flt_con; + uint32_t mask; + uint32_t pend; +}; + struct pad_softc { - struct resource *res[NPORTS+4]; - bus_space_tag_t bst[NPORTS]; - bus_space_handle_t bsh[NPORTS]; + struct resource *res[MAX_PORTS * 2]; + bus_space_tag_t bst[MAX_PORTS]; + bus_space_handle_t bsh[MAX_PORTS]; struct mtx sc_mtx; int gpio_npins; - struct gpio_pin gpio_pins[NGPIO]; - void *gpio_ih[NPORTS+4]; + struct gpio_pin gpio_pins[MAX_NGPIO]; + void *gpio_ih[MAX_PORTS]; device_t dev; + int model; + struct resource_spec *pad_spec; + struct gpio_bank *gpio_map; + struct interrupt_entry *interrupt_table; + int nports; }; struct pad_softc *gpio_sc; -static struct resource_spec pad_spec[] = { +static struct resource_spec pad_spec_5250[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_MEMORY, 1, RF_ACTIVE }, { SYS_RES_MEMORY, 2, RF_ACTIVE }, @@ -115,20 +134,40 @@ static struct resource_spec pad_spec[] = { -1, 0 } }; +static struct resource_spec pad_spec_5420[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, + { SYS_RES_MEMORY, 2, RF_ACTIVE }, + { SYS_RES_MEMORY, 3, RF_ACTIVE }, + { SYS_RES_MEMORY, 4, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE }, + { SYS_RES_IRQ, 2, RF_ACTIVE }, + { SYS_RES_IRQ, 3, RF_ACTIVE }, + { SYS_RES_IRQ, 4, RF_ACTIVE }, + { -1, 0 } +}; + +static struct ofw_compat_data compat_data[] = { + {"samsung,exynos5420-padctrl", EXYNOS5420}, + {"samsung,exynos5250-padctrl", EXYNOS5250}, + {NULL, 0} +}; + struct pad_intr { uint32_t enabled; void (*ih) (void *); void *ih_user; }; -static struct pad_intr intr_map[NGPIO]; +static struct pad_intr intr_map[MAX_NGPIO]; struct interrupt_entry { int gpio_number; char *combiner_source_name; }; -struct interrupt_entry interrupt_table[NINTS] = { +struct interrupt_entry interrupt_table_5250[N_EXT_INTS] = { { 147, "EINT[15]" }, { 146, "EINT[14]" }, { 145, "EINT[13]" }, @@ -147,84 +186,144 @@ struct interrupt_entry interrupt_table[N { 132, "EINT[0]" }, }; -struct gpio_bank { - char *name; - uint32_t port; - uint32_t con; - uint32_t ngpio; - uint32_t ext_int_grp; - uint32_t ext_con; - uint32_t ext_flt_con; - uint32_t mask; - uint32_t pend; +struct interrupt_entry interrupt_table_5420[N_EXT_INTS] = { + { 23, "EINT[15]" }, + { 22, "EINT[14]" }, + { 21, "EINT[13]" }, + { 20, "EINT[12]" }, + { 19, "EINT[11]" }, + { 18, "EINT[10]" }, + { 17, "EINT[9]" }, + { 16, "EINT[8]" }, + { 15, "EINT[7]" }, + { 14, "EINT[6]" }, + { 13, "EINT[5]" }, + { 12, "EINT[4]" }, + { 11, "EINT[3]" }, + { 10, "EINT[2]" }, + { 9, "EINT[1]" }, + { 8, "EINT[0]" }, }; /* * 253 multi-functional input/output ports */ -static struct gpio_bank gpio_map[] = { +static struct gpio_bank gpio_map_5250[] = { /* first 132 gpio */ - { "gpa0", 0, 0x000, 8, 1, 0x700, 0x800, 0x900, 0xA00 }, - { "gpa1", 0, 0x020, 6, 2, 0x704, 0x808, 0x904, 0xA04 }, - { "gpa2", 0, 0x040, 8, 3, 0x708, 0x810, 0x908, 0xA08 }, - { "gpb0", 0, 0x060, 5, 4, 0x70C, 0x818, 0x90C, 0xA0C }, - { "gpb1", 0, 0x080, 5, 5, 0x710, 0x820, 0x910, 0xA10 }, - { "gpb2", 0, 0x0A0, 4, 6, 0x714, 0x828, 0x914, 0xA14 }, - { "gpb3", 0, 0x0C0, 4, 7, 0x718, 0x830, 0x918, 0xA18 }, - { "gpc0", 0, 0x0E0, 7, 8, 0x71C, 0x838, 0x91C, 0xA1C }, - { "gpc1", 0, 0x100, 4, 9, 0x720, 0x840, 0x920, 0xA20 }, - { "gpc2", 0, 0x120, 7, 10, 0x724, 0x848, 0x924, 0xA24 }, - { "gpc3", 0, 0x140, 7, 11, 0x728, 0x850, 0x928, 0xA28 }, - { "gpd0", 0, 0x160, 4, 12, 0x72C, 0x858, 0x92C, 0xA2C }, - { "gpd1", 0, 0x180, 8, 13, 0x730, 0x860, 0x930, 0xA30 }, - { "gpy0", 0, 0x1A0, 6, 0, 0, 0, 0, 0 }, - { "gpy1", 0, 0x1C0, 4, 0, 0, 0, 0, 0 }, - { "gpy2", 0, 0x1E0, 6, 0, 0, 0, 0, 0 }, - { "gpy3", 0, 0x200, 8, 0, 0, 0, 0, 0 }, - { "gpy4", 0, 0x220, 8, 0, 0, 0, 0, 0 }, - { "gpy5", 0, 0x240, 8, 0, 0, 0, 0, 0 }, - { "gpy6", 0, 0x260, 8, 0, 0, 0, 0, 0 }, - { "gpc4", 0, 0x2E0, 7, 30, 0x734, 0x868, 0x934, 0xA34 }, + { "gpa0", 0, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpa1", 0, 0x020, 6, 0x704, 0x808, 0x904, 0xA04 }, + { "gpa2", 0, 0x040, 8, 0x708, 0x810, 0x908, 0xA08 }, + { "gpb0", 0, 0x060, 5, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpb1", 0, 0x080, 5, 0x710, 0x820, 0x910, 0xA10 }, + { "gpb2", 0, 0x0A0, 4, 0x714, 0x828, 0x914, 0xA14 }, + { "gpb3", 0, 0x0C0, 4, 0x718, 0x830, 0x918, 0xA18 }, + { "gpc0", 0, 0x0E0, 7, 0x71C, 0x838, 0x91C, 0xA1C }, + { "gpc1", 0, 0x100, 4, 0x720, 0x840, 0x920, 0xA20 }, + { "gpc2", 0, 0x120, 7, 0x724, 0x848, 0x924, 0xA24 }, + { "gpc3", 0, 0x140, 7, 0x728, 0x850, 0x928, 0xA28 }, + { "gpd0", 0, 0x160, 4, 0x72C, 0x858, 0x92C, 0xA2C }, + { "gpd1", 0, 0x180, 8, 0x730, 0x860, 0x930, 0xA30 }, + { "gpy0", 0, 0x1A0, 6, 0, 0, 0, 0 }, + { "gpy1", 0, 0x1C0, 4, 0, 0, 0, 0 }, + { "gpy2", 0, 0x1E0, 6, 0, 0, 0, 0 }, + { "gpy3", 0, 0x200, 8, 0, 0, 0, 0 }, + { "gpy4", 0, 0x220, 8, 0, 0, 0, 0 }, + { "gpy5", 0, 0x240, 8, 0, 0, 0, 0 }, + { "gpy6", 0, 0x260, 8, 0, 0, 0, 0 }, + { "gpc4", 0, 0x2E0, 7, 0x734, 0x868, 0x934, 0xA34 }, /* next 32 */ - { "gpx0", 0, 0xC00, 8, 40, 0xE00, 0xE80, 0xF00, 0xF40 }, - { "gpx1", 0, 0xC20, 8, 41, 0xE04, 0xE88, 0xF04, 0xF44 }, - { "gpx2", 0, 0xC40, 8, 42, 0xE08, 0xE90, 0xF08, 0xF48 }, - { "gpx3", 0, 0xC60, 8, 43, 0xE0C, 0xE98, 0xF0C, 0xF4C }, - - { "gpe0", 1, 0x000, 8, 14, 0x700, 0x800, 0x900, 0xA00 }, - { "gpe1", 1, 0x020, 2, 15, 0x704, 0x808, 0x904, 0xA04 }, - { "gpf0", 1, 0x040, 4, 16, 0x708, 0x810, 0x908, 0xA08 }, - { "gpf1", 1, 0x060, 4, 17, 0x70C, 0x818, 0x90C, 0xA0C }, - { "gpg0", 1, 0x080, 8, 18, 0x710, 0x820, 0x910, 0xA10 }, - { "gpg1", 1, 0x0A0, 8, 19, 0x714, 0x828, 0x914, 0xA14 }, - { "gpg2", 1, 0x0C0, 2, 20, 0x718, 0x830, 0x918, 0xA18 }, - { "gph0", 1, 0x0E0, 4, 21, 0x71C, 0x838, 0x91C, 0xA1C }, - { "gph1", 1, 0x100, 8, 22, 0x720, 0x840, 0x920, 0xA20 }, - - { "gpv0", 2, 0x000, 8, 60, 0x700, 0x800, 0x900, 0xA00 }, - { "gpv1", 2, 0x020, 8, 61, 0x704, 0x808, 0x904, 0xA04 }, - { "gpv2", 2, 0x060, 8, 62, 0x708, 0x810, 0x908, 0xA08 }, - { "gpv3", 2, 0x080, 8, 63, 0x70C, 0x818, 0x90C, 0xA0C }, - { "gpv4", 2, 0x0C0, 2, 64, 0x710, 0x820, 0x910, 0xA10 }, + { "gpx0", 0, 0xC00, 8, 0xE00, 0xE80, 0xF00, 0xF40 }, + { "gpx1", 0, 0xC20, 8, 0xE04, 0xE88, 0xF04, 0xF44 }, + { "gpx2", 0, 0xC40, 8, 0xE08, 0xE90, 0xF08, 0xF48 }, + { "gpx3", 0, 0xC60, 8, 0xE0C, 0xE98, 0xF0C, 0xF4C }, + + { "gpe0", 1, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpe1", 1, 0x020, 2, 0x704, 0x808, 0x904, 0xA04 }, + { "gpf0", 1, 0x040, 4, 0x708, 0x810, 0x908, 0xA08 }, + { "gpf1", 1, 0x060, 4, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpg0", 1, 0x080, 8, 0x710, 0x820, 0x910, 0xA10 }, + { "gpg1", 1, 0x0A0, 8, 0x714, 0x828, 0x914, 0xA14 }, + { "gpg2", 1, 0x0C0, 2, 0x718, 0x830, 0x918, 0xA18 }, + { "gph0", 1, 0x0E0, 4, 0x71C, 0x838, 0x91C, 0xA1C }, + { "gph1", 1, 0x100, 8, 0x720, 0x840, 0x920, 0xA20 }, + + { "gpv0", 2, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpv1", 2, 0x020, 8, 0x704, 0x808, 0x904, 0xA04 }, + { "gpv2", 2, 0x060, 8, 0x708, 0x810, 0x908, 0xA08 }, + { "gpv3", 2, 0x080, 8, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpv4", 2, 0x0C0, 2, 0x710, 0x820, 0x910, 0xA10 }, + + { "gpz", 3, 0x000, 7, 0x700, 0x800, 0x900, 0xA00 }, + + { NULL, -1, -1, -1, -1, -1, -1, -1 }, +}; + +static struct gpio_bank gpio_map_5420[] = { + /* First 40 */ + { "gpy7", 0, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpx0", 0, 0xC00, 8, 0x704, 0xE80, 0xF00, 0xF40 }, + { "gpx1", 0, 0xC20, 8, 0x708, 0xE88, 0xF04, 0xF44 }, + { "gpx2", 0, 0xC40, 8, 0x70C, 0xE90, 0xF08, 0xF48 }, + { "gpx3", 0, 0xC60, 8, 0x710, 0xE98, 0xF0C, 0xF4C }, + + /* Next 85 */ + { "gpc0", 1, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpc1", 1, 0x020, 8, 0x704, 0x808, 0x904, 0xA04 }, + { "gpc2", 1, 0x040, 7, 0x708, 0x810, 0x908, 0xA08 }, + { "gpc3", 1, 0x060, 4, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpc4", 1, 0x080, 2, 0x710, 0x820, 0x910, 0xA10 }, + { "gpd1", 1, 0x0A0, 8, 0x714, 0x828, 0x914, 0xA14 }, + { "gpy0", 1, 0x0C0, 6, 0x718, 0x830, 0x918, 0xA18 }, + { "gpy1", 1, 0x0E0, 4, 0x71C, 0x838, 0x91C, 0xA1C }, + { "gpy2", 1, 0x100, 6, 0x720, 0x840, 0x920, 0xA20 }, + { "gpy3", 1, 0x120, 8, 0x724, 0x848, 0x924, 0xA24 }, + { "gpy4", 1, 0x140, 8, 0x728, 0x850, 0x928, 0xA28 }, + { "gpy5", 1, 0x160, 8, 0x72C, 0x858, 0x92C, 0xA2C }, + { "gpy6", 1, 0x180, 8, 0x730, 0x860, 0x930, 0xA30 }, + + /* Next 46 */ + { "gpe0", 2, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpe1", 2, 0x020, 2, 0x704, 0x808, 0x904, 0xA04 }, + { "gpf0", 2, 0x040, 6, 0x708, 0x810, 0x908, 0xA08 }, + { "gpf1", 2, 0x060, 8, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpg0", 2, 0x080, 8, 0x710, 0x820, 0x910, 0xA10 }, + { "gpg1", 2, 0x0A0, 8, 0x714, 0x828, 0x914, 0xA14 }, + { "gpg2", 2, 0x0C0, 2, 0x718, 0x830, 0x918, 0xA18 }, + { "gpj4", 2, 0x0E0, 4, 0x71C, 0x838, 0x91C, 0xA1C }, + + /* Next 54 */ + { "gpa0", 3, 0x000, 8, 0x700, 0x800, 0x900, 0xA00 }, + { "gpa1", 3, 0x020, 6, 0x704, 0x808, 0x904, 0xA04 }, + { "gpa2", 3, 0x040, 8, 0x708, 0x810, 0x908, 0xA08 }, + { "gpb0", 3, 0x060, 5, 0x70C, 0x818, 0x90C, 0xA0C }, + { "gpb1", 3, 0x080, 5, 0x710, 0x820, 0x910, 0xA10 }, + { "gpb2", 3, 0x0A0, 4, 0x714, 0x828, 0x914, 0xA14 }, + { "gpb3", 3, 0x0C0, 8, 0x718, 0x830, 0x918, 0xA18 }, + { "gpb4", 3, 0x0E0, 2, 0x71C, 0x838, 0x91C, 0xA1C }, + { "gph0", 3, 0x100, 8, 0x720, 0x840, 0x920, 0xA20 }, + + /* Last 7 */ + { "gpz", 4, 0x000, 7, 0x700, 0x800, 0x900, 0xA00 }, - { "gpz", 3, 0x000, 7, 50, 0x700, 0x800, 0x900, 0xA00 }, + { NULL, -1, -1, -1, -1, -1, -1, -1 }, }; static int -get_bank(int gpio_number, struct gpio_bank *bank, int *pin_shift) +get_bank(struct pad_softc *sc, int gpio_number, + struct gpio_bank *bank, int *pin_shift) { int ngpio; int i; int n; n = 0; - for (i = 0; i < NGRP; i++) { - ngpio = gpio_map[i].ngpio; + for (i = 0; sc->gpio_map[i].ngpio != -1; i++) { + ngpio = sc->gpio_map[i].ngpio; if ((n + ngpio) > gpio_number) { - *bank = gpio_map[i]; + *bank = sc->gpio_map[i]; *pin_shift = (gpio_number - n); return (0); }; @@ -260,16 +359,16 @@ ext_intr(void *arg) sc = arg; n = 0; - for (i = 0; i < NGRP; i++) { + for (i = 0; sc->gpio_map[i].ngpio != -1; i++) { found = 0; - ngpio = gpio_map[i].ngpio; + ngpio = sc->gpio_map[i].ngpio; - if (gpio_map[i].pend == 0) { + if (sc->gpio_map[i].pend == 0) { n += ngpio; continue; } - reg = READ4(sc, gpio_map[i].port, gpio_map[i].pend); + reg = READ4(sc, sc->gpio_map[i].port, sc->gpio_map[i].pend); for (j = 0; j < ngpio; j++) { if (reg & (1 << j)) { @@ -286,7 +385,7 @@ ext_intr(void *arg) if (found) { /* ACK */ - WRITE4(sc, gpio_map[i].port, gpio_map[i].pend, reg); + WRITE4(sc, sc->gpio_map[i].port, sc->gpio_map[i].pend, reg); } n += ngpio; @@ -311,13 +410,13 @@ pad_setup_intr(int gpio_number, void (*i return (-1); } - if (get_bank(gpio_number, &bank, &pin_shift) != 0) + if (get_bank(sc, gpio_number, &bank, &pin_shift) != 0) return (-1); entry = NULL; - for (i = 0; i < NINTS; i++) - if (interrupt_table[i].gpio_number == gpio_number) - entry = &interrupt_table[i]; + for (i = 0; i < N_EXT_INTS; i++) + if (sc->interrupt_table[i].gpio_number == gpio_number) + entry = &(sc->interrupt_table[i]); if (entry == NULL) { device_printf(sc->dev, "Cant find interrupt source for %d\n", @@ -374,11 +473,12 @@ pad_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "exynos,pad")) - return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Exynos Pad Control"); + return (BUS_PROBE_DEFAULT); + } - device_set_desc(dev, "Exynos Pad Control"); - return (BUS_PROBE_DEFAULT); + return (ENXIO); } static int @@ -391,27 +491,47 @@ pad_attach(device_t dev) int i; sc = device_get_softc(dev); + mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); - if (bus_alloc_resources(dev, pad_spec, sc->res)) { + sc->model = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + switch (sc->model) { + case EXYNOS5250: + sc->pad_spec = pad_spec_5250; + sc->gpio_map = gpio_map_5250; + sc->interrupt_table = interrupt_table_5250; + sc->gpio_npins = 253; + sc->nports = 4; + break; + case EXYNOS5420: + sc->pad_spec = pad_spec_5420; + sc->gpio_map = gpio_map_5420; + sc->interrupt_table = interrupt_table_5420; + sc->gpio_npins = 232; + sc->nports = 5; + break; + default: + return (-1); + }; + + if (bus_alloc_resources(dev, sc->pad_spec, sc->res)) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); } /* Memory interface */ - for (i = 0; i < NPORTS; i++) { + for (i = 0; i < sc->nports; i++) { sc->bst[i] = rman_get_bustag(sc->res[i]); sc->bsh[i] = rman_get_bushandle(sc->res[i]); }; sc->dev = dev; - sc->gpio_npins = NGPIO; gpio_sc = sc; - for (i = 0; i < NPORTS; i++) { - if ((bus_setup_intr(dev, sc->res[NPORTS + i], + for (i = 0; i < sc->nports; i++) { + if ((bus_setup_intr(dev, sc->res[sc->nports + i], INTR_TYPE_BIO | INTR_MPSAFE, port_intr, NULL, sc, &sc->gpio_ih[i]))) { device_printf(dev, @@ -424,7 +544,7 @@ pad_attach(device_t dev) sc->gpio_pins[i].gp_pin = i; sc->gpio_pins[i].gp_caps = DEFAULT_CAPS; - if (get_bank(i, &bank, &pin_shift) != 0) + if (get_bank(sc, i, &bank, &pin_shift) != 0) continue; pin_shift *= 4; @@ -450,8 +570,11 @@ pad_attach(device_t dev) static int pad_pin_max(device_t dev, int *maxpin) { + struct pad_softc *sc; + + sc = device_get_softc(dev); - *maxpin = NGPIO - 1; + *maxpin = sc->gpio_npins - 1; return (0); } @@ -538,7 +661,7 @@ pad_pin_get(device_t dev, uint32_t pin, if (i >= sc->gpio_npins) return (EINVAL); - if (get_bank(pin, &bank, &pin_shift) != 0) + if (get_bank(sc, pin, &bank, &pin_shift) != 0) return (EINVAL); GPIO_LOCK(sc); @@ -569,7 +692,7 @@ pad_pin_toggle(device_t dev, uint32_t pi if (i >= sc->gpio_npins) return (EINVAL); - if (get_bank(pin, &bank, &pin_shift) != 0) + if (get_bank(sc, pin, &bank, &pin_shift) != 0) return (EINVAL); GPIO_LOCK(sc); @@ -601,7 +724,7 @@ pad_pin_configure(struct pad_softc *sc, if (flags & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); - if (get_bank(pin->gp_pin, &bank, &pin_shift) != 0) + if (get_bank(sc, pin->gp_pin, &bank, &pin_shift) != 0) return; pin_shift *= 4; @@ -675,7 +798,7 @@ pad_pin_set(device_t dev, uint32_t pin, if (i >= sc->gpio_npins) return (EINVAL); - if (get_bank(pin, &bank, &pin_shift) != 0) + if (get_bank(sc, pin, &bank, &pin_shift) != 0) return (EINVAL); GPIO_LOCK(sc); Added: head/sys/arm/samsung/exynos/exynos5_pmu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/samsung/exynos/exynos5_pmu.c Fri Aug 1 06:20:25 2014 (r269369) @@ -0,0 +1,181 @@ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 12:42:39 2014 Return-Path: Delivered-To: svn-src-all@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 9C3A79CC; Fri, 1 Aug 2014 12:42: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 886B62938; Fri, 1 Aug 2014 12:42:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71CgdFf072865; Fri, 1 Aug 2014 12:42:39 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71CgcfJ072859; Fri, 1 Aug 2014 12:42:38 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201408011242.s71CgcfJ072859@svn.freebsd.org> From: Michael Tuexen Date: Fri, 1 Aug 2014 12:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269376 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 12:42:39 -0000 Author: tuexen Date: Fri Aug 1 12:42:37 2014 New Revision: 269376 URL: http://svnweb.freebsd.org/changeset/base/269376 Log: Cleanup sctp_send_initiate() and sctp_send_initiate_ack() to be in sync as much as possible. This simplifies upcoming changes. Modified: head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_header.h ============================================================================== --- head/sys/netinet/sctp_header.h Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctp_header.h Fri Aug 1 12:42:37 2014 (r269376) @@ -82,12 +82,6 @@ struct sctp_supported_addr_param { uint16_t addr_type[2]; /* array of supported address types */ } SCTP_PACKED; -/* ECN parameter */ -struct sctp_ecn_supported_param { - struct sctp_paramhdr ph;/* type=SCTP_ECN_CAPABLE */ -} SCTP_PACKED; - - /* heartbeat info parameter */ struct sctp_heartbeat_info_param { struct sctp_paramhdr ph; Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctp_indata.c Fri Aug 1 12:42:37 2014 (r269376) @@ -2505,7 +2505,7 @@ sctp_process_data(struct mbuf **mm, int SCTP_BUF_LEN(merr) = sizeof(*phd); SCTP_BUF_NEXT(merr) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); if (SCTP_BUF_NEXT(merr)) { - if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(merr), SCTP_SIZE32(chk_length) - chk_length, NULL)) { + if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(merr), SCTP_SIZE32(chk_length) - chk_length, NULL) == NULL) { sctp_m_freem(merr); } else { sctp_queue_op_err(stcb, merr); Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctp_input.c Fri Aug 1 12:42:37 2014 (r269376) @@ -5484,7 +5484,7 @@ process_control_chunks: SCTP_BUF_LEN(mm) = sizeof(*phd); SCTP_BUF_NEXT(mm) = SCTP_M_COPYM(m, *offset, chk_length, M_NOWAIT); if (SCTP_BUF_NEXT(mm)) { - if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(mm), SCTP_SIZE32(chk_length) - chk_length, NULL)) { + if (sctp_pad_lastmbuf(SCTP_BUF_NEXT(mm), SCTP_SIZE32(chk_length) - chk_length, NULL) == NULL) { sctp_m_freem(mm); } else { #ifdef SCTP_MBUF_LOGGING Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctp_output.c Fri Aug 1 12:42:37 2014 (r269376) @@ -4700,7 +4700,7 @@ sctp_send_initiate(struct sctp_inpcb *in #endif ) { - struct mbuf *m; + struct mbuf *m, *m_last; struct sctp_nets *net; struct sctp_init_chunk *init; struct sctp_supported_addr_param *sup_addr; @@ -4775,80 +4775,17 @@ sctp_send_initiate(struct sctp_inpcb *in init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams); init->init.initial_tsn = htonl(stcb->asoc.init_seq_number); - if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) { - uint8_t i; - - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); - if (stcb->asoc.scope.ipv4_addr_legal) { - parameter_len += (uint16_t) sizeof(uint16_t); - } - if (stcb->asoc.scope.ipv6_addr_legal) { - parameter_len += (uint16_t) sizeof(uint16_t); - } - sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); - sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); - sup_addr->ph.param_length = htons(parameter_len); - i = 0; - if (stcb->asoc.scope.ipv4_addr_legal) { - sup_addr->addr_type[i++] = htons(SCTP_IPV4_ADDRESS); - } - if (stcb->asoc.scope.ipv6_addr_legal) { - sup_addr->addr_type[i++] = htons(SCTP_IPV6_ADDRESS); - } - padding_len = 4 - 2 * i; - chunk_len += parameter_len; - } /* Adaptation layer indication parameter */ if (inp->sctp_ep.adaptation_layer_indicator_provided) { - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; - } parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); ali->ph.param_length = htons(parameter_len); - ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); - chunk_len += parameter_len; - } - if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { - /* Add NAT friendly parameter. */ - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; - } - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); - ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); - ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); - ph->param_length = htons(parameter_len); - chunk_len += parameter_len; - } - /* now any cookie time extensions */ - if (stcb->asoc.cookie_preserve_req) { - struct sctp_cookie_perserve_param *cookie_preserve; - - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; - } - parameter_len = (uint16_t) sizeof(struct sctp_cookie_perserve_param); - cookie_preserve = (struct sctp_cookie_perserve_param *)(mtod(m, caddr_t)+chunk_len); - cookie_preserve->ph.param_type = htons(SCTP_COOKIE_PRESERVE); - cookie_preserve->ph.param_length = htons(parameter_len); - cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req); - stcb->asoc.cookie_preserve_req = 0; + ali->indication = htonl(inp->sctp_ep.adaptation_layer_indicator); chunk_len += parameter_len; } /* ECN parameter */ if (stcb->asoc.ecn_allowed == 1) { - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; - } parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_ECN_CAPABLE); @@ -4856,21 +4793,24 @@ sctp_send_initiate(struct sctp_inpcb *in chunk_len += parameter_len; } /* And now tell the peer we do support PR-SCTP. */ - if (padding_len > 0) { - memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); - chunk_len += padding_len; - padding_len = 0; - } parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); ph->param_length = htons(parameter_len); chunk_len += parameter_len; - /* And now tell the peer we do all the extensions */ + /* Add NAT friendly parameter. */ + if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; + } + /* And now tell the peer which extensions we support */ + num_ext = 0; pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, caddr_t)+chunk_len); pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); - num_ext = 0; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF_ACK; pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; @@ -4943,8 +4883,52 @@ sctp_send_initiate(struct sctp_inpcb *in chunk_len += parameter_len; } } - SCTP_BUF_LEN(m) = chunk_len; + /* now any cookie time extensions */ + if (stcb->asoc.cookie_preserve_req) { + struct sctp_cookie_perserve_param *cookie_preserve; + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_cookie_perserve_param); + cookie_preserve = (struct sctp_cookie_perserve_param *)(mtod(m, caddr_t)+chunk_len); + cookie_preserve->ph.param_type = htons(SCTP_COOKIE_PRESERVE); + cookie_preserve->ph.param_length = htons(parameter_len); + cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req); + stcb->asoc.cookie_preserve_req = 0; + chunk_len += parameter_len; + } + if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) { + uint8_t i; + + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + if (stcb->asoc.scope.ipv4_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + parameter_len += (uint16_t) sizeof(uint16_t); + } + sup_addr = (struct sctp_supported_addr_param *)(mtod(m, caddr_t)+chunk_len); + sup_addr->ph.param_type = htons(SCTP_SUPPORTED_ADDRTYPE); + sup_addr->ph.param_length = htons(parameter_len); + i = 0; + if (stcb->asoc.scope.ipv4_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV4_ADDRESS); + } + if (stcb->asoc.scope.ipv6_addr_legal) { + sup_addr->addr_type[i++] = htons(SCTP_IPV6_ADDRESS); + } + padding_len = 4 - 2 * i; + chunk_len += parameter_len; + } + SCTP_BUF_LEN(m) = chunk_len; /* now the addresses */ /* * To optimize this we could put the scoping stuff into a structure @@ -4952,18 +4936,13 @@ sctp_send_initiate(struct sctp_inpcb *in * we could just sifa in the address within the stcb. But for now * this is a quick hack to get the address stuff teased apart. */ - sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, m, cnt_inits_to, &padding_len, &chunk_len); + m_last = sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, + m, cnt_inits_to, + &padding_len, &chunk_len); init->ch.chunk_length = htons(chunk_len); if (padding_len > 0) { - struct mbuf *m_at, *mp_last; - - mp_last = NULL; - for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { - if (SCTP_BUF_NEXT(m_at) == NULL) - mp_last = m_at; - } - if ((mp_last == NULL) || sctp_add_pad_tombuf(mp_last, padding_len)) { + if (sctp_add_pad_tombuf(m_last, padding_len) == NULL) { sctp_m_freem(m); return; } @@ -5100,7 +5079,6 @@ sctp_arethere_unrecognized_parameters(st *nat_friendly = 1; /* fall through */ case SCTP_PRSCTP_SUPPORTED: - if (padded_size != sizeof(struct sctp_paramhdr)) { SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error prsctp/nat support %d\n", plen); goto invalid_size; @@ -5108,7 +5086,7 @@ sctp_arethere_unrecognized_parameters(st at += padded_size; break; case SCTP_ECN_CAPABLE: - if (padded_size != sizeof(struct sctp_ecn_supported_param)) { + if (padded_size != sizeof(struct sctp_paramhdr)) { SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error ecn %d\n", plen); goto invalid_size; } @@ -5493,13 +5471,13 @@ sctp_send_initiate_ack(struct sctp_inpcb uint32_t vrf_id, uint16_t port, int hold_inp_lock) { struct sctp_association *asoc; - struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last; + struct mbuf *m, *m_tmp, *m_last, *m_cookie, *op_err; struct sctp_init_ack_chunk *initack; struct sctp_adaptation_layer_indication *ali; - struct sctp_ecn_supported_param *ecn; - struct sctp_prsctp_supported_param *prsctp; struct sctp_supported_chunk_types_param *pr_supported; + struct sctp_paramhdr *ph; union sctp_sockstore *over_addr; + struct sctp_scoping scp; #ifdef INET struct sockaddr_in *dst4 = (struct sockaddr_in *)dst; @@ -5519,18 +5497,16 @@ sctp_send_initiate_ack(struct sctp_inpcb uint8_t *signature = NULL; int cnt_inits_to = 0; uint16_t his_limit, i_want; - int abort_flag, padval; - int num_ext; - int p_len; + int abort_flag; int nat_friendly = 0; struct socket *so; + uint16_t num_ext, chunk_len, padding_len, parameter_len; if (stcb) { asoc = &stcb->asoc; } else { asoc = NULL; } - mp_last = NULL; if ((asoc != NULL) && (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) && (sctp_are_there_new_addresses(asoc, init_pkt, offset, src))) { @@ -5573,7 +5549,8 @@ do_a_abort: sctp_m_freem(op_err); return; } - SCTP_BUF_LEN(m) = sizeof(struct sctp_init_chunk); + chunk_len = (uint16_t) sizeof(struct sctp_init_ack_chunk); + padding_len = 0; /* * We might not overwrite the identification[] completely and on @@ -5897,161 +5874,156 @@ do_a_abort: /* adaptation layer indication parameter */ if (inp->sctp_ep.adaptation_layer_indicator_provided) { - ali = (struct sctp_adaptation_layer_indication *)((caddr_t)initack + sizeof(*initack)); + parameter_len = (uint16_t) sizeof(struct sctp_adaptation_layer_indication); + ali = (struct sctp_adaptation_layer_indication *)(mtod(m, caddr_t)+chunk_len); ali->ph.param_type = htons(SCTP_ULP_ADAPTATION); - ali->ph.param_length = htons(sizeof(*ali)); - ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator); - SCTP_BUF_LEN(m) += sizeof(*ali); - ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali)); - } else { - ecn = (struct sctp_ecn_supported_param *)((caddr_t)initack + sizeof(*initack)); + ali->ph.param_length = htons(parameter_len); + ali->indication = htonl(inp->sctp_ep.adaptation_layer_indicator); + chunk_len += parameter_len; } - /* ECN parameter */ if (((asoc != NULL) && (asoc->ecn_allowed == 1)) || - (inp->sctp_ecn_enable == 1)) { - ecn->ph.param_type = htons(SCTP_ECN_CAPABLE); - ecn->ph.param_length = htons(sizeof(*ecn)); - SCTP_BUF_LEN(m) += sizeof(*ecn); - - prsctp = (struct sctp_prsctp_supported_param *)((caddr_t)ecn + - sizeof(*ecn)); - } else { - prsctp = (struct sctp_prsctp_supported_param *)((caddr_t)ecn); - } - /* And now tell the peer we do pr-sctp */ - prsctp->ph.param_type = htons(SCTP_PRSCTP_SUPPORTED); - prsctp->ph.param_length = htons(sizeof(*prsctp)); - SCTP_BUF_LEN(m) += sizeof(*prsctp); - if (nat_friendly) { - /* Add NAT friendly parameter */ - struct sctp_paramhdr *ph; + ((asoc == NULL) && (inp->sctp_ecn_enable == 1))) { + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_ECN_CAPABLE); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; + } + /* And now tell the peer we do pr-sctp */ + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; - ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); + /* Add NAT friendly parameter */ + if (nat_friendly) { + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_HAS_NAT_SUPPORT); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr); + chunk_len += sizeof(struct sctp_paramhdr); } - /* And now tell the peer we do all the extensions */ - pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); + /* And now tell the peer which extensions we support */ num_ext = 0; + pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, caddr_t)+chunk_len); + pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); pr_supported->chunk_types[num_ext++] = SCTP_ASCONF; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF_ACK; pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED; pr_supported->chunk_types[num_ext++] = SCTP_STREAM_RESET; - if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) + if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { pr_supported->chunk_types[num_ext++] = SCTP_AUTHENTICATION; - if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) + } + if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off)) { pr_supported->chunk_types[num_ext++] = SCTP_NR_SELECTIVE_ACK; - p_len = sizeof(*pr_supported) + num_ext; - pr_supported->ph.param_length = htons(p_len); - bzero((caddr_t)pr_supported + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + } + parameter_len = (uint16_t) sizeof(struct sctp_supported_chunk_types_param) + num_ext; + pr_supported->ph.param_length = htons(parameter_len); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; /* add authentication parameters */ if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { struct sctp_auth_random *randp; struct sctp_auth_hmac_algo *hmacs; struct sctp_auth_chunk_list *chunks; - uint16_t random_len; + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } /* generate and add RANDOM parameter */ - random_len = SCTP_AUTH_RANDOM_SIZE_DEFAULT; - randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); + randp = (struct sctp_auth_random *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) sizeof(struct sctp_auth_random) + + SCTP_AUTH_RANDOM_SIZE_DEFAULT; randp->ph.param_type = htons(SCTP_RANDOM); - p_len = sizeof(*randp) + random_len; - randp->ph.param_length = htons(p_len); - SCTP_READ_RANDOM(randp->random_data, random_len); - /* zero out any padding required */ - bzero((caddr_t)randp + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + randp->ph.param_length = htons(parameter_len); + SCTP_READ_RANDOM(randp->random_data, SCTP_AUTH_RANDOM_SIZE_DEFAULT); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; + } /* add HMAC_ALGO parameter */ - hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - p_len = sctp_serialize_hmaclist(inp->sctp_ep.local_hmacs, + hmacs = (struct sctp_auth_hmac_algo *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) sizeof(struct sctp_auth_hmac_algo) + + sctp_serialize_hmaclist(inp->sctp_ep.local_hmacs, (uint8_t *) hmacs->hmac_ids); - if (p_len > 0) { - p_len += sizeof(*hmacs); - hmacs->ph.param_type = htons(SCTP_HMAC_LIST); - hmacs->ph.param_length = htons(p_len); - /* zero out any padding required */ - bzero((caddr_t)hmacs + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); + hmacs->ph.param_type = htons(SCTP_HMAC_LIST); + hmacs->ph.param_length = htons(parameter_len); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; + + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + padding_len = 0; } /* add CHUNKS parameter */ - chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - p_len = sctp_serialize_auth_chunks(inp->sctp_ep.local_auth_chunks, + chunks = (struct sctp_auth_chunk_list *)(mtod(m, caddr_t)+chunk_len); + parameter_len = (uint16_t) sizeof(struct sctp_auth_chunk_list) + + sctp_serialize_auth_chunks(inp->sctp_ep.local_auth_chunks, chunks->chunk_types); - if (p_len > 0) { - p_len += sizeof(*chunks); - chunks->ph.param_type = htons(SCTP_CHUNK_LIST); - chunks->ph.param_length = htons(p_len); - /* zero out any padding required */ - bzero((caddr_t)chunks + p_len, SCTP_SIZE32(p_len) - p_len); - SCTP_BUF_LEN(m) += SCTP_SIZE32(p_len); - } + chunks->ph.param_type = htons(SCTP_CHUNK_LIST); + chunks->ph.param_length = htons(parameter_len); + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; } - m_at = m; + SCTP_BUF_LEN(m) = chunk_len; + m_last = m; /* now the addresses */ - { - struct sctp_scoping scp; - - /* - * To optimize this we could put the scoping stuff into a - * structure and remove the individual uint8's from the stc - * structure. Then we could just sifa in the address within - * the stc.. but for now this is a quick hack to get the - * address stuff teased apart. - */ - scp.ipv4_addr_legal = stc.ipv4_addr_legal; - scp.ipv6_addr_legal = stc.ipv6_addr_legal; - scp.loopback_scope = stc.loopback_scope; - scp.ipv4_local_scope = stc.ipv4_scope; - scp.local_scope = stc.local_scope; - scp.site_scope = stc.site_scope; - m_at = sctp_add_addresses_to_i_ia(inp, stcb, &scp, m_at, cnt_inits_to, NULL, NULL); + /* + * To optimize this we could put the scoping stuff into a structure + * and remove the individual uint8's from the stc structure. Then we + * could just sifa in the address within the stc.. but for now this + * is a quick hack to get the address stuff teased apart. + */ + scp.ipv4_addr_legal = stc.ipv4_addr_legal; + scp.ipv6_addr_legal = stc.ipv6_addr_legal; + scp.loopback_scope = stc.loopback_scope; + scp.ipv4_local_scope = stc.ipv4_scope; + scp.local_scope = stc.local_scope; + scp.site_scope = stc.site_scope; + m_last = sctp_add_addresses_to_i_ia(inp, stcb, &scp, m_last, + cnt_inits_to, + &padding_len, &chunk_len); + /* padding_len can only be positive, if no addresses have been added */ + if (padding_len > 0) { + memset(mtod(m, caddr_t)+chunk_len, 0, padding_len); + chunk_len += padding_len; + SCTP_BUF_LEN(m) += padding_len; + padding_len = 0; } - /* tack on the operational error if present */ if (op_err) { - struct mbuf *ol; - int llen; - - llen = 0; - ol = op_err; - - while (ol) { - llen += SCTP_BUF_LEN(ol); - ol = SCTP_BUF_NEXT(ol); - } - if (llen % 4) { - /* must add a pad to the param */ - uint32_t cpthis = 0; - int padlen; - - padlen = 4 - (llen % 4); - m_copyback(op_err, llen, padlen, (caddr_t)&cpthis); - } - while (SCTP_BUF_NEXT(m_at) != NULL) { - m_at = SCTP_BUF_NEXT(m_at); - } - SCTP_BUF_NEXT(m_at) = op_err; - while (SCTP_BUF_NEXT(m_at) != NULL) { - m_at = SCTP_BUF_NEXT(m_at); + parameter_len = 0; + for (m_tmp = op_err; m_tmp != NULL; m_tmp = SCTP_BUF_NEXT(m_tmp)) { + parameter_len += SCTP_BUF_LEN(m_tmp); + } + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + SCTP_BUF_NEXT(m_last) = op_err; + while (SCTP_BUF_NEXT(m_last) != NULL) { + m_last = SCTP_BUF_NEXT(m_last); } + chunk_len += parameter_len; } - /* pre-calulate the size and update pkt header and chunk header */ - p_len = 0; - for (m_tmp = m; m_tmp; m_tmp = SCTP_BUF_NEXT(m_tmp)) { - p_len += SCTP_BUF_LEN(m_tmp); - if (SCTP_BUF_NEXT(m_tmp) == NULL) { - /* m_tmp should now point to last one */ - break; + if (padding_len > 0) { + m_last = sctp_add_pad_tombuf(m_last, padding_len); + if (m_last == NULL) { + /* Houston we have a problem, no space */ + sctp_m_freem(m); + return; } + chunk_len += padding_len; + padding_len = 0; } - /* Now we must build a cookie */ m_cookie = sctp_add_cookie(init_pkt, offset, m, 0, &stc, &signature); if (m_cookie == NULL) { @@ -6060,21 +6032,22 @@ do_a_abort: return; } /* Now append the cookie to the end and update the space/size */ - SCTP_BUF_NEXT(m_tmp) = m_cookie; - - for (m_tmp = m_cookie; m_tmp; m_tmp = SCTP_BUF_NEXT(m_tmp)) { - p_len += SCTP_BUF_LEN(m_tmp); + SCTP_BUF_NEXT(m_last) = m_cookie; + parameter_len = 0; + for (m_tmp = m_cookie; m_tmp != NULL; m_tmp = SCTP_BUF_NEXT(m_tmp)) { + parameter_len += SCTP_BUF_LEN(m_tmp); if (SCTP_BUF_NEXT(m_tmp) == NULL) { - /* m_tmp should now point to last one */ - mp_last = m_tmp; - break; + m_last = m_tmp; } } + padding_len = SCTP_SIZE32(parameter_len) - parameter_len; + chunk_len += parameter_len; + /* * Place in the size, but we don't include the last pad (if any) in * the INIT-ACK. */ - initack->ch.chunk_length = htons(p_len); + initack->ch.chunk_length = htons(chunk_len); /* * Time to sign the cookie, we don't sign over the cookie signature @@ -6088,11 +6061,8 @@ do_a_abort: * We sifa 0 here to NOT set IP_DF if its IPv4, we ignore the return * here since the timer will drive a retranmission. */ - padval = p_len % 4; - if ((padval) && (mp_last)) { - /* see my previous comments on mp_last */ - if (sctp_add_pad_tombuf(mp_last, (4 - padval))) { - /* Houston we have a problem, no space */ + if (padding_len > 0) { + if (sctp_add_pad_tombuf(m_last, padding_len) == NULL) { sctp_m_freem(m); return; } @@ -7582,12 +7552,10 @@ dont_do_it: int pads; pads = SCTP_SIZE32(chk->book_size) - chk->send_size; - if (sctp_pad_lastmbuf(chk->data, pads, chk->last_mbuf) == 0) { - chk->pad_inplace = 1; - } - if ((lm = SCTP_BUF_NEXT(chk->last_mbuf)) != NULL) { - /* pad added an mbuf */ + lm = sctp_pad_lastmbuf(chk->data, pads, chk->last_mbuf); + if (lm != NULL) { chk->last_mbuf = lm; + chk->pad_inplace = 1; } chk->send_size += pads; } @@ -10900,7 +10868,8 @@ sctp_send_abort_tcb(struct sctp_tcb *stc abort->ch.chunk_length = htons(chunk_len); /* Add padding, if necessary. */ if (padding_len > 0) { - if ((m_last == NULL) || sctp_add_pad_tombuf(m_last, padding_len)) { + if ((m_last == NULL) || + (sctp_add_pad_tombuf(m_last, padding_len) == NULL)) { sctp_m_freem(m_out); return; } @@ -11000,7 +10969,7 @@ sctp_send_resp_msg(struct sockaddr *src, padding_len = 4 - padding_len; } if (padding_len != 0) { - if (sctp_add_pad_tombuf(m_last, padding_len)) { + if (sctp_add_pad_tombuf(m_last, padding_len) == NULL) { sctp_m_freem(cause); return; } Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctputil.c Fri Aug 1 12:42:37 2014 (r269376) @@ -2516,58 +2516,44 @@ sctp_get_next_param(struct mbuf *m, } -int +struct mbuf * sctp_add_pad_tombuf(struct mbuf *m, int padlen) { - /* - * add padlen bytes of 0 filled padding to the end of the mbuf. If - * padlen is > 3 this routine will fail. - */ - uint8_t *dp; - int i; + struct mbuf *m_last; + caddr_t dp; if (padlen > 3) { - SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, ENOBUFS); - return (ENOBUFS); + return (NULL); } if (padlen <= M_TRAILINGSPACE(m)) { /* * The easy way. We hope the majority of the time we hit * here :) */ - dp = (uint8_t *) (mtod(m, caddr_t)+SCTP_BUF_LEN(m)); - SCTP_BUF_LEN(m) += padlen; + m_last = m; } else { - /* Hard way we must grow the mbuf */ - struct mbuf *tmp; - - tmp = sctp_get_mbuf_for_msg(padlen, 0, M_NOWAIT, 1, MT_DATA); - if (tmp == NULL) { - /* Out of space GAK! we are in big trouble. */ - SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, ENOBUFS); - return (ENOBUFS); - } - /* setup and insert in middle */ - SCTP_BUF_LEN(tmp) = padlen; - SCTP_BUF_NEXT(tmp) = NULL; - SCTP_BUF_NEXT(m) = tmp; - dp = mtod(tmp, uint8_t *); - } - /* zero out the pad */ - for (i = 0; i < padlen; i++) { - *dp = 0; - dp++; - } - return (0); + /* Hard way we must grow the mbuf chain */ + m_last = sctp_get_mbuf_for_msg(padlen, 0, M_NOWAIT, 1, MT_DATA); + if (m_last == NULL) { + return (NULL); + } + SCTP_BUF_LEN(m_last) = 0; + SCTP_BUF_NEXT(m_last) = NULL; + SCTP_BUF_NEXT(m) = m_last; + } + dp = mtod(m_last, caddr_t)+SCTP_BUF_LEN(m_last); + SCTP_BUF_LEN(m_last) += padlen; + memset(dp, 0, padlen); + return (m_last); } -int +struct mbuf * sctp_pad_lastmbuf(struct mbuf *m, int padval, struct mbuf *last_mbuf) { /* find the last mbuf in chain and pad it */ struct mbuf *m_at; - if (last_mbuf) { + if (last_mbuf != NULL) { return (sctp_add_pad_tombuf(last_mbuf, padval)); } else { for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { @@ -2576,8 +2562,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa } } } - SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, EFAULT); - return (EFAULT); + return (NULL); } static void Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Fri Aug 1 10:35:35 2014 (r269375) +++ head/sys/netinet/sctputil.h Fri Aug 1 12:42:37 2014 (r269376) @@ -147,9 +147,11 @@ struct sctp_paramhdr * sctp_get_next_param(struct mbuf *, int, struct sctp_paramhdr *, int); -int sctp_add_pad_tombuf(struct mbuf *, int); +struct mbuf * + sctp_add_pad_tombuf(struct mbuf *, int); -int sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *); +struct mbuf * + sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *); void sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 15:04:47 2014 Return-Path: Delivered-To: svn-src-all@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 B0964C69; Fri, 1 Aug 2014 15:04: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 912852B66; Fri, 1 Aug 2014 15:04:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71F4l5r038580; Fri, 1 Aug 2014 15:04:47 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71F4k7u038574; Fri, 1 Aug 2014 15:04:46 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201408011504.s71F4k7u038574@svn.freebsd.org> From: Don Lewis Date: Fri, 1 Aug 2014 15:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269383 - in stable/10: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 15:04:47 -0000 Author: truckman Date: Fri Aug 1 15:04:46 2014 New Revision: 269383 URL: http://svnweb.freebsd.org/changeset/base/269383 Log: MFC r268780 Nuke the never-used RF_TIMESHARE feature, reducing the complexity of the code. The consensus on arch@ is that this feature might have been useful in the distant past, but is now just unnecessary bloat. The int_rman_activate_resource() and int_rman_deactivate_resource() functions become trivial, so manually inline them. The special deferred handling of RF_ACTIVE is no longer needed in reserve_resource_bound(), so eliminate the associated code at the end of the function. These changes reduce the object file size by more than 500 bytes on i386. Update the rman.9 man page to reflect the removal of the RF_TIMESHARE feature. Modified: stable/10/share/man/man9/rman.9 stable/10/sys/kern/subr_rman.c stable/10/sys/sys/rman.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/rman.9 ============================================================================== --- stable/10/share/man/man9/rman.9 Fri Aug 1 14:10:10 2014 (r269382) +++ stable/10/share/man/man9/rman.9 Fri Aug 1 15:04:46 2014 (r269383) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2011 +.Dd July 15, 2014 .Dt RMAN 9 .Os .Sh NAME @@ -141,13 +141,11 @@ represented by a 16-bit flag register, a #define RF_ALLOCATED 0x0001 /* resource has been reserved */ #define RF_ACTIVE 0x0002 /* resource allocation has been activated */ #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */ -#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */ -#define RF_WANTED 0x0010 /* somebody is waiting for this resource */ #define RF_FIRSTSHARE 0x0020 /* first in sharing list */ #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */ .Ed .Pp -The remainder of the flag bits are used to represent the desired alignment +Bits 15:10 of the flag register are used to represent the desired alignment of the resource within the region. .Pp The @@ -299,12 +297,9 @@ The .Fa bound argument must be a power of two. It may be set to zero to specify no boundary restriction. -The default behavior is to allocate an exclusive segment, unless the +A shared segment will be allocated if the .Dv RF_SHAREABLE -or -.Dv RF_TIMESHARE -flags are set, in which case a shared -segment will be allocated. +flag is set, otherwise an exclusive segment will be allocated. If this shared segment already exists, the caller has its device added to the list of consumers. .Pp Modified: stable/10/sys/kern/subr_rman.c ============================================================================== --- stable/10/sys/kern/subr_rman.c Fri Aug 1 14:10:10 2014 (r269382) +++ stable/10/sys/kern/subr_rman.c Fri Aug 1 15:04:46 2014 (r269383) @@ -110,9 +110,6 @@ static MALLOC_DEFINE(M_RMAN, "rman", "Re struct rman_head rman_head; static struct mtx rman_mtx; /* mutex to protect rman_head */ -static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, - struct resource_i **whohas); -static int int_rman_deactivate_resource(struct resource_i *r); static int int_rman_release_resource(struct rman *rm, struct resource_i *r); static __inline struct resource_i * @@ -322,7 +319,7 @@ rman_adjust_resource(struct resource *rr /* Not supported for shared resources. */ r = rr->__r_i; - if (r->r_flags & (RF_TIMESHARE | RF_SHAREABLE)) + if (r->r_flags & RF_SHAREABLE) return (EINVAL); /* @@ -435,7 +432,7 @@ rman_adjust_resource(struct resource *rr return (0); } -#define SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_TIMESHARE | RF_PREFETCHABLE)) +#define SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_PREFETCHABLE)) struct resource * rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end, @@ -452,10 +449,9 @@ rman_reserve_resource_bound(struct rman "length %#lx, flags %u, device %s\n", rm->rm_descr, start, end, count, flags, dev == NULL ? "" : device_get_nameunit(dev))); - KASSERT((flags & (RF_WANTED | RF_FIRSTSHARE)) == 0, + KASSERT((flags & RF_FIRSTSHARE) == 0, ("invalid flags %#x", flags)); - new_rflags = (flags & ~(RF_ACTIVE | RF_WANTED | RF_FIRSTSHARE)) | - RF_ALLOCATED; + new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED; mtx_lock(rm->rm_mtx); @@ -601,7 +597,7 @@ rman_reserve_resource_bound(struct rman * additional work, but this does not seem warranted.) */ DPRINTF(("no unshared regions found\n")); - if ((flags & (RF_SHAREABLE | RF_TIMESHARE)) == 0) + if ((flags & RF_SHAREABLE) == 0) goto out; for (s = r; s && s->r_end <= end; s = TAILQ_NEXT(s, r_link)) { @@ -636,25 +632,11 @@ rman_reserve_resource_bound(struct rman goto out; } } - /* * We couldn't find anything. */ -out: - /* - * If the user specified RF_ACTIVE in flags, we attempt to atomically - * activate the resource. If this fails, we release the resource - * and indicate overall failure. (This behavior probably doesn't - * make sense for RF_TIMESHARE-type resources.) - */ - if (rv && (flags & RF_ACTIVE) != 0) { - struct resource_i *whohas; - if (int_rman_activate_resource(rm, rv, &whohas)) { - int_rman_release_resource(rm, rv); - rv = NULL; - } - } +out: mtx_unlock(rm->rm_mtx); return (rv == NULL ? NULL : &rv->r_r); } @@ -668,91 +650,17 @@ rman_reserve_resource(struct rman *rm, u dev)); } -static int -int_rman_activate_resource(struct rman *rm, struct resource_i *r, - struct resource_i **whohas) -{ - struct resource_i *s; - int ok; - - /* - * If we are not timesharing, then there is nothing much to do. - * If we already have the resource, then there is nothing at all to do. - * If we are not on a sharing list with anybody else, then there is - * little to do. - */ - if ((r->r_flags & RF_TIMESHARE) == 0 - || (r->r_flags & RF_ACTIVE) != 0 - || r->r_sharehead == NULL) { - r->r_flags |= RF_ACTIVE; - return 0; - } - - ok = 1; - for (s = LIST_FIRST(r->r_sharehead); s && ok; - s = LIST_NEXT(s, r_sharelink)) { - if ((s->r_flags & RF_ACTIVE) != 0) { - ok = 0; - *whohas = s; - } - } - if (ok) { - r->r_flags |= RF_ACTIVE; - return 0; - } - return EBUSY; -} - int rman_activate_resource(struct resource *re) { - int rv; - struct resource_i *r, *whohas; + struct resource_i *r; struct rman *rm; r = re->__r_i; rm = r->r_rm; mtx_lock(rm->rm_mtx); - rv = int_rman_activate_resource(rm, r, &whohas); + r->r_flags |= RF_ACTIVE; mtx_unlock(rm->rm_mtx); - return rv; -} - -int -rman_await_resource(struct resource *re, int pri, int timo) -{ - int rv; - struct resource_i *r, *whohas; - struct rman *rm; - - r = re->__r_i; - rm = r->r_rm; - mtx_lock(rm->rm_mtx); - for (;;) { - rv = int_rman_activate_resource(rm, r, &whohas); - if (rv != EBUSY) - return (rv); /* returns with mutex held */ - - if (r->r_sharehead == NULL) - panic("rman_await_resource"); - whohas->r_flags |= RF_WANTED; - rv = msleep(r->r_sharehead, rm->rm_mtx, pri, "rmwait", timo); - if (rv) { - mtx_unlock(rm->rm_mtx); - return (rv); - } - } -} - -static int -int_rman_deactivate_resource(struct resource_i *r) -{ - - r->r_flags &= ~RF_ACTIVE; - if (r->r_flags & RF_WANTED) { - r->r_flags &= ~RF_WANTED; - wakeup(r->r_sharehead); - } return 0; } @@ -763,7 +671,7 @@ rman_deactivate_resource(struct resource rm = r->__r_i->r_rm; mtx_lock(rm->rm_mtx); - int_rman_deactivate_resource(r->__r_i); + r->__r_i->r_flags &= ~RF_ACTIVE; mtx_unlock(rm->rm_mtx); return 0; } @@ -774,7 +682,7 @@ int_rman_release_resource(struct rman *r struct resource_i *s, *t; if (r->r_flags & RF_ACTIVE) - int_rman_deactivate_resource(r); + r->r_flags &= ~RF_ACTIVE; /* * Check for a sharing list first. If there is one, then we don't Modified: stable/10/sys/sys/rman.h ============================================================================== --- stable/10/sys/sys/rman.h Fri Aug 1 14:10:10 2014 (r269382) +++ stable/10/sys/sys/rman.h Fri Aug 1 15:04:46 2014 (r269383) @@ -42,8 +42,8 @@ #define RF_ALLOCATED 0x0001 /* resource has been reserved */ #define RF_ACTIVE 0x0002 /* resource allocation has been activated */ #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */ -#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */ -#define RF_WANTED 0x0010 /* somebody is waiting for this resource */ +#define RF_SPARE1 0x0008 +#define RF_SPARE2 0x0010 #define RF_FIRSTSHARE 0x0020 /* first in sharing list */ #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */ #define RF_OPTIONAL 0x0080 /* for bus_alloc_resources() */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 15:08:49 2014 Return-Path: Delivered-To: svn-src-all@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 F2578AA; Fri, 1 Aug 2014 15:08: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4E6F2BC0; Fri, 1 Aug 2014 15:08:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71F8m4H039611; Fri, 1 Aug 2014 15:08:48 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71F8ms2039608; Fri, 1 Aug 2014 15:08:48 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201408011508.s71F8ms2039608@svn.freebsd.org> From: Don Lewis Date: Fri, 1 Aug 2014 15:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r269384 - in stable/9: share/man/man9 sys/kern sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 15:08:49 -0000 Author: truckman Date: Fri Aug 1 15:08:47 2014 New Revision: 269384 URL: http://svnweb.freebsd.org/changeset/base/269384 Log: MFC r268780 Nuke the never-used RF_TIMESHARE feature, reducing the complexity of the code. The consensus on arch@ is that this feature might have been useful in the distant past, but is now just unnecessary bloat. The int_rman_activate_resource() and int_rman_deactivate_resource() functions become trivial, so manually inline them. The special deferred handling of RF_ACTIVE is no longer needed in reserve_resource_bound(), so eliminate the associated code at the end of the function. These changes reduce the object file size by more than 500 bytes on i386. Update the rman.9 man page to reflect the removal of the RF_TIMESHARE feature. Modified: stable/9/share/man/man9/rman.9 stable/9/sys/kern/subr_rman.c stable/9/sys/sys/rman.h Directory Properties: stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/share/man/man9/rman.9 ============================================================================== --- stable/9/share/man/man9/rman.9 Fri Aug 1 15:04:46 2014 (r269383) +++ stable/9/share/man/man9/rman.9 Fri Aug 1 15:08:47 2014 (r269384) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 29, 2011 +.Dd July 15, 2014 .Dt RMAN 9 .Os .Sh NAME @@ -141,13 +141,11 @@ represented by a 16-bit flag register, a #define RF_ALLOCATED 0x0001 /* resource has been reserved */ #define RF_ACTIVE 0x0002 /* resource allocation has been activated */ #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */ -#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */ -#define RF_WANTED 0x0010 /* somebody is waiting for this resource */ #define RF_FIRSTSHARE 0x0020 /* first in sharing list */ #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */ .Ed .Pp -The remainder of the flag bits are used to represent the desired alignment +Bits 15:10 of the flag register are used to represent the desired alignment of the resource within the region. .Pp The @@ -299,12 +297,9 @@ The .Fa bound argument must be a power of two. It may be set to zero to specify no boundary restriction. -The default behavior is to allocate an exclusive segment, unless the +A shared segment will be allocated if the .Dv RF_SHAREABLE -or -.Dv RF_TIMESHARE -flags are set, in which case a shared -segment will be allocated. +flag is set, otherwise an exclusive segment will be allocated. If this shared segment already exists, the caller has its device added to the list of consumers. .Pp Modified: stable/9/sys/kern/subr_rman.c ============================================================================== --- stable/9/sys/kern/subr_rman.c Fri Aug 1 15:04:46 2014 (r269383) +++ stable/9/sys/kern/subr_rman.c Fri Aug 1 15:08:47 2014 (r269384) @@ -110,9 +110,6 @@ static MALLOC_DEFINE(M_RMAN, "rman", "Re struct rman_head rman_head; static struct mtx rman_mtx; /* mutex to protect rman_head */ -static int int_rman_activate_resource(struct rman *rm, struct resource_i *r, - struct resource_i **whohas); -static int int_rman_deactivate_resource(struct resource_i *r); static int int_rman_release_resource(struct rman *rm, struct resource_i *r); static __inline struct resource_i * @@ -317,7 +314,7 @@ rman_adjust_resource(struct resource *rr /* Not supported for shared resources. */ r = rr->__r_i; - if (r->r_flags & (RF_TIMESHARE | RF_SHAREABLE)) + if (r->r_flags & RF_SHAREABLE) return (EINVAL); /* @@ -430,7 +427,7 @@ rman_adjust_resource(struct resource *rr return (0); } -#define SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_TIMESHARE | RF_PREFETCHABLE)) +#define SHARE_TYPE(f) (f & (RF_SHAREABLE | RF_PREFETCHABLE)) struct resource * rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end, @@ -447,10 +444,9 @@ rman_reserve_resource_bound(struct rman "length %#lx, flags %u, device %s\n", rm->rm_descr, start, end, count, flags, dev == NULL ? "" : device_get_nameunit(dev))); - KASSERT((flags & (RF_WANTED | RF_FIRSTSHARE)) == 0, + KASSERT((flags & RF_FIRSTSHARE) == 0, ("invalid flags %#x", flags)); - new_rflags = (flags & ~(RF_ACTIVE | RF_WANTED | RF_FIRSTSHARE)) | - RF_ALLOCATED; + new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED; mtx_lock(rm->rm_mtx); @@ -596,7 +592,7 @@ rman_reserve_resource_bound(struct rman * additional work, but this does not seem warranted.) */ DPRINTF(("no unshared regions found\n")); - if ((flags & (RF_SHAREABLE | RF_TIMESHARE)) == 0) + if ((flags & RF_SHAREABLE) == 0) goto out; for (s = r; s && s->r_end <= end; s = TAILQ_NEXT(s, r_link)) { @@ -631,25 +627,11 @@ rman_reserve_resource_bound(struct rman goto out; } } - /* * We couldn't find anything. */ -out: - /* - * If the user specified RF_ACTIVE in flags, we attempt to atomically - * activate the resource. If this fails, we release the resource - * and indicate overall failure. (This behavior probably doesn't - * make sense for RF_TIMESHARE-type resources.) - */ - if (rv && (flags & RF_ACTIVE) != 0) { - struct resource_i *whohas; - if (int_rman_activate_resource(rm, rv, &whohas)) { - int_rman_release_resource(rm, rv); - rv = NULL; - } - } +out: mtx_unlock(rm->rm_mtx); return (rv == NULL ? NULL : &rv->r_r); } @@ -663,91 +645,17 @@ rman_reserve_resource(struct rman *rm, u dev)); } -static int -int_rman_activate_resource(struct rman *rm, struct resource_i *r, - struct resource_i **whohas) -{ - struct resource_i *s; - int ok; - - /* - * If we are not timesharing, then there is nothing much to do. - * If we already have the resource, then there is nothing at all to do. - * If we are not on a sharing list with anybody else, then there is - * little to do. - */ - if ((r->r_flags & RF_TIMESHARE) == 0 - || (r->r_flags & RF_ACTIVE) != 0 - || r->r_sharehead == NULL) { - r->r_flags |= RF_ACTIVE; - return 0; - } - - ok = 1; - for (s = LIST_FIRST(r->r_sharehead); s && ok; - s = LIST_NEXT(s, r_sharelink)) { - if ((s->r_flags & RF_ACTIVE) != 0) { - ok = 0; - *whohas = s; - } - } - if (ok) { - r->r_flags |= RF_ACTIVE; - return 0; - } - return EBUSY; -} - int rman_activate_resource(struct resource *re) { - int rv; - struct resource_i *r, *whohas; + struct resource_i *r; struct rman *rm; r = re->__r_i; rm = r->r_rm; mtx_lock(rm->rm_mtx); - rv = int_rman_activate_resource(rm, r, &whohas); + r->r_flags |= RF_ACTIVE; mtx_unlock(rm->rm_mtx); - return rv; -} - -int -rman_await_resource(struct resource *re, int pri, int timo) -{ - int rv; - struct resource_i *r, *whohas; - struct rman *rm; - - r = re->__r_i; - rm = r->r_rm; - mtx_lock(rm->rm_mtx); - for (;;) { - rv = int_rman_activate_resource(rm, r, &whohas); - if (rv != EBUSY) - return (rv); /* returns with mutex held */ - - if (r->r_sharehead == NULL) - panic("rman_await_resource"); - whohas->r_flags |= RF_WANTED; - rv = msleep(r->r_sharehead, rm->rm_mtx, pri, "rmwait", timo); - if (rv) { - mtx_unlock(rm->rm_mtx); - return (rv); - } - } -} - -static int -int_rman_deactivate_resource(struct resource_i *r) -{ - - r->r_flags &= ~RF_ACTIVE; - if (r->r_flags & RF_WANTED) { - r->r_flags &= ~RF_WANTED; - wakeup(r->r_sharehead); - } return 0; } @@ -758,7 +666,7 @@ rman_deactivate_resource(struct resource rm = r->__r_i->r_rm; mtx_lock(rm->rm_mtx); - int_rman_deactivate_resource(r->__r_i); + r->__r_i->r_flags &= ~RF_ACTIVE; mtx_unlock(rm->rm_mtx); return 0; } @@ -769,7 +677,7 @@ int_rman_release_resource(struct rman *r struct resource_i *s, *t; if (r->r_flags & RF_ACTIVE) - int_rman_deactivate_resource(r); + r->r_flags &= ~RF_ACTIVE; /* * Check for a sharing list first. If there is one, then we don't Modified: stable/9/sys/sys/rman.h ============================================================================== --- stable/9/sys/sys/rman.h Fri Aug 1 15:04:46 2014 (r269383) +++ stable/9/sys/sys/rman.h Fri Aug 1 15:08:47 2014 (r269384) @@ -42,8 +42,8 @@ #define RF_ALLOCATED 0x0001 /* resource has been reserved */ #define RF_ACTIVE 0x0002 /* resource allocation has been activated */ #define RF_SHAREABLE 0x0004 /* resource permits contemporaneous sharing */ -#define RF_TIMESHARE 0x0008 /* resource permits time-division sharing */ -#define RF_WANTED 0x0010 /* somebody is waiting for this resource */ +#define RF_SPARE1 0x0008 +#define RF_SPARE2 0x0010 #define RF_FIRSTSHARE 0x0020 /* first in sharing list */ #define RF_PREFETCHABLE 0x0040 /* resource is prefetchable */ #define RF_OPTIONAL 0x0080 /* for bus_alloc_resources() */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 15:10:57 2014 Return-Path: Delivered-To: svn-src-all@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 0A69621D; Fri, 1 Aug 2014 15:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB6FC2CDB; Fri, 1 Aug 2014 15:10:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71FAuC8042279; Fri, 1 Aug 2014 15:10:56 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71FAucP042275; Fri, 1 Aug 2014 15:10:56 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201408011510.s71FAucP042275@svn.freebsd.org> From: Ruslan Bukin Date: Fri, 1 Aug 2014 15:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269385 - in head/sys: arm/conf boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 15:10:57 -0000 Author: br Date: Fri Aug 1 15:10:55 2014 New Revision: 269385 URL: http://svnweb.freebsd.org/changeset/base/269385 Log: Rename files: keep codename only to make it shorter. Added: head/sys/boot/fdt/dts/arm/exynos5250-snow.dts - copied unchanged from r269369, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts head/sys/boot/fdt/dts/arm/exynos5250-spring.dts - copied unchanged from r269368, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Deleted: head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Modified: head/sys/arm/conf/CHROMEBOOK-SNOW head/sys/arm/conf/CHROMEBOOK-SPRING Modified: head/sys/arm/conf/CHROMEBOOK-SNOW ============================================================================== --- head/sys/arm/conf/CHROMEBOOK-SNOW Fri Aug 1 15:08:47 2014 (r269384) +++ head/sys/arm/conf/CHROMEBOOK-SNOW Fri Aug 1 15:10:55 2014 (r269385) @@ -25,4 +25,4 @@ ident CHROMEBOOK-SNOW #FDT options FDT options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=exynos5250-chromebook-snow.dts +makeoptions FDT_DTS_FILE=exynos5250-snow.dts Modified: head/sys/arm/conf/CHROMEBOOK-SPRING ============================================================================== --- head/sys/arm/conf/CHROMEBOOK-SPRING Fri Aug 1 15:08:47 2014 (r269384) +++ head/sys/arm/conf/CHROMEBOOK-SPRING Fri Aug 1 15:10:55 2014 (r269385) @@ -25,4 +25,4 @@ ident CHROMEBOOK-SPRING #FDT options FDT options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=exynos5250-chromebook-spring.dts +makeoptions FDT_DTS_FILE=exynos5250-spring.dts Copied: head/sys/boot/fdt/dts/arm/exynos5250-snow.dts (from r269369, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/exynos5250-snow.dts Fri Aug 1 15:10:55 2014 (r269385, copy of r269369, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-snow.dts) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * 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$ + */ + +/dts-v1/; + +/include/ "exynos5250.dtsi" + +/ { + model = "Samsung Chromebook"; + + memory { + device_type = "memory"; + reg = < 0x40000000 0x80000000 >; /* 2G */ + }; + + SOC: Exynos5@0 { + + pad0: pad@11400000 { + status = "okay"; + }; + + fimd0: fimd@14400000 { + status = "okay"; + + panel-size = < 1366 768 >; + panel-hsync = < 80 32 48 >; + panel-vsync = < 14 5 3 >; + panel-clk-div = < 17 >; + panel-backlight-pin = < 25 >; + }; + + i2c4: i2c@12CA0000 { + status = "okay"; + }; + + keyboard-controller { + compatible = "google,mkbp-keyb"; + google,key-rows = <8>; + google,key-columns = <13>; + freebsd,intr-gpio = <146>; + }; + + usbdrd_phy0: phy@12100000 { + vbus-supply = < 155 >; + }; + }; + + i2c-arbitrator { + freebsd,our-gpio = <177>; + freebsd,ec-gpio = <168>; + }; + + chosen { + stdin = &serial2; + stdout = &serial2; + }; +}; Copied: head/sys/boot/fdt/dts/arm/exynos5250-spring.dts (from r269368, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/exynos5250-spring.dts Fri Aug 1 15:10:55 2014 (r269385, copy of r269368, head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts) @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * 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$ + */ + +/dts-v1/; + +/include/ "exynos5250.dtsi" + +/ { + model = "HP Chromebook 11"; + + memory { + device_type = "memory"; + reg = < 0x40000000 0x80000000 >; /* 2G */ + }; + + SOC: Exynos5@0 { + + pad0: pad@11400000 { + status = "okay"; + }; + + fimd0: fimd@14400000 { + status = "okay"; + + panel-size = < 1366 768 >; + panel-hsync = < 80 32 48 >; + panel-vsync = < 14 5 3 >; + panel-clk-div = < 17 >; + panel-backlight-pin = < 25 >; + }; + + i2c4: i2c@12CA0000 { + status = "okay"; + }; + + keyboard-controller { + compatible = "google,mkbp-keyb"; + google,key-rows = <8>; + google,key-columns = <13>; + freebsd,intr-gpio = <146>; + }; + }; + + chosen { + stdin = &serial2; + stdout = &serial2; + }; + + hsichub@13400000 { + compatible = "smsc,usb3503"; + freebsd,reset-gpio = <172>; + }; +}; From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 16:53:05 2014 Return-Path: Delivered-To: svn-src-all@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 18853BBF; Fri, 1 Aug 2014 16:53: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05B932890; Fri, 1 Aug 2014 16:53:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71Gr4pd090520; Fri, 1 Aug 2014 16:53:04 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71Gr4fm090517; Fri, 1 Aug 2014 16:53:04 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201408011653.s71Gr4fm090517@svn.freebsd.org> From: Andrew Turner Date: Fri, 1 Aug 2014 16:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269387 - head/contrib/llvm/tools/clang/lib/Driver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 16:53:05 -0000 Author: andrew Date: Fri Aug 1 16:53:04 2014 New Revision: 269387 URL: http://svnweb.freebsd.org/changeset/base/269387 Log: Update the ARMv6 core clang targets to be an arm1176jzf-s. This brings us in line with gcc in base as this makes llvm generate code for the armv6k variant of the instruction set. Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp Fri Aug 1 15:17:46 2014 (r269386) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp Fri Aug 1 16:53:04 2014 (r269387) @@ -183,7 +183,8 @@ static const char *getARMTargetCPU(const MArch = Triple.getArchName(); } - if (Triple.getOS() == llvm::Triple::NetBSD) { + if (Triple.getOS() == llvm::Triple::NetBSD || + Triple.getOS() == llvm::Triple::FreeBSD) { if (MArch == "armv6") return "arm1176jzf-s"; } Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Fri Aug 1 15:17:46 2014 (r269386) +++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Fri Aug 1 16:53:04 2014 (r269387) @@ -499,7 +499,8 @@ static std::string getARMTargetCPU(const MArch = Triple.getArchName(); } - if (Triple.getOS() == llvm::Triple::NetBSD) { + if (Triple.getOS() == llvm::Triple::NetBSD || + Triple.getOS() == llvm::Triple::FreeBSD) { if (MArch == "armv6") return "arm1176jzf-s"; } From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 17:09:51 2014 Return-Path: Delivered-To: svn-src-all@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 666AAE5; Fri, 1 Aug 2014 17:09:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39F3729E7; Fri, 1 Aug 2014 17:09:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71H9okB096244; Fri, 1 Aug 2014 17:09:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71H9orb096242; Fri, 1 Aug 2014 17:09:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201408011709.s71H9orb096242@svn.freebsd.org> From: Alan Cox Date: Fri, 1 Aug 2014 17:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269388 - head/sys/powerpc/aim X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 17:09:51 -0000 Author: alc Date: Fri Aug 1 17:09:50 2014 New Revision: 269388 URL: http://svnweb.freebsd.org/changeset/base/269388 Log: Simplify the selection of the pvo_head and pvo allocation zone in moea_enter_locked() and moea64_enter(). Eliminate an unused variable from moea64_enter(). Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 16:53:04 2014 (r269387) +++ head/sys/powerpc/aim/mmu_oea.c Fri Aug 1 17:09:50 2014 (r269388) @@ -1152,26 +1152,20 @@ moea_enter_locked(pmap_t pmap, vm_offset u_int pte_lo, pvo_flags; int error; - if (!moea_initialized) { - pvo_head = &moea_pvo_kunmanaged; - zone = moea_upvo_zone; - pvo_flags = 0; - } else { - pvo_head = vm_page_to_pvoh(m); - zone = moea_mpvo_zone; - pvo_flags = PVO_MANAGED; - } if (pmap_bootstrapped) rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) VM_OBJECT_ASSERT_LOCKED(m->object); - /* XXX change the pvo head for unmanaged pages */ - if ((m->oflags & VPO_UNMANAGED) != 0) { - pvo_flags &= ~PVO_MANAGED; + if ((m->oflags & VPO_UNMANAGED) != 0 || !moea_initialized) { pvo_head = &moea_pvo_kunmanaged; zone = moea_upvo_zone; + pvo_flags = 0; + } else { + pvo_head = vm_page_to_pvoh(m); + zone = moea_mpvo_zone; + pvo_flags = PVO_MANAGED; } pte_lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Aug 1 16:53:04 2014 (r269387) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Aug 1 17:09:50 2014 (r269388) @@ -1289,33 +1289,23 @@ moea64_enter(mmu_t mmu, pmap_t pmap, vm_ { struct pvo_head *pvo_head; uma_zone_t zone; - vm_page_t pg; uint64_t pte_lo; u_int pvo_flags; int error; - if (!moea64_initialized) { + if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) + VM_OBJECT_ASSERT_LOCKED(m->object); + + if ((m->oflags & VPO_UNMANAGED) != 0 || !moea64_initialized) { pvo_head = NULL; - pg = NULL; zone = moea64_upvo_zone; pvo_flags = 0; } else { pvo_head = vm_page_to_pvoh(m); - pg = m; zone = moea64_mpvo_zone; pvo_flags = PVO_MANAGED; } - if ((m->oflags & VPO_UNMANAGED) == 0 && !vm_page_xbusied(m)) - VM_OBJECT_ASSERT_LOCKED(m->object); - - /* XXX change the pvo head for fake pages */ - if ((m->oflags & VPO_UNMANAGED) != 0) { - pvo_flags &= ~PVO_MANAGED; - pvo_head = NULL; - zone = moea64_upvo_zone; - } - pte_lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); if (prot & VM_PROT_WRITE) { From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 18:24:47 2014 Return-Path: Delivered-To: svn-src-all@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 CF4D2409; Fri, 1 Aug 2014 18:24: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB30F2441; Fri, 1 Aug 2014 18:24:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71IOlm4035839; Fri, 1 Aug 2014 18:24:47 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71IOiTi035821; Fri, 1 Aug 2014 18:24:44 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408011824.s71IOiTi035821@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 18:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269390 - in head/sys: arm/arm arm/include libkern/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 18:24:47 -0000 Author: ian Date: Fri Aug 1 18:24:44 2014 New Revision: 269390 URL: http://svnweb.freebsd.org/changeset/base/269390 Log: Fix unwind-info errors in our hand-written arm assembler code. We have functions nested within functions, and places where we start a function then never end it, we just jump to the middle of something else. We tried to express this with nested ENTRY()/END() macros (which result in .fnstart and .fnend directives), but it turns out there's no way to express that nesting in ARM EHABI unwind info, and newer tools treat multiple .fnstart directives without an intervening .fnend as an error. These changes introduce two new macros, EENTRY() and EEND(). EENTRY() creates a global label you can call/jump to just like ENTRY(), but it doesn't emit a .fnstart. EEND() is a no-op that just documents the conceptual endpoint that matches up with the same-named EENTRY(). This is based on patches submitted by Stepan Dyatkovskiy, but I made some changes and added the EEND() stuff, so blame any problems on me. Submitted by: Stepan Dyatkovskiy Modified: head/sys/arm/arm/cpufunc_asm_arm10.S head/sys/arm/arm/cpufunc_asm_arm9.S head/sys/arm/arm/cpufunc_asm_armv5.S head/sys/arm/arm/cpufunc_asm_armv6.S head/sys/arm/arm/cpufunc_asm_armv7.S head/sys/arm/arm/cpufunc_asm_xscale.S head/sys/arm/arm/cpufunc_asm_xscale_c3.S head/sys/arm/arm/exception.S head/sys/arm/arm/fusu.S head/sys/arm/arm/locore.S head/sys/arm/arm/setstack.s head/sys/arm/arm/support.S head/sys/arm/include/asm.h head/sys/libkern/arm/divsi3.S Modified: head/sys/arm/arm/cpufunc_asm_arm10.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm10.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_arm10.S Fri Aug 1 18:24:44 2014 (r269390) @@ -209,7 +209,7 @@ ENTRY_NP(arm10_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through to purge Dcache. */ -ENTRY(arm10_dcache_wbinv_all) +EENTRY(arm10_dcache_wbinv_all) .Larm10_dcache_wbinv_all: ldr ip, .Larm10_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -223,8 +223,8 @@ ENTRY(arm10_dcache_wbinv_all) bhs .Lnext_set_inv /* Next set */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ bx lr +EEND(arm10_dcache_wbinv_all) END(arm10_idcache_wbinv_all) -END(arm10_dcache_wbinv_all) .Larm10_cache_data: .word _C_LABEL(arm10_dcache_sets_max) Modified: head/sys/arm/arm/cpufunc_asm_arm9.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm9.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_arm9.S Fri Aug 1 18:24:44 2014 (r269390) @@ -197,7 +197,7 @@ ENTRY_NP(arm9_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through */ -ENTRY(arm9_dcache_wbinv_all) +EENTRY(arm9_dcache_wbinv_all) .Larm9_dcache_wbinv_all: ldr ip, .Larm9_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -210,8 +210,8 @@ ENTRY(arm9_dcache_wbinv_all) subs s_max, s_max, s_inc bhs .Lnext_set_inv /* Next set */ mov pc, lr +EEND(arm9_dcache_wbinv_all) END(arm9_idcache_wbinv_all) -END(arm9_dcache_wbinv_all) .Larm9_cache_data: .word _C_LABEL(arm9_dcache_sets_max) Modified: head/sys/arm/arm/cpufunc_asm_armv5.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv5.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_armv5.S Fri Aug 1 18:24:44 2014 (r269390) @@ -194,6 +194,7 @@ ENTRY(armv5_idcache_wbinv_range) END(armv5_idcache_wbinv_range) ENTRY_NP(armv5_idcache_wbinv_all) +armv5_idcache_wbinv_all: .Larmv5_idcache_wbinv_all: /* * We assume that the code here can never be out of sync with the @@ -203,7 +204,7 @@ ENTRY_NP(armv5_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through to purge Dcache. */ -ENTRY(armv5_dcache_wbinv_all) +EENTRY(armv5_dcache_wbinv_all) .Larmv5_dcache_wbinv_all: ldr ip, .Larmv5_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -219,8 +220,8 @@ ENTRY(armv5_dcache_wbinv_all) bpl 1b /* Next set */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET +EEND(armv5_dcache_wbinv_all) END(armv5_idcache_wbinv_all) -END(armv5_dcache_wbinv_all) .Larmv5_cache_data: .word _C_LABEL(armv5_dcache_sets_max) Modified: head/sys/arm/arm/cpufunc_asm_armv6.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv6.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_armv6.S Fri Aug 1 18:24:44 2014 (r269390) @@ -137,12 +137,12 @@ ENTRY_NP(armv6_idcache_wbinv_all) /* Fall through to purge Dcache. */ /* LINTSTUB: void armv6_dcache_wbinv_all(void); */ -ENTRY(armv6_dcache_wbinv_all) +EENTRY(armv6_dcache_wbinv_all) mcr p15, 0, r0, c7, c14, 0 /* clean & invalidate D cache */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET +EEND(armv6_dcache_wbinv_all) END(armv6_idcache_wbinv_all) -END(armv6_dcache_wbinv_all) ENTRY(armv6_idcache_inv_all) mov r0, #0 Modified: head/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv7.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_armv7.S Fri Aug 1 18:24:44 2014 (r269390) @@ -358,7 +358,7 @@ ENTRY(armv7_idcache_inv_all) mcr p15, 0, r0, c7, c5, 0 @ invalidate instruction+branch cache isb @ instruction sync barrier bx lr @ return -END(armv7_l1cache_inv_all) +END(armv7_idcache_inv_all) ENTRY_NP(armv7_sleep) dsb Modified: head/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_xscale.S Fri Aug 1 18:24:44 2014 (r269390) @@ -306,11 +306,12 @@ _C_LABEL(xscale_minidata_clean_size): XSCALE_CACHE_CLEAN_UNBLOCK ENTRY_NP(xscale_cache_syncI) -ENTRY_NP(xscale_cache_purgeID) + +EENTRY_NP(xscale_cache_purgeID) mcr p15, 0, r0, c7, c5, 0 /* flush I cache (D cleaned below) */ -ENTRY_NP(xscale_cache_cleanID) -ENTRY_NP(xscale_cache_purgeD) -ENTRY(xscale_cache_cleanD) +EENTRY_NP(xscale_cache_cleanID) +EENTRY_NP(xscale_cache_purgeD) +EENTRY(xscale_cache_cleanD) XSCALE_CACHE_CLEAN_PROLOGUE 1: subs r0, r0, #32 @@ -326,11 +327,11 @@ ENTRY(xscale_cache_cleanD) XSCALE_CACHE_CLEAN_EPILOGUE RET +EEND(xscale_cache_cleanD) +EEND(xscale_cache_purgeD) +EEND(xscale_cache_cleanID) +EEND(xscale_cache_purgeID) END(xscale_cache_syncI) -END(xscale_cache_purgeID) -END(xscale_cache_cleanID) -END(xscale_cache_purgeD) -END(xscale_cache_cleanD) /* * Clean the mini-data cache. @@ -374,7 +375,7 @@ END(xscale_cache_purgeD_E) */ /* xscale_cache_syncI is identical to xscale_cache_purgeID */ -ENTRY(xscale_cache_cleanID_rng) +EENTRY(xscale_cache_cleanID_rng) ENTRY(xscale_cache_cleanD_rng) cmp r1, #0x4000 bcs _C_LABEL(xscale_cache_cleanID) @@ -393,7 +394,7 @@ ENTRY(xscale_cache_cleanD_rng) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ CPWAIT_AND_RETURN(r0) -END(xscale_cache_cleanID_rng) +/*END(xscale_cache_cleanID_rng)*/ END(xscale_cache_cleanD_rng) ENTRY(xscale_cache_purgeID_rng) Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale_c3.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/cpufunc_asm_xscale_c3.S Fri Aug 1 18:24:44 2014 (r269390) @@ -143,11 +143,12 @@ __FBSDID("$FreeBSD$"); ENTRY_NP(xscalec3_cache_syncI) -ENTRY_NP(xscalec3_cache_purgeID) +xscalec3_cache_purgeID: +EENTRY_NP(xscalec3_cache_purgeID) mcr p15, 0, r0, c7, c5, 0 /* flush I cache (D cleaned below) */ -ENTRY_NP(xscalec3_cache_cleanID) -ENTRY_NP(xscalec3_cache_purgeD) -ENTRY(xscalec3_cache_cleanD) +EENTRY_NP(xscalec3_cache_cleanID) +EENTRY_NP(xscalec3_cache_purgeD) +EENTRY(xscalec3_cache_cleanD) XSCALE_CACHE_CLEAN_BLOCK mov r0, #0 @@ -168,11 +169,11 @@ ENTRY(xscalec3_cache_cleanD) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ RET +EEND(xscalec3_cache_purgeID) +EEND(xscalec3_cache_cleanID) +EEND(xscalec3_cache_purgeD) +EEND(xscalec3_cache_cleanD) END(xscalec3_cache_syncI) -END(xscalec3_cache_purgeID) -END(xscalec3_cache_cleanID) -END(xscalec3_cache_purgeD) -END(xscalec3_cache_cleanD) ENTRY(xscalec3_cache_purgeID_rng) @@ -238,7 +239,7 @@ ENTRY(xscalec3_cache_purgeD_rng) END(xscalec3_cache_purgeD_rng) ENTRY(xscalec3_cache_cleanID_rng) -ENTRY(xscalec3_cache_cleanD_rng) +EENTRY(xscalec3_cache_cleanD_rng) cmp r1, #0x4000 bcs _C_LABEL(xscalec3_cache_cleanID) @@ -257,8 +258,8 @@ ENTRY(xscalec3_cache_cleanD_rng) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ CPWAIT_AND_RETURN(r0) +EEND(xscalec3_cache_cleanD_rng) END(xscalec3_cache_cleanID_rng) -END(xscalec3_cache_cleanD_rng) ENTRY(xscalec3_l2cache_purge) /* Clean-up the L2 cache */ Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/exception.S Fri Aug 1 18:24:44 2014 (r269390) @@ -280,12 +280,12 @@ ASENTRY_NP(swi_entry) * that a newly created thread appears to return from a SWI just like * the parent thread that created it. */ -ASENTRY_NP(swi_exit) +ASEENTRY_NP(swi_exit) DO_AST /* Handle pending signals. */ PULLFRAME /* Deallocate trapframe. */ movs pc, lr /* Return to userland. */ STOP_UNWINDING /* Don't unwind into user mode. */ -END(swi_exit) +EEND(swi_exit) END(swi_entry) /* Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/fusu.S Fri Aug 1 18:24:44 2014 (r269390) @@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$"); * Fetch an int from the user's address space. */ -ENTRY_NP(casuword32) ENTRY(casuword) +EENTRY_NP(casuword32) GET_PCB(r3) ldr r3, [r3] @@ -91,7 +91,7 @@ ENTRY(casuword) mov r1, #0x00000000 str r1, [r3, #PCB_ONFAULT] RET -END(casuword32) +EEND(casuword32) END(casuword) /* @@ -110,8 +110,8 @@ END(casuword) * Fetch an int from the user's address space. */ -ENTRY_NP(fuword32) ENTRY(fuword) +EENTRY_NP(fuword32) GET_PCB(r2) ldr r2, [r2] @@ -277,8 +277,8 @@ fusupcbfaulttext: * Store an int in the user's address space. */ -ENTRY_NP(suword32) ENTRY(suword) +EENTRY_NP(suword32) GET_PCB(r2) ldr r2, [r2] @@ -390,4 +390,3 @@ ENTRY(subyte) str r0, [r2, #PCB_ONFAULT] RET END(subyte) - Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/locore.S Fri Aug 1 18:24:44 2014 (r269390) @@ -75,7 +75,8 @@ __FBSDID("$FreeBSD$"); * For both types of boot we gather up the args, put them in a struct arm_boot_params * structure and pass that to initarm. */ -ENTRY_NP(btext) + .globl btext +btext: ASENTRY_NP(_start) STOP_UNWINDING /* Can't unwind into the bootloader! */ @@ -285,7 +286,6 @@ virt_done: adr r0, .Lmainreturned b _C_LABEL(panic) /* NOTREACHED */ -END(btext) END(_start) /* @@ -548,7 +548,7 @@ ENTRY_NP(sigcode) /* Branch back to retry SYS_sigreturn */ b . - 16 - +END(sigcode) .word SYS_sigreturn .word SYS_exit @@ -560,5 +560,5 @@ ENTRY_NP(sigcode) .global szsigcode szsigcode: .long esigcode-sigcode -END(sigcode) + /* End of locore.S */ Modified: head/sys/arm/arm/setstack.s ============================================================================== --- head/sys/arm/arm/setstack.s Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/setstack.s Fri Aug 1 18:24:44 2014 (r269390) @@ -71,7 +71,7 @@ ENTRY(set_stackptr) msr cpsr_fsxc, r3 /* Restore the old mode */ mov pc, lr /* Exit */ - +END(set_stackptr) /* To get the stack pointer for a particular mode we must switch * to that mode copy the banked r13 and then switch back. * This routine provides an easy way of doing this for any mode @@ -90,5 +90,5 @@ ENTRY(get_stackptr) msr cpsr_fsxc, r3 /* Restore the old mode */ mov pc, lr /* Exit */ - +END(get_stackptr) /* End of setstack.S */ Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/arm/support.S Fri Aug 1 18:24:44 2014 (r269390) @@ -130,7 +130,7 @@ ENTRY(bzero) .Lnormal0: mov r3, #0x00 b do_memset - +EEND(bzero) /* LINTSTUB: Func: void *memset(void *, int, size_t) */ ENTRY(memset) and r3, r1, #0xff /* We deal with bytes */ @@ -276,7 +276,6 @@ do_memset: strgeb r3, [ip], #0x01 /* Set another byte */ strgtb r3, [ip] /* and a third */ RET /* Exit */ -END(bzero) END(memset) ENTRY(bcmp) @@ -394,7 +393,7 @@ ENTRY(bcopy) eor r0, r1, r0 eor r1, r0, r1 eor r0, r1, r0 -ENTRY(memmove) +EENTRY(memmove) /* Do the buffers overlap? */ cmp r0, r1 RETeq /* Bail now if src/dst are the same */ @@ -931,8 +930,8 @@ ENTRY(memmove) .Lmemmove_bsrcul1l4: add r1, r1, #1 b .Lmemmove_bl4 +EEND(memmove) END(bcopy) -END(memmove) #if !defined(_ARM_ARCH_5E) ENTRY(memcpy) @@ -2945,13 +2944,17 @@ END(memcpy) ENTRY(user) nop +END(user) ENTRY(btrap) nop +END(btrap) ENTRY(etrap) nop +END(etrap) ENTRY(bintr) nop +END(bintr) ENTRY(eintr) nop - +END(eintr) #endif Modified: head/sys/arm/include/asm.h ============================================================================== --- head/sys/arm/include/asm.h Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/arm/include/asm.h Fri Aug 1 18:24:44 2014 (r269390) @@ -74,9 +74,20 @@ #define GLOBAL(X) .globl x #define _ENTRY(x) \ .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: _FNSTART - #define _END(x) .size x, . - x; _FNEND +/* + * EENTRY()/EEND() mark "extra" entry/exit points from a function. + * The unwind info cannot handle the concept of a nested function, or a function + * with multiple .fnstart directives, but some of our assembler code is written + * with multiple labels to allow entry at several points. The EENTRY() macro + * defines such an extra entry point without a new .fnstart, so that it's + * basically just a label that you can jump to. The EEND() macro does nothing + * at all, except document the exit point associated with the same-named entry. + */ +#define _EENTRY(x) .globl x; .type x,_ASM_TYPE_FUNCTION; x: +#define _EEND(x) /* nothing */ + #ifdef GPROF # define _PROF_PROLOGUE \ mov ip, lr; bl __mcount @@ -85,11 +96,17 @@ #endif #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE +#define EENTRY(y) _EENTRY(_C_LABEL(y)); _PROF_PROLOGUE #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) +#define EENTRY_NP(y) _EENTRY(_C_LABEL(y)) #define END(y) _END(_C_LABEL(y)) +#define EEND(y) #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE +#define ASEENTRY(y) _EENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE #define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) +#define ASEENTRY_NP(y) _EENTRY(_ASM_LABEL(y)) #define ASEND(y) _END(_ASM_LABEL(y)) +#define ASEEND(y) #define ASMSTR .asciz Modified: head/sys/libkern/arm/divsi3.S ============================================================================== --- head/sys/libkern/arm/divsi3.S Fri Aug 1 17:24:36 2014 (r269389) +++ head/sys/libkern/arm/divsi3.S Fri Aug 1 18:24:44 2014 (r269390) @@ -51,11 +51,11 @@ ENTRY_NP(__modsi3) RET END(__modsi3) +ENTRY_NP(__udivsi3) #ifdef __ARM_EABI__ -ENTRY_NP(__aeabi_uidiv) -ENTRY_NP(__aeabi_uidivmod) +EENTRY_NP(__aeabi_uidiv) +EENTRY_NP(__aeabi_uidivmod) #endif -ENTRY_NP(__udivsi3) .L_udivide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 eor r1, r0, r1 @@ -77,16 +77,16 @@ ENTRY_NP(__udivsi3) mov r1, #0 RET #ifdef __ARM_EABI__ -END(__aeabi_uidiv) -END(__aeabi_uidivmod) +EEND(__aeabi_uidiv) +EEND(__aeabi_uidivmod) #endif END(__udivsi3) +ENTRY_NP(__divsi3) #ifdef __ARM_EABI__ -ENTRY_NP(__aeabi_idiv) -ENTRY_NP(__aeabi_idivmod) +EENTRY_NP(__aeabi_idiv) +EENTRY_NP(__aeabi_idivmod) #endif -ENTRY_NP(__divsi3) .L_divide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 eor r1, r0, r1 @@ -401,8 +401,8 @@ ENTRY_NP(__divsi3) mov r0, r3 RET #ifdef __ARM_EABI__ -END(__aeabi_idiv) -END(__aeabi_idivmod) +EEND(__aeabi_idiv) +EEND(__aeabi_idivmod) #endif END(__divsi3) From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 18:36:41 2014 Return-Path: Delivered-To: svn-src-all@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 83AA67F4; Fri, 1 Aug 2014 18:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70E60255C; Fri, 1 Aug 2014 18:36:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71IafJJ040647; Fri, 1 Aug 2014 18:36:41 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71IafGI040646; Fri, 1 Aug 2014 18:36:41 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201408011836.s71IafGI040646@svn.freebsd.org> From: Peter Grehan Date: Fri, 1 Aug 2014 18:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269391 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 18:36:41 -0000 Author: grehan Date: Fri Aug 1 18:36:40 2014 New Revision: 269391 URL: http://svnweb.freebsd.org/changeset/base/269391 Log: Fix byte ordering in default RSS key. The rss_key[] array in netinet/in_rss.c has the bytes in incorrect order. This results in the RSS test vectors in the Microsft RSS spec and Intel NIC specs giving incorrect results, and making it difficult to verify correct hash operation when RSS functionality is added to new NICs. CR: https://phabric.freebsd.org/D516 Reviewed by: adrian Modified: head/sys/netinet/in_rss.c Modified: head/sys/netinet/in_rss.c ============================================================================== --- head/sys/netinet/in_rss.c Fri Aug 1 18:24:44 2014 (r269390) +++ head/sys/netinet/in_rss.c Fri Aug 1 18:36:40 2014 (r269391) @@ -153,11 +153,11 @@ SYSCTL_INT(_net_inet_rss, OID_AUTO, base * the Chelsio T5 firmware default key. */ static uint8_t rss_key[RSS_KEYSIZE] = { - 0xbe, 0xac, 0x01, 0xfa, 0x6a, 0x42, 0xb7, 0x3b, - 0x80, 0x30, 0xf2, 0x0c, 0x77, 0xcb, 0x2d, 0xa3, - 0xae, 0x7b, 0x30, 0xb4, 0xd0, 0xca, 0x2b, 0xcb, - 0x43, 0xa3, 0x8f, 0xb0, 0x41, 0x67, 0x25, 0x3d, - 0x25, 0x5b, 0x0e, 0xc2, 0x6d, 0x5a, 0x56, 0xda, + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa, }; /* From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 19:32:20 2014 Return-Path: Delivered-To: svn-src-all@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 95ED5F07; Fri, 1 Aug 2014 19:32:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8303F2B8F; Fri, 1 Aug 2014 19:32:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71JWKqN067675; Fri, 1 Aug 2014 19:32:20 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71JWK4O067674; Fri, 1 Aug 2014 19:32:20 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201408011932.s71JWK4O067674@svn.freebsd.org> From: Peter Wemm Date: Fri, 1 Aug 2014 19:32:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269392 - head/etc/defaults X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 19:32:20 -0000 Author: peter Date: Fri Aug 1 19:32:20 2014 New Revision: 269392 URL: http://svnweb.freebsd.org/changeset/base/269392 Log: Like with /usr/lib + /usr/lib/compat, add the optional /usr/lib32/compat to the ldconfig32 default path. /usr/lib32 is the 32 bit versions of *current* libraries, while old versions should be able to be in /usr/lib32/compat, like with /usr/lib/compat. The separation is meant to keep the compile time default search paths cleaner. Modified: head/etc/defaults/rc.conf Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Fri Aug 1 18:36:40 2014 (r269391) +++ head/etc/defaults/rc.conf Fri Aug 1 19:32:20 2014 (r269392) @@ -610,7 +610,8 @@ clear_tmp_X="YES" # Clear and recreate ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg" # shared library search paths -ldconfig32_paths="/usr/lib32" # 32-bit compatibility shared library search paths +ldconfig32_paths="/usr/lib32 /usr/lib32/compat" + # 32-bit compatibility shared library search paths ldconfig_paths_aout="/usr/lib/compat/aout /usr/local/lib/aout" # a.out shared library search paths ldconfig_local_dirs="/usr/local/libdata/ldconfig" From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 20:21:41 2014 Return-Path: Delivered-To: svn-src-all@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 EB76774F; Fri, 1 Aug 2014 20:21: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D88E821AC; Fri, 1 Aug 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71KLf18091203; Fri, 1 Aug 2014 20:21:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71KLfaN091202; Fri, 1 Aug 2014 20:21:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012021.s71KLfaN091202@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 20:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269393 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 20:21:42 -0000 Author: ian Date: Fri Aug 1 20:21:41 2014 New Revision: 269393 URL: http://svnweb.freebsd.org/changeset/base/269393 Log: Fix an bug in as(1) parsing of arm -march=arch+ext options. Compare the arch name to just the characters before the '+' in 'arch+ext'. Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Fri Aug 1 19:32:20 2014 (r269392) +++ head/contrib/binutils/gas/config/tc-arm.c Fri Aug 1 20:21:41 2014 (r269393) @@ -20337,7 +20337,7 @@ arm_parse_arch (char * str) } for (opt = arm_archs; opt->name != NULL; opt++) - if (streq (opt->name, str)) + if (strncmp (opt->name, str, optlen) == 0) { march_cpu_opt = &opt->value; march_fpu_opt = &opt->default_fpu; From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 20:28:38 2014 Return-Path: Delivered-To: svn-src-all@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 F0F35AD7; Fri, 1 Aug 2014 20:28:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C79152294; Fri, 1 Aug 2014 20:28:37 +0000 (UTC) Received: from pippin.baldwin.cx (75-48-77-17.lightspeed.cncrca.sbcglobal.net [75.48.77.17]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0A867B968; Fri, 1 Aug 2014 16:28:36 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r269325 - in head/sys: cddl/contrib/opensolaris/common/util modules/dtrace/dtrace Date: Fri, 01 Aug 2014 16:08:59 -0400 Message-ID: <15989605.EqPr2HuWVf@pippin.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/11.0-CURRENT; KDE/4.12.5; amd64; ; ) In-Reply-To: <201407310807.s6V87N4Q040411@svn.freebsd.org> References: <201407310807.s6V87N4Q040411@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 01 Aug 2014 16:28:36 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 20:28:38 -0000 On Thursday 31 July 2014 08:07:23 Rui Paulo wrote: > Author: rpaulo > Date: Thu Jul 31 08:07:23 2014 > New Revision: 269325 > URL: http://svnweb.freebsd.org/changeset/base/269325 > > Log: > Copy strtolctype.h to sys/cddl/contrib/opensolaris/common/util to keep > the kernel self-contained. > > Requested by: jhb Thanks! -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 20:30:24 2014 Return-Path: Delivered-To: svn-src-all@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 C959BC48; Fri, 1 Aug 2014 20:30:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C67D22AD; Fri, 1 Aug 2014 20:30:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71KUOAF093243; Fri, 1 Aug 2014 20:30:24 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71KUOVg093242; Fri, 1 Aug 2014 20:30:24 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012030.s71KUOVg093242@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 20:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269394 - head/contrib/binutils/gas/config X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 20:30:24 -0000 Author: ian Date: Fri Aug 1 20:30:24 2014 New Revision: 269394 URL: http://svnweb.freebsd.org/changeset/base/269394 Log: Teach as(1) to handle the arm .arch_extension pseudo-op, which accepts the same values as the -march= command line option. Add support for the "sec" extension (security extensions). We've been getting away without support for the sec extension because it's bogusly enabled even on arches where its presence is optional. This support for .arch_extension is being added mainly so that we can use the right directives in our source code, and that helps folks using external toolchains (and will help us when we finally update our toolchain). Modified: head/contrib/binutils/gas/config/tc-arm.c Modified: head/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- head/contrib/binutils/gas/config/tc-arm.c Fri Aug 1 20:21:41 2014 (r269393) +++ head/contrib/binutils/gas/config/tc-arm.c Fri Aug 1 20:30:24 2014 (r269394) @@ -3837,6 +3837,7 @@ s_arm_eabi_attribute (int ignored ATTRIB #endif /* OBJ_ELF */ static void s_arm_arch (int); +static void s_arm_arch_extension (int); static void s_arm_object_arch (int); static void s_arm_cpu (int); static void s_arm_fpu (int); @@ -3891,6 +3892,7 @@ const pseudo_typeS md_pseudo_table[] = { "syntax", s_syntax, 0 }, { "cpu", s_arm_cpu, 0 }, { "arch", s_arm_arch, 0 }, + { "arch_extension", s_arm_arch_extension, 0 }, { "object_arch", s_arm_object_arch, 0 }, { "fpu", s_arm_fpu, 0 }, #ifdef OBJ_ELF @@ -20154,6 +20156,7 @@ static const struct arm_option_cpu_value {"xscale", ARM_FEATURE (0, ARM_CEXT_XSCALE)}, {"iwmmxt", ARM_FEATURE (0, ARM_CEXT_IWMMXT)}, {"iwmmxt2", ARM_FEATURE (0, ARM_CEXT_IWMMXT2)}, + {"sec", ARM_FEATURE (ARM_EXT_V6Z, 0)}, {NULL, ARM_ARCH_NONE} }; @@ -20738,6 +20741,34 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED ignore_rest_of_line (); } +/* Parse a .arch_extension directive. */ + +static void +s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED) +{ + const struct arm_option_cpu_value_table *opt; + char saved_char; + char *name; + + name = input_line_pointer; + while (*input_line_pointer && !ISSPACE(*input_line_pointer)) + input_line_pointer++; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + for (opt = arm_extensions; opt->name != NULL; opt++) + if (streq (opt->name, name)) + { + ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, opt->value); + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); + return; + } + + as_bad (_("unknown architecture `%s'\n"), name); + *input_line_pointer = saved_char; + ignore_rest_of_line (); +} /* Parse a .object_arch directive. */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 20:32:29 2014 Return-Path: Delivered-To: svn-src-all@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 E52D9DC4; Fri, 1 Aug 2014 20:32: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2F462431; Fri, 1 Aug 2014 20:32:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71KWTEB096251; Fri, 1 Aug 2014 20:32:29 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71KWToi096250; Fri, 1 Aug 2014 20:32:29 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012032.s71KWToi096250@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 20:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269395 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 20:32:30 -0000 Author: ian Date: Fri Aug 1 20:32:29 2014 New Revision: 269395 URL: http://svnweb.freebsd.org/changeset/base/269395 Log: Tell the assembler we're building for armv7a with security extensions, so that the 'smc' (secure monitor call) opcode is valid. Submitted by: Stepan Dyatkovskiy Modified: head/sys/arm/ti/ti_smc.S Modified: head/sys/arm/ti/ti_smc.S ============================================================================== --- head/sys/arm/ti/ti_smc.S Fri Aug 1 20:30:24 2014 (r269394) +++ head/sys/arm/ti/ti_smc.S Fri Aug 1 20:32:29 2014 (r269395) @@ -26,7 +26,8 @@ #include __FBSDID("$FreeBSD$"); -.arch armv7a + .arch armv7a + .arch_extension sec /* Issue a smc #0 call */ /* r0 and r1 contains the eventual arguments, r2 contains the function ID */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 20:49:28 2014 Return-Path: Delivered-To: svn-src-all@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 65C665D8; Fri, 1 Aug 2014 20:49: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45ADE2592; Fri, 1 Aug 2014 20:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71KnS0W001748; Fri, 1 Aug 2014 20:49:28 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71KnRF0001744; Fri, 1 Aug 2014 20:49:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201408012049.s71KnRF0001744@svn.freebsd.org> From: Michael Tuexen Date: Fri, 1 Aug 2014 20:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269396 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 20:49:28 -0000 Author: tuexen Date: Fri Aug 1 20:49:27 2014 New Revision: 269396 URL: http://svnweb.freebsd.org/changeset/base/269396 Log: Remove the asconf_auth_nochk sysctl. This was off by default and only existed to be able to test with non-compliant peers a long time ago. Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Fri Aug 1 20:32:29 2014 (r269395) +++ head/sys/netinet/sctp_auth.c Fri Aug 1 20:49:27 2014 (r269396) @@ -1949,8 +1949,7 @@ sctp_validate_init_auth_params(struct mb "SCTP: peer sent chunk list w/o AUTH\n"); return (-1); } - if (!SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) && peer_supports_asconf && - !peer_supports_auth) { + if (peer_supports_asconf && !peer_supports_auth) { SCTPDBG(SCTP_DEBUG_AUTH1, "SCTP: peer supports ASCONF but not AUTH\n"); return (-1); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Fri Aug 1 20:32:29 2014 (r269395) +++ head/sys/netinet/sctp_pcb.c Fri Aug 1 20:49:27 2014 (r269396) @@ -6625,8 +6625,7 @@ next_param: /* peer does not support auth but sent a chunks list? */ return (-31); } - if (!SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) && stcb->asoc.peer_supports_asconf && - !stcb->asoc.peer_supports_auth) { + if (stcb->asoc.peer_supports_asconf && !stcb->asoc.peer_supports_auth) { /* peer supports asconf but not auth? */ return (-32); } else if ((stcb->asoc.peer_supports_asconf) && (stcb->asoc.peer_supports_auth) && Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Fri Aug 1 20:32:29 2014 (r269395) +++ head/sys/netinet/sctp_sysctl.c Fri Aug 1 20:49:27 2014 (r269396) @@ -88,7 +88,6 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) = SCTPCTL_NR_SACK_ON_OFF_DEFAULT; SCTP_BASE_SYSCTL(sctp_cmt_use_dac) = SCTPCTL_CMT_USE_DAC_DEFAULT; SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst) = SCTPCTL_CWND_MAXBURST_DEFAULT; - SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) = SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT; SCTP_BASE_SYSCTL(sctp_auth_disable) = SCTPCTL_AUTH_DISABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_nat_friendly) = SCTPCTL_NAT_FRIENDLY_DEFAULT; SCTP_BASE_SYSCTL(sctp_L2_abc_variable) = SCTPCTL_ABC_L_VAR_DEFAULT; @@ -635,7 +634,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_nr_sack_on_off), SCTPCTL_NR_SACK_ON_OFF_MIN, SCTPCTL_NR_SACK_ON_OFF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_cmt_use_dac), SCTPCTL_CMT_USE_DAC_MIN, SCTPCTL_CMT_USE_DAC_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), SCTPCTL_CWND_MAXBURST_MIN, SCTPCTL_CWND_MAXBURST_MAX); - RANGECHK(SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), SCTPCTL_ASCONF_AUTH_NOCHK_MIN, SCTPCTL_ASCONF_AUTH_NOCHK_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_auth_disable), SCTPCTL_AUTH_DISABLE_MIN, SCTPCTL_AUTH_DISABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_nat_friendly), SCTPCTL_NAT_FRIENDLY_MIN, SCTPCTL_NAT_FRIENDLY_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_L2_abc_variable), SCTPCTL_ABC_L_VAR_MIN, SCTPCTL_ABC_L_VAR_MAX); @@ -996,10 +994,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT &SCTP_BASE_SYSCTL(sctp_use_cwnd_based_maxburst), 0, sysctl_sctp_check, "IU", SCTPCTL_CWND_MAXBURST_DESC); -SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, asconf_auth_nochk, CTLTYPE_UINT | CTLFLAG_RW, - &SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk), 0, sysctl_sctp_check, "IU", - SCTPCTL_ASCONF_AUTH_NOCHK_DESC); - SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, auth_disable, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_auth_disable), 0, sysctl_sctp_check, "IU", SCTPCTL_AUTH_DISABLE_DESC); Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Fri Aug 1 20:32:29 2014 (r269395) +++ head/sys/netinet/sctp_sysctl.h Fri Aug 1 20:49:27 2014 (r269396) @@ -79,7 +79,6 @@ struct sctp_sysctl { /* EY 5/5/08 - nr_sack flag variable */ uint32_t sctp_nr_sack_on_off; uint32_t sctp_use_cwnd_based_maxburst; - uint32_t sctp_asconf_auth_nochk; uint32_t sctp_auth_disable; uint32_t sctp_nat_friendly; uint32_t sctp_L2_abc_variable; @@ -360,12 +359,6 @@ struct sctp_sysctl { #define SCTPCTL_CWND_MAXBURST_MAX 1 #define SCTPCTL_CWND_MAXBURST_DEFAULT 1 -/* asconf_auth_nochk: Disable SCTP ASCONF AUTH requirement */ -#define SCTPCTL_ASCONF_AUTH_NOCHK_DESC "Disable SCTP ASCONF AUTH requirement" -#define SCTPCTL_ASCONF_AUTH_NOCHK_MIN 0 -#define SCTPCTL_ASCONF_AUTH_NOCHK_MAX 1 -#define SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT 0 - /* auth_disable: Disable SCTP AUTH function */ #define SCTPCTL_AUTH_DISABLE_DESC "Disable SCTP AUTH function" #define SCTPCTL_AUTH_DISABLE_MIN 0 From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:00:18 2014 Return-Path: Delivered-To: svn-src-all@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 94C43847; Fri, 1 Aug 2014 21:00: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80DEF2679; Fri, 1 Aug 2014 21:00:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71L0Ixs006525; Fri, 1 Aug 2014 21:00:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71L0I2D006524; Fri, 1 Aug 2014 21:00:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201408012100.s71L0I2D006524@svn.freebsd.org> From: John Baldwin Date: Fri, 1 Aug 2014 21:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269397 - stable/10/share/examples/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:00:18 -0000 Author: jhb Date: Fri Aug 1 21:00:18 2014 New Revision: 269397 URL: http://svnweb.freebsd.org/changeset/base/269397 Log: MFC 256657,257423,264837,267559: Sync vmrun.sh with HEAD: - Add -e option to vmrun.sh passed to bhyveload(8) to set loader environment variables. - Stop passing unused -I option to bhyve(8). - Reformat the usage to fit in 80 colums and other cleanups. - Add -C option to specify the console device. - Add -H option to pass a host path to bhyveload(8). - Support for multiple disk and tap devices. Modified: stable/10/share/examples/bhyve/vmrun.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/bhyve/vmrun.sh ============================================================================== --- stable/10/share/examples/bhyve/vmrun.sh Fri Aug 1 20:49:27 2014 (r269396) +++ stable/10/share/examples/bhyve/vmrun.sh Fri Aug 1 21:00:18 2014 (r269397) @@ -34,17 +34,25 @@ FBSDRUN=/usr/sbin/bhyve DEFAULT_MEMSIZE=512M DEFAULT_CPUS=2 DEFAULT_TAPDEV=tap0 +DEFAULT_CONSOLE=stdio DEFAULT_VIRTIO_DISK="./diskdev" DEFAULT_ISOFILE="./release.iso" usage() { - echo "Usage: vmrun.sh [-hai][-g ][-m ][-d ][-I ][-t ] " + echo "Usage: vmrun.sh [-ahi] [-c ] [-C ] [-d ]" + echo " [-e ] [-g ] [-H ]" + echo " [-I ] [-m ]" + echo " [-t ] " + echo "" echo " -h: display this help message" - echo " -a: force memory mapped local apic access" + echo " -a: force memory mapped local APIC access" echo " -c: number of virtual cpus (default is ${DEFAULT_CPUS})" + echo " -C: console device (default is ${DEFAULT_CONSOLE})" echo " -d: virtio diskdev file (default is ${DEFAULT_VIRTIO_DISK})" + echo " -e: set FreeBSD loader environment variable" echo " -g: listen for connection from kgdb at " + echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" @@ -68,24 +76,37 @@ fi force_install=0 isofile=${DEFAULT_ISOFILE} memsize=${DEFAULT_MEMSIZE} +console=${DEFAULT_CONSOLE} cpus=${DEFAULT_CPUS} -virtio_diskdev=${DEFAULT_VIRTIO_DISK} -tapdev=${DEFAULT_TAPDEV} +tap_total=0 +disk_total=0 apic_opt="" gdbport=0 +loader_opt="" -while getopts haic:g:I:m:d:t: c ; do +while getopts ac:C:d:e:g:hH:iI:m:t: c ; do case $c in - h) - usage - ;; a) apic_opt="-a" ;; + c) + cpus=${OPTARG} + ;; + C) + console=${OPTARG} + ;; d) - virtio_diskdev=${OPTARG} + eval "disk_dev${disk_total}=\"${OPTARG}\"" + disk_total=$(($disk_total + 1)) ;; - g) gdbport=${OPTARG} + e) + loader_opt="${loader_opt} -e ${OPTARG}" + ;; + g) + gdbport=${OPTARG} + ;; + H) + host_base=`realpath ${OPTARG}` ;; i) force_install=1 @@ -93,21 +114,29 @@ while getopts haic:g:I:m:d:t: c ; do I) isofile=${OPTARG} ;; - c) - cpus=${OPTARG} - ;; m) memsize=${OPTARG} ;; t) - tapdev=${OPTARG} + eval "tap_dev${tap_total}=\"${OPTARG}\"" + tap_total=$(($tap_total + 1)) ;; - \?) + *) usage ;; esac done +if [ $tap_total -eq 0 ] ; then + tap_total=1 + tap_dev0="${DEFAULT_TAPDEV}" +fi +if [ $disk_total -eq 0 ] ; then + disk_total=1 + disk_dev0="${DEFAULT_VIRTIO_DISK}" + +fi + shift $((${OPTIND} - 1)) if [ $# -ne 1 ]; then @@ -115,26 +144,35 @@ if [ $# -ne 1 ]; then fi vmname="$1" - -# Create the virtio diskdev file if needed -if [ ! -f ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" does not exist." - echo "Creating it ..." - truncate -s 8G ${virtio_diskdev} > /dev/null -fi - -if [ ! -r ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" is not readable" - exit 1 +if [ -n "${host_base}" ]; then + loader_opt="${loader_opt} -h ${host_base}" fi -if [ ! -w ${virtio_diskdev} ]; then - echo "virtio disk device file \"${virtio_diskdev}\" is not writable" - exit 1 -fi +make_and_check_diskdev() +{ + local virtio_diskdev="$1" + # Create the virtio diskdev file if needed + if [ ! -f ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" does not exist." + echo "Creating it ..." + truncate -s 8G ${virtio_diskdev} > /dev/null + fi + + if [ ! -r ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not readable" + exit 1 + fi + + if [ ! -w ${virtio_diskdev} ]; then + echo "virtio disk device file \"${virtio_diskdev}\" is not writable" + exit 1 + fi +} echo "Launching virtual machine \"$vmname\" ..." +virtio_diskdev="$disk_dev0" + while [ 1 ]; do ${BHYVECTL} --vm=${vmname} --destroy > /dev/null 2>&1 @@ -163,18 +201,40 @@ while [ 1 ]; do installer_opt="" fi - ${LOADER} -m ${memsize} -d ${BOOTDISK} ${vmname} + ${LOADER} -c ${console} -m ${memsize} -d ${BOOTDISK} ${loader_opt} \ + ${vmname} if [ $? -ne 0 ]; then break fi - ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -AI -H -P \ + # + # Build up args for additional tap and disk devices now. + # + nextslot=2 # slot 0 is hostbridge, slot 1 is lpc + devargs="" # accumulate disk/tap args here + i=0 + while [ $i -lt $tap_total ] ; do + eval "tapname=\$tap_dev${i}" + devargs="$devargs -s $nextslot:0,virtio-net,${tapname} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) + done + + i=0 + while [ $i -lt $disk_total ] ; do + eval "disk=\$disk_dev${i}" + make_and_check_diskdev "${disk}" + devargs="$devargs -s $nextslot:0,virtio-blk,${disk} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) + done + + ${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \ -g ${gdbport} \ -s 0:0,hostbridge \ -s 1:0,lpc \ - -s 2:0,virtio-net,${tapdev} \ - -s 3:0,virtio-blk,${virtio_diskdev} \ - -l com1,stdio \ + ${devargs} \ + -l com1,${console} \ ${installer_opt} \ ${vmname} if [ $? -ne 0 ]; then From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:10:44 2014 Return-Path: Delivered-To: svn-src-all@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 7AC81DBC; Fri, 1 Aug 2014 21:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 657D52812; Fri, 1 Aug 2014 21:10:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71LAi5r013761; Fri, 1 Aug 2014 21:10:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71LAf4c013741; Fri, 1 Aug 2014 21:10:41 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201408012110.s71LAf4c013741@svn.freebsd.org> From: Rick Macklem Date: Fri, 1 Aug 2014 21:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269398 - in stable/10/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/krpc rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:10:44 -0000 Author: rmacklem Date: Fri Aug 1 21:10:41 2014 New Revision: 269398 URL: http://svnweb.freebsd.org/changeset/base/269398 Log: MFC: r268115 Merge the NFSv4.1 server code in projects/nfsv4.1-server over into head. The code is not believed to have any effect on the semantics of non-NFSv4.1 server behaviour. It is a rather large merge, but I am hoping that there will not be any regressions for the NFS server. Added: stable/10/sys/rpc/clnt_bck.c - copied unchanged from r268115, head/sys/rpc/clnt_bck.c Modified: stable/10/sys/conf/files stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfs/nfsclstate.h stable/10/sys/fs/nfs/nfsdport.h stable/10/sys/fs/nfs/nfsport.h stable/10/sys/fs/nfs/nfsproto.h stable/10/sys/fs/nfs/nfsrvstate.h stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsserver/nfs_nfsdcache.c stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c stable/10/sys/modules/krpc/Makefile stable/10/sys/rpc/krpc.h stable/10/sys/rpc/svc.h stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/conf/files Fri Aug 1 21:10:41 2014 (r269398) @@ -3838,6 +3838,7 @@ pci/viapm.c optional viapm pci rpc/auth_none.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/auth_unix.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/authunix_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/clnt_bck.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/clnt_dg.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Modified: stable/10/sys/fs/nfs/nfs.h ============================================================================== --- stable/10/sys/fs/nfs/nfs.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfs.h Fri Aug 1 21:10:41 2014 (r269398) @@ -50,7 +50,8 @@ #define NFS_MAXREXMIT 100 /* Stop counting after this many */ #define NFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */ #define NFSV4_CALLBACKRETRY 5 /* Number of retries before failure */ -#define NFSV4_CBSLOTS 8 /* Number of slots for session */ +#define NFSV4_SLOTS 64 /* Number of slots, fore channel */ +#define NFSV4_CBSLOTS 8 /* Number of slots, back channel */ #define NFSV4_CBRETRYCNT 4 /* # of CBRecall retries upon err */ #define NFSV4_UPCALLTIMEO (15 * NFS_HZ) /* Timeout in ticks for upcalls */ /* to gssd or nfsuserd */ @@ -91,6 +92,9 @@ #ifndef NFSLOCKHASHSIZE #define NFSLOCKHASHSIZE 20 /* Size of server nfslock hash table */ #endif +#ifndef NFSSESSIONHASHSIZE +#define NFSSESSIONHASHSIZE 20 /* Size of server session hash table */ +#endif #define NFSSTATEHASHSIZE 10 /* Size of server stateid hash table */ #ifndef NFSUSERHASHSIZE #define NFSUSERHASHSIZE 30 /* Size of user id hash table */ @@ -276,6 +280,8 @@ struct nfsreferral { #define LCL_GSSINTEGRITY 0x00002000 #define LCL_GSSPRIVACY 0x00004000 #define LCL_ADMINREVOKED 0x00008000 +#define LCL_RECLAIMCOMPLETE 0x00010000 +#define LCL_NFSV41 0x00020000 #define LCL_GSS LCL_KERBV /* Or of all mechs */ @@ -318,6 +324,11 @@ struct nfsreferral { #define NFSLCK_SETATTR 0x02000000 #define NFSLCK_DELEGPURGE 0x04000000 #define NFSLCK_DELEGRETURN 0x08000000 +#define NFSLCK_WANTWDELEG 0x10000000 +#define NFSLCK_WANTRDELEG 0x20000000 +#define NFSLCK_WANTNODELEG 0x40000000 +#define NFSLCK_WANTBITS \ + (NFSLCK_WANTWDELEG | NFSLCK_WANTRDELEG | NFSLCK_WANTNODELEG) /* And bits for nid_flag */ #define NFSID_INITIALIZE 0x0001 @@ -341,68 +352,120 @@ struct nfsreferral { * THE MACROS MUST BE MANUALLY MODIFIED IF NFSATTRBIT_MAXWORDS CHANGES!! * It is (NFSATTRBIT_MAX + 31) / 32. */ -#define NFSATTRBIT_MAXWORDS 2 +#define NFSATTRBIT_MAXWORDS 3 typedef struct { u_int32_t bits[NFSATTRBIT_MAXWORDS]; } nfsattrbit_t; -#define NFSZERO_ATTRBIT(b) do { (b)->bits[0] = 0; (b)->bits[1] = 0; } while (0) -#define NFSSET_ATTRBIT(t, f) do { (t)->bits[0] = (f)->bits[0]; \ - (t)->bits[1] = (f)->bits[1]; } while (0) +#define NFSZERO_ATTRBIT(b) do { \ + (b)->bits[0] = 0; \ + (b)->bits[1] = 0; \ + (b)->bits[2] = 0; \ +} while (0) + +#define NFSSET_ATTRBIT(t, f) do { \ + (t)->bits[0] = (f)->bits[0]; \ + (t)->bits[1] = (f)->bits[1]; \ + (t)->bits[2] = (f)->bits[2]; \ +} while (0) + #define NFSSETSUPP_ATTRBIT(b) do { \ (b)->bits[0] = NFSATTRBIT_SUPP0; \ - (b)->bits[1] = (NFSATTRBIT_SUPP1 | NFSATTRBIT_SUPPSETONLY); } while (0) + (b)->bits[1] = (NFSATTRBIT_SUPP1 | NFSATTRBIT_SUPPSETONLY); \ + (b)->bits[2] = NFSATTRBIT_SUPP2; \ +} while (0) + #define NFSISSET_ATTRBIT(b, p) ((b)->bits[(p) / 32] & (1 << ((p) % 32))) #define NFSSETBIT_ATTRBIT(b, p) ((b)->bits[(p) / 32] |= (1 << ((p) % 32))) #define NFSCLRBIT_ATTRBIT(b, p) ((b)->bits[(p) / 32] &= ~(1 << ((p) % 32))) + #define NFSCLRALL_ATTRBIT(b, a) do { \ - (b)->bits[0] &= ~((a)->bits[0]); \ - (b)->bits[1] &= ~((a)->bits[1]); \ - } while (0) + (b)->bits[0] &= ~((a)->bits[0]); \ + (b)->bits[1] &= ~((a)->bits[1]); \ + (b)->bits[2] &= ~((a)->bits[2]); \ +} while (0) + #define NFSCLRNOT_ATTRBIT(b, a) do { \ - (b)->bits[0] &= ((a)->bits[0]); \ - (b)->bits[1] &= ((a)->bits[1]); \ - } while (0) + (b)->bits[0] &= ((a)->bits[0]); \ + (b)->bits[1] &= ((a)->bits[1]); \ + (b)->bits[2] &= ((a)->bits[2]); \ +} while (0) + #define NFSCLRNOTFILLABLE_ATTRBIT(b) do { \ - (b)->bits[0] &= NFSATTRBIT_SUPP0; \ - (b)->bits[1] &= NFSATTRBIT_SUPP1; } while (0) + (b)->bits[0] &= NFSATTRBIT_SUPP0; \ + (b)->bits[1] &= NFSATTRBIT_SUPP1; \ + (b)->bits[2] &= NFSATTRBIT_SUPP2; \ +} while (0) + #define NFSCLRNOTSETABLE_ATTRBIT(b) do { \ - (b)->bits[0] &= NFSATTRBIT_SETABLE0; \ - (b)->bits[1] &= NFSATTRBIT_SETABLE1; } while (0) -#define NFSNONZERO_ATTRBIT(b) ((b)->bits[0] || (b)->bits[1]) -#define NFSEQUAL_ATTRBIT(b, p) \ - ((b)->bits[0] == (p)->bits[0] && (b)->bits[1] == (p)->bits[1]) + (b)->bits[0] &= NFSATTRBIT_SETABLE0; \ + (b)->bits[1] &= NFSATTRBIT_SETABLE1; \ + (b)->bits[2] &= NFSATTRBIT_SETABLE2; \ +} while (0) + +#define NFSNONZERO_ATTRBIT(b) ((b)->bits[0] || (b)->bits[1] || (b)->bits[2]) +#define NFSEQUAL_ATTRBIT(b, p) ((b)->bits[0] == (p)->bits[0] && \ + (b)->bits[1] == (p)->bits[1] && (b)->bits[2] == (p)->bits[2]) + #define NFSGETATTR_ATTRBIT(b) do { \ - (b)->bits[0] = NFSATTRBIT_GETATTR0; \ - (b)->bits[1] = NFSATTRBIT_GETATTR1; } while (0) + (b)->bits[0] = NFSATTRBIT_GETATTR0; \ + (b)->bits[1] = NFSATTRBIT_GETATTR1; \ + (b)->bits[2] = NFSATTRBIT_GETATTR2; \ +} while (0) + #define NFSWCCATTR_ATTRBIT(b) do { \ - (b)->bits[0] = NFSATTRBIT_WCCATTR0; \ - (b)->bits[1] = NFSATTRBIT_WCCATTR1; } while (0) + (b)->bits[0] = NFSATTRBIT_WCCATTR0; \ + (b)->bits[1] = NFSATTRBIT_WCCATTR1; \ + (b)->bits[2] = NFSATTRBIT_WCCATTR2; \ +} while (0) + #define NFSWRITEGETATTR_ATTRBIT(b) do { \ - (b)->bits[0] = NFSATTRBIT_WRITEGETATTR0; \ - (b)->bits[1] = NFSATTRBIT_WRITEGETATTR1; } while (0) + (b)->bits[0] = NFSATTRBIT_WRITEGETATTR0; \ + (b)->bits[1] = NFSATTRBIT_WRITEGETATTR1; \ + (b)->bits[2] = NFSATTRBIT_WRITEGETATTR2; \ +} while (0) + #define NFSCBGETATTR_ATTRBIT(b, c) do { \ - (c)->bits[0] = ((b)->bits[0] & NFSATTRBIT_CBGETATTR0); \ - (c)->bits[1] = ((b)->bits[1] & NFSATTRBIT_CBGETATTR1); } while (0) + (c)->bits[0] = ((b)->bits[0] & NFSATTRBIT_CBGETATTR0); \ + (c)->bits[1] = ((b)->bits[1] & NFSATTRBIT_CBGETATTR1); \ + (c)->bits[2] = ((b)->bits[2] & NFSATTRBIT_CBGETATTR2); \ +} while (0) + #define NFSPATHCONF_GETATTRBIT(b) do { \ - (b)->bits[0] = NFSGETATTRBIT_PATHCONF0; \ - (b)->bits[1] = NFSGETATTRBIT_PATHCONF1; } while (0) + (b)->bits[0] = NFSGETATTRBIT_PATHCONF0; \ + (b)->bits[1] = NFSGETATTRBIT_PATHCONF1; \ + (b)->bits[2] = NFSGETATTRBIT_PATHCONF2; \ +} while (0) + #define NFSSTATFS_GETATTRBIT(b) do { \ - (b)->bits[0] = NFSGETATTRBIT_STATFS0; \ - (b)->bits[1] = NFSGETATTRBIT_STATFS1; } while (0) + (b)->bits[0] = NFSGETATTRBIT_STATFS0; \ + (b)->bits[1] = NFSGETATTRBIT_STATFS1; \ + (b)->bits[2] = NFSGETATTRBIT_STATFS2; \ +} while (0) + #define NFSISSETSTATFS_ATTRBIT(b) \ (((b)->bits[0] & NFSATTRBIT_STATFS0) || \ - ((b)->bits[1] & NFSATTRBIT_STATFS1)) + ((b)->bits[1] & NFSATTRBIT_STATFS1) || \ + ((b)->bits[2] & NFSATTRBIT_STATFS2)) + #define NFSCLRSTATFS_ATTRBIT(b) do { \ - (b)->bits[0] &= ~NFSATTRBIT_STATFS0; \ - (b)->bits[1] &= ~NFSATTRBIT_STATFS1; } while (0) + (b)->bits[0] &= ~NFSATTRBIT_STATFS0; \ + (b)->bits[1] &= ~NFSATTRBIT_STATFS1; \ + (b)->bits[2] &= ~NFSATTRBIT_STATFS2; \ +} while (0) + #define NFSREADDIRPLUS_ATTRBIT(b) do { \ - (b)->bits[0] = NFSATTRBIT_READDIRPLUS0; \ - (b)->bits[1] = NFSATTRBIT_READDIRPLUS1; } while (0) + (b)->bits[0] = NFSATTRBIT_READDIRPLUS0; \ + (b)->bits[1] = NFSATTRBIT_READDIRPLUS1; \ + (b)->bits[2] = NFSATTRBIT_READDIRPLUS2; \ +} while (0) + #define NFSREFERRAL_ATTRBIT(b) do { \ - (b)->bits[0] = NFSATTRBIT_REFERRAL0; \ - (b)->bits[1] = NFSATTRBIT_REFERRAL1; } while (0) + (b)->bits[0] = NFSATTRBIT_REFERRAL0; \ + (b)->bits[1] = NFSATTRBIT_REFERRAL1; \ + (b)->bits[2] = NFSATTRBIT_REFERRAL2; \ +} while (0) /* * Store uid, gid creds that were used when the stateid was acquired. @@ -529,6 +592,9 @@ struct nfsrv_descript { int nd_gssnamelen; /* principal name length */ char *nd_gssname; /* principal name */ uint32_t *nd_slotseq; /* ptr to slot seq# in req */ + uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ + uint32_t nd_slotid; /* Slotid for this RPC */ + SVCXPRT *nd_xprt; /* Server RPC handle */ }; #define nd_princlen nd_gssnamelen @@ -562,6 +628,8 @@ struct nfsrv_descript { #define ND_NFSCL 0x01000000 #define ND_NFSV41 0x02000000 #define ND_HASSEQUENCE 0x04000000 +#define ND_CACHETHIS 0x08000000 +#define ND_LASTOP 0x10000000 /* * ND_GSS should be the "or" of all GSS type authentications. Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Fri Aug 1 21:10:41 2014 (r269398) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -739,8 +740,12 @@ tryagain: } nd->nd_mrep = NULL; - stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, nd->nd_mreq, - &nd->nd_mrep, timo); + if (clp != NULL && sep != NULL) + stat = clnt_bck_call(nrp->nr_client, &ext, procnum, + nd->nd_mreq, &nd->nd_mrep, timo, sep->nfsess_xprt); + else + stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, + nd->nd_mreq, &nd->nd_mrep, timo); if (rep != NULL) { /* @@ -795,7 +800,8 @@ tryagain: nd->nd_md = nd->nd_mrep; nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); nd->nd_repstat = 0; - if (nd->nd_procnum != NFSPROC_NULL) { + if (nd->nd_procnum != NFSPROC_NULL && + nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) sep = NFSMNT_MDSSESSION(nmp); @@ -827,11 +833,20 @@ tryagain: /* * If the first op is Sequence, free up the slot. */ - if (nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) + if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) NFSCL_DEBUG(1, "failed seq=%d\n", j); - if (nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) { - NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + - 5 * NFSX_UNSIGNED); + if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && j == 0) + ) { + if (i == NFSV4OP_SEQUENCE) + NFSM_DISSECT(tl, uint32_t *, + NFSX_V4SESSIONID + + 5 * NFSX_UNSIGNED); + else + NFSM_DISSECT(tl, uint32_t *, + NFSX_V4SESSIONID + + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; retseq = fxdr_unsigned(uint32_t, *tl++); Modified: stable/10/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonport.c Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfs_commonport.c Fri Aug 1 21:10:41 2014 (r269398) @@ -112,6 +112,7 @@ MALLOC_DEFINE(M_NEWNFSDEVINFO, "NFSCL de MALLOC_DEFINE(M_NEWNFSSOCKREQ, "NFSCL sockreq", "NFS Sock Req"); MALLOC_DEFINE(M_NEWNFSCLDS, "NFSCL session", "NFSv4.1 Session"); MALLOC_DEFINE(M_NEWNFSLAYRECALL, "NFSCL layrecall", "NFSv4.1 Layout Recall"); +MALLOC_DEFINE(M_NEWNFSDSESSION, "NFSD session", "NFSD Session for a client"); /* * Definition of mutex locks. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Fri Aug 1 21:10:41 2014 (r269398) @@ -1733,6 +1733,23 @@ nfsv4_loadattr(struct nfsrv_descript *nd } attrsum += NFSX_HYPER; break; + case NFSATTRBIT_SUPPATTREXCLCREAT: + retnotsup = 0; + error = nfsrv_getattrbits(nd, &retattrbits, + &cnt, &retnotsup); + if (error) + goto nfsmout; + if (compare && !(*retcmpp)) { + NFSSETSUPP_ATTRBIT(&checkattrbits); + NFSCLRNOTSETABLE_ATTRBIT(&checkattrbits); + NFSCLRBIT_ATTRBIT(&checkattrbits, + NFSATTRBIT_TIMEACCESSSET); + if (!NFSEQUAL_ATTRBIT(&retattrbits, &checkattrbits) + || retnotsup) + *retcmpp = NFSERR_NOTSAME; + } + attrsum += cnt; + break; default: printf("EEK! nfsv4_loadattr unknown attr=%d\n", bitpos); @@ -2469,6 +2486,12 @@ nfsv4_fillattr(struct nfsrv_descript *nd txdr_hyper(uquad, tl); retnum += NFSX_HYPER; break; + case NFSATTRBIT_SUPPATTREXCLCREAT: + NFSSETSUPP_ATTRBIT(&attrbits); + NFSCLRNOTSETABLE_ATTRBIT(&attrbits); + NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMEACCESSSET); + retnum += nfsrv_putattrbit(nd, &attrbits); + break; default: printf("EEK! Bad V4 attribute bitpos=%d\n", bitpos); }; @@ -3663,6 +3686,9 @@ nfsmout: /* * Handle an NFSv4.1 Sequence request for the session. + * If reply != NULL, use it to return the cached reply, as required. + * The client gets a cached reply via this call for callbacks, however the + * server gets a cached reply via the nfsv4_seqsess_cachereply() call. */ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, @@ -3671,7 +3697,8 @@ nfsv4_seqsession(uint32_t seqid, uint32_ int error; error = 0; - *reply = NULL; + if (reply != NULL) + *reply = NULL; if (slotid > maxslot) return (NFSERR_BADSLOT); if (seqid == slots[slotid].nfssl_seq) { @@ -3679,13 +3706,18 @@ nfsv4_seqsession(uint32_t seqid, uint32_ if (slots[slotid].nfssl_inprog != 0) error = NFSERR_DELAY; else if (slots[slotid].nfssl_reply != NULL) { - *reply = slots[slotid].nfssl_reply; - slots[slotid].nfssl_reply = NULL; + if (reply != NULL) { + *reply = slots[slotid].nfssl_reply; + slots[slotid].nfssl_reply = NULL; + } slots[slotid].nfssl_inprog = 1; + error = NFSERR_REPLYFROMCACHE; } else - error = NFSERR_SEQMISORDERED; + /* No reply cached, so just do it. */ + slots[slotid].nfssl_inprog = 1; } else if ((slots[slotid].nfssl_seq + 1) == seqid) { - m_freem(slots[slotid].nfssl_reply); + if (slots[slotid].nfssl_reply != NULL) + m_freem(slots[slotid].nfssl_reply); slots[slotid].nfssl_reply = NULL; slots[slotid].nfssl_inprog = 1; slots[slotid].nfssl_seq++; @@ -3696,12 +3728,22 @@ nfsv4_seqsession(uint32_t seqid, uint32_ /* * Cache this reply for the slot. + * Use the "rep" argument to return the cached reply if repstat is set to + * NFSERR_REPLYFROMCACHE. The client never sets repstat to this value. */ void -nfsv4_seqsess_cacherep(uint32_t slotid, struct nfsslot *slots, struct mbuf *rep) +nfsv4_seqsess_cacherep(uint32_t slotid, struct nfsslot *slots, int repstat, + struct mbuf **rep) { - slots[slotid].nfssl_reply = rep; + if (repstat == NFSERR_REPLYFROMCACHE) { + *rep = slots[slotid].nfssl_reply; + slots[slotid].nfssl_reply = NULL; + } else { + if (slots[slotid].nfssl_reply != NULL) + m_freem(slots[slotid].nfssl_reply); + slots[slotid].nfssl_reply = *rep; + } slots[slotid].nfssl_inprog = 0; } @@ -3713,9 +3755,36 @@ nfsv4_setsequence(struct nfsmount *nmp, struct nfsclsession *sep, int dont_replycache) { uint32_t *tl, slotseq = 0; + int error, maxslot, slotpos; + uint8_t sessionid[NFSX_V4SESSIONID]; + + error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, + sessionid); + if (error != 0) + return; + KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); + + /* Build the Sequence arguments. */ + NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + bcopy(sessionid, tl, NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + nd->nd_slotseq = tl; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + nd->nd_flag |= ND_HASSEQUENCE; +} + +int +nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsclsession *sep, + int *slotposp, int *maxslotp, uint32_t *slotseqp, uint8_t *sessionid) +{ int i, maxslot, slotpos; uint64_t bitval; - uint8_t sessionid[NFSX_V4SESSIONID]; /* Find an unused slot. */ slotpos = -1; @@ -3728,7 +3797,7 @@ nfsv4_setsequence(struct nfsmount *nmp, slotpos = i; sep->nfsess_slots |= bitval; sep->nfsess_slotseq[i]++; - slotseq = sep->nfsess_slotseq[i]; + *slotseqp = sep->nfsess_slotseq[i]; break; } bitval <<= 1; @@ -3739,10 +3808,11 @@ nfsv4_setsequence(struct nfsmount *nmp, * This RPC attempt will fail when it calls * newnfs_request(). */ - if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + if (nmp != NULL && + (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { mtx_unlock(&sep->nfsess_mtx); - return; + return (ESTALE); } /* Wake up once/sec, to check for a forced dismount. */ (void)mtx_sleep(&sep->nfsess_slots, &sep->nfsess_mtx, @@ -3758,21 +3828,9 @@ nfsv4_setsequence(struct nfsmount *nmp, } bcopy(sep->nfsess_sessionid, sessionid, NFSX_V4SESSIONID); mtx_unlock(&sep->nfsess_mtx); - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); - - /* Build the Sequence arguments. */ - NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); - bcopy(sessionid, tl, NFSX_V4SESSIONID); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; - nd->nd_flag |= ND_HASSEQUENCE; + *slotposp = slotpos; + *maxslotp = maxslot; + return (0); } /* Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfs_var.h Fri Aug 1 21:10:41 2014 (r269398) @@ -61,6 +61,7 @@ union nethostaddr; struct nfsstate; struct nfslock; struct nfsclient; +struct nfsdsession; struct nfslockconflict; struct nfsd_idargs; struct nfsd_clid; @@ -90,8 +91,11 @@ NFS_READDIR_ARGS; /* nfs_nfsdstate.c */ int nfsrv_setclient(struct nfsrv_descript *, struct nfsclient **, nfsquad_t *, nfsquad_t *, NFSPROC_T *); -int nfsrv_getclient(nfsquad_t, int, struct nfsclient **, nfsquad_t, - struct nfsrv_descript *, NFSPROC_T *); +int nfsrv_getclient(nfsquad_t, int, struct nfsclient **, struct nfsdsession *, + nfsquad_t, uint32_t, struct nfsrv_descript *, NFSPROC_T *); +int nfsrv_destroyclient(nfsquad_t, NFSPROC_T *); +int nfsrv_destroysession(struct nfsrv_descript *, uint8_t *); +int nfsrv_freestateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *); int nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *); void nfsrv_dumpclients(struct nfsd_dumpclients *, int); void nfsrv_dumplocks(vnode_t, struct nfsd_dumplocks *, int, NFSPROC_T *); @@ -105,8 +109,8 @@ int nfsrv_opencheck(nfsquad_t, nfsv4stat vnode_t, struct nfsrv_descript *, NFSPROC_T *, int); int nfsrv_openupdate(vnode_t, struct nfsstate *, nfsquad_t, nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *); -int nfsrv_delegupdate(nfsquad_t, nfsv4stateid_t *, vnode_t, int, - struct ucred *, NFSPROC_T *); +int nfsrv_delegupdate(struct nfsrv_descript *, nfsquad_t, nfsv4stateid_t *, + vnode_t, int, struct ucred *, NFSPROC_T *); int nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *); void nfsrv_zapclient(struct nfsclient *, NFSPROC_T *); int nfssvc_idname(struct nfsd_idargs *); @@ -127,6 +131,10 @@ int nfsrv_checkgetattr(struct nfsrv_desc int nfsrv_nfsuserdport(u_short, NFSPROC_T *); void nfsrv_nfsuserddelport(void); void nfsrv_throwawayallstate(NFSPROC_T *); +int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *, + uint32_t *, int, uint32_t *, NFSPROC_T *); +int nfsrv_checkreclaimcomplete(struct nfsrv_descript *); +void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **); /* nfs_nfsdserv.c */ int nfsrvd_access(struct nfsrv_descript *, int, @@ -211,10 +219,27 @@ int nfsrvd_releaselckown(struct nfsrv_de vnode_t, NFSPROC_T *, struct nfsexstuff *); int nfsrvd_pathconf(struct nfsrv_descript *, int, vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_exchangeid(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_createsession(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_sequence(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_reclaimcomplete(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_destroyclientid(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_destroysession(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_freestateid(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); +int nfsrvd_notsupp(struct nfsrv_descript *, int, + vnode_t, NFSPROC_T *, struct nfsexstuff *); /* nfs_nfsdsocket.c */ void nfsrvd_rephead(struct nfsrv_descript *); -void nfsrvd_dorpc(struct nfsrv_descript *, int, NFSPROC_T *); +void nfsrvd_dorpc(struct nfsrv_descript *, int, u_char *, int, u_int32_t, + NFSPROC_T *); /* nfs_nfsdcache.c */ void nfsrvd_initcache(void); @@ -264,9 +289,11 @@ int nfsv4_getipaddr(struct nfsrv_descrip int *); int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *, struct mbuf **, uint16_t); -void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, struct mbuf *); +void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **); void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *, struct nfsclsession *, int); +int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *, + int *, uint32_t *, uint8_t *); void nfsv4_freeslot(struct nfsclsession *, int); /* nfs_clcomsubs.c */ @@ -322,6 +349,8 @@ int nfsrv_parsename(struct nfsrv_descrip NFSPATHLEN_T *); void nfsd_init(void); int nfsd_checkrootexp(struct nfsrv_descript *); +void nfsd_getminorvers(struct nfsrv_descript *, u_char *, u_char **, int *, + u_int32_t *); /* nfs_clvfsops.c */ void nfscl_retopts(struct nfsmount *, char *, size_t); @@ -628,6 +657,7 @@ int nfsvno_advlock(vnode_t, int, u_int64 int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *); int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *); uint32_t nfsrv_hashfh(fhandle_t *); +uint32_t nfsrv_hashsessionid(uint8_t *); void nfsrv_backupstable(void); /* nfs_commonkrpc.c */ Modified: stable/10/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/10/sys/fs/nfs/nfsclstate.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfsclstate.h Fri Aug 1 21:10:41 2014 (r269398) @@ -57,6 +57,7 @@ struct nfsclsession { struct mtx nfsess_mtx; struct nfsslot nfsess_cbslots[NFSV4_CBSLOTS]; nfsquad_t nfsess_clientid; + SVCXPRT *nfsess_xprt; /* For backchannel callback */ uint32_t nfsess_slotseq[64]; /* Max for 64bit nm_slots */ uint64_t nfsess_slots; uint32_t nfsess_sequenceid; Modified: stable/10/sys/fs/nfs/nfsdport.h ============================================================================== --- stable/10/sys/fs/nfs/nfsdport.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfsdport.h Fri Aug 1 21:10:41 2014 (r269398) @@ -115,3 +115,9 @@ struct nfsexstuff { #define NFSRV_MINFH (sizeof (fhandle_t)) #define NFSRV_MAXFH (sizeof (fhandle_t)) +/* Use this macro for debug printfs. */ +#define NFSD_DEBUG(level, ...) do { \ + if (nfsd_debuglevel >= (level)) \ + printf(__VA_ARGS__); \ + } while (0) + Modified: stable/10/sys/fs/nfs/nfsport.h ============================================================================== --- stable/10/sys/fs/nfs/nfsport.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfsport.h Fri Aug 1 21:10:41 2014 (r269398) @@ -637,6 +637,9 @@ void nfsrvd_rcv(struct socket *, void *, #define NFSUNLOCKSOCKREQ(r) mtx_unlock(&((r)->nr_mtx)) #define NFSLOCKDS(d) mtx_lock(&((d)->nfsclds_mtx)) #define NFSUNLOCKDS(d) mtx_unlock(&((d)->nfsclds_mtx)) +#define NFSSESSIONMUTEXPTR(s) (&((s)->mtx)) +#define NFSLOCKSESSION(s) mtx_lock(&((s)->mtx)) +#define NFSUNLOCKSESSION(s) mtx_unlock(&((s)->mtx)) /* * Use these macros to initialize/free a mutex. @@ -732,6 +735,7 @@ MALLOC_DECLARE(M_NEWNFSDEVINFO); MALLOC_DECLARE(M_NEWNFSSOCKREQ); MALLOC_DECLARE(M_NEWNFSCLDS); MALLOC_DECLARE(M_NEWNFSLAYRECALL); +MALLOC_DECLARE(M_NEWNFSDSESSION); #define M_NFSRVCACHE M_NEWNFSRVCACHE #define M_NFSDCLIENT M_NEWNFSDCLIENT #define M_NFSDSTATE M_NEWNFSDSTATE @@ -757,6 +761,7 @@ MALLOC_DECLARE(M_NEWNFSLAYRECALL); #define M_NFSSOCKREQ M_NEWNFSSOCKREQ #define M_NFSCLDS M_NEWNFSCLDS #define M_NFSLAYRECALL M_NEWNFSLAYRECALL +#define M_NFSDSESSION M_NEWNFSDSESSION #define NFSINT_SIGMASK(set) \ (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \ Modified: stable/10/sys/fs/nfs/nfsproto.h ============================================================================== --- stable/10/sys/fs/nfs/nfsproto.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfsproto.h Fri Aug 1 21:10:41 2014 (r269398) @@ -389,9 +389,13 @@ #define NFSV4OPEN_CLAIMPREVIOUS 1 #define NFSV4OPEN_CLAIMDELEGATECUR 2 #define NFSV4OPEN_CLAIMDELEGATEPREV 3 +#define NFSV4OPEN_CLAIMFH 4 +#define NFSV4OPEN_CLAIMDELEGATECURFH 5 +#define NFSV4OPEN_CLAIMDELEGATEPREVFH 6 #define NFSV4OPEN_DELEGATENONE 0 #define NFSV4OPEN_DELEGATEREAD 1 #define NFSV4OPEN_DELEGATEWRITE 2 +#define NFSV4OPEN_DELEGATENONEEXT 3 #define NFSV4OPEN_LIMITSIZE 1 #define NFSV4OPEN_LIMITBLOCKS 2 @@ -479,6 +483,14 @@ #define NFSV4OPEN_ACCESSREAD 0x00000001 #define NFSV4OPEN_ACCESSWRITE 0x00000002 #define NFSV4OPEN_ACCESSBOTH 0x00000003 +#define NFSV4OPEN_WANTDELEGMASK 0x0000ff00 +#define NFSV4OPEN_WANTREADDELEG 0x00000100 +#define NFSV4OPEN_WANTWRITEDELEG 0x00000200 +#define NFSV4OPEN_WANTANYDELEG 0x00000300 +#define NFSV4OPEN_WANTNODELEG 0x00000400 +#define NFSV4OPEN_WANTCANCEL 0x00000500 +#define NFSV4OPEN_WANTSIGNALDELEG 0x00010000 +#define NFSV4OPEN_WANTPUSHDELEG 0x00020000 #define NFSV4OPEN_DENYNONE 0x00000000 #define NFSV4OPEN_DENYREAD 0x00000001 @@ -486,16 +498,35 @@ #define NFSV4OPEN_DENYBOTH 0x00000003 /* + * Delegate_none_ext reply values. + */ +#define NFSV4OPEN_NOTWANTED 0 +#define NFSV4OPEN_CONTENTION 1 +#define NFSV4OPEN_RESOURCE 2 +#define NFSV4OPEN_NOTSUPPFTYPE 3 +#define NFSV4OPEN_NOTSUPPWRITEFTYPE 4 +#define NFSV4OPEN_NOTSUPPUPGRADE 5 +#define NFSV4OPEN_NOTSUPPDOWNGRADE 6 +#define NFSV4OPEN_CANCELLED 7 +#define NFSV4OPEN_ISDIR 8 + +/* * Open result flags - * (The first two are in the spec. The rest are used internally.) + * (The first four are in the spec. The rest are used internally.) */ #define NFSV4OPEN_RESULTCONFIRM 0x00000002 #define NFSV4OPEN_LOCKTYPEPOSIX 0x00000004 +#define NFSV4OPEN_PRESERVEUNLINKED 0x00000008 +#define NFSV4OPEN_MAYNOTIFYLOCK 0x00000020 #define NFSV4OPEN_RFLAGS \ - (NFSV4OPEN_RESULTCONFIRM | NFSV4OPEN_LOCKTYPEPOSIX) + (NFSV4OPEN_RESULTCONFIRM | NFSV4OPEN_LOCKTYPEPOSIX | \ + NFSV4OPEN_PRESERVEUNLINKED | NFSV4OPEN_MAYNOTIFYLOCK) #define NFSV4OPEN_RECALL 0x00010000 #define NFSV4OPEN_READDELEGATE 0x00020000 #define NFSV4OPEN_WRITEDELEGATE 0x00040000 +#define NFSV4OPEN_WDRESOURCE 0x00080000 +#define NFSV4OPEN_WDCONTENTION 0x00100000 +#define NFSV4OPEN_WDNOTWANTED 0x00200000 /* * NFS V4 File Handle types @@ -805,6 +836,27 @@ struct nfsv3_sattr { #define NFSATTRBIT_TIMEMODIFY 53 #define NFSATTRBIT_TIMEMODIFYSET 54 #define NFSATTRBIT_MOUNTEDONFILEID 55 +#define NFSATTRBIT_DIRNOTIFDELAY 56 +#define NFSATTRBIT_DIRENTNOTIFDELAY 57 +#define NFSATTRBIT_DACL 58 +#define NFSATTRBIT_SACL 59 +#define NFSATTRBIT_CHANGEPOLICY 60 +#define NFSATTRBIT_FSSTATUS 61 +#define NFSATTRBIT_FSLAYOUTTYPE 62 +#define NFSATTRBIT_LAYOUTHINT 63 +#define NFSATTRBIT_LAYOUTTYPE 64 +#define NFSATTRBIT_LAYOUTBLKSIZE 65 +#define NFSATTRBIT_LAYOUTALIGNMENT 66 +#define NFSATTRBIT_FSLOCATIONSINFO 67 +#define NFSATTRBIT_MDSTHRESHOLD 68 +#define NFSATTRBIT_RETENTIONGET 69 +#define NFSATTRBIT_RETENTIONSET 70 +#define NFSATTRBIT_RETENTEVTGET 71 +#define NFSATTRBIT_RETENTEVTSET 72 +#define NFSATTRBIT_RETENTIONHOLD 73 +#define NFSATTRBIT_MODESETMASKED 74 +#define NFSATTRBIT_SUPPATTREXCLCREAT 75 +#define NFSATTRBIT_FSCHARSETCAP 76 #define NFSATTRBM_SUPPORTEDATTRS 0x00000001 #define NFSATTRBM_TYPE 0x00000002 @@ -862,8 +914,29 @@ struct nfsv3_sattr { #define NFSATTRBM_TIMEMODIFY 0x00200000 #define NFSATTRBM_TIMEMODIFYSET 0x00400000 #define NFSATTRBM_MOUNTEDONFILEID 0x00800000 +#define NFSATTRBM_DIRNOTIFDELAY 0x01000000 +#define NFSATTRBM_DIRENTNOTIFDELAY 0x02000000 +#define NFSATTRBM_DACL 0x04000000 +#define NFSATTRBM_SACL 0x08000000 +#define NFSATTRBM_CHANGEPOLICY 0x10000000 +#define NFSATTRBM_FSSTATUS 0x20000000 +#define NFSATTRBM_FSLAYOUTTYPE 0x40000000 +#define NFSATTRBM_LAYOUTHINT 0x80000000 +#define NFSATTRBM_LAYOUTTYPE 0x00000001 +#define NFSATTRBM_LAYOUTBLKSIZE 0x00000002 +#define NFSATTRBM_LAYOUTALIGNMENT 0x00000004 +#define NFSATTRBM_FSLOCATIONSINFO 0x00000008 +#define NFSATTRBM_MDSTHRESHOLD 0x00000010 +#define NFSATTRBM_RETENTIONGET 0x00000020 +#define NFSATTRBM_RETENTIONSET 0x00000040 +#define NFSATTRBM_RETENTEVTGET 0x00000080 +#define NFSATTRBM_RETENTEVTSET 0x00000100 +#define NFSATTRBM_RETENTIONHOLD 0x00000200 +#define NFSATTRBM_MODESETMASKED 0x00000400 +#define NFSATTRBM_SUPPATTREXCLCREAT 0x00000800 +#define NFSATTRBM_FSCHARSETCAP 0x00001000 -#define NFSATTRBIT_MAX 56 +#define NFSATTRBIT_MAX 77 /* * Sets of attributes that are supported, by words in the bitmap. @@ -871,6 +944,7 @@ struct nfsv3_sattr { /* * NFSATTRBIT_SUPPORTED - SUPP0 - bits 0<->31 * SUPP1 - bits 32<->63 + * SUPP2 - bits 64<->95 */ #define NFSATTRBIT_SUPP0 \ (NFSATTRBM_SUPPORTEDATTRS | \ @@ -937,6 +1011,8 @@ struct nfsv3_sattr { #define NFSATTRBIT_SUPP1 NFSATTRBIT_S1 #endif +#define NFSATTRBIT_SUPP2 NFSATTRBM_SUPPATTREXCLCREAT + /* * NFSATTRBIT_SUPPSETONLY is the OR of NFSATTRBIT_TIMEACCESSSET and * NFSATTRBIT_TIMEMODIFYSET. @@ -947,6 +1023,7 @@ struct nfsv3_sattr { /* * NFSATTRBIT_SETABLE - SETABLE0 - bits 0<->31 * SETABLE1 - bits 32<->63 + * SETABLE2 - bits 64<->95 */ #define NFSATTRBIT_SETABLE0 \ (NFSATTRBM_SIZE | \ @@ -957,6 +1034,7 @@ struct nfsv3_sattr { NFSATTRBM_OWNERGROUP | \ NFSATTRBM_TIMEACCESSSET | \ NFSATTRBM_TIMEMODIFYSET) +#define NFSATTRBIT_SETABLE2 0 /* * Set of attributes that the getattr vnode op needs. @@ -987,6 +1065,11 @@ struct nfsv3_sattr { NFSATTRBM_TIMEMODIFY) /* + * NFSATTRBIT_GETATTR2 - bits 64<->95 + */ +#define NFSATTRBIT_GETATTR2 0 + +/* * Subset of the above that the Write RPC gets. * OR of the following bits. * NFSATTRBIT_WRITEGETATTR0 - bits 0<->31 @@ -1013,6 +1096,11 @@ struct nfsv3_sattr { NFSATTRBM_TIMEMODIFY) /* + * NFSATTRBIT_WRITEGETATTR2 - bits 64<->95 + */ +#define NFSATTRBIT_WRITEGETATTR2 0 + +/* * Set of attributes that the wccattr operation op needs. * OR of the following bits. * NFSATTRBIT_WCCATTR0 - bits 0<->31 @@ -1026,6 +1114,11 @@ struct nfsv3_sattr { (NFSATTRBM_TIMEMODIFY) /* + * NFSATTRBIT_WCCATTR2 - bits 64<->95 + */ +#define NFSATTRBIT_WCCATTR2 0 + +/* * NFSATTRBIT_CBGETATTR0 - bits 0<->31 */ #define NFSATTRBIT_CBGETATTR0 (NFSATTRBM_CHANGE | NFSATTRBM_SIZE) @@ -1036,6 +1129,11 @@ struct nfsv3_sattr { #define NFSATTRBIT_CBGETATTR1 0x0 /* + * NFSATTRBIT_CBGETATTR2 - bits 64<->95 + */ +#define NFSATTRBIT_CBGETATTR2 0x0 + +/* * Sets of attributes that require a VFS_STATFS() call to get the * values of. * NFSATTRBIT_STATFS0 - bits 0<->31 @@ -1067,6 +1165,11 @@ struct nfsv3_sattr { NFSATTRBM_TIMEDELTA) /* + * NFSATTRBIT_STATFS2 - bits 64<->95 + */ +#define NFSATTRBIT_STATFS2 0 + +/* * These are the bits that are needed by the nfs_statfs() call. * (The regular getattr bits are or'd in so the vnode gets the correct * type, etc.) @@ -1094,6 +1197,11 @@ struct nfsv3_sattr { NFSATTRBM_TIMEDELTA) /* + * NFSGETATTRBIT_STATFS2 - bits 64<->95 + */ +#define NFSGETATTRBIT_STATFS2 0 + +/* * Set of attributes for the equivalent of an nfsv3 pathconf rpc. * NFSGETATTRBIT_PATHCONF0 - bits 0<->31 */ @@ -1111,6 +1219,11 @@ struct nfsv3_sattr { NFSATTRBM_NOTRUNC) /* + * NFSGETATTRBIT_PATHCONF2 - bits 64<->95 + */ +#define NFSGETATTRBIT_PATHCONF2 0 + +/* * Sets of attributes required by readdir and readdirplus. * NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBIT_FILEHANDLE | * NFSATTRBIT_RDATTRERROR) @@ -1118,6 +1231,7 @@ struct nfsv3_sattr { #define NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBM_FILEHANDLE | \ NFSATTRBM_RDATTRERROR) #define NFSATTRBIT_READDIRPLUS1 NFSATTRBIT_GETATTR1 +#define NFSATTRBIT_READDIRPLUS2 0 /* * Set of attributes supported by Referral vnodes. @@ -1125,6 +1239,7 @@ struct nfsv3_sattr { #define NFSATTRBIT_REFERRAL0 (NFSATTRBM_TYPE | NFSATTRBM_FSID | \ NFSATTRBM_RDATTRERROR | NFSATTRBM_FSLOCATIONS) #define NFSATTRBIT_REFERRAL1 NFSATTRBM_MOUNTEDONFILEID +#define NFSATTRBIT_REFERRAL2 0 /* * Structure for data handled by the statfs rpc. Since some fields are Modified: stable/10/sys/fs/nfs/nfsrvstate.h ============================================================================== --- stable/10/sys/fs/nfs/nfsrvstate.h Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfs/nfsrvstate.h Fri Aug 1 21:10:41 2014 (r269398) @@ -42,6 +42,8 @@ LIST_HEAD(nfsclienthashhead, nfsclient); LIST_HEAD(nfsstatehead, nfsstate); LIST_HEAD(nfslockhead, nfslock); LIST_HEAD(nfslockhashhead, nfslockfile); +LIST_HEAD(nfssessionhead, nfsdsession); +LIST_HEAD(nfssessionhashhead, nfsdsession); /* * List head for nfsusrgrp. @@ -64,6 +66,13 @@ TAILQ_HEAD(nfsuserlruhead, nfsusrgrp); (&nfsgroupnamehash[((l)>=4?(*(p)+*((p)+1)+*((p)+2)+*((p)+3)):*(p)) \ % NFSGROUPHASHSIZE]) +struct nfssessionhash { + struct mtx mtx; + struct nfssessionhashhead list; +}; +#define NFSSESSIONHASH(f) \ + (&nfssessionhash[nfsrv_hashsessionid(f) % NFSSESSIONHASHSIZE]) + /* * Client server structure for V4. It is doubly linked into two lists. * The first is a hash table based on the clientid and the second is a @@ -76,6 +85,7 @@ struct nfsclient { struct nfsstatehead lc_open; /* Open owner list */ struct nfsstatehead lc_deleg; /* Delegations */ struct nfsstatehead lc_olddeleg; /* and old delegations */ + struct nfssessionhead lc_session; /* List of NFSv4.1 sessions */ time_t lc_expiry; /* Expiry time (sec) */ time_t lc_delegtime; /* Old deleg expiry (sec) */ nfsquad_t lc_clientid; /* 64 bit clientid */ @@ -101,6 +111,43 @@ struct nfsclient { #define CLOPS_RENEWOP 0x0004 /* + * Structure for an NFSv4.1 session. + * Locking rules for this structure. + * To add/delete one of these structures from the lists, you must lock + * both: NFSLOCKSESSION(session hashhead) and NFSLOCKSTATE() in that order. + * To traverse the lists looking for one of these, you must hold one + * of these two locks. + * The exception is if the thread holds the exclusive root sleep lock. + * In this case, all other nfsd threads are blocked, so locking the + * mutexes isn't required. + * When manipulating sess_refcnt, NFSLOCKSTATE() must be locked. + * When manipulating the fields withinsess_cbsess except nfsess_xprt, + * sess_cbsess.nfsess_mtx must be locked. + * When manipulating sess_slots and sess_cbsess.nfsess_xprt, + * NFSLOCKSESSION(session hashhead) must be locked. + */ +struct nfsdsession { + uint64_t sess_refcnt; /* Reference count. */ + LIST_ENTRY(nfsdsession) sess_hash; /* Hash list of sessions. */ + LIST_ENTRY(nfsdsession) sess_list; /* List of client sessions. */ + struct nfsslot sess_slots[NFSV4_SLOTS]; + struct nfsclient *sess_clp; /* Associated clientid. */ + uint32_t sess_crflags; + uint32_t sess_cbprogram; + uint32_t sess_maxreq; + uint32_t sess_maxresp; + uint32_t sess_maxrespcached; + uint32_t sess_maxops; + uint32_t sess_maxslots; + uint32_t sess_cbmaxreq; + uint32_t sess_cbmaxresp; + uint32_t sess_cbmaxrespcached; + uint32_t sess_cbmaxops; + uint8_t sess_sessionid[NFSX_V4SESSIONID]; + struct nfsclsession sess_cbsess; /* Callback session. */ +}; + +/* * Nfs state structure. I couldn't resist overloading this one, since * it makes cleanup, etc. simpler. These structures are used in four ways: * - open_owner structures chained off of nfsclient Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Fri Aug 1 21:10:41 2014 (r269398) @@ -3548,7 +3548,7 @@ out: if (clp != NULL) { nfsv4_seqsess_cacherep(slotid, NFSMNT_MDSSESSION(clp->nfsc_nmp)->nfsess_cbslots, - rep); + NFSERR_OK, &rep); NFSUNLOCKCLSTATE(); } else { NFSUNLOCKCLSTATE(); Modified: stable/10/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Fri Aug 1 21:00:18 2014 (r269397) +++ stable/10/sys/fs/nfsserver/nfs_nfsdcache.c Fri Aug 1 21:10:41 2014 (r269398) @@ -977,6 +977,9 @@ nfsrvd_refcache(struct nfsrvcache *rp) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:14:02 2014 Return-Path: Delivered-To: svn-src-all@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 A80C2F42; Fri, 1 Aug 2014 21:14: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94A0E2835; Fri, 1 Aug 2014 21:14:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71LE2uA015352; Fri, 1 Aug 2014 21:14:02 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71LE2oV015350; Fri, 1 Aug 2014 21:14:02 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201408012114.s71LE2oV015350@svn.freebsd.org> From: Ed Maste Date: Fri, 1 Aug 2014 21:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269399 - stable/10/etc/mtree X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:14:02 -0000 Author: emaste Date: Fri Aug 1 21:14:02 2014 New Revision: 269399 URL: http://svnweb.freebsd.org/changeset/base/269399 Log: MFC r266902: Add missing libexec/bsdconfig subdirectories Modified: stable/10/etc/mtree/BSD.usr.dist Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.usr.dist ============================================================================== --- stable/10/etc/mtree/BSD.usr.dist Fri Aug 1 21:10:41 2014 (r269398) +++ stable/10/etc/mtree/BSD.usr.dist Fri Aug 1 21:14:02 2014 (r269399) @@ -101,6 +101,10 @@ .. include .. + includes + include + .. + .. .. bsdinstall .. From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:24:20 2014 Return-Path: Delivered-To: svn-src-all@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 28755306; Fri, 1 Aug 2014 21:24:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15484292B; Fri, 1 Aug 2014 21:24:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71LOJJj019847; Fri, 1 Aug 2014 21:24:19 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71LOJqB019846; Fri, 1 Aug 2014 21:24:19 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201408012124.s71LOJqB019846@svn.freebsd.org> From: Rick Macklem Date: Fri, 1 Aug 2014 21:24:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269400 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:24:20 -0000 Author: rmacklem Date: Fri Aug 1 21:24:19 2014 New Revision: 269400 URL: http://svnweb.freebsd.org/changeset/base/269400 Log: Bump __FreeBSD_version for r269398, since it changes the internal interfaces between the NFS related modules. This is a direct commit to stable/10. Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Fri Aug 1 21:14:02 2014 (r269399) +++ stable/10/sys/sys/param.h Fri Aug 1 21:24:19 2014 (r269400) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000711 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000712 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:28:58 2014 Return-Path: Delivered-To: svn-src-all@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 EDB894B7; Fri, 1 Aug 2014 21:28: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA22D2953; Fri, 1 Aug 2014 21:28:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71LSwrv020454; Fri, 1 Aug 2014 21:28:58 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71LSwcc020453; Fri, 1 Aug 2014 21:28:58 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201408012128.s71LSwcc020453@svn.freebsd.org> From: Rick Macklem Date: Fri, 1 Aug 2014 21:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269401 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:28:59 -0000 Author: rmacklem Date: Fri Aug 1 21:28:58 2014 New Revision: 269401 URL: http://svnweb.freebsd.org/changeset/base/269401 Log: Add an UPDATING entry for the __FreeBSD_version bump related to r269398. Modified: stable/10/UPDATING Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Fri Aug 1 21:24:19 2014 (r269400) +++ stable/10/UPDATING Fri Aug 1 21:28:58 2014 (r269401) @@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20140801: + The NFSv4.1 server committed by r269398 changes the internal + function call interfaces used between the NFS and krpc modules. + As such, __FreeBSD_version was bumped. + 20140717: It is no longer necessary to include the dwarf version in your DEBUG options in your kernel config file. The bug that required it to be From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 21:40:42 2014 Return-Path: Delivered-To: svn-src-all@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 D7D76904; Fri, 1 Aug 2014 21:40: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3D402AF7; Fri, 1 Aug 2014 21:40:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71LegFU027016; Fri, 1 Aug 2014 21:40:42 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71LegeQ027014; Fri, 1 Aug 2014 21:40:42 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201408012140.s71LegeQ027014@svn.freebsd.org> From: Ed Maste Date: Fri, 1 Aug 2014 21:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269402 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 21:40:42 -0000 Author: emaste Date: Fri Aug 1 21:40:42 2014 New Revision: 269402 URL: http://svnweb.freebsd.org/changeset/base/269402 Log: MFC r258436: Refactor amd64 startup SMAP parsing Extracted from the projects/uefi branch, this change is a reasonable cleanup and will reduce the diffs to review when bringing in the UEFI work. Modified: stable/10/sys/amd64/amd64/machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Fri Aug 1 21:28:58 2014 (r269401) +++ stable/10/sys/amd64/amd64/machdep.c Fri Aug 1 21:40:42 2014 (r269402) @@ -1330,20 +1330,14 @@ isa_irq_pending(void) u_int basemem; static int -add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp) +add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, + int *physmap_idxp) { int i, insert_idx, physmap_idx; physmap_idx = *physmap_idxp; - if (boothowto & RB_VERBOSE) - printf("SMAP type=%02x base=%016lx len=%016lx\n", - smap->type, smap->base, smap->length); - - if (smap->type != SMAP_TYPE_MEMORY) - return (1); - - if (smap->length == 0) + if (length == 0) return (1); /* @@ -1352,8 +1346,8 @@ add_smap_entry(struct bios_smap *smap, v */ insert_idx = physmap_idx + 2; for (i = 0; i <= physmap_idx; i += 2) { - if (smap->base < physmap[i + 1]) { - if (smap->base + smap->length <= physmap[i]) { + if (base < physmap[i + 1]) { + if (base + length <= physmap[i]) { insert_idx = i; break; } @@ -1365,15 +1359,14 @@ add_smap_entry(struct bios_smap *smap, v } /* See if we can prepend to the next entry. */ - if (insert_idx <= physmap_idx && - smap->base + smap->length == physmap[insert_idx]) { - physmap[insert_idx] = smap->base; + if (insert_idx <= physmap_idx && base + length == physmap[insert_idx]) { + physmap[insert_idx] = base; return (1); } /* See if we can append to the previous entry. */ - if (insert_idx > 0 && smap->base == physmap[insert_idx - 1]) { - physmap[insert_idx - 1] += smap->length; + if (insert_idx > 0 && base == physmap[insert_idx - 1]) { + physmap[insert_idx - 1] += length; return (1); } @@ -1395,11 +1388,42 @@ add_smap_entry(struct bios_smap *smap, v } /* Insert the new entry. */ - physmap[insert_idx] = smap->base; - physmap[insert_idx + 1] = smap->base + smap->length; + physmap[insert_idx] = base; + physmap[insert_idx + 1] = base + length; return (1); } +static void +add_smap_entries(struct bios_smap *smapbase, vm_paddr_t *physmap, + int *physmap_idx) +{ + struct bios_smap *smap, *smapend; + u_int32_t smapsize; + + /* + * Memory map from INT 15:E820. + * + * subr_module.c says: + * "Consumer may safely assume that size value precedes data." + * ie: an int32_t immediately precedes smap. + */ + smapsize = *((u_int32_t *)smapbase - 1); + smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); + + for (smap = smapbase; smap < smapend; smap++) { + if (boothowto & RB_VERBOSE) + printf("SMAP type=%02x base=%016lx len=%016lx\n", + smap->type, smap->base, smap->length); + + if (smap->type != SMAP_TYPE_MEMORY) + continue; + + if (!add_physmap_entry(smap->base, smap->length, physmap, + physmap_idx)) + break; + } +} + /* * Populate the (physmap) array with base/bound pairs describing the * available physical memory in the system, then test this memory and @@ -1417,32 +1441,19 @@ getmemsize(caddr_t kmdp, u_int64_t first vm_paddr_t pa, physmap[PHYSMAP_SIZE]; u_long physmem_start, physmem_tunable, memtest; pt_entry_t *pte; - struct bios_smap *smapbase, *smap, *smapend; - u_int32_t smapsize; + struct bios_smap *smapbase; quad_t dcons_addr, dcons_size; bzero(physmap, sizeof(physmap)); basemem = 0; physmap_idx = 0; - /* - * get memory map from INT 15:E820, kindly supplied by the loader. - * - * subr_module.c says: - * "Consumer may safely assume that size value precedes data." - * ie: an int32_t immediately precedes smap. - */ smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase == NULL) panic("No BIOS smap info from loader!"); - smapsize = *((u_int32_t *)smapbase - 1); - smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); - - for (smap = smapbase; smap < smapend; smap++) - if (!add_smap_entry(smap, physmap, &physmap_idx)) - break; + add_smap_entries(smapbase, physmap, &physmap_idx); /* * Find the 'base memory' segment for SMP From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 22:28:36 2014 Return-Path: Delivered-To: svn-src-all@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 E8F4E683; Fri, 1 Aug 2014 22:28:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C970D20C1; Fri, 1 Aug 2014 22:28:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71MSand048060; Fri, 1 Aug 2014 22:28:36 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71MSaIA048059; Fri, 1 Aug 2014 22:28:36 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012228.s71MSaIA048059@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 22:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269403 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 22:28:37 -0000 Author: ian Date: Fri Aug 1 22:28:36 2014 New Revision: 269403 URL: http://svnweb.freebsd.org/changeset/base/269403 Log: Add 64-bit atomic ops for armv6. The only safe way to access a 64-bit value shared across multiple cores is with atomic_load_64() and atomic_store_64(), because the normal 64-bit load/store instructions are not atomic on 32-bit arm. Luckily the ldrexd/strexd instructions that are atomic are fairly cheap on armv6. Because it's fairly simple to do, this implements all the ops for 64-bit, not just load/store. Reviewed by: andrew, cognet Modified: head/sys/arm/include/atomic.h Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Fri Aug 1 21:40:42 2014 (r269402) +++ head/sys/arm/include/atomic.h Fri Aug 1 22:28:36 2014 (r269403) @@ -146,6 +146,28 @@ atomic_set_32(volatile uint32_t *address } static __inline void +atomic_set_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " orr %Q[tmp], %Q[val]\n" + " orr %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_set_long(volatile u_long *address, u_long setmask) { u_long tmp = 0, tmp2 = 0; @@ -177,6 +199,28 @@ atomic_clear_32(volatile uint32_t *addre } static __inline void +atomic_clear_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " bic %Q[tmp], %Q[val]\n" + " bic %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_clear_long(volatile u_long *address, u_long setmask) { u_long tmp = 0, tmp2 = 0; @@ -213,6 +257,35 @@ atomic_cmpset_32(volatile u_int32_t *p, return (ret); } +static __inline int +atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +{ + uint64_t tmp; + uint32_t ret; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " teq %Q[tmp], %Q[cmp]\n" + " itee eq \n" + " teqeq %R[tmp], %R[cmp]\n" + " movne %[ret], #0\n" + " bne 2f\n" + " strexd %[ret], %[new], [%[ptr]]\n" + " teq %[ret], #0\n" + " it ne \n" + " bne 1b\n" + " mov %[ret], #1\n" + "2: \n" + : [ret] "=&r" (ret), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [cmp] "r" (cmpval), + [new] "r" (newval) + : "cc", "memory"); + return (ret); +} + static __inline u_long atomic_cmpset_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -244,6 +317,15 @@ atomic_cmpset_acq_32(volatile u_int32_t return (ret); } +static __inline uint64_t +atomic_cmpset_acq_64(volatile uint64_t *p, volatile uint64_t cmpval, volatile uint64_t newval) +{ + uint64_t ret = atomic_cmpset_64(p, cmpval, newval); + + __do_dmb(); + return (ret); +} + static __inline u_long atomic_cmpset_acq_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -261,6 +343,14 @@ atomic_cmpset_rel_32(volatile u_int32_t return (atomic_cmpset_32(p, cmpval, newval)); } +static __inline uint64_t +atomic_cmpset_rel_64(volatile uint64_t *p, volatile uint64_t cmpval, volatile uint64_t newval) +{ + + __do_dmb(); + return (atomic_cmpset_64(p, cmpval, newval)); +} + static __inline u_long atomic_cmpset_rel_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -286,6 +376,28 @@ atomic_add_32(volatile u_int32_t *p, u_i } static __inline void +atomic_add_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " adds %Q[tmp], %Q[val]\n" + " adc %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_add_long(volatile u_long *p, u_long val) { u_long tmp = 0, tmp2 = 0; @@ -316,6 +428,28 @@ atomic_subtract_32(volatile u_int32_t *p } static __inline void +atomic_subtract_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " subs %Q[tmp], %Q[val]\n" + " sbc %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_subtract_long(volatile u_long *p, u_long val) { u_long tmp = 0, tmp2 = 0; @@ -334,6 +468,10 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(add, 32) ATOMIC_ACQ_REL(subtract, 32) ATOMIC_ACQ_REL(set, 32) +ATOMIC_ACQ_REL(clear, 64) +ATOMIC_ACQ_REL(add, 64) +ATOMIC_ACQ_REL(subtract, 64) +ATOMIC_ACQ_REL(set, 64) ATOMIC_ACQ_REL_LONG(clear) ATOMIC_ACQ_REL_LONG(add) ATOMIC_ACQ_REL_LONG(subtract) @@ -392,6 +530,116 @@ atomic_store_rel_32(volatile uint32_t *p *p = v; } +static __inline uint64_t +atomic_fetchadd_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t ret, tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " adds %Q[tmp], %Q[ret], %Q[val]\n" + " adc %R[tmp], %R[ret], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [ret] "=&r" (ret), + [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_readandclear_64(volatile uint64_t *p) +{ + uint64_t ret, tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " mov %Q[tmp], #0\n" + " mov %R[tmp], #0\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [ret] "=&r" (ret), + [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_load_64(volatile uint64_t *p) +{ + uint64_t ret; + + /* + * The only way to atomically load 64 bits is with LDREXD which puts the + * exclusive monitor into the open state, so reset it with CLREX because + * we don't actually need to store anything. + */ + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " clrex \n" + : [ret] "=&r" (ret) + : [ptr] "r" (p) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_load_acq_64(volatile uint64_t *p) +{ + uint64_t ret; + + ret = atomic_load_64(p); + __do_dmb(); + return (ret); +} + +static __inline void +atomic_store_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + /* + * The only way to atomically store 64 bits is with STREXD, which will + * succeed only if paired up with a preceeding LDREXD using the same + * address, so we read and discard the existing value before storing. + */ + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " strexd %[exf], %[val], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [tmp] "=&r" (tmp), + [exf] "=&r" (exflag) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void +atomic_store_rel_64(volatile uint64_t *p, uint64_t val) +{ + + __do_dmb(); + atomic_store_64(p, val); +} + static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long val) { From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 22:33:24 2014 Return-Path: Delivered-To: svn-src-all@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 21A5B879; Fri, 1 Aug 2014 22:33:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E7982170; Fri, 1 Aug 2014 22:33:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71MXNu1051920; Fri, 1 Aug 2014 22:33:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71MXNIx051919; Fri, 1 Aug 2014 22:33:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408012233.s71MXNIx051919@svn.freebsd.org> From: Xin LI Date: Fri, 1 Aug 2014 22:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269404 - head/sys/cddl/compat/opensolaris/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 22:33:24 -0000 Author: delphij Date: Fri Aug 1 22:33:23 2014 New Revision: 269404 URL: http://svnweb.freebsd.org/changeset/base/269404 Log: Split gethrtime() and gethrtime_waitfree() and make the former use nanouptime() instead of getnanouptime(). nanouptime(9) provides more precise result at expense of being slower. In r269223, gethrtime() is used as creation time of dbuf, which in turn acts as portion of lookup key to maintain AVL invariant where there can not be duplicate items. Before this change, gethrtime() have preferred better execution time by sacrificing precision, which may lead to panic on busy systems with: panic: avl_find() succeeded inside avl_add() Reported by: allanjude, mav PR: kern/192284 MFC after: 11 days X-MFC-with: r269223 Modified: head/sys/cddl/compat/opensolaris/sys/time.h Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 1 22:28:36 2014 (r269403) +++ head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 1 22:33:23 2014 (r269404) @@ -60,6 +60,17 @@ gethrtime(void) { struct timespec ts; hrtime_t nsec; + nanouptime(&ts); + nsec = (hrtime_t)ts.tv_sec * NANOSEC + ts.tv_nsec; + return (nsec); +} + +static __inline hrtime_t +gethrtime_waitfree(void) { + + struct timespec ts; + hrtime_t nsec; + getnanouptime(&ts); nsec = (hrtime_t)ts.tv_sec * NANOSEC + ts.tv_nsec; return (nsec); @@ -67,7 +78,6 @@ gethrtime(void) { #define gethrestime_sec() (time_second) #define gethrestime(ts) getnanotime(ts) -#define gethrtime_waitfree() gethrtime() extern int nsec_per_tick; /* nanoseconds per clock tick */ From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 22:56:42 2014 Return-Path: Delivered-To: svn-src-all@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 06288FE1; Fri, 1 Aug 2014 22:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB7612443; Fri, 1 Aug 2014 22:56:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71MufZt061545; Fri, 1 Aug 2014 22:56:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71Muf47061544; Fri, 1 Aug 2014 22:56:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012256.s71Muf47061544@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 22:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269405 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 22:56:42 -0000 Author: ian Date: Fri Aug 1 22:56:41 2014 New Revision: 269405 URL: http://svnweb.freebsd.org/changeset/base/269405 Log: Add 64-bit atomic ops for armv4, only for kernel code, mostly so that we don't need any #ifdef stuff to use atomic_load/store_64() elsewhere in the kernel. For armv4 the atomics are trivial to implement for kernel code (just disable interrupts), less so for user mode, so this only has the kernel mode implementations for now. Modified: head/sys/arm/include/atomic.h Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Fri Aug 1 22:33:23 2014 (r269404) +++ head/sys/arm/include/atomic.h Fri Aug 1 22:56:41 2014 (r269405) @@ -729,11 +729,23 @@ atomic_set_32(volatile uint32_t *address } static __inline void +atomic_set_64(volatile uint64_t *address, uint64_t setmask) +{ + __with_interrupts_disabled(*address |= setmask); +} + +static __inline void atomic_clear_32(volatile uint32_t *address, uint32_t clearmask) { __with_interrupts_disabled(*address &= ~clearmask); } +static __inline void +atomic_clear_64(volatile uint64_t *address, uint64_t clearmask) +{ + __with_interrupts_disabled(*address &= ~clearmask); +} + static __inline u_int32_t atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { @@ -751,6 +763,23 @@ atomic_cmpset_32(volatile u_int32_t *p, return (ret); } +static __inline u_int64_t +atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + static __inline void atomic_add_32(volatile u_int32_t *p, u_int32_t val) { @@ -758,11 +787,23 @@ atomic_add_32(volatile u_int32_t *p, u_i } static __inline void +atomic_add_64(volatile u_int64_t *p, u_int64_t val) +{ + __with_interrupts_disabled(*p += val); +} + +static __inline void atomic_subtract_32(volatile u_int32_t *p, u_int32_t val) { __with_interrupts_disabled(*p -= val); } +static __inline void +atomic_subtract_64(volatile u_int64_t *p, u_int64_t val) +{ + __with_interrupts_disabled(*p -= val); +} + static __inline uint32_t atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) { @@ -776,6 +817,34 @@ atomic_fetchadd_32(volatile uint32_t *p, return (value); } +static __inline uint64_t +atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t value; + + __with_interrupts_disabled( + { + value = *p; + *p += v; + }); + return (value); +} + +static __inline uint64_t +atomic_load_64(volatile uint64_t *p) +{ + uint64_t value; + + __with_interrupts_disabled(value = *p); + return (value); +} + +static __inline void +atomic_store_64(volatile uint64_t *p, uint64_t value) +{ + __with_interrupts_disabled(*p = value); +} + #else /* !_KERNEL */ static __inline u_int32_t From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 23:06:39 2014 Return-Path: Delivered-To: svn-src-all@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 52A64280; Fri, 1 Aug 2014 23:06: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 407F72513; Fri, 1 Aug 2014 23:06:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71N6cU4066264; Fri, 1 Aug 2014 23:06:38 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71N6c1a066263; Fri, 1 Aug 2014 23:06:38 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012306.s71N6c1a066263@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 23:06:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269406 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 23:06:39 -0000 Author: ian Date: Fri Aug 1 23:06:38 2014 New Revision: 269406 URL: http://svnweb.freebsd.org/changeset/base/269406 Log: Use atomic_load/store_64() in the arm implementation of counter(9), and remove the XXX comments about non-atomic access to the counters. Modified: head/sys/arm/include/counter.h Modified: head/sys/arm/include/counter.h ============================================================================== --- head/sys/arm/include/counter.h Fri Aug 1 22:56:41 2014 (r269405) +++ head/sys/arm/include/counter.h Fri Aug 1 23:06:38 2014 (r269406) @@ -30,6 +30,7 @@ #define __MACHINE_COUNTER_H__ #include +#include #ifdef INVARIANTS #include #endif @@ -38,12 +39,13 @@ #define counter_exit() critical_exit() #ifdef IN_SUBR_COUNTER_C -/* XXXKIB non-atomic 64bit read */ + static inline uint64_t counter_u64_read_one(uint64_t *p, int cpu) { - return (*(uint64_t *)((char *)p + sizeof(struct pcpu) * cpu)); + return (atomic_load_64((uint64_t *)((char *)p + sizeof(struct pcpu) * + cpu))); } static inline uint64_t @@ -59,13 +61,12 @@ counter_u64_fetch_inline(uint64_t *p) return (r); } -/* XXXKIB non-atomic 64bit store, might interrupt increment */ static void counter_u64_zero_one_cpu(void *arg) { - *((uint64_t *)((char *)arg + sizeof(struct pcpu) * - PCPU_GET(cpuid))) = 0; + atomic_store_64((uint64_t *)((char *)arg + sizeof(struct pcpu) * + PCPU_GET(cpuid)), 0); } static inline void @@ -79,7 +80,7 @@ counter_u64_zero_inline(counter_u64_t c) #define counter_u64_add_protected(c, inc) do { \ CRITICAL_ASSERT(curthread); \ - *(uint64_t *)zpcpu_get(c) += (inc); \ + atomic_add_64((uint64_t *)zpcpu_get(c), (inc)); \ } while (0) static inline void From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 23:16:50 2014 Return-Path: Delivered-To: svn-src-all@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 D27844E6; Fri, 1 Aug 2014 23: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF50125FB; Fri, 1 Aug 2014 23:16:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71NGoEB071045; Fri, 1 Aug 2014 23:16:50 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71NGnBh071036; Fri, 1 Aug 2014 23:16:49 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201408012316.s71NGnBh071036@svn.freebsd.org> From: Steven Hartland Date: Fri, 1 Aug 2014 23:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269407 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 23:16:50 -0000 Author: smh Date: Fri Aug 1 23:16:48 2014 New Revision: 269407 URL: http://svnweb.freebsd.org/changeset/base/269407 Log: Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods This prevents recursion of vdev_queue_io_done as per r265321 but using a different method as recommended on the openzfs list. We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods. zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns ZIO_PIPELINE_STOP to ensure future changes don't reintroduce ZIO_PIPELINE_CONTINUE returns. Cleanup flow in vdev_geom_io_start while I'm here. Also fix some cases not using SET_ERROR(..) MFC after: 2 weeks X-MFC-With: r265321 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:16:48 2014 (r269407) @@ -208,7 +208,6 @@ enum zio_flag { ZIO_FLAG_NOPWRITE = 1 << 26, ZIO_FLAG_REEXECUTED = 1 << 27, ZIO_FLAG_DELEGATED = 1 << 28, - ZIO_FLAG_QUEUE_IO_DONE = 1 << 29, }; #define ZIO_FLAG_MUSTSUCCEED 0 @@ -363,7 +362,7 @@ typedef struct zio_transform { struct zio_transform *zt_next; } zio_transform_t; -typedef int zio_pipe_stage_t(zio_t **ziop); +typedef int zio_pipe_stage_t(zio_t *zio); /* * The io_reexecute flags are distinct from io_flags because the child must Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:16:48 2014 (r269407) @@ -684,7 +684,7 @@ vdev_disk_io_intr(buf_t *bp) * Rather than teach the rest of the stack about other error * possibilities (EFAULT, etc), we normalize the error value here. */ - zio->io_error = (geterror(bp) != 0 ? EIO : 0); + zio->io_error = (geterror(bp) != 0 ? SET_ERROR(EIO) : 0); if (zio->io_error == 0 && bp->b_resid != 0) zio->io_error = SET_ERROR(EIO); @@ -730,15 +730,17 @@ vdev_disk_io_start(zio_t *zio) * Nothing to be done here but return failure. */ if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) { - zio->io_error = ENXIO; - return (ZIO_PIPELINE_CONTINUE); + zio->io_error = SET_ERROR(ENXIO); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } if (zio->io_type == ZIO_TYPE_IOCTL) { /* XXPOLICY */ if (!vdev_readable(vd)) { zio->io_error = SET_ERROR(ENXIO); - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } switch (zio->io_cmd) { @@ -790,7 +792,8 @@ vdev_disk_io_start(zio_t *zio) zio->io_error = SET_ERROR(ENOTSUP); } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:16:48 2014 (r269407) @@ -164,7 +164,8 @@ vdev_file_io_start(zio_t *zio) if (!vdev_readable(vd)) { zio->io_error = SET_ERROR(ENXIO); - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } vf = vd->vdev_tsd; @@ -180,7 +181,8 @@ vdev_file_io_start(zio_t *zio) zio->io_error = SET_ERROR(ENOTSUP); } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:16:48 2014 (r269407) @@ -749,7 +749,7 @@ vdev_geom_io_intr(struct bio *bp) vd = zio->io_vd; zio->io_error = bp->bio_error; if (zio->io_error == 0 && bp->bio_resid != 0) - zio->io_error = EIO; + zio->io_error = SET_ERROR(EIO); switch(zio->io_error) { case ENOTSUP: @@ -803,37 +803,38 @@ vdev_geom_io_start(zio_t *zio) /* XXPOLICY */ if (!vdev_readable(vd)) { zio->io_error = SET_ERROR(ENXIO); - return (ZIO_PIPELINE_CONTINUE); - } - - switch (zio->io_cmd) { - case DKIOCFLUSHWRITECACHE: - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) - break; - if (vd->vdev_nowritecache) { + } else { + switch (zio->io_cmd) { + case DKIOCFLUSHWRITECACHE: + if (zfs_nocacheflush || vdev_geom_bio_flush_disable) + break; + if (vd->vdev_nowritecache) { + zio->io_error = SET_ERROR(ENOTSUP); + break; + } + goto sendreq; + default: zio->io_error = SET_ERROR(ENOTSUP); - break; } - goto sendreq; - default: - zio->io_error = SET_ERROR(ENOTSUP); } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); case ZIO_TYPE_FREE: - if (vdev_geom_bio_delete_disable) - return (ZIO_PIPELINE_CONTINUE); - if (vd->vdev_notrim) { zio->io_error = SET_ERROR(ENOTSUP); - return (ZIO_PIPELINE_CONTINUE); + } else if (!vdev_geom_bio_delete_disable) { + goto sendreq; } + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } sendreq: cp = vd->vdev_tsd; if (cp == NULL) { zio->io_error = SET_ERROR(ENXIO); - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } bp = g_alloc_bio(); bp->bio_caller1 = zio; @@ -852,14 +853,11 @@ sendreq: bp->bio_length = zio->io_size; break; case ZIO_TYPE_IOCTL: - if (zio->io_cmd == DKIOCFLUSHWRITECACHE) { - bp->bio_cmd = BIO_FLUSH; - bp->bio_flags |= BIO_ORDERED; - bp->bio_data = NULL; - bp->bio_offset = cp->provider->mediasize; - bp->bio_length = 0; - break; - } + bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; + bp->bio_data = NULL; + bp->bio_offset = cp->provider->mediasize; + bp->bio_length = 0; break; } bp->bio_done = vdev_geom_io_intr; 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 Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Fri Aug 1 23:16:48 2014 (r269407) @@ -450,7 +450,8 @@ vdev_mirror_io_start(zio_t *zio) zio->io_type, zio->io_priority, 0, vdev_mirror_scrub_done, mc)); } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } /* * For normal reads just pick one child. @@ -477,7 +478,8 @@ vdev_mirror_io_start(zio_t *zio) c++; } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } static int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:16:48 2014 (r269407) @@ -71,7 +71,8 @@ static int vdev_missing_io_start(zio_t *zio) { zio->io_error = SET_ERROR(ENOTSUP); - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } /* ARGSUSED */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:16:48 2014 (r269407) @@ -796,25 +796,14 @@ vdev_queue_io_done(zio_t *zio) vq->vq_io_complete_ts = gethrtime(); - if (zio->io_flags & ZIO_FLAG_QUEUE_IO_DONE) { - /* - * Executing from a previous vdev_queue_io_done so - * to avoid recursion we just unlock and return. - */ - mutex_exit(&vq->vq_lock); - return; - } - while ((nio = vdev_queue_io_to_issue(vq)) != NULL) { mutex_exit(&vq->vq_lock); - nio->io_flags |= ZIO_FLAG_QUEUE_IO_DONE; if (nio->io_done == vdev_queue_agg_io_done) { zio_nowait(nio); } else { zio_vdev_io_reissue(nio); zio_execute(nio); } - nio->io_flags &= ~ZIO_FLAG_QUEUE_IO_DONE; mutex_enter(&vq->vq_lock); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:16:48 2014 (r269407) @@ -1755,7 +1755,9 @@ vdev_raidz_io_start(zio_t *zio) zio->io_type, zio->io_priority, 0, vdev_raidz_child_done, rc)); } - return (ZIO_PIPELINE_CONTINUE); + + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } if (zio->io_type == ZIO_TYPE_WRITE) { @@ -1787,7 +1789,8 @@ vdev_raidz_io_start(zio_t *zio) ZIO_FLAG_NODATA | ZIO_FLAG_OPTIONAL, NULL, NULL)); } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } ASSERT(zio->io_type == ZIO_TYPE_READ); @@ -1827,7 +1830,8 @@ vdev_raidz_io_start(zio_t *zio) } } - return (ZIO_PIPELINE_CONTINUE); + zio_interrupt(zio); + return (ZIO_PIPELINE_STOP); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:06:38 2014 (r269406) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:16:48 2014 (r269407) @@ -1038,9 +1038,8 @@ zio_shrink(zio_t *zio, uint64_t size) */ static int -zio_read_bp_init(zio_t **ziop) +zio_read_bp_init(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF && @@ -1073,9 +1072,8 @@ zio_read_bp_init(zio_t **ziop) } static int -zio_write_bp_init(zio_t **ziop) +zio_write_bp_init(zio_t *zio) { - zio_t *zio = *ziop; spa_t *spa = zio->io_spa; zio_prop_t *zp = &zio->io_prop; enum zio_compress compress = zp->zp_compress; @@ -1255,9 +1253,8 @@ zio_write_bp_init(zio_t **ziop) } static int -zio_free_bp_init(zio_t **ziop) +zio_free_bp_init(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; if (zio->io_child_type == ZIO_CHILD_LOGICAL) { @@ -1340,10 +1337,8 @@ zio_taskq_member(zio_t *zio, zio_taskq_t } static int -zio_issue_async(zio_t **ziop) +zio_issue_async(zio_t *zio) { - zio_t *zio = *ziop; - zio_taskq_dispatch(zio, ZIO_TASKQ_ISSUE, B_FALSE); return (ZIO_PIPELINE_STOP); @@ -1411,7 +1406,7 @@ zio_execute(zio_t *zio) } zio->io_stage = stage; - rv = zio_pipeline[highbit64(stage) - 1](&zio); + rv = zio_pipeline[highbit64(stage) - 1](zio); if (rv == ZIO_PIPELINE_STOP) return; @@ -1845,9 +1840,8 @@ zio_gang_tree_issue(zio_t *pio, zio_gang } static int -zio_gang_assemble(zio_t **ziop) +zio_gang_assemble(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == NULL); @@ -1861,9 +1855,8 @@ zio_gang_assemble(zio_t **ziop) } static int -zio_gang_issue(zio_t **ziop) +zio_gang_issue(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE)) @@ -1997,9 +1990,8 @@ zio_write_gang_block(zio_t *pio) * writes) and as a result is mutually exclusive with dedup. */ static int -zio_nop_write(zio_t **ziop) +zio_nop_write(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; blkptr_t *bp_orig = &zio->io_bp_orig; zio_prop_t *zp = &zio->io_prop; @@ -2070,9 +2062,8 @@ zio_ddt_child_read_done(zio_t *zio) } static int -zio_ddt_read_start(zio_t **ziop) +zio_ddt_read_start(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; ASSERT(BP_GET_DEDUP(bp)); @@ -2114,9 +2105,8 @@ zio_ddt_read_start(zio_t **ziop) } static int -zio_ddt_read_done(zio_t **ziop) +zio_ddt_read_done(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; if (zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE)) @@ -2284,9 +2274,8 @@ zio_ddt_ditto_write_done(zio_t *zio) } static int -zio_ddt_write(zio_t **ziop) +zio_ddt_write(zio_t *zio) { - zio_t *zio = *ziop; spa_t *spa = zio->io_spa; blkptr_t *bp = zio->io_bp; uint64_t txg = zio->io_txg; @@ -2397,9 +2386,8 @@ zio_ddt_write(zio_t **ziop) ddt_entry_t *freedde; /* for debugging */ static int -zio_ddt_free(zio_t **ziop) +zio_ddt_free(zio_t *zio) { - zio_t *zio = *ziop; spa_t *spa = zio->io_spa; blkptr_t *bp = zio->io_bp; ddt_t *ddt = ddt_select(spa, bp); @@ -2424,9 +2412,8 @@ zio_ddt_free(zio_t **ziop) * ========================================================================== */ static int -zio_dva_allocate(zio_t **ziop) +zio_dva_allocate(zio_t *zio) { - zio_t *zio = *ziop; spa_t *spa = zio->io_spa; metaslab_class_t *mc = spa_normal_class(spa); blkptr_t *bp = zio->io_bp; @@ -2468,19 +2455,16 @@ zio_dva_allocate(zio_t **ziop) } static int -zio_dva_free(zio_t **ziop) +zio_dva_free(zio_t *zio) { - zio_t *zio = *ziop; - metaslab_free(zio->io_spa, zio->io_bp, zio->io_txg, B_FALSE); return (ZIO_PIPELINE_CONTINUE); } static int -zio_dva_claim(zio_t **ziop) +zio_dva_claim(zio_t *zio) { - zio_t *zio = *ziop; int error; error = metaslab_claim(zio->io_spa, zio->io_bp, zio->io_txg); @@ -2574,12 +2558,12 @@ zio_free_zil(spa_t *spa, uint64_t txg, b * ========================================================================== */ static int -zio_vdev_io_start(zio_t **ziop) +zio_vdev_io_start(zio_t *zio) { - zio_t *zio = *ziop; vdev_t *vd = zio->io_vd; uint64_t align; spa_t *spa = zio->io_spa; + int ret; ASSERT(zio->io_error == 0); ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0); @@ -2690,7 +2674,6 @@ zio_vdev_io_start(zio_t **ziop) case ZIO_TYPE_FREE: if ((zio = vdev_queue_io(zio)) == NULL) return (ZIO_PIPELINE_STOP); - *ziop = zio; if (!vdev_accessible(vd, zio)) { zio->io_error = SET_ERROR(ENXIO); @@ -2710,13 +2693,15 @@ zio_vdev_io_start(zio_t **ziop) return (ZIO_PIPELINE_STOP); } - return (vd->vdev_ops->vdev_op_io_start(zio)); + ret = vd->vdev_ops->vdev_op_io_start(zio); + ASSERT(ret == ZIO_PIPELINE_STOP); + + return (ret); } static int -zio_vdev_io_done(zio_t **ziop) +zio_vdev_io_done(zio_t *zio) { - zio_t *zio = *ziop; vdev_t *vd = zio->io_vd; vdev_ops_t *ops = vd ? vd->vdev_ops : &vdev_mirror_ops; boolean_t unexpected_error = B_FALSE; @@ -2794,9 +2779,8 @@ zio_vsd_default_cksum_report(zio_t *zio, } static int -zio_vdev_io_assess(zio_t **ziop) +zio_vdev_io_assess(zio_t *zio) { - zio_t *zio = *ziop; vdev_t *vd = zio->io_vd; if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE)) @@ -2911,9 +2895,8 @@ zio_vdev_io_bypass(zio_t *zio) * ========================================================================== */ static int -zio_checksum_generate(zio_t **ziop) +zio_checksum_generate(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; enum zio_checksum checksum; @@ -2943,9 +2926,8 @@ zio_checksum_generate(zio_t **ziop) } static int -zio_checksum_verify(zio_t **ziop) +zio_checksum_verify(zio_t *zio) { - zio_t *zio = *ziop; zio_bad_cksum_t info; blkptr_t *bp = zio->io_bp; int error; @@ -3016,9 +2998,8 @@ zio_worst_error(int e1, int e2) * ========================================================================== */ static int -zio_ready(zio_t **ziop) +zio_ready(zio_t *zio) { - zio_t *zio = *ziop; blkptr_t *bp = zio->io_bp; zio_t *pio, *pio_next; @@ -3075,9 +3056,8 @@ zio_ready(zio_t **ziop) } static int -zio_done(zio_t **ziop) +zio_done(zio_t *zio) { - zio_t *zio = *ziop; spa_t *spa = zio->io_spa; zio_t *lio = zio->io_logical; blkptr_t *bp = zio->io_bp; From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 23:28:22 2014 Return-Path: Delivered-To: svn-src-all@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 3CF288DA; Fri, 1 Aug 2014 23:28: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B18726E9; Fri, 1 Aug 2014 23:28:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71NSMda075900; Fri, 1 Aug 2014 23:28:22 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71NSM2A075899; Fri, 1 Aug 2014 23:28:22 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201408012328.s71NSM2A075899@svn.freebsd.org> From: Rui Paulo Date: Fri, 1 Aug 2014 23:28:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269408 - head/usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 23:28:22 -0000 Author: rpaulo Date: Fri Aug 1 23:28:21 2014 New Revision: 269408 URL: http://svnweb.freebsd.org/changeset/base/269408 Log: Add kdump support for shm_open(). MFC after: 1 week Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Fri Aug 1 23:16:48 2014 (r269407) +++ head/usr.bin/kdump/kdump.c Fri Aug 1 23:28:21 2014 (r269408) @@ -1089,6 +1089,14 @@ ktrsyscall(struct ktr_syscall *ktr, u_in ip++; narg--; break; + case SYS_shm_open: + print_number(ip, narg, c); + putchar(','); + flagsname(ip[0]); + printf(",0%o", ip[1]); + ip += 3; + narg -= 3; + break; case SYS_minherit: print_number(ip, narg, c); print_number(ip, narg, c); From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 23:29:05 2014 Return-Path: Delivered-To: svn-src-all@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 30FE6AAE; Fri, 1 Aug 2014 23:29: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8E226FF; Fri, 1 Aug 2014 23:29:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71NT49N076042; Fri, 1 Aug 2014 23:29:04 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71NT4uJ076041; Fri, 1 Aug 2014 23:29:04 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201408012329.s71NT4uJ076041@svn.freebsd.org> From: Rui Paulo Date: Fri, 1 Aug 2014 23:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269409 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 23:29:05 -0000 Author: rpaulo Date: Fri Aug 1 23:29:04 2014 New Revision: 269409 URL: http://svnweb.freebsd.org/changeset/base/269409 Log: In the shm_open() and shm_unlink() syscalls, export the path to KTR. MFC after: 1 week Modified: head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Fri Aug 1 23:28:21 2014 (r269408) +++ head/sys/kern/uipc_shm.c Fri Aug 1 23:29:04 2014 (r269409) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" +#include "opt_ktrace.h" #include #include @@ -53,6 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include #include @@ -727,7 +731,10 @@ sys_shm_open(struct thread *td, struct s } else { path = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); error = copyinstr(uap->path, path, MAXPATHLEN, NULL); - +#ifdef KTRACE + if (error == 0 && KTRPOINT(curthread, KTR_NAMEI)) + ktrnamei(path); +#endif /* Require paths to start with a '/' character. */ if (error == 0 && path[0] != '/') error = EINVAL; @@ -825,7 +832,10 @@ sys_shm_unlink(struct thread *td, struct free(path, M_TEMP); return (error); } - +#ifdef KTRACE + if (KTRPOINT(curthread, KTR_NAMEI)) + ktrnamei(path); +#endif fnv = fnv_32_str(path, FNV1_32_INIT); sx_xlock(&shm_dict_lock); error = shm_remove(path, fnv, td->td_ucred); From owner-svn-src-all@FreeBSD.ORG Fri Aug 1 23:45:51 2014 Return-Path: Delivered-To: svn-src-all@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 1CFA9BB; Fri, 1 Aug 2014 23:45:51 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ACE028C6; Fri, 1 Aug 2014 23:45:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s71Njosk085516; Fri, 1 Aug 2014 23:45:50 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s71Njo36085515; Fri, 1 Aug 2014 23:45:50 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408012345.s71Njo36085515@svn.freebsd.org> From: Ian Lepore Date: Fri, 1 Aug 2014 23:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269410 - head/sys/cddl/compat/opensolaris/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2014 23:45:51 -0000 Author: ian Date: Fri Aug 1 23:45:50 2014 New Revision: 269410 URL: http://svnweb.freebsd.org/changeset/base/269410 Log: Use the 64-bit atomics now provided by arm machine/atomic.h instead of (conflicting) local versions. Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Fri Aug 1 23:29:04 2014 (r269409) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Fri Aug 1 23:45:50 2014 (r269410) @@ -36,7 +36,7 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 -#if !defined(__LP64__) && !defined(__mips_n32) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(__arm__) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -85,7 +85,7 @@ atomic_dec_32_nv(volatile uint32_t *targ return (atomic_fetchadd_32(target, -1) - 1); } -#if defined(__LP64__) || defined(__mips_n32) +#if defined(__LP64__) || defined(__mips_n32) || defined(__arm__) static __inline void atomic_dec_64(volatile uint64_t *target) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 00:56:35 2014 Return-Path: Delivered-To: svn-src-all@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 23D4E1A8; Sat, 2 Aug 2014 00:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 109752086; Sat, 2 Aug 2014 00:56:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s720uZB4018868; Sat, 2 Aug 2014 00:56:35 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s720uYWv018865; Sat, 2 Aug 2014 00:56:34 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408020056.s720uYWv018865@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 2 Aug 2014 00:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269411 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 00:56:35 -0000 Author: np Date: Sat Aug 2 00:56:34 2014 New Revision: 269411 URL: http://svnweb.freebsd.org/changeset/base/269411 Log: cxgbe(4): minor optimizations in ingress queue processing. Reorganize struct sge_iq. Make the iq entry size a compile time constant. While here, eliminate RX_FL_ESIZE and use EQ_ESIZE directly. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Aug 1 23:45:50 2014 (r269410) +++ head/sys/dev/cxgbe/adapter.h Sat Aug 2 00:56:34 2014 (r269411) @@ -125,16 +125,24 @@ struct adapter; typedef struct adapter adapter_t; enum { - FW_IQ_QSIZE = 256, - FW_IQ_ESIZE = 64, /* At least 64 mandated by the firmware spec */ + /* + * All ingress queues use this entry size. Note that the firmware event + * queue and any iq expecting CPL_RX_PKT in the descriptor needs this to + * be at least 64. + */ + IQ_ESIZE = 64, + /* Default queue sizes for all kinds of ingress queues */ + FW_IQ_QSIZE = 256, RX_IQ_QSIZE = 1024, - RX_IQ_ESIZE = 64, /* At least 64 so CPL_RX_PKT will fit */ - EQ_ESIZE = 64, /* All egress queues use this entry size */ - SGE_MAX_WR_NDESC = SGE_MAX_WR_LEN / EQ_ESIZE, /* max WR size in desc */ + /* All egress queues use this entry size */ + EQ_ESIZE = 64, + + /* Default queue sizes for all kinds of egress queues */ + CTRL_EQ_QSIZE = 128, + TX_EQ_QSIZE = 1024, - RX_FL_ESIZE = EQ_ESIZE, /* 8 64bit addresses */ #if MJUMPAGESIZE != MCLBYTES SW_ZONE_SIZES = 4, /* cluster, jumbop, jumbo9k, jumbo16k */ #else @@ -142,9 +150,7 @@ enum { #endif CL_METADATA_SIZE = CACHE_LINE_SIZE, - CTRL_EQ_QSIZE = 128, - - TX_EQ_QSIZE = 1024, + SGE_MAX_WR_NDESC = SGE_MAX_WR_LEN / EQ_ESIZE, /* max WR size in desc */ TX_SGL_SEGS = 36, TX_WR_FLITS = SGE_MAX_WR_LEN / 8 }; @@ -317,6 +323,16 @@ struct tx_sdesc { uint8_t credits; /* NIC txq: # of frames sent out in the WR */ }; + +#define IQ_PAD (IQ_ESIZE - sizeof(struct rsp_ctrl) - sizeof(struct rss_header)) +struct iq_desc { + struct rss_header rss; + uint8_t cpl[IQ_PAD]; + struct rsp_ctrl rsp; +}; +#undef IQ_PAD +CTASSERT(sizeof(struct iq_desc) == IQ_ESIZE); + enum { /* iq flags */ IQ_ALLOCATED = (1 << 0), /* firmware resources allocated */ @@ -334,27 +350,25 @@ enum { * Ingress Queue: T4 is producer, driver is consumer. */ struct sge_iq { - bus_dma_tag_t desc_tag; - bus_dmamap_t desc_map; - bus_addr_t ba; /* bus address of descriptor ring */ uint32_t flags; - uint16_t abs_id; /* absolute SGE id for the iq */ - int8_t intr_pktc_idx; /* packet count threshold index */ - int8_t pad0; - __be64 *desc; /* KVA of descriptor ring */ - volatile int state; struct adapter *adapter; - const __be64 *cdesc; /* current descriptor */ + struct iq_desc *desc; /* KVA of descriptor ring */ + int8_t intr_pktc_idx; /* packet count threshold index */ uint8_t gen; /* generation bit */ uint8_t intr_params; /* interrupt holdoff parameters */ uint8_t intr_next; /* XXX: holdoff for next interrupt */ - uint8_t esize; /* size (bytes) of each entry in the queue */ uint16_t qsize; /* size (# of entries) of the queue */ + uint16_t sidx; /* index of the entry with the status page */ uint16_t cidx; /* consumer index */ uint16_t cntxt_id; /* SGE context id for the iq */ + uint16_t abs_id; /* absolute SGE id for the iq */ STAILQ_ENTRY(sge_iq) link; + + bus_dma_tag_t desc_tag; + bus_dmamap_t desc_map; + bus_addr_t ba; /* bus address of descriptor ring */ }; enum { @@ -570,23 +584,10 @@ struct sge_wrq { #ifdef DEV_NETMAP -#define CPL_PAD (RX_IQ_ESIZE - sizeof(struct rsp_ctrl) - \ - sizeof(struct rss_header)) -struct nm_iq_desc { - struct rss_header rss; - union { - uint8_t cpl[CPL_PAD]; - struct cpl_fw6_msg fw6_msg; - struct cpl_rx_pkt rx_pkt; - } u; - struct rsp_ctrl rsp; -}; -CTASSERT(sizeof(struct nm_iq_desc) == RX_IQ_ESIZE); - struct sge_nm_rxq { struct port_info *pi; - struct nm_iq_desc *iq_desc; + struct iq_desc *iq_desc; uint16_t iq_abs_id; uint16_t iq_cntxt_id; uint16_t iq_cidx; @@ -847,6 +848,12 @@ struct adapter { for (q = &pi->adapter->sge.nm_rxq[pi->first_nm_rxq], iter = 0; \ iter < pi->nnmrxq; ++iter, ++q) +#define IDXINCR(head, incr, wrap) do { \ + head = wrap - head > incr ? head + incr : incr - (wrap - head); \ +} while (0) +#define IDXDIFF(head, tail, wrap) \ + (head >= tail ? head - tail : wrap - tail + head) + /* One for errors, one for firmware events */ #define T4_EXTRA_INTR 2 Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Fri Aug 1 23:45:50 2014 (r269410) +++ head/sys/dev/cxgbe/t4_netmap.c Sat Aug 2 00:56:34 2014 (r269411) @@ -238,8 +238,8 @@ alloc_nm_rxq_hwq(struct port_info *pi, s MPASS(nm_rxq->iq_desc != NULL); MPASS(nm_rxq->fl_desc != NULL); - bzero(nm_rxq->iq_desc, pi->qsize_rxq * RX_IQ_ESIZE); - bzero(nm_rxq->fl_desc, na->num_rx_desc * RX_FL_ESIZE + spg_len); + bzero(nm_rxq->iq_desc, pi->qsize_rxq * IQ_ESIZE); + bzero(nm_rxq->fl_desc, na->num_rx_desc * EQ_ESIZE + spg_len); bzero(&c, sizeof(c)); c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_IQ_CMD) | F_FW_CMD_REQUEST | @@ -264,7 +264,7 @@ alloc_nm_rxq_hwq(struct port_info *pi, s c.iqdroprss_to_iqesize = htobe16(V_FW_IQ_CMD_IQPCIECH(pi->tx_chan) | F_FW_IQ_CMD_IQGTSMODE | V_FW_IQ_CMD_IQINTCNTTHRESH(0) | - V_FW_IQ_CMD_IQESIZE(ilog2(RX_IQ_ESIZE) - 4)); + V_FW_IQ_CMD_IQESIZE(ilog2(IQ_ESIZE) - 4)); c.iqsize = htobe16(pi->qsize_rxq); c.iqaddr = htobe64(nm_rxq->iq_ba); c.iqns_to_fl0congen |= @@ -274,7 +274,7 @@ alloc_nm_rxq_hwq(struct port_info *pi, s c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) | V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B)); - c.fl0size = htobe16(na->num_rx_desc + spg_len / RX_FL_ESIZE); + c.fl0size = htobe16(na->num_rx_desc + spg_len / EQ_ESIZE); c.fl0addr = htobe64(nm_rxq->fl_ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); @@ -285,7 +285,7 @@ alloc_nm_rxq_hwq(struct port_info *pi, s } nm_rxq->iq_cidx = 0; - MPASS(nm_rxq->iq_sidx == pi->qsize_rxq - spg_len / RX_IQ_ESIZE); + MPASS(nm_rxq->iq_sidx == pi->qsize_rxq - spg_len / IQ_ESIZE); nm_rxq->iq_gen = F_RSPD_GEN; nm_rxq->iq_cntxt_id = be16toh(c.iqid); nm_rxq->iq_abs_id = be16toh(c.physiqid); @@ -581,18 +581,7 @@ npkt_to_len16(const int n) return (n * 2 + 1); } -static inline uint16_t -idxdiff(uint16_t head, uint16_t tail, uint16_t wrap) -{ - MPASS(wrap > head); - MPASS(wrap > tail); - - if (head >= tail) - return (head - tail); - else - return (wrap - tail + head); -} -#define IDXDIFF(q, idx) idxdiff((q)->pidx, (q)->idx, (q)->sidx) +#define NMIDXDIFF(q, idx) IDXDIFF((q)->pidx, (q)->idx, (q)->sidx) static void ring_nm_txq_db(struct adapter *sc, struct sge_nm_txq *nm_txq) @@ -602,7 +591,7 @@ ring_nm_txq_db(struct adapter *sc, struc MPASS(nm_txq->pidx != nm_txq->dbidx); - n = IDXDIFF(nm_txq, dbidx); + n = NMIDXDIFF(nm_txq, dbidx); if (n > 1) clrbit(&db, DOORBELL_WCWR); wmb(); @@ -733,16 +722,16 @@ cxgbe_nm_tx(struct adapter *sc, struct s return; } - if (IDXDIFF(nm_txq, equiqidx) >= nm_txq->sidx / 2) { + if (NMIDXDIFF(nm_txq, equiqidx) >= nm_txq->sidx / 2) { wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ | F_FW_WR_EQUIQ); nm_txq->equeqidx = nm_txq->pidx; nm_txq->equiqidx = nm_txq->pidx; - } else if (IDXDIFF(nm_txq, equeqidx) >= 64) { + } else if (NMIDXDIFF(nm_txq, equeqidx) >= 64) { wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ); nm_txq->equeqidx = nm_txq->pidx; } - if (IDXDIFF(nm_txq, dbidx) >= 2 * SGE_MAX_WR_NDESC) + if (NMIDXDIFF(nm_txq, dbidx) >= 2 * SGE_MAX_WR_NDESC) ring_nm_txq_db(sc, nm_txq); } @@ -782,8 +771,15 @@ reclaim_nm_tx_desc(struct sge_nm_txq *nm n += wr->npkt; nm_txq->cidx += npkt_to_ndesc(wr->npkt); - if (__predict_false(nm_txq->cidx >= nm_txq->sidx)) - nm_txq->cidx -= nm_txq->sidx; + + /* + * We never sent a WR that wrapped around so the credits coming + * back, WR by WR, should never cause the cidx to wrap around + * either. + */ + MPASS(nm_txq->cidx <= nm_txq->sidx); + if (__predict_false(nm_txq->cidx == nm_txq->sidx)) + nm_txq->cidx = 0; } return (n); @@ -890,13 +886,8 @@ cxgbe_netmap_rxsync(struct netmap_adapte MPASS((fl_pidx & 7) == 0); MPASS((n & 7) == 0); - kring->nr_hwcur += n; - if (kring->nr_hwcur >= kring->nkr_num_slots) - kring->nr_hwcur -= kring->nkr_num_slots; - - nm_rxq->fl_pidx += n; - if (nm_rxq->fl_pidx >= nm_rxq->fl_sidx) - nm_rxq->fl_pidx -= nm_rxq->fl_sidx; + IDXINCR(kring->nr_hwcur, n, kring->nkr_num_slots); + IDXINCR(nm_rxq->fl_pidx, n, nm_rxq->fl_sidx); while (n > 0) { for (i = 0; i < 8; i++, fl_pidx++, slot++) { @@ -1073,7 +1064,7 @@ t4_nm_intr(void *arg) struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[nm_rxq->nid]; struct netmap_ring *ring = kring->ring; - struct nm_iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx]; + struct iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx]; uint32_t lq; u_int n = 0; int processed = 0; @@ -1100,7 +1091,8 @@ t4_nm_intr(void *arg) switch (opcode) { case CPL_FW4_MSG: case CPL_FW6_MSG: - handle_nm_fw6_msg(sc, ifp, &d->u.fw6_msg); + handle_nm_fw6_msg(sc, ifp, + (const void *)&d->cpl[0]); break; case CPL_RX_PKT: ring->slot[fl_cidx].len = G_RSPD_LEN(lq) - fl_pktshift; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Aug 1 23:45:50 2014 (r269410) +++ head/sys/dev/cxgbe/t4_sge.c Sat Aug 2 00:56:34 2014 (r269411) @@ -175,8 +175,7 @@ static int service_iq(struct sge_iq *, i static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t, int *); static int t4_eth_rx(struct sge_iq *, const struct rss_header *, struct mbuf *); -static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int, - int); +static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, int, char *); static inline void init_eq(struct sge_eq *, int, int, uint8_t, uint16_t, @@ -224,8 +223,6 @@ static int alloc_txq(struct port_info *, struct sysctl_oid *); static int free_txq(struct port_info *, struct sge_txq *); static void oneseg_dma_callback(void *, bus_dma_segment_t *, int, int); -static inline bool is_new_response(const struct sge_iq *, struct rsp_ctrl **); -static inline void iq_next(struct sge_iq *); static inline void ring_fl_db(struct adapter *, struct sge_fl *); static int refill_fl(struct adapter *, struct sge_fl *, int); static void refill_sfl(void *); @@ -1005,8 +1002,7 @@ t4_setup_port_queues(struct port_info *p } for_each_rxq(pi, i, rxq) { - init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq, - RX_IQ_ESIZE); + init_iq(&rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, pi->qsize_rxq); snprintf(name, sizeof(name), "%s rxq%d-fl", device_get_nameunit(pi->dev), i); @@ -1030,7 +1026,7 @@ t4_setup_port_queues(struct port_info *p for_each_ofld_rxq(pi, i, ofld_rxq) { init_iq(&ofld_rxq->iq, sc, pi->tmr_idx, pi->pktc_idx, - pi->qsize_rxq, RX_IQ_ESIZE); + pi->qsize_rxq); snprintf(name, sizeof(name), "%s ofld_rxq%d-fl", device_get_nameunit(pi->dev), i); @@ -1319,8 +1315,7 @@ service_iq(struct sge_iq *iq, int budget struct sge_rxq *rxq = iq_to_rxq(iq); /* Use iff iq is part of rxq */ struct sge_fl *fl = &rxq->fl; /* Use iff IQ_HAS_FL */ struct adapter *sc = iq->adapter; - struct rsp_ctrl *ctrl; - const struct rss_header *rss; + struct iq_desc *d = &iq->desc[iq->cidx]; int ndescs = 0, limit, fl_bufs_used = 0; int rsp_type; uint32_t lq; @@ -1339,14 +1334,13 @@ service_iq(struct sge_iq *iq, int budget * interrupts and other responses after running a single handler. */ for (;;) { - while (is_new_response(iq, &ctrl)) { + while ((d->rsp.u.type_gen & F_RSPD_GEN) == iq->gen) { rmb(); m0 = NULL; - rsp_type = G_RSPD_TYPE(ctrl->u.type_gen); - lq = be32toh(ctrl->pldbuflen_qid); - rss = (const void *)iq->cdesc; + rsp_type = G_RSPD_TYPE(d->rsp.u.type_gen); + lq = be32toh(d->rsp.pldbuflen_qid); switch (rsp_type) { case X_RSPD_TYPE_FLBUF: @@ -1376,10 +1370,10 @@ service_iq(struct sge_iq *iq, int budget /* fall through */ case X_RSPD_TYPE_CPL: - KASSERT(rss->opcode < NUM_CPL_CMDS, + KASSERT(d->rss.opcode < NUM_CPL_CMDS, ("%s: bad opcode %02x.", __func__, - rss->opcode)); - sc->cpl_handler[rss->opcode](iq, rss, m0); + d->rss.opcode)); + sc->cpl_handler[d->rss.opcode](iq, &d->rss, m0); break; case X_RSPD_TYPE_INTR: @@ -1401,7 +1395,7 @@ service_iq(struct sge_iq *iq, int budget * iWARP async notification. */ if (lq >= 1024) { - sc->an_handler(iq, ctrl); + sc->an_handler(iq, &d->rsp); break; } @@ -1436,8 +1430,13 @@ service_iq(struct sge_iq *iq, int budget fl_bufs_used = 0; } - iq_next(iq); - if (++ndescs == limit) { + d++; + if (__predict_false(++iq->cidx == iq->sidx)) { + iq->cidx = 0; + iq->gen ^= F_RSPD_GEN; + d = &iq->desc[0]; + } + if (__predict_false(++ndescs == limit)) { t4_write_reg(sc, MYPF_REG(A_SGE_PF_GTS), V_CIDXINC(ndescs) | V_INGRESSQID(iq->cntxt_id) | @@ -2101,8 +2100,9 @@ can_resume_tx(struct sge_eq *eq) static inline void init_iq(struct sge_iq *iq, struct adapter *sc, int tmr_idx, int pktc_idx, - int qsize, int esize) + int qsize) { + KASSERT(tmr_idx >= 0 && tmr_idx < SGE_NTIMERS, ("%s: bad tmr_idx %d", __func__, tmr_idx)); KASSERT(pktc_idx < SGE_NCOUNTERS, /* -ve is ok, means don't use */ @@ -2117,7 +2117,7 @@ init_iq(struct sge_iq *iq, struct adapte iq->intr_pktc_idx = pktc_idx; } iq->qsize = roundup2(qsize, 16); /* See FW_IQ_CMD/iqsize */ - iq->esize = max(esize, 16); /* See FW_IQ_CMD/iqesize */ + iq->sidx = iq->qsize - spg_len / IQ_ESIZE; } static inline void @@ -2218,7 +2218,7 @@ alloc_iq_fl(struct port_info *pi, struct struct adapter *sc = iq->adapter; __be32 v = 0; - len = iq->qsize * iq->esize; + len = iq->qsize * IQ_ESIZE; rc = alloc_ring(sc, len, &iq->desc_tag, &iq->desc_map, &iq->ba, (void **)&iq->desc); if (rc != 0) @@ -2250,7 +2250,7 @@ alloc_iq_fl(struct port_info *pi, struct c.iqdroprss_to_iqesize = htobe16(V_FW_IQ_CMD_IQPCIECH(pi->tx_chan) | F_FW_IQ_CMD_IQGTSMODE | V_FW_IQ_CMD_IQINTCNTTHRESH(iq->intr_pktc_idx) | - V_FW_IQ_CMD_IQESIZE(ilog2(iq->esize) - 4)); + V_FW_IQ_CMD_IQESIZE(ilog2(IQ_ESIZE) - 4)); c.iqsize = htobe16(iq->qsize); c.iqaddr = htobe64(iq->ba); if (cong >= 0) @@ -2259,14 +2259,14 @@ alloc_iq_fl(struct port_info *pi, struct if (fl) { mtx_init(&fl->fl_lock, fl->lockname, NULL, MTX_DEF); - len = fl->qsize * RX_FL_ESIZE; + len = fl->qsize * EQ_ESIZE; rc = alloc_ring(sc, len, &fl->desc_tag, &fl->desc_map, &fl->ba, (void **)&fl->desc); if (rc) return (rc); /* Allocate space for one software descriptor per buffer. */ - fl->cap = (fl->qsize - spg_len / RX_FL_ESIZE) * 8; + fl->cap = (fl->qsize - spg_len / EQ_ESIZE) * 8; rc = alloc_fl_sdesc(fl); if (rc != 0) { device_printf(sc->dev, @@ -2305,9 +2305,8 @@ alloc_iq_fl(struct port_info *pi, struct return (rc); } - iq->cdesc = iq->desc; iq->cidx = 0; - iq->gen = 1; + iq->gen = F_RSPD_GEN; iq->intr_next = iq->intr_params; iq->cntxt_id = be16toh(c.iqid); iq->abs_id = be16toh(c.physiqid); @@ -2457,7 +2456,7 @@ alloc_fwq(struct adapter *sc) struct sysctl_oid *oid = device_get_sysctl_tree(sc->dev); struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); - init_iq(fwq, sc, 0, 0, FW_IQ_QSIZE, FW_IQ_ESIZE); + init_iq(fwq, sc, 0, 0, FW_IQ_QSIZE); fwq->flags |= IQ_INTR; /* always */ intr_idx = sc->intr_count > 1 ? 1 : 0; rc = alloc_iq_fl(sc->port[0], fwq, NULL, intr_idx, -1); @@ -2677,13 +2676,13 @@ alloc_nm_rxq(struct port_info *pi, struc MPASS(na != NULL); - len = pi->qsize_rxq * RX_IQ_ESIZE; + len = pi->qsize_rxq * IQ_ESIZE; rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); if (rc != 0) return (rc); - len = na->num_rx_desc * RX_FL_ESIZE + spg_len; + len = na->num_rx_desc * EQ_ESIZE + spg_len; rc = alloc_ring(sc, len, &nm_rxq->fl_desc_tag, &nm_rxq->fl_desc_map, &nm_rxq->fl_ba, (void **)&nm_rxq->fl_desc); if (rc != 0) @@ -2692,7 +2691,7 @@ alloc_nm_rxq(struct port_info *pi, struc nm_rxq->pi = pi; nm_rxq->nid = idx; nm_rxq->iq_cidx = 0; - nm_rxq->iq_sidx = pi->qsize_rxq - spg_len / RX_IQ_ESIZE; + nm_rxq->iq_sidx = pi->qsize_rxq - spg_len / IQ_ESIZE; nm_rxq->iq_gen = F_RSPD_GEN; nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; nm_rxq->fl_sidx = na->num_rx_desc; @@ -3214,26 +3213,6 @@ oneseg_dma_callback(void *arg, bus_dma_s *ba = error ? 0 : segs->ds_addr; } -static inline bool -is_new_response(const struct sge_iq *iq, struct rsp_ctrl **ctrl) -{ - *ctrl = (void *)((uintptr_t)iq->cdesc + - (iq->esize - sizeof(struct rsp_ctrl))); - - return (((*ctrl)->u.type_gen >> S_RSPD_GEN) == iq->gen); -} - -static inline void -iq_next(struct sge_iq *iq) -{ - iq->cdesc = (void *) ((uintptr_t)iq->cdesc + iq->esize); - if (__predict_false(++iq->cidx == iq->qsize - spg_len / iq->esize)) { - iq->cidx = 0; - iq->gen ^= 1; - iq->cdesc = iq->desc; - } -} - #define FL_HW_IDX(x) ((x) >> 3) static inline void ring_fl_db(struct adapter *sc, struct sge_fl *fl) From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 01:28:02 2014 Return-Path: Delivered-To: svn-src-all@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 B7CD28EB; Sat, 2 Aug 2014 01:28: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4FBC23DC; Sat, 2 Aug 2014 01:28:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s721S2gW033279; Sat, 2 Aug 2014 01:28:02 GMT (envelope-from jmmv@svn.freebsd.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s721S2MS033277; Sat, 2 Aug 2014 01:28:02 GMT (envelope-from jmmv@svn.freebsd.org) Message-Id: <201408020128.s721S2MS033277@svn.freebsd.org> From: Julio Merino Date: Sat, 2 Aug 2014 01:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r269412 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 01:28:02 -0000 Author: jmmv Date: Sat Aug 2 01:28:01 2014 New Revision: 269412 URL: http://svnweb.freebsd.org/changeset/base/269412 Log: Add Garrett Cooper (ngie@) as a src committer. Garrett will use his shiny new commit superpowers to continue working on the FreeBSD Test Suite (and probably/hopefully other things). Mentored by me and comentored by rpaulo@. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Sat Aug 2 00:56:34 2014 (r269411) +++ svnadmin/conf/access Sat Aug 2 01:28:01 2014 (r269412) @@ -159,6 +159,7 @@ mr n_hibma devnull neel netchild +ngie np nwhitehorn nyan Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Sat Aug 2 00:56:34 2014 (r269411) +++ svnadmin/conf/mentors Sat Aug 2 01:28:01 2014 (r269412) @@ -27,6 +27,7 @@ kadesai ken Co-mentor: scottl, ambrisk mahrens mckusick miwi rwatson monthadar adrian +ngie jmmv Co-mentor: rpaulo odeds jhb Co-mentor: alfred peterj jhb Co-mentor: grog pkelsey jmallett From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 01:48:26 2014 Return-Path: Delivered-To: svn-src-all@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 B4D49BC0; Sat, 2 Aug 2014 01:48: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A19DE2561; Sat, 2 Aug 2014 01:48:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s721mQYC042174; Sat, 2 Aug 2014 01:48:26 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s721mQb0042172; Sat, 2 Aug 2014 01:48:26 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408020148.s721mQb0042172@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 2 Aug 2014 01:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269413 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 01:48:26 -0000 Author: np Date: Sat Aug 2 01:48:25 2014 New Revision: 269413 URL: http://svnweb.freebsd.org/changeset/base/269413 Log: cxgbe(4): Fix an off by one error when looking for the BAR2 doorbell address of an egress queue. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Sat Aug 2 01:28:01 2014 (r269412) +++ head/sys/dev/cxgbe/t4_netmap.c Sat Aug 2 01:48:25 2014 (r269413) @@ -390,7 +390,7 @@ alloc_nm_txq_hwq(struct port_info *pi, s udb = sc->udbs_base + UDBS_DB_OFFSET; udb += (nm_txq->cntxt_id >> s_qpp) << PAGE_SHIFT; nm_txq->udb_qid = nm_txq->cntxt_id & mask; - if (nm_txq->udb_qid > PAGE_SIZE / UDBS_SEG_SIZE) + if (nm_txq->udb_qid >= PAGE_SIZE / UDBS_SEG_SIZE) clrbit(&nm_txq->doorbells, DOORBELL_WCWR); else { udb += nm_txq->udb_qid << UDBS_SEG_SHIFT; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Aug 2 01:28:01 2014 (r269412) +++ head/sys/dev/cxgbe/t4_sge.c Sat Aug 2 01:48:25 2014 (r269413) @@ -2985,7 +2985,7 @@ alloc_eq(struct adapter *sc, struct port udb = sc->udbs_base + UDBS_DB_OFFSET; udb += (eq->cntxt_id >> s_qpp) << PAGE_SHIFT; /* pg offset */ eq->udb_qid = eq->cntxt_id & mask; /* id in page */ - if (eq->udb_qid > PAGE_SIZE / UDBS_SEG_SIZE) + if (eq->udb_qid >= PAGE_SIZE / UDBS_SEG_SIZE) clrbit(&eq->doorbells, DOORBELL_WCWR); else { udb += eq->udb_qid << UDBS_SEG_SHIFT; /* seg offset */ From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 03:44:28 2014 Return-Path: Delivered-To: svn-src-all@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 C496BCED; Sat, 2 Aug 2014 03: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97C9D2150; Sat, 2 Aug 2014 03:44:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s723iSSf096651; Sat, 2 Aug 2014 03:44:28 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s723iSVM096645; Sat, 2 Aug 2014 03:44:28 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201408020344.s723iSVM096645@svn.freebsd.org> From: Ian Lepore Date: Sat, 2 Aug 2014 03:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269414 - in head/sys: arm/include cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 03:44:28 -0000 Author: ian Date: Sat Aug 2 03:44:27 2014 New Revision: 269414 URL: http://svnweb.freebsd.org/changeset/base/269414 Log: When arm 64-bit atomic ops are available, define ARM_HAVE_ATOMIC64. Use that symbol (which will be correct in both kernel and userland contexts) rather than just __arm__ to decide whether to use a local implementation. Modified: head/sys/arm/include/atomic.h head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/sys/atomic.h Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Sat Aug 2 01:48:25 2014 (r269413) +++ head/sys/arm/include/atomic.h Sat Aug 2 03:44:27 2014 (r269414) @@ -88,6 +88,8 @@ defined (__ARM_ARCH_6T2__) || \ defined (__ARM_ARCH_6Z__) || \ defined (__ARM_ARCH_6ZK__) +#define ARM_HAVE_ATOMIC64 + static __inline void __do_dmb(void) { @@ -722,6 +724,8 @@ __swp(uint32_t val, volatile uint32_t *p #ifdef _KERNEL +#define ARM_HAVE_ATOMIC64 + static __inline void atomic_set_32(volatile uint32_t *address, uint32_t setmask) { Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Sat Aug 2 01:48:25 2014 (r269413) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Sat Aug 2 03:44:27 2014 (r269414) @@ -52,7 +52,7 @@ atomic_init(void) } #endif -#if !defined(__LP64__) && !defined(__mips_n32) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) void atomic_add_64(volatile uint64_t *target, int64_t delta) { Modified: head/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/atomic.h Sat Aug 2 01:48:25 2014 (r269413) +++ head/sys/cddl/compat/opensolaris/sys/atomic.h Sat Aug 2 03:44:27 2014 (r269414) @@ -36,7 +36,7 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 -#if !defined(__LP64__) && !defined(__mips_n32) && !defined(__arm__) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -85,7 +85,7 @@ atomic_dec_32_nv(volatile uint32_t *targ return (atomic_fetchadd_32(target, -1) - 1); } -#if defined(__LP64__) || defined(__mips_n32) || defined(__arm__) +#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 03:48:17 2014 Return-Path: Delivered-To: svn-src-all@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 B453AEB3; Sat, 2 Aug 2014 03:48:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1B25216D; Sat, 2 Aug 2014 03:48:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s723mHgJ097262; Sat, 2 Aug 2014 03:48:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s723mHWe097260; Sat, 2 Aug 2014 03:48:17 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201408020348.s723mHWe097260@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 2 Aug 2014 03:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269415 - in head/sys: conf sparc64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 03:48:17 -0000 Author: nwhitehorn Date: Sat Aug 2 03:48:16 2014 New Revision: 269415 URL: http://svnweb.freebsd.org/changeset/base/269415 Log: Add vt(4) support to sparc64. The only driver currently present (ofwfb) provides support for a variety of low-end graphics hardware (SBus adapters, Mach64, QEMU's framebuffer, XVR-100). A driver for at least the Creator3D cards will have to be present before this can become the default console driver. To test vt(4) on sparc64, set kern.vty=vt at the loader prompt. Modified: head/sys/conf/files.sparc64 head/sys/sparc64/conf/GENERIC Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Sat Aug 2 03:44:27 2014 (r269414) +++ head/sys/conf/files.sparc64 Sat Aug 2 03:48:16 2014 (r269415) @@ -60,6 +60,7 @@ dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_sparc64.c optional uart dev/uart/uart_kbd_sun.c optional uart sc | vt +dev/vt/hw/ofwfb/ofwfb.c optional vt kern/kern_clocksource.c standard kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Sat Aug 2 03:44:27 2014 (r269414) +++ head/sys/sparc64/conf/GENERIC Sat Aug 2 03:48:16 2014 (r269415) @@ -140,6 +140,9 @@ device machfb # ATI Mach64 framebuffer device splash # Splash screen and screen saver support options KBD_INSTALL_CDEV # install a CDEV entry in /dev +# vt is the new video console driver +device vt + # Builtin hardware device auxio # auxiliary I/O device device eeprom # eeprom (really a front-end for the MK48Txx) From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 03:56:08 2014 Return-Path: Delivered-To: svn-src-all@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 D6B64EA; Sat, 2 Aug 2014 03:56: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C10D12215; Sat, 2 Aug 2014 03:56:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s723u80G001579; Sat, 2 Aug 2014 03:56:08 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s723u7ZL001571; Sat, 2 Aug 2014 03:56:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020356.s723u7ZL001571@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 03:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269416 - in stable/10: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 03:56:09 -0000 Author: delphij Date: Sat Aug 2 03:56:06 2014 New Revision: 269416 URL: http://svnweb.freebsd.org/changeset/base/269416 Log: MFC r268855: MFV r268848: Instead of asserting all zio's be properly aligned, only assert on the logical ones. Cap uberblocks at 8k, otherwise with ashift=17, there would be only one uberblock. This fixes a problem that zdb would trip assert on pools with ashift >= 0xe (8k). While there, also change the code so it only attempt to condense space map unless the uncondensed size consumes greater than zfs_metaslab_condense_block_threshold blocks. Illumos issue: 4958 zdb trips assert on pools with ashift >= 0xe Modified: stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Aug 2 03:56:06 2014 (r269416) @@ -810,7 +810,7 @@ static uint64_t ztest_get_ashift(void) { if (ztest_opts.zo_ashift == 0) - return (SPA_MINBLOCKSHIFT + ztest_random(3)); + return (SPA_MINBLOCKSHIFT + ztest_random(5)); return (ztest_opts.zo_ashift); } @@ -969,11 +969,28 @@ ztest_random_spa_version(uint64_t initia return (version); } +/* + * Find the largest ashift used + */ +static uint64_t +ztest_spa_get_ashift() { + uint64_t i; + uint64_t ashift = SPA_MINBLOCKSHIFT; + vdev_t *rvd = ztest_spa->spa_root_vdev; + + for (i = 0; i < rvd->vdev_children; i++) { + ashift = MAX(ashift, rvd->vdev_child[i]->vdev_ashift); + } + return (ashift); +} + static int ztest_random_blocksize(void) { - return (1 << (SPA_MINBLOCKSHIFT + - ztest_random(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1))); + // Choose a block size >= the ashift. + uint64_t block_shift = + ztest_random(SPA_MAXBLOCKSHIFT - ztest_spa_get_ashift() + 1); + return (1 << (SPA_MINBLOCKSHIFT + block_shift)); } static int @@ -5768,16 +5785,30 @@ ztest_freeze(void) spa_freeze(spa); /* + * Because it is hard to predict how much space a write will actually + * require beforehand, we leave ourselves some fudge space to write over + * capacity. + */ + uint64_t capacity = metaslab_class_get_space(spa_normal_class(spa)) / 2; + + /* * Run tests that generate log records but don't alter the pool config * or depend on DSL sync tasks (snapshots, objset create/destroy, etc). * We do a txg_wait_synced() after each iteration to force the txg * to increase well beyond the last synced value in the uberblock. * The ZIL should be OK with that. + * + * Run a random number of times less than zo_maxloops and ensure we do + * not run out of space on the pool. */ while (ztest_random(10) != 0 && - numloops++ < ztest_opts.zo_maxloops) { - ztest_dmu_write_parallel(zd, 0); - ztest_dmu_object_alloc_free(zd, 0); + numloops++ < ztest_opts.zo_maxloops && + metaslab_class_get_alloc(spa_normal_class(spa)) < capacity) { + ztest_od_t od; + ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0); + VERIFY0(ztest_object_init(zd, &od, sizeof (od), B_FALSE)); + ztest_io(zd, od.od_object, + ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT); txg_wait_synced(spa_get_dsl(spa), 0); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sat Aug 2 03:56:06 2014 (r269416) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sat Aug 2 03:56:06 2014 (r269416) @@ -74,6 +74,21 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, condense_ " of in-memory counterpart"); /* + * Condensing a metaslab is not guaranteed to actually reduce the amount of + * space used on disk. In particular, a space map uses data in increments of + * MAX(1 << ashift, SPACE_MAP_INITIAL_BLOCKSIZE), so a metaslab might use the + * same number of blocks after condensing. Since the goal of condensing is to + * reduce the number of IOPs required to read the space map, we only want to + * condense when we can be sure we will reduce the number of blocks used by the + * space map. Unfortunately, we cannot precisely compute whether or not this is + * the case in metaslab_should_condense since we are holding ms_lock. Instead, + * we apply the following heuristic: do not condense a spacemap unless the + * uncondensed size consumes greater than zfs_metaslab_condense_block_threshold + * blocks. + */ +int zfs_metaslab_condense_block_threshold = 4; + +/* * The zfs_mg_noalloc_threshold defines which metaslab groups should * be eligible for allocation. The value is defined as a percentage of * a free space. Metaslab groups that have more free space than @@ -1371,6 +1386,8 @@ metaslab_group_preload(metaslab_group_t * times the size than the free space range tree representation * (i.e. zfs_condense_pct = 110 and in-core = 1MB, minimal = 1.1.MB). * + * 3. The on-disk size of the space map should actually decrease. + * * Checking the first condition is tricky since we don't want to walk * the entire AVL tree calculating the estimated on-disk size. Instead we * use the size-ordered range tree in the metaslab and calculate the @@ -1381,13 +1398,21 @@ metaslab_group_preload(metaslab_group_t * To determine the second criterion we use a best-case estimate and assume * each segment can be represented on-disk as a single 64-bit entry. We refer * to this best-case estimate as the space map's minimal form. + * + * Unfortunately, we cannot compute the on-disk size of the space map in this + * context because we cannot accurately compute the effects of compression, etc. + * Instead, we apply the heuristic described in the block comment for + * zfs_metaslab_condense_block_threshold - we only condense if the space used + * is greater than a threshold number of blocks. */ static boolean_t metaslab_should_condense(metaslab_t *msp) { space_map_t *sm = msp->ms_sm; range_seg_t *rs; - uint64_t size, entries, segsz; + uint64_t size, entries, segsz, object_size, optimal_size, record_size; + dmu_object_info_t doi; + uint64_t vdev_blocksize = 1 << msp->ms_group->mg_vd->vdev_ashift; ASSERT(MUTEX_HELD(&msp->ms_lock)); ASSERT(msp->ms_loaded); @@ -1411,9 +1436,15 @@ metaslab_should_condense(metaslab_t *msp entries = size / (MIN(size, SM_RUN_MAX)); segsz = entries * sizeof (uint64_t); - return (segsz <= space_map_length(msp->ms_sm) && - space_map_length(msp->ms_sm) >= (zfs_condense_pct * - sizeof (uint64_t) * avl_numnodes(&msp->ms_tree->rt_root)) / 100); + optimal_size = sizeof (uint64_t) * avl_numnodes(&msp->ms_tree->rt_root); + object_size = space_map_length(msp->ms_sm); + + dmu_object_info_from_db(sm->sm_dbuf, &doi); + record_size = MAX(doi.doi_data_block_size, vdev_blocksize); + + return (segsz <= object_size && + object_size >= (optimal_size * zfs_condense_pct / 100) && + object_size > zfs_metaslab_condense_block_threshold * record_size); } /* Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Aug 2 03:56:06 2014 (r269416) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright 2013 Martin Matuska . All rights reserved. */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sat Aug 2 03:56:06 2014 (r269416) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_IMPL_H @@ -249,8 +249,11 @@ struct vdev { #define VDEV_PHYS_SIZE (112 << 10) #define VDEV_UBERBLOCK_RING (128 << 10) +/* The largest uberblock we support is 8k. */ +#define MAX_UBERBLOCK_SHIFT (13) #define VDEV_UBERBLOCK_SHIFT(vd) \ - MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT) + MIN(MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT), \ + MAX_UBERBLOCK_SHIFT) #define VDEV_UBERBLOCK_COUNT(vd) \ (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd)) #define VDEV_UBERBLOCK_OFFSET(vd, n) \ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Aug 2 03:56:06 2014 (r269416) @@ -165,19 +165,20 @@ enum zio_flag { ZIO_FLAG_RESILVER = 1 << 3, ZIO_FLAG_SCRUB = 1 << 4, ZIO_FLAG_SCAN_THREAD = 1 << 5, + ZIO_FLAG_PHYSICAL = 1 << 6, #define ZIO_FLAG_AGG_INHERIT (ZIO_FLAG_CANFAIL - 1) /* * Flags inherited by ddt, gang, and vdev children. */ - ZIO_FLAG_CANFAIL = 1 << 6, /* must be first for INHERIT */ - ZIO_FLAG_SPECULATIVE = 1 << 7, - ZIO_FLAG_CONFIG_WRITER = 1 << 8, - ZIO_FLAG_DONT_RETRY = 1 << 9, - ZIO_FLAG_DONT_CACHE = 1 << 10, - ZIO_FLAG_NODATA = 1 << 11, - ZIO_FLAG_INDUCE_DAMAGE = 1 << 12, + ZIO_FLAG_CANFAIL = 1 << 7, /* must be first for INHERIT */ + ZIO_FLAG_SPECULATIVE = 1 << 8, + ZIO_FLAG_CONFIG_WRITER = 1 << 9, + ZIO_FLAG_DONT_RETRY = 1 << 10, + ZIO_FLAG_DONT_CACHE = 1 << 11, + ZIO_FLAG_NODATA = 1 << 12, + ZIO_FLAG_INDUCE_DAMAGE = 1 << 13, #define ZIO_FLAG_DDT_INHERIT (ZIO_FLAG_IO_RETRY - 1) #define ZIO_FLAG_GANG_INHERIT (ZIO_FLAG_IO_RETRY - 1) @@ -185,27 +186,27 @@ enum zio_flag { /* * Flags inherited by vdev children. */ - ZIO_FLAG_IO_RETRY = 1 << 13, /* must be first for INHERIT */ - ZIO_FLAG_PROBE = 1 << 14, - ZIO_FLAG_TRYHARD = 1 << 15, - ZIO_FLAG_OPTIONAL = 1 << 16, + ZIO_FLAG_IO_RETRY = 1 << 14, /* must be first for INHERIT */ + ZIO_FLAG_PROBE = 1 << 15, + ZIO_FLAG_TRYHARD = 1 << 16, + ZIO_FLAG_OPTIONAL = 1 << 17, #define ZIO_FLAG_VDEV_INHERIT (ZIO_FLAG_DONT_QUEUE - 1) /* * Flags not inherited by any children. */ - ZIO_FLAG_DONT_QUEUE = 1 << 17, /* must be first for INHERIT */ - ZIO_FLAG_DONT_PROPAGATE = 1 << 18, - ZIO_FLAG_IO_BYPASS = 1 << 19, - ZIO_FLAG_IO_REWRITE = 1 << 20, - ZIO_FLAG_RAW = 1 << 21, - ZIO_FLAG_GANG_CHILD = 1 << 22, - ZIO_FLAG_DDT_CHILD = 1 << 23, - ZIO_FLAG_GODFATHER = 1 << 24, - ZIO_FLAG_NOPWRITE = 1 << 25, - ZIO_FLAG_REEXECUTED = 1 << 26, - ZIO_FLAG_DELEGATED = 1 << 27, + ZIO_FLAG_DONT_QUEUE = 1 << 18, /* must be first for INHERIT */ + ZIO_FLAG_DONT_PROPAGATE = 1 << 19, + ZIO_FLAG_IO_BYPASS = 1 << 20, + ZIO_FLAG_IO_REWRITE = 1 << 21, + ZIO_FLAG_RAW = 1 << 22, + ZIO_FLAG_GANG_CHILD = 1 << 23, + ZIO_FLAG_DDT_CHILD = 1 << 24, + ZIO_FLAG_GODFATHER = 1 << 25, + ZIO_FLAG_NOPWRITE = 1 << 26, + ZIO_FLAG_REEXECUTED = 1 << 27, + ZIO_FLAG_DELEGATED = 1 << 28, }; #define ZIO_FLAG_MUSTSUCCEED 0 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c Sat Aug 2 03:56:06 2014 (r269416) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -57,7 +57,10 @@ zfs_dbgmsg_fini(void) * echo ::zfs_dbgmsg | mdb -k * * Monitor these messages by running: - * dtrace -q -n 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}' + * dtrace -qn 'zfs-dbgmsg{printf("%s\n", stringof(arg0))}' + * + * When used with libzpool, monitor with: + * dtrace -qn 'zfs$pid::zfs_dbgmsg:probe1{printf("%s\n", copyinstr(arg1))}' */ void zfs_dbgmsg(const char *fmt, ...) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Aug 2 03:48:16 2014 (r269415) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Aug 2 03:56:06 2014 (r269416) @@ -886,8 +886,8 @@ zio_read_phys(zio_t *pio, vdev_t *vd, ui ASSERT3U(offset + size, <=, vd->vdev_psize); zio = zio_create(pio, vd->vdev_spa, 0, NULL, data, size, done, private, - ZIO_TYPE_READ, priority, flags, vd, offset, NULL, - ZIO_STAGE_OPEN, ZIO_READ_PHYS_PIPELINE); + ZIO_TYPE_READ, priority, flags | ZIO_FLAG_PHYSICAL, vd, offset, + NULL, ZIO_STAGE_OPEN, ZIO_READ_PHYS_PIPELINE); zio->io_prop.zp_checksum = checksum; @@ -907,8 +907,8 @@ zio_write_phys(zio_t *pio, vdev_t *vd, u ASSERT3U(offset + size, <=, vd->vdev_psize); zio = zio_create(pio, vd->vdev_spa, 0, NULL, data, size, done, private, - ZIO_TYPE_WRITE, priority, flags, vd, offset, NULL, - ZIO_STAGE_OPEN, ZIO_WRITE_PHYS_PIPELINE); + ZIO_TYPE_WRITE, priority, flags | ZIO_FLAG_PHYSICAL, vd, offset, + NULL, ZIO_STAGE_OPEN, ZIO_WRITE_PHYS_PIPELINE); zio->io_prop.zp_checksum = checksum; @@ -2621,7 +2621,9 @@ zio_vdev_io_start(zio_t **ziop) align = 1ULL << vd->vdev_top->vdev_ashift; - if (P2PHASE(zio->io_size, align) != 0) { + if (!(zio->io_flags & ZIO_FLAG_PHYSICAL) && + P2PHASE(zio->io_size, align) != 0) { + /* Transform logical writes to be a full physical block size. */ uint64_t asize = P2ROUNDUP(zio->io_size, align); char *abuf = NULL; if (zio->io_type == ZIO_TYPE_READ || @@ -2636,8 +2638,22 @@ zio_vdev_io_start(zio_t **ziop) zio_subblock); } - ASSERT(P2PHASE(zio->io_offset, align) == 0); - ASSERT(P2PHASE(zio->io_size, align) == 0); + /* + * If this is not a physical io, make sure that it is properly aligned + * before proceeding. + */ + if (!(zio->io_flags & ZIO_FLAG_PHYSICAL)) { + ASSERT0(P2PHASE(zio->io_offset, align)); + ASSERT0(P2PHASE(zio->io_size, align)); + } else { + /* + * For physical writes, we allow 512b aligned writes and assume + * the device will perform a read-modify-write as necessary. + */ + ASSERT0(P2PHASE(zio->io_offset, SPA_MINBLOCKSIZE)); + ASSERT0(P2PHASE(zio->io_size, SPA_MINBLOCKSIZE)); + } + VERIFY(zio->io_type == ZIO_TYPE_READ || spa_writeable(spa)); /* From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 03:59:17 2014 Return-Path: Delivered-To: svn-src-all@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 086B1237; Sat, 2 Aug 2014 03:59:17 +0000 (UTC) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC2442227; Sat, 2 Aug 2014 03:59:15 +0000 (UTC) Received: from [192.168.0.61] (jt-mbp.home.scsiguy.org [192.168.0.61]) (authenticated bits=0) by aslan.scsiguy.com (8.14.8/8.14.8) with ESMTP id s723x6ju016932 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 1 Aug 2014 21:59:09 -0600 (MDT) (envelope-from gibbs@scsiguy.com) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269404 - head/sys/cddl/compat/opensolaris/sys From: "Justin T. Gibbs" In-Reply-To: <201408012233.s71MXNIx051919@svn.freebsd.org> Date: Fri, 1 Aug 2014 21:59:06 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <57D656EF-5D6B-428B-9DCE-7FA360B1407F@scsiguy.com> References: <201408012233.s71MXNIx051919@svn.freebsd.org> To: Xin LI X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 03:59:17 -0000 On Aug 1, 2014, at 4:33 PM, Xin LI wrote: > Author: delphij > Date: Fri Aug 1 22:33:23 2014 > New Revision: 269404 > URL: http://svnweb.freebsd.org/changeset/base/269404 >=20 > Log: > Split gethrtime() and gethrtime_waitfree() and make the former use > nanouptime() instead of getnanouptime(). nanouptime(9) provides more > precise result at expense of being slower. >=20 > In r269223, gethrtime() is used as creation time of dbuf, which in = turn > acts as portion of lookup key to maintain AVL invariant where there = can > not be duplicate items. Before this change, gethrtime() have = preferred > better execution time by sacrificing precision, which may lead to = panic > on busy systems with: >=20 > panic: avl_find() succeeded inside avl_add() I don=92t believe that r269223 requires a temporal ordering of the dbufs = in the AVL, just unique entries. So why use an expensive operation like = getting high resolution time? Can=92t we just use a PCPU counter and = tag the dbufs with "CPU# << 48 | PCPU_counter=94? =97 Justin= From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 03:59:36 2014 Return-Path: Delivered-To: svn-src-all@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 D23FA377; Sat, 2 Aug 2014 03:59:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B34EC222C; Sat, 2 Aug 2014 03:59:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s723xaqq002070; Sat, 2 Aug 2014 03:59:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s723xa82002064; Sat, 2 Aug 2014 03:59:36 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020359.s723xa82002064@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 03:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269417 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 03:59:37 -0000 Author: delphij Date: Sat Aug 2 03:59:35 2014 New Revision: 269417 URL: http://svnweb.freebsd.org/changeset/base/269417 Log: MFC r268858: MFV r268850: Change the interaction between the DMU and ARC so that when the DMU is shutting down an objset, we do not evict the data from the ARC. Instead we simply coordinate the destruction of the DMU's data with the ARC. The only case where we actually need to explicitly evict from the ARC is when dbuf_rele_and_unlock() determines that the administrator has requested that it not be kept in memory, via the primarycache/secondarycache properties. In this case, we evict the data from the ARC by its blkptr_t, the same way as when a block is freed we explicitly evict it from the ARC. Illumos issue: 4631 zvol_get_stats triggering too many reads Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Aug 2 03:56:06 2014 (r269416) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Aug 2 03:59:35 2014 (r269417) @@ -104,7 +104,7 @@ * with the buffer may be evicted prior to the callback. The callback * must be made with *no locks held* (to prevent deadlock). Additionally, * the users of callbacks must ensure that their private data is - * protected from simultaneous callbacks from arc_buf_evict() + * protected from simultaneous callbacks from arc_clear_callback() * and arc_do_user_evicts(). * * Note that the majority of the performance stats are manipulated @@ -1647,8 +1647,12 @@ arc_buf_data_free(arc_buf_t *buf, void ( } } +/* + * Free up buf->b_data and if 'remove' is set, then pull the + * arc_buf_t off of the the arc_buf_hdr_t's list and free it. + */ static void -arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t all) +arc_buf_destroy(arc_buf_t *buf, boolean_t recycle, boolean_t remove) { arc_buf_t **bufp; @@ -1701,7 +1705,7 @@ arc_buf_destroy(arc_buf_t *buf, boolean_ } /* only remove the buf if requested */ - if (!all) + if (!remove) return; /* remove the buf from the hdr list */ @@ -2355,7 +2359,7 @@ restart: mutex_exit(&buf->b_evict_lock); if (buf->b_efunc != NULL) - VERIFY(buf->b_efunc(buf) == 0); + VERIFY0(buf->b_efunc(buf->b_private)); buf->b_efunc = NULL; buf->b_private = NULL; @@ -3490,16 +3494,25 @@ arc_freed(spa_t *spa, const blkptr_t *bp } /* - * This is used by the DMU to let the ARC know that a buffer is - * being evicted, so the ARC should clean up. If this arc buf - * is not yet in the evicted state, it will be put there. + * Clear the user eviction callback set by arc_set_callback(), first calling + * it if it exists. Because the presence of a callback keeps an arc_buf cached + * clearing the callback may result in the arc_buf being destroyed. However, + * it will not result in the *last* arc_buf being destroyed, hence the data + * will remain cached in the ARC. We make a copy of the arc buffer here so + * that we can process the callback without holding any locks. + * + * It's possible that the callback is already in the process of being cleared + * by another thread. In this case we can not clear the callback. + * + * Returns B_TRUE if the callback was successfully called and cleared. */ -int -arc_buf_evict(arc_buf_t *buf) +boolean_t +arc_clear_callback(arc_buf_t *buf) { arc_buf_hdr_t *hdr; kmutex_t *hash_lock; - arc_buf_t **bufp; + arc_evict_func_t *efunc = buf->b_efunc; + void *private = buf->b_private; list_t *list, *evicted_list; kmutex_t *lock, *evicted_lock; @@ -3511,17 +3524,16 @@ arc_buf_evict(arc_buf_t *buf) */ ASSERT(buf->b_data == NULL); mutex_exit(&buf->b_evict_lock); - return (0); + return (B_FALSE); } else if (buf->b_data == NULL) { - arc_buf_t copy = *buf; /* structure assignment */ /* * We are on the eviction list; process this buffer now * but let arc_do_user_evicts() do the reaping. */ buf->b_efunc = NULL; mutex_exit(&buf->b_evict_lock); - VERIFY(copy.b_efunc(©) == 0); - return (1); + VERIFY0(efunc(private)); + return (B_TRUE); } hash_lock = HDR_LOCK(hdr); mutex_enter(hash_lock); @@ -3531,50 +3543,21 @@ arc_buf_evict(arc_buf_t *buf) ASSERT3U(refcount_count(&hdr->b_refcnt), <, hdr->b_datacnt); ASSERT(hdr->b_state == arc_mru || hdr->b_state == arc_mfu); - /* - * Pull this buffer off of the hdr - */ - bufp = &hdr->b_buf; - while (*bufp != buf) - bufp = &(*bufp)->b_next; - *bufp = buf->b_next; - - ASSERT(buf->b_data != NULL); - arc_buf_destroy(buf, FALSE, FALSE); - - if (hdr->b_datacnt == 0) { - arc_state_t *old_state = hdr->b_state; - arc_state_t *evicted_state; - - ASSERT(hdr->b_buf == NULL); - ASSERT(refcount_is_zero(&hdr->b_refcnt)); - - evicted_state = - (old_state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost; - - get_buf_info(hdr, old_state, &list, &lock); - get_buf_info(hdr, evicted_state, &evicted_list, &evicted_lock); - mutex_enter(lock); - mutex_enter(evicted_lock); - - arc_change_state(evicted_state, hdr, hash_lock); - ASSERT(HDR_IN_HASH_TABLE(hdr)); - hdr->b_flags |= ARC_IN_HASH_TABLE; - hdr->b_flags &= ~ARC_BUF_AVAILABLE; + buf->b_efunc = NULL; + buf->b_private = NULL; - mutex_exit(evicted_lock); - mutex_exit(lock); + if (hdr->b_datacnt > 1) { + mutex_exit(&buf->b_evict_lock); + arc_buf_destroy(buf, FALSE, TRUE); + } else { + ASSERT(buf == hdr->b_buf); + hdr->b_flags |= ARC_BUF_AVAILABLE; + mutex_exit(&buf->b_evict_lock); } - mutex_exit(hash_lock); - mutex_exit(&buf->b_evict_lock); - VERIFY(buf->b_efunc(buf) == 0); - buf->b_efunc = NULL; - buf->b_private = NULL; - buf->b_hdr = NULL; - buf->b_next = NULL; - kmem_cache_free(buf_cache, buf); - return (1); + mutex_exit(hash_lock); + VERIFY0(efunc(private)); + return (B_TRUE); } /* @@ -3724,17 +3707,6 @@ arc_released(arc_buf_t *buf) return (released); } -int -arc_has_callback(arc_buf_t *buf) -{ - int callback; - - mutex_enter(&buf->b_evict_lock); - callback = (buf->b_efunc != NULL); - mutex_exit(&buf->b_evict_lock); - return (callback); -} - #ifdef ZFS_DEBUG int arc_referenced(arc_buf_t *buf) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Aug 2 03:56:06 2014 (r269416) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Aug 2 03:59:35 2014 (r269417) @@ -181,8 +181,7 @@ dbuf_hash_insert(dmu_buf_impl_t *db) } /* - * Remove an entry from the hash table. This operation will - * fail if there are any existing holds on the db. + * Remove an entry from the hash table. It must be in the EVICTING state. */ static void dbuf_hash_remove(dmu_buf_impl_t *db) @@ -194,7 +193,7 @@ dbuf_hash_remove(dmu_buf_impl_t *db) dmu_buf_impl_t *dbf, **dbp; /* - * We musn't hold db_mtx to maintin lock ordering: + * We musn't hold db_mtx to maintain lock ordering: * DBUF_HASH_MUTEX > db_mtx. */ ASSERT(refcount_is_zero(&db->db_holds)); @@ -431,7 +430,6 @@ static void dbuf_set_data(dmu_buf_impl_t *db, arc_buf_t *buf) { ASSERT(MUTEX_HELD(&db->db_mtx)); - ASSERT(db->db_buf == NULL || !arc_has_callback(db->db_buf)); db->db_buf = buf; if (buf != NULL) { ASSERT(buf->b_data != NULL); @@ -1544,12 +1542,15 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, a * when we are not holding the dn_dbufs_mtx, we can't clear the * entry in the dn_dbufs list. We have to wait until dbuf_destroy() * in this case. For callers from the DMU we will usually see: - * dbuf_clear()->arc_buf_evict()->dbuf_do_evict()->dbuf_destroy() + * dbuf_clear()->arc_clear_callback()->dbuf_do_evict()->dbuf_destroy() * For the arc callback, we will usually see: * dbuf_do_evict()->dbuf_clear();dbuf_destroy() * Sometimes, though, we will get a mix of these two: - * DMU: dbuf_clear()->arc_buf_evict() + * DMU: dbuf_clear()->arc_clear_callback() * ARC: dbuf_do_evict()->dbuf_destroy() + * + * This routine will dissociate the dbuf from the arc, by calling + * arc_clear_callback(), but will not evict the data from the ARC. */ void dbuf_clear(dmu_buf_impl_t *db) @@ -1557,7 +1558,7 @@ dbuf_clear(dmu_buf_impl_t *db) dnode_t *dn; dmu_buf_impl_t *parent = db->db_parent; dmu_buf_impl_t *dndb; - int dbuf_gone = FALSE; + boolean_t dbuf_gone = B_FALSE; ASSERT(MUTEX_HELD(&db->db_mtx)); ASSERT(refcount_is_zero(&db->db_holds)); @@ -1603,7 +1604,7 @@ dbuf_clear(dmu_buf_impl_t *db) } if (db->db_buf) - dbuf_gone = arc_buf_evict(db->db_buf); + dbuf_gone = arc_clear_callback(db->db_buf); if (!dbuf_gone) mutex_exit(&db->db_mtx); @@ -1771,8 +1772,7 @@ dbuf_create(dnode_t *dn, uint8_t level, static int dbuf_do_evict(void *private) { - arc_buf_t *buf = private; - dmu_buf_impl_t *db = buf->b_private; + dmu_buf_impl_t *db = private; if (!MUTEX_HELD(&db->db_mtx)) mutex_enter(&db->db_mtx); @@ -2135,11 +2135,23 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, * block on-disk. If so, then we simply evict * ourselves. */ - if (!DBUF_IS_CACHEABLE(db) || - arc_buf_eviction_needed(db->db_buf)) + if (!DBUF_IS_CACHEABLE(db)) { + if (db->db_blkptr != NULL && + !BP_IS_HOLE(db->db_blkptr) && + !BP_IS_EMBEDDED(db->db_blkptr)) { + spa_t *spa = + dmu_objset_spa(db->db_objset); + blkptr_t bp = *db->db_blkptr; + dbuf_clear(db); + arc_freed(spa, &bp); + } else { + dbuf_clear(db); + } + } else if (arc_buf_eviction_needed(db->db_buf)) { dbuf_clear(db); - else + } else { mutex_exit(&db->db_mtx); + } } } else { mutex_exit(&db->db_mtx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Aug 2 03:56:06 2014 (r269416) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Sat Aug 2 03:59:35 2014 (r269417) @@ -95,7 +95,6 @@ boolean_t arc_buf_remove_ref(arc_buf_t * int arc_buf_size(arc_buf_t *buf); void arc_release(arc_buf_t *buf, void *tag); int arc_released(arc_buf_t *buf); -int arc_has_callback(arc_buf_t *buf); void arc_buf_freeze(arc_buf_t *buf); void arc_buf_thaw(arc_buf_t *buf); boolean_t arc_buf_eviction_needed(arc_buf_t *buf); @@ -114,7 +113,7 @@ zio_t *arc_write(zio_t *pio, spa_t *spa, void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); -int arc_buf_evict(arc_buf_t *buf); +boolean_t arc_clear_callback(arc_buf_t *buf); void arc_flush(spa_t *spa); void arc_tempreserve_clear(uint64_t reserve); From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 04:01:46 2014 Return-Path: Delivered-To: svn-src-all@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 111A74B2; Sat, 2 Aug 2014 04:01: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDAFC22BD; Sat, 2 Aug 2014 04:01:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7241jVw005787; Sat, 2 Aug 2014 04:01:45 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7241iKK005781; Sat, 2 Aug 2014 04:01:44 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020401.s7241iKK005781@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 04:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269418 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 04:01:46 -0000 Author: delphij Date: Sat Aug 2 04:01:44 2014 New Revision: 269418 URL: http://svnweb.freebsd.org/changeset/base/269418 Log: MFC r268859: MFV r268851: When a sync task is waiting for a txg to complete, we should hurry it along by increasing the number of outstanding async writes (i.e. make vdev_queue_max_async_writes() return a larger number). Illumos issue: 4753 increase number of outstanding async writes when sync task is waiting Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Aug 2 03:59:35 2014 (r269417) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sat Aug 2 04:01:44 2014 (r269418) @@ -1938,6 +1938,16 @@ spa_writeable(spa_t *spa) return (!!(spa->spa_mode & FWRITE)); } +/* + * Returns true if there is a pending sync task in any of the current + * syncing txg, the current quiescing txg, or the current open txg. + */ +boolean_t +spa_has_pending_synctask(spa_t *spa) +{ + return (!txg_all_lists_empty(&spa->spa_dsl_pool->dp_sync_tasks)); +} + int spa_mode(spa_t *spa) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Aug 2 03:59:35 2014 (r269417) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Aug 2 04:01:44 2014 (r269418) @@ -800,6 +800,7 @@ extern uint64_t bp_get_dsize(spa_t *spa, extern boolean_t spa_has_slogs(spa_t *spa); extern boolean_t spa_is_root(spa_t *spa); extern boolean_t spa_writeable(spa_t *spa); +extern boolean_t spa_has_pending_synctask(spa_t *spa); extern int spa_mode(spa_t *spa); extern uint64_t zfs_strtonum(const char *str, char **nptr); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Sat Aug 2 03:59:35 2014 (r269417) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Sat Aug 2 04:01:44 2014 (r269418) @@ -23,7 +23,7 @@ * Use is subject to license terms. */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #ifndef _SYS_TXG_H @@ -112,6 +112,7 @@ extern boolean_t txg_sync_waiting(struct extern void txg_list_create(txg_list_t *tl, size_t offset); extern void txg_list_destroy(txg_list_t *tl); extern boolean_t txg_list_empty(txg_list_t *tl, uint64_t txg); +extern boolean_t txg_all_lists_empty(txg_list_t *tl); extern boolean_t txg_list_add(txg_list_t *tl, void *p, uint64_t txg); extern boolean_t txg_list_add_tail(txg_list_t *tl, void *p, uint64_t txg); extern void *txg_list_remove(txg_list_t *tl, uint64_t txg); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Sat Aug 2 03:59:35 2014 (r269417) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Sat Aug 2 04:01:44 2014 (r269418) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright 2011 Martin Matuska - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -727,6 +727,24 @@ txg_list_empty(txg_list_t *tl, uint64_t } /* + * Returns true if all txg lists are empty. + * + * Warning: this is inherently racy (an item could be added immediately after this + * function returns). We don't bother with the lock because it wouldn't change the + * semantics. + */ +boolean_t +txg_all_lists_empty(txg_list_t *tl) +{ + for (int i = 0; i < TXG_SIZE; i++) { + if (!txg_list_empty(tl, i)) { + return (B_FALSE); + } + } + return (B_TRUE); +} + +/* * Add an entry to the list (unless it's already on the list). * Returns B_TRUE if it was actually added. */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Aug 2 03:59:35 2014 (r269417) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Sat Aug 2 04:01:44 2014 (r269418) @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -408,14 +408,23 @@ vdev_queue_class_min_active(zio_priority } static int -vdev_queue_max_async_writes(uint64_t dirty) +vdev_queue_max_async_writes(spa_t *spa) { int writes; + uint64_t dirty = spa->spa_dsl_pool->dp_dirty_total; uint64_t min_bytes = zfs_dirty_data_max * zfs_vdev_async_write_active_min_dirty_percent / 100; uint64_t max_bytes = zfs_dirty_data_max * zfs_vdev_async_write_active_max_dirty_percent / 100; + /* + * Sync tasks correspond to interactive user actions. To reduce the + * execution time of those actions we push data out as fast as possible. + */ + if (spa_has_pending_synctask(spa)) { + return (zfs_vdev_async_write_max_active); + } + if (dirty < min_bytes) return (zfs_vdev_async_write_min_active); if (dirty > max_bytes) @@ -448,8 +457,7 @@ vdev_queue_class_max_active(spa_t *spa, case ZIO_PRIORITY_ASYNC_READ: return (zfs_vdev_async_read_max_active); case ZIO_PRIORITY_ASYNC_WRITE: - return (vdev_queue_max_async_writes( - spa->spa_dsl_pool->dp_dirty_total)); + return (vdev_queue_max_async_writes(spa)); case ZIO_PRIORITY_SCRUB: return (zfs_vdev_scrub_max_active); default: From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 04:06:37 2014 Return-Path: Delivered-To: svn-src-all@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 1ACDE6F5; Sat, 2 Aug 2014 04:06:37 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06B3623D7; Sat, 2 Aug 2014 04:06:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7246aXO006884; Sat, 2 Aug 2014 04:06:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7246ZsC006874; Sat, 2 Aug 2014 04:06:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020406.s7246ZsC006874@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 04:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269419 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 04:06:37 -0000 Author: delphij Date: Sat Aug 2 04:06:35 2014 New Revision: 269419 URL: http://svnweb.freebsd.org/changeset/base/269419 Log: MFC r268865: MFV r268852: Reduce lock contention on the z_teardown_lock under heavily cached read workload by splitting the single teardown rrw lock into RRM_NUM_LOCKS (17) of them. Read acquisitions are randomly distributed among these locks based on curthread pointer. Write acquisitions are going to all the locks, which for the usage of this type of lock should be rare. Illumos issue: 5008 lock contention (rrw_exit) while running a read only load Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c Sat Aug 2 04:06:35 2014 (r269419) @@ -286,3 +286,91 @@ rrw_tsd_destroy(void *arg) (void *)curthread, (void *)rn->rn_rrl); } } + +/* + * A reader-mostly lock implementation, tuning above reader-writer locks + * for hightly parallel read acquisitions, while pessimizing writes. + * + * The idea is to split single busy lock into array of locks, so that + * each reader can lock only one of them for read, depending on result + * of simple hash function. That proportionally reduces lock congestion. + * Writer same time has to sequentially aquire write on all the locks. + * That makes write aquisition proportionally slower, but in places where + * it is used (filesystem unmount) performance is not critical. + * + * All the functions below are direct wrappers around functions above. + */ +void +rrm_init(rrmlock_t *rrl, boolean_t track_all) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_init(&rrl->locks[i], track_all); +} + +void +rrm_destroy(rrmlock_t *rrl) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_destroy(&rrl->locks[i]); +} + +void +rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag) +{ + if (rw == RW_READER) + rrm_enter_read(rrl, tag); + else + rrm_enter_write(rrl); +} + +/* + * This maps the current thread to a specific lock. Note that the lock + * must be released by the same thread that acquired it. We do this + * mapping by taking the thread pointer mod a prime number. We examine + * only the low 32 bits of the thread pointer, because 32-bit division + * is faster than 64-bit division, and the high 32 bits have little + * entropy anyway. + */ +#define RRM_TD_LOCK() (((uint32_t)(uintptr_t)(curthread)) % RRM_NUM_LOCKS) + +void +rrm_enter_read(rrmlock_t *rrl, void *tag) +{ + rrw_enter_read(&rrl->locks[RRM_TD_LOCK()], tag); +} + +void +rrm_enter_write(rrmlock_t *rrl) +{ + int i; + + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_enter_write(&rrl->locks[i]); +} + +void +rrm_exit(rrmlock_t *rrl, void *tag) +{ + int i; + + if (rrl->locks[0].rr_writer == curthread) { + for (i = 0; i < RRM_NUM_LOCKS; i++) + rrw_exit(&rrl->locks[i], tag); + } else { + rrw_exit(&rrl->locks[RRM_TD_LOCK()], tag); + } +} + +boolean_t +rrm_held(rrmlock_t *rrl, krw_t rw) +{ + if (rw == RW_WRITER) { + return (rrw_held(&rrl->locks[0], rw)); + } else { + return (rrw_held(&rrl->locks[RRM_TD_LOCK()], rw)); + } +} Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h Sat Aug 2 04:06:35 2014 (r269419) @@ -79,6 +79,31 @@ void rrw_tsd_destroy(void *arg); #define RRW_LOCK_HELD(x) \ (rrw_held(x, RW_WRITER) || rrw_held(x, RW_READER)) +/* + * A reader-mostly lock implementation, tuning above reader-writer locks + * for hightly parallel read acquisitions, pessimizing write acquisitions. + * + * This should be a prime number. See comment in rrwlock.c near + * RRM_TD_LOCK() for details. + */ +#define RRM_NUM_LOCKS 17 +typedef struct rrmlock { + rrwlock_t locks[RRM_NUM_LOCKS]; +} rrmlock_t; + +void rrm_init(rrmlock_t *rrl, boolean_t track_all); +void rrm_destroy(rrmlock_t *rrl); +void rrm_enter(rrmlock_t *rrl, krw_t rw, void *tag); +void rrm_enter_read(rrmlock_t *rrl, void *tag); +void rrm_enter_write(rrmlock_t *rrl); +void rrm_exit(rrmlock_t *rrl, void *tag); +boolean_t rrm_held(rrmlock_t *rrl, krw_t rw); + +#define RRM_READ_HELD(x) rrm_held(x, RW_READER) +#define RRM_WRITE_HELD(x) rrm_held(x, RW_WRITER) +#define RRM_LOCK_HELD(x) \ + (rrm_held(x, RW_WRITER) || rrm_held(x, RW_READER)) + #ifdef __cplusplus } #endif Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Sat Aug 2 04:06:35 2014 (r269419) @@ -64,7 +64,7 @@ struct zfsvfs { int z_norm; /* normalization flags */ boolean_t z_atime; /* enable atimes mount option */ boolean_t z_unmounted; /* unmounted */ - rrwlock_t z_teardown_lock; + rrmlock_t z_teardown_lock; krwlock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sat Aug 2 04:06:35 2014 (r269419) @@ -256,7 +256,7 @@ VTOZ(vnode_t *vp) /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ - rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ if ((zfsvfs)->z_unmounted) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ @@ -265,10 +265,10 @@ VTOZ(vnode_t *vp) /* Called on entry to each ZFS vnode and vfs operation that can not return EIO */ #define ZFS_ENTER_NOERROR(zfsvfs) \ - rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) /* Must be called before exiting the vop */ -#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG) /* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 2 04:06:35 2014 (r269419) @@ -1466,7 +1466,7 @@ zfsvfs_hold(const char *name, void *tag, if (getzfsvfs(name, zfvp) != 0) error = zfsvfs_create(name, zfvp); if (error == 0) { - rrw_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : + rrm_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : RW_READER, tag); if ((*zfvp)->z_unmounted) { /* @@ -1474,7 +1474,7 @@ zfsvfs_hold(const char *name, void *tag, * thread should be just about to disassociate the * objset from the zfsvfs. */ - rrw_exit(&(*zfvp)->z_teardown_lock, tag); + rrm_exit(&(*zfvp)->z_teardown_lock, tag); return (SET_ERROR(EBUSY)); } } @@ -1484,7 +1484,7 @@ zfsvfs_hold(const char *name, void *tag, static void zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag) { - rrw_exit(&zfsvfs->z_teardown_lock, tag); + rrm_exit(&zfsvfs->z_teardown_lock, tag); if (zfsvfs->z_vfs) { VFS_RELE(zfsvfs->z_vfs); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Aug 2 04:06:35 2014 (r269419) @@ -988,7 +988,7 @@ zfsvfs_create(const char *osname, zfsvfs mutex_init(&zfsvfs->z_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs->z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node)); - rrw_init(&zfsvfs->z_teardown_lock, B_FALSE); + rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); rw_init(&zfsvfs->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1104,7 +1104,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) mutex_destroy(&zfsvfs->z_znodes_lock); mutex_destroy(&zfsvfs->z_lock); list_destroy(&zfsvfs->z_all_znodes); - rrw_destroy(&zfsvfs->z_teardown_lock); + rrm_destroy(&zfsvfs->z_teardown_lock); rw_destroy(&zfsvfs->z_teardown_inactive_lock); rw_destroy(&zfsvfs->z_fuid_lock); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1833,7 +1833,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea { znode_t *zp; - rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); if (!unmounting) { /* @@ -1866,7 +1866,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea */ if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); return (SET_ERROR(EIO)); } @@ -1893,7 +1893,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); } @@ -1970,9 +1970,9 @@ zfs_umount(vfs_t *vfsp, int fflag) * vflush(FORCECLOSE). This way we ensure no future vnops * will be called and risk operating on DOOMED vnodes. */ - rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); zfsvfs->z_unmounted = B_TRUE; - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } /* @@ -2240,7 +2240,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch znode_t *zp; uint64_t sa_obj = 0; - ASSERT(RRW_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* @@ -2296,7 +2296,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, const ch bail: /* release the VOPs */ rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrw_exit(&zfsvfs->z_teardown_lock, FTAG); + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); if (err) { /* Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Aug 2 04:01:44 2014 (r269418) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sat Aug 2 04:06:35 2014 (r269419) @@ -276,7 +276,7 @@ zfs_znode_move(void *buf, void *newbuf, * can safely ensure that the filesystem is not and will not be * unmounted. The next statement is equivalent to ZFS_ENTER(). */ - rrw_enter(&zfsvfs->z_teardown_lock, RW_READER, FTAG); + rrm_enter(&zfsvfs->z_teardown_lock, RW_READER, FTAG); if (zfsvfs->z_unmounted) { ZFS_EXIT(zfsvfs); rw_exit(&zfsvfs_lock); From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:02:42 2014 Return-Path: Delivered-To: svn-src-all@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 069444F7; Sat, 2 Aug 2014 05:02:42 +0000 (UTC) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C27C52929; Sat, 2 Aug 2014 05:02:41 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id s7252XRG017116; Sat, 2 Aug 2014 00:02:33 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp1.rice.edu with ESMTP id 1ndwdna55h-1; Sat, 02 Aug 2014 00:02:32 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 9E8B45000E5; Sat, 2 Aug 2014 00:02:24 -0500 (CDT) Message-ID: <53DC70E0.3080709@rice.edu> Date: Sat, 02 Aug 2014 00:02:24 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Slawa Olhovchenkov , Alan Cox Subject: Re: svn commit: r269134 - head/sys/vm References: <201407261810.s6QIAIIj049439@svn.freebsd.org> <20140729103812.GA64229@zxy.spb.ru> In-Reply-To: <20140729103812.GA64229@zxy.spb.ru> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details: rule=spam policy=default score=57 spamscore=57 suspectscore=4 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1408020067 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:02:42 -0000 On 07/29/2014 05:38, Slawa Olhovchenkov wrote: > On Sat, Jul 26, 2014 at 06:10:18PM +0000, Alan Cox wrote: > >> Author: alc >> Date: Sat Jul 26 18:10:18 2014 >> New Revision: 269134 >> URL: http://svnweb.freebsd.org/changeset/base/269134 >> >> Log: >> When unwiring a region of an address space, do not assume that the >> underlying physical pages are mapped by the pmap. If, for example, the >> application has performed an mprotect(..., PROT_NONE) on any part of the >> wired region, then those pages will no longer be mapped by the pmap. >> So, using the pmap to lookup the wired pages in order to unwire them >> doesn't always work, and when it doesn't work wired pages are leaked. >> >> To avoid the leak, introduce and use a new function vm_object_unwire() >> that locates the wired pages by traversing the object and its backing >> objects. > MFC planed? At some point, yes. However, I'm not sure that it will be MFCed in time for 10.1. >> At the same time, switch from using pmap_change_wiring() to the recently >> introduced function pmap_unwire() for unwiring the region's mappings. >> pmap_unwire() is faster, because it operates a range of virtual addresses >> rather than a single virtual page at a time. Moreover, by operating on >> a range, it is superpage friendly. It doesn't waste time performing >> unnecessary demotions. >> >> Reported by: markj >> Reviewed by: kib >> Tested by: pho, jmg (arm) >> Sponsored by: EMC / Isilon Storage Division > From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:05:05 2014 Return-Path: Delivered-To: svn-src-all@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 E3FC973D; Sat, 2 Aug 2014 05:05: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2981296D; Sat, 2 Aug 2014 05:05:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72555OG035327; Sat, 2 Aug 2014 05:05:05 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s725559g035326; Sat, 2 Aug 2014 05:05:05 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020505.s725559g035326@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269420 - head/sys/fs/nandfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:05:06 -0000 Author: imp Date: Sat Aug 2 05:05:05 2014 New Revision: 269420 URL: http://svnweb.freebsd.org/changeset/base/269420 Log: Fix a minor style(9) issue. Modified: head/sys/fs/nandfs/nandfs_subr.c Modified: head/sys/fs/nandfs/nandfs_subr.c ============================================================================== --- head/sys/fs/nandfs/nandfs_subr.c Sat Aug 2 04:06:35 2014 (r269419) +++ head/sys/fs/nandfs/nandfs_subr.c Sat Aug 2 05:05:05 2014 (r269420) @@ -639,16 +639,14 @@ nandfs_get_node_raw(struct nandfs_device if (nmp) { mp = nmp->nm_vfs_mountp; error = getnewvnode("nandfs", mp, &nandfs_vnodeops, &nvp); - if (error) { + if (error) return (error); - } } else { mp = NULL; error = getnewvnode("snandfs", mp, &nandfs_system_vnodeops, &nvp); - if (error) { + if (error) return (error); - } } if (mp) From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:05:11 2014 Return-Path: Delivered-To: svn-src-all@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 7102C877; Sat, 2 Aug 2014 05:05: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FA7D296F; Sat, 2 Aug 2014 05:05:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7255BCX035397; Sat, 2 Aug 2014 05:05:11 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7255BZR035396; Sat, 2 Aug 2014 05:05:11 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020505.s7255BZR035396@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269421 - head/sys/fs/nandfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:05:11 -0000 Author: imp Date: Sat Aug 2 05:05:10 2014 New Revision: 269421 URL: http://svnweb.freebsd.org/changeset/base/269421 Log: Follow the ufs practice for disallowing permission changes as well as writes to files for read-only file systems. Since there are already checks in nandfs_setattr that return an error, this moves detection of the error earlier. Modified: head/sys/fs/nandfs/nandfs_vnops.c Modified: head/sys/fs/nandfs/nandfs_vnops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vnops.c Sat Aug 2 05:05:05 2014 (r269420) +++ head/sys/fs/nandfs/nandfs_vnops.c Sat Aug 2 05:05:10 2014 (r269421) @@ -987,7 +987,7 @@ nandfs_check_possible(struct vnode *vp, * Normal nodes: check if we're on a read-only mounted * filingsystem and bomb out if we're trying to write. */ - if ((mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) + if ((mode & VMODIFY_PERMS) && (vp->v_mount->mnt_flag & MNT_RDONLY)) return (EROFS); break; case VBLK: From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:05:16 2014 Return-Path: Delivered-To: svn-src-all@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 BFEEB9B3; Sat, 2 Aug 2014 05:05: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE8AE2971; Sat, 2 Aug 2014 05:05:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7255G2k035463; Sat, 2 Aug 2014 05:05:16 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7255GAt035462; Sat, 2 Aug 2014 05:05:16 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020505.s7255GAt035462@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269422 - head/sys/fs/nandfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:05:16 -0000 Author: imp Date: Sat Aug 2 05:05:16 2014 New Revision: 269422 URL: http://svnweb.freebsd.org/changeset/base/269422 Log: Set the erase block size properly in the case the underlying media doesn't advertise an erase block size. Submitted by: bjg@ Pointy hat to: imp@ Modified: head/sys/fs/nandfs/nandfs_vfsops.c Modified: head/sys/fs/nandfs/nandfs_vfsops.c ============================================================================== --- head/sys/fs/nandfs/nandfs_vfsops.c Sat Aug 2 05:05:10 2014 (r269421) +++ head/sys/fs/nandfs/nandfs_vfsops.c Sat Aug 2 05:05:16 2014 (r269422) @@ -912,7 +912,7 @@ nandfs_mount_device(struct vnode *devvp, /* * We conclude that this is not NAND storage */ - nandfsdev->nd_erasesize = NANDFS_DEF_ERASESIZE; + erasesize = NANDFS_DEF_ERASESIZE; } else { DROP_GIANT(); g_topology_lock(); @@ -924,7 +924,6 @@ nandfs_mount_device(struct vnode *devvp, return (error); } } - nandfsdev->nd_erasesize = erasesize; DPRINTF(VOLUMES, ("%s: erasesize %x\n", __func__, From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:16:20 2014 Return-Path: Delivered-To: svn-src-all@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 C2BD1D49; Sat, 2 Aug 2014 05:16:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0BAC2A79; Sat, 2 Aug 2014 05:16:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s725GKdP040750; Sat, 2 Aug 2014 05:16:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s725GKNR040749; Sat, 2 Aug 2014 05:16:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020516.s725GKNR040749@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269423 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:16:20 -0000 Author: imp Date: Sat Aug 2 05:16:20 2014 New Revision: 269423 URL: http://svnweb.freebsd.org/changeset/base/269423 Log: Add a new -K to suppress installing the kernel. Useful for creating chroots that may never boot (such as build environments), or for platforms that don't really need the kernel installed into the filesystem. Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:05:16 2014 (r269422) +++ head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:16:20 2014 (r269423) @@ -895,10 +895,11 @@ pprint() ( usage () { ( - echo "Usage: $0 [-bfiknqvw] [-c config_file]" + echo "Usage: $0 [-bfiKknqvw] [-c config_file]" echo " -b suppress builds (both kernel and world)" echo " -f suppress code slice extraction" echo " -i suppress disk image build" + echo " -K suppress installkernel" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" echo " -q make output more quiet" @@ -914,12 +915,13 @@ usage () { do_clean=true do_kernel=true +do_installkernel=true do_world=true do_image=true do_copyout_partition=true set +e -args=`getopt bc:fhiknqvw $*` +args=`getopt Kbc:fhiknqvw $*` if [ $? -ne 0 ] ; then usage exit 2 @@ -936,6 +938,10 @@ do do_kernel=false shift ;; + -K) + do_installkernel=false + shift + ;; -k) do_kernel=false shift @@ -1083,7 +1089,11 @@ make_conf_install install_world install_etc setup_nanobsd_etc -install_kernel +if $do_installkernel ; then + install_kernel +else + pprint 2 "Skipping installkernel (as instructed)" +fi run_customize setup_nanobsd From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:18:00 2014 Return-Path: Delivered-To: svn-src-all@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 1BFBCE94; Sat, 2 Aug 2014 05:18: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A08D2A84; Sat, 2 Aug 2014 05:18:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s725HxmO040990; Sat, 2 Aug 2014 05:17:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s725HxLB040989; Sat, 2 Aug 2014 05:17:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020517.s725HxLB040989@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269424 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:18:00 -0000 Author: imp Date: Sat Aug 2 05:17:59 2014 New Revision: 269424 URL: http://svnweb.freebsd.org/changeset/base/269424 Log: Sort usage options. Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:16:20 2014 (r269423) +++ head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:17:59 2014 (r269424) @@ -896,16 +896,16 @@ pprint() ( usage () { ( echo "Usage: $0 [-bfiKknqvw] [-c config_file]" + echo " -K suppress installkernel" echo " -b suppress builds (both kernel and world)" + echo " -c specify config file" echo " -f suppress code slice extraction" echo " -i suppress disk image build" - echo " -K suppress installkernel" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" echo " -q make output more quiet" echo " -v make output more verbose" echo " -w suppress buildworld" - echo " -c specify config file" ) 1>&2 exit 2 } From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 05:19:34 2014 Return-Path: Delivered-To: svn-src-all@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 37CB9FE5; Sat, 2 Aug 2014 05:19:34 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 244712A99; Sat, 2 Aug 2014 05:19:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s725JYdD041252; Sat, 2 Aug 2014 05:19:34 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s725JYoY041251; Sat, 2 Aug 2014 05:19:34 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201408020519.s725JYoY041251@svn.freebsd.org> From: Warner Losh Date: Sat, 2 Aug 2014 05:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269425 - head/tools/tools/nanobsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 05:19:34 -0000 Author: imp Date: Sat Aug 2 05:19:33 2014 New Revision: 269425 URL: http://svnweb.freebsd.org/changeset/base/269425 Log: Sort switch statements. Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:17:59 2014 (r269424) +++ head/tools/tools/nanobsd/nanobsd.sh Sat Aug 2 05:19:33 2014 (r269425) @@ -933,16 +933,12 @@ for i do case "$i" in - -b) - do_world=false - do_kernel=false - shift - ;; -K) do_installkernel=false shift ;; - -k) + -b) + do_world=false do_kernel=false shift ;; @@ -966,6 +962,10 @@ do do_image=false shift ;; + -k) + do_kernel=false + shift + ;; -n) do_clean=false shift From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 06:33:58 2014 Return-Path: Delivered-To: svn-src-all@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 CF3888DA; Sat, 2 Aug 2014 06:33: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBD9E21EB; Sat, 2 Aug 2014 06:33:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s726Xw0Q076585; Sat, 2 Aug 2014 06:33:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s726XwGO076584; Sat, 2 Aug 2014 06:33:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020633.s726XwGO076584@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 06:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r269426 - vendor/illumos/dist/cmd/ztest X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 06:33:58 -0000 Author: delphij Date: Sat Aug 2 06:33:58 2014 New Revision: 269426 URL: http://svnweb.freebsd.org/changeset/base/269426 Log: Author: Matthew Ahrens Date: Fri Aug 1 11:09:46 2014 -0800 5039 ztest should default to larger device sizes Reviewed by: George Wilson Reviewed by: Max Grossman Reviewed by: Christopher Siden Reviewed by: Saso Kiselkov Approved by: Richard Lowe illumos/illumos-gate@539eed8a409366837ae95576ca22df010f901134 Modified: vendor/illumos/dist/cmd/ztest/ztest.c Modified: vendor/illumos/dist/cmd/ztest/ztest.c ============================================================================== --- vendor/illumos/dist/cmd/ztest/ztest.c Sat Aug 2 05:19:33 2014 (r269425) +++ vendor/illumos/dist/cmd/ztest/ztest.c Sat Aug 2 06:33:58 2014 (r269426) @@ -170,7 +170,7 @@ static const ztest_shared_opts_t ztest_o .zo_mirrors = 2, .zo_raidz = 4, .zo_raidz_parity = 1, - .zo_vdev_size = SPA_MINDEVSIZE, + .zo_vdev_size = SPA_MINDEVSIZE * 2, .zo_datasets = 7, .zo_threads = 23, .zo_passtime = 60, /* 60 seconds */ From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 06:49:17 2014 Return-Path: Delivered-To: svn-src-all@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 18D0ACA0; Sat, 2 Aug 2014 06:49:17 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE26023E9; Sat, 2 Aug 2014 06:49:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s726nGT7082133; Sat, 2 Aug 2014 06:49:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s726nG9n082131; Sat, 2 Aug 2014 06:49:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020649.s726nG9n082131@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 06:49:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r269427 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 06:49:17 -0000 Author: delphij Date: Sat Aug 2 06:49:16 2014 New Revision: 269427 URL: http://svnweb.freebsd.org/changeset/base/269427 Log: Author: Justin T. Gibbs Date: Fri Aug 1 17:55:38 2014 -0800 5038 Remove "old-style" flexible array usage in ZFS. Reviewed by: Matthew Ahrens Reviewed by: Josef 'Jeff' Sipek Approved by: Richard Lowe illumos/illumos-gate@7f18da4c54210b682e105b0e7be5195c60f98d20 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sat Aug 2 06:33:58 2014 (r269426) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dnode.c Sat Aug 2 06:49:16 2014 (r269427) @@ -1021,7 +1021,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *a dnh->dnh_dnode = NULL; } kmem_free(children_dnodes, sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t)); + epb * sizeof (dnode_handle_t)); } /* @@ -1106,7 +1106,7 @@ dnode_hold_impl(objset_t *os, uint64_t o int i; dnode_children_t *winner; children_dnodes = kmem_alloc(sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP); + epb * sizeof (dnode_handle_t), KM_SLEEP); children_dnodes->dnc_count = epb; dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) { @@ -1121,7 +1121,7 @@ dnode_hold_impl(objset_t *os, uint64_t o } kmem_free(children_dnodes, sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t)); + epb * sizeof (dnode_handle_t)); children_dnodes = winner; } } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Sat Aug 2 06:33:58 2014 (r269426) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dnode.h Sat Aug 2 06:49:16 2014 (r269427) @@ -245,7 +245,7 @@ typedef struct dnode_handle { typedef struct dnode_children { size_t dnc_count; /* number of children */ - dnode_handle_t dnc_children[1]; /* sized dynamically */ + dnode_handle_t dnc_children[]; /* sized dynamically */ } dnode_children_t; typedef struct free_range { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 06:55:37 2014 Return-Path: Delivered-To: svn-src-all@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 DB636EED; Sat, 2 Aug 2014 06:55:36 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8AAD2496; Sat, 2 Aug 2014 06:55:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s726taCE086366; Sat, 2 Aug 2014 06:55:36 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s726tagq086363; Sat, 2 Aug 2014 06:55:36 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408020655.s726tagq086363@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 2 Aug 2014 06:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269428 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 06:55:37 -0000 Author: np Date: Sat Aug 2 06:55:36 2014 New Revision: 269428 URL: http://svnweb.freebsd.org/changeset/base/269428 Log: cxgbe(4): some optimizations in freelist handling. MFC after: 2 weeks. Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Aug 2 06:49:16 2014 (r269427) +++ head/sys/dev/cxgbe/adapter.h Sat Aug 2 06:55:36 2014 (r269428) @@ -444,43 +444,55 @@ enum { FL_STARVING = (1 << 0), /* on the adapter's list of starving fl's */ FL_DOOMED = (1 << 1), /* about to be destroyed */ FL_BUF_PACKING = (1 << 2), /* buffer packing enabled */ + FL_BUF_RESUME = (1 << 3), /* resume from the middle of the frame */ }; -#define FL_RUNNING_LOW(fl) (fl->cap - fl->needed <= fl->lowat) -#define FL_NOT_RUNNING_LOW(fl) (fl->cap - fl->needed >= 2 * fl->lowat) +#define FL_RUNNING_LOW(fl) \ + (IDXDIFF(fl->dbidx * 8, fl->cidx, fl->sidx * 8) <= fl->lowat) +#define FL_NOT_RUNNING_LOW(fl) \ + (IDXDIFF(fl->dbidx * 8, fl->cidx, fl->sidx * 8) >= 2 * fl->lowat) struct sge_fl { - bus_dma_tag_t desc_tag; - bus_dmamap_t desc_map; - struct cluster_layout cll_def; /* default refill zone, layout */ - struct cluster_layout cll_alt; /* alternate refill zone, layout */ struct mtx fl_lock; - char lockname[16]; - int flags; - __be64 *desc; /* KVA of descriptor ring, ptr to addresses */ - bus_addr_t ba; /* bus address of descriptor ring */ struct fl_sdesc *sdesc; /* KVA of software descriptor ring */ - uint32_t cap; /* max # of buffers, for convenience */ - uint16_t qsize; /* size (# of entries) of the queue */ - uint16_t cntxt_id; /* SGE context id for the freelist */ - uint32_t cidx; /* consumer idx (buffer idx, NOT hw desc idx) */ - uint32_t rx_offset; /* offset in fl buf (when buffer packing) */ - uint32_t pidx; /* producer idx (buffer idx, NOT hw desc idx) */ - uint32_t needed; /* # of buffers needed to fill up fl. */ - uint32_t lowat; /* # of buffers <= this means fl needs help */ - uint32_t pending; /* # of bufs allocated since last doorbell */ - TAILQ_ENTRY(sge_fl) link; /* All starving freelists */ + struct cluster_layout cll_def; /* default refill zone, layout */ + uint16_t lowat; /* # of buffers <= this means fl needs help */ + int flags; + uint16_t buf_boundary; - struct mbuf *m0; - struct mbuf **pnext; - u_int remaining; + /* The 16b idx all deal with hw descriptors */ + uint16_t dbidx; /* hw pidx after last doorbell */ + uint16_t sidx; /* index of status page */ + volatile uint16_t hw_cidx; + + /* The 32b idx are all buffer idx, not hardware descriptor idx */ + uint32_t cidx; /* consumer index */ + uint32_t pidx; /* producer index */ + + uint32_t dbval; + u_int rx_offset; /* offset in fl buf (when buffer packing) */ + volatile uint32_t *udb; uint64_t mbuf_allocated;/* # of mbuf allocated from zone_mbuf */ uint64_t mbuf_inlined; /* # of mbuf created within clusters */ uint64_t cl_allocated; /* # of clusters allocated */ uint64_t cl_recycled; /* # of clusters recycled */ uint64_t cl_fast_recycled; /* # of clusters recycled (fast) */ + + /* These 3 are valid when FL_BUF_RESUME is set, stale otherwise. */ + struct mbuf *m0; + struct mbuf **pnext; + u_int remaining; + + uint16_t qsize; /* # of hw descriptors (status page included) */ + uint16_t cntxt_id; /* SGE context id for the freelist */ + TAILQ_ENTRY(sge_fl) link; /* All starving freelists */ + bus_dma_tag_t desc_tag; + bus_dmamap_t desc_map; + char lockname[16]; + bus_addr_t ba; /* bus address of descriptor ring */ + struct cluster_layout cll_alt; /* alternate refill zone, layout */ }; /* txq: SGE egress queue + what's needed for Ethernet NIC */ @@ -848,11 +860,11 @@ struct adapter { for (q = &pi->adapter->sge.nm_rxq[pi->first_nm_rxq], iter = 0; \ iter < pi->nnmrxq; ++iter, ++q) -#define IDXINCR(head, incr, wrap) do { \ - head = wrap - head > incr ? head + incr : incr - (wrap - head); \ +#define IDXINCR(idx, incr, wrap) do { \ + idx = wrap - idx > incr ? idx + incr : incr - (wrap - idx); \ } while (0) #define IDXDIFF(head, tail, wrap) \ - (head >= tail ? head - tail : wrap - tail + head) + ((head) >= (tail) ? (head) - (tail) : (wrap) - (tail) + (head)) /* One for errors, one for firmware events */ #define T4_EXTRA_INTR 2 Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Aug 2 06:49:16 2014 (r269427) +++ head/sys/dev/cxgbe/t4_sge.c Sat Aug 2 06:55:36 2014 (r269428) @@ -172,8 +172,7 @@ struct sgl { }; static int service_iq(struct sge_iq *, int); -static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t, - int *); +static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); static int t4_eth_rx(struct sge_iq *, const struct rss_header *, struct mbuf *); static inline void init_iq(struct sge_iq *, struct adapter *, int, int, int); static inline void init_fl(struct adapter *, struct sge_fl *, int, int, int, @@ -1313,22 +1312,31 @@ service_iq(struct sge_iq *iq, int budget { struct sge_iq *q; struct sge_rxq *rxq = iq_to_rxq(iq); /* Use iff iq is part of rxq */ - struct sge_fl *fl = &rxq->fl; /* Use iff IQ_HAS_FL */ + struct sge_fl *fl; /* Use iff IQ_HAS_FL */ struct adapter *sc = iq->adapter; struct iq_desc *d = &iq->desc[iq->cidx]; - int ndescs = 0, limit, fl_bufs_used = 0; - int rsp_type; + int ndescs = 0, limit; + int rsp_type, refill; uint32_t lq; + uint16_t fl_hw_cidx; struct mbuf *m0; STAILQ_HEAD(, sge_iq) iql = STAILQ_HEAD_INITIALIZER(iql); #if defined(INET) || defined(INET6) const struct timeval lro_timeout = {0, sc->lro_timeout}; #endif - limit = budget ? budget : iq->qsize / 8; - KASSERT(iq->state == IQS_BUSY, ("%s: iq %p not BUSY", __func__, iq)); + limit = budget ? budget : iq->qsize / 16; + + if (iq->flags & IQ_HAS_FL) { + fl = &rxq->fl; + fl_hw_cidx = fl->hw_cidx; /* stable snapshot */ + } else { + fl = NULL; + fl_hw_cidx = 0; /* to silence gcc warning */ + } + /* * We always come back and check the descriptor ring for new indirect * interrupts and other responses after running a single handler. @@ -1338,6 +1346,7 @@ service_iq(struct sge_iq *iq, int budget rmb(); + refill = 0; m0 = NULL; rsp_type = G_RSPD_TYPE(d->rsp.u.type_gen); lq = be32toh(d->rsp.pldbuflen_qid); @@ -1349,9 +1358,10 @@ service_iq(struct sge_iq *iq, int budget ("%s: data for an iq (%p) with no freelist", __func__, iq)); - m0 = get_fl_payload(sc, fl, lq, &fl_bufs_used); + m0 = get_fl_payload(sc, fl, lq); if (__predict_false(m0 == NULL)) goto process_iql; + refill = IDXDIFF(fl->hw_cidx, fl_hw_cidx, fl->sidx) > 2; #ifdef T4_PKT_TIMESTAMP /* * 60 bit timestamp for the payload is @@ -1402,7 +1412,7 @@ service_iq(struct sge_iq *iq, int budget q = sc->sge.iqmap[lq - sc->sge.iq_start]; if (atomic_cmpset_int(&q->state, IQS_IDLE, IQS_BUSY)) { - if (service_iq(q, q->qsize / 8) == 0) { + if (service_iq(q, q->qsize / 16) == 0) { atomic_cmpset_int(&q->state, IQS_BUSY, IQS_IDLE); } else { @@ -1422,14 +1432,6 @@ service_iq(struct sge_iq *iq, int budget break; } - if (fl_bufs_used >= 16) { - FL_LOCK(fl); - fl->needed += fl_bufs_used; - refill_fl(sc, fl, 32); - FL_UNLOCK(fl); - fl_bufs_used = 0; - } - d++; if (__predict_false(++iq->cidx == iq->sidx)) { iq->cidx = 0; @@ -1452,15 +1454,20 @@ service_iq(struct sge_iq *iq, int budget #endif if (budget) { - if (fl_bufs_used) { + if (iq->flags & IQ_HAS_FL) { FL_LOCK(fl); - fl->needed += fl_bufs_used; refill_fl(sc, fl, 32); FL_UNLOCK(fl); } return (EINPROGRESS); } } + if (refill) { + FL_LOCK(fl); + refill_fl(sc, fl, 32); + FL_UNLOCK(fl); + fl_hw_cidx = fl->hw_cidx; + } } process_iql: @@ -1499,7 +1506,6 @@ process_iql: int starved; FL_LOCK(fl); - fl->needed += fl_bufs_used; starved = refill_fl(sc, fl, 64); FL_UNLOCK(fl); if (__predict_false(starved != 0)) @@ -1566,7 +1572,7 @@ get_scatter_segment(struct adapter *sc, caddr_t payload; len = min(total, hwb->size - fl->rx_offset); - padded_len = roundup2(len, fl_pad); + padded_len = roundup2(len, fl->buf_boundary); payload = sd->cl + cll->region1 + fl->rx_offset; if (sc->sc_do_rxcopy && len < RX_COPY_THRESHOLD) { @@ -1632,38 +1638,32 @@ get_scatter_segment(struct adapter *sc, m->m_len = len; if (fl->flags & FL_BUF_PACKING) { - fl->rx_offset += roundup2(padded_len, sc->sge.pack_boundary); + fl->rx_offset += padded_len; MPASS(fl->rx_offset <= hwb->size); if (fl->rx_offset < hwb->size) return (m); /* without advancing the cidx */ } - if (__predict_false(++fl->cidx == fl->cap)) - fl->cidx = 0; + if (__predict_false(++fl->cidx % 8 == 0)) { + uint16_t cidx = fl->cidx / 8; + + if (__predict_false(cidx == fl->sidx)) + fl->cidx = cidx = 0; + fl->hw_cidx = cidx; + } fl->rx_offset = 0; return (m); } static struct mbuf * -get_fl_payload(struct adapter *sc, struct sge_fl *fl, uint32_t len_newbuf, - int *fl_bufs_used) +get_fl_payload(struct adapter *sc, struct sge_fl *fl, uint32_t len_newbuf) { struct mbuf *m0, *m, **pnext; - u_int nbuf, len; + u_int len; - /* - * No assertion for the fl lock because we don't need it. This routine - * is called only from the rx interrupt handler and it only updates - * fl->cidx. (Contrast that with fl->pidx/fl->needed which could be - * updated in the rx interrupt handler or the starvation helper routine. - * That's why code that manipulates fl->pidx/fl->needed needs the fl - * lock but this routine does not). - */ - - nbuf = 0; len = G_RSPD_LEN(len_newbuf); - if (__predict_false(fl->m0 != NULL)) { + if (__predict_false(fl->flags & FL_BUF_RESUME)) { M_ASSERTPKTHDR(fl->m0); MPASS(len == fl->m0->m_pkthdr.len); MPASS(fl->remaining < len); @@ -1671,15 +1671,19 @@ get_fl_payload(struct adapter *sc, struc m0 = fl->m0; pnext = fl->pnext; len = fl->remaining; - fl->m0 = NULL; + fl->flags &= ~FL_BUF_RESUME; goto get_segment; } if (fl->rx_offset > 0 && len_newbuf & F_RSPD_NEWBUF) { - nbuf++; fl->rx_offset = 0; - if (__predict_false(++fl->cidx == fl->cap)) - fl->cidx = 0; + if (__predict_false(++fl->cidx % 8 == 0)) { + uint16_t cidx = fl->cidx / 8; + + if (__predict_false(cidx == fl->sidx)) + fl->cidx = cidx = 0; + fl->hw_cidx = cidx; + } } /* @@ -1689,30 +1693,26 @@ get_fl_payload(struct adapter *sc, struc m0 = get_scatter_segment(sc, fl, len, M_PKTHDR); if (m0 == NULL) - goto done; + return (NULL); len -= m0->m_len; pnext = &m0->m_next; while (len > 0) { - nbuf++; get_segment: MPASS(fl->rx_offset == 0); m = get_scatter_segment(sc, fl, len, 0); - if (m == NULL) { + if (__predict_false(m == NULL)) { fl->m0 = m0; fl->pnext = pnext; fl->remaining = len; - m0 = NULL; - goto done; + fl->flags |= FL_BUF_RESUME; + return (NULL); } *pnext = m; pnext = &m->m_next; len -= m->m_len; } *pnext = NULL; - if (fl->rx_offset == 0) - nbuf++; -done: - (*fl_bufs_used) += nbuf; + return (m0); } @@ -2126,6 +2126,7 @@ init_fl(struct adapter *sc, struct sge_f { fl->qsize = qsize; + fl->sidx = qsize - spg_len / EQ_ESIZE; strlcpy(fl->lockname, name, sizeof(fl->lockname)); if (pack) fl->flags |= FL_BUF_PACKING; @@ -2266,7 +2267,6 @@ alloc_iq_fl(struct port_info *pi, struct return (rc); /* Allocate space for one software descriptor per buffer. */ - fl->cap = (fl->qsize - spg_len / EQ_ESIZE) * 8; rc = alloc_fl_sdesc(fl); if (rc != 0) { device_printf(sc->dev, @@ -2274,10 +2274,14 @@ alloc_iq_fl(struct port_info *pi, struct rc); return (rc); } - fl->needed = fl->cap; - fl->lowat = fl->flags & FL_BUF_PACKING ? - roundup2(sc->sge.fl_starve_threshold2, 8) : - roundup2(sc->sge.fl_starve_threshold, 8); + + if (fl->flags & FL_BUF_PACKING) { + fl->lowat = roundup2(sc->sge.fl_starve_threshold2, 8); + fl->buf_boundary = max(fl_pad, sc->sge.pack_boundary); + } else { + fl->lowat = roundup2(sc->sge.fl_starve_threshold, 8); + fl->buf_boundary = fl_pad; + } c.iqns_to_fl0congen |= htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) | @@ -2320,6 +2324,9 @@ alloc_iq_fl(struct port_info *pi, struct sc->sge.iqmap[cntxt_id] = iq; if (fl) { + u_int qid; + + iq->flags |= IQ_HAS_FL; fl->cntxt_id = be16toh(c.fl0id); fl->pidx = fl->cidx = 0; @@ -2330,12 +2337,29 @@ alloc_iq_fl(struct port_info *pi, struct } sc->sge.eqmap[cntxt_id] = (void *)fl; + qid = fl->cntxt_id; + if (isset(&sc->doorbells, DOORBELL_UDB)) { + uint32_t s_qpp = sc->sge.eq_s_qpp; + uint32_t mask = (1 << s_qpp) - 1; + volatile uint8_t *udb; + + udb = sc->udbs_base + UDBS_DB_OFFSET; + udb += (qid >> s_qpp) << PAGE_SHIFT; + qid &= mask; + if (qid < PAGE_SIZE / UDBS_SEG_SIZE) { + udb += qid << UDBS_SEG_SHIFT; + qid = 0; + } + fl->udb = (volatile void *)udb; + } + fl->dbval = F_DBPRIO | V_QID(qid); + if (is_t5(sc)) + fl->dbval |= F_DBTYPE; + FL_LOCK(fl); /* Enough to make sure the SGE doesn't think it's starved */ refill_fl(sc, fl, fl->lowat); FL_UNLOCK(fl); - - iq->flags |= IQ_HAS_FL; } if (is_t5(sc) && cong >= 0) { @@ -2545,8 +2569,12 @@ alloc_rxq(struct port_info *pi, struct s if (rc != 0) return (rc); + /* + * The freelist is just barely above the starvation threshold right now, + * fill it up a bit more. + */ FL_LOCK(&rxq->fl); - refill_fl(pi->adapter, &rxq->fl, rxq->fl.needed / 8); + refill_fl(pi->adapter, &rxq->fl, 128); FL_UNLOCK(&rxq->fl); #if defined(INET) || defined(INET6) @@ -3213,53 +3241,60 @@ oneseg_dma_callback(void *arg, bus_dma_s *ba = error ? 0 : segs->ds_addr; } -#define FL_HW_IDX(x) ((x) >> 3) static inline void ring_fl_db(struct adapter *sc, struct sge_fl *fl) { - int ndesc = fl->pending / 8; - uint32_t v; - - if (FL_HW_IDX(fl->pidx) == FL_HW_IDX(fl->cidx)) - ndesc--; /* hold back one credit */ - - if (ndesc <= 0) - return; /* nothing to do */ + uint32_t n, v; - v = F_DBPRIO | V_QID(fl->cntxt_id) | V_PIDX(ndesc); - if (is_t5(sc)) - v |= F_DBTYPE; + n = IDXDIFF(fl->pidx / 8, fl->dbidx, fl->sidx); + MPASS(n > 0); wmb(); - - t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), v); - fl->pending -= ndesc * 8; + v = fl->dbval | V_PIDX(n); + if (fl->udb) + *fl->udb = htole32(v); + else + t4_write_reg(sc, MYPF_REG(A_SGE_PF_KDOORBELL), v); + IDXINCR(fl->dbidx, n, fl->sidx); } /* - * Fill up the freelist by upto nbufs and maybe ring its doorbell. + * Fills up the freelist by allocating upto 'n' buffers. Buffers that are + * recycled do not count towards this allocation budget. * - * Returns non-zero to indicate that it should be added to the list of starving - * freelists. + * Returns non-zero to indicate that this freelist should be added to the list + * of starving freelists. */ static int -refill_fl(struct adapter *sc, struct sge_fl *fl, int nbufs) +refill_fl(struct adapter *sc, struct sge_fl *fl, int n) { - __be64 *d = &fl->desc[fl->pidx]; - struct fl_sdesc *sd = &fl->sdesc[fl->pidx]; + __be64 *d; + struct fl_sdesc *sd; uintptr_t pa; caddr_t cl; - struct cluster_layout *cll = &fl->cll_def; /* default layout */ - struct sw_zone_info *swz = &sc->sge.sw_zone_info[cll->zidx]; + struct cluster_layout *cll; + struct sw_zone_info *swz; struct cluster_metadata *clm; + uint16_t max_pidx; + uint16_t hw_cidx = fl->hw_cidx; /* stable snapshot */ FL_LOCK_ASSERT_OWNED(fl); - if (nbufs > fl->needed) - nbufs = fl->needed; - nbufs -= (fl->pidx + nbufs) % 8; + /* + * We always stop at the begining of the hardware descriptor that's just + * before the one with the hw cidx. This is to avoid hw pidx = hw cidx, + * which would mean an empty freelist to the chip. + */ + max_pidx = __predict_false(hw_cidx == 0) ? fl->sidx - 1 : hw_cidx - 1; + if (fl->pidx == max_pidx * 8) + return (0); + + d = &fl->desc[fl->pidx]; + sd = &fl->sdesc[fl->pidx]; + cll = &fl->cll_def; /* default layout */ + swz = &sc->sge.sw_zone_info[cll->zidx]; - while (nbufs--) { + while (n > 0) { if (sd->cl != NULL) { @@ -3309,6 +3344,7 @@ alloc: goto alloc; } fl->cl_allocated++; + n--; pa = pmap_kextract((vm_offset_t)cl); pa += cll->region1; @@ -3325,18 +3361,26 @@ recycled: } sd->nmbuf = 0; recycled_fast: - fl->pending++; - fl->needed--; d++; sd++; - if (__predict_false(++fl->pidx == fl->cap)) { - fl->pidx = 0; - sd = fl->sdesc; - d = fl->desc; + if (__predict_false(++fl->pidx % 8 == 0)) { + uint16_t pidx = fl->pidx / 8; + + if (__predict_false(pidx == fl->sidx)) { + fl->pidx = 0; + pidx = 0; + sd = fl->sdesc; + d = fl->desc; + } + if (pidx == max_pidx) + break; + + if (IDXDIFF(pidx, fl->dbidx, fl->sidx) >= 4) + ring_fl_db(sc, fl); } } - if (fl->pending >= 8) + if (fl->pidx / 8 != fl->dbidx) ring_fl_db(sc, fl); return (FL_RUNNING_LOW(fl) && !(fl->flags & FL_STARVING)); @@ -3371,7 +3415,7 @@ static int alloc_fl_sdesc(struct sge_fl *fl) { - fl->sdesc = malloc(fl->cap * sizeof(struct fl_sdesc), M_CXGBE, + fl->sdesc = malloc(fl->sidx * 8 * sizeof(struct fl_sdesc), M_CXGBE, M_ZERO | M_WAITOK); return (0); @@ -3386,7 +3430,7 @@ free_fl_sdesc(struct adapter *sc, struct int i; sd = fl->sdesc; - for (i = 0; i < fl->cap; i++, sd++) { + for (i = 0; i < fl->sidx * 8; i++, sd++) { if (sd->cl == NULL) continue; From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 06:56:00 2014 Return-Path: Delivered-To: svn-src-all@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 8D882C6; Sat, 2 Aug 2014 06: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B14824A0; Sat, 2 Aug 2014 06:56:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s726u0TN086466; Sat, 2 Aug 2014 06:56:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s726u0Ll086464; Sat, 2 Aug 2014 06:56:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201408020656.s726u0Ll086464@svn.freebsd.org> From: Alexander Motin Date: Sat, 2 Aug 2014 06:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269429 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 06:56:00 -0000 Author: mav Date: Sat Aug 2 06:56:00 2014 New Revision: 269429 URL: http://svnweb.freebsd.org/changeset/base/269429 Log: MFC r269123: Implement separate I/O dispatch method for ZVOLs in "dev" mode. Unlike disk devices ZVOLs process all requests synchronously. That makes impossible sending multiple requests to them from single thread. From the other side ZVOLs have real d_read/d_write methods, which unlike d_strategy can handle uio scatter/gather and have no strict I/O size limitations. So, if ZVOL in "dev" mode is detected, use of d_read/d_write methods instead of d_strategy allows to avoid pointless splitting of large requests into MAXPHYS (128K) sized chunks. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Sat Aug 2 06:55:36 2014 (r269428) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Sat Aug 2 06:56:00 2014 (r269429) @@ -741,6 +741,88 @@ ctl_be_block_dispatch_file(struct ctl_be } static void +ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, + struct ctl_be_block_io *beio) +{ + struct ctl_be_block_devdata *dev_data; + union ctl_io *io; + struct uio xuio; + struct iovec *xiovec; + int flags; + int error, i; + + DPRINTF("entered\n"); + + dev_data = &be_lun->backend.dev; + io = beio->io; + flags = beio->bio_flags; + + bzero(&xuio, sizeof(xuio)); + if (beio->bio_cmd == BIO_READ) { + SDT_PROBE(cbb, kernel, read, file_start, 0, 0, 0, 0, 0); + xuio.uio_rw = UIO_READ; + } else { + SDT_PROBE(cbb, kernel, write, file_start, 0, 0, 0, 0, 0); + xuio.uio_rw = UIO_WRITE; + } + xuio.uio_offset = beio->io_offset; + xuio.uio_resid = beio->io_len; + xuio.uio_segflg = UIO_SYSSPACE; + xuio.uio_iov = beio->xiovecs; + xuio.uio_iovcnt = beio->num_segs; + xuio.uio_td = curthread; + + for (i = 0, xiovec = xuio.uio_iov; i < xuio.uio_iovcnt; i++, xiovec++) { + xiovec->iov_base = beio->sg_segs[i].addr; + xiovec->iov_len = beio->sg_segs[i].len; + } + + binuptime(&beio->ds_t0); + mtx_lock(&be_lun->io_lock); + devstat_start_transaction(beio->lun->disk_stats, &beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + + if (beio->bio_cmd == BIO_READ) { + error = (*dev_data->csw->d_read)(dev_data->cdev, &xuio, 0); + SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0); + } else { + error = (*dev_data->csw->d_write)(dev_data->cdev, &xuio, 0); + SDT_PROBE(cbb, kernel, write, file_done, 0, 0, 0, 0, 0); + } + + mtx_lock(&be_lun->io_lock); + devstat_end_transaction(beio->lun->disk_stats, beio->io_len, + beio->ds_tag_type, beio->ds_trans_type, + /*now*/ NULL, /*then*/&beio->ds_t0); + mtx_unlock(&be_lun->io_lock); + + /* + * If we got an error, set the sense data to "MEDIUM ERROR" and + * return the I/O to the user. + */ + if (error != 0) { + ctl_set_medium_error(&io->scsiio); + ctl_complete_beio(beio); + return; + } + + /* + * If this is a write or a verify, we're all done. + * If this is a read, we can now send the data to the user. + */ + if ((beio->bio_cmd == BIO_WRITE) || + (ARGS(io)->flags & CTL_LLF_VERIFY)) { + ctl_set_success(&io->scsiio); + ctl_complete_beio(beio); + } else { +#ifdef CTL_TIME_IO + getbintime(&io->io_hdr.dma_start_bt); +#endif + ctl_datamove(io); + } +} + +static void ctl_be_block_flush_dev(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { @@ -1581,14 +1663,17 @@ ctl_be_block_open_dev(struct ctl_be_bloc params = &req->reqdata.create; be_lun->dev_type = CTL_BE_BLOCK_DEV; - be_lun->dispatch = ctl_be_block_dispatch_dev; - be_lun->lun_flush = ctl_be_block_flush_dev; - be_lun->unmap = ctl_be_block_unmap_dev; be_lun->backend.dev.cdev = be_lun->vn->v_rdev; be_lun->backend.dev.csw = dev_refthread(be_lun->backend.dev.cdev, &be_lun->backend.dev.dev_ref); if (be_lun->backend.dev.csw == NULL) panic("Unable to retrieve device switch"); + if (strcmp(be_lun->backend.dev.csw->d_name, "zvol") == 0) + be_lun->dispatch = ctl_be_block_dispatch_zvol; + else + be_lun->dispatch = ctl_be_block_dispatch_dev; + be_lun->lun_flush = ctl_be_block_flush_dev; + be_lun->unmap = ctl_be_block_unmap_dev; error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 07:44:48 2014 Return-Path: Delivered-To: svn-src-all@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 15150B19; Sat, 2 Aug 2014 07:44:48 +0000 (UTC) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EE1DB2D10; Sat, 2 Aug 2014 07:44:47 +0000 (UTC) Received: from delphij-macbook.local (unknown [IPv6:2001:470:83bf:0:4d5e:b0a6:7ed2:e5b2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 857FDAAD4; Sat, 2 Aug 2014 00:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1406965481; x=1406979881; bh=NuMF7hge1WMefia7X4HGCdRMHCEQIm5GsGKAinWLlgU=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=J9oqFUplZ+M1P+yrZaBd9XGHBswNX/KI06X31cpP8+dJQW95eTZ/L1RsrF6g9cWKc 8IKYePmXEMr3tSNy0MV4sXi69MMOSInf1rAjAG+9CLcGWFmQX3EpTAEDs6oUUH1KFh CRQSiY7orzJVqJhp1w1jsYKJ+eJisCz+IUZcY7b8= Message-ID: <53DC96E9.9020805@delphij.net> Date: Sat, 02 Aug 2014 00:44:41 -0700 From: Xin Li Reply-To: d@delphij.net Organization: The FreeBSD Project MIME-Version: 1.0 To: "Justin T. Gibbs" , Xin LI Subject: Re: svn commit: r269404 - head/sys/cddl/compat/opensolaris/sys References: <201408012233.s71MXNIx051919@svn.freebsd.org> <57D656EF-5D6B-428B-9DCE-7FA360B1407F@scsiguy.com> In-Reply-To: <57D656EF-5D6B-428B-9DCE-7FA360B1407F@scsiguy.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "mav >> Alexander Motin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 07:44:48 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 8/1/14 8:59 PM, Justin T. Gibbs wrote: > On Aug 1, 2014, at 4:33 PM, Xin LI wrote: > >> Author: delphij Date: Fri Aug 1 22:33:23 2014 New Revision: >> 269404 URL: http://svnweb.freebsd.org/changeset/base/269404 >> >> Log: Split gethrtime() and gethrtime_waitfree() and make the >> former use nanouptime() instead of getnanouptime(). >> nanouptime(9) provides more precise result at expense of being >> slower. >> >> In r269223, gethrtime() is used as creation time of dbuf, which >> in turn acts as portion of lookup key to maintain AVL invariant >> where there can not be duplicate items. Before this change, >> gethrtime() have preferred better execution time by sacrificing >> precision, which may lead to panic on busy systems with: >> >> panic: avl_find() succeeded inside avl_add() > > I don’t believe that r269223 requires a temporal ordering of the > dbufs in the AVL, just unique entries. So why use an expensive > operation like getting high resolution time? Can’t we just use a > PCPU counter and tag the dbufs with "CPU# << 48 | PCPU_counter”? What do you think about D521? (Alexander suggested similar implementation). https://phabric.freebsd.org/D521 Cheers, -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJT3JboAAoJEJW2GBstM+nsq7wP/j+QfLnkTVTIgFWk15L2haeo V6lPD2GwjggxGn50S9+POOiB1V4kZwTEydkEJ+4vMXkH+Evke5p0eYObF7Ye1ejc UqprnIuEK3N63YkbX2tNkIX22zCJd5KKvnHjWd7IR88c2XT2doPwo+o9IsaWFdrW Gn2FYr1hsw3Pi5PKytzEhc1zOpBa/kXy6gy9ZDOjBCnUXjL6v29GlOa5L+VLCOtG mGpiVdWl18unLW+x0uoT4AfDVeyNYJGIDMzzV5OBtLp14fcDCcWPswwpq4VMDdrf ZWLarOahwpjD7eO9MHFMXgtrZVzj7qY3xXJJDsiNWv109TwOvHx9NmYAVtP3CT3g T5QrkXJzuWJlIsBAX1bHtdLMRRAdSTDN8q9XE3r+2TJ1NUpazEEkA7iRpXLrlvbP rEyFGjr3CEKdGQXMdGx3kpqgqYLRAdo3MdXQIXU/OpWY3CAqm82ljQtqHmfuDHO1 Kb5rcqLxApKaxGqoq7GnZH5vHfrU9ulaYBBTykV3PyCGV5A4p4FWUJBUaS/FaKZv +w53o87L+LRPniyPU5V6i18I/M2X3mIGzUCv+i5oK7ac0O5hMOkORXVs8KTiQ7DG zCzw2eUG26cDGDGPzpixvVKPBKqFTDROQIttmtm5x234zESFINtS534Hdl+XAsDh zSVHaNCcebZ0RYiphbd3 =fb7k -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 07:47:53 2014 Return-Path: Delivered-To: svn-src-all@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 88097C88; Sat, 2 Aug 2014 07:47: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 767B52D2B; Sat, 2 Aug 2014 07:47:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s727lrxT011469; Sat, 2 Aug 2014 07:47:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s727lrPU011468; Sat, 2 Aug 2014 07:47:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020747.s727lrPU011468@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 07:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269430 - head/cddl/contrib/opensolaris/cmd/ztest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 07:47:53 -0000 Author: delphij Date: Sat Aug 2 07:47:52 2014 New Revision: 269430 URL: http://svnweb.freebsd.org/changeset/base/269430 Log: MFV r269426: Double test device size for ztest(1). Illumos issue: 5039 ztest should default to larger device sizes Author: Matthew Ahrens MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Aug 2 06:56:00 2014 (r269429) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sat Aug 2 07:47:52 2014 (r269430) @@ -172,7 +172,7 @@ static const ztest_shared_opts_t ztest_o .zo_mirrors = 2, .zo_raidz = 4, .zo_raidz_parity = 1, - .zo_vdev_size = SPA_MINDEVSIZE, + .zo_vdev_size = SPA_MINDEVSIZE * 2, .zo_datasets = 7, .zo_threads = 23, .zo_passtime = 60, /* 60 seconds */ From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 07:52:17 2014 Return-Path: Delivered-To: svn-src-all@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 1A0DFEB7; Sat, 2 Aug 2014 07:52:17 +0000 (UTC) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D32C72EED; Sat, 2 Aug 2014 07:52:16 +0000 (UTC) Received: from [192.168.0.61] (jt-mbp.home.scsiguy.org [192.168.0.61]) (authenticated bits=0) by aslan.scsiguy.com (8.14.8/8.14.8) with ESMTP id s727q9Cn017947 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sat, 2 Aug 2014 01:52:10 -0600 (MDT) (envelope-from gibbs@scsiguy.com) Content-Type: multipart/signed; boundary="Apple-Mail=_E8F869C3-89C8-4548-ADEE-570FA3BAEF62"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269404 - head/sys/cddl/compat/opensolaris/sys From: "Justin T. Gibbs" In-Reply-To: <53DC96E9.9020805@delphij.net> Date: Sat, 2 Aug 2014 01:51:56 -0600 Message-Id: References: <201408012233.s71MXNIx051919@svn.freebsd.org> <57D656EF-5D6B-428B-9DCE-7FA360B1407F@scsiguy.com> <53DC96E9.9020805@delphij.net> To: d@delphij.net X-Mailer: Apple Mail (2.1878.6) X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI , "mav >> Alexander Motin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 07:52:17 -0000 --Apple-Mail=_E8F869C3-89C8-4548-ADEE-570FA3BAEF62 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Aug 2, 2014, at 1:44 AM, Xin Li wrote: > Signed PGP part > On 8/1/14 8:59 PM, Justin T. Gibbs wrote: > > On Aug 1, 2014, at 4:33 PM, Xin LI wrote: > > > >> Author: delphij Date: Fri Aug 1 22:33:23 2014 New Revision: > >> 269404 URL: http://svnweb.freebsd.org/changeset/base/269404 > >> > >> Log: Split gethrtime() and gethrtime_waitfree() and make the > >> former use nanouptime() instead of getnanouptime(). > >> nanouptime(9) provides more precise result at expense of being > >> slower. > >> > >> In r269223, gethrtime() is used as creation time of dbuf, which > >> in turn acts as portion of lookup key to maintain AVL invariant > >> where there can not be duplicate items. Before this change, > >> gethrtime() have preferred better execution time by sacrificing > >> precision, which may lead to panic on busy systems with: > >> > >> panic: avl_find() succeeded inside avl_add() > > > > I don=92t believe that r269223 requires a temporal ordering of the > > dbufs in the AVL, just unique entries. So why use an expensive > > operation like getting high resolution time? Can=92t we just use a > > PCPU counter and tag the dbufs with "CPU# << 48 | PCPU_counter=94? >=20 > What do you think about D521? (Alexander suggested similar > implementation). >=20 > https://phabric.freebsd.org/D521 >=20 > Cheers, Seems reasonable to me. =97 Justin --Apple-Mail=_E8F869C3-89C8-4548-ADEE-570FA3BAEF62 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 iQEcBAEBAgAGBQJT3JipAAoJED9n8CuvaSf4OrIIAIgaHjhkdbFyBf1gO7xIIeAj iV4Ylsv3spZtzF8S3QIpdKgQzCjA1FWcMnKE2DV7INWU5AnHU3vsw0UyCCefId1I nhru8VEh66L2YekUfDWPSydtJYdvhHI6oQFFh7hFjrBXgpBLdk4QwAP+IebegKYf 9DnukM4F508KldjedulqcIPPkzrXpArMxC4rFLtGXsYQGYZgM/R6Hj5mYFDFiZQB Tcf3mSE8/q9NrKiyZZFDKDdj6ta/kvLEopNiLR4d/K1fb7QBK6gVaLrNHRIZWRp5 dAJ8iFYPopj89AmyuX9eblT48lEIT7wScyyVvyi4LWGHdL0GUiCYWtTLMwtfM0U= =mJml -----END PGP SIGNATURE----- --Apple-Mail=_E8F869C3-89C8-4548-ADEE-570FA3BAEF62-- From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 08:34:23 2014 Return-Path: Delivered-To: svn-src-all@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 14328A69; Sat, 2 Aug 2014 08:34: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBE5D2233; Sat, 2 Aug 2014 08:34:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s728YMOZ034380; Sat, 2 Aug 2014 08:34:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s728YMGW034378; Sat, 2 Aug 2014 08:34:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201408020834.s728YMGW034378@svn.freebsd.org> From: Xin LI Date: Sat, 2 Aug 2014 08:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269431 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 08:34:23 -0000 Author: delphij Date: Sat Aug 2 08:34:22 2014 New Revision: 269431 URL: http://svnweb.freebsd.org/changeset/base/269431 Log: MFV r269427: In dnode_children_t, use C99's "[]" idiom for declaring the variable sized array dnc_children at the end of the structure. This prevents the compiler from mistakenly optimizing away accesses beyond the array's defined size. Illumos issue: 5038 Remove "old-style" flexible array usage in ZFS. Author: Justin T. Gibbs MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Aug 2 07:47:52 2014 (r269430) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Aug 2 08:34:22 2014 (r269431) @@ -1026,7 +1026,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *a dnh->dnh_dnode = NULL; } kmem_free(children_dnodes, sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t)); + epb * sizeof (dnode_handle_t)); } /* @@ -1111,7 +1111,7 @@ dnode_hold_impl(objset_t *os, uint64_t o int i; dnode_children_t *winner; children_dnodes = kmem_zalloc(sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP); + epb * sizeof (dnode_handle_t), KM_SLEEP); children_dnodes->dnc_count = epb; dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) { @@ -1126,7 +1126,7 @@ dnode_hold_impl(objset_t *os, uint64_t o } kmem_free(children_dnodes, sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t)); + epb * sizeof (dnode_handle_t)); children_dnodes = winner; } } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Sat Aug 2 07:47:52 2014 (r269430) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Sat Aug 2 08:34:22 2014 (r269431) @@ -245,7 +245,7 @@ typedef struct dnode_handle { typedef struct dnode_children { size_t dnc_count; /* number of children */ - dnode_handle_t dnc_children[1]; /* sized dynamically */ + dnode_handle_t dnc_children[]; /* sized dynamically */ } dnode_children_t; typedef struct free_range { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 15:05:24 2014 Return-Path: Delivered-To: svn-src-all@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 0252AD6; Sat, 2 Aug 2014 15:05:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0A6528AB; Sat, 2 Aug 2014 15:05:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72F5NnY012302; Sat, 2 Aug 2014 15:05:23 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72F5NIH012301; Sat, 2 Aug 2014 15:05:23 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201408021505.s72F5NIH012301@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 2 Aug 2014 15:05:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269432 - stable/10/etc/etc.ia64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 15:05:24 -0000 Author: marcel Date: Sat Aug 2 15:05:23 2014 New Revision: 269432 URL: http://svnweb.freebsd.org/changeset/base/269432 Log: Define both ttyu0 and ttyu1 as onifconsole. This is ideal for ia64 where the console can be on either, depending on the platform. Modified: stable/10/etc/etc.ia64/ttys Modified: stable/10/etc/etc.ia64/ttys ============================================================================== --- stable/10/etc/etc.ia64/ttys Sat Aug 2 08:34:22 2014 (r269431) +++ stable/10/etc/etc.ia64/ttys Sat Aug 2 15:05:23 2014 (r269432) @@ -41,8 +41,8 @@ ttyv7 "/usr/libexec/getty Pc" xterm off ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals. The 'dialup' keyword identifies dialin lines to login, # fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 on secure -ttyu1 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty std.9600" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty std.9600" vt100 onifconsole secure ttyu2 "/usr/libexec/getty std.9600" dialup off secure ttyu3 "/usr/libexec/getty std.9600" dialup off secure # Dumb console From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 16:10:26 2014 Return-Path: Delivered-To: svn-src-all@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 03E49D9D; Sat, 2 Aug 2014 16:10: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA65F2FE5; Sat, 2 Aug 2014 16:10:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72GAP9R040973; Sat, 2 Aug 2014 16:10:25 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72GAPAd040967; Sat, 2 Aug 2014 16:10:25 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201408021610.s72GAPAd040967@svn.freebsd.org> From: Alan Cox Date: Sat, 2 Aug 2014 16:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269433 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 16:10:26 -0000 Author: alc Date: Sat Aug 2 16:10:24 2014 New Revision: 269433 URL: http://svnweb.freebsd.org/changeset/base/269433 Log: Handle wiring failures in vm_map_wire() with the new functions pmap_unwire() and vm_object_unwire(). Retire vm_fault_{un,}wire(), since they are no longer used. (See r268327 and r269134 for the motivation behind this change.) Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_extern.h head/sys/vm/vm_fault.c head/sys/vm/vm_map.c Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Sat Aug 2 15:05:23 2014 (r269432) +++ head/sys/vm/vm_extern.h Sat Aug 2 16:10:24 2014 (r269433) @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse int fault_flags, vm_page_t *m_hold); int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, vm_prot_t prot, vm_page_t *ma, int max_count); -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int); void vm_waitproc(struct proc *); int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sat Aug 2 15:05:23 2014 (r269432) +++ head/sys/vm/vm_fault.c Sat Aug 2 16:10:24 2014 (r269433) @@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$"); #define PFFOR 4 static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *); -static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); #define VM_FAULT_READ_BEHIND 8 #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) @@ -1155,68 +1154,6 @@ error: } /* - * vm_fault_wire: - * - * Wire down a range of virtual addresses in a map. - */ -int -vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t fictitious) -{ - vm_offset_t va; - int rv; - - /* - * We simulate a fault to get the page and enter it in the physical - * map. For user wiring, we only ask for read access on currently - * read-only sections. - */ - for (va = start; va < end; va += PAGE_SIZE) { - rv = vm_fault(map, va, VM_PROT_NONE, VM_FAULT_CHANGE_WIRING); - if (rv) { - if (va != start) - vm_fault_unwire(map, start, va, fictitious); - return (rv); - } - } - return (KERN_SUCCESS); -} - -/* - * vm_fault_unwire: - * - * Unwire a range of virtual addresses in a map. - */ -static void -vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t fictitious) -{ - vm_paddr_t pa; - vm_offset_t va; - vm_page_t m; - pmap_t pmap; - - pmap = vm_map_pmap(map); - - /* - * Since the pages are wired down, we must be able to get their - * mappings from the physical map system. - */ - for (va = start; va < end; va += PAGE_SIZE) { - pa = pmap_extract(pmap, va); - if (pa != 0) { - pmap_change_wiring(pmap, va, FALSE); - if (!fictitious) { - m = PHYS_TO_VM_PAGE(pa); - vm_page_lock(m); - vm_page_unwire(m, PQ_ACTIVE); - vm_page_unlock(m); - } - } - } -} - -/* * Routine: * vm_fault_copy_entry * Function: Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Aug 2 15:05:23 2014 (r269432) +++ head/sys/vm/vm_map.c Sat Aug 2 16:10:24 2014 (r269433) @@ -140,6 +140,8 @@ static void vmspace_zdtor(void *mem, int static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, int cow); +static void vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, + vm_offset_t failed_addr); #define ENTRY_CHARGED(e) ((e)->cred != NULL || \ ((e)->object.vm_object != NULL && (e)->object.vm_object->cred != NULL && \ @@ -2418,6 +2420,42 @@ done: } /* + * vm_map_wire_entry_failure: + * + * Handle a wiring failure on the given entry. + * + * The map should be locked. + */ +static void +vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, + vm_offset_t failed_addr) +{ + + VM_MAP_ASSERT_LOCKED(map); + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0 && + entry->wired_count == 1, + ("vm_map_wire_entry_failure: entry %p isn't being wired", entry)); + KASSERT(failed_addr < entry->end, + ("vm_map_wire_entry_failure: entry %p was fully wired", entry)); + + /* + * If any pages at the start of this entry were successfully wired, + * then unwire them. + */ + if (failed_addr > entry->start) { + pmap_unwire(map->pmap, entry->start, failed_addr); + vm_object_unwire(entry->object.vm_object, entry->offset, + failed_addr - entry->start, PQ_ACTIVE); + } + + /* + * Assign an out-of-range value to represent the failure to wire this + * entry. + */ + entry->wired_count = -1; +} + +/* * vm_map_wire: * * Implements both kernel and user wiring. @@ -2427,10 +2465,10 @@ vm_map_wire(vm_map_t map, vm_offset_t st int flags) { vm_map_entry_t entry, first_entry, tmp_entry; - vm_offset_t saved_end, saved_start; + vm_offset_t faddr, saved_end, saved_start; unsigned int last_timestamp; int rv; - boolean_t fictitious, need_wakeup, result, user_wire; + boolean_t need_wakeup, result, user_wire; vm_prot_t prot; if (start == end) @@ -2523,17 +2561,24 @@ vm_map_wire(vm_map_t map, vm_offset_t st entry->wired_count++; saved_start = entry->start; saved_end = entry->end; - fictitious = entry->object.vm_object != NULL && - (entry->object.vm_object->flags & - OBJ_FICTITIOUS) != 0; + /* * Release the map lock, relying on the in-transition * mark. Mark the map busy for fork. */ vm_map_busy(map); vm_map_unlock(map); - rv = vm_fault_wire(map, saved_start, saved_end, - fictitious); + + for (faddr = saved_start; faddr < saved_end; faddr += + PAGE_SIZE) { + /* + * Simulate a fault to get the page and enter + * it into the physical map. + */ + if ((rv = vm_fault(map, faddr, VM_PROT_NONE, + VM_FAULT_CHANGE_WIRING)) != KERN_SUCCESS) + break; + } vm_map_lock(map); vm_map_unbusy(map); if (last_timestamp + 1 != map->timestamp) { @@ -2552,23 +2597,22 @@ vm_map_wire(vm_map_t map, vm_offset_t st first_entry = NULL; entry = tmp_entry; while (entry->end < saved_end) { - if (rv != KERN_SUCCESS) { - KASSERT(entry->wired_count == 1, - ("vm_map_wire: bad count")); - entry->wired_count = -1; - } + /* + * In case of failure, handle entries + * that were not fully wired here; + * fully wired entries are handled + * later. + */ + if (rv != KERN_SUCCESS && + faddr < entry->end) + vm_map_wire_entry_failure(map, + entry, faddr); entry = entry->next; } } last_timestamp = map->timestamp; if (rv != KERN_SUCCESS) { - KASSERT(entry->wired_count == 1, - ("vm_map_wire: bad count")); - /* - * Assign an out-of-range value to represent - * the failure to wire this entry. - */ - entry->wired_count = -1; + vm_map_wire_entry_failure(map, entry, faddr); end = entry->end; goto done; } @@ -2632,6 +2676,10 @@ done: entry->wired_count = 0; } else if (!user_wire || (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { + /* + * Undo the wiring. Wiring succeeded on this entry + * but failed on a later entry. + */ if (entry->wired_count == 1) vm_map_entry_unwire(map, entry); else From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 16:45:56 2014 Return-Path: Delivered-To: svn-src-all@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 8B7FA6B0; Sat, 2 Aug 2014 16:45: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EF9B2461; Sat, 2 Aug 2014 16:45:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72GjulZ058802; Sat, 2 Aug 2014 16:45:56 GMT (envelope-from ngie@svn.freebsd.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72GjuGV058800; Sat, 2 Aug 2014 16:45:56 GMT (envelope-from ngie@svn.freebsd.org) Message-Id: <201408021645.s72GjuGV058800@svn.freebsd.org> From: Garrett Cooper Date: Sat, 2 Aug 2014 16:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269434 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 16:45:56 -0000 Author: ngie Date: Sat Aug 2 16:45:55 2014 New Revision: 269434 URL: http://svnweb.freebsd.org/changeset/base/269434 Log: Add myself to calendar.freebsd and committers-src.dot Phabric: D522 Reviewed by: jmmv Approved by: jmmv (co-mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Sat Aug 2 16:10:24 2014 (r269433) +++ head/share/misc/committers-src.dot Sat Aug 2 16:45:55 2014 (r269434) @@ -228,6 +228,7 @@ mp [label="Mark Peek\nmp@FreeBSD.org\n20 mr [label="Michael Reifenberger\nmr@FreeBSD.org\n2001/09/30"] neel [label="Neel Natu\nneel@FreeBSD.org\n2009/09/20"] netchild [label="Alexander Leidinger\nnetchild@FreeBSD.org\n2005/03/31"] +ngie [label="Garrett Cooper\nngie@FreeBSD.org\n2014/07/27"] nork [label="Norikatsu Shigemura\nnork@FreeBSD.org\n2009/06/09"] np [label="Navdeep Parhar\nnp@FreeBSD.org\n2009/06/05"] nwhitehorn [label="Nathan Whitehorn\nnwhitehorn@FreeBSD.org\n2008/07/03"] @@ -512,6 +513,8 @@ jlemon -> brooks jmallett -> pkelsey +jmmv -> ngie + joerg -> brian joerg -> eik joerg -> jmg @@ -623,6 +626,7 @@ rpaulo -> avg rpaulo -> bschmidt rpaulo -> dim rpaulo -> jmmv +rpaulo -> ngie rrs -> brucec rrs -> jchandra Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 2 16:10:24 2014 (r269433) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 2 16:45:55 2014 (r269434) @@ -36,6 +36,7 @@ 01/26 Andrew Gallatin born in Buffalo, New York, United States, 1970 01/27 Nick Sayer born in San Diego, California, United States, 1968 01/27 Jacques Anthony Vidrine born in Baton Rouge, Louisiana, United States, 1971 +01/27 Garrett Cooper born in Seattle, Washington, United States, 1984 01/31 Hidetoshi Shimokawa born in Yokohama, Kanagawa, Japan, 1970 02/01 Doug Rabson born in London, England, 1966 02/01 Nicola Vitale born in Busto Arsizio, Varese, Italy, 1976 From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 16:54:52 2014 Return-Path: Delivered-To: svn-src-all@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 8192FC94; Sat, 2 Aug 2014 16:54:52 +0000 (UTC) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EB57C2623; Sat, 2 Aug 2014 16:54:51 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id C8D0D25D3892; Sat, 2 Aug 2014 16:54:48 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id F1306C25D45; Sat, 2 Aug 2014 16:54:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id X-ZPXp3iOeWN; Sat, 2 Aug 2014 16:54:44 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:c013:8aed:774:63c7] (unknown [IPv6:fde9:577b:c1a9:4410:c013:8aed:774:63c7]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 5B6BEC25BA5; Sat, 2 Aug 2014 16:54:43 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269433 - head/sys/vm From: "Bjoern A. Zeeb" In-Reply-To: <201408021610.s72GAPAd040967@svn.freebsd.org> Date: Sat, 2 Aug 2014 16:54:27 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201408021610.s72GAPAd040967@svn.freebsd.org> To: Alan Cox X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 16:54:52 -0000 On 02 Aug 2014, at 16:10 , Alan Cox wrote: > Author: alc > Date: Sat Aug 2 16:10:24 2014 > New Revision: 269433 > URL: http://svnweb.freebsd.org/changeset/base/269433 >=20 > Log: > Handle wiring failures in vm_map_wire() with the new functions > pmap_unwire() and vm_object_unwire(). >=20 > Retire vm_fault_{un,}wire(), since they are no longer used. >=20 > (See r268327 and r269134 for the motivation behind this change.) >=20 > Reviewed by: kib > Sponsored by: EMC / Isilon Storage Division >=20 cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/sys/vm/vm_map.c: In function 'vm_map_wire': /scratch/tmp/bz/head.svn/sys/vm/vm_map.c:2470: warning: 'rv' may be used = uninitialized in this function --- vm_map.o --- *** [vm_map.o] Error code 1 > Modified: > head/sys/vm/vm_extern.h > head/sys/vm/vm_fault.c > head/sys/vm/vm_map.c >=20 > Modified: head/sys/vm/vm_extern.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/vm/vm_extern.h Sat Aug 2 15:05:23 2014 = (r269432) > +++ head/sys/vm/vm_extern.h Sat Aug 2 16:10:24 2014 = (r269433) > @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse > int fault_flags, vm_page_t *m_hold); > int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, = vm_size_t len, > vm_prot_t prot, vm_page_t *ma, int max_count); > -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); > int vm_forkproc(struct thread *, struct proc *, struct thread *, = struct vmspace *, int); > void vm_waitproc(struct proc *); > int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, = int, objtype_t, void *, vm_ooffset_t); >=20 > Modified: head/sys/vm/vm_fault.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/vm/vm_fault.c Sat Aug 2 15:05:23 2014 = (r269432) > +++ head/sys/vm/vm_fault.c Sat Aug 2 16:10:24 2014 = (r269433) > @@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$"); > #define PFFOR 4 >=20 > static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, = int *); > -static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, = boolean_t); >=20 > #define VM_FAULT_READ_BEHIND 8 > #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) > @@ -1155,68 +1154,6 @@ error:=09 > } >=20 > /* > - * vm_fault_wire: > - * > - * Wire down a range of virtual addresses in a map. > - */ > -int > -vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, > - boolean_t fictitious) > -{ > - vm_offset_t va; > - int rv; > - > - /* > - * We simulate a fault to get the page and enter it in the = physical > - * map. For user wiring, we only ask for read access on = currently > - * read-only sections. > - */ > - for (va =3D start; va < end; va +=3D PAGE_SIZE) { > - rv =3D vm_fault(map, va, VM_PROT_NONE, = VM_FAULT_CHANGE_WIRING); > - if (rv) { > - if (va !=3D start) > - vm_fault_unwire(map, start, va, = fictitious); > - return (rv); > - } > - } > - return (KERN_SUCCESS); > -} > - > -/* > - * vm_fault_unwire: > - * > - * Unwire a range of virtual addresses in a map. > - */ > -static void > -vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, > - boolean_t fictitious) > -{ > - vm_paddr_t pa; > - vm_offset_t va; > - vm_page_t m; > - pmap_t pmap; > - > - pmap =3D vm_map_pmap(map); > - > - /* > - * Since the pages are wired down, we must be able to get their > - * mappings from the physical map system. > - */ > - for (va =3D start; va < end; va +=3D PAGE_SIZE) { > - pa =3D pmap_extract(pmap, va); > - if (pa !=3D 0) { > - pmap_change_wiring(pmap, va, FALSE); > - if (!fictitious) { > - m =3D PHYS_TO_VM_PAGE(pa); > - vm_page_lock(m); > - vm_page_unwire(m, PQ_ACTIVE); > - vm_page_unlock(m); > - } > - } > - } > -} > - > -/* > * Routine: > * vm_fault_copy_entry > * Function: >=20 > Modified: head/sys/vm/vm_map.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/vm/vm_map.c Sat Aug 2 15:05:23 2014 = (r269432) > +++ head/sys/vm/vm_map.c Sat Aug 2 16:10:24 2014 = (r269433) > @@ -140,6 +140,8 @@ static void vmspace_zdtor(void *mem, int > static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, > vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t = max, > int cow); > +static void vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t = entry, > + vm_offset_t failed_addr); >=20 > #define ENTRY_CHARGED(e) ((e)->cred !=3D NULL || \ > ((e)->object.vm_object !=3D NULL && (e)->object.vm_object->cred !=3D= NULL && \ > @@ -2418,6 +2420,42 @@ done: > } >=20 > /* > + * vm_map_wire_entry_failure: > + * > + * Handle a wiring failure on the given entry. > + * > + * The map should be locked. > + */ > +static void > +vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, > + vm_offset_t failed_addr) > +{ > + > + VM_MAP_ASSERT_LOCKED(map); > + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) !=3D 0 && > + entry->wired_count =3D=3D 1, > + ("vm_map_wire_entry_failure: entry %p isn't being wired", = entry)); > + KASSERT(failed_addr < entry->end, > + ("vm_map_wire_entry_failure: entry %p was fully wired", = entry)); > + > + /* > + * If any pages at the start of this entry were successfully = wired, > + * then unwire them. > + */ > + if (failed_addr > entry->start) { > + pmap_unwire(map->pmap, entry->start, failed_addr); > + vm_object_unwire(entry->object.vm_object, entry->offset, > + failed_addr - entry->start, PQ_ACTIVE); > + } > + > + /* > + * Assign an out-of-range value to represent the failure to wire = this > + * entry. > + */ > + entry->wired_count =3D -1; > +} > + > +/* > * vm_map_wire: > * > * Implements both kernel and user wiring. > @@ -2427,10 +2465,10 @@ vm_map_wire(vm_map_t map, vm_offset_t st > int flags) > { > vm_map_entry_t entry, first_entry, tmp_entry; > - vm_offset_t saved_end, saved_start; > + vm_offset_t faddr, saved_end, saved_start; > unsigned int last_timestamp; > int rv; > - boolean_t fictitious, need_wakeup, result, user_wire; > + boolean_t need_wakeup, result, user_wire; > vm_prot_t prot; >=20 > if (start =3D=3D end) > @@ -2523,17 +2561,24 @@ vm_map_wire(vm_map_t map, vm_offset_t st > entry->wired_count++; > saved_start =3D entry->start; > saved_end =3D entry->end; > - fictitious =3D entry->object.vm_object !=3D NULL = && > - (entry->object.vm_object->flags & > - OBJ_FICTITIOUS) !=3D 0; > + > /* > * Release the map lock, relying on the = in-transition > * mark. Mark the map busy for fork. > */ > vm_map_busy(map); > vm_map_unlock(map); > - rv =3D vm_fault_wire(map, saved_start, = saved_end, > - fictitious); > + > + for (faddr =3D saved_start; faddr < saved_end; = faddr +=3D > + PAGE_SIZE) { > + /* > + * Simulate a fault to get the page and = enter > + * it into the physical map. > + */ > + if ((rv =3D vm_fault(map, faddr, = VM_PROT_NONE, > + VM_FAULT_CHANGE_WIRING)) !=3D = KERN_SUCCESS) > + break; > + } > vm_map_lock(map); > vm_map_unbusy(map); > if (last_timestamp + 1 !=3D map->timestamp) { > @@ -2552,23 +2597,22 @@ vm_map_wire(vm_map_t map, vm_offset_t st > first_entry =3D NULL; > entry =3D tmp_entry; > while (entry->end < saved_end) { > - if (rv !=3D KERN_SUCCESS) { > - = KASSERT(entry->wired_count =3D=3D 1, > - ("vm_map_wire: bad = count")); > - entry->wired_count =3D = -1; > - } > + /* > + * In case of failure, handle = entries > + * that were not fully wired = here; > + * fully wired entries are = handled > + * later. > + */ > + if (rv !=3D KERN_SUCCESS && > + faddr < entry->end) > + = vm_map_wire_entry_failure(map, > + entry, faddr); > entry =3D entry->next; > } > } > last_timestamp =3D map->timestamp; > if (rv !=3D KERN_SUCCESS) { > - KASSERT(entry->wired_count =3D=3D 1, > - ("vm_map_wire: bad count")); > - /* > - * Assign an out-of-range value to = represent > - * the failure to wire this entry. > - */ > - entry->wired_count =3D -1; > + vm_map_wire_entry_failure(map, entry, = faddr); > end =3D entry->end; > goto done; > } > @@ -2632,6 +2676,10 @@ done: > entry->wired_count =3D 0; > } else if (!user_wire || > (entry->eflags & MAP_ENTRY_USER_WIRED) =3D=3D 0) { > + /* > + * Undo the wiring. Wiring succeeded on this = entry > + * but failed on a later entry. =20 > + */ > if (entry->wired_count =3D=3D 1) > vm_map_entry_unwire(map, entry); > else >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 17:03:56 2014 Return-Path: Delivered-To: svn-src-all@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 C5354EA5; Sat, 2 Aug 2014 17:03:56 +0000 (UTC) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8736326F1; Sat, 2 Aug 2014 17:03:55 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id s72H3rwf011044; Sat, 2 Aug 2014 12:03:53 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1ngcmb0ds7-1; Sat, 02 Aug 2014 12:03:53 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from 108-254-203-201.lightspeed.hstntx.sbcglobal.net (108-254-203-201.lightspeed.hstntx.sbcglobal.net [108.254.203.201]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 06BAB500108; Sat, 2 Aug 2014 12:03:52 -0500 (CDT) Message-ID: <53DD19F8.9020305@rice.edu> Date: Sat, 02 Aug 2014 12:03:52 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: "Bjoern A. Zeeb" , Alan Cox Subject: Re: svn commit: r269433 - head/sys/vm References: <201408021610.s72GAPAd040967@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.713890987064109 urlsuspect_oldscore=0.713890987064109 suspectscore=4 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=1 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 rbsscore=0.713890987064109 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1408020229 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 17:03:56 -0000 On 08/02/2014 11:54, Bjoern A. Zeeb wrote: > On 02 Aug 2014, at 16:10 , Alan Cox wrote: > >> Author: alc >> Date: Sat Aug 2 16:10:24 2014 >> New Revision: 269433 >> URL: http://svnweb.freebsd.org/changeset/base/269433 >> >> Log: >> Handle wiring failures in vm_map_wire() with the new functions >> pmap_unwire() and vm_object_unwire(). >> >> Retire vm_fault_{un,}wire(), since they are no longer used. >> >> (See r268327 and r269134 for the motivation behind this change.) >> >> Reviewed by: kib >> Sponsored by: EMC / Isilon Storage Division >> > cc1: warnings being treated as errors > /scratch/tmp/bz/head.svn/sys/vm/vm_map.c: In function 'vm_map_wire': > /scratch/tmp/bz/head.svn/sys/vm/vm_map.c:2470: warning: 'rv' may be used uninitialized in this function > --- vm_map.o --- > *** [vm_map.o] Error code 1 gcc? > > >> Modified: >> head/sys/vm/vm_extern.h >> head/sys/vm/vm_fault.c >> head/sys/vm/vm_map.c >> >> Modified: head/sys/vm/vm_extern.h >> ============================================================================== >> --- head/sys/vm/vm_extern.h Sat Aug 2 15:05:23 2014 (r269432) >> +++ head/sys/vm/vm_extern.h Sat Aug 2 16:10:24 2014 (r269433) >> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >> int fault_flags, vm_page_t *m_hold); >> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, >> vm_prot_t prot, vm_page_t *ma, int max_count); >> -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int); >> void vm_waitproc(struct proc *); >> int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t); >> >> Modified: head/sys/vm/vm_fault.c >> ============================================================================== >> --- head/sys/vm/vm_fault.c Sat Aug 2 15:05:23 2014 (r269432) >> +++ head/sys/vm/vm_fault.c Sat Aug 2 16:10:24 2014 (r269433) >> @@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$"); >> #define PFFOR 4 >> >> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t *, int *); >> -static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >> >> #define VM_FAULT_READ_BEHIND 8 >> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >> @@ -1155,68 +1154,6 @@ error: >> } >> >> /* >> - * vm_fault_wire: >> - * >> - * Wire down a range of virtual addresses in a map. >> - */ >> -int >> -vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, >> - boolean_t fictitious) >> -{ >> - vm_offset_t va; >> - int rv; >> - >> - /* >> - * We simulate a fault to get the page and enter it in the physical >> - * map. For user wiring, we only ask for read access on currently >> - * read-only sections. >> - */ >> - for (va = start; va < end; va += PAGE_SIZE) { >> - rv = vm_fault(map, va, VM_PROT_NONE, VM_FAULT_CHANGE_WIRING); >> - if (rv) { >> - if (va != start) >> - vm_fault_unwire(map, start, va, fictitious); >> - return (rv); >> - } >> - } >> - return (KERN_SUCCESS); >> -} >> - >> -/* >> - * vm_fault_unwire: >> - * >> - * Unwire a range of virtual addresses in a map. >> - */ >> -static void >> -vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >> - boolean_t fictitious) >> -{ >> - vm_paddr_t pa; >> - vm_offset_t va; >> - vm_page_t m; >> - pmap_t pmap; >> - >> - pmap = vm_map_pmap(map); >> - >> - /* >> - * Since the pages are wired down, we must be able to get their >> - * mappings from the physical map system. >> - */ >> - for (va = start; va < end; va += PAGE_SIZE) { >> - pa = pmap_extract(pmap, va); >> - if (pa != 0) { >> - pmap_change_wiring(pmap, va, FALSE); >> - if (!fictitious) { >> - m = PHYS_TO_VM_PAGE(pa); >> - vm_page_lock(m); >> - vm_page_unwire(m, PQ_ACTIVE); >> - vm_page_unlock(m); >> - } >> - } >> - } >> -} >> - >> -/* >> * Routine: >> * vm_fault_copy_entry >> * Function: >> >> Modified: head/sys/vm/vm_map.c >> ============================================================================== >> --- head/sys/vm/vm_map.c Sat Aug 2 15:05:23 2014 (r269432) >> +++ head/sys/vm/vm_map.c Sat Aug 2 16:10:24 2014 (r269433) >> @@ -140,6 +140,8 @@ static void vmspace_zdtor(void *mem, int >> static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, >> vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, >> int cow); >> +static void vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, >> + vm_offset_t failed_addr); >> >> #define ENTRY_CHARGED(e) ((e)->cred != NULL || \ >> ((e)->object.vm_object != NULL && (e)->object.vm_object->cred != NULL && \ >> @@ -2418,6 +2420,42 @@ done: >> } >> >> /* >> + * vm_map_wire_entry_failure: >> + * >> + * Handle a wiring failure on the given entry. >> + * >> + * The map should be locked. >> + */ >> +static void >> +vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, >> + vm_offset_t failed_addr) >> +{ >> + >> + VM_MAP_ASSERT_LOCKED(map); >> + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) != 0 && >> + entry->wired_count == 1, >> + ("vm_map_wire_entry_failure: entry %p isn't being wired", entry)); >> + KASSERT(failed_addr < entry->end, >> + ("vm_map_wire_entry_failure: entry %p was fully wired", entry)); >> + >> + /* >> + * If any pages at the start of this entry were successfully wired, >> + * then unwire them. >> + */ >> + if (failed_addr > entry->start) { >> + pmap_unwire(map->pmap, entry->start, failed_addr); >> + vm_object_unwire(entry->object.vm_object, entry->offset, >> + failed_addr - entry->start, PQ_ACTIVE); >> + } >> + >> + /* >> + * Assign an out-of-range value to represent the failure to wire this >> + * entry. >> + */ >> + entry->wired_count = -1; >> +} >> + >> +/* >> * vm_map_wire: >> * >> * Implements both kernel and user wiring. >> @@ -2427,10 +2465,10 @@ vm_map_wire(vm_map_t map, vm_offset_t st >> int flags) >> { >> vm_map_entry_t entry, first_entry, tmp_entry; >> - vm_offset_t saved_end, saved_start; >> + vm_offset_t faddr, saved_end, saved_start; >> unsigned int last_timestamp; >> int rv; >> - boolean_t fictitious, need_wakeup, result, user_wire; >> + boolean_t need_wakeup, result, user_wire; >> vm_prot_t prot; >> >> if (start == end) >> @@ -2523,17 +2561,24 @@ vm_map_wire(vm_map_t map, vm_offset_t st >> entry->wired_count++; >> saved_start = entry->start; >> saved_end = entry->end; >> - fictitious = entry->object.vm_object != NULL && >> - (entry->object.vm_object->flags & >> - OBJ_FICTITIOUS) != 0; >> + >> /* >> * Release the map lock, relying on the in-transition >> * mark. Mark the map busy for fork. >> */ >> vm_map_busy(map); >> vm_map_unlock(map); >> - rv = vm_fault_wire(map, saved_start, saved_end, >> - fictitious); >> + >> + for (faddr = saved_start; faddr < saved_end; faddr += >> + PAGE_SIZE) { >> + /* >> + * Simulate a fault to get the page and enter >> + * it into the physical map. >> + */ >> + if ((rv = vm_fault(map, faddr, VM_PROT_NONE, >> + VM_FAULT_CHANGE_WIRING)) != KERN_SUCCESS) >> + break; >> + } >> vm_map_lock(map); >> vm_map_unbusy(map); >> if (last_timestamp + 1 != map->timestamp) { >> @@ -2552,23 +2597,22 @@ vm_map_wire(vm_map_t map, vm_offset_t st >> first_entry = NULL; >> entry = tmp_entry; >> while (entry->end < saved_end) { >> - if (rv != KERN_SUCCESS) { >> - KASSERT(entry->wired_count == 1, >> - ("vm_map_wire: bad count")); >> - entry->wired_count = -1; >> - } >> + /* >> + * In case of failure, handle entries >> + * that were not fully wired here; >> + * fully wired entries are handled >> + * later. >> + */ >> + if (rv != KERN_SUCCESS && >> + faddr < entry->end) >> + vm_map_wire_entry_failure(map, >> + entry, faddr); >> entry = entry->next; >> } >> } >> last_timestamp = map->timestamp; >> if (rv != KERN_SUCCESS) { >> - KASSERT(entry->wired_count == 1, >> - ("vm_map_wire: bad count")); >> - /* >> - * Assign an out-of-range value to represent >> - * the failure to wire this entry. >> - */ >> - entry->wired_count = -1; >> + vm_map_wire_entry_failure(map, entry, faddr); >> end = entry->end; >> goto done; >> } >> @@ -2632,6 +2676,10 @@ done: >> entry->wired_count = 0; >> } else if (!user_wire || >> (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) { >> + /* >> + * Undo the wiring. Wiring succeeded on this entry >> + * but failed on a later entry. >> + */ >> if (entry->wired_count == 1) >> vm_map_entry_unwire(map, entry); >> else >> > — > Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 > > From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 17:17:03 2014 Return-Path: Delivered-To: svn-src-all@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 56AFB283; Sat, 2 Aug 2014 17:17:03 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CE51027CA; Sat, 2 Aug 2014 17:17:02 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5F9D025D387C; Sat, 2 Aug 2014 17:17:00 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 7A8BBC25D45; Sat, 2 Aug 2014 17:16:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id fKcteD76QSYi; Sat, 2 Aug 2014 17:16:56 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:18aa:31ca:1e8c:ff4c] (unknown [IPv6:fde9:577b:c1a9:4410:18aa:31ca:1e8c:ff4c]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id EBF37C25BA5; Sat, 2 Aug 2014 17:16:53 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269433 - head/sys/vm From: "Bjoern A. Zeeb" In-Reply-To: <53DD19F8.9020305@rice.edu> Date: Sat, 2 Aug 2014 17:16:53 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201408021610.s72GAPAd040967@svn.freebsd.org> <53DD19F8.9020305@rice.edu> To: Alan Cox X-Mailer: Apple Mail (2.1878.6) Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 17:17:03 -0000 On 02 Aug 2014, at 17:03 , Alan Cox wrote: > On 08/02/2014 11:54, Bjoern A. Zeeb wrote: >> On 02 Aug 2014, at 16:10 , Alan Cox wrote: >>=20 >>> Author: alc >>> Date: Sat Aug 2 16:10:24 2014 >>> New Revision: 269433 >>> URL: http://svnweb.freebsd.org/changeset/base/269433 >>>=20 >>> Log: >>> Handle wiring failures in vm_map_wire() with the new functions >>> pmap_unwire() and vm_object_unwire(). >>>=20 >>> Retire vm_fault_{un,}wire(), since they are no longer used. >>>=20 >>> (See r268327 and r269134 for the motivation behind this change.) >>>=20 >>> Reviewed by: kib >>> Sponsored by: EMC / Isilon Storage Division >>>=20 >> cc1: warnings being treated as errors >> /scratch/tmp/bz/head.svn/sys/vm/vm_map.c: In function 'vm_map_wire': >> /scratch/tmp/bz/head.svn/sys/vm/vm_map.c:2470: warning: 'rv' may be = used uninitialized in this function >> --- vm_map.o --- >> *** [vm_map.o] Error code 1 >=20 > gcc? >=20 mips, powerpc, sparc64, arm; yeah very likely. >>=20 >>=20 >>> Modified: >>> head/sys/vm/vm_extern.h >>> head/sys/vm/vm_fault.c >>> head/sys/vm/vm_map.c >>>=20 >>> Modified: head/sys/vm/vm_extern.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_extern.h Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_extern.h Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >>> int fault_flags, vm_page_t *m_hold); >>> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, = vm_size_t len, >>> vm_prot_t prot, vm_page_t *ma, int max_count); >>> -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >>> int vm_forkproc(struct thread *, struct proc *, struct thread *, = struct vmspace *, int); >>> void vm_waitproc(struct proc *); >>> int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, = vm_prot_t, int, objtype_t, void *, vm_ooffset_t); >>>=20 >>> Modified: head/sys/vm/vm_fault.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_fault.c Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_fault.c Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$"); >>> #define PFFOR 4 >>>=20 >>> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t = *, int *); >>> -static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, = boolean_t); >>>=20 >>> #define VM_FAULT_READ_BEHIND 8 >>> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >>> @@ -1155,68 +1154,6 @@ error:=09 >>> } >>>=20 >>> /* >>> - * vm_fault_wire: >>> - * >>> - * Wire down a range of virtual addresses in a map. >>> - */ >>> -int >>> -vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, >>> - boolean_t fictitious) >>> -{ >>> - vm_offset_t va; >>> - int rv; >>> - >>> - /* >>> - * We simulate a fault to get the page and enter it in the = physical >>> - * map. For user wiring, we only ask for read access on = currently >>> - * read-only sections. >>> - */ >>> - for (va =3D start; va < end; va +=3D PAGE_SIZE) { >>> - rv =3D vm_fault(map, va, VM_PROT_NONE, = VM_FAULT_CHANGE_WIRING); >>> - if (rv) { >>> - if (va !=3D start) >>> - vm_fault_unwire(map, start, va, = fictitious); >>> - return (rv); >>> - } >>> - } >>> - return (KERN_SUCCESS); >>> -} >>> - >>> -/* >>> - * vm_fault_unwire: >>> - * >>> - * Unwire a range of virtual addresses in a map. >>> - */ >>> -static void >>> -vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >>> - boolean_t fictitious) >>> -{ >>> - vm_paddr_t pa; >>> - vm_offset_t va; >>> - vm_page_t m; >>> - pmap_t pmap; >>> - >>> - pmap =3D vm_map_pmap(map); >>> - >>> - /* >>> - * Since the pages are wired down, we must be able to get their >>> - * mappings from the physical map system. >>> - */ >>> - for (va =3D start; va < end; va +=3D PAGE_SIZE) { >>> - pa =3D pmap_extract(pmap, va); >>> - if (pa !=3D 0) { >>> - pmap_change_wiring(pmap, va, FALSE); >>> - if (!fictitious) { >>> - m =3D PHYS_TO_VM_PAGE(pa); >>> - vm_page_lock(m); >>> - vm_page_unwire(m, PQ_ACTIVE); >>> - vm_page_unlock(m); >>> - } >>> - } >>> - } >>> -} >>> - >>> -/* >>> * Routine: >>> * vm_fault_copy_entry >>> * Function: >>>=20 >>> Modified: head/sys/vm/vm_map.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_map.c Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_map.c Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -140,6 +140,8 @@ static void vmspace_zdtor(void *mem, int >>> static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, >>> vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, = vm_prot_t max, >>> int cow); >>> +static void vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t = entry, >>> + vm_offset_t failed_addr); >>>=20 >>> #define ENTRY_CHARGED(e) ((e)->cred !=3D NULL || \ >>> ((e)->object.vm_object !=3D NULL && (e)->object.vm_object->cred = !=3D NULL && \ >>> @@ -2418,6 +2420,42 @@ done: >>> } >>>=20 >>> /* >>> + * vm_map_wire_entry_failure: >>> + * >>> + * Handle a wiring failure on the given entry. >>> + * >>> + * The map should be locked. >>> + */ >>> +static void >>> +vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, >>> + vm_offset_t failed_addr) >>> +{ >>> + >>> + VM_MAP_ASSERT_LOCKED(map); >>> + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) !=3D 0 && >>> + entry->wired_count =3D=3D 1, >>> + ("vm_map_wire_entry_failure: entry %p isn't being wired", = entry)); >>> + KASSERT(failed_addr < entry->end, >>> + ("vm_map_wire_entry_failure: entry %p was fully wired", = entry)); >>> + >>> + /* >>> + * If any pages at the start of this entry were successfully = wired, >>> + * then unwire them. >>> + */ >>> + if (failed_addr > entry->start) { >>> + pmap_unwire(map->pmap, entry->start, failed_addr); >>> + vm_object_unwire(entry->object.vm_object, entry->offset, >>> + failed_addr - entry->start, PQ_ACTIVE); >>> + } >>> + >>> + /* >>> + * Assign an out-of-range value to represent the failure to wire = this >>> + * entry. >>> + */ >>> + entry->wired_count =3D -1; >>> +} >>> + >>> +/* >>> * vm_map_wire: >>> * >>> * Implements both kernel and user wiring. >>> @@ -2427,10 +2465,10 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> int flags) >>> { >>> vm_map_entry_t entry, first_entry, tmp_entry; >>> - vm_offset_t saved_end, saved_start; >>> + vm_offset_t faddr, saved_end, saved_start; >>> unsigned int last_timestamp; >>> int rv; >>> - boolean_t fictitious, need_wakeup, result, user_wire; >>> + boolean_t need_wakeup, result, user_wire; >>> vm_prot_t prot; >>>=20 >>> if (start =3D=3D end) >>> @@ -2523,17 +2561,24 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> entry->wired_count++; >>> saved_start =3D entry->start; >>> saved_end =3D entry->end; >>> - fictitious =3D entry->object.vm_object !=3D NULL = && >>> - (entry->object.vm_object->flags & >>> - OBJ_FICTITIOUS) !=3D 0; >>> + >>> /* >>> * Release the map lock, relying on the = in-transition >>> * mark. Mark the map busy for fork. >>> */ >>> vm_map_busy(map); >>> vm_map_unlock(map); >>> - rv =3D vm_fault_wire(map, saved_start, = saved_end, >>> - fictitious); >>> + >>> + for (faddr =3D saved_start; faddr < saved_end; = faddr +=3D >>> + PAGE_SIZE) { >>> + /* >>> + * Simulate a fault to get the page and = enter >>> + * it into the physical map. >>> + */ >>> + if ((rv =3D vm_fault(map, faddr, = VM_PROT_NONE, >>> + VM_FAULT_CHANGE_WIRING)) !=3D = KERN_SUCCESS) >>> + break; >>> + } >>> vm_map_lock(map); >>> vm_map_unbusy(map); >>> if (last_timestamp + 1 !=3D map->timestamp) { >>> @@ -2552,23 +2597,22 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> first_entry =3D NULL; >>> entry =3D tmp_entry; >>> while (entry->end < saved_end) { >>> - if (rv !=3D KERN_SUCCESS) { >>> - = KASSERT(entry->wired_count =3D=3D 1, >>> - ("vm_map_wire: bad = count")); >>> - entry->wired_count =3D = -1; >>> - } >>> + /* >>> + * In case of failure, handle = entries >>> + * that were not fully wired = here; >>> + * fully wired entries are = handled >>> + * later. >>> + */ >>> + if (rv !=3D KERN_SUCCESS && >>> + faddr < entry->end) >>> + = vm_map_wire_entry_failure(map, >>> + entry, faddr); >>> entry =3D entry->next; >>> } >>> } >>> last_timestamp =3D map->timestamp; >>> if (rv !=3D KERN_SUCCESS) { >>> - KASSERT(entry->wired_count =3D=3D 1, >>> - ("vm_map_wire: bad count")); >>> - /* >>> - * Assign an out-of-range value to = represent >>> - * the failure to wire this entry. >>> - */ >>> - entry->wired_count =3D -1; >>> + vm_map_wire_entry_failure(map, entry, = faddr); >>> end =3D entry->end; >>> goto done; >>> } >>> @@ -2632,6 +2676,10 @@ done: >>> entry->wired_count =3D 0; >>> } else if (!user_wire || >>> (entry->eflags & MAP_ENTRY_USER_WIRED) =3D=3D 0) { >>> + /* >>> + * Undo the wiring. Wiring succeeded on this = entry >>> + * but failed on a later entry. =20 >>> + */ >>> if (entry->wired_count =3D=3D 1) >>> vm_map_entry_unwire(map, entry); >>> else >>>=20 >> =97=20 >> Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, = 1983 >>=20 >>=20 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 17:35:16 2014 Return-Path: Delivered-To: svn-src-all@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 1BF2F753; Sat, 2 Aug 2014 17:35: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0F7B2986; Sat, 2 Aug 2014 17:35:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72HZFC0081972; Sat, 2 Aug 2014 17:35:15 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72HZDiT081958; Sat, 2 Aug 2014 17:35:13 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201408021735.s72HZDiT081958@svn.freebsd.org> From: Michael Tuexen Date: Sat, 2 Aug 2014 17:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269436 - in head: lib/libc/net 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 17:35:16 -0000 Author: tuexen Date: Sat Aug 2 17:35:13 2014 New Revision: 269436 URL: http://svnweb.freebsd.org/changeset/base/269436 Log: Cleanup the ECN configuration handling and provide an SCTP socket option for controlling ECN on future associations and get the status on current associations. A simialar pattern will be used for controlling SCTP extensions in upcoming commits. Modified: head/lib/libc/net/sctp_sys_calls.c head/sys/netinet/sctp.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/lib/libc/net/sctp_sys_calls.c Sat Aug 2 17:35:13 2014 (r269436) @@ -350,6 +350,9 @@ sctp_opt_info(int sd, sctp_assoc_t id, i case SCTP_REMOTE_UDP_ENCAPS_PORT: ((struct sctp_udpencaps *)arg)->sue_assoc_id = id; break; + case SCTP_ECN_SUPPORTED: + ((struct sctp_assoc_value *)arg)->assoc_id = id; + break; case SCTP_MAX_BURST: ((struct sctp_assoc_value *)arg)->assoc_id = id; break; Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp.h Sat Aug 2 17:35:13 2014 (r269436) @@ -121,6 +121,7 @@ struct sctp_paramhdr { #define SCTP_DEFAULT_PRINFO 0x00000022 #define SCTP_PEER_ADDR_THLDS 0x00000023 #define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 +#define SCTP_ECN_SUPPORTED 0x00000025 /* * read-only options Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_input.c Sat Aug 2 17:35:13 2014 (r269436) @@ -2785,7 +2785,7 @@ sctp_handle_cookie_echo(struct mbuf *m, inp->sctp_socket = so; inp->sctp_frag_point = (*inp_p)->sctp_frag_point; inp->sctp_cmt_on_off = (*inp_p)->sctp_cmt_on_off; - inp->sctp_ecn_enable = (*inp_p)->sctp_ecn_enable; + inp->ecn_supported = (*inp_p)->ecn_supported; inp->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; inp->local_strreset_support = (*inp_p)->local_strreset_support; @@ -5898,7 +5898,7 @@ sctp_common_input_processing(struct mbuf } /* take care of ecn */ if ((data_processed == 1) && - (stcb->asoc.ecn_allowed == 1) && + (stcb->asoc.ecn_supported == 1) && ((ecn_bits & SCTP_CE_BITS) == SCTP_CE_BITS)) { /* Yep, we need to add a ECNE */ sctp_send_ecn_echo(stcb, net, high_tsn); Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_output.c Sat Aug 2 17:35:13 2014 (r269436) @@ -3914,7 +3914,7 @@ sctp_add_cookie(struct mbuf *init, int i static uint8_t sctp_get_ect(struct sctp_tcb *stcb) { - if ((stcb != NULL) && (stcb->asoc.ecn_allowed == 1)) { + if ((stcb != NULL) && (stcb->asoc.ecn_supported == 1)) { return (SCTP_ECT0_BIT); } else { return (0); @@ -4785,7 +4785,7 @@ sctp_send_initiate(struct sctp_inpcb *in chunk_len += parameter_len; } /* ECN parameter */ - if (stcb->asoc.ecn_allowed == 1) { + if (stcb->asoc.ecn_supported == 1) { parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_ECN_CAPABLE); @@ -5882,8 +5882,8 @@ do_a_abort: chunk_len += parameter_len; } /* ECN parameter */ - if (((asoc != NULL) && (asoc->ecn_allowed == 1)) || - ((asoc == NULL) && (inp->sctp_ecn_enable == 1))) { + if (((asoc != NULL) && (asoc->ecn_supported == 1)) || + ((asoc == NULL) && (inp->ecn_supported == 1))) { parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); ph->param_type = htons(SCTP_ECN_CAPABLE); Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_pcb.c Sat Aug 2 17:35:13 2014 (r269436) @@ -2483,7 +2483,7 @@ sctp_inpcb_alloc(struct socket *so, uint inp->partial_delivery_point = SCTP_SB_LIMIT_RCV(so) >> SCTP_PARTIAL_DELIVERY_SHIFT; inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT; inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off); - inp->sctp_ecn_enable = SCTP_BASE_SYSCTL(sctp_ecn_enable); + inp->ecn_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_ecn_enable); /* init the small hash table we use to track asocid <-> tcb */ inp->sctp_asocidhash = SCTP_HASH_INIT(SCTP_STACK_VTAG_HASH_SIZE, &inp->hashasocidmark); if (inp->sctp_asocidhash == NULL) { @@ -6081,7 +6081,7 @@ sctp_load_addresses_from_init(struct sct sctp_key_t *new_key; uint32_t keylen; int got_random = 0, got_hmacs = 0, got_chklist = 0; - uint8_t ecn_allowed; + uint8_t ecn_supported; #ifdef INET struct sockaddr_in sin; @@ -6111,7 +6111,7 @@ sctp_load_addresses_from_init(struct sct sa = src; } /* Turn off ECN until we get through all params */ - ecn_allowed = 0; + ecn_supported = 0; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { /* mark all addresses that we have currently on the list */ net->dest_state |= SCTP_ADDR_NOT_IN_ASSOC; @@ -6360,7 +6360,7 @@ sctp_load_addresses_from_init(struct sct } else #endif if (ptype == SCTP_ECN_CAPABLE) { - ecn_allowed = 1; + ecn_supported = 1; } else if (ptype == SCTP_ULP_ADAPTATION) { if (stcb->asoc.state != SCTP_STATE_OPEN) { struct sctp_adaptation_layer_indication ai, @@ -6612,9 +6612,7 @@ next_param: } } } - if (ecn_allowed == 0) { - stcb->asoc.ecn_allowed = 0; - } + stcb->asoc.ecn_supported &= ecn_supported; /* validate authentication required parameters */ if (got_random && got_hmacs) { stcb->asoc.peer_supports_auth = 1; Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_pcb.h Sat Aug 2 17:35:13 2014 (r269436) @@ -406,7 +406,7 @@ struct sctp_inpcb { uint32_t sctp_context; uint8_t local_strreset_support; uint32_t sctp_cmt_on_off; - uint32_t sctp_ecn_enable; + uint8_t ecn_supported; struct sctp_nonpad_sndrcvinfo def_send; /*- * These three are here for the sosend_dgram Modified: head/sys/netinet/sctp_peeloff.c ============================================================================== --- head/sys/netinet/sctp_peeloff.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_peeloff.c Sat Aug 2 17:35:13 2014 (r269436) @@ -118,7 +118,7 @@ sctp_do_peeloff(struct socket *head, str n_inp->sctp_mobility_features = inp->sctp_mobility_features; n_inp->sctp_frag_point = inp->sctp_frag_point; n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; - n_inp->sctp_ecn_enable = inp->sctp_ecn_enable; + n_inp->ecn_supported = inp->ecn_supported; n_inp->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->local_strreset_support = inp->local_strreset_support; Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_structs.h Sat Aug 2 17:35:13 2014 (r269436) @@ -1151,7 +1151,7 @@ struct sctp_association { */ /* Flag to tell if ECN is allowed */ - uint8_t ecn_allowed; + uint8_t ecn_supported; /* Did the peer make the stream config (add out) request */ uint8_t peer_req_out; Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctp_usrreq.c Sat Aug 2 17:35:13 2014 (r269436) @@ -3294,6 +3294,33 @@ flags_out: } break; } + case SCTP_ECN_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + av->assoc_value = stcb->asoc.ecn_supported; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_RLOCK(inp); + av->assoc_value = inp->ecn_supported; + SCTP_INP_RUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + if (error == 0) { + *optsize = sizeof(struct sctp_assoc_value); + } + break; + } case SCTP_ENABLE_STREAM_RESET: { struct sctp_assoc_value *av; @@ -5857,6 +5884,35 @@ sctp_setopt(struct socket *so, int optna } break; } + case SCTP_ECN_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_WLOCK(inp); + if (av->assoc_value == 0) { + inp->ecn_supported = 0; + } else { + inp->ecn_supported = 0; + } + SCTP_INP_WUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + break; + } default: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); error = ENOPROTOOPT; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Aug 2 17:18:47 2014 (r269435) +++ head/sys/netinet/sctputil.c Sat Aug 2 17:35:13 2014 (r269436) @@ -904,7 +904,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, s asoc->heart_beat_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]); asoc->cookie_life = inp->sctp_ep.def_cookie_life; asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; - asoc->ecn_allowed = inp->sctp_ecn_enable; + asoc->ecn_supported = inp->ecn_supported; asoc->sctp_nr_sack_on_off = (uint8_t) SCTP_BASE_SYSCTL(sctp_nr_sack_on_off); asoc->sctp_cmt_pf = (uint8_t) 0; asoc->sctp_frag_point = inp->sctp_frag_point; From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 17:45:08 2014 Return-Path: Delivered-To: svn-src-all@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 A6C90B7F; Sat, 2 Aug 2014 17:45: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 940652A84; Sat, 2 Aug 2014 17:45:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72Hj8uY086640; Sat, 2 Aug 2014 17:45:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72Hj8TM086639; Sat, 2 Aug 2014 17:45:08 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201408021745.s72Hj8TM086639@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 2 Aug 2014 17:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269437 - head/sys/dev/vt/hw/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 17:45:08 -0000 Author: nwhitehorn Date: Sat Aug 2 17:45:08 2014 New Revision: 269437 URL: http://svnweb.freebsd.org/changeset/base/269437 Log: Don't assume that the framebuffer driver is using vt_fb_blank() when blanking the screen during init. MFC after: 1 week Modified: head/sys/dev/vt/hw/fb/vt_fb.c Modified: head/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 2 17:35:13 2014 (r269436) +++ head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 2 17:45:08 2014 (r269437) @@ -401,7 +401,7 @@ vt_fb_init(struct vt_device *vd) } /* Clear the screen. */ - vt_fb_blank(vd, TC_BLACK); + vd->vd_driver->vd_blank(vd, TC_BLACK); /* Wakeup screen. KMS need this. */ vt_fb_postswitch(vd); From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 17:58:20 2014 Return-Path: Delivered-To: svn-src-all@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 C501BF36; Sat, 2 Aug 2014 17:58:20 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2E582BA8; Sat, 2 Aug 2014 17:58:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72HwKEL091658; Sat, 2 Aug 2014 17:58:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72HwKQ8091657; Sat, 2 Aug 2014 17:58:20 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201408021758.s72HwKQ8091657@svn.freebsd.org> From: Alan Cox Date: Sat, 2 Aug 2014 17:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269438 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 17:58:20 -0000 Author: alc Date: Sat Aug 2 17:58:20 2014 New Revision: 269438 URL: http://svnweb.freebsd.org/changeset/base/269438 Log: Rewrite a loop in vm_map_wire() so that gcc doesn't think that the variable "rv" is uninitialized. Reported by: bz Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Aug 2 17:45:08 2014 (r269437) +++ head/sys/vm/vm_map.c Sat Aug 2 17:58:20 2014 (r269438) @@ -2569,8 +2569,8 @@ vm_map_wire(vm_map_t map, vm_offset_t st vm_map_busy(map); vm_map_unlock(map); - for (faddr = saved_start; faddr < saved_end; faddr += - PAGE_SIZE) { + faddr = saved_start; + do { /* * Simulate a fault to get the page and enter * it into the physical map. @@ -2578,7 +2578,7 @@ vm_map_wire(vm_map_t map, vm_offset_t st if ((rv = vm_fault(map, faddr, VM_PROT_NONE, VM_FAULT_CHANGE_WIRING)) != KERN_SUCCESS) break; - } + } while ((faddr += PAGE_SIZE) < saved_end); vm_map_lock(map); vm_map_unbusy(map); if (last_timestamp + 1 != map->timestamp) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 18:01:05 2014 Return-Path: Delivered-To: svn-src-all@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 6729E126; Sat, 2 Aug 2014 18:01:05 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DF7E42BBE; Sat, 2 Aug 2014 18:01:04 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 72CF325D37C7; Sat, 2 Aug 2014 18:01:02 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 8FDEEC25D66; Sat, 2 Aug 2014 18:01:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id GDL9fCcApQz4; Sat, 2 Aug 2014 18:00:58 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:18aa:31ca:1e8c:ff4c] (unknown [IPv6:fde9:577b:c1a9:4410:18aa:31ca:1e8c:ff4c]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 93A71C25BA5; Sat, 2 Aug 2014 18:00:56 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r269433 - head/sys/vm From: "Bjoern A. Zeeb" In-Reply-To: <53DD19F8.9020305@rice.edu> Date: Sat, 2 Aug 2014 17:16:53 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201408021610.s72GAPAd040967@svn.freebsd.org> <53DD19F8.9020305@rice.edu> To: Alan Cox X-Mailer: Apple Mail (2.1878.6) Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 18:01:05 -0000 On 02 Aug 2014, at 17:03 , Alan Cox wrote: > On 08/02/2014 11:54, Bjoern A. Zeeb wrote: >> On 02 Aug 2014, at 16:10 , Alan Cox wrote: >>=20 >>> Author: alc >>> Date: Sat Aug 2 16:10:24 2014 >>> New Revision: 269433 >>> URL: http://svnweb.freebsd.org/changeset/base/269433 >>>=20 >>> Log: >>> Handle wiring failures in vm_map_wire() with the new functions >>> pmap_unwire() and vm_object_unwire(). >>>=20 >>> Retire vm_fault_{un,}wire(), since they are no longer used. >>>=20 >>> (See r268327 and r269134 for the motivation behind this change.) >>>=20 >>> Reviewed by: kib >>> Sponsored by: EMC / Isilon Storage Division >>>=20 >> cc1: warnings being treated as errors >> /scratch/tmp/bz/head.svn/sys/vm/vm_map.c: In function 'vm_map_wire': >> /scratch/tmp/bz/head.svn/sys/vm/vm_map.c:2470: warning: 'rv' may be = used uninitialized in this function >> --- vm_map.o --- >> *** [vm_map.o] Error code 1 >=20 > gcc? >=20 mips, powerpc, sparc64, arm; yeah very likely. >>=20 >>=20 >>> Modified: >>> head/sys/vm/vm_extern.h >>> head/sys/vm/vm_fault.c >>> head/sys/vm/vm_map.c >>>=20 >>> Modified: head/sys/vm/vm_extern.h >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_extern.h Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_extern.h Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -81,7 +81,6 @@ int vm_fault_hold(vm_map_t map, vm_offse >>> int fault_flags, vm_page_t *m_hold); >>> int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, = vm_size_t len, >>> vm_prot_t prot, vm_page_t *ma, int max_count); >>> -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); >>> int vm_forkproc(struct thread *, struct proc *, struct thread *, = struct vmspace *, int); >>> void vm_waitproc(struct proc *); >>> int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, = vm_prot_t, int, objtype_t, void *, vm_ooffset_t); >>>=20 >>> Modified: head/sys/vm/vm_fault.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_fault.c Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_fault.c Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$"); >>> #define PFFOR 4 >>>=20 >>> static int vm_fault_additional_pages(vm_page_t, int, int, vm_page_t = *, int *); >>> -static void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, = boolean_t); >>>=20 >>> #define VM_FAULT_READ_BEHIND 8 >>> #define VM_FAULT_READ_MAX (1 + VM_FAULT_READ_AHEAD_MAX) >>> @@ -1155,68 +1154,6 @@ error:=09 >>> } >>>=20 >>> /* >>> - * vm_fault_wire: >>> - * >>> - * Wire down a range of virtual addresses in a map. >>> - */ >>> -int >>> -vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, >>> - boolean_t fictitious) >>> -{ >>> - vm_offset_t va; >>> - int rv; >>> - >>> - /* >>> - * We simulate a fault to get the page and enter it in the = physical >>> - * map. For user wiring, we only ask for read access on = currently >>> - * read-only sections. >>> - */ >>> - for (va =3D start; va < end; va +=3D PAGE_SIZE) { >>> - rv =3D vm_fault(map, va, VM_PROT_NONE, = VM_FAULT_CHANGE_WIRING); >>> - if (rv) { >>> - if (va !=3D start) >>> - vm_fault_unwire(map, start, va, = fictitious); >>> - return (rv); >>> - } >>> - } >>> - return (KERN_SUCCESS); >>> -} >>> - >>> -/* >>> - * vm_fault_unwire: >>> - * >>> - * Unwire a range of virtual addresses in a map. >>> - */ >>> -static void >>> -vm_fault_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, >>> - boolean_t fictitious) >>> -{ >>> - vm_paddr_t pa; >>> - vm_offset_t va; >>> - vm_page_t m; >>> - pmap_t pmap; >>> - >>> - pmap =3D vm_map_pmap(map); >>> - >>> - /* >>> - * Since the pages are wired down, we must be able to get their >>> - * mappings from the physical map system. >>> - */ >>> - for (va =3D start; va < end; va +=3D PAGE_SIZE) { >>> - pa =3D pmap_extract(pmap, va); >>> - if (pa !=3D 0) { >>> - pmap_change_wiring(pmap, va, FALSE); >>> - if (!fictitious) { >>> - m =3D PHYS_TO_VM_PAGE(pa); >>> - vm_page_lock(m); >>> - vm_page_unwire(m, PQ_ACTIVE); >>> - vm_page_unlock(m); >>> - } >>> - } >>> - } >>> -} >>> - >>> -/* >>> * Routine: >>> * vm_fault_copy_entry >>> * Function: >>>=20 >>> Modified: head/sys/vm/vm_map.c >>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>> --- head/sys/vm/vm_map.c Sat Aug 2 15:05:23 2014 = (r269432) >>> +++ head/sys/vm/vm_map.c Sat Aug 2 16:10:24 2014 = (r269433) >>> @@ -140,6 +140,8 @@ static void vmspace_zdtor(void *mem, int >>> static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, >>> vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, = vm_prot_t max, >>> int cow); >>> +static void vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t = entry, >>> + vm_offset_t failed_addr); >>>=20 >>> #define ENTRY_CHARGED(e) ((e)->cred !=3D NULL || \ >>> ((e)->object.vm_object !=3D NULL && (e)->object.vm_object->cred = !=3D NULL && \ >>> @@ -2418,6 +2420,42 @@ done: >>> } >>>=20 >>> /* >>> + * vm_map_wire_entry_failure: >>> + * >>> + * Handle a wiring failure on the given entry. >>> + * >>> + * The map should be locked. >>> + */ >>> +static void >>> +vm_map_wire_entry_failure(vm_map_t map, vm_map_entry_t entry, >>> + vm_offset_t failed_addr) >>> +{ >>> + >>> + VM_MAP_ASSERT_LOCKED(map); >>> + KASSERT((entry->eflags & MAP_ENTRY_IN_TRANSITION) !=3D 0 && >>> + entry->wired_count =3D=3D 1, >>> + ("vm_map_wire_entry_failure: entry %p isn't being wired", = entry)); >>> + KASSERT(failed_addr < entry->end, >>> + ("vm_map_wire_entry_failure: entry %p was fully wired", = entry)); >>> + >>> + /* >>> + * If any pages at the start of this entry were successfully = wired, >>> + * then unwire them. >>> + */ >>> + if (failed_addr > entry->start) { >>> + pmap_unwire(map->pmap, entry->start, failed_addr); >>> + vm_object_unwire(entry->object.vm_object, entry->offset, >>> + failed_addr - entry->start, PQ_ACTIVE); >>> + } >>> + >>> + /* >>> + * Assign an out-of-range value to represent the failure to wire = this >>> + * entry. >>> + */ >>> + entry->wired_count =3D -1; >>> +} >>> + >>> +/* >>> * vm_map_wire: >>> * >>> * Implements both kernel and user wiring. >>> @@ -2427,10 +2465,10 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> int flags) >>> { >>> vm_map_entry_t entry, first_entry, tmp_entry; >>> - vm_offset_t saved_end, saved_start; >>> + vm_offset_t faddr, saved_end, saved_start; >>> unsigned int last_timestamp; >>> int rv; >>> - boolean_t fictitious, need_wakeup, result, user_wire; >>> + boolean_t need_wakeup, result, user_wire; >>> vm_prot_t prot; >>>=20 >>> if (start =3D=3D end) >>> @@ -2523,17 +2561,24 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> entry->wired_count++; >>> saved_start =3D entry->start; >>> saved_end =3D entry->end; >>> - fictitious =3D entry->object.vm_object !=3D NULL = && >>> - (entry->object.vm_object->flags & >>> - OBJ_FICTITIOUS) !=3D 0; >>> + >>> /* >>> * Release the map lock, relying on the = in-transition >>> * mark. Mark the map busy for fork. >>> */ >>> vm_map_busy(map); >>> vm_map_unlock(map); >>> - rv =3D vm_fault_wire(map, saved_start, = saved_end, >>> - fictitious); >>> + >>> + for (faddr =3D saved_start; faddr < saved_end; = faddr +=3D >>> + PAGE_SIZE) { >>> + /* >>> + * Simulate a fault to get the page and = enter >>> + * it into the physical map. >>> + */ >>> + if ((rv =3D vm_fault(map, faddr, = VM_PROT_NONE, >>> + VM_FAULT_CHANGE_WIRING)) !=3D = KERN_SUCCESS) >>> + break; >>> + } >>> vm_map_lock(map); >>> vm_map_unbusy(map); >>> if (last_timestamp + 1 !=3D map->timestamp) { >>> @@ -2552,23 +2597,22 @@ vm_map_wire(vm_map_t map, vm_offset_t st >>> first_entry =3D NULL; >>> entry =3D tmp_entry; >>> while (entry->end < saved_end) { >>> - if (rv !=3D KERN_SUCCESS) { >>> - = KASSERT(entry->wired_count =3D=3D 1, >>> - ("vm_map_wire: bad = count")); >>> - entry->wired_count =3D = -1; >>> - } >>> + /* >>> + * In case of failure, handle = entries >>> + * that were not fully wired = here; >>> + * fully wired entries are = handled >>> + * later. >>> + */ >>> + if (rv !=3D KERN_SUCCESS && >>> + faddr < entry->end) >>> + = vm_map_wire_entry_failure(map, >>> + entry, faddr); >>> entry =3D entry->next; >>> } >>> } >>> last_timestamp =3D map->timestamp; >>> if (rv !=3D KERN_SUCCESS) { >>> - KASSERT(entry->wired_count =3D=3D 1, >>> - ("vm_map_wire: bad count")); >>> - /* >>> - * Assign an out-of-range value to = represent >>> - * the failure to wire this entry. >>> - */ >>> - entry->wired_count =3D -1; >>> + vm_map_wire_entry_failure(map, entry, = faddr); >>> end =3D entry->end; >>> goto done; >>> } >>> @@ -2632,6 +2676,10 @@ done: >>> entry->wired_count =3D 0; >>> } else if (!user_wire || >>> (entry->eflags & MAP_ENTRY_USER_WIRED) =3D=3D 0) { >>> + /* >>> + * Undo the wiring. Wiring succeeded on this = entry >>> + * but failed on a later entry. =20 >>> + */ >>> if (entry->wired_count =3D=3D 1) >>> vm_map_entry_unwire(map, entry); >>> else >>>=20 >> =97=20 >> Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, = 1983 >>=20 >>=20 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 18:37:09 2014 Return-Path: Delivered-To: svn-src-all@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 4CFB6A3B; Sat, 2 Aug 2014 18:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A7662039; Sat, 2 Aug 2014 18:37:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72Ib98a010739; Sat, 2 Aug 2014 18:37:09 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72Ib9wm010738; Sat, 2 Aug 2014 18:37:09 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201408021837.s72Ib9wm010738@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 2 Aug 2014 18:37:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269439 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 18:37:09 -0000 Author: hselasky Date: Sat Aug 2 18:37:08 2014 New Revision: 269439 URL: http://svnweb.freebsd.org/changeset/base/269439 Log: - Spelling corrections Suggested by: Garrett Cooper PR: 192101 Modified: head/share/man/man9/sysctl.9 Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Sat Aug 2 17:58:20 2014 (r269438) +++ head/share/man/man9/sysctl.9 Sat Aug 2 18:37:08 2014 (r269439) @@ -243,22 +243,22 @@ See for how to create a new sysctl context. Programmers are strongly advised to use contexts to organize the dynamic OIDs which they create because when a context is destroyed all -belonging sysctls are destroyed aswell. +belonging sysctls are destroyed as well. This makes the sysctl cleanup code much simpler. -Else deletion of all created OIDs is required at module unload typically. +Else deletion of all created OIDs is required at module unload. .It Fa parent A pointer to a .Li struct sysctl_oid_list , which is the head of the parent's list of children. -This pointer is retrieved by using the +This pointer is retrieved using the .Fn SYSCTL_STATIC_CHILDREN macro for static sysctls and the .Fn SYSCTL_CHILDREN macro for dynamic sysctls. -To get the parent of an OID the +The .Fn SYSCTL_PARENT -macro shall be used. -If there is no parent this macro returns NULL. +macro can be used to get the parent of an OID. +The macro returns NULL if there is no parent. .It Fa number The OID number that will be assigned to this OID. In almost all cases this should be set to From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 18:37:23 2014 Return-Path: Delivered-To: svn-src-all@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 220B8B79; Sat, 2 Aug 2014 18:37: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA254203E; Sat, 2 Aug 2014 18:37:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72IbMf7010817; Sat, 2 Aug 2014 18:37:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72IbM5F010815; Sat, 2 Aug 2014 18:37:22 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201408021837.s72IbM5F010815@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 2 Aug 2014 18:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269440 - head/sys/dev/cxgbe/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 18:37:23 -0000 Author: np Date: Sat Aug 2 18:37:22 2014 New Revision: 269440 URL: http://svnweb.freebsd.org/changeset/base/269440 Log: cxgbe(4): Remove an unused version of t4_enable_vi. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Sat Aug 2 18:37:08 2014 (r269439) +++ head/sys/dev/cxgbe/common/common.h Sat Aug 2 18:37:22 2014 (r269440) @@ -581,8 +581,6 @@ int t4_set_addr_hash(struct adapter *ada bool ucast, u64 vec, bool sleep_ok); int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, bool rx_en, bool tx_en); -int t4_enable_vi_ns(struct adapter *adap, unsigned int mbox, unsigned int viid, - bool rx_en, bool tx_en); int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, unsigned int nblinks); int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 2 18:37:08 2014 (r269439) +++ head/sys/dev/cxgbe/common/t4_hw.c Sat Aug 2 18:37:22 2014 (r269440) @@ -5206,19 +5206,6 @@ int t4_enable_vi(struct adapter *adap, u return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); } -int t4_enable_vi_ns(struct adapter *adap, unsigned int mbox, unsigned int viid, - bool rx_en, bool tx_en) -{ - struct fw_vi_enable_cmd c; - - memset(&c, 0, sizeof(c)); - c.op_to_viid = htonl(V_FW_CMD_OP(FW_VI_ENABLE_CMD) | F_FW_CMD_REQUEST | - F_FW_CMD_EXEC | V_FW_VI_ENABLE_CMD_VIID(viid)); - c.ien_to_len16 = htonl(V_FW_VI_ENABLE_CMD_IEN(rx_en) | - V_FW_VI_ENABLE_CMD_EEN(tx_en) | FW_LEN16(c)); - return t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), NULL); -} - /** * t4_identify_port - identify a VI's port by blinking its LED * @adap: the adapter From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 19:51:11 2014 Return-Path: Delivered-To: svn-src-all@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 EED355D1; Sat, 2 Aug 2014 19:51: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC58426E1; Sat, 2 Aug 2014 19:51:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72JpArp045743; Sat, 2 Aug 2014 19:51:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72JpAMo045742; Sat, 2 Aug 2014 19:51:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201408021951.s72JpAMo045742@svn.freebsd.org> From: Alexander Motin Date: Sat, 2 Aug 2014 19:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269441 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 19:51:11 -0000 Author: mav Date: Sat Aug 2 19:51:10 2014 New Revision: 269441 URL: http://svnweb.freebsd.org/changeset/base/269441 Log: Add missing comparisons to make list IDs in EXTENDED COPY per-initiator, as they should be. Wrap it into a function to not duplicate the code. MFC after: 3 days Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 18:37:22 2014 (r269440) +++ head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 19:51:10 2014 (r269441) @@ -327,6 +327,21 @@ ctl_receive_copy_operating_parameters(st return (retval); } +static struct tpc_list * +tpc_find_list(struct ctl_lun *lun, uint32_t list_id, uint32_t init_idx) +{ + struct tpc_list *list; + + mtx_assert(&lun->lun_lock, MA_OWNED); + TAILQ_FOREACH(list, &lun->tpc_lists, links) { + if ((list->flags & EC_LIST_ID_USAGE_MASK) != + EC_LIST_ID_USAGE_NONE && list->list_id == list_id && + list->init_idx == init_idx) + break; + } + return (list); +} + int ctl_receive_copy_status_lid1(struct ctl_scsiio *ctsio) { @@ -348,11 +363,8 @@ ctl_receive_copy_status_lid1(struct ctl_ list_id = cdb->list_identifier; mtx_lock(&lun->lun_lock); - TAILQ_FOREACH(list, &lun->tpc_lists, links) { - if ((list->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && list->list_id == list_id) - break; - } + list = tpc_find_list(lun, list_id, + ctl_get_resindex(&ctsio->io_hdr.nexus)); if (list == NULL) { mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -433,12 +445,9 @@ ctl_receive_copy_failure_details(struct list_id = cdb->list_identifier; mtx_lock(&lun->lun_lock); - TAILQ_FOREACH(list, &lun->tpc_lists, links) { - if (list->completed && (list->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && list->list_id == list_id) - break; - } - if (list == NULL) { + list = tpc_find_list(lun, list_id, + ctl_get_resindex(&ctsio->io_hdr.nexus)); + if (list == NULL || !list->completed) { mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 2, /*bit_valid*/ 0, @@ -507,11 +516,8 @@ ctl_receive_copy_status_lid4(struct ctl_ list_id = scsi_4btoul(cdb->list_identifier); mtx_lock(&lun->lun_lock); - TAILQ_FOREACH(list, &lun->tpc_lists, links) { - if ((list->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && list->list_id == list_id) - break; - } + list = tpc_find_list(lun, list_id, + ctl_get_resindex(&ctsio->io_hdr.nexus)); if (list == NULL) { mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -596,11 +602,8 @@ ctl_copy_operation_abort(struct ctl_scsi list_id = scsi_4btoul(cdb->list_identifier); mtx_lock(&lun->lun_lock); - TAILQ_FOREACH(list, &lun->tpc_lists, links) { - if ((list->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && list->list_id == list_id) - break; - } + list = tpc_find_list(lun, list_id, + ctl_get_resindex(&ctsio->io_hdr.nexus)); if (list == NULL) { mtx_unlock(&lun->lun_lock); ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -1210,12 +1213,7 @@ ctl_extended_copy_lid1(struct ctl_scsiio list->lun = lun; mtx_lock(&lun->lun_lock); if ((list->flags & EC_LIST_ID_USAGE_MASK) != EC_LIST_ID_USAGE_NONE) { - TAILQ_FOREACH(tlist, &lun->tpc_lists, links) { - if ((tlist->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && - tlist->list_id == list->list_id) - break; - } + tlist = tpc_find_list(lun, list->list_id, list->init_idx); if (tlist != NULL && !tlist->completed) { mtx_unlock(&lun->lun_lock); free(list, M_CTL); @@ -1338,12 +1336,7 @@ ctl_extended_copy_lid4(struct ctl_scsiio list->lun = lun; mtx_lock(&lun->lun_lock); if ((list->flags & EC_LIST_ID_USAGE_MASK) != EC_LIST_ID_USAGE_NONE) { - TAILQ_FOREACH(tlist, &lun->tpc_lists, links) { - if ((tlist->flags & EC_LIST_ID_USAGE_MASK) != - EC_LIST_ID_USAGE_NONE && - tlist->list_id == list->list_id) - break; - } + tlist = tpc_find_list(lun, list->list_id, list->init_idx); if (tlist != NULL && !tlist->completed) { mtx_unlock(&lun->lun_lock); free(list, M_CTL); From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 19:59:19 2014 Return-Path: Delivered-To: svn-src-all@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 E279176C; Sat, 2 Aug 2014 19:59: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6AE72721; Sat, 2 Aug 2014 19:59:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72JxJlp047352; Sat, 2 Aug 2014 19:59:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72JxJjn047351; Sat, 2 Aug 2014 19:59:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201408021959.s72JxJjn047351@svn.freebsd.org> From: Alexander Motin Date: Sat, 2 Aug 2014 19:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269442 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 19:59:20 -0000 Author: mav Date: Sat Aug 2 19:59:19 2014 New Revision: 269442 URL: http://svnweb.freebsd.org/changeset/base/269442 Log: Fix some bugs in RECEIVE COPY STATUS data. MFC after: 3 days Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 19:51:10 2014 (r269441) +++ head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 19:59:19 2014 (r269442) @@ -481,7 +481,8 @@ ctl_receive_copy_failure_details(struct data = (struct scsi_receive_copy_failure_details_data *)ctsio->kern_data_ptr; if (list_copy.completed && (list_copy.error || list_copy.abort)) { - scsi_ulto4b(sizeof(*data) - 4, data->available_data); + scsi_ulto4b(sizeof(*data) - 4 + list_copy.sense_len, + data->available_data); data->copy_command_status = RCS_CCS_ERROR; } else scsi_ulto4b(0, data->available_data); @@ -553,7 +554,8 @@ ctl_receive_copy_status_lid4(struct ctl_ ctsio->kern_rel_offset = 0; data = (struct scsi_receive_copy_status_lid4_data *)ctsio->kern_data_ptr; - scsi_ulto4b(sizeof(*data) - 4, data->available_data); + scsi_ulto4b(sizeof(*data) - 4 + list_copy.sense_len, + data->available_data); data->response_to_service_action = list_copy.service_action; if (list_copy.completed) { if (list_copy.error) @@ -566,14 +568,10 @@ ctl_receive_copy_status_lid4(struct ctl_ data->copy_command_status = RCS_CCS_INPROG_FG; scsi_ulto2b(list_copy.curops, data->operation_counter); scsi_ulto4b(UINT32_MAX, data->estimated_status_update_delay); - if (list_copy.curbytes <= UINT32_MAX) { - data->transfer_count_units = RCS_TC_BYTES; - scsi_ulto4b(list_copy.curbytes, data->transfer_count); - } else { - data->transfer_count_units = RCS_TC_MBYTES; - scsi_ulto4b(list_copy.curbytes >> 20, data->transfer_count); - } + data->transfer_count_units = RCS_TC_BYTES; + scsi_u64to8b(list_copy.curbytes, data->transfer_count); scsi_ulto2b(list_copy.curseg, data->segments_processed); + data->length_of_the_sense_data_field = list_copy.sense_len; data->sense_data_length = list_copy.sense_len; memcpy(data->sense_data, &list_copy.sense_data, list_copy.sense_len); From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 20:06:37 2014 Return-Path: Delivered-To: svn-src-all@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 560CAA3E; Sat, 2 Aug 2014 20:06:37 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F86727D9; Sat, 2 Aug 2014 20:06:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72K6bVR051892; Sat, 2 Aug 2014 20:06:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72K6baa051891; Sat, 2 Aug 2014 20:06:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201408022006.s72K6baa051891@svn.freebsd.org> From: Rick Macklem Date: Sat, 2 Aug 2014 20:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269443 - stable/10/usr.sbin/nfsd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 20:06:37 -0000 Author: rmacklem Date: Sat Aug 2 20:06:36 2014 New Revision: 269443 URL: http://svnweb.freebsd.org/changeset/base/269443 Log: MFC: r268866 r243637 changed the default number of nfsd threads created, but the man page did not reflect this. This is a content change. Modified: stable/10/usr.sbin/nfsd/nfsd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/nfsd/nfsd.8 ============================================================================== --- stable/10/usr.sbin/nfsd/nfsd.8 Sat Aug 2 19:59:19 2014 (r269442) +++ stable/10/usr.sbin/nfsd/nfsd.8 Sat Aug 2 20:06:36 2014 (r269443) @@ -28,7 +28,7 @@ .\" @(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd April 23, 2011 +.Dd July 18, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -53,7 +53,7 @@ At least one .Nm must be running for a machine to operate as a server. .Pp -Unless otherwise specified, four servers for +Unless otherwise specified, eight servers per CPU for .Tn UDP transport are started. .Pp From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 20:15:00 2014 Return-Path: Delivered-To: svn-src-all@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 B2190BD0; Sat, 2 Aug 2014 20:15: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A07572899; Sat, 2 Aug 2014 20:15:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72KF03I056491; Sat, 2 Aug 2014 20:15:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72KF05N056490; Sat, 2 Aug 2014 20:15:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201408022015.s72KF05N056490@svn.freebsd.org> From: Alexander Motin Date: Sat, 2 Aug 2014 20:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269444 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 20:15:00 -0000 Author: mav Date: Sat Aug 2 20:15:00 2014 New Revision: 269444 URL: http://svnweb.freebsd.org/changeset/base/269444 Log: Plug EXTENDED COPY request data memory leak. MFC after: 3 days Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 20:06:36 2014 (r269443) +++ head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 20:15:00 2014 (r269444) @@ -948,6 +948,8 @@ done: free(list, M_CTL); } else { list->completed = 1; + free(list->params, M_CTL); + list->params = NULL; list->sense_data = ctsio->sense_data; list->sense_len = ctsio->sense_len; list->scsi_status = ctsio->scsi_status; From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 20:37:03 2014 Return-Path: Delivered-To: svn-src-all@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 8910AEED; Sat, 2 Aug 2014 20:37:03 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76E802A75; Sat, 2 Aug 2014 20:37:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72Kb38q066168; Sat, 2 Aug 2014 20:37:03 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72Kb3it066167; Sat, 2 Aug 2014 20:37:03 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201408022037.s72Kb3it066167@svn.freebsd.org> From: Michael Tuexen Date: Sat, 2 Aug 2014 20:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269445 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 20:37:03 -0000 Author: tuexen Date: Sat Aug 2 20:37:02 2014 New Revision: 269445 URL: http://svnweb.freebsd.org/changeset/base/269445 Log: Fix a copy and paste error. X-MFC with: 269436 Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Aug 2 20:15:00 2014 (r269444) +++ head/sys/netinet/sctp_usrreq.c Sat Aug 2 20:37:02 2014 (r269445) @@ -5903,7 +5903,7 @@ sctp_setopt(struct socket *so, int optna if (av->assoc_value == 0) { inp->ecn_supported = 0; } else { - inp->ecn_supported = 0; + inp->ecn_supported = 1; } SCTP_INP_WUNLOCK(inp); } else { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 20:58:47 2014 Return-Path: Delivered-To: svn-src-all@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 9DDE335C; Sat, 2 Aug 2014 20:58: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89A462CE7; Sat, 2 Aug 2014 20:58:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72KwlKA075179; Sat, 2 Aug 2014 20:58:47 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72KwlUf075175; Sat, 2 Aug 2014 20:58:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201408022058.s72KwlUf075175@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 2 Aug 2014 20:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269446 - in stable/10/sys: kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 20:58:47 -0000 Author: hselasky Date: Sat Aug 2 20:58:46 2014 New Revision: 269446 URL: http://svnweb.freebsd.org/changeset/base/269446 Log: Partial MFC of r267961, r267973, r267985, r267992, r267993 and r268005: Backport some macro definitions to make backporting code from FreeBSD current easier. Modified: stable/10/sys/kern/kern_mib.c stable/10/sys/sys/sysctl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_mib.c ============================================================================== --- stable/10/sys/kern/kern_mib.c Sat Aug 2 20:37:02 2014 (r269445) +++ stable/10/sys/kern/kern_mib.c Sat Aug 2 20:58:46 2014 (r269446) @@ -55,35 +55,35 @@ __FBSDID("$FreeBSD$"); #include #include -SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(0, sysctl, CTLFLAG_RW, 0, "Sysctl internal magic"); -SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW|CTLFLAG_CAPRD, 0, +SYSCTL_ROOT_NODE(CTL_KERN, kern, CTLFLAG_RW|CTLFLAG_CAPRD, 0, "High kernel, proc, limits &c"); -SYSCTL_NODE(, CTL_VM, vm, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_VM, vm, CTLFLAG_RW, 0, "Virtual memory"); -SYSCTL_NODE(, CTL_VFS, vfs, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_VFS, vfs, CTLFLAG_RW, 0, "File system"); -SYSCTL_NODE(, CTL_NET, net, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_NET, net, CTLFLAG_RW, 0, "Network, (see socket.h)"); -SYSCTL_NODE(, CTL_DEBUG, debug, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_DEBUG, debug, CTLFLAG_RW, 0, "Debugging"); SYSCTL_NODE(_debug, OID_AUTO, sizeof, CTLFLAG_RW, 0, "Sizeof various things"); -SYSCTL_NODE(, CTL_HW, hw, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_HW, hw, CTLFLAG_RW, 0, "hardware"); -SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_MACHDEP, machdep, CTLFLAG_RW, 0, "machine dependent"); -SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_USER, user, CTLFLAG_RW, 0, "user-level"); -SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, "p1003_1b, (see p1003_1b.h)"); -SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(OID_AUTO, compat, CTLFLAG_RW, 0, "Compatibility code"); -SYSCTL_NODE(, OID_AUTO, security, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(OID_AUTO, security, CTLFLAG_RW, 0, "Security"); #ifdef REGRESSION -SYSCTL_NODE(, OID_AUTO, regression, CTLFLAG_RW, 0, +SYSCTL_ROOT_NODE(OID_AUTO, regression, CTLFLAG_RW, 0, "Regression test MIB"); #endif Modified: stable/10/sys/sys/sysctl.h ============================================================================== --- stable/10/sys/sys/sysctl.h Sat Aug 2 20:37:02 2014 (r269445) +++ stable/10/sys/sys/sysctl.h Sat Aug 2 20:58:46 2014 (r269446) @@ -92,6 +92,7 @@ struct ctlname { #define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */ #define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */ #define CTLFLAG_STATS 0x00002000 /* Statistics, not a tuneable */ +#define CTLFLAG_NOFETCH 0x00001000 /* Don't fetch tunable from getenv() */ #define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR) /* @@ -206,6 +207,7 @@ void sysctl_unregister_oid(struct sysctl /* Hide these in macros. */ #define SYSCTL_CHILDREN(oid_ptr) \ (struct sysctl_oid_list *)(oid_ptr)->oid_arg1 +#define SYSCTL_PARENT(oid_ptr) NULL /* not supported */ #define SYSCTL_CHILDREN_SET(oid_ptr, val) (oid_ptr)->oid_arg1 = (val) #define SYSCTL_STATIC_CHILDREN(oid_name) (&sysctl_##oid_name##_children) @@ -296,12 +298,19 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr)) +/* This constructs a root node from which other nodes can hang. */ +#define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \ + SYSCTL_NODE(, nbr, name, access, handler, descr) + /* This constructs a node from which other oids can hang. */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name); \ SYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access), \ (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, "N", descr) +#define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ + SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(), nbr, name, access, handler, descr) + #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr)) From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 21:01:59 2014 Return-Path: Delivered-To: svn-src-all@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 32A3F58C; Sat, 2 Aug 2014 21:01: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F7F92E84; Sat, 2 Aug 2014 21:01:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72L1whI079009; Sat, 2 Aug 2014 21:01:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72L1wUI079006; Sat, 2 Aug 2014 21:01:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201408022101.s72L1wUI079006@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 2 Aug 2014 21:01:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269447 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 21:01:59 -0000 Author: hselasky Date: Sat Aug 2 21:01:58 2014 New Revision: 269447 URL: http://svnweb.freebsd.org/changeset/base/269447 Log: MFC r269139: Split the XHCI TRB allocations into smaller parts, so that we don't end up allocating contiguous busdma buffers above PAGE_SIZE bytes. Modified: stable/10/sys/dev/usb/controller/xhci.c stable/10/sys/dev/usb/controller/xhci.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Sat Aug 2 20:58:46 2014 (r269446) +++ stable/10/sys/dev/usb/controller/xhci.c Sat Aug 2 21:01:58 2014 (r269447) @@ -2682,24 +2682,23 @@ xhci_alloc_device_ext(struct usb_device goto error; } - pc = &sc->sc_hw.devs[index].endpoint_pc; - pg = &sc->sc_hw.devs[index].endpoint_pg; + /* initialise all endpoint LINK TRBs */ - /* need to initialize the page cache */ - pc->tag_parent = sc->sc_bus.dma_parent_tag; + for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) { - if (usb_pc_alloc_mem(pc, pg, - sizeof(struct xhci_dev_endpoint_trbs), XHCI_PAGE_SIZE)) { - goto error; - } + pc = &sc->sc_hw.devs[index].endpoint_pc[i]; + pg = &sc->sc_hw.devs[index].endpoint_pg[i]; - /* initialise all endpoint LINK TRBs */ + /* need to initialize the page cache */ + pc->tag_parent = sc->sc_bus.dma_parent_tag; - for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) { + if (usb_pc_alloc_mem(pc, pg, + sizeof(struct xhci_dev_endpoint_trbs), XHCI_TRB_ALIGN)) { + goto error; + } /* lookup endpoint TRB ring */ - usbd_get_page(pc, (uintptr_t)& - ((struct xhci_dev_endpoint_trbs *)0)->trb[i][0], &buf_ep); + usbd_get_page(pc, 0, &buf_ep); /* get TRB pointer */ trb = buf_ep.buffer; @@ -2713,9 +2712,9 @@ xhci_alloc_device_ext(struct usb_device trb->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); trb->dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK)); - } - usb_pc_cpu_flush(pc); + usb_pc_cpu_flush(pc); + } xhci_set_slot_pointer(sc, index, buf_dev.physaddr); @@ -2732,13 +2731,15 @@ xhci_free_device_ext(struct usb_device * { struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); uint8_t index; + uint8_t i; index = udev->controller_slot_id; xhci_set_slot_pointer(sc, index, 0); usb_pc_free_mem(&sc->sc_hw.devs[index].device_pc); usb_pc_free_mem(&sc->sc_hw.devs[index].input_pc); - usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc); + for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) + usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc[i]); } static struct xhci_endpoint_ext * @@ -2759,10 +2760,9 @@ xhci_get_endpoint_ext(struct usb_device index = udev->controller_slot_id; - pc = &sc->sc_hw.devs[index].endpoint_pc; + pc = &sc->sc_hw.devs[index].endpoint_pc[epno]; - usbd_get_page(pc, (uintptr_t)&((struct xhci_dev_endpoint_trbs *)0)-> - trb[epno][0], &buf_ep); + usbd_get_page(pc, 0, &buf_ep); pepext = &sc->sc_hw.devs[index].endp[epno]; pepext->page_cache = pc; Modified: stable/10/sys/dev/usb/controller/xhci.h ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.h Sat Aug 2 20:58:46 2014 (r269446) +++ stable/10/sys/dev/usb/controller/xhci.h Sat Aug 2 21:01:58 2014 (r269447) @@ -316,8 +316,8 @@ struct xhci_trb { } __aligned(4); struct xhci_dev_endpoint_trbs { - struct xhci_trb trb[XHCI_MAX_ENDPOINTS] - [(XHCI_MAX_STREAMS * XHCI_MAX_TRANSFERS) + XHCI_MAX_STREAMS]; + struct xhci_trb trb[(XHCI_MAX_STREAMS * + XHCI_MAX_TRANSFERS) + XHCI_MAX_STREAMS]; }; #define XHCI_TD_PAGE_NBUF 17 /* units, room enough for 64Kbytes */ @@ -385,11 +385,11 @@ enum { struct xhci_hw_dev { struct usb_page_cache device_pc; struct usb_page_cache input_pc; - struct usb_page_cache endpoint_pc; + struct usb_page_cache endpoint_pc[XHCI_MAX_ENDPOINTS]; struct usb_page device_pg; struct usb_page input_pg; - struct usb_page endpoint_pg; + struct usb_page endpoint_pg[XHCI_MAX_ENDPOINTS]; struct xhci_endpoint_ext endp[XHCI_MAX_ENDPOINTS]; From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 21:36:44 2014 Return-Path: Delivered-To: svn-src-all@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 0E8B6E8A; Sat, 2 Aug 2014 21:36: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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFC502136; Sat, 2 Aug 2014 21:36:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72LahWT093566; Sat, 2 Aug 2014 21:36:43 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72LafXl093551; Sat, 2 Aug 2014 21:36:41 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201408022136.s72LafXl093551@svn.freebsd.org> From: Michael Tuexen Date: Sat, 2 Aug 2014 21:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269448 - in head: lib/libc/net 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 21:36:44 -0000 Author: tuexen Date: Sat Aug 2 21:36:40 2014 New Revision: 269448 URL: http://svnweb.freebsd.org/changeset/base/269448 Log: Add support for the SCTP_PR_SUPPORTED socket option as specified in http://tools.ietf.org/html/draft-ietf-tsvwg-sctp-prpolicies Add also a sysctl controlling the default of the end-points. MFC after: 1 week Modified: head/lib/libc/net/sctp_sys_calls.c head/sys/netinet/sctp.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/lib/libc/net/sctp_sys_calls.c Sat Aug 2 21:36:40 2014 (r269448) @@ -353,6 +353,9 @@ sctp_opt_info(int sd, sctp_assoc_t id, i case SCTP_ECN_SUPPORTED: ((struct sctp_assoc_value *)arg)->assoc_id = id; break; + case SCTP_PR_SUPPORTED: + ((struct sctp_assoc_value *)arg)->assoc_id = id; + break; case SCTP_MAX_BURST: ((struct sctp_assoc_value *)arg)->assoc_id = id; break; Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp.h Sat Aug 2 21:36:40 2014 (r269448) @@ -122,6 +122,7 @@ struct sctp_paramhdr { #define SCTP_PEER_ADDR_THLDS 0x00000023 #define SCTP_REMOTE_UDP_ENCAPS_PORT 0x00000024 #define SCTP_ECN_SUPPORTED 0x00000025 +#define SCTP_PR_SUPPORTED 0x00000026 /* * read-only options Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_indata.c Sat Aug 2 21:36:40 2014 (r269448) @@ -2960,7 +2960,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t num_dests_sacked++; } } - if (stcb->asoc.peer_supports_prsctp) { + if (stcb->asoc.prsctp_supported) { (void)SCTP_GETTIME_TIMEVAL(&now); } TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { @@ -2981,7 +2981,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t /* done */ break; } - if (stcb->asoc.peer_supports_prsctp) { + if (stcb->asoc.prsctp_supported) { if ((PR_SCTP_TTL_ENABLED(tp1->flags)) && tp1->sent < SCTP_DATAGRAM_ACKED) { /* Is it expired? */ if (timevalcmp(&now, &tp1->rec.data.timetodrop, >)) { @@ -3235,7 +3235,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t /* remove from the total flight */ sctp_total_flight_decrease(stcb, tp1); - if ((stcb->asoc.peer_supports_prsctp) && + if ((stcb->asoc.prsctp_supported) && (PR_SCTP_RTX_ENABLED(tp1->flags))) { /* * Has it been retransmitted tv_sec times? - @@ -3380,7 +3380,7 @@ sctp_try_advance_peer_ack_point(struct s struct timeval now; int now_filled = 0; - if (asoc->peer_supports_prsctp == 0) { + if (asoc->prsctp_supported == 0) { return (NULL); } TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { @@ -4042,7 +4042,7 @@ again: asoc->advanced_peer_ack_point = cumack; } /* PR-Sctp issues need to be addressed too */ - if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { + if ((asoc->prsctp_supported) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; uint32_t old_adv_peer_ack_point; @@ -4479,7 +4479,7 @@ sctp_handle_sack(struct mbuf *m, int off sctp_free_bufspace(stcb, asoc, tp1, 1); sctp_m_freem(tp1->data); tp1->data = NULL; - if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(tp1->flags)) { + if (asoc->prsctp_supported && PR_SCTP_BUF_ENABLED(tp1->flags)) { asoc->sent_queue_cnt_removeable--; } } @@ -4891,7 +4891,7 @@ again: asoc->advanced_peer_ack_point = cum_ack; } /* C2. try to further move advancedPeerAckPoint ahead */ - if ((asoc->peer_supports_prsctp) && (asoc->pr_sctp_cnt > 0)) { + if ((asoc->prsctp_supported) && (asoc->pr_sctp_cnt > 0)) { struct sctp_tmit_chunk *lchk; uint32_t old_adv_peer_ack_point; Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_input.c Sat Aug 2 21:36:40 2014 (r269448) @@ -1082,7 +1082,7 @@ sctp_process_unrecog_chunk(struct sctp_t sctp_asconf_cleanup(stcb, net); break; case SCTP_FORWARD_CUM_TSN: - stcb->asoc.peer_supports_prsctp = 0; + stcb->asoc.prsctp_supported = 0; break; default: SCTPDBG(SCTP_DEBUG_INPUT2, @@ -1106,7 +1106,7 @@ sctp_process_unrecog_param(struct sctp_t switch (ntohs(pbad->param_type)) { /* pr-sctp draft */ case SCTP_PRSCTP_SUPPORTED: - stcb->asoc.peer_supports_prsctp = 0; + stcb->asoc.prsctp_supported = 0; break; case SCTP_SUPPORTED_CHUNK_EXT: break; @@ -2786,6 +2786,7 @@ sctp_handle_cookie_echo(struct mbuf *m, inp->sctp_frag_point = (*inp_p)->sctp_frag_point; inp->sctp_cmt_on_off = (*inp_p)->sctp_cmt_on_off; inp->ecn_supported = (*inp_p)->ecn_supported; + inp->prsctp_supported = (*inp_p)->prsctp_supported; inp->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; inp->local_strreset_support = (*inp_p)->local_strreset_support; Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_output.c Sat Aug 2 21:36:40 2014 (r269448) @@ -4792,13 +4792,14 @@ sctp_send_initiate(struct sctp_inpcb *in ph->param_length = htons(parameter_len); chunk_len += parameter_len; } - /* And now tell the peer we do support PR-SCTP. */ - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); - ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); - ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); - ph->param_length = htons(parameter_len); - chunk_len += parameter_len; - + /* PR-SCTP supported parameter */ + if (stcb->asoc.prsctp_supported == 1) { + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; + } /* Add NAT friendly parameter. */ if (SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly)) { parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); @@ -4813,7 +4814,9 @@ sctp_send_initiate(struct sctp_inpcb *in pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); pr_supported->chunk_types[num_ext++] = SCTP_ASCONF; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF_ACK; - pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; + if (stcb->asoc.prsctp_supported == 1) { + pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; + } pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED; pr_supported->chunk_types[num_ext++] = SCTP_STREAM_RESET; if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { @@ -5890,13 +5893,15 @@ do_a_abort: ph->param_length = htons(parameter_len); chunk_len += parameter_len; } - /* And now tell the peer we do pr-sctp */ - parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); - ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); - ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); - ph->param_length = htons(parameter_len); - chunk_len += parameter_len; - + /* PR-SCTP supported parameter */ + if (((asoc != NULL) && (asoc->prsctp_supported == 1)) || + ((asoc == NULL) && (inp->prsctp_supported == 1))) { + parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); + ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+chunk_len); + ph->param_type = htons(SCTP_PRSCTP_SUPPORTED); + ph->param_length = htons(parameter_len); + chunk_len += parameter_len; + } /* Add NAT friendly parameter */ if (nat_friendly) { parameter_len = (uint16_t) sizeof(struct sctp_paramhdr); @@ -5911,7 +5916,10 @@ do_a_abort: pr_supported->ph.param_type = htons(SCTP_SUPPORTED_CHUNK_EXT); pr_supported->chunk_types[num_ext++] = SCTP_ASCONF; pr_supported->chunk_types[num_ext++] = SCTP_ASCONF_ACK; - pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; + if (((asoc != NULL) && (asoc->prsctp_supported == 1)) || + ((asoc == NULL) && (inp->prsctp_supported == 1))) { + pr_supported->chunk_types[num_ext++] = SCTP_FORWARD_CUM_TSN; + } pr_supported->chunk_types[num_ext++] = SCTP_PACKET_DROPPED; pr_supported->chunk_types[num_ext++] = SCTP_STREAM_RESET; if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) { @@ -6093,7 +6101,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, *nchk; SCTP_TCB_LOCK_ASSERT(stcb); - if ((asoc->peer_supports_prsctp) && + if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { /* @@ -12948,7 +12956,7 @@ skip_preblock: continue; } /* PR-SCTP? */ - if ((asoc->peer_supports_prsctp) && (asoc->sent_queue_cnt_removeable > 0)) { + if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { /* * This is ugly but we must assure locking * order Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_pcb.c Sat Aug 2 21:36:40 2014 (r269448) @@ -2484,6 +2484,7 @@ sctp_inpcb_alloc(struct socket *so, uint inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT; inp->sctp_cmt_on_off = SCTP_BASE_SYSCTL(sctp_cmt_on_off); inp->ecn_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_ecn_enable); + inp->prsctp_supported = (uint8_t) SCTP_BASE_SYSCTL(sctp_pr_enable); /* init the small hash table we use to track asocid <-> tcb */ inp->sctp_asocidhash = SCTP_HASH_INIT(SCTP_STACK_VTAG_HASH_SIZE, &inp->hashasocidmark); if (inp->sctp_asocidhash == NULL) { @@ -6082,6 +6083,7 @@ sctp_load_addresses_from_init(struct sct uint32_t keylen; int got_random = 0, got_hmacs = 0, got_chklist = 0; uint8_t ecn_supported; + uint8_t prsctp_supported; #ifdef INET struct sockaddr_in sin; @@ -6112,6 +6114,7 @@ sctp_load_addresses_from_init(struct sct } /* Turn off ECN until we get through all params */ ecn_supported = 0; + prsctp_supported = 0; TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { /* mark all addresses that we have currently on the list */ net->dest_state |= SCTP_ADDR_NOT_IN_ASSOC; @@ -6436,7 +6439,7 @@ sctp_load_addresses_from_init(struct sct stcb->asoc.peer_supports_nat = 1; } else if (ptype == SCTP_PRSCTP_SUPPORTED) { /* Peer supports pr-sctp */ - stcb->asoc.peer_supports_prsctp = 1; + prsctp_supported = 1; } else if (ptype == SCTP_SUPPORTED_CHUNK_EXT) { /* A supported extension chunk */ struct sctp_supported_chunk_types_param *pr_supported; @@ -6449,7 +6452,6 @@ sctp_load_addresses_from_init(struct sct return (-25); } stcb->asoc.peer_supports_asconf = 0; - stcb->asoc.peer_supports_prsctp = 0; stcb->asoc.peer_supports_pktdrop = 0; stcb->asoc.peer_supports_strreset = 0; stcb->asoc.peer_supports_nr_sack = 0; @@ -6463,7 +6465,7 @@ sctp_load_addresses_from_init(struct sct stcb->asoc.peer_supports_asconf = 1; break; case SCTP_FORWARD_CUM_TSN: - stcb->asoc.peer_supports_prsctp = 1; + prsctp_supported = 1; break; case SCTP_PACKET_DROPPED: stcb->asoc.peer_supports_pktdrop = 1; @@ -6613,6 +6615,7 @@ next_param: } } stcb->asoc.ecn_supported &= ecn_supported; + stcb->asoc.prsctp_supported &= prsctp_supported; /* validate authentication required parameters */ if (got_random && got_hmacs) { stcb->asoc.peer_supports_auth = 1; Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_pcb.h Sat Aug 2 21:36:40 2014 (r269448) @@ -407,6 +407,7 @@ struct sctp_inpcb { uint8_t local_strreset_support; uint32_t sctp_cmt_on_off; uint8_t ecn_supported; + uint8_t prsctp_supported; struct sctp_nonpad_sndrcvinfo def_send; /*- * These three are here for the sosend_dgram Modified: head/sys/netinet/sctp_peeloff.c ============================================================================== --- head/sys/netinet/sctp_peeloff.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_peeloff.c Sat Aug 2 21:36:40 2014 (r269448) @@ -119,6 +119,7 @@ sctp_do_peeloff(struct socket *head, str n_inp->sctp_frag_point = inp->sctp_frag_point; n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; n_inp->ecn_supported = inp->ecn_supported; + n_inp->prsctp_supported = inp->prsctp_supported; n_inp->partial_delivery_point = inp->partial_delivery_point; n_inp->sctp_context = inp->sctp_context; n_inp->local_strreset_support = inp->local_strreset_support; Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_structs.h Sat Aug 2 21:36:40 2014 (r269448) @@ -1150,8 +1150,9 @@ struct sctp_association { * sum is updated as well. */ - /* Flag to tell if ECN is allowed */ + /* Flags whether an extension is supported or not */ uint8_t ecn_supported; + uint8_t prsctp_supported; /* Did the peer make the stream config (add out) request */ uint8_t peer_req_out; @@ -1160,8 +1161,6 @@ struct sctp_association { uint8_t peer_supports_asconf; /* EY - flag to indicate if peer can do nr_sack */ uint8_t peer_supports_nr_sack; - /* pr-sctp support flag */ - uint8_t peer_supports_prsctp; /* peer authentication support flag */ uint8_t peer_supports_auth; /* stream resets are supported by the peer */ Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_sysctl.c Sat Aug 2 21:36:40 2014 (r269448) @@ -54,6 +54,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_auto_asconf) = SCTPCTL_AUTOASCONF_DEFAULT; SCTP_BASE_SYSCTL(sctp_multiple_asconfs) = SCTPCTL_MULTIPLEASCONFS_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; + SCTP_BASE_SYSCTL(sctp_pr_enable) = SCTPCTL_PR_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; @@ -600,6 +601,7 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_recvspace), SCTPCTL_RECVSPACE_MIN, SCTPCTL_RECVSPACE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_auto_asconf), SCTPCTL_AUTOASCONF_MIN, SCTPCTL_AUTOASCONF_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); + RANGECHK(SCTP_BASE_SYSCTL(sctp_pr_enable), SCTPCTL_PR_ENABLE_MIN, SCTPCTL_PR_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); @@ -861,6 +863,10 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT &SCTP_BASE_SYSCTL(sctp_ecn_enable), 0, sysctl_sctp_check, "IU", SCTPCTL_ECN_ENABLE_DESC); +SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, pr_enable, CTLTYPE_UINT | CTLFLAG_RW, + &SCTP_BASE_SYSCTL(sctp_pr_enable), 0, sysctl_sctp_check, "IU", + SCTPCTL_PR_ENABLE_DESC); + SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_sacks, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", SCTPCTL_STRICT_SACKS_DESC); Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_sysctl.h Sat Aug 2 21:36:40 2014 (r269448) @@ -45,6 +45,7 @@ struct sctp_sysctl { uint32_t sctp_auto_asconf; uint32_t sctp_multiple_asconfs; uint32_t sctp_ecn_enable; + uint32_t sctp_pr_enable; uint32_t sctp_fr_max_burst_default; uint32_t sctp_strict_sacks; uint32_t sctp_peer_chunk_oh; @@ -154,6 +155,12 @@ struct sctp_sysctl { #define SCTPCTL_ECN_ENABLE_MAX 1 #define SCTPCTL_ECN_ENABLE_DEFAULT 1 +/* pr_enable: Enable PR-SCTP */ +#define SCTPCTL_PR_ENABLE_DESC "Enable PR-SCTP" +#define SCTPCTL_PR_ENABLE_MIN 0 +#define SCTPCTL_PR_ENABLE_MAX 1 +#define SCTPCTL_PR_ENABLE_DEFAULT 1 + /* strict_sacks: Enable SCTP Strict SACK checking */ #define SCTPCTL_STRICT_SACKS_DESC "Enable SCTP Strict SACK checking" #define SCTPCTL_STRICT_SACKS_MIN 0 Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_timer.c Sat Aug 2 21:36:40 2014 (r269448) @@ -445,7 +445,7 @@ sctp_recover_sent_list(struct sctp_tcb * sctp_free_bufspace(stcb, asoc, chk, 1); sctp_m_freem(chk->data); chk->data = NULL; - if (asoc->peer_supports_prsctp && PR_SCTP_BUF_ENABLED(chk->flags)) { + if (asoc->prsctp_supported && PR_SCTP_BUF_ENABLED(chk->flags)) { asoc->sent_queue_cnt_removeable--; } } @@ -600,7 +600,7 @@ start_again: continue; } } - if (stcb->asoc.peer_supports_prsctp && PR_SCTP_TTL_ENABLED(chk->flags)) { + if (stcb->asoc.prsctp_supported && PR_SCTP_TTL_ENABLED(chk->flags)) { /* Is it expired? */ if (timevalcmp(&now, &chk->rec.data.timetodrop, >)) { /* Yes so drop it */ @@ -614,7 +614,7 @@ start_again: continue; } } - if (stcb->asoc.peer_supports_prsctp && PR_SCTP_RTX_ENABLED(chk->flags)) { + if (stcb->asoc.prsctp_supported && PR_SCTP_RTX_ENABLED(chk->flags)) { /* Has it been retransmitted tv_sec times? */ if (chk->snd_count > chk->rec.data.timetodrop.tv_sec) { if (chk->data) { @@ -957,7 +957,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net); return (0); } - if (stcb->asoc.peer_supports_prsctp) { + if (stcb->asoc.prsctp_supported) { struct sctp_tmit_chunk *lchk; lchk = sctp_try_advance_peer_ack_point(stcb, &stcb->asoc); Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctp_usrreq.c Sat Aug 2 21:36:40 2014 (r269448) @@ -3321,6 +3321,33 @@ flags_out: } break; } + case SCTP_PR_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + av->assoc_value = stcb->asoc.prsctp_supported; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_RLOCK(inp); + av->assoc_value = inp->prsctp_supported; + SCTP_INP_RUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + if (error == 0) { + *optsize = sizeof(struct sctp_assoc_value); + } + break; + } case SCTP_ENABLE_STREAM_RESET: { struct sctp_assoc_value *av; @@ -5913,6 +5940,35 @@ sctp_setopt(struct socket *so, int optna } break; } + case SCTP_PR_SUPPORTED: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_WLOCK(inp); + if (av->assoc_value == 0) { + inp->prsctp_supported = 0; + } else { + inp->prsctp_supported = 1; + } + SCTP_INP_WUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + break; + } default: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); error = ENOPROTOOPT; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Aug 2 21:01:58 2014 (r269447) +++ head/sys/netinet/sctputil.c Sat Aug 2 21:36:40 2014 (r269448) @@ -905,6 +905,7 @@ sctp_init_asoc(struct sctp_inpcb *inp, s asoc->cookie_life = inp->sctp_ep.def_cookie_life; asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off; asoc->ecn_supported = inp->ecn_supported; + asoc->prsctp_supported = inp->prsctp_supported; asoc->sctp_nr_sack_on_off = (uint8_t) SCTP_BASE_SYSCTL(sctp_nr_sack_on_off); asoc->sctp_cmt_pf = (uint8_t) 0; asoc->sctp_frag_point = inp->sctp_frag_point; @@ -2620,7 +2621,7 @@ sctp_notify_assoc_change(uint16_t state, if (notif_len > sizeof(struct sctp_assoc_change)) { if ((state == SCTP_COMM_UP) || (state == SCTP_RESTART)) { i = 0; - if (stcb->asoc.peer_supports_prsctp) { + if (stcb->asoc.prsctp_supported) { sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; } if (stcb->asoc.peer_supports_auth) { From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 22:25:25 2014 Return-Path: Delivered-To: svn-src-all@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 0080D81C; Sat, 2 Aug 2014 22:25:24 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0E4A25DE; Sat, 2 Aug 2014 22:25:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72MPOFU016651; Sat, 2 Aug 2014 22:25:24 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72MPOsB016650; Sat, 2 Aug 2014 22:25:24 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201408022225.s72MPOsB016650@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 2 Aug 2014 22:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269449 - stable/10/lib/libkvm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 22:25:25 -0000 Author: marcel Date: Sat Aug 2 22:25:24 2014 New Revision: 269449 URL: http://svnweb.freebsd.org/changeset/base/269449 Log: MFC 259910, 260023, 260028, 260600 & 260701: o Fix "kptdir is itself virtual" error, caused by having the kptdir in PBVM. o Allow building a cross libkvm for ia64. o Add support for virtual cores (aka minidumps). o We don't have to worry about page sizes when working on virtual cores. o Handle truncation of the size returned by _kvm_kvatop(). Modified: stable/10/lib/libkvm/kvm_ia64.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libkvm/kvm_ia64.c ============================================================================== --- stable/10/lib/libkvm/kvm_ia64.c Sat Aug 2 21:36:40 2014 (r269448) +++ stable/10/lib/libkvm/kvm_ia64.c Sat Aug 2 22:25:24 2014 (r269449) @@ -32,12 +32,21 @@ #include #include +#ifndef CROSS_LIBKVM #include #include +#include #include +#else +#include "../../sys/ia64/include/atomic.h" +#include "../../sys/ia64/include/bootinfo.h" +#include "../../sys/ia64/include/elf.h" +#include "../../sys/ia64/include/pte.h" +#endif #include #include +#include #include #include @@ -55,6 +64,8 @@ #define PBVM_BASE 0x9ffc000000000000UL #define PBVM_PGSZ (64 * 1024) +typedef size_t (a2p_f)(kvm_t *, uint64_t, off_t *); + struct vmstate { void *mmapbase; size_t mmapsize; @@ -62,6 +73,7 @@ struct vmstate { u_long kptdir; u_long *pbvm_pgtbl; u_int pbvm_pgtblsz; + a2p_f *kvatop; }; /* @@ -70,7 +82,7 @@ struct vmstate { * set of headers. */ static int -_kvm_maphdrs(kvm_t *kd, size_t sz) +ia64_maphdrs(kvm_t *kd, size_t sz) { struct vmstate *vm = kd->vmst; @@ -91,38 +103,103 @@ _kvm_maphdrs(kvm_t *kd, size_t sz) } /* - * Translate a physical memory address to a file-offset in the crash-dump. + * Physical core support. */ + static size_t -_kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) +phys_addr2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz) { - Elf64_Ehdr *e = kd->vmst->mmapbase; - Elf64_Phdr *p = (Elf64_Phdr*)((char*)e + e->e_phoff); - int n = e->e_phnum; - - if (pa != REGION_ADDR(pa)) { - _kvm_err(kd, kd->program, "internal error"); - return (0); - } - + Elf64_Ehdr *e; + Elf64_Phdr *p; + int n; + + if (pa != REGION_ADDR(pa)) + goto fail; + + e = (Elf64_Ehdr *)(kd->vmst->mmapbase); + n = e->e_phnum; + p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); while (n && (pa < p->p_paddr || pa >= p->p_paddr + p->p_memsz)) p++, n--; if (n == 0) - return (0); + goto fail; *ofs = (pa - p->p_paddr) + p->p_offset; if (pgsz == 0) return (p->p_memsz - (pa - p->p_paddr)); return (pgsz - ((size_t)pa & (pgsz - 1))); + + fail: + _kvm_err(kd, kd->program, "invalid physical address %#jx", + (uintmax_t)pa); + return (0); +} + +static size_t +phys_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) +{ + struct ia64_lpte pte; + uint64_t pa, pgaddr, pt0addr, pt1addr; + size_t pgno, pgsz, pt0no, pt1no; + + if (va >= REGION_BASE(6)) { + /* Regions 6 and 7: direct mapped. */ + pa = REGION_ADDR(va); + return (phys_addr2off(kd, pa, ofs, 0)); + } else if (va >= REGION_BASE(5)) { + /* Region 5: Kernel Virtual Memory. */ + va = REGION_ADDR(va); + pgsz = kd->vmst->pagesize; + pt0no = KPTE_DIR0_INDEX(va, pgsz); + pt1no = KPTE_DIR1_INDEX(va, pgsz); + pgno = KPTE_PTE_INDEX(va, pgsz); + if (pt0no >= NKPTEDIR(pgsz)) + goto fail; + pt0addr = kd->vmst->kptdir + (pt0no << 3); + if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) + goto fail; + if (pt1addr == 0) + goto fail; + pt1addr += pt1no << 3; + if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) + goto fail; + if (pgaddr == 0) + goto fail; + pgaddr += pgno * sizeof(pte); + if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) + goto fail; + if (!(pte.pte & PTE_PRESENT)) + goto fail; + pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); + return (phys_addr2off(kd, pa, ofs, pgsz)); + } else if (va >= PBVM_BASE) { + /* Region 4: Pre-Boot Virtual Memory (PBVM). */ + va -= PBVM_BASE; + pgsz = PBVM_PGSZ; + pt0no = va / pgsz; + if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) + goto fail; + pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; + if (!(pt0addr & PTE_PRESENT)) + goto fail; + pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; + return (phys_addr2off(kd, pa, ofs, pgsz)); + } + + fail: + _kvm_err(kd, kd->program, "invalid kernel virtual address %#jx", + (uintmax_t)va); + *ofs = -1; + return (0); } static ssize_t -_kvm_read_phys(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) +phys_read(kvm_t *kd, uint64_t pa, void *buf, size_t bufsz) { off_t ofs; size_t sz; - sz = _kvm_pa2off(kd, pa, &ofs, 0); + sz = phys_addr2off(kd, pa, &ofs, 0); if (sz < bufsz) return ((ssize_t)sz); @@ -131,6 +208,50 @@ _kvm_read_phys(kvm_t *kd, uint64_t pa, v return (read(kd->pmfd, buf, bufsz)); } +/* + * Virtual core support (aka minidump). + */ + +static size_t +virt_addr2off(kvm_t *kd, uint64_t va, off_t *ofs, size_t pgsz) +{ + Elf64_Ehdr *e; + Elf64_Phdr *p; + int n; + + if (va < REGION_BASE(4)) + goto fail; + + e = (Elf64_Ehdr *)(kd->vmst->mmapbase); + n = e->e_phnum; + p = (Elf64_Phdr *)(void *)((uintptr_t)(void *)e + e->e_phoff); + while (n && (va < p->p_vaddr || va >= p->p_vaddr + p->p_memsz)) + p++, n--; + if (n == 0) + goto fail; + + *ofs = (va - p->p_vaddr) + p->p_offset; + if (pgsz == 0) + return (p->p_memsz - (va - p->p_vaddr)); + return (pgsz - ((size_t)va & (pgsz - 1))); + + fail: + _kvm_err(kd, kd->program, "invalid virtual address %#jx", + (uintmax_t)va); + return (0); +} + +static size_t +virt_kvatop(kvm_t *kd, uint64_t va, off_t *ofs) +{ + + return (virt_addr2off(kd, va, ofs, 0)); +} + +/* + * KVM architecture support functions. + */ + void _kvm_freevtop(kvm_t *kd) { @@ -160,27 +281,37 @@ _kvm_initvtop(kvm_t *kd) return (-1); } +#ifndef CROSS_LIBKVM kd->vmst->pagesize = getpagesize(); +#else + kd->vmst->pagesize = 8192; +#endif - if (_kvm_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) + if (ia64_maphdrs(kd, sizeof(Elf64_Ehdr)) == -1) return (-1); ehdr = kd->vmst->mmapbase; hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; - if (_kvm_maphdrs(kd, hdrsz) == -1) + if (ia64_maphdrs(kd, hdrsz) == -1) return (-1); + kd->vmst->kvatop = (ehdr->e_flags & EF_IA_64_ABSOLUTE) ? + phys_kvatop : virt_kvatop; + /* * Load the PBVM page table. We need this to resolve PBVM addresses. * The PBVM page table is obtained from the bootinfo structure, of - * which the physical address is given to us in e_entry. If e_entry - * is 0, then this is assumed to be a pre-PBVM kernel. + * which the address is given to us in e_entry. If e_entry is 0, then + * this is assumed to be a pre-PBVM kernel. + * Note that the address of the bootinfo structure is either physical + * or virtual, depending on whether the core is physical or virtual. */ - if (ehdr->e_entry != 0) { - sz = _kvm_read_phys(kd, ehdr->e_entry, &bi, sizeof(bi)); + if (ehdr->e_entry != 0 && (ehdr->e_flags & EF_IA_64_ABSOLUTE) != 0) { + sz = phys_read(kd, ehdr->e_entry, &bi, sizeof(bi)); if (sz != sizeof(bi)) { _kvm_err(kd, kd->program, - "cannot read bootinfo from PA %#lx", ehdr->e_entry); + "cannot read bootinfo at physical address %#jx", + (uintmax_t)ehdr->e_entry); return (-1); } if (bi.bi_magic != BOOTINFO_MAGIC) { @@ -193,12 +324,12 @@ _kvm_initvtop(kvm_t *kd) return (-1); } kd->vmst->pbvm_pgtblsz = bi.bi_pbvm_pgtblsz; - sz = _kvm_read_phys(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, + sz = phys_read(kd, bi.bi_pbvm_pgtbl, kd->vmst->pbvm_pgtbl, bi.bi_pbvm_pgtblsz); if (sz != bi.bi_pbvm_pgtblsz) { _kvm_err(kd, kd->program, - "cannot read page table from PA %#lx", - bi.bi_pbvm_pgtbl); + "cannot read page table at physical address %#jx", + (uintmax_t)bi.bi_pbvm_pgtbl); return (-1); } } else { @@ -225,7 +356,7 @@ _kvm_initvtop(kvm_t *kd) return (-1); } - if (va < REGION_BASE(6)) { + if (va == REGION_BASE(5)) { _kvm_err(kd, kd->program, "kptdir is itself virtual"); return (-1); } @@ -237,56 +368,8 @@ _kvm_initvtop(kvm_t *kd) int _kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs) { - struct ia64_lpte pte; - uint64_t pa, pgaddr, pt0addr, pt1addr; - size_t pgno, pgsz, pt0no, pt1no; - - if (va >= REGION_BASE(6)) { - /* Regions 6 and 7: direct mapped. */ - pa = REGION_ADDR(va); - return (_kvm_pa2off(kd, pa, ofs, 0)); - } else if (va >= REGION_BASE(5)) { - /* Region 5: Kernel Virtual Memory. */ - va = REGION_ADDR(va); - pgsz = kd->vmst->pagesize; - pt0no = KPTE_DIR0_INDEX(va, pgsz); - pt1no = KPTE_DIR1_INDEX(va, pgsz); - pgno = KPTE_PTE_INDEX(va, pgsz); - if (pt0no >= NKPTEDIR(pgsz)) - goto fail; - pt0addr = kd->vmst->kptdir + (pt0no << 3); - if (kvm_read(kd, pt0addr, &pt1addr, 8) != 8) - goto fail; - if (pt1addr == 0) - goto fail; - pt1addr += pt1no << 3; - if (kvm_read(kd, pt1addr, &pgaddr, 8) != 8) - goto fail; - if (pgaddr == 0) - goto fail; - pgaddr += pgno * sizeof(pte); - if (kvm_read(kd, pgaddr, &pte, sizeof(pte)) != sizeof(pte)) - goto fail; - if (!(pte.pte & PTE_PRESENT)) - goto fail; - pa = (pte.pte & PTE_PPN_MASK) + (va & (pgsz - 1)); - return (_kvm_pa2off(kd, pa, ofs, pgsz)); - } else if (va >= PBVM_BASE) { - /* Region 4: Pre-Boot Virtual Memory (PBVM). */ - va -= PBVM_BASE; - pgsz = PBVM_PGSZ; - pt0no = va / pgsz; - if (pt0no >= (kd->vmst->pbvm_pgtblsz >> 3)) - goto fail; - pt0addr = kd->vmst->pbvm_pgtbl[pt0no]; - if (!(pt0addr & PTE_PRESENT)) - goto fail; - pa = (pt0addr & PTE_PPN_MASK) + va % pgsz; - return (_kvm_pa2off(kd, pa, ofs, pgsz)); - } + size_t sz; - fail: - _kvm_err(kd, kd->program, "invalid kernel virtual address"); - *ofs = ~0UL; - return (0); + sz = kd->vmst->kvatop(kd, va, ofs); + return ((sz > INT_MAX) ? INT_MAX : sz); } From owner-svn-src-all@FreeBSD.ORG Sat Aug 2 23:20:43 2014 Return-Path: Delivered-To: svn-src-all@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 E7B27D8B; Sat, 2 Aug 2014 23:20:43 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5C3729DD; Sat, 2 Aug 2014 23:20:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s72NKh3J041394; Sat, 2 Aug 2014 23:20:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s72NKhdH041393; Sat, 2 Aug 2014 23:20:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201408022320.s72NKhdH041393@svn.freebsd.org> From: Alexander Motin Date: Sat, 2 Aug 2014 23:20:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269450 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 23:20:44 -0000 Author: mav Date: Sat Aug 2 23:20:43 2014 New Revision: 269450 URL: http://svnweb.freebsd.org/changeset/base/269450 Log: Rework r269444 to work also for lists without IDs. MFC after: 3 days Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 22:25:24 2014 (r269449) +++ head/sys/cam/ctl/ctl_tpc.c Sat Aug 2 23:20:43 2014 (r269450) @@ -942,14 +942,14 @@ tpc_process(struct tpc_list *list) done: //printf("ZZZ done\n"); + free(list->params, M_CTL); + list->params = NULL; mtx_lock(&lun->lun_lock); if ((list->flags & EC_LIST_ID_USAGE_MASK) == EC_LIST_ID_USAGE_NONE) { TAILQ_REMOVE(&lun->tpc_lists, list, links); free(list, M_CTL); } else { list->completed = 1; - free(list->params, M_CTL); - list->params = NULL; list->sense_data = ctsio->sense_data; list->sense_len = ctsio->sense_len; list->scsi_status = ctsio->scsi_status;