From owner-svn-src-head@FreeBSD.ORG Sun Jul 27 00:10:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 05:44:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 06:49:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 07:11:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:20:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:24:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:27:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:29:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:37:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:37:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:40:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:42:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:44:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 08:53:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 09:50:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 16:12:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 16:29:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 17:34:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 18:07:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:10:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:14:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:14:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:15:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:47:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:48:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 20:55:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 22:54:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Sun Jul 27 22:56:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-head@FreeBSD.ORG Mon Jul 28 05:37:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 07:20:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 08:22:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 10:01:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 10:17:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 12:47:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 13:01:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 13:47:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:14:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:15:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:20:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:22:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:24:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:27:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:29:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:32:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:35:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:37:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:38:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 14:41:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 20:49:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 20:52:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 21:04:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 21:14:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 21:18:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 21:57:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 22:23:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Mon Jul 28 23:36:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-head@FreeBSD.ORG Tue Jul 29 00:16:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 01:46:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:31:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:34:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:35:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:36:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:36:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:36:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:36:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:36:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:37:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:37:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:37:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 02:38:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 03:23:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 06:57:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 07:39:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 08:31:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 08:42:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 09:36:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 09:46:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 10:38:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 12:04:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 12:44:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 13:26:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 13:40:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 14:41:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 14:54:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 15:01:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 16:42:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 19:38:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 19:41:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 19:43:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 19:46:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 19:49:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 21:10:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F31AE3FF for ; Tue, 29 Jul 2014 21:10:10 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) (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 77D6F25DB for ; Tue, 29 Jul 2014 21:10:10 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id w7so193771lbi.1 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=emQeoGRGWgH1D1R1Pv1SfFN0XR1Ys739pB2Te1n7AjdXMnp+Dy/88dyquYSbqFZZcZ FRtH848HWQeIP3uHaCPgJgA8PzONuxZejGl2/HF2/+0/eQTuXlY0LFej1dQgaE9S3wM0 bplFuh/w4JDlDuMfK6xD1BF5fHHzaRpOX8e8/q/TK+C6X655Riu7OPCTL703RBh2PkoE 3SdXo+Bygq8i0MaUw1GEDLCdapvvZRb8J+zwNXrxKzrrsaE9YXKDEfjl6FnuyLVkqriV n2hQddB3DGPylBa/Sjin1y4GgQ1XdTCstTvwgE4ld6ZJAJXhgkIkjlFEOO/CbGSgryn0 pQVQ== X-Gm-Message-State: ALoCoQk0EN8pVX4eVNBNVs35B+nFyUrtBcVuENT1LEuAN6e1A/kLYNd3tAYwiMJFu3z7r0tHyPex 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jul 2014 21:10:11 -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-head@FreeBSD.ORG Tue Jul 29 23:11:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Tue Jul 29 23:42:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-head@FreeBSD.ORG Wed Jul 30 00:00:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 00:28:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 03:24:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 04:40:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 04:46:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 04:47:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 04:48:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 04:48:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 09:08:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 14:46:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 14:52:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 15:08:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 15:43:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 16:08:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 17:19:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 17:58:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 18:21:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 18:47:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 18:59:04 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 19:41:02 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 19:46:58 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 19:54:37 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 20:15:42 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 21:17:33 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Wed Jul 30 21:26:48 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-head@FreeBSD.ORG Thu Jul 31 02:07:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 03:34:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 03:36:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 03:59:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 04:35:50 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 05:12:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 05:56:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 07:51:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 08:07:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 08:28:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 08:29:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 09:00:37 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 09:18:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 09:18:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 15:25:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 15:40:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 15:43:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 16:17:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 16:43:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 16:54:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 17:18:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 18:02:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 18:35:01 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 19:24:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 19:25:31 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 22:00:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 22:05:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 22:09:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 22:13:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 22:32:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 23:19:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Thu Jul 31 23:25:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-head@FreeBSD.ORG Fri Aug 1 00:00:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 00:00:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 00:37:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 01:30:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 01:48:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 01:53:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 02:20:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 04:53:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 06:20:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 12:42:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 15:10:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 16:53:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 17:09:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 18:24:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 18:36:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 19:32:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 20:21:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 20:28:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 20:30:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 20:32:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 20:49:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 22:28:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 22:33:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 22:56:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 23:06:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 23:16:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 23:28:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 23:29:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Fri Aug 1 23:45:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-head@FreeBSD.ORG Sat Aug 2 00:56:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 01:48:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 03:44:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 03:48:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 03:59:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:02:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:05:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:05:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:05:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:16:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:18:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 05:19:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 06:55:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 07:44:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 07:47:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 07:52:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 08:34:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 16:10:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 16:45:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 16:54:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 17:03:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 17:17:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 17:35:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 17:45:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 17:58:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 18:01:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 18:37:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 18:37:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 19:51:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 19:59:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 20:15:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 20:37:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 21:36:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-head@FreeBSD.ORG Sat Aug 2 23:20:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 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-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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;