From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 01:02:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7735423C; Sun, 3 Mar 2013 01:02:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA98B6D; Sun, 3 Mar 2013 01:02:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r2312vlW016447; Sun, 3 Mar 2013 01:02:57 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r2312vJ1016446; Sun, 3 Mar 2013 01:02:57 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303030102.r2312vJ1016446@svn.freebsd.org> From: Attilio Rao Date: Sun, 3 Mar 2013 01:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247678 - head/sys/i386/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 01:02:58 -0000 Author: attilio Date: Sun Mar 3 01:02:57 2013 New Revision: 247678 URL: http://svnweb.freebsd.org/changeset/base/247678 Log: Fix-up r247622 by also renaming pv_list iterator into the xen pmap verbatim copy. Sponsored by: EMC / Isilon storage division Reported by: tinderbox Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun Mar 3 00:37:34 2013 (r247677) +++ head/sys/i386/xen/pmap.c Sun Mar 3 01:02:57 2013 (r247678) @@ -2038,7 +2038,7 @@ pmap_pv_reclaim(pmap_t locked_pmap) vm_page_dirty(m); if ((tpte & PG_A) != 0) vm_page_aflag_set(m, PGA_REFERENCED); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); if (TAILQ_EMPTY(&m->md.pv_list)) vm_page_aflag_clear(m, PGA_WRITEABLE); pc->pc_map[field] |= 1UL << bit; @@ -2239,9 +2239,9 @@ pmap_pvh_remove(struct md_page *pvh, pma pv_entry_t pv; rw_assert(&pvh_global_lock, RA_WLOCKED); - TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { + TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) { if (pmap == PV_PMAP(pv) && va == pv->pv_va) { - TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); + TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); break; } } @@ -2281,7 +2281,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm if (pv_entry_count < pv_entry_high_water && (pv = get_pv_entry(pmap, TRUE)) != NULL) { pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); return (TRUE); } else return (FALSE); @@ -2503,7 +2503,7 @@ pmap_remove_all(vm_page_t m) vm_page_dirty(m); pmap_unuse_pt(pmap, pv->pv_va, &free); pmap_invalidate_page(pmap, pv->pv_va); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } @@ -2770,7 +2770,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (pv == NULL) pv = get_pv_entry(pmap, FALSE); pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); pa |= PG_MANAGED; } else if (pv != NULL) free_pv_entry(pmap, pv); @@ -3465,7 +3465,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; rw_wlock(&pvh_global_lock); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { if (PV_PMAP(pv) == pmap) { rv = TRUE; break; @@ -3497,7 +3497,7 @@ pmap_page_wired_mappings(vm_page_t m) return (count); rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3602,7 +3602,7 @@ pmap_remove_pages(pmap_t pmap) if (tpte & PG_M) vm_page_dirty(m); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); if (TAILQ_EMPTY(&m->md.pv_list)) vm_page_aflag_clear(m, PGA_WRITEABLE); @@ -3662,7 +3662,7 @@ pmap_is_modified(vm_page_t m) return (rv); rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3723,7 +3723,7 @@ pmap_is_referenced(vm_page_t m) rv = FALSE; rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3793,7 +3793,7 @@ pmap_remove_write(vm_page_t m) return; rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3852,9 +3852,9 @@ pmap_ts_referenced(vm_page_t m) if ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pvf = pv; do { - pvn = TAILQ_NEXT(pv, pv_list); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + pvn = TAILQ_NEXT(pv, pv_next); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3901,7 +3901,7 @@ pmap_clear_modify(vm_page_t m) return; rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -3936,7 +3936,7 @@ pmap_clear_reference(vm_page_t m) ("pmap_clear_reference: page %p is not managed", m)); rw_wlock(&pvh_global_lock); sched_pin(); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); @@ -4418,7 +4418,7 @@ pmap_pvdump(vm_paddr_t pa) printf("pa %x", pa); m = PHYS_TO_VM_PAGE(pa); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { pmap = PV_PMAP(pv); printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va); pads(pmap); From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 02:11:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9EF84599; Sun, 3 Mar 2013 02:11:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91D91E07; Sun, 3 Mar 2013 02:11:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r232B4CL039203; Sun, 3 Mar 2013 02:11:04 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r232B4RR039202; Sun, 3 Mar 2013 02:11:04 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201303030211.r232B4RR039202@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 3 Mar 2013 02:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247683 - head/lib/libedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 02:11:04 -0000 Author: pfg Date: Sun Mar 3 02:11:03 2013 New Revision: 247683 URL: http://svnweb.freebsd.org/changeset/base/247683 Log: libedit does not need to be linked with ncurses libedit uses the terminfo headers but doesn't really need to be linked with ncurses. Discussed with: christos@NetBSD MFC after; 3 days Modified: head/lib/libedit/Makefile Modified: head/lib/libedit/Makefile ============================================================================== --- head/lib/libedit/Makefile Sun Mar 3 01:36:31 2013 (r247682) +++ head/lib/libedit/Makefile Sun Mar 3 02:11:03 2013 (r247683) @@ -11,7 +11,6 @@ OSRCS= chared.c common.c el.c emacs.c fc parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c DPADD= ${LIBNCURSES} -LDADD= -lncurses MAN= editline.3 editrc.5 From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 06:42:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2D766F0A; Sun, 3 Mar 2013 06:42:37 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08F977EF; Sun, 3 Mar 2013 06:42:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r236galx021708; Sun, 3 Mar 2013 06:42:36 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r236ga0i021707; Sun, 3 Mar 2013 06:42:36 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201303030642.r236ga0i021707@svn.freebsd.org> From: Rui Paulo Date: Sun, 3 Mar 2013 06:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247684 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 06:42:37 -0000 Author: rpaulo Date: Sun Mar 3 06:42:36 2013 New Revision: 247684 URL: http://svnweb.freebsd.org/changeset/base/247684 Log: Remove the extra parenthesis from the cv_init() macro. They are not necessary because we already use parenthesis in zfs_cv_init(). This fixes a long standing bug where there would be an extra ")" at the end of the string. This extra parenthesis would show up in the WCHAN of the process (top, stty status, etc.). Modified: head/sys/cddl/compat/opensolaris/sys/kcondvar.h Modified: head/sys/cddl/compat/opensolaris/sys/kcondvar.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/kcondvar.h Sun Mar 3 02:11:03 2013 (r247683) +++ head/sys/cddl/compat/opensolaris/sys/kcondvar.h Sun Mar 3 06:42:36 2013 (r247684) @@ -55,7 +55,7 @@ typedef enum { _name = #cv; \ cv_init((cv), _name); \ } while (0) -#define cv_init(cv, name, type, arg) zfs_cv_init((cv), (name), (type), (arg)) +#define cv_init(cv, name, type, arg) zfs_cv_init(cv, name, type, arg) #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 09:11:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E33D3613; Sun, 3 Mar 2013 09:11:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BFB87B6A; Sun, 3 Mar 2013 09:11:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239BO8G067284; Sun, 3 Mar 2013 09:11:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239BOId067283; Sun, 3 Mar 2013 09:11:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303030911.r239BOId067283@svn.freebsd.org> From: Alexander Motin Date: Sun, 3 Mar 2013 09:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247698 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:11:25 -0000 Author: mav Date: Sun Mar 3 09:11:24 2013 New Revision: 247698 URL: http://svnweb.freebsd.org/changeset/base/247698 Log: MFcalloutng: Some whitespace fixes. Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sun Mar 3 09:09:59 2013 (r247697) +++ head/sys/kern/kern_timeout.c Sun Mar 3 09:11:24 2013 (r247698) @@ -205,7 +205,7 @@ cc_cme_migrating(struct callout_cpu *cc) } /* - * kern_timeout_callwheel_alloc() - kernel low level callwheel initialization + * kern_timeout_callwheel_alloc() - kernel low level callwheel initialization * * This code is called very early in the kernel initialization sequence, * and may be called more then once. @@ -704,7 +704,7 @@ softclock(void *arg) * Initialize a handle so that using it with untimeout is benign. * * See AT&T BCI Driver Reference Manual for specification. This - * implementation differs from that one in that although an + * implementation differs from that one in that although an * identification value is returned from timeout, the original * arguments to timeout as well as the identifier are used to * identify entries for untimeout. From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 09:47:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C972E22C; Sun, 3 Mar 2013 09:47:48 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B5490D14; Sun, 3 Mar 2013 09:47:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r239lmiN077225; Sun, 3 Mar 2013 09:47:48 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r239lmdi077219; Sun, 3 Mar 2013 09:47:48 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201303030947.r239lmdi077219@svn.freebsd.org> From: Josh Paetzel Date: Sun, 3 Mar 2013 09:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247705 - in head/usr.sbin/pc-sysinstall: backend examples X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 09:47:48 -0000 Author: jpaetzel Date: Sun Mar 3 09:47:47 2013 New Revision: 247705 URL: http://svnweb.freebsd.org/changeset/base/247705 Log: Fix a bug extracting files from dist scheme Obtained from: PC-BSD Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh head/usr.sbin/pc-sysinstall/backend/functions-parse.sh head/usr.sbin/pc-sysinstall/backend/parseconfig.sh head/usr.sbin/pc-sysinstall/examples/README Modified: head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Sun Mar 3 09:26:58 2013 (r247704) +++ head/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh Sun Mar 3 09:47:47 2013 (r247705) @@ -29,23 +29,60 @@ . ${BACKEND}/functions-mountoptical.sh +# Performs the extraction of data to disk from FreeBSD dist files +start_extract_dist() +{ + if [ -z "$1" ] ; then exit_err "Called dist extraction with no directory set!"; fi + if [ -z "$INSFILE" ]; then exit_err "Called extraction with no install file set!"; fi + local DDIR="$1" + + # Check if we are doing an upgrade, and if so use our exclude list + if [ "${INSTALLMODE}" = "upgrade" ]; then + TAROPTS="-X ${PROGDIR}/conf/exclude-from-upgrade" + else + TAROPTS="" + fi + + # Loop though and extract dist files + for di in $INSFILE + do + # Check the MANIFEST see if we have an archive size / count + if [ -e "${DDIR}/MANIFEST" ]; then + count=`grep "^${di}.txz" ${DDIR}/MANIFEST | awk '{print $3}'` + if [ ! -z "$count" ] ; then + echo "INSTALLCOUNT: $count" + fi + fi + echo_log "pc-sysinstall: Starting Extraction (${di})" + tar -xpv -C ${FSMNT} -f ${DDIR}/${di}.txz ${TAROPTS} >&1 2>&1 + if [ $? -ne 0 ]; then + exit_err "ERROR: Failed extracting the dist file: $di" + fi + done + + # Check if this was a FTP download and clean it up now + if [ "${INSTALLMEDIUM}" = "ftp" ]; then + echo_log "Cleaning up downloaded archives" + rm -rf ${DDIR} + fi + + echo_log "pc-sysinstall: Extraction Finished" +} + # Performs the extraction of data to disk from a uzip or tar archive start_extract_uzip_tar() { - if [ -z "$INSFILE" ] - then + if [ -z "$INSFILE" ]; then exit_err "ERROR: Called extraction with no install file set!" fi # Check if we have a .count file, and echo it out for a front-end to use in progress bars - if [ -e "${INSFILE}.count" ] - then + if [ -e "${INSFILE}.count" ]; then echo "INSTALLCOUNT: `cat ${INSFILE}.count`" fi # Check if we are doing an upgrade, and if so use our exclude list - if [ "${INSTALLMODE}" = "upgrade" ] - then + if [ "${INSTALLMODE}" = "upgrade" ]; then TAROPTS="-X ${PROGDIR}/conf/exclude-from-upgrade" else TAROPTS="" @@ -87,9 +124,8 @@ start_extract_uzip_tar() mdconfig -d -u ${MDDEVICE} ;; tar) - tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1 - if [ $? -ne 0 ] - then + tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1 + if [ $? -ne 0 ]; then exit_err "ERROR: Failed extracting the tar image" fi ;; @@ -176,6 +212,38 @@ start_extract_split() echo_log "pc-sysinstall: Extraction Finished" }; +# Function which will attempt to fetch the dist file(s) before we start +fetch_dist_file() +{ + get_value_from_cfg ftpPath + if [ -z "$VAL" ] + then + exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!" + fi + + FTPPATH="${VAL}" + + # Check if we have a /usr partition to save the download + if [ -d "${FSMNT}/usr" ] + then + DLDIR="${FSMNT}/usr/.fetch.$$" + else + DLDIR="${FSMNT}/.fetch.$$" + fi + mkdir -p ${DLDIR} + + # Do the fetch of the dist archive(s) now + for di in $INSFILE + do + fetch_file "${FTPPATH}/${di}.txz" "${DLDIR}/${di}.txz" "1" + done + + # Check to see if there is a MANIFEST file for this install + fetch_file "${FTPPATH}/MANIFEST" "${DLDIR}/MANIFEST" "0" + + export DLDIR +}; + # Function which will attempt to fetch the install file before we start # the install fetch_install_file() @@ -390,6 +458,13 @@ init_extraction() case $PACKAGETYPE in uzip) INSFILE="${FBSD_UZIP_FILE}" ;; tar) INSFILE="${FBSD_TAR_FILE}" ;; + dist) + get_value_from_cfg_with_spaces distFiles + if [ -z "$VAL" ] ; then + exit_err "No dist files specified!" + fi + INSFILE="${VAL}" + ;; split) INSDIR="${FBSD_BRANCH_DIR}" @@ -401,6 +476,13 @@ init_extraction() case $PACKAGETYPE in uzip) INSFILE="${UZIP_FILE}" ;; tar) INSFILE="${TAR_FILE}" ;; + dist) + get_value_from_cfg_with_spaces distFiles + if [ -z "$VAL" ] ; then + exit_err "No dist files specified!" + fi + INSFILE="${VAL}" + ;; esac fi export INSFILE @@ -417,22 +499,32 @@ init_extraction() start_extract_split else - INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE - start_extract_uzip_tar + if [ "$PACKAGETYPE" = "dist" ] ; then + start_extract_dist "${CDMNT}/usr/freebsd-dist" + else + INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE + start_extract_uzip_tar + fi fi ;; ftp) - if [ "$PACKAGETYPE" = "split" ] - then - fetch_split_files + case $PACKAGETYPE in + split) + fetch_split_files - INSDIR="${INSFILE}" ; export INSDIR - start_extract_split - else - fetch_install_file - start_extract_uzip_tar - fi + INSDIR="${INSFILE}" ; export INSDIR + start_extract_split + ;; + dist) + fetch_dist_file + start_extract_dist "$DLDIR" + ;; + *) + fetch_install_file + start_extract_uzip_tar + ;; + esac ;; sftp) ;; @@ -446,8 +538,13 @@ init_extraction() exit_err "Install medium was set to local, but no localPath was provided!" fi LOCALPATH=$VAL - INSFILE="${LOCALPATH}/${INSFILE}" ; export INSFILE - start_extract_uzip_tar + if [ "$PACKAGETYPE" = "dist" ] ; then + INSFILE="${INSFILE}" ; export INSFILE + start_extract_dist "$LOCALPATH" + else + INSFILE="${LOCALPATH}/${INSFILE}" ; export INSFILE + start_extract_uzip_tar + fi ;; *) exit_err "ERROR: Unknown install medium" ;; esac Modified: head/usr.sbin/pc-sysinstall/backend/functions-parse.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Sun Mar 3 09:26:58 2013 (r247704) +++ head/usr.sbin/pc-sysinstall/backend/functions-parse.sh Sun Mar 3 09:47:47 2013 (r247705) @@ -45,7 +45,7 @@ get_value_from_cfg_with_spaces() { if [ -n "${1}" ] then - export VAL=`grep "^${1}=" ${CFGF} | head -n 1 | cut -d '=' -f 2-` + export VAL="`grep ^${1}= ${CFGF} | head -n 1 | cut -d '=' -f 2-`" else exit_err "Error: Did we forgot to supply a setting to grab?" fi Modified: head/usr.sbin/pc-sysinstall/backend/parseconfig.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Sun Mar 3 09:26:58 2013 (r247704) +++ head/usr.sbin/pc-sysinstall/backend/parseconfig.sh Sun Mar 3 09:47:47 2013 (r247705) @@ -69,7 +69,7 @@ file_sanity_check "installMode installTy check_value installMode "fresh upgrade extract" check_value installType "PCBSD FreeBSD" check_value installMedium "dvd usb ftp rsync image local" -check_value packageType "uzip tar rsync split" +check_value packageType "uzip tar rsync split dist" if_check_value_exists mirrorbal "load prefer round-robin split" # We passed all sanity checks! Yay, lets start the install Modified: head/usr.sbin/pc-sysinstall/examples/README ============================================================================== --- head/usr.sbin/pc-sysinstall/examples/README Sun Mar 3 09:26:58 2013 (r247704) +++ head/usr.sbin/pc-sysinstall/examples/README Sun Mar 3 09:47:47 2013 (r247705) @@ -243,11 +243,16 @@ Set installMedium= to the source type we Available Types: dvd - Search for and mount the DVD which contains the install archive +local - Pull files directly from a local directory usb - Search for and mount the USB drive which contains the install archive ftp - The install archive will be fetched from a FTP / HTTP server before install rsync - Pull the system data from a ssh + rsync server, specified with variables below image - Install system from an image +# localPath=/usr/freebsd-dist + +Location of the directory we will be pulling installation files from + # installType=(PCBSD, FreeBSD) Set the type of system we are installing, PCBSD or FreeBSD @@ -256,10 +261,14 @@ Set the type of system we are installing The installer archive, if not using the defaults specified in conf/pc-sysinstall.conf -# packageType=(tar, uzip, split) +# packageType=(tar, uzip, split, dist) The archive type we are extracting from when using dvd, usb or ftp +# distFiles=base src kernel + +List of dist files to install when packageType=dist + # ftpPath=ftp://ftp.pcbsd.org/pub/8.0/netinstall Location of the installer archive when using a installMedium=ftp From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 11:09:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 125B24D4; Sun, 3 Mar 2013 11:09:56 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E2B8DF40; Sun, 3 Mar 2013 11:09:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23B9tj1002566; Sun, 3 Mar 2013 11:09:55 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23B9tMU002565; Sun, 3 Mar 2013 11:09:55 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201303031109.r23B9tMU002565@svn.freebsd.org> From: Antoine Brodin Date: Sun, 3 Mar 2013 11:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247709 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 11:09:56 -0000 Author: antoine Date: Sun Mar 3 11:09:55 2013 New Revision: 247709 URL: http://svnweb.freebsd.org/changeset/base/247709 Log: Add more obsolete files. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Mar 3 10:52:41 2013 (r247708) +++ head/ObsoleteFiles.inc Sun Mar 3 11:09:55 2013 (r247709) @@ -39,6 +39,8 @@ # done # 20130302: NTFS support removed +OLD_FILES+=rescue/mount_ntfs +OLD_FILES+=sbin/mount_ntfs OLD_FILES+=usr/include/fs/ntfs/ntfs.h OLD_FILES+=usr/include/fs/ntfs/ntfs_compr.h OLD_FILES+=usr/include/fs/ntfs/ntfs_ihash.h @@ -51,6 +53,7 @@ OLD_FILES+=usr/share/man/man8/mount_ntfs # 20130302: PORTALFS support removed OLD_FILES+=usr/include/fs/portalfs/portal.h OLD_DIRS+=usr/include/fs/portalfs +OLD_FILES+=usr/sbin/mount_portalfs OLD_FILES+=usr/share/examples/portal/README OLD_FILES+=usr/share/examples/portal/portal.conf OLD_DIRS+=usr/share/examples/portal @@ -79,9 +82,10 @@ OLD_DIRS+=var/remote # 20121114: zpool-features manual page moved from section 5 to 7 OLD_FILES+=usr/share/man/man5/zpool-features.5.gz # 20121022: remove harp, hfa and idt man page -OLD_FILES+=share/man/man4/harp.4 -OLD_FILES+=share/man/man4/hfa.4 -OLD_FILES+=share/man/man4/idt.4 +OLD_FILES+=usr/share/man/man4/harp.4.gz +OLD_FILES+=usr/share/man/man4/hfa.4.gz +OLD_FILES+=usr/share/man/man4/idt.4.gz +OLD_FILES+=usr/share/man/man4/if_idt.4.gz # 20121022: VFS_LOCK_GIANT elimination OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 13:21:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 02F36BEA; Sun, 3 Mar 2013 13:21:22 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ia0-x236.google.com (mail-ia0-x236.google.com [IPv6:2607:f8b0:4001:c02::236]) by mx1.freebsd.org (Postfix) with ESMTP id 860B5714; Sun, 3 Mar 2013 13:21:21 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id w21so2056109iac.27 for ; Sun, 03 Mar 2013 05:21:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=p4ErHjMKZGR9pUQlPH440e9MQKRD527jEzlPCPtDJE8=; b=pTkFYJ2ZEdGCG+EQmW6YA56iYZ5R76tTDZ+uStgQLHyHblGHpD2eLirmGKQgcflMDN aNiRYNU2IArjLSPH/E2R3e3i72hAccfoCnMb6aKkYrCCMrXBbm4kt5Epg4T1u25De09u yhr9ZrVayiyPeqDQhANiqcxg8OR8rtbhGcY63GVIv4ippSlmslUAnKhcNoswrRazSx6+ x0f5cxRn9GwkT8ldIx2z1E5kSv1CIoUgZeReBgP0Vh6/rUs6vOD630ZsNqOPwlsN79ms 8tRNwwWznP96FDAaZ5j/wXLuw7x/eQ9O81Aa/q8o1ssbttbkfWtCJbS1g/S7nLAqp1ig fr6A== MIME-Version: 1.0 X-Received: by 10.50.184.132 with SMTP id eu4mr141613igc.19.1362316881136; Sun, 03 Mar 2013 05:21:21 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Sun, 3 Mar 2013 05:21:20 -0800 (PST) In-Reply-To: <201303031109.r23B9tMU002565@svn.freebsd.org> References: <201303031109.r23B9tMU002565@svn.freebsd.org> Date: Sun, 3 Mar 2013 14:21:20 +0100 X-Google-Sender-Auth: ks2YFKeqk6JNnbZYlct7NNiK-Zw Message-ID: Subject: Re: svn commit: r247709 - head From: Attilio Rao To: Antoine Brodin 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.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: 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, 03 Mar 2013 13:21:22 -0000 On Sun, Mar 3, 2013 at 12:09 PM, Antoine Brodin wrote: > Author: antoine > Date: Sun Mar 3 11:09:55 2013 > New Revision: 247709 > URL: http://svnweb.freebsd.org/changeset/base/247709 > > Log: > Add more obsolete files. Pointy hat to me (most of). Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 13:43:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1B02D52A; Sun, 3 Mar 2013 13:43:18 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id D7A617EE; Sun, 3 Mar 2013 13:43:17 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 341833592DA; Sun, 3 Mar 2013 14:43:15 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 1ECBA2848C; Sun, 3 Mar 2013 14:43:15 +0100 (CET) Date: Sun, 3 Mar 2013 14:43:14 +0100 From: Jilles Tjoelker To: "Pedro F. Giffuni" Subject: Re: svn commit: r247683 - head/lib/libedit Message-ID: <20130303134314.GA21318@stack.nl> References: <201303030211.r232B4RR039202@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201303030211.r232B4RR039202@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 13:43:18 -0000 On Sun, Mar 03, 2013 at 02:11:04AM +0000, Pedro F. Giffuni wrote: > Author: pfg > Date: Sun Mar 3 02:11:03 2013 > New Revision: 247683 > URL: http://svnweb.freebsd.org/changeset/base/247683 > Log: > libedit does not need to be linked with ncurses > libedit uses the terminfo headers but doesn't really need > to be linked with ncurses. > Discussed with: christos@NetBSD > MFC after; 3 days > Modified: > head/lib/libedit/Makefile > Modified: head/lib/libedit/Makefile > ============================================================================== > --- head/lib/libedit/Makefile Sun Mar 3 01:36:31 2013 (r247682) > +++ head/lib/libedit/Makefile Sun Mar 3 02:11:03 2013 (r247683) > @@ -11,7 +11,6 @@ OSRCS= chared.c common.c el.c emacs.c fc > parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c > > DPADD= ${LIBNCURSES} > -LDADD= -lncurses > > MAN= editline.3 editrc.5 > This is wrong. libedit.so uses symbols such as tgetent from libcurses.so, so it should be linked to libcurses.so. These symbols are easily visible in the output of objdump -T /lib/libedit.so.7 because they are unversioned. There is not much breakage because most applications using libedit explicitly link to libcurses, since that is required for static linking. For dynamic linking it is really a case of overlinking, particularly because libedit completely abstracts away libcurses from the application's point of view (in other words, the application need not call libcurses itself). More subtle breakage will result if libcurses.so starts using versioned symbols and libedit.so uses a symbol with more than one version, as rtld will then give it the oldest version where libedit.so expects a newer version. Perhaps we should add -Wl,--no-undefined to SOLINKOPTS in bsd.lib.mk with the exception of libraries that deliberately have undefined symbols (for example, to be supplied by the application). -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 14:05:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6F2BFC48; Sun, 3 Mar 2013 14:05:04 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5ECE48B2; Sun, 3 Mar 2013 14:05:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23E54Zl056673; Sun, 3 Mar 2013 14:05:04 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23E53aT056667; Sun, 3 Mar 2013 14:05:03 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303031405.r23E53aT056667@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sun, 3 Mar 2013 14:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247712 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 14:05:04 -0000 Author: melifaro Date: Sun Mar 3 14:05:03 2013 New Revision: 247712 URL: http://svnweb.freebsd.org/changeset/base/247712 Log: Implement buffer size checking in ipfw(8) add cmd. PR: bin/65961 Submitted by: Eugene Grosbein MFC after: 2 weeks Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sun Mar 3 13:53:58 2013 (r247711) +++ head/sbin/ipfw/ipfw2.c Sun Mar 3 14:05:03 2013 (r247712) @@ -64,6 +64,22 @@ int ipfw_socket = -1; #define s6_addr32 __u6_addr.__u6_addr32 #endif +#define CHECK_LENGTH(v, len) do { \ + if ((v) < (len)) \ + errx(EX_DATAERR, "Rule too long"); \ + } while (0) +/* + * Check if we have enough space in cmd buffer. Note that since + * first 8? u32 words are reserved by reserved header, full cmd + * buffer can't be used, so we need to protect from buffer overrun + * only. At the beginnig, cblen is less than actual buffer size by + * size of ipfw_insn_u32 instruction + 1 u32 work. This eliminates need + * for checking small instructions fitting in given range. + * We also (ab)use the fact that ipfw_insn is always the first field + * for any custom instruction. + */ +#define CHECK_CMDLEN CHECK_LENGTH(cblen, F_LEN((ipfw_insn *)cmd)) + #define GET_UINT_ARG(arg, min, max, tok, s_x) do { \ if (!av[0]) \ errx(EX_USAGE, "%s: missing argument", match_value(s_x, tok)); \ @@ -653,7 +669,7 @@ strtoport(char *s, char **end, int base, * Fill the body of the command with the list of port ranges. */ static int -fill_newports(ipfw_insn_u16 *cmd, char *av, int proto) +fill_newports(ipfw_insn_u16 *cmd, char *av, int proto, int cblen) { uint16_t a, b, *p = cmd->ports; int i = 0; @@ -664,6 +680,8 @@ fill_newports(ipfw_insn_u16 *cmd, char * if (s == av) /* empty or invalid argument */ return (0); + CHECK_LENGTH(cblen, i + 2); + switch (*s) { case '-': /* a range */ av = s + 1; @@ -2068,7 +2086,7 @@ lookup_host (char *host, struct in_addr * We can have multiple comma-separated address/mask entries. */ static void -fill_ip(ipfw_insn_ip *cmd, char *av) +fill_ip(ipfw_insn_ip *cmd, char *av, int cblen) { int len = 0; uint32_t *d = ((ipfw_insn_u32 *)cmd)->d; @@ -2108,6 +2126,8 @@ fill_ip(ipfw_insn_ip *cmd, char *av) int masklen; char md, nd = '\0'; + CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn) + 2 + len); + if (p) { md = *p; *p++ = '\0'; @@ -2366,11 +2386,13 @@ ipfw_delete(char *av[]) * patterns which match interfaces. */ static void -fill_iface(ipfw_insn_if *cmd, char *arg) +fill_iface(ipfw_insn_if *cmd, char *arg, int cblen) { cmd->name[0] = '\0'; cmd->o.len |= F_INSN_SIZE(ipfw_insn_if); + CHECK_CMDLEN; + /* Parse the interface or address */ if (strcmp(arg, "any") == 0) cmd->o.len = 0; /* effectively ignore this command */ @@ -2441,8 +2463,10 @@ get_mac_addr_mask(const char *p, uint8_t * the new command in case it has been clobbered before. */ static ipfw_insn * -next_cmd(ipfw_insn *cmd) +next_cmd(ipfw_insn *cmd, int *len) { + *len -= F_LEN(cmd); + CHECK_LENGTH(*len, 0); cmd += F_LEN(cmd); bzero(cmd, sizeof(*cmd)); return cmd; @@ -2452,7 +2476,7 @@ next_cmd(ipfw_insn *cmd) * Takes arguments and copies them into a comment */ static void -fill_comment(ipfw_insn *cmd, char **av) +fill_comment(ipfw_insn *cmd, char **av, int cblen) { int i, l; char *p = (char *)(cmd + 1); @@ -2470,6 +2494,8 @@ fill_comment(ipfw_insn *cmd, char **av) "comment too long (max 80 chars)"); l = 1 + (l+3)/4; cmd->len = (cmd->len & (F_NOT | F_OR)) | l; + CHECK_CMDLEN; + for (i = 0; av[i] != NULL; i++) { strcpy(p, av[i]); p += strlen(av[i]); @@ -2495,7 +2521,7 @@ fill_cmd(ipfw_insn *cmd, enum ipfw_opcod * two microinstructions, and returns the pointer to the last one. */ static ipfw_insn * -add_mac(ipfw_insn *cmd, char *av[]) +add_mac(ipfw_insn *cmd, char *av[], int cblen) { ipfw_insn_mac *mac; @@ -2504,6 +2530,7 @@ add_mac(ipfw_insn *cmd, char *av[]) cmd->opcode = O_MACADDR2; cmd->len = (cmd->len & (F_NOT | F_OR)) | F_INSN_SIZE(ipfw_insn_mac); + CHECK_CMDLEN; mac = (ipfw_insn_mac *)cmd; get_mac_addr_mask(av[0], mac->addr, mac->mask); /* dst */ @@ -2513,12 +2540,13 @@ add_mac(ipfw_insn *cmd, char *av[]) } static ipfw_insn * -add_mactype(ipfw_insn *cmd, char *av) +add_mactype(ipfw_insn *cmd, char *av, int cblen) { if (!av) errx(EX_DATAERR, "missing MAC type"); if (strcmp(av, "any") != 0) { /* we have a non-null type */ - fill_newports((ipfw_insn_u16 *)cmd, av, IPPROTO_ETHERTYPE); + fill_newports((ipfw_insn_u16 *)cmd, av, IPPROTO_ETHERTYPE, + cblen); cmd->opcode = O_MAC_TYPE; return cmd; } else @@ -2587,9 +2615,9 @@ add_proto_compat(ipfw_insn *cmd, char *a } static ipfw_insn * -add_srcip(ipfw_insn *cmd, char *av) +add_srcip(ipfw_insn *cmd, char *av, int cblen) { - fill_ip((ipfw_insn_ip *)cmd, av); + fill_ip((ipfw_insn_ip *)cmd, av, cblen); if (cmd->opcode == O_IP_DST_SET) /* set */ cmd->opcode = O_IP_SRC_SET; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ @@ -2604,9 +2632,9 @@ add_srcip(ipfw_insn *cmd, char *av) } static ipfw_insn * -add_dstip(ipfw_insn *cmd, char *av) +add_dstip(ipfw_insn *cmd, char *av, int cblen) { - fill_ip((ipfw_insn_ip *)cmd, av); + fill_ip((ipfw_insn_ip *)cmd, av, cblen); if (cmd->opcode == O_IP_DST_SET) /* set */ ; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ @@ -2621,12 +2649,12 @@ add_dstip(ipfw_insn *cmd, char *av) } static ipfw_insn * -add_ports(ipfw_insn *cmd, char *av, u_char proto, int opcode) +add_ports(ipfw_insn *cmd, char *av, u_char proto, int opcode, int cblen) { /* XXX "any" is trapped before. Perhaps "to" */ if (_substrcmp(av, "any") == 0) { return NULL; - } else if (fill_newports((ipfw_insn_u16 *)cmd, av, proto)) { + } else if (fill_newports((ipfw_insn_u16 *)cmd, av, proto, cblen)) { /* XXX todo: check that we have a protocol with ports */ cmd->opcode = opcode; return cmd; @@ -2635,7 +2663,7 @@ add_ports(ipfw_insn *cmd, char *av, u_ch } static ipfw_insn * -add_src(ipfw_insn *cmd, char *av, u_char proto) +add_src(ipfw_insn *cmd, char *av, u_char proto, int cblen) { struct in6_addr a; char *host, *ch; @@ -2648,11 +2676,11 @@ add_src(ipfw_insn *cmd, char *av, u_char if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || inet_pton(AF_INET6, host, &a) == 1) - ret = add_srcip6(cmd, av); + ret = add_srcip6(cmd, av, cblen); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || inet_pton(AF_INET6, host, &a) != 1)) - ret = add_srcip(cmd, av); + ret = add_srcip(cmd, av, cblen); if (ret == NULL && strcmp(av, "any") != 0) ret = cmd; @@ -2661,7 +2689,7 @@ add_src(ipfw_insn *cmd, char *av, u_char } static ipfw_insn * -add_dst(ipfw_insn *cmd, char *av, u_char proto) +add_dst(ipfw_insn *cmd, char *av, u_char proto, int cblen) { struct in6_addr a; char *host, *ch; @@ -2674,11 +2702,11 @@ add_dst(ipfw_insn *cmd, char *av, u_char if (proto == IPPROTO_IPV6 || strcmp(av, "me6") == 0 || inet_pton(AF_INET6, host, &a) == 1) - ret = add_dstip6(cmd, av); + ret = add_dstip6(cmd, av, cblen); /* XXX: should check for IPv4, not !IPv6 */ if (ret == NULL && (proto == IPPROTO_IP || strcmp(av, "me") == 0 || inet_pton(AF_INET6, host, &a) != 1)) - ret = add_dstip(cmd, av); + ret = add_dstip(cmd, av, cblen); if (ret == NULL && strcmp(av, "any") != 0) ret = cmd; @@ -2708,6 +2736,7 @@ ipfw_add(char *av[]) * go into actbuf[]. */ static uint32_t rulebuf[255], actbuf[255], cmdbuf[255]; + int rblen, ablen, cblen; ipfw_insn *src, *dst, *cmd, *action, *prev=NULL; ipfw_insn *first_cmd; /* first match pattern */ @@ -2738,6 +2767,15 @@ ipfw_add(char *av[]) cmd = (ipfw_insn *)cmdbuf; action = (ipfw_insn *)actbuf; + rblen = sizeof(rulebuf) / sizeof(rulebuf[0]); + rblen -= offsetof(struct ip_fw, cmd) / sizeof(rulebuf[0]); + ablen = sizeof(actbuf) / sizeof(actbuf[0]); + cblen = sizeof(cmdbuf) / sizeof(cmdbuf[0]); + cblen -= F_INSN_SIZE(ipfw_insn_u32) + 1; + +#define CHECK_RBUFLEN(len) { CHECK_LENGTH(rblen, len); rblen -= len; } +#define CHECK_ACTLEN CHECK_LENGTH(ablen, action->len) + av++; /* [rule N] -- Rule number optional */ @@ -2769,6 +2807,7 @@ ipfw_add(char *av[]) i = match_token(rule_actions, *av); av++; action->len = 1; /* default */ + CHECK_ACTLEN; switch(i) { case TOK_CHECKSTATE: have_state = action; @@ -2820,6 +2859,7 @@ ipfw_add(char *av[]) case TOK_NAT: action->opcode = O_NAT; action->len = F_INSN_SIZE(ipfw_insn_nat); + CHECK_ACTLEN; if (_substrcmp(*av, "global") == 0) { action->arg1 = 0; av++; @@ -2936,6 +2976,7 @@ chkarg: action->opcode = O_FORWARD_IP; action->len = F_INSN_SIZE(ipfw_insn_sa); + CHECK_ACTLEN; /* * In the kernel we assume AF_INET and use only @@ -2952,6 +2993,7 @@ chkarg: action->opcode = O_FORWARD_IP6; action->len = F_INSN_SIZE(ipfw_insn_sa6); + CHECK_ACTLEN; p->sa.sin6_len = sizeof(struct sockaddr_in6); p->sa.sin6_family = AF_INET6; @@ -3005,7 +3047,7 @@ chkarg: default: errx(EX_DATAERR, "invalid action %s\n", av[-1]); } - action = next_cmd(action); + action = next_cmd(action, &ablen); /* * [altq queuename] -- altq tag, optional @@ -3027,6 +3069,7 @@ chkarg: "log cannot be specified more than once"); have_log = (ipfw_insn *)c; cmd->len = F_INSN_SIZE(ipfw_insn_log); + CHECK_CMDLEN; cmd->opcode = O_LOG; if (av[0] && _substrcmp(*av, "logamount") == 0) { av++; @@ -3058,6 +3101,7 @@ chkarg: "altq cannot be specified more than once"); have_altq = (ipfw_insn *)a; cmd->len = F_INSN_SIZE(ipfw_insn_altq); + CHECK_CMDLEN; cmd->opcode = O_ALTQ; a->qid = altq_name_to_qid(*av); av++; @@ -3083,7 +3127,7 @@ chkarg: default: abort(); } - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } if (have_state) /* must be a check-state, we are done */ @@ -3168,7 +3212,7 @@ chkarg: av++; if (F_LEN(cmd) != 0) { prev = cmd; - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } else if (first_cmd != cmd) { errx(EX_DATAERR, "invalid protocol ``%s''", *av); @@ -3189,11 +3233,11 @@ chkarg: OR_START(source_ip); NOT_BLOCK; /* optional "not" */ NEED1("missing source address"); - if (add_src(cmd, *av, proto)) { + if (add_src(cmd, *av, proto, cblen)) { av++; if (F_LEN(cmd) != 0) { /* ! any */ prev = cmd; - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } else errx(EX_USAGE, "bad source address %s", *av); @@ -3205,10 +3249,10 @@ chkarg: NOT_BLOCK; /* optional "not" */ if ( av[0] != NULL ) { if (_substrcmp(*av, "any") == 0 || - add_ports(cmd, *av, proto, O_IP_SRCPORT)) { + add_ports(cmd, *av, proto, O_IP_SRCPORT, cblen)) { av++; if (F_LEN(cmd) != 0) - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } @@ -3225,11 +3269,11 @@ chkarg: OR_START(dest_ip); NOT_BLOCK; /* optional "not" */ NEED1("missing dst address"); - if (add_dst(cmd, *av, proto)) { + if (add_dst(cmd, *av, proto, cblen)) { av++; if (F_LEN(cmd) != 0) { /* ! any */ prev = cmd; - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } else errx( EX_USAGE, "bad destination address %s", *av); @@ -3241,10 +3285,10 @@ chkarg: NOT_BLOCK; /* optional "not" */ if (av[0]) { if (_substrcmp(*av, "any") == 0 || - add_ports(cmd, *av, proto, O_IP_DSTPORT)) { + add_ports(cmd, *av, proto, O_IP_DSTPORT, cblen)) { av++; if (F_LEN(cmd) != 0) - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } @@ -3332,7 +3376,7 @@ read_options: case TOK_VIA: NEED1("recv, xmit, via require interface name" " or address"); - fill_iface((ipfw_insn_if *)cmd, av[0]); + fill_iface((ipfw_insn_if *)cmd, av[0], cblen); av++; if (F_LEN(cmd) == 0) /* not a valid address */ break; @@ -3352,14 +3396,14 @@ read_options: case TOK_ICMP6TYPES: NEED1("icmptypes requires list of types"); - fill_icmp6types((ipfw_insn_icmp6 *)cmd, *av); + fill_icmp6types((ipfw_insn_icmp6 *)cmd, *av, cblen); av++; break; case TOK_IPTTL: NEED1("ipttl requires TTL"); if (strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_IPTTL)) + if (!add_ports(cmd, *av, 0, O_IPTTL, cblen)) errx(EX_DATAERR, "invalid ipttl %s", *av); } else fill_cmd(cmd, O_IPTTL, 0, strtoul(*av, NULL, 0)); @@ -3369,7 +3413,7 @@ read_options: case TOK_IPID: NEED1("ipid requires id"); if (strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_IPID)) + if (!add_ports(cmd, *av, 0, O_IPID, cblen)) errx(EX_DATAERR, "invalid ipid %s", *av); } else fill_cmd(cmd, O_IPID, 0, strtoul(*av, NULL, 0)); @@ -3379,7 +3423,7 @@ read_options: case TOK_IPLEN: NEED1("iplen requires length"); if (strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_IPLEN)) + if (!add_ports(cmd, *av, 0, O_IPLEN, cblen)) errx(EX_DATAERR, "invalid ip len %s", *av); } else fill_cmd(cmd, O_IPLEN, 0, strtoul(*av, NULL, 0)); @@ -3475,7 +3519,7 @@ read_options: case TOK_TCPDATALEN: NEED1("tcpdatalen requires length"); if (strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_TCPDATALEN)) + if (!add_ports(cmd, *av, 0, O_TCPDATALEN, cblen)) errx(EX_DATAERR, "invalid tcpdata len %s", *av); } else fill_cmd(cmd, O_TCPDATALEN, 0, @@ -3501,7 +3545,7 @@ read_options: case TOK_TCPWIN: NEED1("tcpwin requires length"); if (strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_TCPWIN)) + if (!add_ports(cmd, *av, 0, O_TCPWIN, cblen)) errx(EX_DATAERR, "invalid tcpwin len %s", *av); } else fill_cmd(cmd, O_TCPWIN, 0, @@ -3540,6 +3584,7 @@ read_options: have_state = cmd; cmd->len = F_INSN_SIZE(ipfw_insn_limit); + CHECK_CMDLEN; cmd->opcode = O_LIMIT; c->limit_mask = c->conn_limit = 0; @@ -3571,28 +3616,28 @@ read_options: case TOK_SRCIP: NEED1("missing source IP"); - if (add_srcip(cmd, *av)) { + if (add_srcip(cmd, *av, cblen)) { av++; } break; case TOK_DSTIP: NEED1("missing destination IP"); - if (add_dstip(cmd, *av)) { + if (add_dstip(cmd, *av, cblen)) { av++; } break; case TOK_SRCIP6: NEED1("missing source IP6"); - if (add_srcip6(cmd, *av)) { + if (add_srcip6(cmd, *av, cblen)) { av++; } break; case TOK_DSTIP6: NEED1("missing destination IP6"); - if (add_dstip6(cmd, *av)) { + if (add_dstip6(cmd, *av, cblen)) { av++; } break; @@ -3600,7 +3645,7 @@ read_options: case TOK_SRCPORT: NEED1("missing source port"); if (_substrcmp(*av, "any") == 0 || - add_ports(cmd, *av, proto, O_IP_SRCPORT)) { + add_ports(cmd, *av, proto, O_IP_SRCPORT, cblen)) { av++; } else errx(EX_DATAERR, "invalid source port %s", *av); @@ -3609,7 +3654,7 @@ read_options: case TOK_DSTPORT: NEED1("missing destination port"); if (_substrcmp(*av, "any") == 0 || - add_ports(cmd, *av, proto, O_IP_DSTPORT)) { + add_ports(cmd, *av, proto, O_IP_DSTPORT, cblen)) { av++; } else errx(EX_DATAERR, "invalid destination port %s", @@ -3617,13 +3662,13 @@ read_options: break; case TOK_MAC: - if (add_mac(cmd, av)) + if (add_mac(cmd, av, cblen)) av += 2; break; case TOK_MACTYPE: NEED1("missing mac type"); - if (!add_mactype(cmd, *av)) + if (!add_mactype(cmd, *av, cblen)) errx(EX_DATAERR, "invalid mac type %s", *av); av++; break; @@ -3661,18 +3706,18 @@ read_options: if (proto != IPPROTO_IPV6 ) errx( EX_USAGE, "flow-id filter is active " "only for ipv6 protocol\n"); - fill_flow6( (ipfw_insn_u32 *) cmd, *av ); + fill_flow6( (ipfw_insn_u32 *) cmd, *av, cblen); av++; break; case TOK_COMMENT: - fill_comment(cmd, av); + fill_comment(cmd, av, cblen); av[0]=NULL; break; case TOK_TAGGED: if (av[0] && strpbrk(*av, "-,")) { - if (!add_ports(cmd, *av, 0, O_TAGGED)) + if (!add_ports(cmd, *av, 0, O_TAGGED, cblen)) errx(EX_DATAERR, "tagged: invalid tag" " list: %s", *av); } @@ -3725,7 +3770,7 @@ read_options: } if (F_LEN(cmd) > 0) { /* prepare to advance */ prev = cmd; - cmd = next_cmd(cmd); + cmd = next_cmd(cmd, &cblen); } } @@ -3754,12 +3799,13 @@ done: */ if (have_state && have_state->opcode != O_CHECK_STATE) { fill_cmd(dst, O_PROBE_STATE, 0, 0); - dst = next_cmd(dst); + dst = next_cmd(dst, &rblen); } /* copy all commands but O_LOG, O_KEEP_STATE, O_LIMIT, O_ALTQ, O_TAG */ for (src = (ipfw_insn *)cmdbuf; src != cmd; src += i) { i = F_LEN(src); + CHECK_RBUFLEN(i); switch (src->opcode) { case O_LOG: @@ -3779,6 +3825,7 @@ done: */ if (have_state && have_state->opcode != O_CHECK_STATE) { i = F_LEN(have_state); + CHECK_RBUFLEN(i); bcopy(have_state, dst, i * sizeof(uint32_t)); dst += i; } @@ -3790,24 +3837,29 @@ done: /* put back O_LOG, O_ALTQ, O_TAG if necessary */ if (have_log) { i = F_LEN(have_log); + CHECK_RBUFLEN(i); bcopy(have_log, dst, i * sizeof(uint32_t)); dst += i; } if (have_altq) { i = F_LEN(have_altq); + CHECK_RBUFLEN(i); bcopy(have_altq, dst, i * sizeof(uint32_t)); dst += i; } if (have_tag) { i = F_LEN(have_tag); + CHECK_RBUFLEN(i); bcopy(have_tag, dst, i * sizeof(uint32_t)); dst += i; } + /* * copy all other actions */ for (src = (ipfw_insn *)actbuf; src != action; src += i) { i = F_LEN(src); + CHECK_RBUFLEN(i); bcopy(src, dst, i * sizeof(uint32_t)); dst += i; } Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Sun Mar 3 13:53:58 2013 (r247711) +++ head/sbin/ipfw/ipfw2.h Sun Mar 3 14:05:03 2013 (r247712) @@ -283,10 +283,10 @@ void print_flow6id(struct _ipfw_insn_u32 void print_icmp6types(struct _ipfw_insn_u32 *cmd); void print_ext6hdr(struct _ipfw_insn *cmd ); -struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av); -struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av); +struct _ipfw_insn *add_srcip6(struct _ipfw_insn *cmd, char *av, int cblen); +struct _ipfw_insn *add_dstip6(struct _ipfw_insn *cmd, char *av, int cblen); -void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av ); +void fill_flow6(struct _ipfw_insn_u32 *cmd, char *av, int cblen); void fill_unreach6_code(u_short *codep, char *str); -void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av); +void fill_icmp6types(struct _ipfw_insn_icmp6 *cmd, char *av, int cblen); int fill_ext6hdr(struct _ipfw_insn *cmd, char *av); Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Sun Mar 3 13:53:58 2013 (r247711) +++ head/sbin/ipfw/ipv6.c Sun Mar 3 14:05:03 2013 (r247712) @@ -42,6 +42,11 @@ #include #include +#define CHECK_LENGTH(v, len) do { \ + if ((v) < (len)) \ + errx(EX_DATAERR, "Rule too long"); \ + } while (0) + static struct _s_x icmp6codes[] = { { "no-route", ICMP6_DST_UNREACH_NOROUTE }, { "admin-prohib", ICMP6_DST_UNREACH_ADMIN }, @@ -131,10 +136,12 @@ print_ip6(ipfw_insn_ip6 *cmd, char const } void -fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av) +fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cblen) { uint8_t type; + CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6)); + bzero(cmd, sizeof(*cmd)); while (*av) { if (*av == ',') @@ -327,7 +334,7 @@ lookup_host6 (char *host, struct in6_add * Return 1 on success, 0 on failure. */ static int -fill_ip6(ipfw_insn_ip6 *cmd, char *av) +fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen) { int len = 0; struct in6_addr *d = &(cmd->addr6); @@ -379,6 +386,8 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) int masklen; char md = '\0'; + CHECK_LENGTH(cblen, 1 + len + 2 * F_INSN_SIZE(struct in6_addr)); + if ((p = strpbrk(av, "/,")) ) { md = *p; /* save the separator */ *p = '\0'; /* terminate address string */ @@ -453,7 +462,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av) * additional flow-id we want to filter, the basic is 1 */ void -fill_flow6( ipfw_insn_u32 *cmd, char *av ) +fill_flow6( ipfw_insn_u32 *cmd, char *av, int cblen) { u_int32_t type; /* Current flow number */ u_int16_t nflow = 0; /* Current flow index */ @@ -461,6 +470,8 @@ fill_flow6( ipfw_insn_u32 *cmd, char *av cmd->d[0] = 0; /* Initializing the base number*/ while (s) { + CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_u32) + nflow + 1); + av = strsep( &s, ",") ; type = strtoul(av, &av, 0); if (*av != ',' && *av != '\0') @@ -481,10 +492,10 @@ fill_flow6( ipfw_insn_u32 *cmd, char *av } ipfw_insn * -add_srcip6(ipfw_insn *cmd, char *av) +add_srcip6(ipfw_insn *cmd, char *av, int cblen) { - fill_ip6((ipfw_insn_ip6 *)cmd, av); + fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen); if (cmd->opcode == O_IP_DST_SET) /* set */ cmd->opcode = O_IP_SRC_SET; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ @@ -503,10 +514,10 @@ add_srcip6(ipfw_insn *cmd, char *av) } ipfw_insn * -add_dstip6(ipfw_insn *cmd, char *av) +add_dstip6(ipfw_insn *cmd, char *av, int cblen) { - fill_ip6((ipfw_insn_ip6 *)cmd, av); + fill_ip6((ipfw_insn_ip6 *)cmd, av, cblen); if (cmd->opcode == O_IP_DST_SET) /* set */ ; else if (cmd->opcode == O_IP_DST_LOOKUP) /* table */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 14:42:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 858825E0; Sun, 3 Mar 2013 14:42:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 74FAA9F4; Sun, 3 Mar 2013 14:42:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23EgGAb068253; Sun, 3 Mar 2013 14:42:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23EgGQ7068252; Sun, 3 Mar 2013 14:42:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303031442.r23EgGQ7068252@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Mar 2013 14:42:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247713 - head/lib/libedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 14:42:16 -0000 Author: jilles Date: Sun Mar 3 14:42:15 2013 New Revision: 247713 URL: http://svnweb.freebsd.org/changeset/base/247713 Log: libedit: Revert r247683 to fix buildworld. I think r247683 is wrong because libedit.so actually uses symbols from libcurses.so. Since it breaks the build, revert it now. Modified: head/lib/libedit/Makefile Modified: head/lib/libedit/Makefile ============================================================================== --- head/lib/libedit/Makefile Sun Mar 3 14:05:03 2013 (r247712) +++ head/lib/libedit/Makefile Sun Mar 3 14:42:15 2013 (r247713) @@ -11,6 +11,7 @@ OSRCS= chared.c common.c el.c emacs.c fc parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c DPADD= ${LIBNCURSES} +LDADD= -lncurses MAN= editline.3 editrc.5 From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 14:43:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 29CBE765; Sun, 3 Mar 2013 14:43:27 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id E3C6BA04; Sun, 3 Mar 2013 14:43:26 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 538AB358C5A; Sun, 3 Mar 2013 15:43:26 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 312922848C; Sun, 3 Mar 2013 15:43:26 +0100 (CET) Date: Sun, 3 Mar 2013 15:43:26 +0100 From: Jilles Tjoelker To: "Pedro F. Giffuni" Subject: Re: svn commit: r247683 - head/lib/libedit Message-ID: <20130303144325.GB21318@stack.nl> References: <201303030211.r232B4RR039202@svn.freebsd.org> <20130303134314.GA21318@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130303134314.GA21318@stack.nl> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 14:43:27 -0000 On Sun, Mar 03, 2013 at 02:43:14PM +0100, Jilles Tjoelker wrote: > On Sun, Mar 03, 2013 at 02:11:04AM +0000, Pedro F. Giffuni wrote: > > Author: pfg > > Date: Sun Mar 3 02:11:03 2013 > > New Revision: 247683 > > URL: http://svnweb.freebsd.org/changeset/base/247683 > > Log: > > libedit does not need to be linked with ncurses > > libedit uses the terminfo headers but doesn't really need > > to be linked with ncurses. > > Discussed with: christos@NetBSD > > MFC after; 3 days > > Modified: > > head/lib/libedit/Makefile > > > Modified: head/lib/libedit/Makefile > > ============================================================================== > > --- head/lib/libedit/Makefile Sun Mar 3 01:36:31 2013 (r247682) > > +++ head/lib/libedit/Makefile Sun Mar 3 02:11:03 2013 (r247683) > > @@ -11,7 +11,6 @@ OSRCS= chared.c common.c el.c emacs.c fc > > parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c > > > > DPADD= ${LIBNCURSES} > > -LDADD= -lncurses > > > > MAN= editline.3 editrc.5 > > > This is wrong. libedit.so uses symbols such as tgetent from > libcurses.so, so it should be linked to libcurses.so. These symbols are > easily visible in the output of > objdump -T /lib/libedit.so.7 > because they are unversioned. > There is not much breakage because most applications using libedit > explicitly link to libcurses, since that is required for static linking. > For dynamic linking it is really a case of overlinking, particularly > because libedit completely abstracts away libcurses from the > application's point of view (in other words, the application need not > call libcurses itself). This actually happens in buildworld, so I have taken the liberty to revert your commit. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 14:47:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 77F43B81; Sun, 3 Mar 2013 14:47:03 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 68FD3A2A; Sun, 3 Mar 2013 14:47:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23El3QK069183; Sun, 3 Mar 2013 14:47:03 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23El34A069179; Sun, 3 Mar 2013 14:47:03 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303031447.r23El34A069179@svn.freebsd.org> From: Davide Italiano Date: Sun, 3 Mar 2013 14:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247714 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 14:47:03 -0000 Author: davide Date: Sun Mar 3 14:47:02 2013 New Revision: 247714 URL: http://svnweb.freebsd.org/changeset/base/247714 Log: Remove a couple of unused include. Modified: head/sys/kern/kern_timeout.c head/sys/sys/systm.h Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sun Mar 3 14:42:15 2013 (r247713) +++ head/sys/kern/kern_timeout.c Sun Mar 3 14:47:02 2013 (r247714) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sun Mar 3 14:42:15 2013 (r247713) +++ head/sys/sys/systm.h Sun Mar 3 14:47:02 2013 (r247714) @@ -44,7 +44,6 @@ #include #include #include /* for people using printf mainly */ -#include extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* kern_reboot() has been called. */ From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 15:01:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1C02AFB0; Sun, 3 Mar 2013 15:01:34 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EC7F3A96; Sun, 3 Mar 2013 15:01:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23F1XH5074534; Sun, 3 Mar 2013 15:01:33 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23F1XvA074533; Sun, 3 Mar 2013 15:01:33 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303031501.r23F1XvA074533@svn.freebsd.org> From: Davide Italiano Date: Sun, 3 Mar 2013 15:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247715 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 15:01:34 -0000 Author: davide Date: Sun Mar 3 15:01:33 2013 New Revision: 247715 URL: http://svnweb.freebsd.org/changeset/base/247715 Log: callwheelmask and callwheelsize are always greater than zero. Switch their type to u_int. Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sun Mar 3 14:47:02 2013 (r247714) +++ head/sys/kern/kern_timeout.c Sun Mar 3 15:01:33 2013 (r247715) @@ -83,7 +83,7 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_mpca * TODO: * allocate more timeout table slots when table overflows. */ -int callwheelsize, callwheelmask; +u_int callwheelsize, callwheelmask; /* * The callout cpu migration entity represents informations necessary for From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 15:02:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C30E51D0; Sun, 3 Mar 2013 15:02:56 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AC4E3AA9; Sun, 3 Mar 2013 15:02:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23F2uL3074856; Sun, 3 Mar 2013 15:02:56 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23F2uAT074855; Sun, 3 Mar 2013 15:02:56 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303031502.r23F2uAT074855@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Mar 2013 15:02:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247716 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 15:02:56 -0000 Author: jilles Date: Sun Mar 3 15:02:56 2013 New Revision: 247716 URL: http://svnweb.freebsd.org/changeset/base/247716 Log: MAINTAINERS: Document my maintainership of sh(1). Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Sun Mar 3 15:01:33 2013 (r247715) +++ head/MAINTAINERS Sun Mar 3 15:02:56 2013 (r247716) @@ -124,3 +124,6 @@ isci(4) jimharris Pre-commit review req cmx daniel@roe.ch Pre-commit review preferred. filemon obrien Pre-commit review preferred. sysdoc trhodes Pre-commit review preferred. +sh(1) jilles Pre-commit review requested. This also applies + to kill(1), printf(1) and test(1) which are + compiled in as builtins. From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 15:34:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 11255E47 for ; Sun, 3 Mar 2013 15:34:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm12-vm0.bullet.mail.ne1.yahoo.com (nm12-vm0.bullet.mail.ne1.yahoo.com [98.138.91.51]) by mx1.freebsd.org (Postfix) with ESMTP id B9FE7C31 for ; Sun, 3 Mar 2013 15:34:40 +0000 (UTC) Received: from [98.138.90.55] by nm12.bullet.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 15:34:34 -0000 Received: from [98.138.84.35] by tm8.bullet.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 15:34:34 -0000 Received: from [127.0.0.1] by smtp103.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 15:34:34 -0000 X-Yahoo-Newman-Id: 242951.15589.bm@smtp103.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 6WA_vLwVM1kIXUKjJAU59aB.Tc0lJYO67vOD5lxSoUy_1r5 Nv_hblC0BkBlrCI3pHtGwAd5QOyOrFUHkGmEu.cUGdoGEMvLgM9UDj2WHoxY azSxS.0q6f.AjzRx1uOTWzsuvmpPNos.nigh_lP.TrHdPmSWFgkGHundTHq0 m58jditn.ToyZTPyQb29VMZGKNZkbvKLXeLdZM5lCJdF.Z_EJuzoHpgv.pnL 4_..8TeZWcKRBkide_jcW_AKlzqWMNAYnhG25bKz8UeDqPiX514qiovvOLdj sRieFh52ntLbJNOgPr3tfhlNxwGywX06Zuqqgwebfx_KdkSmUTUhE7K27ndr llfrhl.Wy6QeUlM2RcGtl_acqGzdjixLRE865DROZ7IxXVEUDLbg16B4Ew72 7kJJEryUTLHVEus7g1qnaT7qn10lIb_ZN_fFuhlHUiuwb.rbeEHCgXYJjOvd l1LfhOGgdrpve6HjoJ9zN._JE_T1uM64l_qsPJdTO41SjFreO._bJaFNvnoW Zmjzo7xyij5qyquWpYGrotQlY3bDGjImVRpMnqGl4oiFvf.rWmeW6lysMO.U X7lJuTRkb6y57BsdZUOPSo4Yc X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Received: from [190.157.124.18] (pfg@190.157.124.18 with plain) by smtp103.mail.ne1.yahoo.com with SMTP; 03 Mar 2013 07:34:34 -0800 PST Message-ID: <51336D8C.9000105@FreeBSD.org> Date: Sun, 03 Mar 2013 10:34:36 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130201 Thunderbird/17.0.2 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: svn commit: r247713 - head/lib/libedit References: <201303031442.r23EgGQ7068252@svn.freebsd.org> In-Reply-To: <201303031442.r23EgGQ7068252@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 15:34:41 -0000 On 03/03/2013 09:42, Jilles Tjoelker wrote: > Author: jilles > Date: Sun Mar 3 14:42:15 2013 > New Revision: 247713 > URL: http://svnweb.freebsd.org/changeset/base/247713 > > Log: > libedit: Revert r247683 to fix buildworld. > > I think r247683 is wrong because libedit.so actually uses symbols from > libcurses.so. Since it breaks the build, revert it now. > > Modified: > head/lib/libedit/Makefile > > Modified: head/lib/libedit/Makefile > ============================================================================== > --- head/lib/libedit/Makefile Sun Mar 3 14:05:03 2013 (r247712) > +++ head/lib/libedit/Makefile Sun Mar 3 14:42:15 2013 (r247713) > @@ -11,6 +11,7 @@ OSRCS= chared.c common.c el.c emacs.c fc > parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c > > DPADD= ${LIBNCURSES} > +LDADD= -lncurses > > MAN= editline.3 editrc.5 > > Thank you for reverting. My router broke this morning or I would've done it first. I have no idea why NetBSD survives without linking ncurses here but next time I will test this further before trusting the package author. Pedro. From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 16:17:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0936BD46; Sun, 3 Mar 2013 16:17:10 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C12B4E45; Sun, 3 Mar 2013 16:17:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23GH9L9097872; Sun, 3 Mar 2013 16:17:09 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23GH9F1097871; Sun, 3 Mar 2013 16:17:09 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201303031617.r23GH9F1097871@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 3 Mar 2013 16:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247719 - head/sys/modules/mqueue X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 16:17:10 -0000 Author: uqs Date: Sun Mar 3 16:17:09 2013 New Revision: 247719 URL: http://svnweb.freebsd.org/changeset/base/247719 Log: Fix 'make depend' Modified: head/sys/modules/mqueue/Makefile Modified: head/sys/modules/mqueue/Makefile ============================================================================== --- head/sys/modules/mqueue/Makefile Sun Mar 3 16:16:10 2013 (r247718) +++ head/sys/modules/mqueue/Makefile Sun Mar 3 16:17:09 2013 (r247719) @@ -5,6 +5,6 @@ KMOD= mqueuefs SRCS= uipc_mqueue.c \ vnode_if.h \ - opt_posix.h opt_compat.h + opt_posix.h opt_compat.h opt_capsicum.h .include From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 17:34:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BAD60CA4; Sun, 3 Mar 2013 17:34:00 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A07D3CA; Sun, 3 Mar 2013 17:34:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23HY0sN021426; Sun, 3 Mar 2013 17:34:00 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23HY00n021423; Sun, 3 Mar 2013 17:34:00 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201303031734.r23HY00n021423@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Mar 2013 17:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247720 - in head: bin/sh tools/regression/bin/sh/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 17:34:00 -0000 Author: jilles Date: Sun Mar 3 17:33:59 2013 New Revision: 247720 URL: http://svnweb.freebsd.org/changeset/base/247720 Log: sh: When executing a trap, keep exit status along with evalskip. This ensures 'return' in a trap returns the correct status to the caller. If evalskip is not set or if it is overridden by a previous evalskip, keep the old behaviour of restoring the exit status from before the trap. Added: head/tools/regression/bin/sh/builtins/trap12.0 (contents, props changed) Modified: head/bin/sh/trap.c Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sun Mar 3 16:17:09 2013 (r247719) +++ head/bin/sh/trap.c Sun Mar 3 17:33:59 2013 (r247720) @@ -455,7 +455,6 @@ dotrap(void) last_trapsig = i; savestatus = exitstatus; evalstring(trap[i], 0); - exitstatus = savestatus; /* * If such a command was not @@ -464,9 +463,11 @@ dotrap(void) * trap action to have an effect * outside of it. */ - if (prev_evalskip != 0) { + if (evalskip == 0 || + prev_evalskip != 0) { evalskip = prev_evalskip; skipcount = prev_skipcount; + exitstatus = savestatus; } if (i == SIGCHLD) Added: head/tools/regression/bin/sh/builtins/trap12.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/trap12.0 Sun Mar 3 17:33:59 2013 (r247720) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +f() { + trap 'return 42' USR1 + kill -USR1 $$ + return 3 +} +f +r=$? +[ "$r" = 42 ] From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 19:10:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 21E1EDE7; Sun, 3 Mar 2013 19:10:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0F057329; Sun, 3 Mar 2013 19:10:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23JASfA050285; Sun, 3 Mar 2013 19:10:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23JAS3L050275; Sun, 3 Mar 2013 19:10:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303031910.r23JAS3L050275@svn.freebsd.org> From: Alexander Motin Date: Sun, 3 Mar 2013 19:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247725 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 19:10:29 -0000 Author: mav Date: Sun Mar 3 19:10:28 2013 New Revision: 247725 URL: http://svnweb.freebsd.org/changeset/base/247725 Log: Fix typos in hint names. MFC after: 1 week Modified: head/share/man/man4/mvs.4 Modified: head/share/man/man4/mvs.4 ============================================================================== --- head/share/man/man4/mvs.4 Sun Mar 3 19:02:23 2013 (r247724) +++ head/share/man/man4/mvs.4 Sun Mar 3 19:10:28 2013 (r247725) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 27, 2010 +.Dd March 3, 2013 .Dt MVS 4 .Os .Sh NAME @@ -62,7 +62,7 @@ command latency. .It Va hint.mvs. Ns Ar X Ns Va .cccc defines number of completed commands for CCC, which trigger interrupt without waiting for specified coalescing timeout. -.It Va hint.mvs. Ns Ar X Ns Va .pm_level +.It Va hint.mvsch. Ns Ar X Ns Va .pm_level controls SATA interface Power Management for the specified channel, allowing some power to be saved at the cost of additional command latency. @@ -82,7 +82,7 @@ driver initiates SLUMBER PM state transi Note that interface Power Management is not compatible with device presence detection. A manual bus reset is needed on device hot-plug. -.It Va hint.mvs. Ns Ar X Ns Va .sata_rev +.It Va hint.mvsch. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. .El From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 20:10:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D8CF0EA6; Sun, 3 Mar 2013 20:10:57 +0000 (UTC) (envelope-from dwmalone@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B2DF373A; Sun, 3 Mar 2013 20:10:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23KAvq4069162; Sun, 3 Mar 2013 20:10:57 GMT (envelope-from dwmalone@svn.freebsd.org) Received: (from dwmalone@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23KAusJ069153; Sun, 3 Mar 2013 20:10:56 GMT (envelope-from dwmalone@svn.freebsd.org) Message-Id: <201303032010.r23KAusJ069153@svn.freebsd.org> From: David Malone Date: Sun, 3 Mar 2013 20:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247730 - head/usr.bin/find X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 20:10:57 -0000 Author: dwmalone Date: Sun Mar 3 20:10:56 2013 New Revision: 247730 URL: http://svnweb.freebsd.org/changeset/base/247730 Log: Add an option for finding sparse files. Reviewed by: iedowse MFC after: 3 weeks Modified: head/usr.bin/find/extern.h head/usr.bin/find/find.1 head/usr.bin/find/function.c head/usr.bin/find/option.c Modified: head/usr.bin/find/extern.h ============================================================================== --- head/usr.bin/find/extern.h Sun Mar 3 19:31:44 2013 (r247729) +++ head/usr.bin/find/extern.h Sun Mar 3 20:10:56 2013 (r247730) @@ -73,6 +73,7 @@ creat_f c_regex; creat_f c_samefile; creat_f c_simple; creat_f c_size; +creat_f c_sparse; creat_f c_type; creat_f c_user; creat_f c_xdev; @@ -109,6 +110,7 @@ exec_f f_prune; exec_f f_quit; exec_f f_regex; exec_f f_size; +exec_f f_sparse; exec_f f_type; exec_f f_user; Modified: head/usr.bin/find/find.1 ============================================================================== --- head/usr.bin/find/find.1 Sun Mar 3 19:31:44 2013 (r247729) +++ head/usr.bin/find/find.1 Sun Mar 3 20:10:56 2013 (r247730) @@ -816,6 +816,10 @@ terabytes (1024 gigabytes) .It Cm P petabytes (1024 terabytes) .El +.It Ic -sparse +True if the current file is sparse, +i.e. has fewer blocks allocated than expected based on its size in bytes. +This might also match files that have been compressed by the filesystem. .It Ic -type Ar t True if the file is of the specified type. Possible file types are as follows: @@ -997,7 +1001,7 @@ and as well as .Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , .Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , -.Ic -path , -print0 , -regex +.Ic -path , -print0 , -regex, -sparse and all of the .Ic -B* birthtime related primaries are extensions to Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Sun Mar 3 19:31:44 2013 (r247729) +++ head/usr.bin/find/function.c Sun Mar 3 20:10:56 2013 (r247730) @@ -1497,6 +1497,29 @@ c_size(OPTION *option, char ***argvp) } /* + * -sparse functions -- + * + * Check if a file is sparse by finding if it occupies fewer blocks + * than we expect based on its size. + */ +int +f_sparse(PLAN *plan __unused, FTSENT *entry) +{ + off_t expected_blocks; + + expected_blocks = (entry->fts_statp->st_size + 511) / 512; + return entry->fts_statp->st_blocks < expected_blocks; +} + +PLAN * +c_sparse(OPTION *option, char ***argvp __unused) +{ + ftsoptions &= ~FTS_NOSTAT; + + return palloc(option); +} + +/* * -type c functions -- * * True if the type of the file is c, where c is b, c, d, p, f or w Modified: head/usr.bin/find/option.c ============================================================================== --- head/usr.bin/find/option.c Sun Mar 3 19:31:44 2013 (r247729) +++ head/usr.bin/find/option.c Sun Mar 3 20:10:56 2013 (r247730) @@ -145,6 +145,7 @@ static OPTION const options[] = { { "-regex", c_regex, f_regex, 0 }, { "-samefile", c_samefile, f_inum, 0 }, { "-size", c_size, f_size, 0 }, + { "-sparse", c_sparse, f_sparse, 0 }, { "-true", c_simple, f_always_true, 0 }, { "-type", c_type, f_type, 0 }, { "-uid", c_user, f_user, 0 }, From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:01:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 812727C2; Sun, 3 Mar 2013 23:01:47 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6403BDA3; Sun, 3 Mar 2013 23:01:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23N1lK8023041; Sun, 3 Mar 2013 23:01:47 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23N1lZa023039; Sun, 3 Mar 2013 23:01:47 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201303032301.r23N1lZa023039@svn.freebsd.org> From: Josh Paetzel Date: Sun, 3 Mar 2013 23:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247734 - head/usr.sbin/pc-sysinstall/backend X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:01:47 -0000 Author: jpaetzel Date: Sun Mar 3 23:01:46 2013 New Revision: 247734 URL: http://svnweb.freebsd.org/changeset/base/247734 Log: Improves and enhances using the "installPackages=" variable. Adds "pkgExt=" variable to set if pkgs are .tbz or .txz or other. Auto-detects if packages are PKGNG or old PKG format. Auto-bootstrap of PKGNG for the new installed environment. Fixes issues with installing packages from local media, such as DVD/USB. Switch to using a space-delimiter for installPackages, since a number of packages use a "," in their version string. Fix pc-sysinstall to ignore install scripts, and not hang on user interaction prompts when installing pkgs. Add pkg2ng command as apart of pkgng bootstrap process. Obtained from: PC-BSD Modified: head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh head/usr.sbin/pc-sysinstall/backend/functions-packages.sh Modified: head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh Sun Mar 3 22:33:13 2013 (r247733) +++ head/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh Sun Mar 3 23:01:46 2013 (r247734) @@ -76,50 +76,113 @@ fetch_package_dependencies() # Check for any packages specified, and begin loading them install_packages() { + echo "Checking for packages to install..." + sleep 2 + # First, lets check and see if we even have any packages to install get_value_from_cfg installPackages - if [ -n "${VAL}" ] - then - HERE=`pwd` - rc_nohalt "mkdir -p ${FSMNT}/${PKGTMPDIR}" - rc_nohalt "cd ${FSMNT}/${PKGTMPDIR}" - if [ ! -f "${CONFDIR}/INDEX" ] + # Nothing to do? + if [ -z "${VAL}" ]; then return; fi + + echo "Installing packages..." + sleep 3 + + local PKGPTH + + HERE=`pwd` + rc_halt "mkdir -p ${FSMNT}${PKGTMPDIR}" + + # Determine the directory we will install packages from + get_package_location + rc_halt "cd ${PKGDLDIR}" + + # Set the location of the INDEXFILE + INDEXFILE="${TMPDIR}/INDEX" + + if [ ! -f "${INDEXFILE}" ]; then + get_package_index + fi + + if [ ! -f "${TMPDIR}/INDEX.parsed" -a "$INSTALLMEDIUM" = "ftp" ]; then + parse_package_index + fi + + # What extension are we using for pkgs? + PKGEXT="txz" + get_value_from_cfg pkgExt + if [ -n "${VAL}" ]; then + strip_white_space ${VAL} + PKGEXT="$VAL" + fi + export PKGEXT + + # We dont want to be bothered with scripts asking questions + PACKAGE_BUILDING=yes + export PACKAGE_BUILDING + + # Lets start by cleaning up the string and getting it ready to parse + get_value_from_cfg_with_spaces installPackages + PACKAGES="${VAL}" + echo_log "Packages to install: `echo $PACKAGES | wc -w | awk '{print $1}'`" + for i in $PACKAGES + do + if ! get_package_name "${i}" then - get_package_index + echo_log "Unable to locate package ${i}" + continue + fi + + PKGNAME="${VAL}" + + # Fetch package + deps, but skip if installing from local media + if [ "${INSTALLMEDIUM}" = "ftp" ] ; then + DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps" + rc_nohalt "touch ${DEPFILE}" + determine_package_dependencies "${PKGNAME}" "${DEPFILE}" + fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}" fi - if [ ! -f "${CONFDIR}/INDEX.parsed" ] + # Set package location + case "${INSTALLMEDIUM}" in + usb|dvd|local) PKGPTH="${PKGTMPDIR}/All/${PKGNAME}" ;; + *) PKGPTH="${PKGTMPDIR}/${PKGNAME}" ;; + esac + + # See if we need to determine the package format we are working with + if [ -z "${PKGINFO}" ] ; then + tar tqf "${FSMNT}${PKGPTH}" '+MANIFEST' >/dev/null 2>/dev/null + if [ $? -ne 0 ] ; then + PKGADD="pkg_add -C ${FSMNT}" + PKGINFO="pkg_info" + else + PKGADD="pkg -c ${FSMNT} add" + PKGINFO="pkg info" + bootstrap_pkgng + fi + fi + + # If the package is not already installed, install it! + if ! run_chroot_cmd "${PKGINFO} -e ${PKGNAME}" >/dev/null 2>/dev/null then - parse_package_index + echo_log "Installing package: ${PKGNAME}" + rc_nohalt "${PKGADD} ${PKGPTH}" fi - # Lets start by cleaning up the string and getting it ready to parse - strip_white_space ${VAL} - PACKAGES=`echo ${VAL} | sed -e "s|,| |g"` - for i in $PACKAGES - do - if get_package_name "${i}" - then - PKGNAME="${VAL}" - DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps" - - rc_nohalt "touch ${DEPFILE}" - determine_package_dependencies "${PKGNAME}" "${DEPFILE}" - fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}" - - # If the package is not already installed, install it! - if ! run_chroot_cmd "pkg_info -e ${PKGNAME}" - then - rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz" - fi + if [ "${INSTALLMEDIUM}" = "ftp" ] ; then + rc_nohalt "rm ${DEPFILE}" + fi - rc_nohalt "rm ${DEPFILE}" - fi + done - rc_nohalt "cd ${HERE}" - done + echo_log "Package installation complete!" - rm -rf "${FSMNT}/${PKGTMPDIR}" + # Cleanup after ourselves + rc_halt "cd ${HERE}" + if [ "${INSTALLMEDIUM}" = "ftp" ] ; then + rc_halt "rm -rf ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null + else + rc_halt "umount ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null + rc_halt "rmdir ${FSMNT}${PKGTMPDIR}" >/dev/null 2>/dev/null fi }; Modified: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-packages.sh Sun Mar 3 22:33:13 2013 (r247733) +++ head/usr.sbin/pc-sysinstall/backend/functions-packages.sh Sun Mar 3 23:01:46 2013 (r247734) @@ -45,9 +45,11 @@ get_package_index_by_ftp() then INDEX_FILE="${INDEX_FILE}.bz2" USE_BZIP2=1 + INDEX_PATH="${INDEXFILE}.bz2" + else + INDEX_PATH="${INDEXFILE}" fi - INDEX_PATH="${CONFDIR}/${INDEX_FILE}" fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1" if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ] then @@ -57,17 +59,18 @@ get_package_index_by_ftp() get_package_index_by_fs() { - local INDEX_FILE - - INDEX_FILE="${CDMNT}/packages/INDEX" - fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0" + if [ "$INSTALLMEDIUM" = "local" ] ; then + INDEXFILE="${LOCALPATH}/packages/INDEX" + else + INDEXFILE="${CDMNT}/packages/INDEX" + fi }; get_package_index_size() { - if [ -f "${CONFDIR}/INDEX" ] + if [ -f "${INDEXFILE}" ] then - SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'` + SIZE=`ls -l ${INDEXFILE} | awk '{ print $5 }'` else get_ftp_mirror FTPHOST="${VAL}" @@ -94,28 +97,24 @@ get_package_index() get_package_index_by_ftp "${FTPPATH}" else - get_value_from_cfg ftpHost - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" - fi - - FTPHOST="${VAL}" - - get_value_from_cfg ftpDir - if [ -z "$VAL" ] - then - exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" - fi - - FTPDIR="${VAL}" - FTPPATH="ftp://${FTPHOST}${FTPDIR}" case "${INSTALLMEDIUM}" in - usb|dvd) get_package_index_by_fs ;; - ftp) get_package_index_by_ftp "${FTPPATH}" ;; - sftp) ;; - *) RES=1 ;; + usb|dvd|local) get_package_index_by_fs ;; + ftp) get_value_from_cfg ftpHost + if [ -z "$VAL" ]; then + exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!" + fi + FTPHOST="${VAL}" + + get_value_from_cfg ftpDir + if [ -z "$VAL" ]; then + exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!" + fi + FTPDIR="${VAL}" + FTPPATH="ftp://${FTPHOST}${FTPDIR}" + get_package_index_by_ftp "${FTPPATH}" ;; + sftp) ;; + *) RES=1 ;; esac fi @@ -125,10 +124,11 @@ get_package_index() parse_package_index() { + echo_log "Building package dep list.. Please wait.." INDEX_FILE="${PKGDIR}/INDEX" exec 3<&0 - exec 0<"${INDEX_FILE}" + exec 0<"${INDEXFILE}" while read -r line do @@ -257,20 +257,38 @@ get_package_name() { PACKAGE="${1}" RES=0 + local PKGPTH - INDEX_FILE="${PKGDIR}/INDEX.deps" - REGEX="^${PACKAGE}|" + # If we are on a local medium, we can parse the Latest/ directory + if [ "${INSTALLMEDIUM}" != "ftp" ] ; then + case "${INSTALLMEDIUM}" in + usb|dvd) PKGPTH="${CDMNT}/packages" ;; + *) PKGPTH="${LOCALPATH}/packages" ;; + esac + + # Check the /Latest dir for generic names, then look for specific version in All/ + if [ -e "${PKGPTH}/Latest/${PACKAGE}.${PKGEXT}" ] ; then + NAME=`ls -al ${PKGPTH}/Latest/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '` + else + NAME=`ls -al ${PKGPTH}/All/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '` + fi + export VAL="${NAME}" + else + # Doing remote fetch, we we will look up, but some generic names like + # "perl" wont work, since we don't know the default version + INDEX_FILE="${PKGDIR}/INDEX.deps" + REGEX="^${PACKAGE}|" - LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null` - NAME=`echo "${LINE}"|cut -f2 -d'|'` + LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null` + NAME=`echo "${LINE}"|cut -f2 -d'|'` - export VAL="${NAME}" + export VAL="${NAME}" + fi if [ -z "${VAL}" ] then RES=1 fi - return ${RES} }; @@ -334,7 +352,7 @@ fetch_package_by_ftp() fi FTPDIR="${VAL}" - PACKAGE="${PACKAGE}.tbz" + PACKAGE="${PACKAGE}.${PKGEXT}" FTP_SERVER="ftp://${FTPHOST}${FTPDIR}" if [ ! -f "${SAVEDIR}/${PACKAGE}" ] @@ -345,28 +363,49 @@ fetch_package_by_ftp() fi }; -fetch_package_by_fs() -{ - CATEGORY="${1}" - PACKAGE="${2}" - SAVEDIR="${3}" - - PACKAGE="${PACKAGE}.tbz" - if [ ! -f "${SAVEDIR}/${PACKAGE}" ] - then - fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0" - fi -}; - fetch_package() { CATEGORY="${1}" PACKAGE="${2}" SAVEDIR="${3}" + # Fetch package, but skip if installing from local media case "${INSTALLMEDIUM}" in - usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; + usb|dvd|local) return ;; ftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;; sftp) ;; esac }; + +bootstrap_pkgng() +{ + # Check if we need to boot-strap pkgng + if run_chroot_cmd "which pkg-static" >/dev/null 2>/dev/null + then + return + fi + local PKGPTH + + # Ok, lets boot-strap this sucker + echo_log "Bootstraping pkgng.." + fetch_package "Latest" "pkg" "${PKGDLDIR}" + + # Figure out real location of "pkg" package + case "${INSTALLMEDIUM}" in + usb|dvd|local) PKGPTH="${PKGTMPDIR}/Latest/pkg.${PKGEXT}" ;; + *) PKGPTH="${PKGTMPDIR}/pkg.${PKGEXT}" ;; + esac + rc_halt "pkg -c ${FSMNT} add ${PKGPTH}" ; run_chroot_cmd "pkg2ng" +} + +get_package_location() +{ + case "${INSTALLMEDIUM}" in + usb|dvd) rc_halt "mount_nullfs ${CDMNT}/packages ${FSMNT}${PKGTMPDIR}" + PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;; + local) rc_halt "mount_nullfs ${LOCALPATH}/packages ${FSMNT}${PKGTMPDIR}" + PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;; + *) PKGDLDIR="${FSMNT}${PKGTMPDIR}" ;; + esac + export PKGDLDIR +} From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:07:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 327E796D; Sun, 3 Mar 2013 23:07:29 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0B84CDC5; Sun, 3 Mar 2013 23:07:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23N7S5u024049; Sun, 3 Mar 2013 23:07:28 GMT (envelope-from jpaetzel@svn.freebsd.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23N7RXa024039; Sun, 3 Mar 2013 23:07:27 GMT (envelope-from jpaetzel@svn.freebsd.org) Message-Id: <201303032307.r23N7RXa024039@svn.freebsd.org> From: Josh Paetzel Date: Sun, 3 Mar 2013 23:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247735 - in head/usr.sbin/pc-sysinstall: backend 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:07:29 -0000 Author: jpaetzel Date: Sun Mar 3 23:07:27 2013 New Revision: 247735 URL: http://svnweb.freebsd.org/changeset/base/247735 Log: Use GNOP to force ZFS pools to 4k. Obtained from: PC-BSD Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh head/usr.sbin/pc-sysinstall/backend/functions-disk.sh head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh head/usr.sbin/pc-sysinstall/backend/functions.sh head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -62,7 +62,18 @@ get_fs_line_xvars() echo $ZFSVARS | grep -qE "^(disk|file|mirror|raidz(1|2|3)?|spare|log|cache):" 2>/dev/null if [ $? -eq 0 ] ; then ZTYPE=`echo $ZFSVARS | cut -f1 -d:` - ZFSVARS=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"` + tmpVars=`echo $ZFSVARS | sed "s|$ZTYPE: ||g" | sed "s|$ZTYPE:||g"` + ZFSVARS="" + # make sure we have a '/dev' in front of the extra devices + for i in $tmpVars + do + echo $i | grep -q '/dev/' + if [ $? -ne 0 ] ; then + ZFSVARS="$ZFSVARS /dev/${i}" + else + ZFSVARS="$ZFSVARS $i" + fi + done fi # Return the ZFS options Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -33,6 +33,7 @@ is_disk() for _dsk in `sysctl -n kern.disks` do [ "$_dsk" = "${1}" ] && return 0 + [ "/dev/$_dsk" = "${1}" ] && return 0 done return 1 Modified: head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -149,12 +149,12 @@ mount_all_filesystems() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - if [ ! -e "${PARTDEV}" ] + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] then exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" @@ -186,12 +186,12 @@ mount_all_filesystems() for PART in `ls ${PARTDIR}` do PARTDEV=`echo $PART | sed 's|-|/|g'` - if [ ! -e "${PARTDEV}" ] + PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" + if [ ! -e "${PARTDEV}" -a "${PARTFS}" != "ZFS" ] then exit_err "ERROR: The partition ${PARTDEV} does not exist. Failure in bsdlabel?" fi - PARTFS="`cat ${PARTDIR}/${PART} | cut -d '#' -f 1`" PARTMNT="`cat ${PARTDIR}/${PART} | cut -d '#' -f 2`" PARTENC="`cat ${PARTDIR}/${PART} | cut -d '#' -f 3`" Modified: head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -60,18 +60,56 @@ setup_zfs_filesystem() fi done - # Check if we have some custom zpool arguments and use them if so if [ ! -z "${ZPOOLOPTS}" ] ; then - rc_halt "zpool create -m none -f ${ZPOOLNAME} ${ZPOOLOPTS}" + # Sort through devices and run gnop on them + local gnopDev="" + local newOpts="" + for i in $ZPOOLOPTS + do + echo "$i" | grep -q '/dev/' + if [ $? -eq 0 ] ; then + rc_halt "gnop create -S 4096 ${i}" + gnopDev="$gnopDev $i" + newOpts="$newOpts ${i}.nop" + else + newOpts="$newOpts $i" + fi + done + + echo_log "Creating zpool ${ZPOOLNAME} with $newOpts" + rc_halt "zpool create -m none -f ${ZPOOLNAME} ${newOpts}" + + # Export the pool + rc_halt "zpool export ${ZPOOLNAME}" + + # Destroy the gnop devices + for i in $gnopDev + do + rc_halt "gnop destroy ${i}.nop" + done + + # And lastly re-import the pool + rc_halt "zpool import ${ZPOOLNAME}" else + # Lets do our pseudo-4k drive + rc_halt "gnop create -S 4096 ${PART}${EXT}" + # No zpool options, create pool on single device - rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}" + echo_log "Creating zpool ${ZPOOLNAME} on ${PART}${EXT}" + rc_halt "zpool create -m none -f ${ZPOOLNAME} ${PART}${EXT}.nop" + + # Finish up the gnop 4k trickery + rc_halt "zpool export ${ZPOOLNAME}" + rc_halt "gnop destroy ${PART}${EXT}.nop" + rc_halt "zpool import ${ZPOOLNAME}" fi # Disable atime for this zfs partition, speed increase rc_nohalt "zfs set atime=off ${ZPOOLNAME}" + + }; # Runs newfs on all the partiions which we've setup with bsdlabel Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions.sh Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/backend/functions.sh Sun Mar 3 23:07:27 2013 (r247735) @@ -277,7 +277,11 @@ get_zpool_name() while : do NEWNAME="${BASENAME}${NUM}" - zpool import | grep -qw "${NEWNAME}" || break + zpool list | grep -qw "${NEWNAME}" + local chk1=$? + zpool import | grep -qw "${NEWNAME}" + local chk2=$? + if [ $chk1 -eq 1 -a $chk2 -eq 1 ] ; then break ; fi NUM=$((NUM+1)) done Modified: head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf ============================================================================== --- head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Sun Mar 3 23:01:46 2013 (r247734) +++ head/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf Sun Mar 3 23:07:27 2013 (r247735) @@ -5,11 +5,9 @@ TMPDIR="/tmp/.pc-sysinstall" export TMPDIR -if [ ! -d "${TMPDIR}" ] -then - mkdir -p ${TMPDIR} - chmod 777 ${TMPDIR} -fi +# Create a fresh TMPDIR +if [ -d "${TMPDIR}" -a "$TMPDIR" != '/' ]; then rm -rf ${TMPDIR}; fi +mkdir -p ${TMPDIR} # Set our temp directory for storing partition information PARTDIR="${TMPDIR}/part-info" From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:23:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 85608CF1; Sun, 3 Mar 2013 23:23:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5AA94E75; Sun, 3 Mar 2013 23:23:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23NNaTT029683; Sun, 3 Mar 2013 23:23:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23NNZY4029680; Sun, 3 Mar 2013 23:23:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303032323.r23NNZY4029680@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 3 Mar 2013 23:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247736 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:23:36 -0000 Author: pjd Date: Sun Mar 3 23:23:35 2013 New Revision: 247736 URL: http://svnweb.freebsd.org/changeset/base/247736 Log: Plug memory leaks in file descriptors passing. Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Mar 3 23:07:27 2013 (r247735) +++ head/sys/kern/kern_descrip.c Sun Mar 3 23:23:35 2013 (r247736) @@ -1397,7 +1397,7 @@ filecaps_copy(const struct filecaps *src /* * Move filecaps structure to the new place and clear the old place. */ -static void +void filecaps_move(struct filecaps *src, struct filecaps *dst) { Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sun Mar 3 23:07:27 2013 (r247735) +++ head/sys/kern/uipc_usrreq.c Sun Mar 3 23:23:35 2013 (r247736) @@ -1686,6 +1686,7 @@ unp_freerights(struct filedescent *fde, for (i = 0; i < fdcount; i++, fde++) { fp = fde->fde_file; + filecaps_free(&fdep->fde_caps); bzero(fde, sizeof(*fde)); unp_discard(fp); } @@ -1760,7 +1761,7 @@ unp_externalize(struct mbuf *control, st panic("unp_externalize fdalloc failed"); fde = &fdesc->fd_ofiles[f]; fde->fde_file = fdep->fde_file; - filecaps_copy(&fdep->fde_caps, &fde->fde_caps); + filecaps_move(&fdep->fde_caps, &fde->fde_caps); unp_externalize_fp(fde->fde_file); *fdp = f; } Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Mar 3 23:07:27 2013 (r247735) +++ head/sys/sys/filedesc.h Sun Mar 3 23:23:35 2013 (r247736) @@ -136,6 +136,7 @@ struct thread; void filecaps_init(struct filecaps *fcaps); void filecaps_copy(const struct filecaps *src, struct filecaps *dst); +void filecaps_move(struct filecaps *src, struct filecaps *dst); void filecaps_free(struct filecaps *fcaps); int closef(struct file *fp, struct thread *td); From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:25:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 77C94E71; Sun, 3 Mar 2013 23:25:46 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 68C57E84; Sun, 3 Mar 2013 23:25:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23NPkAZ030012; Sun, 3 Mar 2013 23:25:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23NPk50030011; Sun, 3 Mar 2013 23:25:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303032325.r23NPk50030011@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 3 Mar 2013 23:25:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247737 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:25:46 -0000 Author: pjd Date: Sun Mar 3 23:25:45 2013 New Revision: 247737 URL: http://svnweb.freebsd.org/changeset/base/247737 Log: Use dedicated malloc type for filecaps-related data, so we can detect any memory leaks easier. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Mar 3 23:23:35 2013 (r247736) +++ head/sys/kern/kern_descrip.c Sun Mar 3 23:25:45 2013 (r247737) @@ -104,6 +104,7 @@ static MALLOC_DEFINE(M_FILEDESC, "filede static MALLOC_DEFINE(M_FILEDESC_TO_LEADER, "filedesc_to_leader", "file desc to leader structures"); static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); +MALLOC_DEFINE(M_FILECAPS, "filecaps", "descriptor capabilities"); MALLOC_DECLARE(M_FADVISE); @@ -1389,7 +1390,7 @@ filecaps_copy(const struct filecaps *src ("fc_ioctls != NULL, but fc_nioctls=%hd", src->fc_nioctls)); size = sizeof(src->fc_ioctls[0]) * src->fc_nioctls; - dst->fc_ioctls = malloc(size, M_TEMP, M_WAITOK); + dst->fc_ioctls = malloc(size, M_FILECAPS, M_WAITOK); bcopy(src->fc_ioctls, dst->fc_ioctls, size); } } @@ -1425,7 +1426,7 @@ void filecaps_free(struct filecaps *fcaps) { - free(fcaps->fc_ioctls, M_TEMP); + free(fcaps->fc_ioctls, M_FILECAPS); bzero(fcaps, sizeof(*fcaps)); } From owner-svn-src-head@FreeBSD.ORG Sun Mar 3 23:39:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7E5434E1; Sun, 3 Mar 2013 23:39:31 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 65B66EE5; Sun, 3 Mar 2013 23:39:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r23NdUbh033512; Sun, 3 Mar 2013 23:39:30 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r23NdUxm033511; Sun, 3 Mar 2013 23:39:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201303032339.r23NdUxm033511@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 3 Mar 2013 23:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247740 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 23:39:31 -0000 Author: pjd Date: Sun Mar 3 23:39:30 2013 New Revision: 247740 URL: http://svnweb.freebsd.org/changeset/base/247740 Log: For some reason when I started to pass filedescent structures instead of pointers to the file structure receiving descriptors stopped to work when also at least few kilobytes of data is being send. In the kernel the soreceive_generic() function doesn't see control mbuf as the first mbuf and unp_externalize() is never called, first 6(?) kilobytes of data is missing as well on receiving end. This breaks for example tmux. I don't know yet why going from 8 bytes to sizeof(struct filedescent) per descriptor (or even to 16 bytes per descriptor) breaks things, but to work-around it for now use 8 bytes per file descriptor at the cost of memory allocation. Reported by: flo, Diane Bruce, Jan Beich Simple testcase provided by: mjg Modified: head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Sun Mar 3 23:27:21 2013 (r247739) +++ head/sys/kern/uipc_usrreq.c Sun Mar 3 23:39:30 2013 (r247740) @@ -102,6 +102,8 @@ __FBSDID("$FreeBSD$"); #include +MALLOC_DECLARE(M_FILECAPS); + /* * Locking key: * (l) Locked using list lock @@ -282,7 +284,7 @@ static void unp_drop(struct unpcb *, int static void unp_gc(__unused void *, int); static void unp_scan(struct mbuf *, void (*)(struct file *)); static void unp_discard(struct file *); -static void unp_freerights(struct filedescent *, int); +static void unp_freerights(struct filedescent **, int); static void unp_init(void); static int unp_internalize(struct mbuf **, struct thread *); static void unp_internalize_fp(struct file *); @@ -1679,17 +1681,17 @@ unp_drop(struct unpcb *unp, int errno) } static void -unp_freerights(struct filedescent *fde, int fdcount) +unp_freerights(struct filedescent **fdep, int fdcount) { struct file *fp; int i; - for (i = 0; i < fdcount; i++, fde++) { - fp = fde->fde_file; - filecaps_free(&fdep->fde_caps); - bzero(fde, sizeof(*fde)); + for (i = 0; i < fdcount; i++) { + fp = fdep[i]->fde_file; + filecaps_free(&fdep[i]->fde_caps); unp_discard(fp); } + free(fdep[0], M_FILECAPS); } static int @@ -1700,7 +1702,7 @@ unp_externalize(struct mbuf *control, st int i; int *fdp; struct filedesc *fdesc = td->td_proc->p_fd; - struct filedescent *fde, *fdep; + struct filedescent *fde, **fdep; void *data; socklen_t clen = control->m_len, datalen; int error, newfds; @@ -1756,16 +1758,18 @@ unp_externalize(struct mbuf *control, st fdp = (int *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); - for (i = 0; i < newfds; i++, fdep++, fdp++) { + for (i = 0; i < newfds; i++, fdp++) { if (fdalloc(td, 0, &f)) panic("unp_externalize fdalloc failed"); fde = &fdesc->fd_ofiles[f]; - fde->fde_file = fdep->fde_file; - filecaps_move(&fdep->fde_caps, &fde->fde_caps); + fde->fde_file = fdep[0]->fde_file; + filecaps_move(&fdep[0]->fde_caps, + &fde->fde_caps); unp_externalize_fp(fde->fde_file); *fdp = f; } FILEDESC_XUNLOCK(fdesc); + free(fdep[0], M_FILECAPS); } else { /* We can just copy anything else across. */ if (error || controlp == NULL) @@ -1840,7 +1844,7 @@ unp_internalize(struct mbuf **controlp, struct bintime *bt; struct cmsghdr *cm = mtod(control, struct cmsghdr *); struct cmsgcred *cmcred; - struct filedescent *fde, *fdep; + struct filedescent *fde, **fdep, *fdev; struct file *fp; struct timeval *tv; int i, fd, *fdp; @@ -1914,7 +1918,7 @@ unp_internalize(struct mbuf **controlp, * Now replace the integer FDs with pointers to the * file structure and capability rights. */ - newlen = oldfds * sizeof(*fdep); + newlen = oldfds * sizeof(fdep[0]); *controlp = sbcreatecontrol(NULL, newlen, SCM_RIGHTS, SOL_SOCKET); if (*controlp == NULL) { @@ -1923,13 +1927,17 @@ unp_internalize(struct mbuf **controlp, goto out; } fdp = data; - fdep = (struct filedescent *) + fdep = (struct filedescent **) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); - for (i = 0; i < oldfds; i++, fdep++, fdp++) { + fdev = malloc(sizeof(*fdev) * oldfds, M_FILECAPS, + M_WAITOK); + for (i = 0; i < oldfds; i++, fdev++, fdp++) { fde = &fdesc->fd_ofiles[*fdp]; - fdep->fde_file = fde->fde_file; - filecaps_copy(&fde->fde_caps, &fdep->fde_caps); - unp_internalize_fp(fdep->fde_file); + fdep[i] = fdev; + fdep[i]->fde_file = fde->fde_file; + filecaps_copy(&fde->fde_caps, + &fdep[i]->fde_caps); + unp_internalize_fp(fdep[i]->fde_file); } FILEDESC_SUNLOCK(fdesc); break; @@ -2291,7 +2299,7 @@ static void unp_scan(struct mbuf *m0, void (*op)(struct file *)) { struct mbuf *m; - struct filedescent *fdep; + struct filedescent **fdep; struct cmsghdr *cm; void *data; int i; @@ -2318,8 +2326,8 @@ unp_scan(struct mbuf *m0, void (*op)(str cm->cmsg_type == SCM_RIGHTS) { qfds = datalen / sizeof(*fdep); fdep = data; - for (i = 0; i < qfds; i++, fdep++) - (*op)(fdep->fde_file); + for (i = 0; i < qfds; i++) + (*op)(fdep[i]->fde_file); } if (CMSG_SPACE(datalen) < clen) { From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:19:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7C34077B; Mon, 4 Mar 2013 02:19:56 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6F91C380; Mon, 4 Mar 2013 02:19:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242JuLj082930; Mon, 4 Mar 2013 02:19:56 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242JuAX082928; Mon, 4 Mar 2013 02:19:56 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040219.r242JuAX082928@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247751 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:19:56 -0000 Author: eadler Date: Mon Mar 4 02:19:55 2013 New Revision: 247751 URL: http://svnweb.freebsd.org/changeset/base/247751 Log: Constify where possible. Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 01:56:00 2013 (r247750) +++ head/sbin/devd/devd.cc Mon Mar 4 02:19:55 2013 (r247751) @@ -653,7 +653,7 @@ config::expand_string(const char *src, c } bool -config::chop_var(char *&buffer, char *&lhs, char *&rhs) +config::chop_var(char *&buffer, char *&lhs, char *&rhs) const { char *walker; Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Mon Mar 4 01:56:00 2013 (r247750) +++ head/sbin/devd/devd.hh Mon Mar 4 02:19:55 2013 (r247751) @@ -172,7 +172,7 @@ protected: void parse_files_in_dir(const char *dirname); void expand_one(const char *&src, std::string &dst); bool is_id_char(char) const; - bool chop_var(char *&buffer, char *&lhs, char *&rhs); + bool chop_var(char *&buffer, char *&lhs, char *&rhs) const; private: std::vector _dir_list; std::string _pidfile; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0F26A90B; Mon, 4 Mar 2013 02:21:04 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F2157391; Mon, 4 Mar 2013 02:21:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242L3xS084753; Mon, 4 Mar 2013 02:21:03 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242L3uo084752; Mon, 4 Mar 2013 02:21:03 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242L3uo084752@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247752 - head/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:04 -0000 Author: eadler Date: Mon Mar 4 02:21:03 2013 New Revision: 247752 URL: http://svnweb.freebsd.org/changeset/base/247752 Log: Due to calendar(1)'s abuse of the C preprocessor "unix" gets expanded to "1". 'Fix' this. PR: bin/175790 Submitted by: ak Approved by: cperciva (mentor) Modified: head/usr.bin/calendar/calendars/calendar.birthday Modified: head/usr.bin/calendar/calendars/calendar.birthday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.birthday Mon Mar 4 02:19:55 2013 (r247751) +++ head/usr.bin/calendar/calendars/calendar.birthday Mon Mar 4 02:21:03 2013 (r247752) @@ -6,6 +6,7 @@ #ifndef _calendar_birthday_ #define _calendar_birthday_ +#undef unix 01/01 J.D. Salinger born, 1919 01/01 Paul Revere born in Boston, 1735 From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DD7F690C; Mon, 4 Mar 2013 02:21:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C6AAA392; Mon, 4 Mar 2013 02:21:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242L6T0084792; Mon, 4 Mar 2013 02:21:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242L65q084791; Mon, 4 Mar 2013 02:21:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242L65q084791@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247753 - head/usr.bin/hexdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:06 -0000 Author: eadler Date: Mon Mar 4 02:21:06 2013 New Revision: 247753 URL: http://svnweb.freebsd.org/changeset/base/247753 Log: Fix typo ('1' != 'l') PR: bin/175975 Submitted by: William Ahern Approved by: cperciva (mentor) Modified: head/usr.bin/hexdump/conv.c Modified: head/usr.bin/hexdump/conv.c ============================================================================== --- head/usr.bin/hexdump/conv.c Mon Mar 4 02:21:03 2013 (r247752) +++ head/usr.bin/hexdump/conv.c Mon Mar 4 02:21:06 2013 (r247753) @@ -151,7 +151,7 @@ conv_u(PR *pr, u_char *p) static char const * list[] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs", "ht", "lf", "vt", "ff", "cr", "so", "si", - "dle", "dcl", "dc2", "dc3", "dc4", "nak", "syn", "etb", + "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc", "fs", "gs", "rs", "us", }; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3DD7690D; Mon, 4 Mar 2013 02:21:09 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1AE42393; Mon, 4 Mar 2013 02:21:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242L8HG084829; Mon, 4 Mar 2013 02:21:08 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242L81G084828; Mon, 4 Mar 2013 02:21:08 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242L81G084828@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247754 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:09 -0000 Author: eadler Date: Mon Mar 4 02:21:08 2013 New Revision: 247754 URL: http://svnweb.freebsd.org/changeset/base/247754 Log: devd: Use volatile sig_atomic_t for the flag set by a signal handler. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:06 2013 (r247753) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:08 2013 (r247754) @@ -116,7 +116,7 @@ static struct pidfh *pfh; int Dflag; int dflag; int nflag; -int romeo_must_die = 0; +static volatile sig_atomic_t romeo_must_die = 0; static const char *configfile = CF; @@ -1076,7 +1076,7 @@ set_variable(const char *var, const char static void gensighand(int) { - romeo_must_die++; + romeo_must_die = 1; _exit(0); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EC34FA62; Mon, 4 Mar 2013 02:21:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E0231397; Mon, 4 Mar 2013 02:21:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LCRm084872; Mon, 4 Mar 2013 02:21:12 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LCNk084871; Mon, 4 Mar 2013 02:21:12 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LCNk084871@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247755 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:13 -0000 Author: eadler Date: Mon Mar 4 02:21:12 2013 New Revision: 247755 URL: http://svnweb.freebsd.org/changeset/base/247755 Log: devd: Remove call to _exit() from signal handler, which also sets a stop flag. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:08 2013 (r247754) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:12 2013 (r247755) @@ -1077,7 +1077,6 @@ static void gensighand(int) { romeo_must_die = 1; - _exit(0); } static void From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 60A7EB6C; Mon, 4 Mar 2013 02:21:15 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A3004398; Mon, 4 Mar 2013 02:21:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LFf2084911; Mon, 4 Mar 2013 02:21:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LFrL084910; Mon, 4 Mar 2013 02:21:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LFrL084910@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247756 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:17 -0000 Author: eadler Date: Mon Mar 4 02:21:15 2013 New Revision: 247756 URL: http://svnweb.freebsd.org/changeset/base/247756 Log: devd: Simplify while (1) { if (x) break; } to while (!x) {}. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:12 2013 (r247755) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:15 2013 (r247756) @@ -912,9 +912,7 @@ event_loop(void) server_fd = create_socket(PIPE); accepting = 1; max_fd = max(fd, server_fd) + 1; - while (1) { - if (romeo_must_die) - break; + while (!romeo_must_die) { if (!once && !dflag && !nflag) { // Check to see if we have any events pending. tv.tv_sec = 0; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 20EF6B89; Mon, 4 Mar 2013 02:21:18 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 14EFA39A; Mon, 4 Mar 2013 02:21:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LH79084952; Mon, 4 Mar 2013 02:21:17 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LHdj084951; Mon, 4 Mar 2013 02:21:17 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LHdj084951@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247757 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:18 -0000 Author: eadler Date: Mon Mar 4 02:21:17 2013 New Revision: 247757 URL: http://svnweb.freebsd.org/changeset/base/247757 Log: devd: Use the standard constructor of std::string instead of string(""). Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Mon Mar 4 02:21:15 2013 (r247756) +++ head/sbin/devd/devd.hh Mon Mar 4 02:21:17 2013 (r247757) @@ -144,7 +144,7 @@ private: class config { public: - config() : _pidfile("") { push_var_table(); } + config() { push_var_table(); } virtual ~config() { reset(); } void add_attach(int, event_proc *); void add_detach(int, event_proc *); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5B7B6B8A; Mon, 4 Mar 2013 02:21:20 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6313A4; Mon, 4 Mar 2013 02:21:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LKYp084988; Mon, 4 Mar 2013 02:21:20 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LKGY084987; Mon, 4 Mar 2013 02:21:20 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LKGY084987@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247758 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:20 -0000 Author: eadler Date: Mon Mar 4 02:21:19 2013 New Revision: 247758 URL: http://svnweb.freebsd.org/changeset/base/247758 Log: devd: Avoid unnecessary temporary objects (and simplify the code) when handling std::string. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:17 2013 (r247757) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:19 2013 (r247758) @@ -460,7 +460,7 @@ config::open_pidfile() { pid_t otherpid; - if (_pidfile == "") + if (_pidfile.empty()) return; pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid); if (pfh == NULL) { @@ -528,7 +528,7 @@ config::add_notify(int prio, event_proc void config::set_pidfile(const char *fn) { - _pidfile = string(fn); + _pidfile = fn; } void @@ -617,7 +617,7 @@ config::expand_one(const char *&src, str do { buffer.append(src++, 1); } while (is_id_char(*src)); - dst.append(get_variable(buffer.c_str())); + dst.append(get_variable(buffer)); } const string From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7DBCACB8; Mon, 4 Mar 2013 02:21:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C512D3C6; Mon, 4 Mar 2013 02:21:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LMl2085031; Mon, 4 Mar 2013 02:21:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LMs7085030; Mon, 4 Mar 2013 02:21:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LMs7085030@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247759 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:23 -0000 Author: eadler Date: Mon Mar 4 02:21:22 2013 New Revision: 247759 URL: http://svnweb.freebsd.org/changeset/base/247759 Log: devd: Remove empty virtual destructor from class, which has noch subclasses. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Mon Mar 4 02:21:19 2013 (r247758) +++ head/sbin/devd/devd.hh Mon Mar 4 02:21:22 2013 (r247759) @@ -42,7 +42,6 @@ class var_list { public: var_list() {} - virtual ~var_list() {} /** Set a variable in this var list. */ void set_variable(const std::string &var, const std::string &val); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2A639CF7; Mon, 4 Mar 2013 02:21:25 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1E8673C8; Mon, 4 Mar 2013 02:21:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LPwv085067; Mon, 4 Mar 2013 02:21:25 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LO9G085066; Mon, 4 Mar 2013 02:21:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LO9G085066@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247760 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:25 -0000 Author: eadler Date: Mon Mar 4 02:21:24 2013 New Revision: 247760 URL: http://svnweb.freebsd.org/changeset/base/247760 Log: devd: Remove unnecessary empty default constructors. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Mon Mar 4 02:21:22 2013 (r247759) +++ head/sbin/devd/devd.hh Mon Mar 4 02:21:24 2013 (r247760) @@ -41,7 +41,6 @@ class config; class var_list { public: - var_list() {} /** Set a variable in this var list. */ void set_variable(const std::string &var, const std::string &val); @@ -67,7 +66,6 @@ private: struct eps { public: - eps() {} virtual ~eps() {} /** Does this eps match the current config? */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2824DE14; Mon, 4 Mar 2013 02:21:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61D023CB; Mon, 4 Mar 2013 02:21:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LR4K085112; Mon, 4 Mar 2013 02:21:27 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LRvw085110; Mon, 4 Mar 2013 02:21:27 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LRvw085110@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247761 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:29 -0000 Author: eadler Date: Mon Mar 4 02:21:26 2013 New Revision: 247761 URL: http://svnweb.freebsd.org/changeset/base/247761 Log: devd: Use string::empty() instea of string::length() == 0. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:24 2013 (r247760) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:26 2013 (r247761) @@ -319,7 +319,7 @@ media::do_match(config &c) // the name of interest, first try device-name and fall back // to subsystem if none exists. value = c.get_variable("device-name"); - if (value.length() == 0) + if (value.empty()) value = c.get_variable("subsystem"); if (Dflag) fprintf(stderr, "Testing media type of %s against 0x%x\n", From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ACC6BE1F; Mon, 4 Mar 2013 02:21:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A0CCA3CE; Mon, 4 Mar 2013 02:21:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LTvb085146; Mon, 4 Mar 2013 02:21:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LTbZ085145; Mon, 4 Mar 2013 02:21:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LTbZ085145@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247762 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:29 -0000 Author: eadler Date: Mon Mar 4 02:21:29 2013 New Revision: 247762 URL: http://svnweb.freebsd.org/changeset/base/247762 Log: devd: Use simpler dst += *x instead of str.append(x, 1). Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:26 2013 (r247761) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:29 2013 (r247762) @@ -585,7 +585,7 @@ config::expand_one(const char *&src, str src++; // $$ -> $ if (*src == '$') { - dst.append(src++, 1); + dst += *src++; return; } @@ -593,7 +593,7 @@ config::expand_one(const char *&src, str // Not sure if I want to support this or not, so for now we just pass // it through. if (*src == '(') { - dst.append("$"); + dst += '$'; count = 1; /* If the string ends before ) is matched , return. */ while (count > 0 && *src) { @@ -601,21 +601,21 @@ config::expand_one(const char *&src, str count--; else if (*src == '(') count++; - dst.append(src++, 1); + dst += *src++; } return; } // ${^A-Za-z] -> $\1 if (!isalpha(*src)) { - dst.append("$"); - dst.append(src++, 1); + dst += '$'; + dst += *src++; return; } // $var -> replace with value do { - buffer.append(src++, 1); + buffer += *src++; } while (is_id_char(*src)); dst.append(get_variable(buffer)); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 976D9F3B; Mon, 4 Mar 2013 02:21:32 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E94E23D4; Mon, 4 Mar 2013 02:21:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LV5Z085187; Mon, 4 Mar 2013 02:21:31 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LVv3085186; Mon, 4 Mar 2013 02:21:31 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LVv3085186@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247763 - head/sbin/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:34 -0000 Author: eadler Date: Mon Mar 4 02:21:31 2013 New Revision: 247763 URL: http://svnweb.freebsd.org/changeset/base/247763 Log: devd: Correct typo in comment. Submitted by: Christoph Mallon Approved by: cperciva (mentor) Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Mon Mar 4 02:21:29 2013 (r247762) +++ head/sbin/devd/devd.cc Mon Mar 4 02:21:31 2013 (r247763) @@ -606,7 +606,7 @@ config::expand_one(const char *&src, str return; } - // ${^A-Za-z] -> $\1 + // $[^A-Za-z] -> $\1 if (!isalpha(*src)) { dst += '$'; dst += *src++; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 02:21:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 15365F4B; Mon, 4 Mar 2013 02:21:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 091593D8; Mon, 4 Mar 2013 02:21:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r242LYiw085228; Mon, 4 Mar 2013 02:21:34 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r242LYAH085225; Mon, 4 Mar 2013 02:21:34 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303040221.r242LYAH085225@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 02:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247764 - in head/sys/compat: linprocfs linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 02:21:35 -0000 Author: eadler Date: Mon Mar 4 02:21:34 2013 New Revision: 247764 URL: http://svnweb.freebsd.org/changeset/base/247764 Log: Remove check for NULL prior to free(9) and m_freem(9). Approved by: cperciva (mentor) Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Mon Mar 4 02:21:31 2013 (r247763) +++ head/sys/compat/linprocfs/linprocfs.c Mon Mar 4 02:21:34 2013 (r247764) @@ -386,8 +386,7 @@ linprocfs_domtab(PFS_FILL_ARGS) sbuf_printf(sb, " 0 0\n"); } mtx_unlock(&mountlist_mtx); - if (flep != NULL) - free(flep, M_TEMP); + free(flep, M_TEMP); return (error); } @@ -447,8 +446,7 @@ linprocfs_dopartitions(PFS_FILL_ARGS) } g_topology_unlock(); - if (flep != NULL) - free(flep, M_TEMP); + free(flep, M_TEMP); return (error); } Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Mon Mar 4 02:21:31 2013 (r247763) +++ head/sys/compat/linux/linux_file.c Mon Mar 4 02:21:34 2013 (r247764) @@ -517,8 +517,7 @@ eof: td->td_retval[0] = nbytes - resid; out: - if (cookies) - free(cookies, M_TEMP); + free(cookies, M_TEMP); VOP_UNLOCK(vp, 0); foffset_unlock(fp, off, 0); Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Mon Mar 4 02:21:31 2013 (r247763) +++ head/sys/compat/linux/linux_socket.c Mon Mar 4 02:21:34 2013 (r247764) @@ -1443,10 +1443,8 @@ out: bad: free(iov, M_IOV); - if (control != NULL) - m_freem(control); - if (linux_cmsg != NULL) - free(linux_cmsg, M_TEMP); + m_freem(control); + free(linux_cmsg, M_TEMP); return (error); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 07:47:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 95D44717; Mon, 4 Mar 2013 07:47:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2B420167; Mon, 4 Mar 2013 07:40:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r247epTJ075347; Mon, 4 Mar 2013 07:40:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r247eoYx075341; Mon, 4 Mar 2013 07:40:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303040740.r247eoYx075341@svn.freebsd.org> From: Adrian Chadd Date: Mon, 4 Mar 2013 07:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247774 - in head/sys/dev/ath: . ath_hal ath_hal/ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 07:47:00 -0000 Author: adrian Date: Mon Mar 4 07:40:49 2013 New Revision: 247774 URL: http://svnweb.freebsd.org/changeset/base/247774 Log: add a method to set/clear the VMF field in the TX descriptor. Obtained from: Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Mon Mar 4 07:25:11 2013 (r247773) +++ head/sys/dev/ath/ath_hal/ah.h Mon Mar 4 07:40:49 2013 (r247774) @@ -1527,11 +1527,13 @@ struct ath_hal { struct ath_desc *, u_int); void __ahdecl(*ah_set11nAggrLast)(struct ath_hal *, struct ath_desc *); - void __ahdecl(*ah_clr11nAggr)(struct ath_hal *, struct ath_desc *); void __ahdecl(*ah_set11nBurstDuration)(struct ath_hal *, struct ath_desc *, u_int); + void __ahdecl(*ah_set11nVirtMoreFrag)(struct ath_hal *, + struct ath_desc *, u_int); + HAL_BOOL __ahdecl(*ah_getMibCycleCounts) (struct ath_hal *, HAL_SURVEY_SAMPLE *); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Mar 4 07:25:11 2013 (r247773) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Mon Mar 4 07:40:49 2013 (r247774) @@ -409,8 +409,9 @@ extern void ar5416Set11nAggrFirst(struct u_int aggrLen, u_int numDelims); extern void ar5416Set11nAggrMiddle(struct ath_hal *ah, struct ath_desc *ds, u_int numDelims); extern void ar5416Set11nAggrLast(struct ath_hal *ah, struct ath_desc *ds); - extern void ar5416Clr11nAggr(struct ath_hal *ah, struct ath_desc *ds); +extern void ar5416Set11nVirtualMoreFrag(struct ath_hal *ah, + struct ath_desc *ds, u_int vmf); extern void ar5416Set11nBurstDuration(struct ath_hal *ah, struct ath_desc *ds, u_int burstDuration); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Mar 4 07:25:11 2013 (r247773) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Mon Mar 4 07:40:49 2013 (r247774) @@ -194,6 +194,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_set11nMac2040 = ar5416Set11nMac2040; ah->ah_get11nRxClear = ar5416Get11nRxClear; ah->ah_set11nRxClear = ar5416Set11nRxClear; + ah->ah_set11nVirtMoreFrag = ar5416Set11nVirtualMoreFrag; /* Interrupt functions */ ah->ah_isInterruptPending = ar5416IsInterruptPending; Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Mon Mar 4 07:25:11 2013 (r247773) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Mon Mar 4 07:40:49 2013 (r247774) @@ -825,6 +825,17 @@ ar5416Clr11nAggr(struct ath_hal *ah, str ads->ds_ctl6 &= ~AR_AggrLen; } +void +ar5416Set11nVirtualMoreFrag(struct ath_hal *ah, struct ath_desc *ds, + u_int vmf) +{ + struct ar5416_desc *ads = AR5416DESC(ds); + if (vmf) + ads->ds_ctl0 |= AR_VirtMoreFrag; + else + ads->ds_ctl0 &= ~AR_VirtMoreFrag; +} + /* * Program the burst duration, with the included BA delta if it's * applicable. Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Mar 4 07:25:11 2013 (r247773) +++ head/sys/dev/ath/if_athvar.h Mon Mar 4 07:40:49 2013 (r247774) @@ -1297,6 +1297,8 @@ void ath_intr(void *); ((*(_ah)->ah_set11nBurstDuration)((_ah), (_ds), (_dur))) #define ath_hal_clr11n_aggr(_ah, _ds) \ ((*(_ah)->ah_clr11nAggr)((_ah), (_ds))) +#define ath_hal_set11n_virtmorefrag(_ah, _ds, _v) \ + ((*(_ah)->ah_set11nVirtMoreFrag)((_ah), (_ds), (_v))) #define ath_hal_gpioCfgOutput(_ah, _gpio, _type) \ ((*(_ah)->ah_gpioCfgOutput)((_ah), (_gpio), (_type))) From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 10:41:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A58E7519; Mon, 4 Mar 2013 10:41:54 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99AA7B2B; Mon, 4 Mar 2013 10:41:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24AfshF014573; Mon, 4 Mar 2013 10:41:54 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24Afs5J014572; Mon, 4 Mar 2013 10:41:54 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201303041041.r24Afs5J014572@svn.freebsd.org> From: Olivier Houchard Date: Mon, 4 Mar 2013 10:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247776 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 10:41:54 -0000 Author: cognet Date: Mon Mar 4 10:41:54 2013 New Revision: 247776 URL: http://svnweb.freebsd.org/changeset/base/247776 Log: If we're using a PIPT L2 cache, only merge 2 segments if both the virtual and the physical addreses are contiguous. Submitted by: Thomas Skibo 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 Mon Mar 4 09:35:50 2013 (r247775) +++ head/sys/arm/arm/busdma_machdep-v6.c Mon Mar 4 10:41:54 2013 (r247776) @@ -1007,6 +1007,9 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm } else { sl = &map->slist[map->sync_count - 1]; if (map->sync_count == 0 || +#ifdef ARM_L2_PIPT + curaddr != sl->busaddr + sl->datacount || +#endif vaddr != sl->vaddr + sl->datacount) { if (++map->sync_count > dmat->nsegments) goto cleanup; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:09:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 536A88FB; Mon, 4 Mar 2013 11:09:58 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37A201019; Mon, 4 Mar 2013 11:09:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24B9weq022399; Mon, 4 Mar 2013 11:09:58 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24B9vbt022388; Mon, 4 Mar 2013 11:09:57 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041109.r24B9vbt022388@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 11:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247777 - in head/sys: conf kern netinet 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:09:58 -0000 Author: davide Date: Mon Mar 4 11:09:56 2013 New Revision: 247777 URL: http://svnweb.freebsd.org/changeset/base/247777 Log: - Make callout(9) tickless, relying on eventtimers(4) as backend for precise time event generation. This greatly improves granularity of callouts which are not anymore constrained to wait next tick to be scheduled. - Extend the callout KPI introducing a set of callout_reset_sbt* functions, which take a sbintime_t as timeout argument. The new KPI also offers a way for consumers to specify precision tolerance they allow, so that callout can coalesce events and reduce number of interrupts as well as potentially avoid scheduling a SWI thread. - Introduce support for dispatching callouts directly from hardware interrupt context, specifying an additional flag. This feature should be used carefully, as long as interrupt context has some limitations (e.g. no sleeping locks can be held). - Enhance mechanisms to gather informations about callwheel, introducing a new sysctl to obtain stats. This change breaks the KBI. struct callout fields has been changed, in particular 'int ticks' (4 bytes) has been replaced with 'sbintime_t' (8 bytes) and another 'sbintime_t' field was added for precision. Together with: mav Reviewed by: attilio, bde, luigi, phk Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo (amd64, sparc64), marius (sparc64), ian (arm), markj (amd64), mav, Fabian Keil Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/kern/kern_tc.c head/sys/kern/kern_timeout.c head/sys/kern/subr_param.c head/sys/netinet/tcp_timer.c head/sys/sys/_callout.h head/sys/sys/callout.h head/sys/sys/systm.h head/sys/sys/time.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/conf/NOTES Mon Mar 4 11:09:56 2013 (r247777) @@ -259,6 +259,8 @@ options SX_NOINLINE # SMP Debugging Options: # +# CALLOUT_PROFILING enables rudimentary profiling of the callwheel data +# structure used as backend in callout(9). # PREEMPTION allows the threads that are in the kernel to be preempted by # higher priority [interrupt] threads. It helps with interactivity # and allows interrupt threads to run sooner rather than waiting. @@ -297,6 +299,9 @@ options LOCK_PROFILING options MPROF_BUFFERS="1536" options MPROF_HASH_SIZE="1543" +# Profiling for the callout(9) backend. +options CALLOUT_PROFILING + # Profiling for internal hash tables. options SLEEPQUEUE_PROFILING options TURNSTILE_PROFILING Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/conf/options Mon Mar 4 11:09:56 2013 (r247777) @@ -68,6 +68,7 @@ TEXTDUMP_VERBOSE opt_ddb.h ADAPTIVE_LOCKMGRS ALQ AUDIT opt_global.h +CALLOUT_PROFILING CAPABILITIES opt_capsicum.h CAPABILITY_MODE opt_capsicum.h COMPAT_43 opt_compat.h Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/kern/kern_clock.c Mon Mar 4 11:09:56 2013 (r247777) @@ -460,7 +460,7 @@ hardclock_cpu(int usermode) if (td->td_intr_frame != NULL) PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); #endif - callout_tick(); + callout_process(sbinuptime()); } /* @@ -550,7 +550,6 @@ hardclock_cnt(int cnt, int usermode) if (td->td_intr_frame != NULL) PMC_SOFT_CALL_TF( , , clock, hard, td->td_intr_frame); #endif - callout_tick(); /* We are in charge to handle this tick duty. */ if (newticks > 0) { /* Dangerous and no need to call these things concurrently. */ Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/kern/kern_clocksource.c Mon Mar 4 11:09:56 2013 (r247777) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2012 Alexander Motin + * Copyright (c) 2010-2013 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,17 +64,14 @@ int cpu_can_deep_sleep = 0; /* C3 stat int cpu_disable_deep_sleep = 0; /* Timer dies in C3. */ static void setuptimer(void); -static void loadtimer(struct bintime *now, int first); +static void loadtimer(sbintime_t now, int first); static int doconfigtimer(void); static void configtimer(int start); static int round_freq(struct eventtimer *et, int freq); -static void getnextcpuevent(struct bintime *event, int idle); -static void getnextevent(struct bintime *event); -static int handleevents(struct bintime *now, int fake); -#ifdef SMP -static void cpu_new_callout(int cpu, int ticks); -#endif +static sbintime_t getnextcpuevent(int idle); +static sbintime_t getnextevent(void); +static int handleevents(sbintime_t now, int fake); static struct mtx et_hw_mtx; @@ -94,13 +92,11 @@ static struct mtx et_hw_mtx; } static struct eventtimer *timer = NULL; -static struct bintime timerperiod; /* Timer period for periodic mode. */ -static struct bintime hardperiod; /* hardclock() events period. */ -static struct bintime statperiod; /* statclock() events period. */ -static struct bintime profperiod; /* profclock() events period. */ -static struct bintime nexttick; /* Next global timer tick time. */ -static struct bintime nexthard; /* Next global hardlock() event. */ -static u_int busy = 0; /* Reconfiguration is in progress. */ +static sbintime_t timerperiod; /* Timer period for periodic mode. */ +static sbintime_t statperiod; /* statclock() events period. */ +static sbintime_t profperiod; /* profclock() events period. */ +static sbintime_t nexttick; /* Next global timer tick time. */ +static u_int busy = 1; /* Reconfiguration is in progress. */ static int profiling = 0; /* Profiling events enabled. */ static char timername[32]; /* Wanted timer. */ @@ -116,11 +112,6 @@ TUNABLE_INT("kern.eventtimer.idletick", SYSCTL_UINT(_kern_eventtimer, OID_AUTO, idletick, CTLFLAG_RW, &idletick, 0, "Run periodic events when idle"); -static u_int activetick = 1; /* Run all periodic events when active. */ -TUNABLE_INT("kern.eventtimer.activetick", &activetick); -SYSCTL_UINT(_kern_eventtimer, OID_AUTO, activetick, CTLFLAG_RW, &activetick, - 0, "Run all periodic events when active"); - static int periodic = 0; /* Periodic or one-shot mode. */ static int want_periodic = 0; /* What mode to prefer. */ TUNABLE_INT("kern.eventtimer.periodic", &want_periodic); @@ -129,31 +120,23 @@ struct pcpu_state { struct mtx et_hw_mtx; /* Per-CPU timer mutex. */ u_int action; /* Reconfiguration requests. */ u_int handle; /* Immediate handle resuests. */ - struct bintime now; /* Last tick time. */ - struct bintime nextevent; /* Next scheduled event on this CPU. */ - struct bintime nexttick; /* Next timer tick time. */ - struct bintime nexthard; /* Next hardlock() event. */ - struct bintime nextstat; /* Next statclock() event. */ - struct bintime nextprof; /* Next profclock() event. */ + sbintime_t now; /* Last tick time. */ + sbintime_t nextevent; /* Next scheduled event on this CPU. */ + sbintime_t nexttick; /* Next timer tick time. */ + sbintime_t nexthard; /* Next hardlock() event. */ + sbintime_t nextstat; /* Next statclock() event. */ + sbintime_t nextprof; /* Next profclock() event. */ + sbintime_t nextcall; /* Next callout event. */ + sbintime_t nextcallopt; /* Next optional callout event. */ #ifdef KDTRACE_HOOKS - struct bintime nextcyc; /* Next OpenSolaris cyclics event. */ + sbintime_t nextcyc; /* Next OpenSolaris cyclics event. */ #endif int ipi; /* This CPU needs IPI. */ int idle; /* This CPU is in idle mode. */ }; static DPCPU_DEFINE(struct pcpu_state, timerstate); - -#define FREQ2BT(freq, bt) \ -{ \ - (bt)->sec = 0; \ - (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \ -} -#define BT2FREQ(bt) \ - (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \ - ((bt)->frac >> 1)) - -#define SBT2FREQ(sbt) ((SBT_1S + ((sbt) >> 1)) / (sbt)) +DPCPU_DEFINE(sbintime_t, hardclocktime); /* * Timer broadcast IPI handler. @@ -161,7 +144,7 @@ static DPCPU_DEFINE(struct pcpu_state, t int hardclockintr(void) { - struct bintime now; + sbintime_t now; struct pcpu_state *state; int done; @@ -169,10 +152,9 @@ hardclockintr(void) return (FILTER_HANDLED); state = DPCPU_PTR(timerstate); now = state->now; - CTR4(KTR_SPARE2, "ipi at %d: now %d.%08x%08x", - curcpu, now.sec, (u_int)(now.frac >> 32), - (u_int)(now.frac & 0xffffffff)); - done = handleevents(&now, 0); + CTR3(KTR_SPARE2, "ipi at %d: now %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); + done = handleevents(now, 0); return (done ? FILTER_HANDLED : FILTER_STRAY); } @@ -180,48 +162,43 @@ hardclockintr(void) * Handle all events for specified time on this CPU */ static int -handleevents(struct bintime *now, int fake) +handleevents(sbintime_t now, int fake) { - struct bintime t; + sbintime_t t, *hct; struct trapframe *frame; struct pcpu_state *state; - uintfptr_t pc; int usermode; int done, runs; - CTR4(KTR_SPARE2, "handle at %d: now %d.%08x%08x", - curcpu, now->sec, (u_int)(now->frac >> 32), - (u_int)(now->frac & 0xffffffff)); + CTR3(KTR_SPARE2, "handle at %d: now %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); done = 0; if (fake) { frame = NULL; usermode = 0; - pc = 0; } else { frame = curthread->td_intr_frame; usermode = TRAPF_USERMODE(frame); - pc = TRAPF_PC(frame); } state = DPCPU_PTR(timerstate); runs = 0; - while (bintime_cmp(now, &state->nexthard, >=)) { - bintime_addx(&state->nexthard, hardperiod.frac); + while (now >= state->nexthard) { + state->nexthard += tick_sbt; runs++; } if (runs) { - if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && - bintime_cmp(&state->nexthard, &nexthard, >)) - nexthard = state->nexthard; + hct = DPCPU_PTR(hardclocktime); + *hct = state->nexthard - tick_sbt; if (fake < 2) { hardclock_cnt(runs, usermode); done = 1; } } runs = 0; - while (bintime_cmp(now, &state->nextstat, >=)) { - bintime_addx(&state->nextstat, statperiod.frac); + while (now >= state->nextstat) { + state->nextstat += statperiod; runs++; } if (runs && fake < 2) { @@ -230,31 +207,29 @@ handleevents(struct bintime *now, int fa } if (profiling) { runs = 0; - while (bintime_cmp(now, &state->nextprof, >=)) { - bintime_addx(&state->nextprof, profperiod.frac); + while (now >= state->nextprof) { + state->nextprof += profperiod; runs++; } if (runs && !fake) { - profclock_cnt(runs, usermode, pc); + profclock_cnt(runs, usermode, TRAPF_PC(frame)); done = 1; } } else state->nextprof = state->nextstat; + if (now >= state->nextcallopt) { + state->nextcall = state->nextcallopt = INT64_MAX; + callout_process(now); + } #ifdef KDTRACE_HOOKS - if (fake == 0 && cyclic_clock_func != NULL && - state->nextcyc.sec != -1 && - bintime_cmp(now, &state->nextcyc, >=)) { - state->nextcyc.sec = -1; + if (fake == 0 && now >= state->nextcyc && cyclic_clock_func != NULL) { + state->nextcyc = INT64_MAX; (*cyclic_clock_func)(frame); } #endif - getnextcpuevent(&t, 0); - if (fake == 2) { - state->nextevent = t; - return (done); - } + t = getnextcpuevent(0); ET_HW_LOCK(state); if (!busy) { state->idle = 0; @@ -268,84 +243,81 @@ handleevents(struct bintime *now, int fa /* * Schedule binuptime of the next event on current CPU. */ -static void -getnextcpuevent(struct bintime *event, int idle) +static sbintime_t +getnextcpuevent(int idle) { - struct bintime tmp; + sbintime_t event; struct pcpu_state *state; - int skip; + u_int hardfreq; state = DPCPU_PTR(timerstate); - /* Handle hardclock() events. */ - *event = state->nexthard; - if (idle || (!activetick && !profiling && - (timer->et_flags & ET_FLAGS_PERCPU) == 0)) { - skip = idle ? 4 : (stathz / 2); - if (curcpu == CPU_FIRST() && tc_min_ticktock_freq > skip) - skip = tc_min_ticktock_freq; - skip = callout_tickstofirst(hz / skip) - 1; - CTR2(KTR_SPARE2, "skip at %d: %d", curcpu, skip); - tmp = hardperiod; - bintime_mul(&tmp, skip); - bintime_add(event, &tmp); - } + /* Handle hardclock() events, skipping some if CPU is idle. */ + event = state->nexthard; + if (idle) { + hardfreq = (u_int)hz / 2; + if (tc_min_ticktock_freq > 2 +#ifdef SMP + && curcpu == CPU_FIRST() +#endif + ) + hardfreq = hz / tc_min_ticktock_freq; + if (hardfreq > 1) + event += tick_sbt * (hardfreq - 1); + } + /* Handle callout events. */ + if (event > state->nextcall) + event = state->nextcall; if (!idle) { /* If CPU is active - handle other types of events. */ - if (bintime_cmp(event, &state->nextstat, >)) - *event = state->nextstat; - if (profiling && bintime_cmp(event, &state->nextprof, >)) - *event = state->nextprof; + if (event > state->nextstat) + event = state->nextstat; + if (profiling && event > state->nextprof) + event = state->nextprof; } #ifdef KDTRACE_HOOKS - if (state->nextcyc.sec != -1 && bintime_cmp(event, &state->nextcyc, >)) - *event = state->nextcyc; + if (event > state->nextcyc) + event = state->nextcyc; #endif + return (event); } /* * Schedule binuptime of the next event on all CPUs. */ -static void -getnextevent(struct bintime *event) +static sbintime_t +getnextevent(void) { struct pcpu_state *state; + sbintime_t event; #ifdef SMP int cpu; #endif - int c, nonidle; + int c; state = DPCPU_PTR(timerstate); - *event = state->nextevent; - c = curcpu; - nonidle = !state->idle; - if ((timer->et_flags & ET_FLAGS_PERCPU) == 0) { + event = state->nextevent; + c = -1; #ifdef SMP - if (smp_started) { - CPU_FOREACH(cpu) { - if (curcpu == cpu) - continue; - state = DPCPU_ID_PTR(cpu, timerstate); - nonidle += !state->idle; - if (bintime_cmp(event, &state->nextevent, >)) { - *event = state->nextevent; - c = cpu; - } + if ((timer->et_flags & ET_FLAGS_PERCPU) == 0) { + CPU_FOREACH(cpu) { + state = DPCPU_ID_PTR(cpu, timerstate); + if (event > state->nextevent) { + event = state->nextevent; + c = cpu; } } -#endif - if (nonidle != 0 && bintime_cmp(event, &nexthard, >)) - *event = nexthard; } - CTR5(KTR_SPARE2, "next at %d: next %d.%08x%08x by %d", - curcpu, event->sec, (u_int)(event->frac >> 32), - (u_int)(event->frac & 0xffffffff), c); +#endif + CTR4(KTR_SPARE2, "next at %d: next %d.%08x by %d", + curcpu, (int)(event >> 32), (u_int)(event & 0xffffffff), c); + return (event); } /* Hardware timer callback function. */ static void timercb(struct eventtimer *et, void *arg) { - struct bintime now; - struct bintime *next; + sbintime_t now; + sbintime_t *next; struct pcpu_state *state; #ifdef SMP int cpu, bcast; @@ -360,16 +332,14 @@ timercb(struct eventtimer *et, void *arg next = &state->nexttick; } else next = &nexttick; - binuptime(&now); - if (periodic) { - *next = now; - bintime_addx(next, timerperiod.frac); /* Next tick in 1 period. */ - } else - next->sec = -1; /* Next tick is not scheduled yet. */ + now = sbinuptime(); + if (periodic) + *next = now + timerperiod; + else + *next = -1; /* Next tick is not scheduled yet. */ state->now = now; - CTR4(KTR_SPARE2, "intr at %d: now %d.%08x%08x", - curcpu, (int)(now.sec), (u_int)(now.frac >> 32), - (u_int)(now.frac & 0xffffffff)); + CTR3(KTR_SPARE2, "intr at %d: now %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); #ifdef SMP /* Prepare broadcasting to other CPUs for non-per-CPU timers. */ @@ -379,8 +349,8 @@ timercb(struct eventtimer *et, void *arg state = DPCPU_ID_PTR(cpu, timerstate); ET_HW_LOCK(state); state->now = now; - if (bintime_cmp(&now, &state->nextevent, >=)) { - state->nextevent.sec++; + if (now >= state->nextevent) { + state->nextevent += SBT_1S; if (curcpu != cpu) { state->ipi = 1; bcast = 1; @@ -392,7 +362,7 @@ timercb(struct eventtimer *et, void *arg #endif /* Handle events for this time on this CPU. */ - handleevents(&now, 0); + handleevents(now, 0); #ifdef SMP /* Broadcast interrupt to other CPUs for non-per-CPU timers. */ @@ -414,11 +384,11 @@ timercb(struct eventtimer *et, void *arg * Load new value into hardware timer. */ static void -loadtimer(struct bintime *now, int start) +loadtimer(sbintime_t now, int start) { struct pcpu_state *state; - struct bintime new; - struct bintime *next; + sbintime_t new; + sbintime_t *next; uint64_t tmp; int eq; @@ -433,30 +403,24 @@ loadtimer(struct bintime *now, int start * Try to start all periodic timers aligned * to period to make events synchronous. */ - tmp = ((uint64_t)now->sec << 36) + (now->frac >> 28); - tmp = (tmp % (timerperiod.frac >> 28)) << 28; - new.sec = 0; - new.frac = timerperiod.frac - tmp; - if (new.frac < tmp) /* Left less then passed. */ - bintime_addx(&new, timerperiod.frac); + tmp = now % timerperiod; + new = timerperiod - tmp; + if (new < tmp) /* Left less then passed. */ + new += timerperiod; CTR5(KTR_SPARE2, "load p at %d: now %d.%08x first in %d.%08x", - curcpu, now->sec, (u_int)(now->frac >> 32), - new.sec, (u_int)(new.frac >> 32)); - *next = new; - bintime_add(next, now); - et_start(timer, bttosbt(new), bttosbt(timerperiod)); + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff), + (int)(new >> 32), (u_int)(new & 0xffffffff)); + *next = new + now; + et_start(timer, new, timerperiod); } } else { - getnextevent(&new); - eq = bintime_cmp(&new, next, ==); - CTR5(KTR_SPARE2, "load at %d: next %d.%08x%08x eq %d", - curcpu, new.sec, (u_int)(new.frac >> 32), - (u_int)(new.frac & 0xffffffff), - eq); + new = getnextevent(); + eq = (new == *next); + CTR4(KTR_SPARE2, "load at %d: next %d.%08x eq %d", + curcpu, (int)(new >> 32), (u_int)(new & 0xffffffff), eq); if (!eq) { *next = new; - bintime_sub(&new, now); - et_start(timer, bttosbt(new), 0); + et_start(timer, new - now, 0); } } } @@ -478,7 +442,7 @@ setuptimer(void) while (freq < (profiling ? profhz : stathz)) freq += hz; freq = round_freq(timer, freq); - FREQ2BT(freq, &timerperiod); + timerperiod = SBT_1S / freq; } /* @@ -487,15 +451,15 @@ setuptimer(void) static int doconfigtimer(void) { - struct bintime now; + sbintime_t now; struct pcpu_state *state; state = DPCPU_PTR(timerstate); switch (atomic_load_acq_int(&state->action)) { case 1: - binuptime(&now); + now = sbinuptime(); ET_HW_LOCK(state); - loadtimer(&now, 1); + loadtimer(now, 1); ET_HW_UNLOCK(state); state->handle = 0; atomic_store_rel_int(&state->action, 0); @@ -509,8 +473,8 @@ doconfigtimer(void) return (1); } if (atomic_readandclear_int(&state->handle) && !busy) { - binuptime(&now); - handleevents(&now, 0); + now = sbinuptime(); + handleevents(now, 0); return (1); } return (0); @@ -523,40 +487,45 @@ doconfigtimer(void) static void configtimer(int start) { - struct bintime now, next; + sbintime_t now, next; struct pcpu_state *state; int cpu; if (start) { setuptimer(); - binuptime(&now); - } + now = sbinuptime(); + } else + now = 0; critical_enter(); ET_HW_LOCK(DPCPU_PTR(timerstate)); if (start) { /* Initialize time machine parameters. */ - next = now; - bintime_addx(&next, timerperiod.frac); + next = now + timerperiod; if (periodic) nexttick = next; else - nexttick.sec = -1; + nexttick = -1; CPU_FOREACH(cpu) { state = DPCPU_ID_PTR(cpu, timerstate); state->now = now; - state->nextevent = next; + if (!smp_started && cpu != CPU_FIRST()) + state->nextevent = INT64_MAX; + else + state->nextevent = next; if (periodic) state->nexttick = next; else - state->nexttick.sec = -1; + state->nexttick = -1; state->nexthard = next; state->nextstat = next; state->nextprof = next; + state->nextcall = next; + state->nextcallopt = next; hardclock_sync(cpu); } busy = 0; /* Start global timer or per-CPU timer of this CPU. */ - loadtimer(&now, 1); + loadtimer(now, 1); } else { busy = 1; /* Stop global timer or per-CPU timer of this CPU. */ @@ -629,12 +598,11 @@ cpu_initclocks_bsp(void) state = DPCPU_ID_PTR(cpu, timerstate); mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN); #ifdef KDTRACE_HOOKS - state->nextcyc.sec = -1; + state->nextcyc = INT64_MAX; #endif + state->nextcall = INT64_MAX; + state->nextcallopt = INT64_MAX; } -#ifdef SMP - callout_new_inserted = cpu_new_callout; -#endif periodic = want_periodic; /* Grab requested timer or the best of present. */ if (timername[0]) @@ -698,9 +666,10 @@ cpu_initclocks_bsp(void) profhz = round_freq(timer, stathz * 64); } tick = 1000000 / hz; - FREQ2BT(hz, &hardperiod); - FREQ2BT(stathz, &statperiod); - FREQ2BT(profhz, &profperiod); + tick_sbt = SBT_1S / hz; + tick_bt = sbttobt(tick_sbt); + statperiod = SBT_1S / stathz; + profperiod = SBT_1S / profhz; ET_LOCK(); configtimer(1); ET_UNLOCK(); @@ -712,18 +681,22 @@ cpu_initclocks_bsp(void) void cpu_initclocks_ap(void) { - struct bintime now; + sbintime_t now; struct pcpu_state *state; + struct thread *td; state = DPCPU_PTR(timerstate); - binuptime(&now); + now = sbinuptime(); ET_HW_LOCK(state); state->now = now; hardclock_sync(curcpu); - handleevents(&state->now, 2); - if (timer->et_flags & ET_FLAGS_PERCPU) - loadtimer(&now, 1); + spinlock_enter(); ET_HW_UNLOCK(state); + td = curthread; + td->td_intr_nesting_level++; + handleevents(state->now, 2); + td->td_intr_nesting_level--; + spinlock_exit(); } /* @@ -772,7 +745,7 @@ cpu_stopprofclock(void) sbintime_t cpu_idleclock(void) { - struct bintime now, t; + sbintime_t now, t; struct pcpu_state *state; if (idletick || busy || @@ -786,19 +759,17 @@ cpu_idleclock(void) if (periodic) now = state->now; else - binuptime(&now); - CTR4(KTR_SPARE2, "idle at %d: now %d.%08x%08x", - curcpu, now.sec, (u_int)(now.frac >> 32), - (u_int)(now.frac & 0xffffffff)); - getnextcpuevent(&t, 1); + now = sbinuptime(); + CTR3(KTR_SPARE2, "idle at %d: now %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); + t = getnextcpuevent(1); ET_HW_LOCK(state); state->idle = 1; state->nextevent = t; if (!periodic) - loadtimer(&now, 0); + loadtimer(now, 0); ET_HW_UNLOCK(state); - bintime_sub(&t, &now); - return (MAX(bttosbt(t), 0)); + return (MAX(t - now, 0)); } /* @@ -807,7 +778,7 @@ cpu_idleclock(void) void cpu_activeclock(void) { - struct bintime now; + sbintime_t now; struct pcpu_state *state; struct thread *td; @@ -817,101 +788,98 @@ cpu_activeclock(void) if (periodic) now = state->now; else - binuptime(&now); - CTR4(KTR_SPARE2, "active at %d: now %d.%08x%08x", - curcpu, now.sec, (u_int)(now.frac >> 32), - (u_int)(now.frac & 0xffffffff)); + now = sbinuptime(); + CTR3(KTR_SPARE2, "active at %d: now %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff)); spinlock_enter(); td = curthread; td->td_intr_nesting_level++; - handleevents(&now, 1); + handleevents(now, 1); td->td_intr_nesting_level--; spinlock_exit(); } #ifdef KDTRACE_HOOKS void -clocksource_cyc_set(const struct bintime *t) +clocksource_cyc_set(const struct bintime *bt) { - struct bintime now; + sbintime_t now, t; struct pcpu_state *state; + /* Do not touch anything if somebody reconfiguring timers. */ + if (busy) + return; + t = bttosbt(*bt); state = DPCPU_PTR(timerstate); if (periodic) now = state->now; else - binuptime(&now); + now = sbinuptime(); - CTR4(KTR_SPARE2, "set_cyc at %d: now %d.%08x%08x", - curcpu, now.sec, (u_int)(now.frac >> 32), - (u_int)(now.frac & 0xffffffff)); - CTR4(KTR_SPARE2, "set_cyc at %d: t %d.%08x%08x", - curcpu, t->sec, (u_int)(t->frac >> 32), - (u_int)(t->frac & 0xffffffff)); + CTR5(KTR_SPARE2, "set_cyc at %d: now %d.%08x t %d.%08x", + curcpu, (int)(now >> 32), (u_int)(now & 0xffffffff), + (int)(t >> 32), (u_int)(t & 0xffffffff)); ET_HW_LOCK(state); - if (bintime_cmp(t, &state->nextcyc, ==)) { - ET_HW_UNLOCK(state); - return; - } - state->nextcyc = *t; - if (bintime_cmp(&state->nextcyc, &state->nextevent, >=)) { - ET_HW_UNLOCK(state); - return; - } - state->nextevent = state->nextcyc; + if (t == state->nextcyc) + goto done; + state->nextcyc = t; + if (t >= state->nextevent) + goto done; + state->nextevent = t; if (!periodic) - loadtimer(&now, 0); + loadtimer(now, 0); +done: ET_HW_UNLOCK(state); } #endif -#ifdef SMP -static void -cpu_new_callout(int cpu, int ticks) +void +cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt) { - struct bintime tmp; struct pcpu_state *state; - CTR3(KTR_SPARE2, "new co at %d: on %d in %d", - curcpu, cpu, ticks); + /* Do not touch anything if somebody reconfiguring timers. */ + if (busy) + return; + CTR6(KTR_SPARE2, "new co at %d: on %d at %d.%08x - %d.%08x", + curcpu, cpu, (int)(bt_opt >> 32), (u_int)(bt_opt & 0xffffffff), + (int)(bt >> 32), (u_int)(bt & 0xffffffff)); state = DPCPU_ID_PTR(cpu, timerstate); ET_HW_LOCK(state); - if (state->idle == 0 || busy) { - ET_HW_UNLOCK(state); - return; - } + /* - * If timer is periodic - just update next event time for target CPU. - * If timer is global - there is chance it is already programmed. + * If there is callout time already set earlier -- do nothing. + * This check may appear redundant because we check already in + * callout_process() but this double check guarantees we're safe + * with respect to race conditions between interrupts execution + * and scheduling. */ - if (periodic || (timer->et_flags & ET_FLAGS_PERCPU) == 0) { - tmp = hardperiod; - bintime_mul(&tmp, ticks - 1); - bintime_add(&tmp, &state->nexthard); - if (bintime_cmp(&tmp, &state->nextevent, <)) - state->nextevent = tmp; - if (periodic || - bintime_cmp(&state->nextevent, &nexttick, >=)) { - ET_HW_UNLOCK(state); - return; - } + state->nextcallopt = bt_opt; + if (bt >= state->nextcall) + goto done; + state->nextcall = bt; + /* If there is some other event set earlier -- do nothing. */ + if (bt >= state->nextevent) + goto done; + state->nextevent = bt; + /* If timer is periodic -- there is nothing to reprogram. */ + if (periodic) + goto done; + /* If timer is global or of the current CPU -- reprogram it. */ + if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 || cpu == curcpu) { + loadtimer(sbinuptime(), 0); +done: + ET_HW_UNLOCK(state); + return; } - /* - * Otherwise we have to wake that CPU up, as we can't get present - * bintime to reprogram global timer from here. If timer is per-CPU, - * we by definition can't do it from here. - */ + /* Otherwise make other CPU to reprogram it. */ + state->handle = 1; ET_HW_UNLOCK(state); - if (timer->et_flags & ET_FLAGS_PERCPU) { - state->handle = 1; - ipi_cpu(cpu, IPI_HARDCLOCK); - } else { - if (!cpu_idle_wakeup(cpu)) - ipi_cpu(cpu, IPI_AST); - } -} +#ifdef SMP + ipi_cpu(cpu, IPI_HARDCLOCK); #endif +} /* * Report or change the active event timers hardware. Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/kern/kern_tc.c Mon Mar 4 11:09:56 2013 (r247777) @@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef FFCLOCK #include #include @@ -119,6 +120,21 @@ static int timestepwarnings; SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW, ×tepwarnings, 0, "Log time steps"); +struct bintime bt_timethreshold; +struct bintime bt_tickthreshold; +sbintime_t sbt_timethreshold; +sbintime_t sbt_tickthreshold; +struct bintime tc_tick_bt; +sbintime_t tc_tick_sbt; +int tc_precexp; +int tc_timepercentage = TC_DEFAULTPERC; +TUNABLE_INT("kern.timecounter.alloweddeviation", &tc_timepercentage); +static int sysctl_kern_timecounter_adjprecision(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_kern_timecounter, OID_AUTO, alloweddeviation, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, + sysctl_kern_timecounter_adjprecision, "I", + "Allowed time interval deviation in percents"); + static void tc_windup(void); static void cpu_tick_calibrate(int); @@ -1746,10 +1762,47 @@ tc_ticktock(int cnt) tc_windup(); } +static void __inline +tc_adjprecision(void) +{ + int t; + + if (tc_timepercentage > 0) { + t = (99 + tc_timepercentage) / tc_timepercentage; + tc_precexp = fls(t + (t >> 1)) - 1; + FREQ2BT(hz / tc_tick, &bt_timethreshold); + FREQ2BT(hz, &bt_tickthreshold); + bintime_shift(&bt_timethreshold, tc_precexp); + bintime_shift(&bt_tickthreshold, tc_precexp); + } else { + tc_precexp = 31; + bt_timethreshold.sec = INT_MAX; + bt_timethreshold.frac = ~(uint64_t)0; + bt_tickthreshold = bt_timethreshold; + } + sbt_timethreshold = bttosbt(bt_timethreshold); + sbt_tickthreshold = bttosbt(bt_tickthreshold); +} + +static int +sysctl_kern_timecounter_adjprecision(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = tc_timepercentage; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + tc_timepercentage = val; + tc_adjprecision(); + return (0); +} + static void inittimecounter(void *dummy) { u_int p; + int tick_rate; /* * Set the initial timeout to @@ -1763,6 +1816,12 @@ inittimecounter(void *dummy) tc_tick = (hz + 500) / 1000; else tc_tick = 1; + tc_adjprecision(); + FREQ2BT(hz, &tick_bt); + tick_sbt = bttosbt(tick_bt); + tick_rate = hz / tc_tick; + FREQ2BT(tick_rate, &tc_tick_bt); + tc_tick_sbt = bttosbt(tc_tick_bt); p = (tc_tick * 1000000) / hz; printf("Timecounters tick every %d.%03u msec\n", p / 1000, p % 1000); Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Mar 4 10:41:54 2013 (r247776) +++ head/sys/kern/kern_timeout.c Mon Mar 4 11:09:56 2013 (r247777) @@ -37,7 +37,11 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_callout_profiling.h" #include "opt_kdtrace.h" +#if defined(__arm__) +#include "opt_timer.h" +#endif #include #include @@ -59,6 +63,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifndef NO_EVENTTIMERS +DPCPU_DECLARE(sbintime_t, hardclocktime); +#endif + SDT_PROVIDER_DEFINE(callout_execute); SDT_PROBE_DEFINE(callout_execute, kernel, , callout_start, callout-start); SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_start, 0, @@ -67,6 +75,7 @@ SDT_PROBE_DEFINE(callout_execute, kernel SDT_PROBE_ARGTYPE(callout_execute, kernel, , callout_end, 0, "struct callout *"); +#ifdef CALLOUT_PROFILING static int avg_depth; SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:22:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7E226FA6; Mon, 4 Mar 2013 11:22:20 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4F35110F5; Mon, 4 Mar 2013 11:22:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BMK25027580; Mon, 4 Mar 2013 11:22:20 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BMJSu027575; Mon, 4 Mar 2013 11:22:19 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041122.r24BMJSu027575@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 11:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247778 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:22:20 -0000 Author: davide Date: Mon Mar 4 11:22:19 2013 New Revision: 247778 URL: http://svnweb.freebsd.org/changeset/base/247778 Log: MFcalloutng (r244355): Make loadavg calculation callout direct. There are several reasons for it: - it is very simple and doesn't worth context switch to SWI; - since SWI is no longer used here, we can remove twelve years old hack, excluding this SWI from from the loadavg statistics; - it fixes problem when eventtimer (HPET) shares interrupt with some other device, and that interrupt thread counted as permanent loadavg of 1; now loadavg accounted before that interrupt thread is scheduled. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, Fabian Keil, markj Modified: head/sys/kern/kern_intr.c head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Mon Mar 4 11:09:56 2013 (r247777) +++ head/sys/kern/kern_intr.c Mon Mar 4 11:22:19 2013 (r247778) @@ -1103,7 +1103,6 @@ int swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep) { - struct thread *td; struct intr_event *ie; int error; @@ -1125,15 +1124,7 @@ swi_add(struct intr_event **eventp, cons } error = intr_event_add_handler(ie, name, NULL, handler, arg, PI_SWI(pri), flags, cookiep); - if (error) - return (error); - if (pri == SWI_CLOCK) { - td = ie->ie_thread->it_thread; - thread_lock(td); - td->td_flags |= TDF_NOLOAD; - thread_unlock(td); - } - return (0); + return (error); } /* Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Mon Mar 4 11:09:56 2013 (r247777) +++ head/sys/kern/kern_synch.c Mon Mar 4 11:22:19 2013 (r247778) @@ -560,8 +560,9 @@ loadav(void *arg) * random variation to avoid synchronisation with processes that * run at regular intervals. */ - callout_reset(&loadav_callout, hz * 4 + (int)(random() % (hz * 2 + 1)), - loadav, NULL); + callout_reset_sbt(&loadav_callout, + tick_sbt * (hz * 4 + (int)(random() % (hz * 2 + 1))), 0, + loadav, NULL, C_DIRECT_EXEC | C_HARDCLOCK); } /* ARGSUSED */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:27:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A46220E; Mon, 4 Mar 2013 11:27:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D82EB112F; Mon, 4 Mar 2013 11:27:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BRgiU028301; Mon, 4 Mar 2013 11:27:42 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BRfdZ028293; Mon, 4 Mar 2013 11:27:41 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303041127.r24BRfdZ028293@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 4 Mar 2013 11:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247779 - in head: contrib/libyaml lib lib/libyaml share/mk tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:27:43 -0000 Author: bapt Date: Mon Mar 4 11:27:41 2013 New Revision: 247779 URL: http://svnweb.freebsd.org/changeset/base/247779 Log: Import libyaml as libbsdyml (private brand name) LibYAML is a YAML 1.1 parser and emitter under MIT license which will soon be used by the pkg boostrap (usr.bin/pkg) and bhyve Reviewed by: roberto, antoine Added: head/contrib/libyaml/ - copied from r247775, vendor/libyaml/dist/ head/lib/libyaml/ head/lib/libyaml/Makefile (contents, props changed) head/lib/libyaml/config.h (contents, props changed) Modified: head/lib/Makefile head/share/mk/bsd.libnames.mk head/tools/make_libdeps.sh Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Mar 4 11:22:19 2013 (r247778) +++ head/lib/Makefile Mon Mar 4 11:27:41 2013 (r247779) @@ -119,6 +119,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libvmmapi} \ libwrap \ liby \ + libyaml \ libz \ ${_atf} \ ${_bind} \ Added: head/lib/libyaml/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libyaml/Makefile Mon Mar 4 11:27:41 2013 (r247779) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +LIBYAML= ${.CURDIR}/../../contrib/libyaml + +LIB= bsdyml +SHLIB_MAJOR= 0 +INCS= bsdyml.h +SRCS= api.c dumper.c emitter.c loader.c \ + parser.c reader.c scanner.c writer.c + +.PATH: ${LIBYAML}/src ${LIBYAML}/include +CLEANFILES= bsdyml.h + +WARNS?= 1 +CFLAGS+= -I${LIBYAML}/include \ + -I${LIBYAML} \ + -I${.CURDIR} \ + -DHAVE_CONFIG_H + +bsdyml.h: yaml.h + cp -f ${.ALLSRC} ${.TARGET} + +.include Added: head/lib/libyaml/config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libyaml/config.h Mon Mar 4 11:27:41 2013 (r247779) @@ -0,0 +1,83 @@ +/* $FreeBSD$ */ + +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "yaml" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "yaml" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "yaml 0.1.4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "yaml" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1.4" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1.4" + +/* Define the major version number. */ +#define YAML_VERSION_MAJOR 0 + +/* Define the minor version number. */ +#define YAML_VERSION_MINOR 1 + +/* Define the patch version number. */ +#define YAML_VERSION_PATCH 4 + +/* Define the version string. */ +#define YAML_VERSION_STRING "0.1.4" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ Modified: head/share/mk/bsd.libnames.mk ============================================================================== --- head/share/mk/bsd.libnames.mk Mon Mar 4 11:22:19 2013 (r247778) +++ head/share/mk/bsd.libnames.mk Mon Mar 4 11:27:41 2013 (r247779) @@ -25,6 +25,7 @@ LIBBIND9?= ${DESTDIR}${LIBDIR}/libbind9. .endif LIBBLUETOOTH?= ${DESTDIR}${LIBDIR}/libbluetooth.a LIBBSDXML?= ${DESTDIR}${LIBDIR}/libbsdxml.a +LIBBSDYML?= ${DESTDIR}${LIBDIR}/libbsdyml.a LIBBSM?= ${DESTDIR}${LIBDIR}/libbsm.a LIBBSNMP?= ${DESTDIR}${LIBDIR}/libbsnmp.a LIBBZ2?= ${DESTDIR}${LIBDIR}/libbz2.a Modified: head/tools/make_libdeps.sh ============================================================================== --- head/tools/make_libdeps.sh Mon Mar 4 11:22:19 2013 (r247778) +++ head/tools/make_libdeps.sh Mon Mar 4 11:27:41 2013 (r247779) @@ -47,6 +47,7 @@ sed -E -e's; ;! ;g' -e's;$;!;' -e's;-lbsdxml!;lib/libexpat;g' + -e's;-lbsdyml!;lib/libyaml;g' -e's;-lpthread!;lib/libthr;g' -e's;-lm!;lib/msun;g' -e's;-l(ncurses|termcap)!;lib/ncurses/ncurses;g' From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:34:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7D4494C3; Mon, 4 Mar 2013 11:34:32 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5A61E1194; Mon, 4 Mar 2013 11:34:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BYWTq030846; Mon, 4 Mar 2013 11:34:32 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BYW5K030845; Mon, 4 Mar 2013 11:34:32 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201303041134.r24BYW5K030845@svn.freebsd.org> From: Devin Teske Date: Mon, 4 Mar 2013 11:34:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247780 - head/usr.sbin/tzsetup X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:34:32 -0000 Author: dteske Date: Mon Mar 4 11:34:31 2013 New Revision: 247780 URL: http://svnweb.freebsd.org/changeset/base/247780 Log: Fix VERBOSE reporting on results when removing _PATH_LOCALTIME for UTC option. PR: bin/164976 Submitted by: dteske Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:27:41 2013 (r247779) +++ head/usr.sbin/tzsetup/tzsetup.c Mon Mar 4 11:34:31 2013 (r247780) @@ -703,8 +703,13 @@ install_zoneinfo_file(const char *zonein return (DITEM_FAILURE | DITEM_RECREATE); } #ifdef VERBOSE + snprintf(title, sizeof(title), "Done"); snprintf(prompt, sizeof(prompt), "Removed %s", path_localtime); + if (usedialog) + dialog_msgbox(title, prompt, 8, 72, 1); + else + fprintf(stderr, "%s\n", prompt); #endif return (DITEM_LEAVE_MENU); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:51:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5FDFCEE5; Mon, 4 Mar 2013 11:51:47 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 300C112B7; Mon, 4 Mar 2013 11:51:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BplIM036415; Mon, 4 Mar 2013 11:51:47 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BpkrJ036413; Mon, 4 Mar 2013 11:51:46 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041151.r24BpkrJ036413@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 11:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247783 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:51:47 -0000 Author: davide Date: Mon Mar 4 11:51:46 2013 New Revision: 247783 URL: http://svnweb.freebsd.org/changeset/base/247783 Log: MFcalloutng: Convert sleepqueue(9) bits to the new callout KPI. Take advantage of the possibility to run callback directly from hw interrupt context. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/subr_sleepqueue.c head/sys/sys/sleepqueue.h Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Mon Mar 4 11:43:20 2013 (r247782) +++ head/sys/kern/subr_sleepqueue.c Mon Mar 4 11:51:46 2013 (r247783) @@ -361,7 +361,8 @@ sleepq_add(void *wchan, struct lock_obje * sleep queue after timo ticks if the thread has not already been awakened. */ void -sleepq_set_timeout(void *wchan, int timo) +sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr, + int flags) { struct sleepqueue_chain *sc; struct thread *td; @@ -372,7 +373,8 @@ sleepq_set_timeout(void *wchan, int timo MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td); + callout_reset_sbt_on(&td->td_slpcallout, sbt, pr, + sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC); } /* Modified: head/sys/sys/sleepqueue.h ============================================================================== --- head/sys/sys/sleepqueue.h Mon Mar 4 11:43:20 2013 (r247782) +++ head/sys/sys/sleepqueue.h Mon Mar 4 11:51:46 2013 (r247783) @@ -108,7 +108,10 @@ struct sleepqueue *sleepq_lookup(void *w void sleepq_release(void *wchan); void sleepq_remove(struct thread *td, void *wchan); int sleepq_signal(void *wchan, int flags, int pri, int queue); -void sleepq_set_timeout(void *wchan, int timo); +void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, + sbintime_t pr, int flags); +#define sleepq_set_timeout(wchan, timo) \ + sleepq_set_timeout_sbt((wchan), (tick_sbt * (timo)), 0, C_HARDCLOCK) u_int sleepq_sleepcnt(void *wchan, int queue); int sleepq_timedwait(void *wchan, int pri); int sleepq_timedwait_sig(void *wchan, int pri); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 11:55:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A38B8120; Mon, 4 Mar 2013 11:55:32 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB9F12D2; Mon, 4 Mar 2013 11:55:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24BtWnY036982; Mon, 4 Mar 2013 11:55:32 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24BtWF9036981; Mon, 4 Mar 2013 11:55:32 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041155.r24BtWF9036981@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 11:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247784 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 11:55:32 -0000 Author: davide Date: Mon Mar 4 11:55:32 2013 New Revision: 247784 URL: http://svnweb.freebsd.org/changeset/base/247784 Log: Style fix: remove useless braces. Sorry, my bad. Submitted by: bde Modified: head/sys/sys/sleepqueue.h Modified: head/sys/sys/sleepqueue.h ============================================================================== --- head/sys/sys/sleepqueue.h Mon Mar 4 11:51:46 2013 (r247783) +++ head/sys/sys/sleepqueue.h Mon Mar 4 11:55:32 2013 (r247784) @@ -111,7 +111,7 @@ int sleepq_signal(void *wchan, int flags void sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr, int flags); #define sleepq_set_timeout(wchan, timo) \ - sleepq_set_timeout_sbt((wchan), (tick_sbt * (timo)), 0, C_HARDCLOCK) + sleepq_set_timeout_sbt((wchan), tick_sbt * (timo), 0, C_HARDCLOCK) u_int sleepq_sleepcnt(void *wchan, int queue); int sleepq_timedwait(void *wchan, int pri); int sleepq_timedwait_sig(void *wchan, int pri); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 12:20:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BF373A29; Mon, 4 Mar 2013 12:20:49 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B242315B3; Mon, 4 Mar 2013 12:20:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24CKn29044636; Mon, 4 Mar 2013 12:20:49 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24CKn1G044424; Mon, 4 Mar 2013 12:20:49 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041220.r24CKn1G044424@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 12:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247785 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 12:20:49 -0000 Author: davide Date: Mon Mar 4 12:20:48 2013 New Revision: 247785 URL: http://svnweb.freebsd.org/changeset/base/247785 Log: MFcalloutng: Extend condvar(9) KPI introducing sbt variant of cv_timedwait. This rely on the previously committed sleepq_set_timeout_sbt(). Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/kern_condvar.c head/sys/sys/condvar.h Modified: head/sys/kern/kern_condvar.c ============================================================================== --- head/sys/kern/kern_condvar.c Mon Mar 4 11:55:32 2013 (r247784) +++ head/sys/kern/kern_condvar.c Mon Mar 4 12:20:48 2013 (r247785) @@ -270,12 +270,13 @@ _cv_wait_sig(struct cv *cvp, struct lock } /* - * Wait on a condition variable for at most timo/hz seconds. Returns 0 if the - * process was resumed by cv_signal or cv_broadcast, EWOULDBLOCK if the timeout - * expires. + * Wait on a condition variable for (at most) the value specified in sbt + * argument. Returns 0 if the process was resumed by cv_signal or cv_broadcast, + * EWOULDBLOCK if the timeout expires. */ int -_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo) +_cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, sbintime_t sbt, + sbintime_t pr, int flags) { WITNESS_SAVE_DECL(lock_witness); struct lock_class *class; @@ -311,7 +312,7 @@ _cv_timedwait(struct cv *cvp, struct loc DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0); - sleepq_set_timeout(cvp, timo); + sleepq_set_timeout_sbt(cvp, sbt, pr, flags); if (lock != &Giant.lock_object) { if (class->lc_flags & LC_SLEEPABLE) sleepq_release(cvp); @@ -336,13 +337,15 @@ _cv_timedwait(struct cv *cvp, struct loc } /* - * Wait on a condition variable for at most timo/hz seconds, allowing - * interruption by signals. Returns 0 if the thread was resumed by cv_signal - * or cv_broadcast, EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if - * a signal was caught. + * Wait on a condition variable for (at most) the value specified in sbt + * argument, allowing interruption by signals. + * Returns 0 if the thread was resumed by cv_signal or cv_broadcast, + * EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if a signal + * was caught. */ int -_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo) +_cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, + sbintime_t sbt, sbintime_t pr, int flags) { WITNESS_SAVE_DECL(lock_witness); struct lock_class *class; @@ -379,7 +382,7 @@ _cv_timedwait_sig(struct cv *cvp, struct sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR | SLEEPQ_INTERRUPTIBLE, 0); - sleepq_set_timeout(cvp, timo); + sleepq_set_timeout_sbt(cvp, sbt, pr, flags); if (lock != &Giant.lock_object) { if (class->lc_flags & LC_SLEEPABLE) sleepq_release(cvp); Modified: head/sys/sys/condvar.h ============================================================================== --- head/sys/sys/condvar.h Mon Mar 4 11:55:32 2013 (r247784) +++ head/sys/sys/condvar.h Mon Mar 4 12:20:48 2013 (r247785) @@ -55,8 +55,10 @@ void cv_destroy(struct cv *cvp); void _cv_wait(struct cv *cvp, struct lock_object *lock); void _cv_wait_unlock(struct cv *cvp, struct lock_object *lock); int _cv_wait_sig(struct cv *cvp, struct lock_object *lock); -int _cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo); -int _cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo); +int _cv_timedwait_sbt(struct cv *cvp, struct lock_object *lock, + sbintime_t sbt, sbintime_t pr, int flags); +int _cv_timedwait_sig_sbt(struct cv *cvp, struct lock_object *lock, + sbintime_t sbt, sbintime_t pr, int flags); void cv_signal(struct cv *cvp); void cv_broadcastpri(struct cv *cvp, int pri); @@ -68,9 +70,15 @@ void cv_broadcastpri(struct cv *cvp, int #define cv_wait_sig(cvp, lock) \ _cv_wait_sig((cvp), &(lock)->lock_object) #define cv_timedwait(cvp, lock, timo) \ - _cv_timedwait((cvp), &(lock)->lock_object, (timo)) + _cv_timedwait_sbt((cvp), &(lock)->lock_object, \ + tick_sbt * (timo), 0, C_HARDCLOCK) +#define cv_timedwait_sbt(cvp, lock, sbt, pr, flags) \ + _cv_timedwait_sbt((cvp), &(lock)->lock_object, (sbt), (pr), (flags)) #define cv_timedwait_sig(cvp, lock, timo) \ - _cv_timedwait_sig((cvp), &(lock)->lock_object, (timo)) + _cv_timedwait_sig_sbt((cvp), &(lock)->lock_object, \ + tick_sbt * (timo), 0, C_HARDCLOCK) +#define cv_timedwait_sig_sbt(cvp, lock, sbt, pr, flags) \ + _cv_timedwait_sig_sbt((cvp), &(lock)->lock_object, (sbt), (pr), (flags)) #define cv_broadcast(cvp) cv_broadcastpri(cvp, 0) From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 12:48:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6C5EF16B; Mon, 4 Mar 2013 12:48:43 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5085B16B0; Mon, 4 Mar 2013 12:48:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24CmhRI052625; Mon, 4 Mar 2013 12:48:43 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24Cmg2Q052617; Mon, 4 Mar 2013 12:48:42 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041248.r24Cmg2Q052617@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 12:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247787 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 12:48:43 -0000 Author: davide Date: Mon Mar 4 12:48:41 2013 New Revision: 247787 URL: http://svnweb.freebsd.org/changeset/base/247787 Log: MFcalloutng: Introduce sbt variants of msleep(), msleep_spin(), pause(), tsleep() in the KPI, allowing to specify timeout in 'sbintime_t' rather than ticks. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/kern_synch.c head/sys/sys/mutex.h head/sys/sys/rwlock.h head/sys/sys/sx.h head/sys/sys/systm.h Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Mon Mar 4 12:33:40 2013 (r247786) +++ head/sys/kern/kern_synch.c Mon Mar 4 12:48:41 2013 (r247787) @@ -146,12 +146,12 @@ sleepinit(void) */ int _sleep(void *ident, struct lock_object *lock, int priority, - const char *wmesg, int timo) + const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; struct proc *p; struct lock_class *class; - int catch, flags, lock_state, pri, rval; + int catch, lock_state, pri, rval, sleepq_flags; WITNESS_SAVE_DECL(lock_witness); td = curthread; @@ -162,7 +162,7 @@ _sleep(void *ident, struct lock_object * #endif WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, "Sleeping on \"%s\"", wmesg); - KASSERT(timo != 0 || mtx_owned(&Giant) || lock != NULL, + KASSERT(sbt != 0 || mtx_owned(&Giant) || lock != NULL, ("sleeping without a lock")); KASSERT(p != NULL, ("msleep1")); KASSERT(ident != NULL && TD_IS_RUNNING(td), ("msleep")); @@ -199,13 +199,13 @@ _sleep(void *ident, struct lock_object * sleepq_remove(td, td->td_wchan); if (ident == &pause_wchan) - flags = SLEEPQ_PAUSE; + sleepq_flags = SLEEPQ_PAUSE; else - flags = SLEEPQ_SLEEP; + sleepq_flags = SLEEPQ_SLEEP; if (catch) - flags |= SLEEPQ_INTERRUPTIBLE; + sleepq_flags |= SLEEPQ_INTERRUPTIBLE; if (priority & PBDRY) - flags |= SLEEPQ_STOP_ON_BDRY; + sleepq_flags |= SLEEPQ_STOP_ON_BDRY; sleepq_lock(ident); CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)", @@ -231,18 +231,18 @@ _sleep(void *ident, struct lock_object * * stopped, then td will no longer be on a sleep queue upon * return from cursig(). */ - sleepq_add(ident, lock, wmesg, flags, 0); - if (timo) - sleepq_set_timeout(ident, timo); + sleepq_add(ident, lock, wmesg, sleepq_flags, 0); + if (sbt != 0) + sleepq_set_timeout_sbt(ident, sbt, pr, flags); if (lock != NULL && class->lc_flags & LC_SLEEPABLE) { sleepq_release(ident); WITNESS_SAVE(lock, lock_witness); lock_state = class->lc_unlock(lock); sleepq_lock(ident); } - if (timo && catch) + if (sbt != 0 && catch) rval = sleepq_timedwait_sig(ident, pri); - else if (timo) + else if (sbt != 0) rval = sleepq_timedwait(ident, pri); else if (catch) rval = sleepq_wait_sig(ident, pri); @@ -263,7 +263,8 @@ _sleep(void *ident, struct lock_object * } int -msleep_spin(void *ident, struct mtx *mtx, const char *wmesg, int timo) +msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg, + sbintime_t sbt, sbintime_t pr, int flags) { struct thread *td; struct proc *p; @@ -301,8 +302,8 @@ msleep_spin(void *ident, struct mtx *mtx * We put ourselves on the sleep queue and start our timeout. */ sleepq_add(ident, &mtx->lock_object, wmesg, SLEEPQ_SLEEP, 0); - if (timo) - sleepq_set_timeout(ident, timo); + if (sbt != 0) + sleepq_set_timeout_sbt(ident, sbt, pr, flags); /* * Can't call ktrace with any spin locks held so it can lock the @@ -324,7 +325,7 @@ msleep_spin(void *ident, struct mtx *mtx wmesg); sleepq_lock(ident); #endif - if (timo) + if (sbt != 0) rval = sleepq_timedwait(ident, 0); else { sleepq_wait(ident, 0); @@ -348,28 +349,30 @@ msleep_spin(void *ident, struct mtx *mtx * to a "timo" value of one. */ int -pause(const char *wmesg, int timo) +pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { - KASSERT(timo >= 0, ("pause: timo must be >= 0")); + int sbt_sec; + + sbt_sec = sbintime_getsec(sbt); + KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0")); /* silently convert invalid timeouts */ - if (timo < 1) - timo = 1; + if (sbt == 0) + sbt = tick_sbt; if (cold) { /* - * We delay one HZ at a time to avoid overflowing the + * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): */ - while (timo >= hz) { + while (sbt_sec > 0) { DELAY(1000000); - timo -= hz; + sbt_sec--; } - if (timo > 0) - DELAY(timo * tick); + DELAY((sbt & 0xffffffff) / SBT_1US); return (0); } - return (tsleep(&pause_wchan, 0, wmesg, timo)); + return (_sleep(&pause_wchan, NULL, 0, wmesg, sbt, pr, flags)); } /* Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Mon Mar 4 12:33:40 2013 (r247786) +++ head/sys/sys/mutex.h Mon Mar 4 12:48:41 2013 (r247787) @@ -376,7 +376,8 @@ extern struct mtx_pool *mtxpool_sleep; mtx_assert_((m), (what), __FILE__, __LINE__) #define mtx_sleep(chan, mtx, pri, wmesg, timo) \ - _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo)) + _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ + tick_sbt * (timo), 0, C_HARDCLOCK) #define mtx_initialized(m) lock_initalized(&(m)->lock_object) Modified: head/sys/sys/rwlock.h ============================================================================== --- head/sys/sys/rwlock.h Mon Mar 4 12:33:40 2013 (r247786) +++ head/sys/sys/rwlock.h Mon Mar 4 12:48:41 2013 (r247787) @@ -211,7 +211,8 @@ void __rw_assert(const volatile uintptr_ rw_runlock(rw); \ } while (0) #define rw_sleep(chan, rw, pri, wmesg, timo) \ - _sleep((chan), &(rw)->lock_object, (pri), (wmesg), (timo)) + _sleep((chan), &(rw)->lock_object, (pri), (wmesg), \ + tick_sbt * (timo), 0, C_HARDCLOCK) #define rw_initialized(rw) lock_initalized(&(rw)->lock_object) Modified: head/sys/sys/sx.h ============================================================================== --- head/sys/sys/sx.h Mon Mar 4 12:33:40 2013 (r247786) +++ head/sys/sys/sx.h Mon Mar 4 12:48:41 2013 (r247787) @@ -275,7 +275,8 @@ __sx_sunlock(struct sx *sx, const char * #define sx_unlock(sx) sx_unlock_((sx), LOCK_FILE, LOCK_LINE) #define sx_sleep(chan, sx, pri, wmesg, timo) \ - _sleep((chan), &(sx)->lock_object, (pri), (wmesg), (timo)) + _sleep((chan), &(sx)->lock_object, (pri), (wmesg), \ + tick_sbt * (timo), 0, C_HARDCLOCK) /* * Options passed to sx_init_flags(). Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Mar 4 12:33:40 2013 (r247786) +++ head/sys/sys/systm.h Mon Mar 4 12:48:41 2013 (r247787) @@ -340,14 +340,27 @@ static __inline void splx(intrmask_t ip * less often. */ int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg, - int timo) __nonnull(1); + sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); #define msleep(chan, mtx, pri, wmesg, timo) \ - _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo)) -int msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo) - __nonnull(1); -int pause(const char *wmesg, int timo); + _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ + tick_sbt * (timo), 0, C_HARDCLOCK) +#define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ + _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ + (flags)) +int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg, + sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); +#define msleep_spin(chan, mtx, wmesg, timo) \ + msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ + 0, C_HARDCLOCK) +int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, + int flags); +#define pause(wmesg, timo) \ + pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK) #define tsleep(chan, pri, wmesg, timo) \ - _sleep((chan), NULL, (pri), (wmesg), (timo)) + _sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \ + 0, C_HARDCLOCK) +#define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ + _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) void wakeup(void *chan) __nonnull(1); void wakeup_one(void *chan) __nonnull(1); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 13:11:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1C1826B6; Mon, 4 Mar 2013 13:11:00 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E57121798; Mon, 4 Mar 2013 13:10:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24DAxD7061142; Mon, 4 Mar 2013 13:10:59 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24DAxau061141; Mon, 4 Mar 2013 13:10:59 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303041310.r24DAxau061141@svn.freebsd.org> From: Attilio Rao Date: Mon, 4 Mar 2013 13:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247788 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 13:11:00 -0000 Author: attilio Date: Mon Mar 4 13:10:59 2013 New Revision: 247788 URL: http://svnweb.freebsd.org/changeset/base/247788 Log: Merge from vmcontention: As vm objects are type-stable there is no need to initialize the resident splay tree pointer and the cache splay tree pointer in _vm_object_allocate() but this could be done in the init UMA zone handler. The destructor UMA zone handler, will further check if the condition is retained at every destruction and catch for bugs. Sponsored by: EMC / Isilon storage division Submitted by: alc Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Mar 4 12:48:41 2013 (r247787) +++ head/sys/vm/vm_object.c Mon Mar 4 13:10:59 2013 (r247788) @@ -165,8 +165,9 @@ vm_object_zdtor(void *mem, int size, voi object = (vm_object_t)mem; KASSERT(TAILQ_EMPTY(&object->memq), - ("object %p has resident pages", - object)); + ("object %p has resident pages in its memq", object)); + KASSERT(object->root == NULL, + ("object %p has resident pages in its tree", object)); #if VM_NRESERVLEVEL > 0 KASSERT(LIST_EMPTY(&object->rvq), ("object %p has reservations", @@ -197,9 +198,11 @@ vm_object_zinit(void *mem, int size, int mtx_init(&object->mtx, "vm object", NULL, MTX_DEF | MTX_DUPOK); /* These are true for any object that has been freed */ + object->root = NULL; object->paging_in_progress = 0; object->resident_page_count = 0; object->shadow_count = 0; + object->cache = NULL; return (0); } @@ -210,7 +213,6 @@ _vm_object_allocate(objtype_t type, vm_p TAILQ_INIT(&object->memq); LIST_INIT(&object->shadow_head); - object->root = NULL; object->type = type; switch (type) { case OBJT_DEAD: @@ -247,7 +249,6 @@ _vm_object_allocate(objtype_t type, vm_p #if VM_NRESERVLEVEL > 0 LIST_INIT(&object->rvq); #endif - object->cache = NULL; mtx_lock(&vm_object_list_mtx); TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 13:57:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9BE869AA; Mon, 4 Mar 2013 13:57:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 78C9419EE; Mon, 4 Mar 2013 13:57:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24DvkLa073931; Mon, 4 Mar 2013 13:57:46 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24DvkkM073928; Mon, 4 Mar 2013 13:57:46 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201303041357.r24DvkkM073928@svn.freebsd.org> From: Eitan Adler Date: Mon, 4 Mar 2013 13:57:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247791 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 13:57:47 -0000 Author: eadler Date: Mon Mar 4 13:57:46 2013 New Revision: 247791 URL: http://svnweb.freebsd.org/changeset/base/247791 Log: Modernize some portions of the ports man page. Stop documenting other operating systems's default patha Approved by: bcr (mentor) Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Mon Mar 4 13:17:52 2013 (r247790) +++ head/share/man/man7/ports.7 Mon Mar 4 13:57:46 2013 (r247791) @@ -490,27 +490,17 @@ single file .Bl -tag -width ".Pa /usr/ports/Mk/bsd.port.mk" -compact .It Pa /usr/ports The default ports directory -.No ( Fx -and -.Ox ) . -.It Pa /usr/pkgsrc -The default ports directory -.Pq Nx . .It Pa /usr/ports/Mk/bsd.port.mk The big Kahuna. .El .Sh SEE ALSO .Xr make 1 , -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_version 1 +.Xr pkg 8 , +.Xr portsnap 8 .Pp The following are part of the ports collection: .Pp .Xr portaudit 1 , -.Xr portcheckout 1 , .Xr portlint 1 .Rs .%B "The FreeBSD Handbook" From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 14:00:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A8E5DCFC; Mon, 4 Mar 2013 14:00:59 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8E2E51A1C; Mon, 4 Mar 2013 14:00:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24E0xR9076177; Mon, 4 Mar 2013 14:00:59 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24E0xOo076175; Mon, 4 Mar 2013 14:00:59 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041400.r24E0xOo076175@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 14:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247792 - head/sys/dev/syscons X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 14:00:59 -0000 Author: davide Date: Mon Mar 4 14:00:58 2013 New Revision: 247792 URL: http://svnweb.freebsd.org/changeset/base/247792 Log: MFcalloutng (r244249, r244306 by mav): - Switch syscons from timeout() to callout_reset_flags() and specify that precision is not important there -- anything from 20 to 30Hz will be fine. - Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode and there is nothing to do except some polling for keyboard. Text mode refresh would also be nice to have adaptive, but this change at least should help laptop users who running X. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Mon Mar 4 13:57:46 2013 (r247791) +++ head/sys/dev/syscons/syscons.c Mon Mar 4 14:00:58 2013 (r247792) @@ -506,6 +506,8 @@ sc_attach_unit(int unit, int flags) sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE); sc->config = flags; + callout_init(&sc->ctimeout, 0); + callout_init(&sc->cblink, 0); scp = sc_get_stat(sc->dev[0]); if (sc_console == NULL) /* sc_console_unit < 0 */ sc_console = scp; @@ -1831,13 +1833,11 @@ static void scrn_timer(void *arg) { #ifndef PC98 - static int kbd_interval = 0; + static time_t kbd_time_stamp = 0; #endif - struct timeval tv; sc_softc_t *sc; scr_stat *scp; - int again; - int s; + int again, rate; again = (arg != NULL); if (arg != NULL) @@ -1847,18 +1847,18 @@ scrn_timer(void *arg) else return; + /* find the vty to update */ + scp = sc->cur_scp; + /* don't do anything when we are performing some I/O operations */ - if (suspend_in_progress || sc->font_loading_in_progress) { - if (again) - timeout(scrn_timer, sc, hz / 10); - return; - } - s = spltty(); + if (suspend_in_progress || sc->font_loading_in_progress) + goto done; #ifndef PC98 if ((sc->kbd == NULL) && (sc->config & SC_AUTODETECT_KBD)) { /* try to allocate a keyboard automatically */ - if (++kbd_interval >= 25) { + if (kbd_time_stamp != time_uptime) { + kbd_time_stamp = time_uptime; sc->keyboard = sc_allocate_keyboard(sc, -1); if (sc->keyboard >= 0) { sc->kbd = kbd_get_keyboard(sc->keyboard); @@ -1867,25 +1867,20 @@ scrn_timer(void *arg) update_kbd_state(sc->cur_scp, sc->cur_scp->status, LOCK_MASK); } - kbd_interval = 0; } } #endif /* PC98 */ - /* find the vty to update */ - scp = sc->cur_scp; - /* should we stop the screen saver? */ - getmicrouptime(&tv); if (debugger > 0 || panicstr || shutdown_in_progress) sc_touch_scrn_saver(); if (run_scrn_saver) { - if (tv.tv_sec > sc->scrn_time_stamp + scrn_blank_time) + if (time_uptime > sc->scrn_time_stamp + scrn_blank_time) sc->flags |= SC_SCRN_IDLE; else sc->flags &= ~SC_SCRN_IDLE; } else { - sc->scrn_time_stamp = tv.tv_sec; + sc->scrn_time_stamp = time_uptime; sc->flags &= ~SC_SCRN_IDLE; if (scrn_blank_time > 0) run_scrn_saver = TRUE; @@ -1898,12 +1893,8 @@ scrn_timer(void *arg) /* should we just return ? */ if (sc->blink_in_progress || sc->switch_in_progress - || sc->write_in_progress) { - if (again) - timeout(scrn_timer, sc, hz / 10); - splx(s); - return; - } + || sc->write_in_progress) + goto done; /* Update the screen */ scp = sc->cur_scp; /* cur_scp may have changed... */ @@ -1917,9 +1908,19 @@ scrn_timer(void *arg) (*current_saver)(sc, TRUE); #endif - if (again) - timeout(scrn_timer, sc, hz / 25); - splx(s); +done: + if (again) { + /* + * Use reduced "refresh" rate if we are in graphics and that is not a + * graphical screen saver. In such case we just have nothing to do. + */ + if (ISGRAPHSC(scp) && !(sc->flags & SC_SCRN_BLANKED)) + rate = 2; + else + rate = 30; + callout_reset_sbt(&sc->ctimeout, SBT_1S / rate, 0, + scrn_timer, sc, C_PREL(1)); + } } static int @@ -3863,7 +3864,8 @@ blink_screen(void *arg) (*scp->rndr->draw)(scp, 0, scp->xsize*scp->ysize, scp->sc->blink_in_progress & 1); scp->sc->blink_in_progress--; - timeout(blink_screen, scp, hz / 10); + callout_reset_sbt(&scp->sc->cblink, SBT_1S / 15, 0, + blink_screen, scp, C_PREL(0)); } } Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Mon Mar 4 13:57:46 2013 (r247791) +++ head/sys/dev/syscons/syscons.h Mon Mar 4 14:00:58 2013 (r247792) @@ -269,6 +269,8 @@ typedef struct sc_softc { #ifdef KDB int sc_altbrk; #endif + struct callout ctimeout; + struct callout cblink; } sc_softc_t; /* virtual screen */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 14:50:07 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ACE3AEED; Mon, 4 Mar 2013 14:50:07 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7931E4C; Mon, 4 Mar 2013 14:50:06 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 91FBC7300A; Mon, 4 Mar 2013 15:42:16 +0100 (CET) Date: Mon, 4 Mar 2013 15:42:16 +0100 From: Luigi Rizzo To: Davide Italiano Subject: Re: svn commit: r247792 - head/sys/dev/syscons Message-ID: <20130304144216.GA63659@onelab2.iet.unipi.it> References: <201303041400.r24E0xOo076175@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201303041400.r24E0xOo076175@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 14:50:07 -0000 On Mon, Mar 04, 2013 at 02:00:59PM +0000, Davide Italiano wrote: > Author: davide > Date: Mon Mar 4 14:00:58 2013 > New Revision: 247792 > URL: http://svnweb.freebsd.org/changeset/base/247792 > > Log: > MFcalloutng (r244249, r244306 by mav): > - Switch syscons from timeout() to callout_reset_flags() and specify that > precision is not important there -- anything from 20 to 30Hz will be fine. > - Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode > and there is nothing to do except some polling for keyboard. Text mode just to understand, how does this 1-2Hz affect the respose to keypresses ? does it mean it takes 0.5..1s to see the keypress ? cheers luigi From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 14:55:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8EF10185; Mon, 4 Mar 2013 14:55:56 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com [IPv6:2a00:1450:4010:c03::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 5B2E91E85; Mon, 4 Mar 2013 14:55:55 +0000 (UTC) Received: by mail-la0-f47.google.com with SMTP id fj20so5008472lab.20 for ; Mon, 04 Mar 2013 06:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=QhxVr1gwG5YTvBgZfD+wIkmOG/6mBzKzbdujFaQk1Ec=; b=BtR6+vdYdLSsBOTEKyHoHQLwKcGmSyOSFWCNozoiP/7S4uQfxtql4+KywKL4q9vK9n 1uBnQnm7c5nJIkx8S6WNFnIEOG1IRusBC0Y45WOA1IVWKi83MmzHkzACBQtdjPOFJyC9 cw3xVMX4maS3xz7e1kvjMBdaxU/IVwz1cFUQaGrQClV5l6dnnLIsfewHuuAA1RfiSxCa cL5fTwFZD3U4MOPX72B71ndn7fIyOTgam6V2aU6mwdykoSTjwf/8cO/nQQV55AQ/A6+Q Z4OPhv3nedI20wpcT11Zsu0tJ6xyM0RGdFoOBk0HRhsLAhM6QKzXfpMPNdnY4Wg9U3FX Q16w== X-Received: by 10.152.46.12 with SMTP id r12mr18210722lam.15.1362408954358; Mon, 04 Mar 2013 06:55:54 -0800 (PST) Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37]) by mx.google.com with ESMTPS id b13sm7388208lbd.10.2013.03.04.06.55.51 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Mar 2013 06:55:53 -0800 (PST) Sender: Alexander Motin Message-ID: <5134B5F5.7000204@FreeBSD.org> Date: Mon, 04 Mar 2013 16:55:49 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130125 Thunderbird/17.0.2 MIME-Version: 1.0 To: Luigi Rizzo Subject: Re: svn commit: r247792 - head/sys/dev/syscons References: <201303041400.r24E0xOo076175@svn.freebsd.org> <20130304144216.GA63659@onelab2.iet.unipi.it> In-Reply-To: <20130304144216.GA63659@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Davide Italiano , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 14:55:56 -0000 On 04.03.2013 16:42, Luigi Rizzo wrote: > On Mon, Mar 04, 2013 at 02:00:59PM +0000, Davide Italiano wrote: >> Author: davide >> Date: Mon Mar 4 14:00:58 2013 >> New Revision: 247792 >> URL: http://svnweb.freebsd.org/changeset/base/247792 >> >> Log: >> MFcalloutng (r244249, r244306 by mav): >> - Switch syscons from timeout() to callout_reset_flags() and specify that >> precision is not important there -- anything from 20 to 30Hz will be fine. >> - Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode >> and there is nothing to do except some polling for keyboard. Text mode > > just to understand, how does this 1-2Hz affect the respose to keypresses ? > does it mean it takes 0.5..1s to see the keypress ? No, it is a polling for keyboard presence, and its rate already limited to 1Hz by comparing kbd_time_stamp to time_uptime there. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 15:03:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D29E63D1; Mon, 4 Mar 2013 15:03:52 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AFD361EDE; Mon, 4 Mar 2013 15:03:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24F3qvX094573; Mon, 4 Mar 2013 15:03:52 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24F3qW7094572; Mon, 4 Mar 2013 15:03:52 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041503.r24F3qW7094572@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 15:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247793 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 15:03:52 -0000 Author: davide Date: Mon Mar 4 15:03:52 2013 New Revision: 247793 URL: http://svnweb.freebsd.org/changeset/base/247793 Log: Fix build with DIAGNOSTIC/CALLOUT_PROFILING options turned on. Reported by: kib, David Wolfskill Pointy-hat to: davide Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Mar 4 14:00:58 2013 (r247792) +++ head/sys/kern/kern_timeout.c Mon Mar 4 15:03:52 2013 (r247793) @@ -601,7 +601,7 @@ softclock_call_cc(struct callout *c, str sbintime_t new_time; #endif #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) - sbintime_t bt1, bt2; + sbintime_t sbt1, sbt2; struct timespec ts2; static sbintime_t maxdt = 2 * SBT_1MS; /* 2 msec */ static timeout_t *lastfunc; @@ -655,7 +655,7 @@ softclock_call_cc(struct callout *c, str CTR3(KTR_CALLOUT, "callout %p func %p arg %p", c, c_func, c_arg); } -#ifdef DIAGNOSTIC +#if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) sbt1 = sbinuptime(); #endif THREAD_NO_SLEEPING(); @@ -663,17 +663,17 @@ softclock_call_cc(struct callout *c, str c_func(c_arg); SDT_PROBE(callout_execute, kernel, , callout_end, c, 0, 0, 0, 0); THREAD_SLEEPING_OK(); -#ifdef DIAGNOSTIC - bt2 = sbinuptime(); - bt2 -= bt1; - if (bt2 > maxdt) { - if (lastfunc != c_func || bt2 > maxdt * 2) { - ts2 = sbttots(bt2); +#if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) + sbt2 = sbinuptime(); + sbt2 -= sbt1; + if (sbt2 > maxdt) { + if (lastfunc != c_func || sbt2 > maxdt * 2) { + ts2 = sbttots(sbt2); printf( "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", c_func, c_arg, (intmax_t)ts2.tv_sec, ts2.tv_nsec); } - maxdt = bt2; + maxdt = sbt2; lastfunc = c_func; } #endif From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 15:57:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D5AA0CAE; Mon, 4 Mar 2013 15:57:41 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5B962DD; Mon, 4 Mar 2013 15:57:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24FvfJD010387; Mon, 4 Mar 2013 15:57:41 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24Fvfvx010386; Mon, 4 Mar 2013 15:57:41 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041557.r24Fvfvx010386@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 15:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247797 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 15:57:41 -0000 Author: davide Date: Mon Mar 4 15:57:41 2013 New Revision: 247797 URL: http://svnweb.freebsd.org/changeset/base/247797 Log: MFcalloutng: kern_nanosleep() is now converted to use tsleep_sbt(). With this change nanosleep() and usleep() can handle sub-tick precision for timeouts. Also, try to help coalesce of events passing as argument to tsleep_bt() a precision value calculated as a percentage of the sleep time. This percentage is default 5%, but it can tuned according to users need via the sysctl interface. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/kern_time.c Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Mon Mar 4 15:34:59 2013 (r247796) +++ head/sys/kern/kern_time.c Mon Mar 4 15:57:41 2013 (r247797) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -481,38 +482,37 @@ static int nanowait; int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) { - struct timespec ts, ts2, ts3; - struct timeval tv; + struct timespec ts; + sbintime_t sbt, sbtt, prec, tmp; int error; if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) return (EINVAL); if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) return (0); - getnanouptime(&ts); - timespecadd(&ts, rqt); - TIMESPEC_TO_TIMEVAL(&tv, rqt); - for (;;) { - error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", - tvtohz(&tv)); - getnanouptime(&ts2); - if (error != EWOULDBLOCK) { - if (error == ERESTART) - error = EINTR; - if (rmt != NULL) { - timespecsub(&ts, &ts2); - if (ts.tv_sec < 0) - timespecclear(&ts); - *rmt = ts; - } - return (error); + tmp = tstosbt(*rqt); + prec = tmp; + prec >>= tc_precexp; + if (TIMESEL(&sbt, tmp)) + sbt += tc_tick_sbt; + sbt += tmp; + error = tsleep_sbt(&nanowait, PWAIT | PCATCH, "nanslp", sbt, prec, + C_ABSOLUTE); + if (error != EWOULDBLOCK) { + if (error == ERESTART) + error = EINTR; + TIMESEL(&sbtt, tmp); + if (rmt != NULL) { + ts = sbttots(sbt - sbtt); + if (ts.tv_sec < 0) + timespecclear(&ts); + *rmt = ts; } - if (timespeccmp(&ts2, &ts, >=)) + if (sbtt >= sbt) return (0); - ts3 = ts; - timespecsub(&ts3, &ts2); - TIMESPEC_TO_TIMEVAL(&tv, &ts3); + return (error); } + return (0); } #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 16:07:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2774C267; Mon, 4 Mar 2013 16:07:56 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1A90D378; Mon, 4 Mar 2013 16:07:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24G7tHK013654; Mon, 4 Mar 2013 16:07:55 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24G7t02013653; Mon, 4 Mar 2013 16:07:55 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041607.r24G7t02013653@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 16:07:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247798 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:07:56 -0000 Author: davide Date: Mon Mar 4 16:07:55 2013 New Revision: 247798 URL: http://svnweb.freebsd.org/changeset/base/247798 Log: MFcalloutng (r244255 by mav, with minor changes): Specify that syslog doesn't need exactly 5 wakeups per second. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/subr_log.c Modified: head/sys/kern/subr_log.c ============================================================================== --- head/sys/kern/subr_log.c Mon Mar 4 15:57:41 2013 (r247797) +++ head/sys/kern/subr_log.c Mon Mar 4 16:07:55 2013 (r247798) @@ -117,8 +117,8 @@ logopen(struct cdev *dev, int flags, int return (EBUSY); } log_open = 1; - callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second, - logtimeout, NULL); + callout_reset_sbt(&logsoftc.sc_callout, + SBT_1S / log_wakeups_per_second, 0, logtimeout, NULL, C_PREL(1)); mtx_unlock(&msgbuf_lock); fsetown(td->td_proc->p_pid, &logsoftc.sc_sigio); /* signal process only */ @@ -233,22 +233,21 @@ logtimeout(void *arg) if (!log_open) return; - if (log_wakeups_per_second < 1) { - printf("syslog wakeup is less than one. Adjusting to 1.\n"); - log_wakeups_per_second = 1; - } - if (msgbuftrigger == 0) { - callout_schedule(&logsoftc.sc_callout, - hz / log_wakeups_per_second); - return; - } + if (msgbuftrigger == 0) + goto done; msgbuftrigger = 0; selwakeuppri(&logsoftc.sc_selp, LOG_RDPRI); KNOTE_LOCKED(&logsoftc.sc_selp.si_note, 0); if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL) pgsigio(&logsoftc.sc_sigio, SIGIO, 0); cv_broadcastpri(&log_wakeup, LOG_RDPRI); - callout_schedule(&logsoftc.sc_callout, hz / log_wakeups_per_second); +done: + if (log_wakeups_per_second < 1) { + printf("syslog wakeup is less than one. Adjusting to 1.\n"); + log_wakeups_per_second = 1; + } + callout_reset_sbt(&logsoftc.sc_callout, + SBT_1S / log_wakeups_per_second, 0, logtimeout, NULL, C_PREL(1)); } /*ARGSUSED*/ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 16:16:23 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E4CC266D; Mon, 4 Mar 2013 16:16:23 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4B15616; Mon, 4 Mar 2013 16:16:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24GGN7A016796; Mon, 4 Mar 2013 16:16:23 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24GGNNs016795; Mon, 4 Mar 2013 16:16:23 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041616.r24GGNNs016795@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 16:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247799 - head/sys/dev/random X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:16:24 -0000 Author: davide Date: Mon Mar 4 16:16:23 2013 New Revision: 247799 URL: http://svnweb.freebsd.org/changeset/base/247799 Log: MFcalloutng (r236314 by mav): Specify that wakeup rate of 7.5-10Hz is enough for yarrow harvesting thread. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/dev/random/randomdev_soft.c Modified: head/sys/dev/random/randomdev_soft.c ============================================================================== --- head/sys/dev/random/randomdev_soft.c Mon Mar 4 16:07:55 2013 (r247798) +++ head/sys/dev/random/randomdev_soft.c Mon Mar 4 16:16:23 2013 (r247799) @@ -242,10 +242,10 @@ random_kthread(void *arg __unused) local_count = 0; /* Process until told to stop */ + mtx_lock_spin(&harvest_mtx); for (; random_kthread_control >= 0;) { /* Cycle through all the entropy sources */ - mtx_lock_spin(&harvest_mtx); for (source = RANDOM_START; source < ENTROPYSOURCE; source++) { /* * Drain entropy source records into a thread-local @@ -270,7 +270,6 @@ random_kthread(void *arg __unused) emptyfifo.count += local_count; local_count = 0; } - mtx_unlock_spin(&harvest_mtx); KASSERT(local_count == 0, ("random_kthread: local_count %d", local_count)); @@ -283,9 +282,11 @@ random_kthread(void *arg __unused) random_kthread_control = 0; /* Work done, so don't belabour the issue */ - pause("-", hz / 10); + msleep_spin_sbt(&random_kthread_control, &harvest_mtx, + "-", SBT_1S / 10, 0, C_PREL(1)); } + mtx_unlock_spin(&harvest_mtx); random_set_wakeup_exit(&random_kthread_control); /* NOTREACHED */ From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 16:25:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7AE0CAA1; Mon, 4 Mar 2013 16:25:13 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6DEB26CB; Mon, 4 Mar 2013 16:25:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24GPD1o019591; Mon, 4 Mar 2013 16:25:13 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24GPD5m019590; Mon, 4 Mar 2013 16:25:13 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041625.r24GPD5m019590@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 16:25:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247800 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:25:13 -0000 Author: davide Date: Mon Mar 4 16:25:12 2013 New Revision: 247800 URL: http://svnweb.freebsd.org/changeset/base/247800 Log: MFcalloutng (r244251 with minor changes): Specify that precision of 0.5s is enough for resource limitation. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Mon Mar 4 16:16:23 2013 (r247799) +++ head/sys/kern/kern_resource.c Mon Mar 4 16:25:12 2013 (r247800) @@ -645,7 +645,8 @@ lim_cb(void *arg) } } if ((p->p_flag & P_WEXIT) == 0) - callout_reset(&p->p_limco, hz, lim_cb, p); + callout_reset_sbt(&p->p_limco, SBT_1S, 0, + lim_cb, p, C_PREL(1)); } int @@ -697,7 +698,8 @@ kern_proc_setrlimit(struct thread *td, s case RLIMIT_CPU: if (limp->rlim_cur != RLIM_INFINITY && p->p_cpulimit == RLIM_INFINITY) - callout_reset(&p->p_limco, hz, lim_cb, p); + callout_reset_sbt(&p->p_limco, SBT_1S, 0, + lim_cb, p, C_PREL(1)); p->p_cpulimit = limp->rlim_cur; break; case RLIMIT_DATA: @@ -1137,7 +1139,8 @@ lim_fork(struct proc *p1, struct proc *p p2->p_limit = lim_hold(p1->p_limit); callout_init_mtx(&p2->p_limco, &p2->p_mtx, 0); if (p1->p_cpulimit != RLIM_INFINITY) - callout_reset(&p2->p_limco, hz, lim_cb, p2); + callout_reset_sbt(&p2->p_limco, SBT_1S, 0, + lim_cb, p2, C_PREL(1)); } void From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 16:41:28 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8DFFBF99; Mon, 4 Mar 2013 16:41:28 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 808EB764; Mon, 4 Mar 2013 16:41:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24GfSS6025065; Mon, 4 Mar 2013 16:41:28 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24GfSUD025064; Mon, 4 Mar 2013 16:41:28 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041641.r24GfSUD025064@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 16:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247801 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:41:28 -0000 Author: davide Date: Mon Mar 4 16:41:27 2013 New Revision: 247801 URL: http://svnweb.freebsd.org/changeset/base/247801 Log: MFcalloutng: Fix kern_select() and sys_poll() so that they can handle sub-tick precision for timeouts (in the same fashion it was done for nanosleep() in r247797). Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Mon Mar 4 16:25:12 2013 (r247800) +++ head/sys/kern/sys_generic.c Mon Mar 4 16:41:27 2013 (r247801) @@ -103,7 +103,7 @@ static int dofilewrite(struct thread *, off_t, int); static void doselwakeup(struct selinfo *, int); static void seltdinit(struct thread *); -static int seltdwait(struct thread *, int); +static int seltdwait(struct thread *, sbintime_t, sbintime_t); static void seltdclear(struct thread *); /* @@ -950,9 +950,10 @@ kern_select(struct thread *td, int nd, f */ fd_mask s_selbits[howmany(2048, NFDBITS)]; fd_mask *ibits[3], *obits[3], *selbits, *sbp; - struct timeval atv, rtv, ttv; - int error, lf, ndu, timo; + struct timeval rtv; + sbintime_t asbt, precision, rsbt; u_int nbufbytes, ncpbytes, ncpubytes, nfdbits; + int error, lf, ndu; if (nd < 0) return (EINVAL); @@ -1042,35 +1043,29 @@ kern_select(struct thread *td, int nd, f if (nbufbytes != 0) bzero(selbits, nbufbytes / 2); + precision = 0; if (tvp != NULL) { - atv = *tvp; - if (itimerfix(&atv)) { + rtv = *tvp; + if (rtv.tv_sec < 0 || rtv.tv_usec < 0 || + rtv.tv_usec >= 1000000) { error = EINVAL; goto done; } - getmicrouptime(&rtv); - timevaladd(&atv, &rtv); - } else { - atv.tv_sec = 0; - atv.tv_usec = 0; - } - timo = 0; + rsbt = tvtosbt(rtv); + precision = rsbt; + precision >>= tc_precexp; + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + } else + asbt = -1; seltdinit(td); /* Iterate until the timeout expires or descriptors become ready. */ for (;;) { error = selscan(td, ibits, obits, nd); if (error || td->td_retval[0] != 0) break; - if (atv.tv_sec || atv.tv_usec) { - getmicrouptime(&rtv); - if (timevalcmp(&rtv, &atv, >=)) - break; - ttv = atv; - timevalsub(&ttv, &rtv); - timo = ttv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&ttv); - } - error = seltdwait(td, timo); + error = seltdwait(td, asbt, precision); if (error) break; error = selrescan(td, ibits, obits); @@ -1278,9 +1273,9 @@ sys_poll(td, uap) { struct pollfd *bits; struct pollfd smallbits[32]; - struct timeval atv, rtv, ttv; - int error, timo; + sbintime_t asbt, precision, rsbt; u_int nfds; + int error; size_t ni; nfds = uap->nfds; @@ -1294,36 +1289,27 @@ sys_poll(td, uap) error = copyin(uap->fds, bits, ni); if (error) goto done; + precision = 0; if (uap->timeout != INFTIM) { - atv.tv_sec = uap->timeout / 1000; - atv.tv_usec = (uap->timeout % 1000) * 1000; - if (itimerfix(&atv)) { + if (uap->timeout < 0) { error = EINVAL; goto done; } - getmicrouptime(&rtv); - timevaladd(&atv, &rtv); - } else { - atv.tv_sec = 0; - atv.tv_usec = 0; - } - timo = 0; + rsbt = SBT_1MS * uap->timeout; + precision = rsbt; + precision >>= tc_precexp; + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + } else + asbt = -1; seltdinit(td); /* Iterate until the timeout expires or descriptors become ready. */ for (;;) { error = pollscan(td, bits, nfds); if (error || td->td_retval[0] != 0) break; - if (atv.tv_sec || atv.tv_usec) { - getmicrouptime(&rtv); - if (timevalcmp(&rtv, &atv, >=)) - break; - ttv = atv; - timevalsub(&ttv, &rtv); - timo = ttv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&ttv); - } - error = seltdwait(td, timo); + error = seltdwait(td, asbt, precision); if (error) break; error = pollrescan(td); @@ -1667,7 +1653,7 @@ out: } static int -seltdwait(struct thread *td, int timo) +seltdwait(struct thread *td, sbintime_t sbt, sbintime_t precision) { struct seltd *stp; int error; @@ -1686,8 +1672,11 @@ seltdwait(struct thread *td, int timo) mtx_unlock(&stp->st_mtx); return (0); } - if (timo > 0) - error = cv_timedwait_sig(&stp->st_wait, &stp->st_mtx, timo); + if (sbt == 0) + error = EWOULDBLOCK; + else if (sbt != -1) + error = cv_timedwait_sig_sbt(&stp->st_wait, &stp->st_mtx, + sbt, precision, C_ABSOLUTE); else error = cv_wait_sig(&stp->st_wait, &stp->st_mtx); mtx_unlock(&stp->st_mtx); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 16:55:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C936385E; Mon, 4 Mar 2013 16:55:16 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BBEE481E; Mon, 4 Mar 2013 16:55:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24GtGIm028730; Mon, 4 Mar 2013 16:55:16 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24GtGAM028729; Mon, 4 Mar 2013 16:55:16 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041655.r24GtGAM028729@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 16:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247804 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 16:55:16 -0000 Author: davide Date: Mon Mar 4 16:55:16 2013 New Revision: 247804 URL: http://svnweb.freebsd.org/changeset/base/247804 Log: MFcalloutng: - Rewrite kevent() timeout implementation to allow sub-tick precision. - Make the interval timings for EVFILT_TIMER more accurate. This also removes an hack introduced in r238424. Sponsored by: Google Summer of Code 2012, iXsystems inc. Tested by: flo, marius, ian, markj, Fabian Keil Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Mon Mar 4 16:50:01 2013 (r247803) +++ head/sys/kern/kern_event.c Mon Mar 4 16:55:16 2013 (r247804) @@ -517,39 +517,28 @@ knote_fork(struct knlist *list, int pid) * XXX: EVFILT_TIMER should perhaps live in kern_time.c beside the * interval timer support code. */ -static int -timertoticks(intptr_t data) +static __inline sbintime_t +timer2sbintime(intptr_t data) { - struct timeval tv; - int tticks; - - tv.tv_sec = data / 1000; - tv.tv_usec = (data % 1000) * 1000; - tticks = tvtohz(&tv); - return tticks; + return (SBT_1MS * data); } static void filt_timerexpire(void *knx) { - struct knote *kn = knx; struct callout *calloutp; + struct knote *kn; + kn = knx; kn->kn_data++; KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ - /* - * timertoticks() uses tvtohz() which always adds 1 to allow - * for the time until the next clock interrupt being strictly - * less than 1 clock tick. We don't want that here since we - * want to appear to be in sync with the clock interrupt even - * when we're delayed. - */ if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { calloutp = (struct callout *)kn->kn_hook; - callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata) - 1, - filt_timerexpire, kn); + callout_reset_sbt_on(calloutp, + timer2sbintime(kn->kn_sdata), 0 /* 1ms? */, + filt_timerexpire, kn, PCPU_GET(cpuid), 0); } } @@ -573,8 +562,9 @@ filt_timerattach(struct knote *kn) calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK); callout_init(calloutp, CALLOUT_MPSAFE); kn->kn_hook = calloutp; - callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata), - filt_timerexpire, kn); + callout_reset_sbt_on(calloutp, + timer2sbintime(kn->kn_sdata), 0 /* 1ms? */, + filt_timerexpire, kn, PCPU_GET(cpuid), 0); return (0); } @@ -1319,10 +1309,9 @@ kqueue_scan(struct kqueue *kq, int maxev const struct timespec *tsp, struct kevent *keva, struct thread *td) { struct kevent *kevp; - struct timeval atv, rtv, ttv; struct knote *kn, *marker; - int count, timeout, nkev, error, influx; - int haskqglobal, touch; + sbintime_t asbt, rsbt; + int count, error, haskqglobal, influx, nkev, touch; count = maxevents; nkev = 0; @@ -1332,24 +1321,23 @@ kqueue_scan(struct kqueue *kq, int maxev if (maxevents == 0) goto done_nl; + rsbt = 0; if (tsp != NULL) { - TIMESPEC_TO_TIMEVAL(&atv, tsp); - if (itimerfix(&atv)) { + if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || + tsp->tv_nsec > 1000000000) { error = EINVAL; goto done_nl; } - if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) - timeout = -1; - else - timeout = atv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&atv); - getmicrouptime(&rtv); - timevaladd(&atv, &rtv); - } else { - atv.tv_sec = 0; - atv.tv_usec = 0; - timeout = 0; - } + if (timespecisset(tsp)) { + rsbt = tstosbt(*tsp); + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + rsbt >>= tc_precexp; + } else + asbt = -1; + } else + asbt = 0; marker = knote_alloc(1); if (marker == NULL) { error = ENOMEM; @@ -1357,28 +1345,16 @@ kqueue_scan(struct kqueue *kq, int maxev } marker->kn_status = KN_MARKER; KQ_LOCK(kq); - goto start; retry: - if (atv.tv_sec || atv.tv_usec) { - getmicrouptime(&rtv); - if (timevalcmp(&rtv, &atv, >=)) - goto done; - ttv = atv; - timevalsub(&ttv, &rtv); - timeout = ttv.tv_sec > 24 * 60 * 60 ? - 24 * 60 * 60 * hz : tvtohz(&ttv); - } - -start: kevp = keva; if (kq->kq_count == 0) { - if (timeout < 0) { + if (asbt == -1) { error = EWOULDBLOCK; } else { kq->kq_state |= KQ_SLEEP; - error = msleep(kq, &kq->kq_lock, PSOCK | PCATCH, - "kqread", timeout); + error = msleep_sbt(kq, &kq->kq_lock, PSOCK | PCATCH, + "kqread", asbt, rsbt, C_ABSOLUTE); } if (error == 0) goto retry; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 18:51:54 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 92FD5F97; Mon, 4 Mar 2013 18:51:54 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6CB09E20; Mon, 4 Mar 2013 18:51:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24Ipsie064910; Mon, 4 Mar 2013 18:51:54 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24IpraJ064904; Mon, 4 Mar 2013 18:51:53 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303041851.r24IpraJ064904@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Mon, 4 Mar 2013 18:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247810 - in head/contrib/openpam: doc/man 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 18:51:54 -0000 Author: des Date: Mon Mar 4 18:51:53 2013 New Revision: 247810 URL: http://svnweb.freebsd.org/changeset/base/247810 Log: Merge upstream r634:646: correctly parse mixed quoted / unquoted text. Modified: head/contrib/openpam/doc/man/openpam_straddch.3 head/contrib/openpam/lib/openpam_readline.c head/contrib/openpam/lib/openpam_readword.c Directory Properties: head/contrib/openpam/ (props changed) Modified: head/contrib/openpam/doc/man/openpam_straddch.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_straddch.3 Mon Mar 4 18:46:55 2013 (r247809) +++ head/contrib/openpam/doc/man/openpam_straddch.3 Mon Mar 4 18:51:53 2013 (r247810) @@ -34,7 +34,7 @@ .\" .\" $Id$ .\" -.Dd May 26, 2012 +.Dd March 3, 2013 .Dt OPENPAM_STRADDCH 3 .Os .Sh NAME @@ -73,6 +73,21 @@ and argument point to variables used to hold the size of the buffer and the length of the string it contains, respectively. .Pp +The final argument, +.Fa ch , +is the character that should be appended to +the string. If +.Fa ch +is 0, nothing is appended, but a new buffer is +still allocated if +.Fa str +is NULL. This can be used to +.Do +bootstrap +.Dc +the +string. +.Pp If a new buffer is allocated or an existing buffer is reallocated to make room for the additional character, .Fa str @@ -91,7 +106,9 @@ If the function is successful, it increments the integer variable pointed to by .Fa len -and returns 0. +(unless +.Fa ch +was 0) and returns 0. Otherwise, it leaves the variables pointed to by .Fa str , .Fa size Modified: head/contrib/openpam/lib/openpam_readline.c ============================================================================== --- head/contrib/openpam/lib/openpam_readline.c Mon Mar 4 18:46:55 2013 (r247809) +++ head/contrib/openpam/lib/openpam_readline.c Mon Mar 4 18:51:53 2013 (r247810) @@ -62,11 +62,9 @@ openpam_readline(FILE *f, int *lineno, s size_t len, size; int ch; - if ((line = malloc(size = MIN_LINE_LENGTH)) == NULL) { - openpam_log(PAM_LOG_ERROR, "malloc(): %m"); + line = NULL; + if (openpam_straddch(&line, &size, &len, 0) != 0) return (NULL); - } - len = 0; for (;;) { ch = fgetc(f); /* strip comment */ Modified: head/contrib/openpam/lib/openpam_readword.c ============================================================================== --- head/contrib/openpam/lib/openpam_readword.c Mon Mar 4 18:46:55 2013 (r247809) +++ head/contrib/openpam/lib/openpam_readword.c Mon Mar 4 18:51:53 2013 (r247810) @@ -86,13 +86,8 @@ openpam_readword(FILE *f, int *lineno, s /* begin quote */ quote = ch; /* edge case: empty quoted string */ - if (word == NULL && (word = malloc(1)) == NULL) { - openpam_log(PAM_LOG_ERROR, "malloc(): %m"); - errno = ENOMEM; + if (openpam_straddch(&word, &size, &len, 0) != 0) return (NULL); - } - *word = '\0'; - size = 1; } else if (ch == quote && !escape) { /* end quote */ quote = 0; From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 19:01:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 324382E1; Mon, 4 Mar 2013 19:01:39 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1A7B1E86; Mon, 4 Mar 2013 19:01:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24J1ceL067960; Mon, 4 Mar 2013 19:01:38 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24J1cBe067959; Mon, 4 Mar 2013 19:01:38 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303041901.r24J1cBe067959@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 4 Mar 2013 19:01:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247811 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 19:01:39 -0000 Author: melifaro Date: Mon Mar 4 19:01:38 2013 New Revision: 247811 URL: http://svnweb.freebsd.org/changeset/base/247811 Log: Do not suddenly fail on some rulesets if -n (syntax check only) is specified and ipfw(4) module is not loaded. MFC after: 2 weeks Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Mar 4 18:51:53 2013 (r247810) +++ head/sbin/ipfw/ipfw2.c Mon Mar 4 19:01:38 2013 (r247811) @@ -3083,9 +3083,14 @@ chkarg: } else { len = sizeof(c->max_log); if (sysctlbyname("net.inet.ip.fw.verbose_limit", - &c->max_log, &len, NULL, 0) == -1) + &c->max_log, &len, NULL, 0) == -1) { + if (co.test_only) { + c->max_log = 0; + break; + } errx(1, "sysctlbyname(\"%s\")", "net.inet.ip.fw.verbose_limit"); + } } } break; @@ -3986,9 +3991,13 @@ ipfw_table_handler(int ac, char *av[]) mask = 0; // XXX uninitialized ? len = sizeof(tables_max); if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len, - NULL, 0) == -1) - errx(1, "Can't determine maximum number of ipfw tables. " - "Perhaps you forgot to load ipfw module?"); + NULL, 0) == -1) { + if (co.test_only) + tables_max = 128; /* Old conservative default */ + else + errx(1, "Can't determine maximum number of ipfw tables." + " Perhaps you forgot to load ipfw module?"); + } memset(&xent, 0, sizeof(xent)); From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 19:10:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 333A35E2; Mon, 4 Mar 2013 19:10:41 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 15ED0EF0; Mon, 4 Mar 2013 19:10:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24JAenZ069562; Mon, 4 Mar 2013 19:10:40 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24JAd04069553; Mon, 4 Mar 2013 19:10:39 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303041910.r24JAd04069553@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 19:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247812 - in head/share/man: man4 man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 19:10:41 -0000 Author: davide Date: Mon Mar 4 19:10:39 2013 New Revision: 247812 URL: http://svnweb.freebsd.org/changeset/base/247812 Log: MFcalloutng: Dcoument the new functions added to condvar(9), sleep(9), sleepqueue(9) KPIs. Also document recent changes in timeout(9) and eventtimers(4). Modified: head/share/man/man4/eventtimers.4 head/share/man/man9/Makefile head/share/man/man9/condvar.9 head/share/man/man9/sleep.9 head/share/man/man9/sleepqueue.9 head/share/man/man9/timeout.9 Modified: head/share/man/man4/eventtimers.4 ============================================================================== --- head/share/man/man4/eventtimers.4 Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man4/eventtimers.4 Mon Mar 4 19:10:39 2013 (r247812) @@ -143,14 +143,6 @@ By default this options is disabled. If chosen timer is per-CPU and runs in periodic mode, this option has no effect - all interrupts are always generating. -.It Va kern.eventtimer.activetick -makes each CPU to receive all kinds of timer interrupts when they are busy. -Disabling it allows to skip some -.Fn hardclock -calls in some cases. -By default this options is enabled. -If chosen timer is per-CPU, this option has no effect - all interrupts are -always generating, as timer reprogramming is too expensive for that case. .El .Sh SEE ALSO .Xr apic 4 , Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man9/Makefile Mon Mar 4 19:10:39 2013 (r247812) @@ -1196,9 +1196,13 @@ MLINKS+=signal.9 cursig.9 \ signal.9 SIG_STOPSIGMASK.9 \ signal.9 trapsignal.9 MLINKS+=sleep.9 msleep.9 \ + sleep.9 msleep_sbt.9 \ sleep.9 msleep_spin.9 \ + sleep.9 msleep_spin_sbt.9 \ sleep.9 pause.9 \ + sleep.9 pause_sbt.9 \ sleep.9 tsleep.9 \ + sleep.9 tsleep_sbt.9 \ sleep.9 wakeup.9 \ sleep.9 wakeup_one.9 MLINKS+=sleepqueue.9 init_sleepqueues.9 \ @@ -1213,6 +1217,7 @@ MLINKS+=sleepqueue.9 init_sleepqueues.9 sleepqueue.9 sleepq_release.9 \ sleepqueue.9 sleepq_remove.9 \ sleepqueue.9 sleepq_set_timeout.9 \ + sleepqueue.9 sleepq_set_timeout_sbt.9 \ sleepqueue.9 sleepq_signal.9 \ sleepqueue.9 sleepq_timedwait.9 \ sleepqueue.9 sleepq_timedwait_sig.9 \ @@ -1335,6 +1340,9 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_init_rw.9 \ timeout.9 callout_pending.9 \ timeout.9 callout_reset.9 \ + timeout.9 callout_reset_sbt.9 \ + timeout.9 callout_reset_on.9 \ + timeout.9 callout_reset_sbt_on.9 \ timeout.9 callout_schedule.9 \ timeout.9 callout_stop.9 \ timeout.9 untimeout.9 Modified: head/share/man/man9/condvar.9 ============================================================================== --- head/share/man/man9/condvar.9 Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man9/condvar.9 Mon Mar 4 19:10:39 2013 (r247812) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5, 2007 +.Dd February 19, 2013 .Dt CONDVAR 9 .Os .Sh NAME @@ -37,7 +37,9 @@ .Nm cv_wait_sig , .Nm cv_wait_unlock , .Nm cv_timedwait , +.Nm cv_timedwait_sbt , .Nm cv_timedwait_sig , +.Nm cv_timedwait_sig_sbt , .Nm cv_signal , .Nm cv_broadcast , .Nm cv_broadcastpri , @@ -60,7 +62,13 @@ .Ft int .Fn cv_timedwait "struct cv *cvp" "lock" "int timo" .Ft int +.Fn cv_timedwait_sbt "struct cv *cvp" "lock" "sbintime_t sbt" \ +"sbintime_t pr" "int flags" +.Ft int .Fn cv_timedwait_sig "struct cv *cvp" "lock" "int timo" +.Ft int +.Fn cv_timedwait_sig_sbt "struct cv *cvp" "lock" "sbintime_t sbt" \ +"sbintime_t pr" "int flags" .Ft void .Fn cv_signal "struct cv *cvp" .Ft void @@ -191,6 +199,25 @@ if a signal is caught, or 0 if signaled .Fn cv_signal or .Fn cv_broadcast . +.Pp +.Fn cv_timedwait_sbt +and +.Fn cv_timedwait_sig_sbt +functions take +.Fa sbt +argument instead of +.Fa timo . +It allows to specify relative or absolute unblock time with higher resolution +in form of +.Vt sbintime_t . +The parameter +.Fa pr +allows to specify wanted absolute event precision. +The parameter +.Fa flags +allows to pass additional +.Fn callout_reset_sbt +flags. .Sh RETURN VALUES If successful, .Fn cv_wait_sig , @@ -230,4 +257,5 @@ Timeout expired. .Xr rwlock 9 , .Xr sema 9 , .Xr sleep 9 , -.Xr sx 9 +.Xr sx 9 , +.Xr timeout 9 Modified: head/share/man/man9/sleep.9 ============================================================================== --- head/share/man/man9/sleep.9 Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man9/sleep.9 Mon Mar 4 19:10:39 2013 (r247812) @@ -25,14 +25,18 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2009 +.Dd February 19, 2013 .Dt SLEEP 9 .Os .Sh NAME .Nm msleep , +.Nm msleep_sbt , .Nm msleep_spin , +.Nm msleep_spin_sbt , .Nm pause , +.Nm pause_sbt , .Nm tsleep , +.Nm tsleep_sbt , .Nm wakeup .Nd wait for events .Sh SYNOPSIS @@ -42,11 +46,23 @@ .Ft int .Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo" .Ft int +.Fn msleep_sbt "void *chan" "struct mtx *mtx" "int priority" \ +"const char *wmesg" "sbintime_t sbt" "sbintime_t pr" "int flags" +.Ft int .Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo" +.Ft int +.Fn msleep_spin_sbt "void *chan" "struct mtx *mtx" "const char *wmesg" \ +"sbintime_t sbt" "sbintime_t pr" "int flags" .Ft void .Fn pause "const char *wmesg" "int timo" +.Ft void +.Fn pause_sbt "const char *wmesg" "sbintime_t sbt" "sbintime_t pr" \ + "int flags" .Ft int .Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo" +.Ft int +.Fn tsleep_sbt "void *chan" "int priority" "const char *wmesg" \ +"sbintime_t sbt" "sbintime_t pr" "int flags" .Ft void .Fn wakeup "void *chan" .Ft void @@ -148,6 +164,27 @@ If the timeout expires, then the sleep function will return .Er EWOULDBLOCK . .Pp +.Fn msleep_sbt , +.Fn msleep_spin_sbt , +.Fn pause_sbt +and +.Fn tsleep_sbt +functions take +.Fa sbt +parameter instead of +.Fa timo . +It allows to specify relative or absolite wakeup time with higher resolution +in form of +.Vt sbintime_t . +The parameter +.Fa pr +allows to specify wanted absolute event precision. +The parameter +.Fa flags +allows to pass additional +.Fn callout_reset_sbt +flags. +.Pp Several of the sleep functions including .Fn msleep , .Fn msleep_spin , @@ -301,7 +338,8 @@ A non-zero timeout was specified and the .Xr mi_switch 9 , .Xr mtx_sleep 9 , .Xr rw_sleep 9 , -.Xr sx_sleep 9 +.Xr sx_sleep 9 , +.Xr timeout 9 .Sh HISTORY The functions .Fn sleep Modified: head/share/man/man9/sleepqueue.9 ============================================================================== --- head/share/man/man9/sleepqueue.9 Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man9/sleepqueue.9 Mon Mar 4 19:10:39 2013 (r247812) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2010 +.Dd February 19, 2013 .Dt SLEEPQUEUE 9 .Os .Sh NAME @@ -41,6 +41,7 @@ .Nm sleepq_remove , .Nm sleepq_signal , .Nm sleepq_set_timeout , +.Nm sleepq_set_timeout_sbt , .Nm sleepq_sleepcnt , .Nm sleepq_timedwait , .Nm sleepq_timedwait_sig , @@ -79,6 +80,9 @@ .Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue" .Ft void .Fn sleepq_set_timeout "void *wchan" "int timo" +.Ft void +.Fn sleepq_set_timeout_sbt "void *wchan" "sbintime_t sbt" \ +"sbintime_t pr" "int flags" .Ft u_int .Fn sleepq_sleepcnt "void *wchan" "int queue" .Ft int @@ -231,6 +235,23 @@ The .Fa timo parameter should specify the timeout value in ticks. .Pp +.Fn sleepq_set_timeout_sbt +function takes +.Fa sbt +argument instead of +.Fa timo . +It allows to specify relative or absolute wakeup time with higher resolution +in form of +.Vt sbintime_t . +The parameter +.Fa pr +allows to specify wanted absolute event precision. +The parameter +.Fa flags +allows to pass additional +.Fn callout_reset_sbt +flags. +.Pp The current thread may be marked interruptible by calling .Fn sleepq_catch_signals with @@ -400,4 +421,5 @@ than manipulating sleep queues directly. .Xr condvar 9 , .Xr runqueue 9 , .Xr scheduler 9 , -.Xr sleep 9 +.Xr sleep 9 , +.Xr timeout 9 Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Mon Mar 4 19:01:38 2013 (r247811) +++ head/share/man/man9/timeout.9 Mon Mar 4 19:10:39 2013 (r247812) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2012 +.Dd February 19, 2013 .Dt TIMEOUT 9 .Os .Sh NAME @@ -44,6 +44,9 @@ .Nm callout_reset , .Nm callout_reset_on , .Nm callout_reset_curcpu , +.Nm callout_reset_sbt , +.Nm callout_reset_sbt_on , +.Nm callout_reset_sbt_curcpu , .Nm callout_schedule , .Nm callout_schedule_on , .Nm callout_schedule_curcpu , @@ -82,6 +85,9 @@ struct callout_handle handle = CALLOUT_H .Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \ "void *arg" "int cpu" .Ft int +.Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags" +.Ft int .Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \ "void *arg" .Ft int @@ -326,6 +332,33 @@ and .Fn callout_schedule but take an extra parameter specifying the target CPU for the callout. .Pp +The function +.Fn callout_reset_sbt_on +allows to get higher time resolution, taking relative or absolute time +and precision instead of relative ticks count. +If specified time is in past, it will be silently converted to present +to run handler as soon as possible. +.Pp +The following +.Fa flags +may be specified: +.Bl -tag -width ".Dv C_DIRECT_EXEC" +.It Dv C_ALSOLUTE +Handle the +.Fa sbt +argument as absolute time of the event since boot, or relative time otherwise. +.It Dv C_DIRECT_EXEC +Run handler directly from hardware interrupt context instead of softclock swi. +It is faster, but puts more constraints on handlers. +Handlers may use only spin mutexes for locking, and they must be fast because +they run with absolute priority. +.It Fn C_PREL +Specifies relative event time precision as binary logarithm of time interval +divided by acceptable time deviation: 1 -- 1/2, 2 -- 1/4, etc. +Smaller value allows to aggregate more events in one timer interrupt to +reduce processing overhead and power consumption. +.El +.Pp The functions .Fn callout_reset_curcpu and From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 21:09:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E0173758; Mon, 4 Mar 2013 21:09:22 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2D73152B; Mon, 4 Mar 2013 21:09:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24L9M3f005917; Mon, 4 Mar 2013 21:09:22 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24L9Mm1005916; Mon, 4 Mar 2013 21:09:22 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303042109.r24L9Mm1005916@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 21:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247813 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 21:09:22 -0000 Author: davide Date: Mon Mar 4 21:09:22 2013 New Revision: 247813 URL: http://svnweb.freebsd.org/changeset/base/247813 Log: Use C99 'bool' rather than Machish 'boolean_t'. Requested by: jhb Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Mar 4 19:10:39 2013 (r247812) +++ head/sys/kern/kern_timeout.c Mon Mar 4 21:09:22 2013 (r247813) @@ -126,8 +126,8 @@ struct cc_exec { int ce_migration_cpu; sbintime_t ce_migration_time; #endif - boolean_t cc_cancel; - boolean_t cc_waiting; + bool cc_cancel; + bool cc_waiting; }; /* From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 21:18:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 048F4BC2; Mon, 4 Mar 2013 21:18:47 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DCA0B15C2; Mon, 4 Mar 2013 21:18:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24LIk8I008921; Mon, 4 Mar 2013 21:18:46 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24LIj5e008913; Mon, 4 Mar 2013 21:18:45 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201303042118.r24LIj5e008913@svn.freebsd.org> From: "Kenneth D. Merry" Date: Mon, 4 Mar 2013 21:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 21:18:47 -0000 Author: ken Date: Mon Mar 4 21:18:45 2013 New Revision: 247814 URL: http://svnweb.freebsd.org/changeset/base/247814 Log: Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable tunable by default. This will allow GENERIC configurations to boot on small memory boxes, but not require end users who want to use CTL to recompile their kernel. They can simply set kern.cam.ctl.disable=0 in loader.conf. The eventual solution to the memory usage problem is to change the way CTL allocates memory to be more configurable, but this should fix things for small memory situations in the mean time. UPDATING: Explain the change in the CTL configuration, and how users can enable CTL if they would like to use it. sys/conf/options: Add a new option, CTL_DISABLE, that prevents CTL from initializing. ctl.c: If CTL_DISABLE is turned on, don't initialize. i386/conf/GENERIC, amd64/conf/GENERIC: Re-enable device ctl, and add the CTL_DISABLE option. Modified: head/UPDATING head/sys/amd64/conf/GENERIC head/sys/cam/ctl/ctl.c head/sys/conf/options head/sys/i386/conf/GENERIC Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 4 21:09:22 2013 (r247813) +++ head/UPDATING Mon Mar 4 21:18:45 2013 (r247814) @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130304: + The ctl device has been re-enabled in GENERIC for i386 and amd64, + but does not initialize by default (because of the new CTL_DISABLE + option) to save memory. To re-enable it, remove the CTL_DISABLE + option from the kernel config file or set kern.cam.ctl.disable=0 + in /boot/loader.conf. + 20130301: The ctl device has been disabled in GENERIC for i386 and amd64. This was done due to the extra memory being allocated at system Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Mon Mar 4 21:09:22 2013 (r247813) +++ head/sys/amd64/conf/GENERIC Mon Mar 4 21:18:45 2013 (r247814) @@ -138,7 +138,10 @@ device sa # Sequential Access (tape et device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) -#device ctl # CAM Target Layer +device ctl # CAM Target Layer +options CTL_DISABLE # Disable CTL by default to save memory. + # Re-enable with kern.cam.ctl.disable=0 in + # /boot/loader.conf # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Mar 4 21:09:22 2013 (r247813) +++ head/sys/cam/ctl/ctl.c Mon Mar 4 21:18:45 2013 (r247814) @@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_ctl.h" + struct ctl_softc *control_softc = NULL; /* @@ -317,7 +319,11 @@ static int persis_offset; static uint8_t ctl_pause_rtr; static int ctl_is_single; static int index_to_aps_page; +#ifdef CTL_DISABLE +int ctl_disable = 1; +#else int ctl_disable = 0; +#endif SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, &ctl_disable, 0, Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Mar 4 21:09:22 2013 (r247813) +++ head/sys/conf/options Mon Mar 4 21:18:45 2013 (r247814) @@ -329,6 +329,9 @@ SCSI_PT_DEFAULT_TIMEOUT opt_pt.h # Options used only in cam/scsi/scsi_ses.c SES_ENABLE_PASSTHROUGH opt_ses.h +# Options used only in cam/ctl +CTL_DISABLE opt_ctl.h + # Options used in dev/sym/ (Symbios SCSI driver). SYM_SETUP_LP_PROBE_MAP opt_sym.h #-Low Priority Probe Map (bits) # Allows the ncr to take precedence Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Mon Mar 4 21:09:22 2013 (r247813) +++ head/sys/i386/conf/GENERIC Mon Mar 4 21:18:45 2013 (r247814) @@ -146,7 +146,10 @@ device sa # Sequential Access (tape et device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) -#device ctl # CAM Target Layer +device ctl # CAM Target Layer +options CTL_DISABLE # Disable CTL by default to save memory. + # Re-enable with kern.cam.ctl.disable=0 in + # /boot/loader.conf # RAID controllers interfaced to the SCSI subsystem device amr # AMI MegaRAID From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 21:20:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 24EA0E58; Mon, 4 Mar 2013 21:20:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17EC715E3; Mon, 4 Mar 2013 21:20:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24LKDEr009455; Mon, 4 Mar 2013 21:20:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24LKDWv009452; Mon, 4 Mar 2013 21:20:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303042120.r24LKDWv009452@svn.freebsd.org> From: Alexander Motin Date: Mon, 4 Mar 2013 21:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247815 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 21:20:14 -0000 Author: mav Date: Mon Mar 4 21:20:13 2013 New Revision: 247815 URL: http://svnweb.freebsd.org/changeset/base/247815 Log: Add quirk to enable headphones redirection on Lenovo X220. PR: kern/174876 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 Mon Mar 4 21:18:45 2013 (r247814) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Mon Mar 4 21:20:13 2013 (r247815) @@ -333,6 +333,13 @@ hdac_pin_patch(struct hdaa_widget *w) patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_CX20590 && + subid == LENOVO_X220_SUBVENDOR) { + switch (nid) { + case 25: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Mon Mar 4 21:18:45 2013 (r247814) +++ head/sys/dev/sound/pci/hda/hdac.h Mon Mar 4 21:20:13 2013 (r247815) @@ -220,6 +220,7 @@ #define LENOVO_3KN200_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x384e) #define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d) #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015) +#define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 21:52:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 868ADC02; Mon, 4 Mar 2013 21:52:13 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4819F175E; Mon, 4 Mar 2013 21:52:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24LqDEu020113; Mon, 4 Mar 2013 21:52:13 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24LqDA7020112; Mon, 4 Mar 2013 21:52:13 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303042152.r24LqDA7020112@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 21:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247818 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 21:52:13 -0000 Author: davide Date: Mon Mar 4 21:52:12 2013 New Revision: 247818 URL: http://svnweb.freebsd.org/changeset/base/247818 Log: Complete r247813: Use true/false instead of TRUE/FALSE. Reported by: attilio Requested by: jhb Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Mar 4 21:36:34 2013 (r247817) +++ head/sys/kern/kern_timeout.c Mon Mar 4 21:52:12 2013 (r247818) @@ -215,8 +215,8 @@ cc_cce_cleanup(struct callout_cpu *cc, i cc->cc_exec_entity[direct].cc_curr = NULL; cc->cc_exec_entity[direct].cc_next = NULL; - cc->cc_exec_entity[direct].cc_cancel = FALSE; - cc->cc_exec_entity[direct].cc_waiting = FALSE; + cc->cc_exec_entity[direct].cc_cancel = false; + cc->cc_exec_entity[direct].cc_waiting = false; #ifdef SMP cc->cc_exec_entity[direct].ce_migration_cpu = CPUBLOCK; cc->cc_exec_entity[direct].ce_migration_time = 0; @@ -621,7 +621,7 @@ softclock_call_cc(struct callout *c, str else c->c_flags &= ~CALLOUT_PENDING; cc->cc_exec_entity[direct].cc_curr = c; - cc->cc_exec_entity[direct].cc_cancel = FALSE; + cc->cc_exec_entity[direct].cc_cancel = false; CC_UNLOCK(cc); if (c_lock != NULL) { class->lc_lock(c_lock, sharedlock); @@ -634,7 +634,7 @@ softclock_call_cc(struct callout *c, str goto skip; } /* The callout cannot be stopped now. */ - cc->cc_exec_entity[direct].cc_cancel = TRUE; + cc->cc_exec_entity[direct].cc_cancel = true; if (c_lock == &Giant.lock_object) { #ifdef CALLOUT_PROFILING (*gcalls)++; @@ -700,7 +700,7 @@ skip: */ c->c_flags &= ~CALLOUT_DFRMIGRATION; } - cc->cc_exec_entity[direct].cc_waiting = FALSE; + cc->cc_exec_entity[direct].cc_waiting = false; CC_UNLOCK(cc); wakeup(&cc->cc_exec_entity[direct].cc_waiting); CC_LOCK(cc); @@ -954,7 +954,7 @@ callout_reset_sbt_on(struct callout *c, * can cancel the callout if it has not really started. */ if (c->c_lock != NULL && !cc->cc_exec_entity[direct].cc_cancel) - cancelled = cc->cc_exec_entity[direct].cc_cancel = TRUE; + cancelled = cc->cc_exec_entity[direct].cc_cancel = true; if (cc->cc_exec_entity[direct].cc_waiting) { /* * Someone has called callout_drain to kill this @@ -1135,7 +1135,7 @@ again: * will be packed up, just let softclock() * take care of it. */ - cc->cc_exec_entity[direct].cc_waiting = TRUE; + cc->cc_exec_entity[direct].cc_waiting = true; DROP_GIANT(); CC_UNLOCK(cc); sleepq_add( @@ -1161,7 +1161,7 @@ again: * lock, the callout will be skipped in * softclock(). */ - cc->cc_exec_entity[direct].cc_cancel = TRUE; + cc->cc_exec_entity[direct].cc_cancel = true; CTR3(KTR_CALLOUT, "cancelled %p func %p arg %p", c, c->c_func, c->c_arg); KASSERT(!cc_cce_migrating(cc, direct), From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 22:07:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 883AB3A9; Mon, 4 Mar 2013 22:07:37 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6259B180E; Mon, 4 Mar 2013 22:07:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24M7blZ024136; Mon, 4 Mar 2013 22:07:37 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24M7brA024135; Mon, 4 Mar 2013 22:07:37 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201303042207.r24M7brA024135@svn.freebsd.org> From: "Justin T. Gibbs" Date: Mon, 4 Mar 2013 22:07:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247820 - head/sys/cddl/contrib/opensolaris/uts/intel/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 22:07:37 -0000 Author: gibbs Date: Mon Mar 4 22:07:36 2013 New Revision: 247820 URL: http://svnweb.freebsd.org/changeset/base/247820 Log: Fix assertion failure when using userland DTrace probes from the pid provider on a kernel compiled with INVARIANTS. sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c: In fasttrap_probe_pid(), attempts to write to the address space of the thread that fired the probe must be performed with the process of the thread held. Use _PHOLD() to ensure this is the case. In fasttrap_probe_pid(), use proc_write_regs() instead of calling set_regs() directly. proc_write_regs() performs invariant checks to verify the calling environment of set_regs(). PROC_LOCK()/UNLOCK() around the call to proc_write_regs() so that it's invariants are satisfied. Sponsored by: Spectra Logic Corporation Reviewed by: gnn, rpaulo MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Modified: head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Mon Mar 4 22:04:14 2013 (r247819) +++ head/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c Mon Mar 4 22:07:36 2013 (r247820) @@ -1034,6 +1034,7 @@ fasttrap_pid_probe(struct reg *rp) #endif PROC_LOCK(p); + _PHOLD(p); pid = p->p_pid; #if defined(sun) pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock; @@ -1059,6 +1060,7 @@ fasttrap_pid_probe(struct reg *rp) #if defined(sun) mutex_exit(pid_mtx); #endif + _PRELE(p); PROC_UNLOCK(p); return (-1); } @@ -1732,7 +1734,6 @@ fasttrap_pid_probe(struct reg *rp) ASSERT(i <= sizeof (scratch)); - #if defined(sun) if (fasttrap_copyout(scratch, (char *)addr, i)) { #else @@ -1794,7 +1795,11 @@ done: } rp->r_rip = new_pc; - set_regs(curthread, rp); + + PROC_LOCK(p); + proc_write_regs(curthread, rp); + _PRELE(p); + PROC_UNLOCK(p); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 22:27:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 57DFB73C; Mon, 4 Mar 2013 22:27:33 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 4480E1897; Mon, 4 Mar 2013 22:27:33 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 438A01A3D17; Mon, 4 Mar 2013 14:27:26 -0800 (PST) Message-ID: <51351FCA.7040303@mu.org> Date: Mon, 04 Mar 2013 14:27:22 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: "Kenneth D. Merry" Subject: Re: svn commit: r247814 - in head: . sys/amd64/conf sys/cam/ctl sys/conf sys/i386/conf References: <201303042118.r24LIj5e008913@svn.freebsd.org> In-Reply-To: <201303042118.r24LIj5e008913@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 22:27:33 -0000 Ken, By the time ctl_init is called, it looks like enough of the vm is there such that you could probe for physmem. (I may be wrong and apologize if so) Look at kern_mib.c: > sysctl_hw_physmem(SYSCTL_HANDLER_ARGS) > { > u_long val; > > val = ctob(physmem); > return (sysctl_handle_long(oidp, &val, 0, req)); > } > > SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD, > 0, 0, sysctl_hw_physmem, "LU", ""); Then the logic could be: IF (set(tunable_ctl_onoff)) ctl_onoff = tunable_ctl_onoff; ELSE ctl_onoff = physmem > ctl_threshold; This would get you much more people testing the code and the best out of the box experience for people downloading. Hope this helps. -Alfred On 3/4/13 1:18 PM, Kenneth D. Merry wrote: > Author: ken > Date: Mon Mar 4 21:18:45 2013 > New Revision: 247814 > URL: http://svnweb.freebsd.org/changeset/base/247814 > > Log: > Re-enable CTL in GENERIC on i386 and amd64, but turn on the CTL disable > tunable by default. > > This will allow GENERIC configurations to boot on small memory boxes, but > not require end users who want to use CTL to recompile their kernel. They > can simply set kern.cam.ctl.disable=0 in loader.conf. > > The eventual solution to the memory usage problem is to change the way > CTL allocates memory to be more configurable, but this should fix things > for small memory situations in the mean time. > > UPDATING: Explain the change in the CTL configuration, and > how users can enable CTL if they would like to use > it. > > sys/conf/options: Add a new option, CTL_DISABLE, that prevents CTL > from initializing. > > ctl.c: If CTL_DISABLE is turned on, don't initialize. > > i386/conf/GENERIC, > amd64/conf/GENERIC: Re-enable device ctl, and add the CTL_DISABLE > option. > > Modified: > head/UPDATING > head/sys/amd64/conf/GENERIC > head/sys/cam/ctl/ctl.c > head/sys/conf/options > head/sys/i386/conf/GENERIC > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Mon Mar 4 21:09:22 2013 (r247813) > +++ head/UPDATING Mon Mar 4 21:18:45 2013 (r247814) > @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20130304: > + The ctl device has been re-enabled in GENERIC for i386 and amd64, > + but does not initialize by default (because of the new CTL_DISABLE > + option) to save memory. To re-enable it, remove the CTL_DISABLE > + option from the kernel config file or set kern.cam.ctl.disable=0 > + in /boot/loader.conf. > + > 20130301: > The ctl device has been disabled in GENERIC for i386 and amd64. > This was done due to the extra memory being allocated at system > > Modified: head/sys/amd64/conf/GENERIC > ============================================================================== > --- head/sys/amd64/conf/GENERIC Mon Mar 4 21:09:22 2013 (r247813) > +++ head/sys/amd64/conf/GENERIC Mon Mar 4 21:18:45 2013 (r247814) > @@ -138,7 +138,10 @@ device sa # Sequential Access (tape et > device cd # CD > device pass # Passthrough device (direct ATA/SCSI access) > device ses # Enclosure Services (SES and SAF-TE) > -#device ctl # CAM Target Layer > +device ctl # CAM Target Layer > +options CTL_DISABLE # Disable CTL by default to save memory. > + # Re-enable with kern.cam.ctl.disable=0 in > + # /boot/loader.conf > > # RAID controllers interfaced to the SCSI subsystem > device amr # AMI MegaRAID > > Modified: head/sys/cam/ctl/ctl.c > ============================================================================== > --- head/sys/cam/ctl/ctl.c Mon Mar 4 21:09:22 2013 (r247813) > +++ head/sys/cam/ctl/ctl.c Mon Mar 4 21:18:45 2013 (r247814) > @@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include "opt_ctl.h" > + > struct ctl_softc *control_softc = NULL; > > /* > @@ -317,7 +319,11 @@ static int persis_offset; > static uint8_t ctl_pause_rtr; > static int ctl_is_single; > static int index_to_aps_page; > +#ifdef CTL_DISABLE > +int ctl_disable = 1; > +#else > int ctl_disable = 0; > +#endif > > SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); > SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, &ctl_disable, 0, > > Modified: head/sys/conf/options > ============================================================================== > --- head/sys/conf/options Mon Mar 4 21:09:22 2013 (r247813) > +++ head/sys/conf/options Mon Mar 4 21:18:45 2013 (r247814) > @@ -329,6 +329,9 @@ SCSI_PT_DEFAULT_TIMEOUT opt_pt.h > # Options used only in cam/scsi/scsi_ses.c > SES_ENABLE_PASSTHROUGH opt_ses.h > > +# Options used only in cam/ctl > +CTL_DISABLE opt_ctl.h > + > # Options used in dev/sym/ (Symbios SCSI driver). > SYM_SETUP_LP_PROBE_MAP opt_sym.h #-Low Priority Probe Map (bits) > # Allows the ncr to take precedence > > Modified: head/sys/i386/conf/GENERIC > ============================================================================== > --- head/sys/i386/conf/GENERIC Mon Mar 4 21:09:22 2013 (r247813) > +++ head/sys/i386/conf/GENERIC Mon Mar 4 21:18:45 2013 (r247814) > @@ -146,7 +146,10 @@ device sa # Sequential Access (tape et > device cd # CD > device pass # Passthrough device (direct ATA/SCSI access) > device ses # Enclosure Services (SES and SAF-TE) > -#device ctl # CAM Target Layer > +device ctl # CAM Target Layer > +options CTL_DISABLE # Disable CTL by default to save memory. > + # Re-enable with kern.cam.ctl.disable=0 in > + # /boot/loader.conf > > # RAID controllers interfaced to the SCSI subsystem > device amr # AMI MegaRAID > From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 22:41:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 05A67A83; Mon, 4 Mar 2013 22:41:50 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EC8C4B0; Mon, 4 Mar 2013 22:41:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r24MfnNv096735; Mon, 4 Mar 2013 22:41:49 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24MfnD2096733; Mon, 4 Mar 2013 22:41:49 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303042241.r24MfnD2096733@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Mar 2013 22:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247821 - in 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 22:41:50 -0000 Author: davide Date: Mon Mar 4 22:41:49 2013 New Revision: 247821 URL: http://svnweb.freebsd.org/changeset/base/247821 Log: - Bump __FreeBSD_version after recent callout(9) changes. - Add an entry in UPDATING to notice users about breakages. Modified: head/UPDATING head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Mar 4 22:07:36 2013 (r247820) +++ head/UPDATING Mon Mar 4 22:41:49 2013 (r247821) @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20130304: + Recent commits to callout(9) changed the size of struct callout, + so the KBI is probably heavily disturbed. Also, some functions + in callout(9)/sleep(9)/sleepqueue(9)/condvar(9) KPIs were replaced + by macros. Every kernel module using it won't load, so rebuild + is requested. + The ctl device has been re-enabled in GENERIC for i386 and amd64, but does not initialize by default (because of the new CTL_DISABLE option) to save memory. To re-enable it, remove the CTL_DISABLE Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Mar 4 22:07:36 2013 (r247820) +++ head/sys/sys/param.h Mon Mar 4 22:41:49 2013 (r247821) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000028 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000029 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 23:07:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E0A7E28F; Mon, 4 Mar 2013 23:07:41 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C739F1A3; Mon, 4 Mar 2013 23:07:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r24N7fId028108; Mon, 4 Mar 2013 23:07:41 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24N7eMs028100; Mon, 4 Mar 2013 23:07:40 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201303042307.r24N7eMs028100@svn.freebsd.org> From: Jack F Vogel Date: Mon, 4 Mar 2013 23:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247822 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 23:07:41 -0000 Author: jfv Date: Mon Mar 4 23:07:40 2013 New Revision: 247822 URL: http://svnweb.freebsd.org/changeset/base/247822 Log: First, sync to internal shared code, and then Fixes: - flow control - don't override user value on re-init - fix to make 1G optics work correctly - change to interrupt enabling - some bits were incorrect for certain hardware. - certain stats fixes, remove a duplicate increment of ierror, thanks to Scott Long for pointing these out. - shared code link interface changed, requiring some core code changes to accomodate this. - add an m_adj() to ETHER_ALIGN on the recieve side, this was requested by Mike Karels, thanks Mike. - Multicast code corrections also thanks to Mike Karels. Modified: head/sys/dev/ixgbe/LICENSE head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_82599.h head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_api.h head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_mbx.h head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_phy.h head/sys/dev/ixgbe/ixgbe_type.h head/sys/dev/ixgbe/ixgbe_vf.c head/sys/dev/ixgbe/ixgbe_vf.h head/sys/dev/ixgbe/ixgbe_x540.c head/sys/dev/ixgbe/ixgbe_x540.h head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/ixgbe/LICENSE ============================================================================== --- head/sys/dev/ixgbe/LICENSE Mon Mar 4 22:41:49 2013 (r247821) +++ head/sys/dev/ixgbe/LICENSE Mon Mar 4 23:07:40 2013 (r247822) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2013, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Mar 4 22:41:49 2013 (r247821) +++ head/sys/dev/ixgbe/ixgbe.c Mon Mar 4 23:07:40 2013 (r247822) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2012, Intel Corporation + Copyright (c) 2001-2013, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0"; +char ixgbe_driver_version[] = "2.5.7 - HEAD"; /********************************************************************* * PCI Device ID Table @@ -83,7 +83,7 @@ static ixgbe_vendor_info_t ixgbe_vendor_ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, - {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T1, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF_QP, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} @@ -216,7 +216,6 @@ static device_method_t ixgbe_methods[] = DEVMETHOD(device_attach, ixgbe_attach), DEVMETHOD(device_detach, ixgbe_detach), DEVMETHOD(device_shutdown, ixgbe_shutdown), - DEVMETHOD_END }; @@ -596,6 +595,9 @@ ixgbe_attach(device_t dev) "PCIE, or x4 PCIE 2 slot is required.\n"); } + /* Set an initial default flow control value */ + adapter->fc = ixgbe_fc_full; + /* let hardware know driver is loaded */ ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD; @@ -1310,7 +1312,7 @@ ixgbe_init_locked(struct adapter *adapte tmp = IXGBE_LOW_DV(frame); hw->fc.low_water[0] = IXGBE_BT2KB(tmp); - adapter->fc = hw->fc.requested_mode = ixgbe_fc_full; + hw->fc.requested_mode = adapter->fc; hw->fc.pause_time = IXGBE_FC_PAUSE; hw->fc.send_xon = TRUE; } @@ -1680,7 +1682,7 @@ ixgbe_media_status(struct ifnet * ifp, s ifmr->ifm_active |= IFM_100_TX | IFM_FDX; break; case IXGBE_LINK_SPEED_1GB_FULL: - ifmr->ifm_active |= adapter->optics | IFM_FDX; + ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; break; case IXGBE_LINK_SPEED_10GB_FULL: ifmr->ifm_active |= adapter->optics | IFM_FDX; @@ -1932,18 +1934,6 @@ ixgbe_set_multi(struct adapter *adapter) bzero(mta, sizeof(u8) * IXGBE_ETH_LENGTH_OF_ADDRESS * MAX_NUM_MULTICAST_ADDRESSES); - fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); - fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - if (ifp->if_flags & IFF_PROMISC) - fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - else if (ifp->if_flags & IFF_ALLMULTI) { - fctrl |= IXGBE_FCTRL_MPE; - fctrl &= ~IXGBE_FCTRL_UPE; - } else - fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); - - IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl); - #if __FreeBSD_version < 800000 IF_ADDR_LOCK(ifp); #else @@ -1952,6 +1942,8 @@ ixgbe_set_multi(struct adapter *adapter) TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; + if (mcnt == MAX_NUM_MULTICAST_ADDRESSES) + break; bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), &mta[mcnt * IXGBE_ETH_LENGTH_OF_ADDRESS], IXGBE_ETH_LENGTH_OF_ADDRESS); @@ -1963,9 +1955,24 @@ ixgbe_set_multi(struct adapter *adapter) if_maddr_runlock(ifp); #endif - update_ptr = mta; - ixgbe_update_mc_addr_list(&adapter->hw, - update_ptr, mcnt, ixgbe_mc_array_itr, TRUE); + fctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_FCTRL); + fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); + if (ifp->if_flags & IFF_PROMISC) + fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); + else if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES || + ifp->if_flags & IFF_ALLMULTI) { + fctrl |= IXGBE_FCTRL_MPE; + fctrl &= ~IXGBE_FCTRL_UPE; + } else + fctrl &= ~(IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE); + + IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl); + + if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) { + update_ptr = mta; + ixgbe_update_mc_addr_list(&adapter->hw, + update_ptr, mcnt, ixgbe_mc_array_itr, TRUE); + } return; } @@ -2172,7 +2179,7 @@ ixgbe_setup_optics(struct adapter *adapt { struct ixgbe_hw *hw = &adapter->hw; int layer; - + layer = ixgbe_get_supported_physical_layer(hw); if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) { @@ -2651,7 +2658,7 @@ ixgbe_config_link(struct adapter *adapte taskqueue_enqueue(adapter->tq, &adapter->mod_task); } else { if (hw->mac.ops.check_link) - err = ixgbe_check_link(hw, &autoneg, + err = ixgbe_check_link(hw, &adapter->link_speed, &adapter->link_up, FALSE); if (err) goto out; @@ -2662,8 +2669,8 @@ ixgbe_config_link(struct adapter *adapte if (err) goto out; if (hw->mac.ops.setup_link) - err = hw->mac.ops.setup_link(hw, autoneg, - negotiate, adapter->link_up); + err = hw->mac.ops.setup_link(hw, + autoneg, adapter->link_up); } out: return; @@ -3713,6 +3720,8 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, M_PKTHDR, rxr->mbuf_sz); if (mp == NULL) goto update; + if (adapter->max_frame_size <= (MCLBYTES - ETHER_ALIGN)) + m_adj(mp, ETHER_ALIGN); } else mp = rxbuf->buf; @@ -4408,7 +4417,6 @@ ixgbe_rxeof(struct ix_queue *que) /* Make sure bad packets are discarded */ if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) || (rxr->discard)) { - ifp->if_ierrors++; rxr->rx_discarded++; if (eop) rxr->discard = FALSE; @@ -4734,14 +4742,25 @@ ixgbe_enable_intr(struct adapter *adapte /* Enable Fan Failure detection */ if (hw->device_id == IXGBE_DEV_ID_82598AT) mask |= IXGBE_EIMS_GPI_SDP1; - else { - mask |= IXGBE_EIMS_ECC; - mask |= IXGBE_EIMS_GPI_SDP0; - mask |= IXGBE_EIMS_GPI_SDP1; - mask |= IXGBE_EIMS_GPI_SDP2; + + switch (adapter->hw.mac.type) { + case ixgbe_mac_82599EB: + mask |= IXGBE_EIMS_ECC; + mask |= IXGBE_EIMS_GPI_SDP0; + mask |= IXGBE_EIMS_GPI_SDP1; + mask |= IXGBE_EIMS_GPI_SDP2; +#ifdef IXGBE_FDIR + mask |= IXGBE_EIMS_FLOW_DIR; +#endif + break; + case ixgbe_mac_X540: + mask |= IXGBE_EIMS_ECC; #ifdef IXGBE_FDIR - mask |= IXGBE_EIMS_FLOW_DIR; + mask |= IXGBE_EIMS_FLOW_DIR; #endif + /* falls through */ + default: + break; } IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask); @@ -4969,7 +4988,7 @@ ixgbe_handle_msf(void *context, int pend if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); if (hw->mac.ops.setup_link) - hw->mac.ops.setup_link(hw, autoneg, negotiate, TRUE); + hw->mac.ops.setup_link(hw, autoneg, TRUE); return; } @@ -5013,6 +5032,11 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.errbc += IXGBE_READ_REG(hw, IXGBE_ERRBC); adapter->stats.mspdc += IXGBE_READ_REG(hw, IXGBE_MSPDC); + /* + ** Note: these are for the 8 possible traffic classes, + ** which in current implementation is unused, + ** therefore only 0 should read real data. + */ for (int i = 0; i < 8; i++) { u32 mp; mp = IXGBE_READ_REG(hw, IXGBE_MPC(i)); @@ -5022,13 +5046,20 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.mpc[i] += mp; /* Running comprehensive total for stats display */ total_missed_rx += adapter->stats.mpc[i]; - if (hw->mac.type == ixgbe_mac_82598EB) + if (hw->mac.type == ixgbe_mac_82598EB) { adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + adapter->stats.qbtc[i] += + IXGBE_READ_REG(hw, IXGBE_QBTC(i)); + adapter->stats.qbrc[i] += + IXGBE_READ_REG(hw, IXGBE_QBRC(i)); + adapter->stats.pxonrxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); + } else + adapter->stats.pxonrxc[i] += + IXGBE_READ_REG(hw, IXGBE_PXONRXCNT(i)); adapter->stats.pxontxc[i] += IXGBE_READ_REG(hw, IXGBE_PXONTXC(i)); - adapter->stats.pxonrxc[i] += - IXGBE_READ_REG(hw, IXGBE_PXONRXC(i)); adapter->stats.pxofftxc[i] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(i)); adapter->stats.pxoffrxc[i] += @@ -5039,12 +5070,6 @@ ixgbe_update_stats_counters(struct adapt for (int i = 0; i < 16; i++) { adapter->stats.qprc[i] += IXGBE_READ_REG(hw, IXGBE_QPRC(i)); adapter->stats.qptc[i] += IXGBE_READ_REG(hw, IXGBE_QPTC(i)); - adapter->stats.qbrc[i] += IXGBE_READ_REG(hw, IXGBE_QBRC(i)); - adapter->stats.qbrc[i] += - ((u64)IXGBE_READ_REG(hw, IXGBE_QBRC(i)) << 32); - adapter->stats.qbtc[i] += IXGBE_READ_REG(hw, IXGBE_QBTC(i)); - adapter->stats.qbtc[i] += - ((u64)IXGBE_READ_REG(hw, IXGBE_QBTC(i)) << 32); adapter->stats.qprdc[i] += IXGBE_READ_REG(hw, IXGBE_QPRDC(i)); } adapter->stats.mlfc += IXGBE_READ_REG(hw, IXGBE_MLFC); @@ -5141,8 +5166,8 @@ ixgbe_update_stats_counters(struct adapt ifp->if_collisions = 0; /* Rx Errors */ - ifp->if_ierrors = total_missed_rx + adapter->stats.crcerrs + - adapter->stats.rlec; + ifp->if_iqdrops = total_missed_rx; + ifp->if_ierrors = adapter->stats.crcerrs + adapter->stats.rlec; } /** ixgbe_sysctl_tdh_handler - Handler function @@ -5528,10 +5553,13 @@ ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS) ixgbe_disable_rx_drop(adapter); break; case ixgbe_fc_none: - default: adapter->hw.fc.requested_mode = ixgbe_fc_none; if (adapter->num_queues > 1) ixgbe_enable_rx_drop(adapter); + break; + default: + adapter->fc = last; + return (EINVAL); } /* Don't autoneg if forcing a value */ adapter->hw.fc.disable_fc_autoneg = TRUE; @@ -5560,7 +5588,7 @@ ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) last = adapter->advertise; error = sysctl_handle_int(oidp, &adapter->advertise, 0, req); - if ((error) || (adapter->advertise == -1)) + if ((error) || (req->newptr == NULL)) return (error); if (adapter->advertise == last) /* no change */ @@ -5568,11 +5596,11 @@ ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) if (!((hw->phy.media_type == ixgbe_media_type_copper) || (hw->phy.multispeed_fiber))) - return (error); + return (EINVAL); if ((adapter->advertise == 2) && (hw->mac.type != ixgbe_mac_X540)) { device_printf(dev, "Set Advertise: 100Mb on X540 only\n"); - return (error); + return (EINVAL); } if (adapter->advertise == 1) @@ -5582,11 +5610,13 @@ ixgbe_set_advertise(SYSCTL_HANDLER_ARGS) else if (adapter->advertise == 3) speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_10GB_FULL; - else /* bogus value */ - return (error); + else { /* bogus value */ + adapter->advertise = last; + return (EINVAL); + } hw->mac.autotry_restart = TRUE; - hw->mac.ops.setup_link(hw, speed, TRUE, TRUE); + hw->mac.ops.setup_link(hw, speed, TRUE); return (error); } Modified: head/sys/dev/ixgbe/ixgbe_82598.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 4 22:41:49 2013 (r247821) +++ head/sys/dev/ixgbe/ixgbe_82598.c Mon Mar 4 23:07:40 2013 (r247822) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2012, Intel Corporation + Copyright (c) 2001-2013, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,18 +49,17 @@ static s32 ixgbe_check_mac_link_82598(st bool link_up_wait_to_complete); static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, - bool autoneg, bool autoneg_wait_to_complete); static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, - bool autoneg, bool autoneg_wait_to_complete); static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw); static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq); static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw); static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb, u32 headroom, int strategy); - +static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset, + u8 *sff8472_data); /** * ixgbe_set_pcie_completion_timeout - set pci-e completion timeout * @hw: pointer to the HW structure @@ -155,6 +154,7 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw /* SFP+ Module */ phy->ops.read_i2c_eeprom = &ixgbe_read_i2c_eeprom_82598; + phy->ops.read_i2c_sff8472 = &ixgbe_read_i2c_sff8472_82598; /* Link */ mac->ops.check_link = &ixgbe_check_mac_link_82598; @@ -712,15 +712,15 @@ out: * ixgbe_setup_mac_link_82598 - Set MAC link speed * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. **/ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, - ixgbe_link_speed speed, bool autoneg, + ixgbe_link_speed speed, bool autoneg_wait_to_complete) { + bool autoneg = FALSE; s32 status = IXGBE_SUCCESS; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); @@ -766,14 +766,12 @@ static s32 ixgbe_setup_mac_link_82598(st * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE if waiting is needed to complete * * Sets the link speed in the AUTOC register in the MAC and restarts link. **/ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, - bool autoneg, bool autoneg_wait_to_complete) { s32 status; @@ -781,7 +779,7 @@ static s32 ixgbe_setup_copper_link_82598 DEBUGFUNC("ixgbe_setup_copper_link_82598"); /* Setup the PHY according to input speed */ - status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, + status = hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait_to_complete); /* Set up MAC */ ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); @@ -1102,15 +1100,16 @@ s32 ixgbe_write_analog_reg8_82598(struct } /** - * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface. + * ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface. * @hw: pointer to hardware structure - * @byte_offset: EEPROM byte offset to read + * @dev_addr: address to read from + * @byte_offset: byte offset to read from dev_addr * @eeprom_data: value read * * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. **/ -s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, - u8 *eeprom_data) +static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, + u8 byte_offset, u8 *eeprom_data) { s32 status = IXGBE_SUCCESS; u16 sfp_addr = 0; @@ -1118,7 +1117,7 @@ s32 ixgbe_read_i2c_eeprom_82598(struct i u16 sfp_stat = 0; u32 i; - DEBUGFUNC("ixgbe_read_i2c_eeprom_82598"); + DEBUGFUNC("ixgbe_read_i2c_phy_82598"); if (hw->phy.type == ixgbe_phy_nl) { /* @@ -1126,7 +1125,7 @@ s32 ixgbe_read_i2c_eeprom_82598(struct i * 0xC30D. These registers are used to talk to the SFP+ * module's EEPROM through the SDA/SCL (I2C) interface. */ - sfp_addr = (IXGBE_I2C_EEPROM_DEV_ADDR << 8) + byte_offset; + sfp_addr = (dev_addr << 8) + byte_offset; sfp_addr = (sfp_addr | IXGBE_I2C_EEPROM_READ_MASK); hw->phy.ops.write_reg(hw, IXGBE_MDIO_PMA_PMD_SDA_SCL_ADDR, @@ -1158,7 +1157,6 @@ s32 ixgbe_read_i2c_eeprom_82598(struct i *eeprom_data = (u8)(sfp_data >> 8); } else { status = IXGBE_ERR_PHY; - goto out; } out: @@ -1166,6 +1164,36 @@ out: } /** + * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface. + * @hw: pointer to hardware structure + * @byte_offset: EEPROM byte offset to read + * @eeprom_data: value read + * + * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. + **/ +s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, + u8 *eeprom_data) +{ + return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR, + byte_offset, eeprom_data); +} + +/** + * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface. + * @hw: pointer to hardware structure + * @byte_offset: byte offset at address 0xA2 + * @eeprom_data: value read + * + * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C + **/ +static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset, + u8 *sff8472_data) +{ + return ixgbe_read_i2c_phy_82598(hw, IXGBE_I2C_EEPROM_DEV_ADDR2, + byte_offset, sff8472_data); +} + +/** * ixgbe_get_supported_physical_layer_82598 - Returns physical layer type * @hw: pointer to hardware structure * Modified: head/sys/dev/ixgbe/ixgbe_82599.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 4 22:41:49 2013 (r247821) +++ head/sys/dev/ixgbe/ixgbe_82599.c Mon Mar 4 23:07:40 2013 (r247822) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2012, Intel Corporation + Copyright (c) 2001-2013, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -40,7 +40,6 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed, - bool autoneg, bool autoneg_wait_to_complete); static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); static s32 ixgbe_read_eeprom_82599(struct ixgbe_hw *hw, @@ -48,14 +47,37 @@ static s32 ixgbe_read_eeprom_82599(struc static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset, u16 words, u16 *data); +static bool ixgbe_mng_enabled(struct ixgbe_hw *hw) +{ + u32 fwsm, manc, factps; + + fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM); + if ((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) + return FALSE; + + manc = IXGBE_READ_REG(hw, IXGBE_MANC); + if (!(manc & IXGBE_MANC_RCV_TCO_EN)) + return FALSE; + + factps = IXGBE_READ_REG(hw, IXGBE_FACTPS); + if (factps & IXGBE_FACTPS_MNGCG) + return FALSE; + + return TRUE; +} + void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) { struct ixgbe_mac_info *mac = &hw->mac; DEBUGFUNC("ixgbe_init_mac_link_ops_82599"); - /* enable the laser control functions for SFP+ fiber */ - if (mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) { + /* + * enable the laser control functions for SFP+ fiber + * and MNG not enabled + */ + if ((mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) && + !(ixgbe_mng_enabled(hw))) { mac->ops.disable_tx_laser = &ixgbe_disable_tx_laser_multispeed_fiber; mac->ops.enable_tx_laser = @@ -135,9 +157,8 @@ init_phy_ops_out: s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) { s32 ret_val = IXGBE_SUCCESS; - u32 reg_anlp1 = 0; - u32 i = 0; u16 list_offset, data_offset, data_value; + bool got_lock = FALSE; DEBUGFUNC("ixgbe_setup_sfp_modules_82599"); @@ -171,28 +192,39 @@ s32 ixgbe_setup_sfp_modules_82599(struct /* Delay obtaining semaphore again to allow FW access */ msec_delay(hw->eeprom.semaphore_delay); - /* Now restart DSP by setting Restart_AN and clearing LMS */ - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((IXGBE_READ_REG(hw, - IXGBE_AUTOC) & ~IXGBE_AUTOC_LMS_MASK) | - IXGBE_AUTOC_AN_RESTART)); - - /* Wait for AN to leave state 0 */ - for (i = 0; i < 10; i++) { - msec_delay(4); - reg_anlp1 = IXGBE_READ_REG(hw, IXGBE_ANLP1); - if (reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK) - break; + /* Need SW/FW semaphore around AUTOC writes if LESM on, + * likewise reset_pipeline requires lock as it also writes + * AUTOC. + */ + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + ret_val = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (ret_val != IXGBE_SUCCESS) { + ret_val = IXGBE_ERR_SWFW_SYNC; + goto setup_sfp_out; + } + + got_lock = TRUE; + } + + /* Restart DSP and set SFI mode */ + IXGBE_WRITE_REG(hw, IXGBE_AUTOC, ((hw->mac.orig_autoc) | + IXGBE_AUTOC_LMS_10G_SERIAL)); + hw->mac.cached_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); + ret_val = ixgbe_reset_pipeline_82599(hw); + + if (got_lock) { + hw->mac.ops.release_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + got_lock = FALSE; } - if (!(reg_anlp1 & IXGBE_ANLP1_AN_STATE_MASK)) { + + if (ret_val) { DEBUGOUT("sfp module setup not complete\n"); ret_val = IXGBE_ERR_SFP_SETUP_NOT_COMPLETE; goto setup_sfp_out; } - /* Restart DSP by setting Restart_AN and return to SFI mode */ - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, (IXGBE_READ_REG(hw, - IXGBE_AUTOC) | IXGBE_AUTOC_LMS_10G_SERIAL | - IXGBE_AUTOC_AN_RESTART)); } setup_sfp_out: @@ -216,7 +248,7 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw DEBUGFUNC("ixgbe_init_ops_82599"); - ret_val = ixgbe_init_phy_ops_generic(hw); + ixgbe_init_phy_ops_generic(hw); ret_val = ixgbe_init_ops_generic(hw); /* PHY */ @@ -289,13 +321,13 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw * ixgbe_get_link_capabilities_82599 - Determines link capabilities * @hw: pointer to hardware structure * @speed: pointer to link speed - * @negotiation: TRUE when autoneg or autotry is enabled + * @autoneg: TRUE when autoneg or autotry is enabled * * Determines the link capabilities by reading the AUTOC register. **/ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed, - bool *negotiation) + bool *autoneg) { s32 status = IXGBE_SUCCESS; u32 autoc = 0; @@ -309,7 +341,7 @@ s32 ixgbe_get_link_capabilities_82599(st hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { *speed = IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = TRUE; + *autoneg = TRUE; goto out; } @@ -326,22 +358,22 @@ s32 ixgbe_get_link_capabilities_82599(st switch (autoc & IXGBE_AUTOC_LMS_MASK) { case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = FALSE; + *autoneg = FALSE; break; case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_10GB_FULL; - *negotiation = FALSE; + *autoneg = FALSE; break; case IXGBE_AUTOC_LMS_1G_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = TRUE; + *autoneg = TRUE; break; case IXGBE_AUTOC_LMS_10G_SERIAL: *speed = IXGBE_LINK_SPEED_10GB_FULL; - *negotiation = FALSE; + *autoneg = FALSE; break; case IXGBE_AUTOC_LMS_KX4_KX_KR: @@ -353,7 +385,7 @@ s32 ixgbe_get_link_capabilities_82599(st *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (autoc & IXGBE_AUTOC_KX_SUPP) *speed |= IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = TRUE; + *autoneg = TRUE; break; case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII: @@ -364,12 +396,12 @@ s32 ixgbe_get_link_capabilities_82599(st *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (autoc & IXGBE_AUTOC_KX_SUPP) *speed |= IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = TRUE; + *autoneg = TRUE; break; case IXGBE_AUTOC_LMS_SGMII_1G_100M: *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL; - *negotiation = FALSE; + *autoneg = FALSE; break; default: @@ -381,7 +413,7 @@ s32 ixgbe_get_link_capabilities_82599(st if (hw->phy.multispeed_fiber) { *speed |= IXGBE_LINK_SPEED_10GB_FULL | IXGBE_LINK_SPEED_1GB_FULL; - *negotiation = TRUE; + *autoneg = TRUE; } out: @@ -424,6 +456,7 @@ enum ixgbe_media_type ixgbe_get_media_ty case IXGBE_DEV_ID_82599_SFP_FCOE: case IXGBE_DEV_ID_82599_SFP_EM: case IXGBE_DEV_ID_82599_SFP_SF2: + case IXGBE_DEV_ID_82599_SFP_SF_QP: case IXGBE_DEV_ID_82599EN_SFP: media_type = ixgbe_media_type_fiber; break; @@ -433,6 +466,10 @@ enum ixgbe_media_type ixgbe_get_media_ty case IXGBE_DEV_ID_82599_T3_LOM: media_type = ixgbe_media_type_copper; break; + case IXGBE_DEV_ID_82599_BYPASS: + media_type = ixgbe_media_type_fiber_fixed; + hw->phy.multispeed_fiber = TRUE; + break; default: media_type = ixgbe_media_type_unknown; break; @@ -456,17 +493,32 @@ s32 ixgbe_start_mac_link_82599(struct ix u32 links_reg; u32 i; s32 status = IXGBE_SUCCESS; + bool got_lock = FALSE; DEBUGFUNC("ixgbe_start_mac_link_82599"); + /* reset_pipeline requires us to hold this lock as it writes to + * AUTOC. + */ + if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { + status = hw->mac.ops.acquire_swfw_sync(hw, + IXGBE_GSSR_MAC_CSR_SM); + if (status != IXGBE_SUCCESS) + goto out; + + got_lock = TRUE; + } + /* Restart link */ - autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); - autoc_reg |= IXGBE_AUTOC_AN_RESTART; - IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); + ixgbe_reset_pipeline_82599(hw); + + if (got_lock) + hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM); /* Only poll for autoneg to complete if specified to do so */ if (autoneg_wait_to_complete) { + autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC); if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) == IXGBE_AUTOC_LMS_KX4_KX_KR || (autoc_reg & IXGBE_AUTOC_LMS_MASK) == @@ -490,6 +542,7 @@ s32 ixgbe_start_mac_link_82599(struct ix /* Add delay to filter out noises during initial link setup */ msec_delay(50); +out: return status; } @@ -555,16 +608,84 @@ void ixgbe_flap_tx_laser_multispeed_fibe } /** + * ixgbe_set_fiber_fixed_speed - Set module link speed for fixed fiber + * @hw: pointer to hardware structure + * @speed: link speed to set + * + * We set the module speed differently for fixed fiber. For other + * multi-speed devices we don't have an error value so here if we + * detect an error we just log it and exit. + */ +static void ixgbe_set_fiber_fixed_speed(struct ixgbe_hw *hw, + ixgbe_link_speed speed) +{ + s32 status; + u8 rs, eeprom_data; + + switch (speed) { + case IXGBE_LINK_SPEED_10GB_FULL: + /* one bit mask same as setting on */ + rs = IXGBE_SFF_SOFT_RS_SELECT_10G; + break; + case IXGBE_LINK_SPEED_1GB_FULL: + rs = IXGBE_SFF_SOFT_RS_SELECT_1G; + break; + default: + DEBUGOUT("Invalid fixed module speed\n"); + return; + } + + /* Set RS0 */ + status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, + IXGBE_I2C_EEPROM_DEV_ADDR2, + &eeprom_data); + if (status) { + DEBUGOUT("Failed to read Rx Rate Select RS0\n"); + goto out; + } + + eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs; + + status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_OSCB, + IXGBE_I2C_EEPROM_DEV_ADDR2, + eeprom_data); + if (status) { + DEBUGOUT("Failed to write Rx Rate Select RS0\n"); + goto out; + } + + /* Set RS1 */ + status = hw->phy.ops.read_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, + IXGBE_I2C_EEPROM_DEV_ADDR2, + &eeprom_data); + if (status) { + DEBUGOUT("Failed to read Rx Rate Select RS1\n"); + goto out; + } + + eeprom_data = (eeprom_data & ~IXGBE_SFF_SOFT_RS_SELECT_MASK) & rs; + + status = hw->phy.ops.write_i2c_byte(hw, IXGBE_SFF_SFF_8472_ESCB, + IXGBE_I2C_EEPROM_DEV_ADDR2, + eeprom_data); + if (status) { + DEBUGOUT("Failed to write Rx Rate Select RS1\n"); + goto out; + } +out: + return; +} + +/** * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. **/ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, - ixgbe_link_speed speed, bool autoneg, + ixgbe_link_speed speed, bool autoneg_wait_to_complete) { s32 status = IXGBE_SUCCESS; @@ -573,13 +694,12 @@ s32 ixgbe_setup_mac_link_multispeed_fibe u32 speedcnt = 0; u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); u32 i = 0; - bool link_up = FALSE; - bool negotiation; + bool autoneg, link_up = FALSE; DEBUGFUNC("ixgbe_setup_mac_link_multispeed_fiber"); /* Mask off requested but non-supported speeds */ - status = ixgbe_get_link_capabilities(hw, &link_speed, &negotiation); + status = ixgbe_get_link_capabilities(hw, &link_speed, &autoneg); if (status != IXGBE_SUCCESS) return status; @@ -602,16 +722,20 @@ s32 ixgbe_setup_mac_link_multispeed_fibe goto out; /* Set the module link speed */ - esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); - IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); - IXGBE_WRITE_FLUSH(hw); + if (hw->phy.media_type == ixgbe_media_type_fiber_fixed) { + ixgbe_set_fiber_fixed_speed(hw, + IXGBE_LINK_SPEED_10GB_FULL); + } else { + esdp_reg |= (IXGBE_ESDP_SDP5_DIR | IXGBE_ESDP_SDP5); + IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); + IXGBE_WRITE_FLUSH(hw); + } /* Allow module to change analog characteristics (1G->10G) */ msec_delay(40); status = ixgbe_setup_mac_link_82599(hw, IXGBE_LINK_SPEED_10GB_FULL, - autoneg, autoneg_wait_to_complete); if (status != IXGBE_SUCCESS) return status; @@ -653,17 +777,21 @@ s32 ixgbe_setup_mac_link_multispeed_fibe goto out; /* Set the module link speed */ - esdp_reg &= ~IXGBE_ESDP_SDP5; - esdp_reg |= IXGBE_ESDP_SDP5_DIR; - IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); - IXGBE_WRITE_FLUSH(hw); + if (hw->phy.media_type == ixgbe_media_type_fiber_fixed) { + ixgbe_set_fiber_fixed_speed(hw, + IXGBE_LINK_SPEED_1GB_FULL); + } else { + esdp_reg &= ~IXGBE_ESDP_SDP5; + esdp_reg |= IXGBE_ESDP_SDP5_DIR; + IXGBE_WRITE_REG(hw, IXGBE_ESDP, esdp_reg); + IXGBE_WRITE_FLUSH(hw); + } /* Allow module to change analog characteristics (10G->1G) */ msec_delay(40); status = ixgbe_setup_mac_link_82599(hw, IXGBE_LINK_SPEED_1GB_FULL, - autoneg, autoneg_wait_to_complete); if (status != IXGBE_SUCCESS) return status; @@ -690,7 +818,7 @@ s32 ixgbe_setup_mac_link_multispeed_fibe */ if (speedcnt > 1) status = ixgbe_setup_mac_link_multispeed_fiber(hw, - highest_link_speed, autoneg, autoneg_wait_to_complete); + highest_link_speed, autoneg_wait_to_complete); out: /* Set autoneg_advertised value based on input link speed */ @@ -709,13 +837,12 @@ out: * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Implements the Intel SmartSpeed algorithm. **/ s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, - ixgbe_link_speed speed, bool autoneg, + ixgbe_link_speed speed, bool autoneg_wait_to_complete) { s32 status = IXGBE_SUCCESS; @@ -748,7 +875,7 @@ s32 ixgbe_setup_mac_link_smartspeed(stru /* First, try to get link with full advertisement */ hw->phy.smart_speed_active = FALSE; for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) { - status = ixgbe_setup_mac_link_82599(hw, speed, autoneg, + status = ixgbe_setup_mac_link_82599(hw, speed, autoneg_wait_to_complete); if (status != IXGBE_SUCCESS) goto out; @@ -783,7 +910,7 @@ s32 ixgbe_setup_mac_link_smartspeed(stru /* Turn SmartSpeed on to disable KR support */ hw->phy.smart_speed_active = TRUE; - status = ixgbe_setup_mac_link_82599(hw, speed, autoneg, + status = ixgbe_setup_mac_link_82599(hw, speed, autoneg_wait_to_complete); if (status != IXGBE_SUCCESS) goto out; @@ -808,7 +935,7 @@ s32 ixgbe_setup_mac_link_smartspeed(stru /* We didn't get link. Turn SmartSpeed back off. */ hw->phy.smart_speed_active = FALSE; - status = ixgbe_setup_mac_link_82599(hw, speed, autoneg, + status = ixgbe_setup_mac_link_82599(hw, speed, autoneg_wait_to_complete); out: @@ -822,32 +949,30 @@ out: * ixgbe_setup_mac_link_82599 - Set MAC link speed * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg: TRUE if autonegotiation enabled * @autoneg_wait_to_complete: TRUE when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. **/ s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, - ixgbe_link_speed speed, bool autoneg, + ixgbe_link_speed speed, bool autoneg_wait_to_complete) { + bool autoneg = FALSE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Mar 4 23:15:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4B739471; Mon, 4 Mar 2013 23:15:08 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3D15B1DC; Mon, 4 Mar 2013 23:15:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r24NF8u4030773; Mon, 4 Mar 2013 23:15:08 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r24NF8rG030772; Mon, 4 Mar 2013 23:15:08 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201303042315.r24NF8rG030772@svn.freebsd.org> From: Jack F Vogel Date: Mon, 4 Mar 2013 23:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247823 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Mar 2013 23:15:08 -0000 Author: jfv Date: Mon Mar 4 23:15:07 2013 New Revision: 247823 URL: http://svnweb.freebsd.org/changeset/base/247823 Log: Fix a small, but important bug, a task drain was mistakenly being compiled only when setting LEGACY_TX, this means you would not get the drain when needed on detach!! Thanks to Bryan Venteicher (bryanv@freebsd.org) for catching this little gremlin!! :) Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Mar 4 23:07:40 2013 (r247822) +++ head/sys/dev/ixgbe/ixgbe.c Mon Mar 4 23:15:07 2013 (r247823) @@ -654,7 +654,7 @@ ixgbe_detach(device_t dev) for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { if (que->tq) { -#ifdef IXGBE_LEGACY_TX +#ifndef IXGBE_LEGACY_TX taskqueue_drain(que->tq, &txr->txq_task); #endif taskqueue_drain(que->tq, &que->que_task); From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 07:00:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 69BA8E13; Tue, 5 Mar 2013 07:00:06 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D0BB5EE; Tue, 5 Mar 2013 07:00:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25706M2068979; Tue, 5 Mar 2013 07:00:06 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r257066g068978; Tue, 5 Mar 2013 07:00:06 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303050700.r257066g068978@svn.freebsd.org> From: Bryan Venteicher Date: Tue, 5 Mar 2013 07:00:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247829 - head/sys/dev/virtio/block X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 07:00:06 -0000 Author: bryanv Date: Tue Mar 5 07:00:05 2013 New Revision: 247829 URL: http://svnweb.freebsd.org/changeset/base/247829 Log: Only set the barrier flag if the feature was negotiated When the VirtIO barrier feature is not negotiated, the driver must enforce the proper ordering for BIO_ORDERED BIOs. All the in-flight BIOs must complete before starting the BIO, and the ordered BIO must complete before subsequent BIOs can start. Also fix a few whitespace nits. Reported by: neel Approved by: grehan (mentor) MFC after: 3 days Modified: head/sys/dev/virtio/block/virtio_blk.c Modified: head/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.c Tue Mar 5 06:43:54 2013 (r247828) +++ head/sys/dev/virtio/block/virtio_blk.c Tue Mar 5 07:00:05 2013 (r247829) @@ -72,6 +72,7 @@ struct vtblk_softc { #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 #define VTBLK_FLAG_DUMPING 0x0010 +#define VTBLK_FLAG_BARRIER 0x0020 struct virtqueue *vtblk_vq; struct sglist *vtblk_sglist; @@ -81,7 +82,8 @@ struct vtblk_softc { TAILQ_HEAD(, vtblk_request) vtblk_req_free; TAILQ_HEAD(, vtblk_request) - vtblk_req_ready; + vtblk_req_ready; + struct vtblk_request *vtblk_req_ordered; struct taskqueue *vtblk_tq; struct task vtblk_intr_task; @@ -278,9 +280,10 @@ vtblk_attach(device_t dev) if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; - if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) sc->vtblk_flags |= VTBLK_FLAG_READONLY; + if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER)) + sc->vtblk_flags |= VTBLK_FLAG_BARRIER; /* Get local copy of config. */ virtio_read_device_config(dev, 0, &blkcfg, @@ -766,25 +769,45 @@ vtblk_bio_request(struct vtblk_softc *sc bp->bio_cmd); } - if (bp->bio_flags & BIO_ORDERED) - req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; - return (req); } static int vtblk_execute_request(struct vtblk_softc *sc, struct vtblk_request *req) { + struct virtqueue *vq; struct sglist *sg; struct bio *bp; - int readable, writable, error; + int ordered, readable, writable, error; + vq = sc->vtblk_vq; sg = sc->vtblk_sglist; bp = req->vbr_bp; + ordered = 0; writable = 0; VTBLK_LOCK_ASSERT(sc); + /* + * Wait until the ordered request completes before + * executing subsequent requests. + */ + if (sc->vtblk_req_ordered != NULL) + return (EBUSY); + + if (bp->bio_flags & BIO_ORDERED) { + if ((sc->vtblk_flags & VTBLK_FLAG_BARRIER) == 0) { + /* + * This request will be executed once all + * the in-flight requests are completed. + */ + if (!virtqueue_empty(vq)) + return (EBUSY); + ordered = 1; + } else + req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; + } + sglist_reset(sg); sglist_append(sg, &req->vbr_hdr, sizeof(struct virtio_blk_outhdr)); @@ -802,10 +825,13 @@ vtblk_execute_request(struct vtblk_softc writable++; sglist_append(sg, &req->vbr_ack, sizeof(uint8_t)); - readable = sg->sg_nseg - writable; - return (virtqueue_enqueue(sc->vtblk_vq, req, sg, readable, writable)); + error = virtqueue_enqueue(vq, req, sg, readable, writable); + if (error == 0 && ordered) + sc->vtblk_req_ordered = req; + + return (error); } static int @@ -1013,6 +1039,12 @@ vtblk_finish_completed(struct vtblk_soft while ((req = virtqueue_dequeue(sc->vtblk_vq, NULL)) != NULL) { bp = req->vbr_bp; + if (sc->vtblk_req_ordered != NULL) { + /* This should be the only outstanding request. */ + MPASS(sc->vtblk_req_ordered == req); + sc->vtblk_req_ordered = NULL; + } + error = vtblk_request_error(req); if (error) disk_err(bp, "hard error", -1, 1); @@ -1039,6 +1071,7 @@ vtblk_drain_vq(struct vtblk_softc *sc, i vtblk_enqueue_request(sc, req); } + sc->vtblk_req_ordered = NULL; KASSERT(virtqueue_empty(vq), ("virtqueue not empty")); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 07:20:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0AAFF302; Tue, 5 Mar 2013 07:20:05 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id C2A0B6A6; Tue, 5 Mar 2013 07:20:03 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 14C1D7300A; Tue, 5 Mar 2013 08:20:40 +0100 (CET) Date: Tue, 5 Mar 2013 08:20:40 +0100 From: Luigi Rizzo To: Alexander Motin Subject: Re: svn commit: r247792 - head/sys/dev/syscons Message-ID: <20130305072040.GB13187@onelab2.iet.unipi.it> References: <201303041400.r24E0xOo076175@svn.freebsd.org> <20130304144216.GA63659@onelab2.iet.unipi.it> <5134B5F5.7000204@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5134B5F5.7000204@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Davide Italiano , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 07:20:05 -0000 On Mon, Mar 04, 2013 at 04:55:49PM +0200, Alexander Motin wrote: > On 04.03.2013 16:42, Luigi Rizzo wrote: > > On Mon, Mar 04, 2013 at 02:00:59PM +0000, Davide Italiano wrote: ... > >> - Reduce syscons "refresh" rate to 1-2Hz when console is in graphics mode > >> and there is nothing to do except some polling for keyboard. Text mode > > > > just to understand, how does this 1-2Hz affect the respose to keypresses ? > > does it mean it takes 0.5..1s to see the keypress ? > > No, it is a polling for keyboard presence, and its rate already limited > to 1Hz by comparing kbd_time_stamp to time_uptime there. perfect, thanks for the clarification cheers luigi From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 08:08:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 75259FA0; Tue, 5 Mar 2013 08:08:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58D8D84F; Tue, 5 Mar 2013 08:08:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2588Hpi090234; Tue, 5 Mar 2013 08:08:17 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2588HYo090232; Tue, 5 Mar 2013 08:08:17 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303050808.r2588HYo090232@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 5 Mar 2013 08:08:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247830 - head/sys/contrib/altq/altq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 08:08:17 -0000 Author: glebius Date: Tue Mar 5 08:08:16 2013 New Revision: 247830 URL: http://svnweb.freebsd.org/changeset/base/247830 Log: Simplify TAILQ usage and avoid additional memory allocations. Tested by: Eugene M. Zheganin Sponsored by: Nginx, Inc Modified: head/sys/contrib/altq/altq/altq_hfsc.c head/sys/contrib/altq/altq/altq_hfsc.h Modified: head/sys/contrib/altq/altq/altq_hfsc.c ============================================================================== --- head/sys/contrib/altq/altq/altq_hfsc.c Tue Mar 5 07:00:05 2013 (r247829) +++ head/sys/contrib/altq/altq/altq_hfsc.c Tue Mar 5 08:08:16 2013 (r247830) @@ -104,14 +104,10 @@ static void update_ed(struct hfsc_clas static void update_d(struct hfsc_class *, int); static void init_vf(struct hfsc_class *, int); static void update_vf(struct hfsc_class *, int, u_int64_t); -static ellist_t *ellist_alloc(void); -static void ellist_destroy(ellist_t *); static void ellist_insert(struct hfsc_class *); static void ellist_remove(struct hfsc_class *); static void ellist_update(struct hfsc_class *); -struct hfsc_class *ellist_get_mindl(ellist_t *, u_int64_t); -static actlist_t *actlist_alloc(void); -static void actlist_destroy(actlist_t *); +struct hfsc_class *hfsc_get_mindl(struct hfsc_if *, u_int64_t); static void actlist_insert(struct hfsc_class *); static void actlist_remove(struct hfsc_class *); static void actlist_update(struct hfsc_class *); @@ -204,12 +200,7 @@ hfsc_add_altq(struct pf_altq *a) if (hif == NULL) return (ENOMEM); - hif->hif_eligible = ellist_alloc(); - if (hif->hif_eligible == NULL) { - free(hif, M_DEVBUF); - return (ENOMEM); - } - + TAILQ_INIT(&hif->hif_eligible); hif->hif_ifq = &ifp->if_snd; /* keep the state in pf_altq */ @@ -230,8 +221,6 @@ hfsc_remove_altq(struct pf_altq *a) (void)hfsc_clear_interface(hif); (void)hfsc_class_destroy(hif->hif_rootclass); - ellist_destroy(hif->hif_eligible); - free(hif, M_DEVBUF); return (0); @@ -408,9 +397,7 @@ hfsc_class_create(struct hfsc_if *hif, s if (cl->cl_q == NULL) goto err_ret; - cl->cl_actc = actlist_alloc(); - if (cl->cl_actc == NULL) - goto err_ret; + TAILQ_INIT(&cl->cl_actc); if (qlimit == 0) qlimit = 50; /* use default */ @@ -544,8 +531,6 @@ hfsc_class_create(struct hfsc_if *hif, s return (cl); err_ret: - if (cl->cl_actc != NULL) - actlist_destroy(cl->cl_actc); if (cl->cl_red != NULL) { #ifdef ALTQ_RIO if (q_is_rio(cl->cl_q)) @@ -620,8 +605,6 @@ hfsc_class_destroy(struct hfsc_class *cl IFQ_UNLOCK(cl->cl_hif->hif_ifq); splx(s); - actlist_destroy(cl->cl_actc); - if (cl->cl_red != NULL) { #ifdef ALTQ_RIO if (q_is_rio(cl->cl_q)) @@ -774,7 +757,7 @@ hfsc_dequeue(struct ifaltq *ifq, int op) * find the class with the minimum deadline among * the eligible classes. */ - if ((cl = ellist_get_mindl(hif->hif_eligible, cur_time)) + if ((cl = hfsc_get_mindl(hif, cur_time)) != NULL) { realtime = 1; } else { @@ -994,7 +977,7 @@ init_vf(struct hfsc_class *cl, int len) go_active = 0; if (go_active) { - max_cl = actlist_last(cl->cl_parent->cl_actc); + max_cl = TAILQ_LAST(&cl->cl_parent->cl_actc, acthead); if (max_cl != NULL) { /* * set vt to the average of the min and max @@ -1159,12 +1142,12 @@ update_cfmin(struct hfsc_class *cl) struct hfsc_class *p; u_int64_t cfmin; - if (TAILQ_EMPTY(cl->cl_actc)) { + if (TAILQ_EMPTY(&cl->cl_actc)) { cl->cl_cfmin = 0; return; } cfmin = HT_INFINITY; - TAILQ_FOREACH(p, cl->cl_actc, cl_actlist) { + TAILQ_FOREACH(p, &cl->cl_actc, cl_actlist) { if (p->cl_f == 0) { cl->cl_cfmin = 0; return; @@ -1184,22 +1167,6 @@ update_cfmin(struct hfsc_class *cl) * there is one eligible list per interface. */ -static ellist_t * -ellist_alloc(void) -{ - ellist_t *head; - - head = malloc(sizeof(ellist_t), M_DEVBUF, M_WAITOK); - TAILQ_INIT(head); - return (head); -} - -static void -ellist_destroy(ellist_t *head) -{ - free(head, M_DEVBUF); -} - static void ellist_insert(struct hfsc_class *cl) { @@ -1207,13 +1174,13 @@ ellist_insert(struct hfsc_class *cl) struct hfsc_class *p; /* check the last entry first */ - if ((p = TAILQ_LAST(hif->hif_eligible, _eligible)) == NULL || + if ((p = TAILQ_LAST(&hif->hif_eligible, elighead)) == NULL || p->cl_e <= cl->cl_e) { - TAILQ_INSERT_TAIL(hif->hif_eligible, cl, cl_ellist); + TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist); return; } - TAILQ_FOREACH(p, hif->hif_eligible, cl_ellist) { + TAILQ_FOREACH(p, &hif->hif_eligible, cl_ellist) { if (cl->cl_e < p->cl_e) { TAILQ_INSERT_BEFORE(p, cl, cl_ellist); return; @@ -1227,7 +1194,7 @@ ellist_remove(struct hfsc_class *cl) { struct hfsc_if *hif = cl->cl_hif; - TAILQ_REMOVE(hif->hif_eligible, cl, cl_ellist); + TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist); } static void @@ -1245,11 +1212,11 @@ ellist_update(struct hfsc_class *cl) return; /* check the last entry */ - last = TAILQ_LAST(hif->hif_eligible, _eligible); + last = TAILQ_LAST(&hif->hif_eligible, elighead); ASSERT(last != NULL); if (last->cl_e <= cl->cl_e) { - TAILQ_REMOVE(hif->hif_eligible, cl, cl_ellist); - TAILQ_INSERT_TAIL(hif->hif_eligible, cl, cl_ellist); + TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist); + TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist); return; } @@ -1259,7 +1226,7 @@ ellist_update(struct hfsc_class *cl) */ while ((p = TAILQ_NEXT(p, cl_ellist)) != NULL) { if (cl->cl_e < p->cl_e) { - TAILQ_REMOVE(hif->hif_eligible, cl, cl_ellist); + TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist); TAILQ_INSERT_BEFORE(p, cl, cl_ellist); return; } @@ -1269,11 +1236,11 @@ ellist_update(struct hfsc_class *cl) /* find the class with the minimum deadline among the eligible classes */ struct hfsc_class * -ellist_get_mindl(ellist_t *head, u_int64_t cur_time) +hfsc_get_mindl(struct hfsc_if *hif, u_int64_t cur_time) { struct hfsc_class *p, *cl = NULL; - TAILQ_FOREACH(p, head, cl_ellist) { + TAILQ_FOREACH(p, &hif->hif_eligible, cl_ellist) { if (p->cl_e > cur_time) break; if (cl == NULL || p->cl_d < cl->cl_d) @@ -1287,34 +1254,20 @@ ellist_get_mindl(ellist_t *head, u_int64 * by their virtual time. * each intermediate class has one active children list. */ -static actlist_t * -actlist_alloc(void) -{ - actlist_t *head; - - head = malloc(sizeof(actlist_t), M_DEVBUF, M_WAITOK); - TAILQ_INIT(head); - return (head); -} static void -actlist_destroy(actlist_t *head) -{ - free(head, M_DEVBUF); -} -static void actlist_insert(struct hfsc_class *cl) { struct hfsc_class *p; /* check the last entry first */ - if ((p = TAILQ_LAST(cl->cl_parent->cl_actc, _active)) == NULL + if ((p = TAILQ_LAST(&cl->cl_parent->cl_actc, acthead)) == NULL || p->cl_vt <= cl->cl_vt) { - TAILQ_INSERT_TAIL(cl->cl_parent->cl_actc, cl, cl_actlist); + TAILQ_INSERT_TAIL(&cl->cl_parent->cl_actc, cl, cl_actlist); return; } - TAILQ_FOREACH(p, cl->cl_parent->cl_actc, cl_actlist) { + TAILQ_FOREACH(p, &cl->cl_parent->cl_actc, cl_actlist) { if (cl->cl_vt < p->cl_vt) { TAILQ_INSERT_BEFORE(p, cl, cl_actlist); return; @@ -1326,7 +1279,7 @@ actlist_insert(struct hfsc_class *cl) static void actlist_remove(struct hfsc_class *cl) { - TAILQ_REMOVE(cl->cl_parent->cl_actc, cl, cl_actlist); + TAILQ_REMOVE(&cl->cl_parent->cl_actc, cl, cl_actlist); } static void @@ -1344,11 +1297,11 @@ actlist_update(struct hfsc_class *cl) return; /* check the last entry */ - last = TAILQ_LAST(cl->cl_parent->cl_actc, _active); + last = TAILQ_LAST(&cl->cl_parent->cl_actc, acthead); ASSERT(last != NULL); if (last->cl_vt <= cl->cl_vt) { - TAILQ_REMOVE(cl->cl_parent->cl_actc, cl, cl_actlist); - TAILQ_INSERT_TAIL(cl->cl_parent->cl_actc, cl, cl_actlist); + TAILQ_REMOVE(&cl->cl_parent->cl_actc, cl, cl_actlist); + TAILQ_INSERT_TAIL(&cl->cl_parent->cl_actc, cl, cl_actlist); return; } @@ -1358,7 +1311,7 @@ actlist_update(struct hfsc_class *cl) */ while ((p = TAILQ_NEXT(p, cl_actlist)) != NULL) { if (cl->cl_vt < p->cl_vt) { - TAILQ_REMOVE(cl->cl_parent->cl_actc, cl, cl_actlist); + TAILQ_REMOVE(&cl->cl_parent->cl_actc, cl, cl_actlist); TAILQ_INSERT_BEFORE(p, cl, cl_actlist); return; } @@ -1371,7 +1324,7 @@ actlist_firstfit(struct hfsc_class *cl, { struct hfsc_class *p; - TAILQ_FOREACH(p, cl->cl_actc, cl_actlist) { + TAILQ_FOREACH(p, &cl->cl_actc, cl_actlist) { if (p->cl_f <= cur_time) return (p); } Modified: head/sys/contrib/altq/altq/altq_hfsc.h ============================================================================== --- head/sys/contrib/altq/altq/altq_hfsc.h Tue Mar 5 07:00:05 2013 (r247829) +++ head/sys/contrib/altq/altq/altq_hfsc.h Tue Mar 5 08:08:16 2013 (r247830) @@ -218,16 +218,6 @@ struct runtime_sc { u_int64_t ism2; /* scaled inverse-slope of the 2nd segment */ }; -/* for TAILQ based ellist and actlist implementation */ -struct hfsc_class; -typedef TAILQ_HEAD(_eligible, hfsc_class) ellist_t; -typedef TAILQ_ENTRY(hfsc_class) elentry_t; -typedef TAILQ_HEAD(_active, hfsc_class) actlist_t; -typedef TAILQ_ENTRY(hfsc_class) actentry_t; -#define ellist_first(s) TAILQ_FIRST(s) -#define actlist_first(s) TAILQ_FIRST(s) -#define actlist_last(s) TAILQ_LAST(s, _active) - struct hfsc_class { u_int cl_id; /* class id (just for debug) */ u_int32_t cl_handle; /* class handle */ @@ -277,10 +267,10 @@ struct hfsc_class { u_int cl_vtperiod; /* vt period sequence no */ u_int cl_parentperiod; /* parent's vt period seqno */ int cl_nactive; /* number of active children */ - actlist_t *cl_actc; /* active children list */ - actentry_t cl_actlist; /* active children list entry */ - elentry_t cl_ellist; /* eligible list entry */ + TAILQ_HEAD(acthead, hfsc_class) cl_actc; /* active children list */ + TAILQ_ENTRY(hfsc_class) cl_actlist; /* active children list entry */ + TAILQ_ENTRY(hfsc_class) cl_ellist; /* eligible list entry */ struct { struct pktcntr xmit_cnt; @@ -304,7 +294,7 @@ struct hfsc_if { u_int hif_packets; /* # of packets in the tree */ u_int hif_classid; /* class id sequence number */ - ellist_t *hif_eligible; /* eligible list */ + TAILQ_HEAD(elighead, hfsc_class) hif_eligible; /* eligible list */ #ifdef ALTQ3_CLFIER_COMPAT struct acc_classifier hif_classifier; From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 09:07:02 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8553F12B; Tue, 5 Mar 2013 09:07:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 73D81A7F; Tue, 5 Mar 2013 09:07:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25972rK008180; Tue, 5 Mar 2013 09:07:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25972JH008179; Tue, 5 Mar 2013 09:07:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303050907.r25972JH008179@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 09:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247832 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 09:07:02 -0000 Author: kib Date: Tue Mar 5 09:07:01 2013 New Revision: 247832 URL: http://svnweb.freebsd.org/changeset/base/247832 Log: Import the likely() compat macro. Sponsored by: The FreeBSD Foundation MFC after: 1 month Modified: head/sys/dev/drm2/drmP.h Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Tue Mar 5 08:09:53 2013 (r247831) +++ head/sys/dev/drm2/drmP.h Tue Mar 5 09:07:01 2013 (r247832) @@ -228,6 +228,7 @@ typedef void irqreturn_t; #define IRQ_NONE /* nothing */ #define unlikely(x) __builtin_expect(!!(x), 0) +#define likely(x) __builtin_expect((x), 0) #define container_of(ptr, type, member) ({ \ __typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 09:07:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 46DF5347; Tue, 5 Mar 2013 09:07:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 17921A90; Tue, 5 Mar 2013 09:07:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2597wlm008375; Tue, 5 Mar 2013 09:07:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2597wbk008373; Tue, 5 Mar 2013 09:07:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303050907.r2597wbk008373@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 09:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247833 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 09:07:59 -0000 Author: kib Date: Tue Mar 5 09:07:58 2013 New Revision: 247833 URL: http://svnweb.freebsd.org/changeset/base/247833 Log: Import the drm_mm_debug_table() function. Sponsored by: The FreeBSD Foundation MFC after: 1 month Modified: head/sys/dev/drm2/drm_mm.c head/sys/dev/drm2/drm_mm.h Modified: head/sys/dev/drm2/drm_mm.c ============================================================================== --- head/sys/dev/drm2/drm_mm.c Tue Mar 5 09:07:01 2013 (r247832) +++ head/sys/dev/drm2/drm_mm.c Tue Mar 5 09:07:58 2013 (r247833) @@ -561,3 +561,40 @@ void drm_mm_takedown(struct drm_mm * mm) KASSERT(mm->num_unused == 0, ("num_unused != 0")); } + +void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) +{ + struct drm_mm_node *entry; + unsigned long total_used = 0, total_free = 0, total = 0; + unsigned long hole_start, hole_end, hole_size; + + hole_start = drm_mm_hole_node_start(&mm->head_node); + hole_end = drm_mm_hole_node_end(&mm->head_node); + hole_size = hole_end - hole_start; + if (hole_size) + printf("%s 0x%08lx-0x%08lx: %8lu: free\n", + prefix, hole_start, hole_end, + hole_size); + total_free += hole_size; + + drm_mm_for_each_node(entry, mm) { + printf("%s 0x%08lx-0x%08lx: %8lu: used\n", + prefix, entry->start, entry->start + entry->size, + entry->size); + total_used += entry->size; + + if (entry->hole_follows) { + hole_start = drm_mm_hole_node_start(entry); + hole_end = drm_mm_hole_node_end(entry); + hole_size = hole_end - hole_start; + printf("%s 0x%08lx-0x%08lx: %8lu: free\n", + prefix, hole_start, hole_end, + hole_size); + total_free += hole_size; + } + } + total = total_free + total_used; + + printf("%s total: %lu, used %lu free %lu\n", prefix, total, + total_used, total_free); +} Modified: head/sys/dev/drm2/drm_mm.h ============================================================================== --- head/sys/dev/drm2/drm_mm.h Tue Mar 5 09:07:01 2013 (r247832) +++ head/sys/dev/drm2/drm_mm.h Tue Mar 5 09:07:58 2013 (r247833) @@ -182,4 +182,6 @@ void drm_mm_init_scan_with_range(struct int drm_mm_scan_add_block(struct drm_mm_node *node); int drm_mm_scan_remove_block(struct drm_mm_node *node); +void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); + #endif From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 09:27:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 69C98DB7; Tue, 5 Mar 2013 09:27:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D2D7D9A; Tue, 5 Mar 2013 09:27:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r259RMhA014251; Tue, 5 Mar 2013 09:27:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r259RLDH014246; Tue, 5 Mar 2013 09:27:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303050927.r259RLDH014246@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 09:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247834 - in head/sys: dev/drm2 modules/drm2/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 09:27:22 -0000 Author: kib Date: Tue Mar 5 09:27:21 2013 New Revision: 247834 URL: http://svnweb.freebsd.org/changeset/base/247834 Log: Import the drm_global references helpers. Sponsored by: The FreeBSD Foundation MFC after: 1 month Added: head/sys/dev/drm2/drm_global.c (contents, props changed) head/sys/dev/drm2/drm_global.h (contents, props changed) Modified: head/sys/modules/drm2/drm2/Makefile Added: head/sys/dev/drm2/drm_global.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_global.c Tue Mar 5 09:27:21 2013 (r247834) @@ -0,0 +1,109 @@ +/************************************************************************** + * + * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Thomas Hellstrom + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +MALLOC_DEFINE(M_DRM_GLOBAL, "drm_global", "DRM Global Items"); + +struct drm_global_item { + struct sx mutex; + void *object; + int refcount; +}; + +static struct drm_global_item glob[DRM_GLOBAL_NUM]; + +void drm_global_init(void) +{ + int i; + + for (i = 0; i < DRM_GLOBAL_NUM; ++i) { + struct drm_global_item *item = &glob[i]; + sx_init(&item->mutex, "drmgi"); + item->object = NULL; + item->refcount = 0; + } +} + +void drm_global_release(void) +{ + int i; + for (i = 0; i < DRM_GLOBAL_NUM; ++i) { + struct drm_global_item *item = &glob[i]; + MPASS(item->object == NULL); + MPASS(item->refcount == 0); + } +} + +int drm_global_item_ref(struct drm_global_reference *ref) +{ + int ret; + struct drm_global_item *item = &glob[ref->global_type]; + void *object; + + sx_xlock(&item->mutex); + if (item->refcount == 0) { + item->object = malloc(ref->size, M_DRM_GLOBAL, + M_WAITOK | M_ZERO); + + ref->object = item->object; + ret = ref->init(ref); + if (unlikely(ret != 0)) + goto out_err; + + } + ++item->refcount; + ref->object = item->object; + object = item->object; + sx_xunlock(&item->mutex); + return 0; +out_err: + sx_xunlock(&item->mutex); + item->object = NULL; + return ret; +} + +void drm_global_item_unref(struct drm_global_reference *ref) +{ + struct drm_global_item *item = &glob[ref->global_type]; + + sx_xlock(&item->mutex); + MPASS(item->refcount != 0); + MPASS(ref->object == item->object); + if (--item->refcount == 0) { + ref->release(ref); + item->object = NULL; + } + sx_xunlock(&item->mutex); +} Added: head/sys/dev/drm2/drm_global.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/drm_global.h Tue Mar 5 09:27:21 2013 (r247834) @@ -0,0 +1,56 @@ +/************************************************************************** + * + * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Thomas Hellstrom + */ +/* $FreeBSD$ */ + +#ifndef _DRM_GLOBAL_H_ +#define _DRM_GLOBAL_H_ +enum drm_global_types { + DRM_GLOBAL_TTM_MEM = 0, + DRM_GLOBAL_TTM_BO, + DRM_GLOBAL_TTM_OBJECT, + DRM_GLOBAL_NUM +}; + +struct drm_global_reference { + enum drm_global_types global_type; + size_t size; + void *object; + int (*init) (struct drm_global_reference *); + void (*release) (struct drm_global_reference *); +}; + +extern void drm_global_init(void); +extern void drm_global_release(void); +extern int drm_global_item_ref(struct drm_global_reference *ref); +extern void drm_global_item_unref(struct drm_global_reference *ref); + +MALLOC_DECLARE(M_DRM_GLOBAL); + +#endif Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Tue Mar 5 09:07:58 2013 (r247833) +++ head/sys/modules/drm2/drm2/Makefile Tue Mar 5 09:27:21 2013 (r247834) @@ -18,6 +18,7 @@ SRCS = \ drm_fops.c \ drm_gem.c \ drm_gem_names.c \ + drm_global.c \ drm_hashtab.c \ drm_ioctl.c \ drm_irq.c \ From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 09:49:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9CCF7BC4; Tue, 5 Mar 2013 09:49:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F5D111A; Tue, 5 Mar 2013 09:49:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r259nZ5X020427; Tue, 5 Mar 2013 09:49:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r259nYRn020421; Tue, 5 Mar 2013 09:49:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303050949.r259nYRn020421@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 09:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247835 - in head/sys: dev/drm2 dev/drm2/ttm modules/drm2/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 09:49:35 -0000 Author: kib Date: Tue Mar 5 09:49:34 2013 New Revision: 247835 URL: http://svnweb.freebsd.org/changeset/base/247835 Log: Import the preliminary port of the TTM. The early commit is done to facilitate the off-tree work on the porting of the Radeon driver. Sponsored by: The FreeBSD Foundation Debugged and tested by: dumbbell MFC after: 1 month Added: head/sys/dev/drm2/ttm/ head/sys/dev/drm2/ttm/ttm_agp_backend.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo_api.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo_driver.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo_manager.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo_util.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_bo_vm.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_execbuf_util.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_execbuf_util.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_lock.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_lock.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_memory.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_memory.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_module.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_object.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_object.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_page_alloc.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_page_alloc.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_page_alloc_dma.c (contents, props changed) head/sys/dev/drm2/ttm/ttm_placement.h (contents, props changed) head/sys/dev/drm2/ttm/ttm_tt.c (contents, props changed) Modified: head/sys/dev/drm2/drmP.h head/sys/dev/drm2/drm_drv.c head/sys/dev/drm2/drm_gem.c head/sys/modules/drm2/drm2/Makefile Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Tue Mar 5 09:27:21 2013 (r247834) +++ head/sys/dev/drm2/drmP.h Tue Mar 5 09:49:34 2013 (r247835) @@ -906,6 +906,7 @@ struct drm_device { struct drm_minor *control; /**< Control node for card */ struct drm_minor *primary; /**< render type primary screen head */ + void *drm_ttm_bo; struct unrhdr *drw_unrhdr; /* RB tree of drawable infos */ RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head; @@ -1302,10 +1303,14 @@ void drm_gem_release(struct drm_device * int drm_gem_create_mmap_offset(struct drm_gem_object *obj); void drm_gem_free_mmap_offset(struct drm_gem_object *obj); -int drm_gem_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t size, - struct vm_object **obj_res, int nprot); +int drm_gem_mmap_single(struct drm_device *dev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **obj_res, int nprot); void drm_gem_pager_dtr(void *obj); +struct ttm_bo_device; +int ttm_bo_mmap_single(struct ttm_bo_device *bdev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **obj_res, int nprot); + void drm_device_lock_mtx(struct drm_device *dev); void drm_device_unlock_mtx(struct drm_device *dev); int drm_device_sleep_mtx(struct drm_device *dev, void *chan, int flags, Modified: head/sys/dev/drm2/drm_drv.c ============================================================================== --- head/sys/dev/drm2/drm_drv.c Tue Mar 5 09:27:21 2013 (r247834) +++ head/sys/dev/drm2/drm_drv.c Tue Mar 5 09:49:34 2013 (r247835) @@ -58,6 +58,8 @@ static int drm_load(struct drm_device *d static void drm_unload(struct drm_device *dev); static drm_pci_id_list_t *drm_find_description(int vendor, int device, drm_pci_id_list_t *idlist); +static int drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **obj_res, int nprot); static int drm_modevent(module_t mod, int type, void *data) @@ -187,7 +189,7 @@ static struct cdevsw drm_cdevsw = { .d_ioctl = drm_ioctl, .d_poll = drm_poll, .d_mmap = drm_mmap, - .d_mmap_single = drm_gem_mmap_single, + .d_mmap_single = drm_mmap_single, .d_name = "drm", .d_flags = D_TRACKCLOSE }; @@ -955,6 +957,23 @@ drm_add_busid_modesetting(struct drm_dev return (0); } +static int +drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t size, + struct vm_object **obj_res, int nprot) +{ + struct drm_device *dev; + + dev = drm_get_device_from_kdev(kdev); + if ((dev->driver->driver_features & DRIVER_GEM) != 0) { + return (drm_gem_mmap_single(dev, offset, size, obj_res, nprot)); + } else if (dev->drm_ttm_bo != NULL) { + return (ttm_bo_mmap_single(dev->drm_ttm_bo, offset, size, + obj_res, nprot)); + } else { + return (ENODEV); + } +} + #if DRM_LINUX #include Modified: head/sys/dev/drm2/drm_gem.c ============================================================================== --- head/sys/dev/drm2/drm_gem.c Tue Mar 5 09:27:21 2013 (r247834) +++ head/sys/dev/drm2/drm_gem.c Tue Mar 5 09:49:34 2013 (r247835) @@ -441,16 +441,12 @@ drm_gem_free_mmap_offset(struct drm_gem_ } int -drm_gem_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t size, +drm_gem_mmap_single(struct drm_device *dev, vm_ooffset_t *offset, vm_size_t size, struct vm_object **obj_res, int nprot) { - struct drm_device *dev; struct drm_gem_object *gem_obj; struct vm_object *vm_obj; - dev = drm_get_device_from_kdev(kdev); - if ((dev->driver->driver_features & DRIVER_GEM) == 0) - return (ENODEV); DRM_LOCK(dev); gem_obj = drm_gem_object_from_offset(dev, *offset); if (gem_obj == NULL) { Added: head/sys/dev/drm2/ttm/ttm_agp_backend.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/ttm/ttm_agp_backend.c Tue Mar 5 09:49:34 2013 (r247835) @@ -0,0 +1,145 @@ +/************************************************************************** + * + * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Thomas Hellstrom + * Keith Packard. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#ifdef TTM_HAS_AGP +#include + +struct ttm_agp_backend { + struct ttm_tt ttm; + struct agp_memory *mem; + device_t bridge; +}; + +MALLOC_DEFINE(M_TTM_AGP, "ttm_agp", "TTM AGP Backend"); + +static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) +{ + struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); + struct drm_mm_node *node = bo_mem->mm_node; + struct agp_memory *mem; + int ret, cached = (bo_mem->placement & TTM_PL_FLAG_CACHED); + unsigned i; + + mem = agp_alloc_memory(agp_be->bridge, AGP_USER_MEMORY, ttm->num_pages); + if (unlikely(mem == NULL)) + return -ENOMEM; + + mem->page_count = 0; + for (i = 0; i < ttm->num_pages; i++) { + vm_page_t page = ttm->pages[i]; + + if (!page) + page = ttm->dummy_read_page; + + mem->pages[mem->page_count++] = page; + } + agp_be->mem = mem; + + mem->is_flushed = 1; + mem->type = (cached) ? AGP_USER_CACHED_MEMORY : AGP_USER_MEMORY; + + ret = agp_bind_memory(mem, node->start); + if (ret) + pr_err("AGP Bind memory failed\n"); + + return ret; +} + +static int ttm_agp_unbind(struct ttm_tt *ttm) +{ + struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); + + if (agp_be->mem) { + if (agp_be->mem->is_bound) + return agp_unbind_memory(agp_be->mem); + agp_free_memory(agp_be->mem); + agp_be->mem = NULL; + } + return 0; +} + +static void ttm_agp_destroy(struct ttm_tt *ttm) +{ + struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); + + if (agp_be->mem) + ttm_agp_unbind(ttm); + ttm_tt_fini(ttm); + free(agp_be, M_TTM_AGP); +} + +static struct ttm_backend_func ttm_agp_func = { + .bind = ttm_agp_bind, + .unbind = ttm_agp_unbind, + .destroy = ttm_agp_destroy, +}; + +struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, + device_t bridge, + unsigned long size, uint32_t page_flags, + vm_page_t dummy_read_page) +{ + struct ttm_agp_backend *agp_be; + + agp_be = malloc(sizeof(*agp_be), M_TTM_AGP, M_WAITOK | M_ZERO); + + agp_be->mem = NULL; + agp_be->bridge = bridge; + agp_be->ttm.func = &ttm_agp_func; + + if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) { + return NULL; + } + + return &agp_be->ttm; +} + +int ttm_agp_tt_populate(struct ttm_tt *ttm) +{ + if (ttm->state != tt_unpopulated) + return 0; + + return ttm_pool_populate(ttm); +} + +void ttm_agp_tt_unpopulate(struct ttm_tt *ttm) +{ + ttm_pool_unpopulate(ttm); +} + +#endif Added: head/sys/dev/drm2/ttm/ttm_bo.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm2/ttm/ttm_bo.c Tue Mar 5 09:49:34 2013 (r247835) @@ -0,0 +1,1820 @@ +/************************************************************************** + * + * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Thomas Hellstrom + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#define TTM_ASSERT_LOCKED(param) +#define TTM_DEBUG(fmt, arg...) +#define TTM_BO_HASH_ORDER 13 + +static int ttm_bo_setup_vm(struct ttm_buffer_object *bo); +static int ttm_bo_swapout(struct ttm_mem_shrink *shrink); +static void ttm_bo_global_kobj_release(struct ttm_bo_global *glob); + +MALLOC_DEFINE(M_TTM_BO, "ttm_bo", "TTM Buffer Objects"); + +static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t *mem_type) +{ + int i; + + for (i = 0; i <= TTM_PL_PRIV5; i++) + if (flags & (1 << i)) { + *mem_type = i; + return 0; + } + return -EINVAL; +} + +static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) +{ + struct ttm_mem_type_manager *man = &bdev->man[mem_type]; + + printf(" has_type: %d\n", man->has_type); + printf(" use_type: %d\n", man->use_type); + printf(" flags: 0x%08X\n", man->flags); + printf(" gpu_offset: 0x%08lX\n", man->gpu_offset); + printf(" size: %ju\n", (uintmax_t)man->size); + printf(" available_caching: 0x%08X\n", man->available_caching); + printf(" default_caching: 0x%08X\n", man->default_caching); + if (mem_type != TTM_PL_SYSTEM) + (*man->func->debug)(man, TTM_PFX); +} + +static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, + struct ttm_placement *placement) +{ + int i, ret, mem_type; + + printf("No space for %p (%lu pages, %luK, %luM)\n", + bo, bo->mem.num_pages, bo->mem.size >> 10, + bo->mem.size >> 20); + for (i = 0; i < placement->num_placement; i++) { + ret = ttm_mem_type_from_flags(placement->placement[i], + &mem_type); + if (ret) + return; + printf(" placement[%d]=0x%08X (%d)\n", + i, placement->placement[i], mem_type); + ttm_mem_type_debug(bo->bdev, mem_type); + } +} + +#if 0 +static ssize_t ttm_bo_global_show(struct ttm_bo_global *glob, + char *buffer) +{ + + return snprintf(buffer, PAGE_SIZE, "%lu\n", + (unsigned long) atomic_read(&glob->bo_count)); +} +#endif + +static inline uint32_t ttm_bo_type_flags(unsigned type) +{ + return 1 << (type); +} + +static void ttm_bo_release_list(struct ttm_buffer_object *bo) +{ + struct ttm_bo_device *bdev = bo->bdev; + size_t acc_size = bo->acc_size; + + MPASS(atomic_read(&bo->list_kref) == 0); + MPASS(atomic_read(&bo->kref) == 0); + MPASS(atomic_read(&bo->cpu_writers) == 0); + MPASS(bo->sync_obj == NULL); + MPASS(bo->mem.mm_node == NULL); + MPASS(list_empty(&bo->lru)); + MPASS(list_empty(&bo->ddestroy)); + + if (bo->ttm) + ttm_tt_destroy(bo->ttm); + atomic_dec(&bo->glob->bo_count); + if (bo->destroy) + bo->destroy(bo); + else { + free(bo, M_TTM_BO); + } + ttm_mem_global_free(bdev->glob->mem_glob, acc_size); +} + +int +ttm_bo_wait_unreserved_locked(struct ttm_buffer_object *bo, bool interruptible) +{ + const char *wmsg; + int flags, ret; + + ret = 0; + if (interruptible) { + flags = PCATCH; + wmsg = "ttbowi"; + } else { + flags = 0; + wmsg = "ttbowu"; + } + while (!ttm_bo_is_reserved(bo)) { + ret = -msleep(bo, &bo->glob->lru_lock, flags, wmsg, 0); + if (ret != 0) + break; + } + return (ret); +} + +void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_mem_type_manager *man; + + MPASS(ttm_bo_is_reserved(bo)); + + if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { + + MPASS(list_empty(&bo->lru)); + + man = &bdev->man[bo->mem.mem_type]; + list_add_tail(&bo->lru, &man->lru); + refcount_acquire(&bo->list_kref); + + if (bo->ttm != NULL) { + list_add_tail(&bo->swap, &bo->glob->swap_lru); + refcount_acquire(&bo->list_kref); + } + } +} + +int ttm_bo_del_from_lru(struct ttm_buffer_object *bo) +{ + int put_count = 0; + + if (!list_empty(&bo->swap)) { + list_del_init(&bo->swap); + ++put_count; + } + if (!list_empty(&bo->lru)) { + list_del_init(&bo->lru); + ++put_count; + } + + /* + * TODO: Add a driver hook to delete from + * driver-specific LRU's here. + */ + + return put_count; +} + +int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, + bool interruptible, + bool no_wait, bool use_sequence, uint32_t sequence) +{ + int ret; + + while (unlikely(atomic_read(&bo->reserved) != 0)) { + /** + * Deadlock avoidance for multi-bo reserving. + */ + if (use_sequence && bo->seq_valid) { + /** + * We've already reserved this one. + */ + if (unlikely(sequence == bo->val_seq)) + return -EDEADLK; + /** + * Already reserved by a thread that will not back + * off for us. We need to back off. + */ + if (unlikely(sequence - bo->val_seq < (1 << 31))) + return -EAGAIN; + } + + if (no_wait) + return -EBUSY; + + ret = ttm_bo_wait_unreserved_locked(bo, interruptible); + if (unlikely(ret)) + return ret; + } + + atomic_set(&bo->reserved, 1); + if (use_sequence) { + /** + * Wake up waiters that may need to recheck for deadlock, + * if we decreased the sequence number. + */ + if (unlikely((bo->val_seq - sequence < (1 << 31)) + || !bo->seq_valid)) + wakeup(bo); + + bo->val_seq = sequence; + bo->seq_valid = true; + } else { + bo->seq_valid = false; + } + + return 0; +} + +void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count, + bool never_free) +{ + u_int old; + + old = atomic_fetchadd_int(&bo->list_kref, -count); + if (old <= count) { + if (never_free) + panic("ttm_bo_ref_buf"); + ttm_bo_release_list(bo); + } +} + +int ttm_bo_reserve(struct ttm_buffer_object *bo, + bool interruptible, + bool no_wait, bool use_sequence, uint32_t sequence) +{ + struct ttm_bo_global *glob = bo->glob; + int put_count = 0; + int ret; + + mtx_lock(&glob->lru_lock); + ret = ttm_bo_reserve_locked(bo, interruptible, no_wait, use_sequence, + sequence); + if (likely(ret == 0)) + put_count = ttm_bo_del_from_lru(bo); + mtx_unlock(&glob->lru_lock); + + ttm_bo_list_ref_sub(bo, put_count, true); + + return ret; +} + +void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo) +{ + ttm_bo_add_to_lru(bo); + atomic_set(&bo->reserved, 0); + wakeup(bo); +} + +void ttm_bo_unreserve(struct ttm_buffer_object *bo) +{ + struct ttm_bo_global *glob = bo->glob; + + mtx_lock(&glob->lru_lock); + ttm_bo_unreserve_locked(bo); + mtx_unlock(&glob->lru_lock); +} + +/* + * Call bo->mutex locked. + */ +static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_bo_global *glob = bo->glob; + int ret = 0; + uint32_t page_flags = 0; + + TTM_ASSERT_LOCKED(&bo->mutex); + bo->ttm = NULL; + + if (bdev->need_dma32) + page_flags |= TTM_PAGE_FLAG_DMA32; + + switch (bo->type) { + case ttm_bo_type_device: + if (zero_alloc) + page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC; + case ttm_bo_type_kernel: + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT, + page_flags, glob->dummy_read_page); + if (unlikely(bo->ttm == NULL)) + ret = -ENOMEM; + break; + case ttm_bo_type_sg: + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT, + page_flags | TTM_PAGE_FLAG_SG, + glob->dummy_read_page); + if (unlikely(bo->ttm == NULL)) { + ret = -ENOMEM; + break; + } + bo->ttm->sg = bo->sg; + break; + default: + printf("[TTM] Illegal buffer object type\n"); + ret = -EINVAL; + break; + } + + return ret; +} + +static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, + struct ttm_mem_reg *mem, + bool evict, bool interruptible, + bool no_wait_gpu) +{ + struct ttm_bo_device *bdev = bo->bdev; + bool old_is_pci = ttm_mem_reg_is_pci(bdev, &bo->mem); + bool new_is_pci = ttm_mem_reg_is_pci(bdev, mem); + struct ttm_mem_type_manager *old_man = &bdev->man[bo->mem.mem_type]; + struct ttm_mem_type_manager *new_man = &bdev->man[mem->mem_type]; + int ret = 0; + + if (old_is_pci || new_is_pci || + ((mem->placement & bo->mem.placement & TTM_PL_MASK_CACHING) == 0)) { + ret = ttm_mem_io_lock(old_man, true); + if (unlikely(ret != 0)) + goto out_err; + ttm_bo_unmap_virtual_locked(bo); + ttm_mem_io_unlock(old_man); + } + + /* + * Create and bind a ttm if required. + */ + + if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) { + if (bo->ttm == NULL) { + bool zero = !(old_man->flags & TTM_MEMTYPE_FLAG_FIXED); + ret = ttm_bo_add_ttm(bo, zero); + if (ret) + goto out_err; + } + + ret = ttm_tt_set_placement_caching(bo->ttm, mem->placement); + if (ret) + goto out_err; + + if (mem->mem_type != TTM_PL_SYSTEM) { + ret = ttm_tt_bind(bo->ttm, mem); + if (ret) + goto out_err; + } + + if (bo->mem.mem_type == TTM_PL_SYSTEM) { + if (bdev->driver->move_notify) + bdev->driver->move_notify(bo, mem); + bo->mem = *mem; + mem->mm_node = NULL; + goto moved; + } + } + + if (bdev->driver->move_notify) + bdev->driver->move_notify(bo, mem); + + if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && + !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) + ret = ttm_bo_move_ttm(bo, evict, no_wait_gpu, mem); + else if (bdev->driver->move) + ret = bdev->driver->move(bo, evict, interruptible, + no_wait_gpu, mem); + else + ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, mem); + + if (ret) { + if (bdev->driver->move_notify) { + struct ttm_mem_reg tmp_mem = *mem; + *mem = bo->mem; + bo->mem = tmp_mem; + bdev->driver->move_notify(bo, mem); + bo->mem = *mem; + } + + goto out_err; + } + +moved: + if (bo->evicted) { + ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); + if (ret) + printf("[TTM] Can not flush read caches\n"); + bo->evicted = false; + } + + if (bo->mem.mm_node) { + bo->offset = (bo->mem.start << PAGE_SHIFT) + + bdev->man[bo->mem.mem_type].gpu_offset; + bo->cur_placement = bo->mem.placement; + } else + bo->offset = 0; + + return 0; + +out_err: + new_man = &bdev->man[bo->mem.mem_type]; + if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) { + ttm_tt_unbind(bo->ttm); + ttm_tt_destroy(bo->ttm); + bo->ttm = NULL; + } + + return ret; +} + +/** + * Call bo::reserved. + * Will release GPU memory type usage on destruction. + * This is the place to put in driver specific hooks to release + * driver private resources. + * Will release the bo::reserved lock. + */ + +static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) +{ + if (bo->bdev->driver->move_notify) + bo->bdev->driver->move_notify(bo, NULL); + + if (bo->ttm) { + ttm_tt_unbind(bo->ttm); + ttm_tt_destroy(bo->ttm); + bo->ttm = NULL; + } + ttm_bo_mem_put(bo, &bo->mem); + + atomic_set(&bo->reserved, 0); + wakeup(&bo); + + /* + * Since the final reference to this bo may not be dropped by + * the current task we have to put a memory barrier here to make + * sure the changes done in this function are always visible. + * + * This function only needs protection against the final kref_put. + */ + mb(); +} + +static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_bo_global *glob = bo->glob; + struct ttm_bo_driver *driver = bdev->driver; + void *sync_obj = NULL; + int put_count; + int ret; + + mtx_lock(&glob->lru_lock); + ret = ttm_bo_reserve_locked(bo, false, true, false, 0); + + mtx_lock(&bdev->fence_lock); + (void) ttm_bo_wait(bo, false, false, true); + if (!ret && !bo->sync_obj) { + mtx_unlock(&bdev->fence_lock); + put_count = ttm_bo_del_from_lru(bo); + + mtx_unlock(&glob->lru_lock); + ttm_bo_cleanup_memtype_use(bo); + + ttm_bo_list_ref_sub(bo, put_count, true); + + return; + } + if (bo->sync_obj) + sync_obj = driver->sync_obj_ref(bo->sync_obj); + mtx_unlock(&bdev->fence_lock); + + if (!ret) { + atomic_set(&bo->reserved, 0); + wakeup(bo); + } + + refcount_acquire(&bo->list_kref); + list_add_tail(&bo->ddestroy, &bdev->ddestroy); + mtx_unlock(&glob->lru_lock); + + if (sync_obj) { + driver->sync_obj_flush(sync_obj); + driver->sync_obj_unref(&sync_obj); + } + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, + ((hz / 100) < 1) ? 1 : hz / 100); +} + +/** + * function ttm_bo_cleanup_refs_and_unlock + * If bo idle, remove from delayed- and lru lists, and unref. + * If not idle, do nothing. + * + * Must be called with lru_lock and reservation held, this function + * will drop both before returning. + * + * @interruptible Any sleeps should occur interruptibly. + * @no_wait_gpu Never wait for gpu. Return -EBUSY instead. + */ + +static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo, + bool interruptible, + bool no_wait_gpu) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_bo_driver *driver = bdev->driver; + struct ttm_bo_global *glob = bo->glob; + int put_count; + int ret; + + mtx_lock(&bdev->fence_lock); + ret = ttm_bo_wait(bo, false, false, true); + + if (ret && !no_wait_gpu) { + void *sync_obj; + + /* + * Take a reference to the fence and unreserve, + * at this point the buffer should be dead, so + * no new sync objects can be attached. + */ + sync_obj = driver->sync_obj_ref(bo->sync_obj); + mtx_unlock(&bdev->fence_lock); + + atomic_set(&bo->reserved, 0); + wakeup(bo); + mtx_unlock(&glob->lru_lock); + + ret = driver->sync_obj_wait(sync_obj, false, interruptible); + driver->sync_obj_unref(&sync_obj); + if (ret) + return ret; + + /* + * remove sync_obj with ttm_bo_wait, the wait should be + * finished, and no new wait object should have been added. + */ + mtx_lock(&bdev->fence_lock); + ret = ttm_bo_wait(bo, false, false, true); + mtx_unlock(&bdev->fence_lock); + if (ret) + return ret; + + mtx_lock(&glob->lru_lock); + ret = ttm_bo_reserve_locked(bo, false, true, false, 0); + + /* + * We raced, and lost, someone else holds the reservation now, + * and is probably busy in ttm_bo_cleanup_memtype_use. + * + * Even if it's not the case, because we finished waiting any + * delayed destruction would succeed, so just return success + * here. + */ + if (ret) { + mtx_unlock(&glob->lru_lock); + return 0; + } + } else + mtx_unlock(&bdev->fence_lock); + + if (ret || unlikely(list_empty(&bo->ddestroy))) { + atomic_set(&bo->reserved, 0); + wakeup(bo); + mtx_unlock(&glob->lru_lock); + return ret; + } + + put_count = ttm_bo_del_from_lru(bo); + list_del_init(&bo->ddestroy); + ++put_count; + + mtx_unlock(&glob->lru_lock); + ttm_bo_cleanup_memtype_use(bo); + + ttm_bo_list_ref_sub(bo, put_count, true); + + return 0; +} + +/** + * Traverse the delayed list, and call ttm_bo_cleanup_refs on all + * encountered buffers. + */ + +static int ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all) +{ + struct ttm_bo_global *glob = bdev->glob; + struct ttm_buffer_object *entry = NULL; + int ret = 0; + + mtx_lock(&glob->lru_lock); + if (list_empty(&bdev->ddestroy)) + goto out_unlock; + + entry = list_first_entry(&bdev->ddestroy, + struct ttm_buffer_object, ddestroy); + refcount_acquire(&entry->list_kref); + + for (;;) { + struct ttm_buffer_object *nentry = NULL; + + if (entry->ddestroy.next != &bdev->ddestroy) { + nentry = list_first_entry(&entry->ddestroy, + struct ttm_buffer_object, ddestroy); + refcount_acquire(&nentry->list_kref); + } + + ret = ttm_bo_reserve_locked(entry, false, !remove_all, false, 0); + if (!ret) + ret = ttm_bo_cleanup_refs_and_unlock(entry, false, + !remove_all); + else + mtx_unlock(&glob->lru_lock); + + if (refcount_release(&entry->list_kref)) + ttm_bo_release_list(entry); + entry = nentry; + + if (ret || !entry) + goto out; + + mtx_lock(&glob->lru_lock); + if (list_empty(&entry->ddestroy)) + break; + } + +out_unlock: + mtx_unlock(&glob->lru_lock); +out: + if (entry && refcount_release(&entry->list_kref)) + ttm_bo_release_list(entry); + return ret; +} + +static void ttm_bo_delayed_workqueue(void *arg, int pending __unused) +{ + struct ttm_bo_device *bdev = arg; + + if (ttm_bo_delayed_delete(bdev, false)) { + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, + ((hz / 100) < 1) ? 1 : hz / 100); + } +} + +static void ttm_bo_release(struct ttm_buffer_object *bo) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; + + rw_wlock(&bdev->vm_lock); + if (likely(bo->vm_node != NULL)) { + RB_REMOVE(ttm_bo_device_buffer_objects, + &bdev->addr_space_rb, bo); + drm_mm_put_block(bo->vm_node); + bo->vm_node = NULL; + } + rw_wunlock(&bdev->vm_lock); + ttm_mem_io_lock(man, false); + ttm_mem_io_free_vm(bo); + ttm_mem_io_unlock(man); + ttm_bo_cleanup_refs_or_queue(bo); + if (refcount_release(&bo->list_kref)) + ttm_bo_release_list(bo); +} + +void ttm_bo_unref(struct ttm_buffer_object **p_bo) +{ + struct ttm_buffer_object *bo = *p_bo; + + *p_bo = NULL; + if (refcount_release(&bo->kref)) + ttm_bo_release(bo); +} + +int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev) +{ + int pending; + + taskqueue_cancel_timeout(taskqueue_thread, &bdev->wq, &pending); + if (pending) + taskqueue_drain_timeout(taskqueue_thread, &bdev->wq); + return (pending); +} + +void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched) +{ + if (resched) { + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, + ((hz / 100) < 1) ? 1 : hz / 100); + } +} + +static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, + bool no_wait_gpu) +{ + struct ttm_bo_device *bdev = bo->bdev; + struct ttm_mem_reg evict_mem; + struct ttm_placement placement; + int ret = 0; + + mtx_lock(&bdev->fence_lock); + ret = ttm_bo_wait(bo, false, interruptible, no_wait_gpu); + mtx_unlock(&bdev->fence_lock); + + if (unlikely(ret != 0)) { + if (ret != -ERESTART) { + printf("[TTM] Failed to expire sync object before buffer eviction\n"); + } + goto out; + } + + MPASS(ttm_bo_is_reserved(bo)); + + evict_mem = bo->mem; + evict_mem.mm_node = NULL; + evict_mem.bus.io_reserved_vm = false; + evict_mem.bus.io_reserved_count = 0; + + placement.fpfn = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 10:18:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6EE5A2D4; Tue, 5 Mar 2013 10:18:49 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5453F2C4; Tue, 5 Mar 2013 10:18:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25AIm2K029617; Tue, 5 Mar 2013 10:18:48 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25AIm8C029614; Tue, 5 Mar 2013 10:18:48 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201303051018.r25AIm8C029614@svn.freebsd.org> From: Fabien Thomas Date: Tue, 5 Mar 2013 10:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247836 - in head/sys: dev/hwpmc kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 10:18:49 -0000 Author: fabient Date: Tue Mar 5 10:18:48 2013 New Revision: 247836 URL: http://svnweb.freebsd.org/changeset/base/247836 Log: Add a generic way to call per event allocate / release function. Reviewed by: mav MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_soft.c head/sys/kern/kern_clock.c head/sys/sys/pmckern.h Modified: head/sys/dev/hwpmc/hwpmc_soft.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_soft.c Tue Mar 5 09:49:34 2013 (r247835) +++ head/sys/dev/hwpmc/hwpmc_soft.c Tue Mar 5 10:18:48 2013 (r247836) @@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$"); #define SOFT_CAPS (PMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INTERRUPT | \ PMC_CAP_USER | PMC_CAP_SYSTEM) -PMC_SOFT_DECLARE( , , clock, prof); - struct soft_descr { struct pmc_descr pm_descr; /* "base class" */ }; @@ -126,9 +124,10 @@ soft_allocate_pmc(int cpu, int ri, struc if (ps == NULL) return (EINVAL); pmc_soft_ev_release(ps); + /* Module unload is protected by pmc SX lock. */ + if (ps->ps_alloc != NULL) + ps->ps_alloc(); - if (ev == pmc___clock_prof.ps_ev.pm_ev_code) - cpu_startprofclock(); return (0); } @@ -315,6 +314,8 @@ static int soft_release_pmc(int cpu, int ri, struct pmc *pmc) { struct pmc_hw *phw; + enum pmc_event ev; + struct pmc_soft *ps; (void) pmc; @@ -328,8 +329,16 @@ soft_release_pmc(int cpu, int ri, struct KASSERT(phw->phw_pmc == NULL, ("[soft,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - if (pmc->pm_event == pmc___clock_prof.ps_ev.pm_ev_code) - cpu_stopprofclock(); + ev = pmc->pm_event; + + /* Check if event is registered. */ + ps = pmc_soft_ev_acquire(ev); + KASSERT(ps != NULL, + ("[soft,%d] unregistered event %d", __LINE__, ev)); + pmc_soft_ev_release(ps); + /* Module unload is protected by pmc SX lock. */ + if (ps->ps_release != NULL) + ps->ps_release(); return (0); } Modified: head/sys/kern/kern_clock.c ============================================================================== --- head/sys/kern/kern_clock.c Tue Mar 5 09:49:34 2013 (r247835) +++ head/sys/kern/kern_clock.c Tue Mar 5 10:18:48 2013 (r247836) @@ -78,7 +78,8 @@ __FBSDID("$FreeBSD$"); #include PMC_SOFT_DEFINE( , , clock, hard); PMC_SOFT_DEFINE( , , clock, stat); -PMC_SOFT_DEFINE( , , clock, prof); +PMC_SOFT_DEFINE_EX( , , clock, prof, \ + cpu_startprofclock, cpu_stopprofclock); #endif #ifdef DEVICE_POLLING Modified: head/sys/sys/pmckern.h ============================================================================== --- head/sys/sys/pmckern.h Tue Mar 5 09:49:34 2013 (r247835) +++ head/sys/sys/pmckern.h Tue Mar 5 10:18:48 2013 (r247836) @@ -87,9 +87,9 @@ struct pmckern_soft { * Soft PMC. */ -#define PMC_SOFT_DEFINE(prov, mod, func, name) \ +#define PMC_SOFT_DEFINE_EX(prov, mod, func, name, alloc, release) \ struct pmc_soft pmc_##prov##_##mod##_##func##_##name = \ - { 0, { #prov "_" #mod "_" #func "." #name, 0 } }; \ + { 0, alloc, release, { #prov "_" #mod "_" #func "." #name, 0 } }; \ SYSINIT(pmc_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \ SI_ORDER_SECOND + 1, pmc_soft_ev_register, \ &pmc_##prov##_##mod##_##func##_##name ); \ @@ -97,6 +97,9 @@ struct pmckern_soft { SI_SUB_KDTRACE, SI_ORDER_SECOND + 1, pmc_soft_ev_deregister, \ &pmc_##prov##_##mod##_##func##_##name ) +#define PMC_SOFT_DEFINE(prov, mod, func, name) \ + PMC_SOFT_DEFINE_EX(prov, mod, func, name, NULL, NULL) + #define PMC_SOFT_DECLARE(prov, mod, func, name) \ extern struct pmc_soft pmc_##prov##_##mod##_##func##_##name @@ -147,6 +150,8 @@ do { \ struct pmc_soft { int ps_running; + void (*ps_alloc)(void); + void (*ps_release)(void); struct pmc_dyn_event_descr ps_ev; }; From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 11:02:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9E67AE4C; Tue, 5 Mar 2013 11:02:05 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 91F406FC; Tue, 5 Mar 2013 11:02:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25B25Di043600; Tue, 5 Mar 2013 11:02:05 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25B25Db043599; Tue, 5 Mar 2013 11:02:05 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303051102.r25B25Db043599@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Tue, 5 Mar 2013 11:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247837 - head/sys/geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 11:02:05 -0000 Author: dumbbell Date: Tue Mar 5 11:02:05 2013 New Revision: 247837 URL: http://svnweb.freebsd.org/changeset/base/247837 Log: g_label_ntfs.c: Mark structures as __packed Without this, read data is mis-interpreted. This could trigger a panic, as was the case on one computer where computed "recsize" was zero, leading to a call to g_read_page() asking for 0 bytes. Modified: head/sys/geom/label/g_label_ntfs.c Modified: head/sys/geom/label/g_label_ntfs.c ============================================================================== --- head/sys/geom/label/g_label_ntfs.c Tue Mar 5 10:18:48 2013 (r247836) +++ head/sys/geom/label/g_label_ntfs.c Tue Mar 5 11:02:05 2013 (r247837) @@ -55,7 +55,7 @@ struct ntfs_attr { uint16_t reserved3; uint16_t a_dataoff; uint16_t a_indexed; -}; +} __packed; struct ntfs_filerec { uint32_t fr_hdrmagic; @@ -70,7 +70,7 @@ struct ntfs_filerec { uint32_t fr_allocated; uint64_t fr_mainrec; uint16_t fr_attrnum; -}; +} __packed; struct ntfs_bootfile { uint8_t reserved1[3]; @@ -89,7 +89,7 @@ struct ntfs_bootfile { uint8_t bf_mftrecsz; uint32_t bf_ibsz; uint32_t bf_volsn; -}; +} __packed; static void g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 11:02:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 30805FC8; Tue, 5 Mar 2013 11:02:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2002570B; Tue, 5 Mar 2013 11:02:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25B2cCC043730; Tue, 5 Mar 2013 11:02:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25B2c6k043729; Tue, 5 Mar 2013 11:02:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303051102.r25B2c6k043729@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 11:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247838 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 11:02:39 -0000 Author: kib Date: Tue Mar 5 11:02:38 2013 New Revision: 247838 URL: http://svnweb.freebsd.org/changeset/base/247838 Log: Correct the r247832. Noted by: marius, rdivacky MFC after: 1 month Modified: head/sys/dev/drm2/drmP.h Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Tue Mar 5 11:02:05 2013 (r247837) +++ head/sys/dev/drm2/drmP.h Tue Mar 5 11:02:38 2013 (r247838) @@ -228,7 +228,7 @@ typedef void irqreturn_t; #define IRQ_NONE /* nothing */ #define unlikely(x) __builtin_expect(!!(x), 0) -#define likely(x) __builtin_expect((x), 0) +#define likely(x) __builtin_expect(!!(x), 1) #define container_of(ptr, type, member) ({ \ __typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 11:18:58 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 87D31873; Tue, 5 Mar 2013 11:18:58 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 762317CC; Tue, 5 Mar 2013 11:18:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25BIw8W048294; Tue, 5 Mar 2013 11:18:58 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25BIw9I048293; Tue, 5 Mar 2013 11:18:58 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303051118.r25BIw9I048293@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Tue, 5 Mar 2013 11:18:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247839 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 11:18:58 -0000 Author: dumbbell Date: Tue Mar 5 11:18:57 2013 New Revision: 247839 URL: http://svnweb.freebsd.org/changeset/base/247839 Log: drm_global.c: Destroy sx in drm_global_release() This fixes a build error at the same time (unused variable "item"), if the kernel is compiled without INVARIANTS. Reported by: Hartmann, O. (build error) Reviewed by: Konstantin Belousov (kib@) Modified: head/sys/dev/drm2/drm_global.c Modified: head/sys/dev/drm2/drm_global.c ============================================================================== --- head/sys/dev/drm2/drm_global.c Tue Mar 5 11:02:38 2013 (r247838) +++ head/sys/dev/drm2/drm_global.c Tue Mar 5 11:18:57 2013 (r247839) @@ -63,6 +63,7 @@ void drm_global_release(void) struct drm_global_item *item = &glob[i]; MPASS(item->object == NULL); MPASS(item->refcount == 0); + sx_destroy(&item->mutex); } } From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 13:06:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4A6456BD; Tue, 5 Mar 2013 13:06:41 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2E86FD1B; Tue, 5 Mar 2013 13:06:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25D6e9G081103; Tue, 5 Mar 2013 13:06:40 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25D6eZo081100; Tue, 5 Mar 2013 13:06:40 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303051306.r25D6eZo081100@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 5 Mar 2013 13:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247840 - head/lib/libyaml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 13:06:41 -0000 Author: bapt Date: Tue Mar 5 13:06:40 2013 New Revision: 247840 URL: http://svnweb.freebsd.org/changeset/base/247840 Log: Add a stub manpage modeled over the libexpat one to explain to users not to use this library outside of base. Requested by: simon Added: head/lib/libyaml/libbsdyml.3 (contents, props changed) Modified: head/lib/libyaml/Makefile Modified: head/lib/libyaml/Makefile ============================================================================== --- head/lib/libyaml/Makefile Tue Mar 5 11:18:57 2013 (r247839) +++ head/lib/libyaml/Makefile Tue Mar 5 13:06:40 2013 (r247840) @@ -7,6 +7,7 @@ SHLIB_MAJOR= 0 INCS= bsdyml.h SRCS= api.c dumper.c emitter.c loader.c \ parser.c reader.c scanner.c writer.c +MAN= libbsdyml.3 .PATH: ${LIBYAML}/src ${LIBYAML}/include CLEANFILES= bsdyml.h Added: head/lib/libyaml/libbsdyml.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libyaml/libbsdyml.3 Tue Mar 5 13:06:40 2013 (r247840) @@ -0,0 +1,61 @@ +.\" Copyright (c) 2013 Baptiste Daroussin +.\" 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 05, 2013 +.Dt LIBBSDYML 3 +.Os +.Sh NAME +.Nm libbsdyml +.Nd LibYAML library for parsing and emitting YAML +.Sh SYNOPSIS +.In bsdyml.h +.Sh DESCRIPTION +The +.Nm +library is a verbatim copy of the LibYAML version 0.1.4 +.Pp +The +.Nm +library is intended to be used within the +.Fx +base system only. +Use of the +.Nm +library for other purposes is not supported and discouraged. +.Pp +To avoid version and autoconfiguration issues, the library has been +renamed to +.Nm +rather than retain the original LibYAML library and include file names +to prevent confusion and autoconfiguration issues for 3rd party +software. +.Sh SEE ALSO +For full documentation, please see the LibYAML webpage at +.Pa http://pyyaml.org/wiki/LibYAML . +.Sh AUTHORS +.An -nosplit +The original LibYAML was written by +.An Kirill Simonov Aq xi@resolvent.net . From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 13:31:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 251BCDEA; Tue, 5 Mar 2013 13:31:08 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08D77E79; Tue, 5 Mar 2013 13:31:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25DV80Q089484; Tue, 5 Mar 2013 13:31:08 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25DV7Km089479; Tue, 5 Mar 2013 13:31:07 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303051331.r25DV7Km089479@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 5 Mar 2013 13:31:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247841 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 13:31:08 -0000 Author: bapt Date: Tue Mar 5 13:31:06 2013 New Revision: 247841 URL: http://svnweb.freebsd.org/changeset/base/247841 Log: Add the ability to correctly read pkg.conf is exists. Only look for boostrap useful options: - PACKAGESITE - ABI - MIRROR_TYPE - ASSUME_ALWAYS_YES While here makes PACKAGESITE expand the ${ABI} variable. Allow to deactivate any SRV record look up (MIRROR_TYPE=none) Use the same mechanism as for pkgng itself: first get configuration out of environment variable and fallback on pkg.conf if exists. Reviewed by: bdrewery Added: head/usr.sbin/pkg/config.c (contents, props changed) head/usr.sbin/pkg/config.h (contents, props changed) Modified: head/usr.sbin/pkg/Makefile head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Tue Mar 5 13:06:40 2013 (r247840) +++ head/usr.sbin/pkg/Makefile Tue Mar 5 13:31:06 2013 (r247841) @@ -1,10 +1,10 @@ # $FreeBSD$ PROG= pkg -SRCS= pkg.c dns_utils.c +SRCS= pkg.c dns_utils.c config.c NO_MAN= yes -DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} -LDADD= -larchive -lelf -lfetch +DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBBSDYML} ${LIBSUBF} +LDADD= -larchive -lelf -lfetch -lbsdyml -lsbuf .include Added: head/usr.sbin/pkg/config.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pkg/config.c Tue Mar 5 13:31:06 2013 (r247841) @@ -0,0 +1,428 @@ +/*- + * Copyright (c) 2013 Baptiste Daroussin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "elf_tables.h" +#include "config.h" + +#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ + +struct config_entry { + uint8_t type; + const char *key; + const char *val; + char *value; + bool envset; +}; + +static struct config_entry c[] = { + [PACKAGESITE] = { + PKG_CONFIG_STRING, + "PACKAGESITE", + "http://pkg.FreeBSD.org/${ABI}/latest", + NULL, + false, + }, + [ABI] = { + PKG_CONFIG_STRING, + "ABI", + NULL, + NULL, + false, + }, + [MIRROR_TYPE] = { + PKG_CONFIG_STRING, + "MIRROR_TYPE", + "SRV", + NULL, + false, + }, + [ASSUME_ALWAYS_YES] = { + PKG_CONFIG_BOOL, + "ASSUME_ALWAYS_YES", + "NO", + NULL, + false, + } +}; + +static const char * +elf_corres_to_string(struct _elf_corres *m, int e) +{ + int i; + + for (i = 0; m[i].string != NULL; i++) + if (m[i].elf_nb == e) + return (m[i].string); + + return ("unknown"); +} + +static int +pkg_get_myabi(char *dest, size_t sz) +{ + Elf *elf; + Elf_Data *data; + Elf_Note note; + Elf_Scn *scn; + char *src, *osname; + const char *abi; + GElf_Ehdr elfhdr; + GElf_Shdr shdr; + int fd, i, ret; + uint32_t version; + + version = 0; + ret = -1; + scn = NULL; + abi = NULL; + + if (elf_version(EV_CURRENT) == EV_NONE) { + warnx("ELF library initialization failed: %s", + elf_errmsg(-1)); + return (-1); + } + + if ((fd = open(_PATH_BSHELL, O_RDONLY)) < 0) { + warn("open()"); + return (-1); + } + + if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { + ret = -1; + warnx("elf_begin() failed: %s.", elf_errmsg(-1)); + goto cleanup; + } + + if (gelf_getehdr(elf, &elfhdr) == NULL) { + ret = -1; + warn("getehdr() failed: %s.", elf_errmsg(-1)); + goto cleanup; + } + while ((scn = elf_nextscn(elf, scn)) != NULL) { + if (gelf_getshdr(scn, &shdr) != &shdr) { + ret = -1; + warn("getshdr() failed: %s.", elf_errmsg(-1)); + goto cleanup; + } + + if (shdr.sh_type == SHT_NOTE) + break; + } + + if (scn == NULL) { + ret = -1; + warn("failed to get the note section"); + goto cleanup; + } + + data = elf_getdata(scn, NULL); + src = data->d_buf; + for (;;) { + memcpy(¬e, src, sizeof(Elf_Note)); + src += sizeof(Elf_Note); + if (note.n_type == NT_VERSION) + break; + src += note.n_namesz + note.n_descsz; + } + osname = src; + src += roundup2(note.n_namesz, 4); + if (elfhdr.e_ident[EI_DATA] == ELFDATA2MSB) + version = be32dec(src); + else + version = le32dec(src); + + for (i = 0; osname[i] != '\0'; i++) + osname[i] = (char)tolower(osname[i]); + + snprintf(dest, sz, "%s:%d:%s:%s", + osname, version / 100000, + elf_corres_to_string(mach_corres, (int)elfhdr.e_machine), + elf_corres_to_string(wordsize_corres, + (int)elfhdr.e_ident[EI_CLASS])); + + ret = 0; + + switch (elfhdr.e_machine) { + case EM_ARM: + snprintf(dest + strlen(dest), sz - strlen(dest), + ":%s:%s:%s", elf_corres_to_string(endian_corres, + (int)elfhdr.e_ident[EI_DATA]), + (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ? + "eabi" : "oabi", + (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ? + "softfp" : "vfp"); + break; + case EM_MIPS: + /* + * this is taken from binutils sources: + * include/elf/mips.h + * mapping is figured out from binutils: + * gas/config/tc-mips.c + */ + switch (elfhdr.e_flags & EF_MIPS_ABI) { + case E_MIPS_ABI_O32: + abi = "o32"; + break; + case E_MIPS_ABI_N32: + abi = "n32"; + break; + default: + if (elfhdr.e_ident[EI_DATA] == + ELFCLASS32) + abi = "o32"; + else if (elfhdr.e_ident[EI_DATA] == + ELFCLASS64) + abi = "n64"; + break; + } + snprintf(dest + strlen(dest), sz - strlen(dest), + ":%s:%s", elf_corres_to_string(endian_corres, + (int)elfhdr.e_ident[EI_DATA]), abi); + break; + } + +cleanup: + if (elf != NULL) + elf_end(elf); + + close(fd); + return (ret); +} + +static void +subst_packagesite(const char *abi) +{ + struct sbuf *newval; + const char *variable_string; + const char *oldval; + + if (c[PACKAGESITE].value != NULL) + oldval = c[PACKAGESITE].value; + else + oldval = c[PACKAGESITE].val; + + if ((variable_string = strstr(oldval, "${ABI}")) == NULL) + return; + + newval = sbuf_new_auto(); + sbuf_bcat(newval, oldval, variable_string - oldval); + sbuf_cat(newval, abi); + sbuf_cat(newval, variable_string + strlen("${ABI}")); + sbuf_finish(newval); + + free(c[PACKAGESITE].value); + c[PACKAGESITE].value = strdup(sbuf_data(newval)); +} + +static void +config_parse(yaml_document_t *doc, yaml_node_t *node) +{ + yaml_node_pair_t *pair; + yaml_node_t *key, *val; + struct sbuf *buf = sbuf_new_auto(); + int i; + size_t j; + + pair = node->data.mapping.pairs.start; + + while (pair < node->data.mapping.pairs.top) { + key = yaml_document_get_node(doc, pair->key); + val = yaml_document_get_node(doc, pair->value); + + /* + * ignoring silently empty keys can be empty lines + * or user mistakes + */ + if (key->data.scalar.length <= 0) { + ++pair; + continue; + } + + /* + * silently skip on purpose to allow user to leave + * empty lines without complaining + */ + if (val->type == YAML_NO_NODE || + (val->type == YAML_SCALAR_NODE && + val->data.scalar.length <= 0)) { + ++pair; + continue; + } + + sbuf_clear(buf); + for (j = 0; j < strlen(key->data.scalar.value); ++j) + sbuf_putc(buf, toupper(key->data.scalar.value[j])); + + sbuf_finish(buf); + for (i = 0; i < CONFIG_SIZE; i++) { + if (strcmp(sbuf_data(buf), c[i].key) == 0) + break; + } + + if (i == CONFIG_SIZE) { + ++pair; + continue; + } + + /* env has priority over config file */ + if (c[i].envset) { + ++pair; + continue; + } + + c[i].value = strdup(val->data.scalar.value); + ++pair; + } + + sbuf_delete(buf); +} + +int +config_init(void) +{ + FILE *fp; + yaml_parser_t parser; + yaml_document_t doc; + yaml_node_t *node; + const char *val; + int i; + const char *localbase; + char confpath[MAXPATHLEN]; + char abi[BUFSIZ]; + + for (i = 0; i < CONFIG_SIZE; i++) { + val = getenv(c[i].key); + if (val != NULL) { + c[i].val = val; + c[i].envset = true; + } + } + + localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE; + snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", localbase); + + if ((fp = fopen(confpath, "r")) == NULL) { + if (errno != ENOENT) + err(EXIT_FAILURE, "Unable to open configuration file %s", confpath); + /* no configuration present */ + goto finalize; + } + + yaml_parser_initialize(&parser); + yaml_parser_set_input_file(&parser, fp); + yaml_parser_load(&parser, &doc); + + node = yaml_document_get_root_node(&doc); + + if (node != NULL) { + if (node->type != YAML_MAPPING_NODE) + warnx("Invalid configuration format, ignoring the configuration file"); + else + config_parse(&doc, node); + } else { + warnx("Invalid configuration format, ignoring the configuration file"); + } + + yaml_document_delete(&doc); + yaml_parser_delete(&parser); + +finalize: + if (c[ABI].val == NULL && c[ABI].value == NULL) { + if (pkg_get_myabi(abi, BUFSIZ) != 0) + errx(EXIT_FAILURE, "Failed to determine the system ABI"); + c[ABI].val = abi; + } + + subst_packagesite(c[ABI].val); + + return (0); +} + +int +config_string(pkg_config_key k, const char **val) +{ + if (c[k].type != PKG_CONFIG_STRING) + return (-1); + + if (c[k].value != NULL) + *val = c[k].value; + else + *val = c[k].val; + + return (0); +} + +int +config_bool(pkg_config_key k, bool *val) +{ + const char *value; + + if (c[k].type != PKG_CONFIG_BOOL) + return (-1); + + *val = false; + + if (c[k].value != NULL) + value = c[k].value; + else + value = c[k].val; + + if (strcasecmp(value, "true") == 0 || + strcasecmp(value, "yes") == 0 || + strcasecmp(value, "on") == 0 || + *value == '1') + *val = true; + + return (0); +} + +void +config_finish(void) { + int i; + + for (i = 0; i < CONFIG_SIZE; i++) + free(c[i].value); +} Added: head/usr.sbin/pkg/config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pkg/config.h Tue Mar 5 13:31:06 2013 (r247841) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2013 Baptiste Daroussin + * 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$ + */ + +#ifndef _PKG_CONFIG_H +#define _PKG_CONFIG_H + +#define _LOCALBASE "/usr/local" + +typedef enum { + PACKAGESITE = 0, + ABI, + MIRROR_TYPE, + ASSUME_ALWAYS_YES, + CONFIG_SIZE +} pkg_config_key; + +typedef enum { + PKG_CONFIG_STRING=0, + PKG_CONFIG_BOOL, +} pkg_config_t; + +int config_init(void); +void config_finish(void); +int config_string(pkg_config_key, const char **); +int config_bool(pkg_config_key, bool *); + +#endif Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Tue Mar 5 13:06:40 2013 (r247840) +++ head/usr.sbin/pkg/pkg.c Tue Mar 5 13:31:06 2013 (r247841) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Baptiste Daroussin + * Copyright (c) 2012-2013 Baptiste Daroussin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,175 +28,23 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include #include #include -#include #include #include -#include #include -#include #include +#include #include #include #include #include #include -#include "elf_tables.h" #include "dns_utils.h" - -#define _LOCALBASE "/usr/local" -#define _PKGS_URL "http://pkg.FreeBSD.org" - -static const char * -elf_corres_to_string(struct _elf_corres *m, int e) -{ - int i; - - for (i = 0; m[i].string != NULL; i++) - if (m[i].elf_nb == e) - return (m[i].string); - - return ("unknown"); -} - -static int -pkg_get_myabi(char *dest, size_t sz) -{ - Elf *elf; - Elf_Data *data; - Elf_Note note; - Elf_Scn *scn; - char *src, *osname; - const char *abi; - GElf_Ehdr elfhdr; - GElf_Shdr shdr; - int fd, i, ret; - uint32_t version; - - version = 0; - ret = -1; - scn = NULL; - abi = NULL; - - if (elf_version(EV_CURRENT) == EV_NONE) { - warnx("ELF library initialization failed: %s", - elf_errmsg(-1)); - return (-1); - } - - if ((fd = open("/bin/sh", O_RDONLY)) < 0) { - warn("open()"); - return (-1); - } - - if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { - ret = -1; - warnx("elf_begin() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } - - if (gelf_getehdr(elf, &elfhdr) == NULL) { - ret = -1; - warn("getehdr() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } - - while ((scn = elf_nextscn(elf, scn)) != NULL) { - if (gelf_getshdr(scn, &shdr) != &shdr) { - ret = -1; - warn("getshdr() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } - - if (shdr.sh_type == SHT_NOTE) - break; - } - - if (scn == NULL) { - ret = -1; - warn("failed to get the note section"); - goto cleanup; - } - - data = elf_getdata(scn, NULL); - src = data->d_buf; - for (;;) { - memcpy(¬e, src, sizeof(Elf_Note)); - src += sizeof(Elf_Note); - if (note.n_type == NT_VERSION) - break; - src += note.n_namesz + note.n_descsz; - } - osname = src; - src += note.n_namesz; - if (elfhdr.e_ident[EI_DATA] == ELFDATA2MSB) - version = be32dec(src); - else - version = le32dec(src); - - for (i = 0; osname[i] != '\0'; i++) - osname[i] = (char)tolower(osname[i]); - - snprintf(dest, sz, "%s:%d:%s:%s", - osname, version / 100000, - elf_corres_to_string(mach_corres, (int)elfhdr.e_machine), - elf_corres_to_string(wordsize_corres, - (int)elfhdr.e_ident[EI_CLASS])); - - ret = 0; - - switch (elfhdr.e_machine) { - case EM_ARM: - snprintf(dest + strlen(dest), sz - strlen(dest), - ":%s:%s:%s", elf_corres_to_string(endian_corres, - (int)elfhdr.e_ident[EI_DATA]), - (elfhdr.e_flags & EF_ARM_NEW_ABI) > 0 ? - "eabi" : "oabi", - (elfhdr.e_flags & EF_ARM_VFP_FLOAT) > 0 ? - "softfp" : "vfp"); - break; - case EM_MIPS: - /* - * this is taken from binutils sources: - * include/elf/mips.h - * mapping is figured out from binutils: - * gas/config/tc-mips.c - */ - switch (elfhdr.e_flags & EF_MIPS_ABI) { - case E_MIPS_ABI_O32: - abi = "o32"; - break; - case E_MIPS_ABI_N32: - abi = "n32"; - break; - default: - if (elfhdr.e_ident[EI_DATA] == - ELFCLASS32) - abi = "o32"; - else if (elfhdr.e_ident[EI_DATA] == - ELFCLASS64) - abi = "n64"; - break; - } - snprintf(dest + strlen(dest), sz - strlen(dest), - ":%s:%s", elf_corres_to_string(endian_corres, - (int)elfhdr.e_ident[EI_DATA]), abi); - break; - } - -cleanup: - if (elf != NULL) - elf_end(elf); - - close(fd); - return (ret); -} +#include "config.h" static int extract_pkg_static(int fd, char *p, int sz) @@ -291,8 +139,8 @@ bootstrap_pkg(void) char zone[MAXHOSTNAMELEN + 13]; char url[MAXPATHLEN]; char conf[MAXPATHLEN]; - char abi[BUFSIZ]; char tmppkg[MAXPATHLEN]; + const char *packagesite, *mirror_type; char buf[10240]; char pkgstatic[MAXPATHLEN]; int fd, retry, ret, max_retry; @@ -311,17 +159,15 @@ bootstrap_pkg(void) printf("Bootstrapping pkg please wait\n"); - if (pkg_get_myabi(abi, MAXPATHLEN) != 0) { - warnx("failed to determine the system ABI"); + if (config_string(PACKAGESITE, &packagesite) != 0) { + warnx("No PACKAGESITE defined"); return (-1); } - - if (getenv("PACKAGESITE") != NULL) - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", getenv("PACKAGESITE")); - else - snprintf(url, MAXPATHLEN, "%s/%s/latest/Latest/pkg.txz", - getenv("PACKAGEROOT") ? getenv("PACKAGEROOT") : _PKGS_URL, - getenv("ABI") ? getenv("ABI") : abi); + if (config_string(MIRROR_TYPE, &mirror_type) != 0) { + warnx("No MIRROR_TYPE defined"); + return (-1); + } + snprintf(url, MAXPATHLEN, "%s/latest/Latest/pkg.txz", packagesite); snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); @@ -336,10 +182,10 @@ bootstrap_pkg(void) u = fetchParseURL(url); while (remote == NULL) { if (retry == max_retry) { - if (strcmp(u->scheme, "file") != 0) { + if (strcmp(u->scheme, "file") != 0 && + strcasecmp(mirror_type, "srv") == 0) { snprintf(zone, sizeof(zone), "_%s._tcp.%s", u->scheme, u->host); - printf("%s\n", zone); mirrors = dns_getsrvinfo(zone); current = mirrors; } @@ -449,6 +295,7 @@ int main(__unused int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; + bool yes = false; snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); @@ -467,7 +314,9 @@ main(__unused int argc, char *argv[]) * not tty. Check the environment to see if user has answer * tucked in there already. */ - if (getenv("ASSUME_ALWAYS_YES") == NULL) { + config_init(); + config_bool(ASSUME_ALWAYS_YES, &yes); + if (!yes) { printf("%s", confirmation_message); if (!isatty(fileno(stdin))) exit(EXIT_FAILURE); @@ -477,6 +326,7 @@ main(__unused int argc, char *argv[]) } if (bootstrap_pkg() != 0) exit(EXIT_FAILURE); + config_finish(); } execv(pkgpath, argv); From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 13:38:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 63663139; Tue, 5 Mar 2013 13:38:46 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 564C8EF0; Tue, 5 Mar 2013 13:38:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25Dck4C090526; Tue, 5 Mar 2013 13:38:46 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25DckJE090525; Tue, 5 Mar 2013 13:38:46 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303051338.r25DckJE090525@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Tue, 5 Mar 2013 13:38:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247842 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 13:38:46 -0000 Author: melifaro Date: Tue Mar 5 13:38:45 2013 New Revision: 247842 URL: http://svnweb.freebsd.org/changeset/base/247842 Log: Write lock is not required for find&compare operation. MFC after: 2 weeks Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Mar 5 13:31:06 2013 (r247841) +++ head/sys/net/route.c Tue Mar 5 13:38:45 2013 (r247842) @@ -1498,7 +1498,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int if (rnh == NULL) /* this table doesn't exist but others might */ continue; - RADIX_NODE_HEAD_LOCK(rnh); + RADIX_NODE_HEAD_RLOCK(rnh); #ifdef RADIX_MPATH if (rn_mpath_capable(rnh)) { @@ -1527,7 +1527,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int (rn->rn_flags & RNF_ROOT) || RNTORT(rn)->rt_ifa != ifa || !sa_equal((struct sockaddr *)rn->rn_key, dst)); - RADIX_NODE_HEAD_UNLOCK(rnh); + RADIX_NODE_HEAD_RUNLOCK(rnh); if (error) { /* this is only an error if bad on ALL tables */ continue; From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 14:08:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EF9748EE; Tue, 5 Mar 2013 14:08:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D73FB15F; Tue, 5 Mar 2013 14:08:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25E8aj5099755; Tue, 5 Mar 2013 14:08:36 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25E8awl099754; Tue, 5 Mar 2013 14:08:36 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303051408.r25E8awl099754@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 5 Mar 2013 14:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247843 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 14:08:37 -0000 Author: bapt Date: Tue Mar 5 14:08:36 2013 New Revision: 247843 URL: http://svnweb.freebsd.org/changeset/base/247843 Log: choose in priority the allocated ABI if any to do the ${ABI} substitution in PACKAGESITE Reviewed by: bdrewery Modified: head/usr.sbin/pkg/config.c Modified: head/usr.sbin/pkg/config.c ============================================================================== --- head/usr.sbin/pkg/config.c Tue Mar 5 13:38:45 2013 (r247842) +++ head/usr.sbin/pkg/config.c Tue Mar 5 14:08:36 2013 (r247843) @@ -376,7 +376,7 @@ finalize: c[ABI].val = abi; } - subst_packagesite(c[ABI].val); + subst_packagesite(c[ABI].value != NULL ? c[ABI].value : c[ABI].val); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 15:45:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 85231FE8; Tue, 5 Mar 2013 15:45:09 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.78]) by mx1.freebsd.org (Postfix) with ESMTP id 8ABBD996; Tue, 5 Mar 2013 15:45:08 +0000 (UTC) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1UCu36-0006FC-1A; Tue, 05 Mar 2013 16:45:06 +0100 Received: from [81.21.138.17] (helo=ronaldradial.versatec.local) by smtp.greenhost.nl with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1UCu35-0002ji-UZ; Tue, 05 Mar 2013 16:45:03 +0100 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Konstantin Belousov" Subject: Re: svn commit: r247835 - in head/sys: dev/drm2 dev/drm2/ttm modules/drm2/drm2 References: <201303050949.r259nYRn020421@svn.freebsd.org> Date: Tue, 05 Mar 2013 16:45:02 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: In-Reply-To: <201303050949.r259nYRn020421@svn.freebsd.org> User-Agent: Opera Mail/12.14 (Win32) X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: 0.8 X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.1 X-Scan-Signature: 4567a9210dc8a3ba2947d2777f3c295b X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 15:45:09 -0000 I know this is not done yet, but I appreciate the work very much. Regards, Ronald. On Tue, 05 Mar 2013 10:49:34 +0100, Konstantin Belousov wrote: > Author: kib > Date: Tue Mar 5 09:49:34 2013 > New Revision: 247835 > URL: http://svnweb.freebsd.org/changeset/base/247835 > > Log: > Import the preliminary port of the TTM. > The early commit is done to facilitate the off-tree work on the > porting of the Radeon driver. > Sponsored by: The FreeBSD Foundation > Debugged and tested by: dumbbell > MFC after: 1 month > > Added: > head/sys/dev/drm2/ttm/ > head/sys/dev/drm2/ttm/ttm_agp_backend.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo_api.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo_driver.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo_manager.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo_util.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_bo_vm.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_execbuf_util.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_execbuf_util.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_lock.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_lock.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_memory.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_memory.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_module.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_object.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_object.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_page_alloc.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_page_alloc.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_page_alloc_dma.c (contents, props changed) > head/sys/dev/drm2/ttm/ttm_placement.h (contents, props changed) > head/sys/dev/drm2/ttm/ttm_tt.c (contents, props changed) > Modified: > head/sys/dev/drm2/drmP.h > head/sys/dev/drm2/drm_drv.c > head/sys/dev/drm2/drm_gem.c > head/sys/modules/drm2/drm2/Makefile > > Modified: head/sys/dev/drm2/drmP.h > ============================================================================== > --- head/sys/dev/drm2/drmP.h Tue Mar 5 09:27:21 2013 (r247834) > +++ head/sys/dev/drm2/drmP.h Tue Mar 5 09:49:34 2013 (r247835) > @@ -906,6 +906,7 @@ struct drm_device { > struct drm_minor *control; /**< Control node for card */ > struct drm_minor *primary; /**< render type primary screen head */ > + void *drm_ttm_bo; > struct unrhdr *drw_unrhdr; > /* RB tree of drawable infos */ > RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head; > @@ -1302,10 +1303,14 @@ void drm_gem_release(struct drm_device * > int drm_gem_create_mmap_offset(struct drm_gem_object *obj); > void drm_gem_free_mmap_offset(struct drm_gem_object *obj); > -int drm_gem_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, > vm_size_t size, > - struct vm_object **obj_res, int nprot); > +int drm_gem_mmap_single(struct drm_device *dev, vm_ooffset_t *offset, > + vm_size_t size, struct vm_object **obj_res, int nprot); > void drm_gem_pager_dtr(void *obj); > +struct ttm_bo_device; > +int ttm_bo_mmap_single(struct ttm_bo_device *bdev, vm_ooffset_t *offset, > + vm_size_t size, struct vm_object **obj_res, int nprot); > + > void drm_device_lock_mtx(struct drm_device *dev); > void drm_device_unlock_mtx(struct drm_device *dev); > int drm_device_sleep_mtx(struct drm_device *dev, void *chan, int flags, > > Modified: head/sys/dev/drm2/drm_drv.c > ============================================================================== > --- head/sys/dev/drm2/drm_drv.c Tue Mar 5 09:27:21 2013 (r247834) > +++ head/sys/dev/drm2/drm_drv.c Tue Mar 5 09:49:34 2013 (r247835) > @@ -58,6 +58,8 @@ static int drm_load(struct drm_device *d > static void drm_unload(struct drm_device *dev); > static drm_pci_id_list_t *drm_find_description(int vendor, int device, > drm_pci_id_list_t *idlist); > +static int drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, > + vm_size_t size, struct vm_object **obj_res, int nprot); > static int > drm_modevent(module_t mod, int type, void *data) > @@ -187,7 +189,7 @@ static struct cdevsw drm_cdevsw = { > .d_ioctl = drm_ioctl, > .d_poll = drm_poll, > .d_mmap = drm_mmap, > - .d_mmap_single = drm_gem_mmap_single, > + .d_mmap_single = drm_mmap_single, > .d_name = "drm", > .d_flags = D_TRACKCLOSE > }; > @@ -955,6 +957,23 @@ drm_add_busid_modesetting(struct drm_dev > return (0); > } > +static int > +drm_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t size, > + struct vm_object **obj_res, int nprot) > +{ > + struct drm_device *dev; > + > + dev = drm_get_device_from_kdev(kdev); > + if ((dev->driver->driver_features & DRIVER_GEM) != 0) { > + return (drm_gem_mmap_single(dev, offset, size, obj_res, nprot)); > + } else if (dev->drm_ttm_bo != NULL) { > + return (ttm_bo_mmap_single(dev->drm_ttm_bo, offset, size, > + obj_res, nprot)); > + } else { > + return (ENODEV); > + } > +} > + > #if DRM_LINUX > #include > > Modified: head/sys/dev/drm2/drm_gem.c > ============================================================================== > --- head/sys/dev/drm2/drm_gem.c Tue Mar 5 09:27:21 2013 (r247834) > +++ head/sys/dev/drm2/drm_gem.c Tue Mar 5 09:49:34 2013 (r247835) > @@ -441,16 +441,12 @@ drm_gem_free_mmap_offset(struct drm_gem_ > } > int > -drm_gem_mmap_single(struct cdev *kdev, vm_ooffset_t *offset, vm_size_t > size, > +drm_gem_mmap_single(struct drm_device *dev, vm_ooffset_t *offset, > vm_size_t size, > struct vm_object **obj_res, int nprot) > { > - struct drm_device *dev; > struct drm_gem_object *gem_obj; > struct vm_object *vm_obj; > - dev = drm_get_device_from_kdev(kdev); > - if ((dev->driver->driver_features & DRIVER_GEM) == 0) > - return (ENODEV); > DRM_LOCK(dev); > gem_obj = drm_gem_object_from_offset(dev, *offset); > if (gem_obj == NULL) { > > Added: head/sys/dev/drm2/ttm/ttm_agp_backend.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/drm2/ttm/ttm_agp_backend.c Tue Mar 5 09:49:34 > 2013 (r247835) > @@ -0,0 +1,145 @@ > +/************************************************************************** > + * > + * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person > obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sub license, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * The above copyright notice and this permission notice (including the > + * next paragraph) shall be included in all copies or substantial > portions > + * of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > SHALL > + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR > ANY CLAIM, > + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE > OR THE > + * USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + > **************************************************************************/ > +/* > + * Authors: Thomas Hellstrom > + * Keith Packard. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#ifdef TTM_HAS_AGP > +#include > + > +struct ttm_agp_backend { > + struct ttm_tt ttm; > + struct agp_memory *mem; > + device_t bridge; > +}; > + > +MALLOC_DEFINE(M_TTM_AGP, "ttm_agp", "TTM AGP Backend"); > + > +static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) > +{ > + struct ttm_agp_backend *agp_be = container_of(ttm, struct > ttm_agp_backend, ttm); > + struct drm_mm_node *node = bo_mem->mm_node; > + struct agp_memory *mem; > + int ret, cached = (bo_mem->placement & TTM_PL_FLAG_CACHED); > + unsigned i; > + > + mem = agp_alloc_memory(agp_be->bridge, AGP_USER_MEMORY, > ttm->num_pages); > + if (unlikely(mem == NULL)) > + return -ENOMEM; > + > + mem->page_count = 0; > + for (i = 0; i < ttm->num_pages; i++) { > + vm_page_t page = ttm->pages[i]; > + > + if (!page) > + page = ttm->dummy_read_page; > + > + mem->pages[mem->page_count++] = page; > + } > + agp_be->mem = mem; > + > + mem->is_flushed = 1; > + mem->type = (cached) ? AGP_USER_CACHED_MEMORY : AGP_USER_MEMORY; > + > + ret = agp_bind_memory(mem, node->start); > + if (ret) > + pr_err("AGP Bind memory failed\n"); > + > + return ret; > +} > + > +static int ttm_agp_unbind(struct ttm_tt *ttm) > +{ > + struct ttm_agp_backend *agp_be = container_of(ttm, struct > ttm_agp_backend, ttm); > + > + if (agp_be->mem) { > + if (agp_be->mem->is_bound) > + return agp_unbind_memory(agp_be->mem); > + agp_free_memory(agp_be->mem); > + agp_be->mem = NULL; > + } > + return 0; > +} > + > +static void ttm_agp_destroy(struct ttm_tt *ttm) > +{ > + struct ttm_agp_backend *agp_be = container_of(ttm, struct > ttm_agp_backend, ttm); > + > + if (agp_be->mem) > + ttm_agp_unbind(ttm); > + ttm_tt_fini(ttm); > + free(agp_be, M_TTM_AGP); > +} > + > +static struct ttm_backend_func ttm_agp_func = { > + .bind = ttm_agp_bind, > + .unbind = ttm_agp_unbind, > + .destroy = ttm_agp_destroy, > +}; > + > +struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, > + device_t bridge, > + unsigned long size, uint32_t page_flags, > + vm_page_t dummy_read_page) > +{ > + struct ttm_agp_backend *agp_be; > + > + agp_be = malloc(sizeof(*agp_be), M_TTM_AGP, M_WAITOK | M_ZERO); > + > + agp_be->mem = NULL; > + agp_be->bridge = bridge; > + agp_be->ttm.func = &ttm_agp_func; > + > + if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, > dummy_read_page)) { > + return NULL; > + } > + > + return &agp_be->ttm; > +} > + > +int ttm_agp_tt_populate(struct ttm_tt *ttm) > +{ > + if (ttm->state != tt_unpopulated) > + return 0; > + > + return ttm_pool_populate(ttm); > +} > + > +void ttm_agp_tt_unpopulate(struct ttm_tt *ttm) > +{ > + ttm_pool_unpopulate(ttm); > +} > + > +#endif > > Added: head/sys/dev/drm2/ttm/ttm_bo.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/drm2/ttm/ttm_bo.c Tue Mar 5 09:49:34 2013 (r247835) > @@ -0,0 +1,1820 @@ > +/************************************************************************** > + * > + * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person > obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sub license, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * The above copyright notice and this permission notice (including the > + * next paragraph) shall be included in all copies or substantial > portions > + * of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > SHALL > + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR > ANY CLAIM, > + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE > OR THE > + * USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + > **************************************************************************/ > +/* > + * Authors: Thomas Hellstrom > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > + > +#define TTM_ASSERT_LOCKED(param) > +#define TTM_DEBUG(fmt, arg...) > +#define TTM_BO_HASH_ORDER 13 > + > +static int ttm_bo_setup_vm(struct ttm_buffer_object *bo); > +static int ttm_bo_swapout(struct ttm_mem_shrink *shrink); > +static void ttm_bo_global_kobj_release(struct ttm_bo_global *glob); > + > +MALLOC_DEFINE(M_TTM_BO, "ttm_bo", "TTM Buffer Objects"); > + > +static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t > *mem_type) > +{ > + int i; > + > + for (i = 0; i <= TTM_PL_PRIV5; i++) > + if (flags & (1 << i)) { > + *mem_type = i; > + return 0; > + } > + return -EINVAL; > +} > + > +static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) > +{ > + struct ttm_mem_type_manager *man = &bdev->man[mem_type]; > + > + printf(" has_type: %d\n", man->has_type); > + printf(" use_type: %d\n", man->use_type); > + printf(" flags: 0x%08X\n", man->flags); > + printf(" gpu_offset: 0x%08lX\n", man->gpu_offset); > + printf(" size: %ju\n", (uintmax_t)man->size); > + printf(" available_caching: 0x%08X\n", man->available_caching); > + printf(" default_caching: 0x%08X\n", man->default_caching); > + if (mem_type != TTM_PL_SYSTEM) > + (*man->func->debug)(man, TTM_PFX); > +} > + > +static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, > + struct ttm_placement *placement) > +{ > + int i, ret, mem_type; > + > + printf("No space for %p (%lu pages, %luK, %luM)\n", > + bo, bo->mem.num_pages, bo->mem.size >> 10, > + bo->mem.size >> 20); > + for (i = 0; i < placement->num_placement; i++) { > + ret = ttm_mem_type_from_flags(placement->placement[i], > + &mem_type); > + if (ret) > + return; > + printf(" placement[%d]=0x%08X (%d)\n", > + i, placement->placement[i], mem_type); > + ttm_mem_type_debug(bo->bdev, mem_type); > + } > +} > + > +#if 0 > +static ssize_t ttm_bo_global_show(struct ttm_bo_global *glob, > + char *buffer) > +{ > + > + return snprintf(buffer, PAGE_SIZE, "%lu\n", > + (unsigned long) atomic_read(&glob->bo_count)); > +} > +#endif > + > +static inline uint32_t ttm_bo_type_flags(unsigned type) > +{ > + return 1 << (type); > +} > + > +static void ttm_bo_release_list(struct ttm_buffer_object *bo) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + size_t acc_size = bo->acc_size; > + > + MPASS(atomic_read(&bo->list_kref) == 0); > + MPASS(atomic_read(&bo->kref) == 0); > + MPASS(atomic_read(&bo->cpu_writers) == 0); > + MPASS(bo->sync_obj == NULL); > + MPASS(bo->mem.mm_node == NULL); > + MPASS(list_empty(&bo->lru)); > + MPASS(list_empty(&bo->ddestroy)); > + > + if (bo->ttm) > + ttm_tt_destroy(bo->ttm); > + atomic_dec(&bo->glob->bo_count); > + if (bo->destroy) > + bo->destroy(bo); > + else { > + free(bo, M_TTM_BO); > + } > + ttm_mem_global_free(bdev->glob->mem_glob, acc_size); > +} > + > +int > +ttm_bo_wait_unreserved_locked(struct ttm_buffer_object *bo, bool > interruptible) > +{ > + const char *wmsg; > + int flags, ret; > + > + ret = 0; > + if (interruptible) { > + flags = PCATCH; > + wmsg = "ttbowi"; > + } else { > + flags = 0; > + wmsg = "ttbowu"; > + } > + while (!ttm_bo_is_reserved(bo)) { > + ret = -msleep(bo, &bo->glob->lru_lock, flags, wmsg, 0); > + if (ret != 0) > + break; > + } > + return (ret); > +} > + > +void ttm_bo_add_to_lru(struct ttm_buffer_object *bo) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_mem_type_manager *man; > + > + MPASS(ttm_bo_is_reserved(bo)); > + > + if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) { > + > + MPASS(list_empty(&bo->lru)); > + > + man = &bdev->man[bo->mem.mem_type]; > + list_add_tail(&bo->lru, &man->lru); > + refcount_acquire(&bo->list_kref); > + > + if (bo->ttm != NULL) { > + list_add_tail(&bo->swap, &bo->glob->swap_lru); > + refcount_acquire(&bo->list_kref); > + } > + } > +} > + > +int ttm_bo_del_from_lru(struct ttm_buffer_object *bo) > +{ > + int put_count = 0; > + > + if (!list_empty(&bo->swap)) { > + list_del_init(&bo->swap); > + ++put_count; > + } > + if (!list_empty(&bo->lru)) { > + list_del_init(&bo->lru); > + ++put_count; > + } > + > + /* > + * TODO: Add a driver hook to delete from > + * driver-specific LRU's here. > + */ > + > + return put_count; > +} > + > +int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, > + bool interruptible, > + bool no_wait, bool use_sequence, uint32_t sequence) > +{ > + int ret; > + > + while (unlikely(atomic_read(&bo->reserved) != 0)) { > + /** > + * Deadlock avoidance for multi-bo reserving. > + */ > + if (use_sequence && bo->seq_valid) { > + /** > + * We've already reserved this one. > + */ > + if (unlikely(sequence == bo->val_seq)) > + return -EDEADLK; > + /** > + * Already reserved by a thread that will not back > + * off for us. We need to back off. > + */ > + if (unlikely(sequence - bo->val_seq < (1 << 31))) > + return -EAGAIN; > + } > + > + if (no_wait) > + return -EBUSY; > + > + ret = ttm_bo_wait_unreserved_locked(bo, interruptible); > + if (unlikely(ret)) > + return ret; > + } > + > + atomic_set(&bo->reserved, 1); > + if (use_sequence) { > + /** > + * Wake up waiters that may need to recheck for deadlock, > + * if we decreased the sequence number. > + */ > + if (unlikely((bo->val_seq - sequence < (1 << 31)) > + || !bo->seq_valid)) > + wakeup(bo); > + > + bo->val_seq = sequence; > + bo->seq_valid = true; > + } else { > + bo->seq_valid = false; > + } > + > + return 0; > +} > + > +void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count, > + bool never_free) > +{ > + u_int old; > + > + old = atomic_fetchadd_int(&bo->list_kref, -count); > + if (old <= count) { > + if (never_free) > + panic("ttm_bo_ref_buf"); > + ttm_bo_release_list(bo); > + } > +} > + > +int ttm_bo_reserve(struct ttm_buffer_object *bo, > + bool interruptible, > + bool no_wait, bool use_sequence, uint32_t sequence) > +{ > + struct ttm_bo_global *glob = bo->glob; > + int put_count = 0; > + int ret; > + > + mtx_lock(&glob->lru_lock); > + ret = ttm_bo_reserve_locked(bo, interruptible, no_wait, use_sequence, > + sequence); > + if (likely(ret == 0)) > + put_count = ttm_bo_del_from_lru(bo); > + mtx_unlock(&glob->lru_lock); > + > + ttm_bo_list_ref_sub(bo, put_count, true); > + > + return ret; > +} > + > +void ttm_bo_unreserve_locked(struct ttm_buffer_object *bo) > +{ > + ttm_bo_add_to_lru(bo); > + atomic_set(&bo->reserved, 0); > + wakeup(bo); > +} > + > +void ttm_bo_unreserve(struct ttm_buffer_object *bo) > +{ > + struct ttm_bo_global *glob = bo->glob; > + > + mtx_lock(&glob->lru_lock); > + ttm_bo_unreserve_locked(bo); > + mtx_unlock(&glob->lru_lock); > +} > + > +/* > + * Call bo->mutex locked. > + */ > +static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_bo_global *glob = bo->glob; > + int ret = 0; > + uint32_t page_flags = 0; > + > + TTM_ASSERT_LOCKED(&bo->mutex); > + bo->ttm = NULL; > + > + if (bdev->need_dma32) > + page_flags |= TTM_PAGE_FLAG_DMA32; > + > + switch (bo->type) { > + case ttm_bo_type_device: > + if (zero_alloc) > + page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC; > + case ttm_bo_type_kernel: > + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << > PAGE_SHIFT, > + page_flags, glob->dummy_read_page); > + if (unlikely(bo->ttm == NULL)) > + ret = -ENOMEM; > + break; > + case ttm_bo_type_sg: > + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << > PAGE_SHIFT, > + page_flags | TTM_PAGE_FLAG_SG, > + glob->dummy_read_page); > + if (unlikely(bo->ttm == NULL)) { > + ret = -ENOMEM; > + break; > + } > + bo->ttm->sg = bo->sg; > + break; > + default: > + printf("[TTM] Illegal buffer object type\n"); > + ret = -EINVAL; > + break; > + } > + > + return ret; > +} > + > +static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > + struct ttm_mem_reg *mem, > + bool evict, bool interruptible, > + bool no_wait_gpu) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + bool old_is_pci = ttm_mem_reg_is_pci(bdev, &bo->mem); > + bool new_is_pci = ttm_mem_reg_is_pci(bdev, mem); > + struct ttm_mem_type_manager *old_man = &bdev->man[bo->mem.mem_type]; > + struct ttm_mem_type_manager *new_man = &bdev->man[mem->mem_type]; > + int ret = 0; > + > + if (old_is_pci || new_is_pci || > + ((mem->placement & bo->mem.placement & TTM_PL_MASK_CACHING) == 0)) > { > + ret = ttm_mem_io_lock(old_man, true); > + if (unlikely(ret != 0)) > + goto out_err; > + ttm_bo_unmap_virtual_locked(bo); > + ttm_mem_io_unlock(old_man); > + } > + > + /* > + * Create and bind a ttm if required. > + */ > + > + if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) { > + if (bo->ttm == NULL) { > + bool zero = !(old_man->flags & TTM_MEMTYPE_FLAG_FIXED); > + ret = ttm_bo_add_ttm(bo, zero); > + if (ret) > + goto out_err; > + } > + > + ret = ttm_tt_set_placement_caching(bo->ttm, mem->placement); > + if (ret) > + goto out_err; > + > + if (mem->mem_type != TTM_PL_SYSTEM) { > + ret = ttm_tt_bind(bo->ttm, mem); > + if (ret) > + goto out_err; > + } > + > + if (bo->mem.mem_type == TTM_PL_SYSTEM) { > + if (bdev->driver->move_notify) > + bdev->driver->move_notify(bo, mem); > + bo->mem = *mem; > + mem->mm_node = NULL; > + goto moved; > + } > + } > + > + if (bdev->driver->move_notify) > + bdev->driver->move_notify(bo, mem); > + > + if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && > + !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) > + ret = ttm_bo_move_ttm(bo, evict, no_wait_gpu, mem); > + else if (bdev->driver->move) > + ret = bdev->driver->move(bo, evict, interruptible, > + no_wait_gpu, mem); > + else > + ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, mem); > + > + if (ret) { > + if (bdev->driver->move_notify) { > + struct ttm_mem_reg tmp_mem = *mem; > + *mem = bo->mem; > + bo->mem = tmp_mem; > + bdev->driver->move_notify(bo, mem); > + bo->mem = *mem; > + } > + > + goto out_err; > + } > + > +moved: > + if (bo->evicted) { > + ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); > + if (ret) > + printf("[TTM] Can not flush read caches\n"); > + bo->evicted = false; > + } > + > + if (bo->mem.mm_node) { > + bo->offset = (bo->mem.start << PAGE_SHIFT) + > + bdev->man[bo->mem.mem_type].gpu_offset; > + bo->cur_placement = bo->mem.placement; > + } else > + bo->offset = 0; > + > + return 0; > + > +out_err: > + new_man = &bdev->man[bo->mem.mem_type]; > + if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) { > + ttm_tt_unbind(bo->ttm); > + ttm_tt_destroy(bo->ttm); > + bo->ttm = NULL; > + } > + > + return ret; > +} > + > +/** > + * Call bo::reserved. > + * Will release GPU memory type usage on destruction. > + * This is the place to put in driver specific hooks to release > + * driver private resources. > + * Will release the bo::reserved lock. > + */ > + > +static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) > +{ > + if (bo->bdev->driver->move_notify) > + bo->bdev->driver->move_notify(bo, NULL); > + > + if (bo->ttm) { > + ttm_tt_unbind(bo->ttm); > + ttm_tt_destroy(bo->ttm); > + bo->ttm = NULL; > + } > + ttm_bo_mem_put(bo, &bo->mem); > + > + atomic_set(&bo->reserved, 0); > + wakeup(&bo); > + > + /* > + * Since the final reference to this bo may not be dropped by > + * the current task we have to put a memory barrier here to make > + * sure the changes done in this function are always visible. > + * > + * This function only needs protection against the final kref_put. > + */ > + mb(); > +} > + > +static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_bo_global *glob = bo->glob; > + struct ttm_bo_driver *driver = bdev->driver; > + void *sync_obj = NULL; > + int put_count; > + int ret; > + > + mtx_lock(&glob->lru_lock); > + ret = ttm_bo_reserve_locked(bo, false, true, false, 0); > + > + mtx_lock(&bdev->fence_lock); > + (void) ttm_bo_wait(bo, false, false, true); > + if (!ret && !bo->sync_obj) { > + mtx_unlock(&bdev->fence_lock); > + put_count = ttm_bo_del_from_lru(bo); > + > + mtx_unlock(&glob->lru_lock); > + ttm_bo_cleanup_memtype_use(bo); > + > + ttm_bo_list_ref_sub(bo, put_count, true); > + > + return; > + } > + if (bo->sync_obj) > + sync_obj = driver->sync_obj_ref(bo->sync_obj); > + mtx_unlock(&bdev->fence_lock); > + > + if (!ret) { > + atomic_set(&bo->reserved, 0); > + wakeup(bo); > + } > + > + refcount_acquire(&bo->list_kref); > + list_add_tail(&bo->ddestroy, &bdev->ddestroy); > + mtx_unlock(&glob->lru_lock); > + > + if (sync_obj) { > + driver->sync_obj_flush(sync_obj); > + driver->sync_obj_unref(&sync_obj); > + } > + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, > + ((hz / 100) < 1) ? 1 : hz / 100); > +} > + > +/** > + * function ttm_bo_cleanup_refs_and_unlock > + * If bo idle, remove from delayed- and lru lists, and unref. > + * If not idle, do nothing. > + * > + * Must be called with lru_lock and reservation held, this function > + * will drop both before returning. > + * > + * @interruptible Any sleeps should occur interruptibly. > + * @no_wait_gpu Never wait for gpu. Return -EBUSY instead. > + */ > + > +static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo, > + bool interruptible, > + bool no_wait_gpu) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_bo_driver *driver = bdev->driver; > + struct ttm_bo_global *glob = bo->glob; > + int put_count; > + int ret; > + > + mtx_lock(&bdev->fence_lock); > + ret = ttm_bo_wait(bo, false, false, true); > + > + if (ret && !no_wait_gpu) { > + void *sync_obj; > + > + /* > + * Take a reference to the fence and unreserve, > + * at this point the buffer should be dead, so > + * no new sync objects can be attached. > + */ > + sync_obj = driver->sync_obj_ref(bo->sync_obj); > + mtx_unlock(&bdev->fence_lock); > + > + atomic_set(&bo->reserved, 0); > + wakeup(bo); > + mtx_unlock(&glob->lru_lock); > + > + ret = driver->sync_obj_wait(sync_obj, false, interruptible); > + driver->sync_obj_unref(&sync_obj); > + if (ret) > + return ret; > + > + /* > + * remove sync_obj with ttm_bo_wait, the wait should be > + * finished, and no new wait object should have been added. > + */ > + mtx_lock(&bdev->fence_lock); > + ret = ttm_bo_wait(bo, false, false, true); > + mtx_unlock(&bdev->fence_lock); > + if (ret) > + return ret; > + > + mtx_lock(&glob->lru_lock); > + ret = ttm_bo_reserve_locked(bo, false, true, false, 0); > + > + /* > + * We raced, and lost, someone else holds the reservation now, > + * and is probably busy in ttm_bo_cleanup_memtype_use. > + * > + * Even if it's not the case, because we finished waiting any > + * delayed destruction would succeed, so just return success > + * here. > + */ > + if (ret) { > + mtx_unlock(&glob->lru_lock); > + return 0; > + } > + } else > + mtx_unlock(&bdev->fence_lock); > + > + if (ret || unlikely(list_empty(&bo->ddestroy))) { > + atomic_set(&bo->reserved, 0); > + wakeup(bo); > + mtx_unlock(&glob->lru_lock); > + return ret; > + } > + > + put_count = ttm_bo_del_from_lru(bo); > + list_del_init(&bo->ddestroy); > + ++put_count; > + > + mtx_unlock(&glob->lru_lock); > + ttm_bo_cleanup_memtype_use(bo); > + > + ttm_bo_list_ref_sub(bo, put_count, true); > + > + return 0; > +} > + > +/** > + * Traverse the delayed list, and call ttm_bo_cleanup_refs on all > + * encountered buffers. > + */ > + > +static int ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool > remove_all) > +{ > + struct ttm_bo_global *glob = bdev->glob; > + struct ttm_buffer_object *entry = NULL; > + int ret = 0; > + > + mtx_lock(&glob->lru_lock); > + if (list_empty(&bdev->ddestroy)) > + goto out_unlock; > + > + entry = list_first_entry(&bdev->ddestroy, > + struct ttm_buffer_object, ddestroy); > + refcount_acquire(&entry->list_kref); > + > + for (;;) { > + struct ttm_buffer_object *nentry = NULL; > + > + if (entry->ddestroy.next != &bdev->ddestroy) { > + nentry = list_first_entry(&entry->ddestroy, > + struct ttm_buffer_object, ddestroy); > + refcount_acquire(&nentry->list_kref); > + } > + > + ret = ttm_bo_reserve_locked(entry, false, !remove_all, false, 0); > + if (!ret) > + ret = ttm_bo_cleanup_refs_and_unlock(entry, false, > + !remove_all); > + else > + mtx_unlock(&glob->lru_lock); > + > + if (refcount_release(&entry->list_kref)) > + ttm_bo_release_list(entry); > + entry = nentry; > + > + if (ret || !entry) > + goto out; > + > + mtx_lock(&glob->lru_lock); > + if (list_empty(&entry->ddestroy)) > + break; > + } > + > +out_unlock: > + mtx_unlock(&glob->lru_lock); > +out: > + if (entry && refcount_release(&entry->list_kref)) > + ttm_bo_release_list(entry); > + return ret; > +} > + > +static void ttm_bo_delayed_workqueue(void *arg, int pending __unused) > +{ > + struct ttm_bo_device *bdev = arg; > + > + if (ttm_bo_delayed_delete(bdev, false)) { > + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, > + ((hz / 100) < 1) ? 1 : hz / 100); > + } > +} > + > +static void ttm_bo_release(struct ttm_buffer_object *bo) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; > + > + rw_wlock(&bdev->vm_lock); > + if (likely(bo->vm_node != NULL)) { > + RB_REMOVE(ttm_bo_device_buffer_objects, > + &bdev->addr_space_rb, bo); > + drm_mm_put_block(bo->vm_node); > + bo->vm_node = NULL; > + } > + rw_wunlock(&bdev->vm_lock); > + ttm_mem_io_lock(man, false); > + ttm_mem_io_free_vm(bo); > + ttm_mem_io_unlock(man); > + ttm_bo_cleanup_refs_or_queue(bo); > + if (refcount_release(&bo->list_kref)) > + ttm_bo_release_list(bo); > +} > + > +void ttm_bo_unref(struct ttm_buffer_object **p_bo) > +{ > + struct ttm_buffer_object *bo = *p_bo; > + > + *p_bo = NULL; > + if (refcount_release(&bo->kref)) > + ttm_bo_release(bo); > +} > + > +int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev) > +{ > + int pending; > + > + taskqueue_cancel_timeout(taskqueue_thread, &bdev->wq, &pending); > + if (pending) > + taskqueue_drain_timeout(taskqueue_thread, &bdev->wq); > + return (pending); > +} > + > +void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int > resched) > +{ > + if (resched) { > + taskqueue_enqueue_timeout(taskqueue_thread, &bdev->wq, > + ((hz / 100) < 1) ? 1 : hz / 100); > + } > +} > + > +static int ttm_bo_evict(struct ttm_buffer_object *bo, bool > interruptible, > + bool no_wait_gpu) > +{ > + struct ttm_bo_device *bdev = bo->bdev; > + struct ttm_mem_reg evict_mem; > + struct ttm_placement placement; > + int ret = 0; > + > + mtx_lock(&bdev->fence_lock); > + ret = ttm_bo_wait(bo, false, interruptible, no_wait_gpu); > + mtx_unlock(&bdev->fence_lock); > + > + if (unlikely(ret != 0)) { > + if (ret != -ERESTART) { > + printf("[TTM] Failed to expire sync object before buffer > eviction\n"); > + } > + goto out; > + } > + > + MPASS(ttm_bo_is_reserved(bo)); > + > + evict_mem = bo->mem; > + evict_mem.mm_node = NULL; > + evict_mem.bus.io_reserved_vm = false; > + evict_mem.bus.io_reserved_count = 0; > + > + placement.fpfn = 0; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 16:14:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 531CA1E3; Tue, 5 Mar 2013 16:14:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 45A72B61; Tue, 5 Mar 2013 16:14:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25GEuRU039046; Tue, 5 Mar 2013 16:14:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25GEumU039045; Tue, 5 Mar 2013 16:14:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303051614.r25GEumU039045@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 16:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247848 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 16:14:56 -0000 Author: kib Date: Tue Mar 5 16:14:55 2013 New Revision: 247848 URL: http://svnweb.freebsd.org/changeset/base/247848 Log: Fix build with gcc, remove redundand declarations. Reported and tested by: gjb MFC after: 1 month Modified: head/sys/dev/drm2/ttm/ttm_lock.h Modified: head/sys/dev/drm2/ttm/ttm_lock.h ============================================================================== --- head/sys/dev/drm2/ttm/ttm_lock.h Tue Mar 5 16:04:15 2013 (r247847) +++ head/sys/dev/drm2/ttm/ttm_lock.h Tue Mar 5 16:14:55 2013 (r247848) @@ -125,27 +125,6 @@ extern int ttm_read_lock(struct ttm_lock extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible); /** - * ttm_write_unlock - * - * @lock: Pointer to a struct ttm_lock - * - * Releases a write lock. - */ -extern void ttm_write_unlock(struct ttm_lock *lock); - -/** - * ttm_write_lock - * - * @lock: Pointer to a struct ttm_lock - * @interruptible: Interruptible sleeping while waiting for a lock. - * - * Takes the lock in write mode. - * Returns: - * -ERESTARTSYS If interrupted by a signal and interruptible is true. - */ -extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); - -/** * ttm_lock_downgrade * * @lock: Pointer to a struct ttm_lock From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 16:15:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C8FB135B; Tue, 5 Mar 2013 16:15:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5AFEB6B; Tue, 5 Mar 2013 16:15:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25GFYjX039226; Tue, 5 Mar 2013 16:15:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25GFYv5039225; Tue, 5 Mar 2013 16:15:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303051615.r25GFYv5039225@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 5 Mar 2013 16:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247849 - head/sys/dev/drm2/ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 16:15:34 -0000 Author: kib Date: Tue Mar 5 16:15:34 2013 New Revision: 247849 URL: http://svnweb.freebsd.org/changeset/base/247849 Log: Fix build with gcc, do not use unnamed union. Reported and tested by: gjb MFC after: 1 month Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_page_alloc.c Tue Mar 5 16:14:55 2013 (r247848) +++ head/sys/dev/drm2/ttm/ttm_page_alloc.c Tue Mar 5 16:15:34 2013 (r247849) @@ -113,16 +113,22 @@ struct ttm_pool_manager { struct ttm_pool_opts options; union { - struct ttm_page_pool pools[NUM_POOLS]; - struct { - struct ttm_page_pool wc_pool; - struct ttm_page_pool uc_pool; - struct ttm_page_pool wc_pool_dma32; - struct ttm_page_pool uc_pool_dma32; - } ; - }; + struct ttm_page_pool u_pools[NUM_POOLS]; + struct _utag { + struct ttm_page_pool u_wc_pool; + struct ttm_page_pool u_uc_pool; + struct ttm_page_pool u_wc_pool_dma32; + struct ttm_page_pool u_uc_pool_dma32; + } _ut; + } _u; }; +#define pools _u.u_pools +#define wc_pool _u._ut.u_wc_pool +#define uc_pool _u._ut.u_uc_pool +#define wc_pool_dma32 _u._ut.u_wc_pool_dma32 +#define uc_pool_dma32 _u._ut.u_uc_pool_dma32 + MALLOC_DEFINE(M_TTM_POOLMGR, "ttm_poolmgr", "TTM Pool Manager"); static void From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 18:54:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ED32A3CB; Tue, 5 Mar 2013 18:54:42 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D9365779; Tue, 5 Mar 2013 18:54:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25Isg6O088340; Tue, 5 Mar 2013 18:54:42 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25Isfpi088335; Tue, 5 Mar 2013 18:54:41 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201303051854.r25Isfpi088335@svn.freebsd.org> From: Martin Matuska Date: Tue, 5 Mar 2013 18:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247852 - in head: cddl/contrib/opensolaris/cmd/zdb 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 18:54:43 -0000 Author: mm Date: Tue Mar 5 18:54:41 2013 New Revision: 247852 URL: http://svnweb.freebsd.org/changeset/base/247852 Log: MFV r247845: Import ZFS bpobj bugfix from vendor. Illumos ZFS issues: 3603 panic from bpobj_enqueue_subobj() 3604 zdb should print bpobjs more verbosely References: https://www.illumos.org/issues/3603 https://www.illumos.org/issues/3604 MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Mar 5 17:46:12 2013 (r247851) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Mar 5 18:54:41 2013 (r247852) @@ -1189,7 +1189,7 @@ dump_bpobj_cb(void *arg, const blkptr_t } static void -dump_bpobj(bpobj_t *bpo, char *name) +dump_bpobj(bpobj_t *bpo, char *name, int indent) { char bytes[32]; char comp[32]; @@ -1199,31 +1199,56 @@ dump_bpobj(bpobj_t *bpo, char *name) return; zdb_nicenum(bpo->bpo_phys->bpo_bytes, bytes); - if (bpo->bpo_havesubobj) { + if (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_subobjs != 0) { zdb_nicenum(bpo->bpo_phys->bpo_comp, comp); zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp); - (void) printf("\n %s: %llu local blkptrs, %llu subobjs, " - "%s (%s/%s comp)\n", - name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, + (void) printf(" %*s: object %llu, %llu local blkptrs, " + "%llu subobjs, %s (%s/%s comp)\n", + indent * 8, name, + (u_longlong_t)bpo->bpo_object, + (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, (u_longlong_t)bpo->bpo_phys->bpo_num_subobjs, bytes, comp, uncomp); + + for (uint64_t i = 0; i < bpo->bpo_phys->bpo_num_subobjs; i++) { + uint64_t subobj; + bpobj_t subbpo; + int error; + VERIFY0(dmu_read(bpo->bpo_os, + bpo->bpo_phys->bpo_subobjs, + i * sizeof (subobj), sizeof (subobj), &subobj, 0)); + error = bpobj_open(&subbpo, bpo->bpo_os, subobj); + if (error != 0) { + (void) printf("ERROR %u while trying to open " + "subobj id %llu\n", + error, (u_longlong_t)subobj); + continue; + } + dump_bpobj(&subbpo, "subobj", indent + 1); + } } else { - (void) printf("\n %s: %llu blkptrs, %s\n", - name, (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, bytes); + (void) printf(" %*s: object %llu, %llu blkptrs, %s\n", + indent * 8, name, + (u_longlong_t)bpo->bpo_object, + (u_longlong_t)bpo->bpo_phys->bpo_num_blkptrs, + bytes); } if (dump_opt['d'] < 5) return; - (void) printf("\n"); - (void) bpobj_iterate_nofree(bpo, dump_bpobj_cb, NULL, NULL); + if (indent == 0) { + (void) bpobj_iterate_nofree(bpo, dump_bpobj_cb, NULL, NULL); + (void) printf("\n"); + } } static void dump_deadlist(dsl_deadlist_t *dl) { dsl_deadlist_entry_t *dle; + uint64_t unused; char bytes[32]; char comp[32]; char uncomp[32]; @@ -1242,14 +1267,24 @@ dump_deadlist(dsl_deadlist_t *dl) (void) printf("\n"); + /* force the tree to be loaded */ + dsl_deadlist_space_range(dl, 0, UINT64_MAX, &unused, &unused, &unused); + for (dle = avl_first(&dl->dl_tree); dle; dle = AVL_NEXT(&dl->dl_tree, dle)) { - (void) printf(" mintxg %llu -> obj %llu\n", - (longlong_t)dle->dle_mintxg, - (longlong_t)dle->dle_bpobj.bpo_object); + if (dump_opt['d'] >= 5) { + char buf[128]; + (void) snprintf(buf, sizeof (buf), "mintxg %llu -> ", + (longlong_t)dle->dle_mintxg, + (longlong_t)dle->dle_bpobj.bpo_object); - if (dump_opt['d'] >= 5) - dump_bpobj(&dle->dle_bpobj, ""); + dump_bpobj(&dle->dle_bpobj, buf, 0); + } else { + (void) printf("mintxg %llu -> obj %llu\n", + (longlong_t)dle->dle_mintxg, + (longlong_t)dle->dle_bpobj.bpo_object); + + } } } @@ -1272,7 +1307,7 @@ fuid_table_destroy() * print uid or gid information. * For normal POSIX id just the id is printed in decimal format. * For CIFS files with FUID the fuid is printed in hex followed by - * the doman-rid string. + * the domain-rid string. */ static void print_idstr(uint64_t id, const char *id_type) @@ -2529,10 +2564,11 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); if (dump_opt['d'] >= 3) { - dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees"); + dump_bpobj(&spa->spa_deferred_bpobj, + "Deferred frees", 0); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj, - "Pool snapshot frees"); + "Pool snapshot frees", 0); } if (spa_feature_is_active(spa, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Tue Mar 5 17:46:12 2013 (r247851) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c Tue Mar 5 18:54:41 2013 (r247852) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include @@ -414,6 +414,12 @@ bpobj_enqueue_subobj(bpobj_t *bpo, uint6 VERIFY3U(0, ==, dmu_buf_hold(bpo->bpo_os, subsubobjs, 0, FTAG, &subdb, 0)); + /* + * Make sure that we are not asking dmu_write() + * to write more data than we have in our buffer. + */ + VERIFY3U(subdb->db_size, >=, + numsubsub * sizeof (subobj)); dmu_write(bpo->bpo_os, bpo->bpo_phys->bpo_subobjs, bpo->bpo_phys->bpo_num_subobjs * sizeof (subobj), numsubsub * sizeof (subobj), subdb->db_data, tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Mar 5 17:46:12 2013 (r247851) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Tue Mar 5 18:54:41 2013 (r247852) @@ -1711,7 +1711,7 @@ dmu_object_info_from_dnode(dnode_t *dn, doi->doi_checksum = dn->dn_checksum; doi->doi_compress = dn->dn_compress; doi->doi_physical_blocks_512 = (DN_USED_BYTES(dnp) + 256) >> 9; - doi->doi_max_offset = (dnp->dn_maxblkid + 1) * dn->dn_datablksz; + doi->doi_max_offset = (dn->dn_maxblkid + 1) * dn->dn_datablksz; doi->doi_fill_count = 0; for (int i = 0; i < dnp->dn_nblkptr; i++) doi->doi_fill_count += dnp->dn_blkptr[i].blk_fill; From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 19:37:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EBB95EFC; Tue, 5 Mar 2013 19:37:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D43E1948; Tue, 5 Mar 2013 19:37:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25JbThJ001119; Tue, 5 Mar 2013 19:37:29 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25JbTZh001118; Tue, 5 Mar 2013 19:37:29 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201303051937.r25JbTZh001118@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 5 Mar 2013 19:37:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247854 - head/tools/tools/cxgbetool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 19:37:30 -0000 Author: np Date: Tue Mar 5 19:37:29 2013 New Revision: 247854 URL: http://svnweb.freebsd.org/changeset/base/247854 Log: Fix compile warning by including ctype.h for isdigit(). MFC after: 1 day Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Tue Mar 5 19:20:34 2013 (r247853) +++ head/tools/tools/cxgbetool/cxgbetool.c Tue Mar 5 19:37:29 2013 (r247854) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 20:00:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 36C2C70C; Tue, 5 Mar 2013 20:00:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 282C0A3C; Tue, 5 Mar 2013 20:00:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25K0Btm007619; Tue, 5 Mar 2013 20:00:11 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25K0BIn007618; Tue, 5 Mar 2013 20:00:11 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201303052000.r25K0BIn007618@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 5 Mar 2013 20:00:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247855 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 20:00:12 -0000 Author: gonzo Date: Tue Mar 5 20:00:11 2013 New Revision: 247855 URL: http://svnweb.freebsd.org/changeset/base/247855 Log: - Reset DMA channel if error occured - Initialize info field in bcm_dma_reset Submitted by: Daisuke Aoyama Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Tue Mar 5 19:37:29 2013 (r247854) +++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Tue Mar 5 20:00:11 2013 (r247855) @@ -199,6 +199,7 @@ bcm_dma_reset(device_t dev, int ch) /* Reset control block */ cb = sc->sc_dma_ch[ch].cb; bzero(cb, sizeof(cb)); + cb->info = INFO_WAIT_RESP; } static int @@ -615,6 +616,7 @@ bcm_dma_intr(void *arg) debug & DEBUG_ERROR_MASK, ch->ch); bus_write_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch), debug & DEBUG_ERROR_MASK); + bcm_dma_reset(sc->sc_dev, ch->ch); } if (cs & CS_INT) { From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 22:41:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 073175DB; Tue, 5 Mar 2013 22:41:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF18A153; Tue, 5 Mar 2013 22:41:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25MfbOA058376; Tue, 5 Mar 2013 22:41:37 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25MfaCp058364; Tue, 5 Mar 2013 22:41:36 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303052241.r25MfaCp058364@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 5 Mar 2013 22:41:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247856 - in head/sbin: mount_cd9660 mount_msdosfs mount_nfs mount_nullfs mount_reiserfs mount_std mount_udf mount_unionfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 22:41:38 -0000 Author: jkim Date: Tue Mar 5 22:41:35 2013 New Revision: 247856 URL: http://svnweb.freebsd.org/changeset/base/247856 Log: GC unused variables. Prefer NULL over 0 for pointers. Modified: head/sbin/mount_cd9660/mount_cd9660.c head/sbin/mount_msdosfs/mount_msdosfs.c head/sbin/mount_nfs/mount_nfs.c head/sbin/mount_nullfs/mount_nullfs.c head/sbin/mount_reiserfs/mount_reiserfs.c head/sbin/mount_std/mount_std.c head/sbin/mount_udf/mount_udf.c head/sbin/mount_unionfs/mount_unionfs.c Modified: head/sbin/mount_cd9660/mount_cd9660.c ============================================================================== --- head/sbin/mount_cd9660/mount_cd9660.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_cd9660/mount_cd9660.c Tue Mar 5 22:41:35 2013 (r247856) @@ -83,7 +83,7 @@ main(int argc, char **argv) { struct iovec *iov; int iovlen; - int ch, mntflags, opts; + int ch, mntflags; char *dev, *dir, *p, *val, mntpath[MAXPATHLEN]; int verbose; int ssector; /* starting sector, 0 for 1st session */ @@ -91,7 +91,7 @@ main(int argc, char **argv) iov = NULL; iovlen = 0; - mntflags = opts = verbose = 0; + mntflags = verbose = 0; ssector = -1; while ((ch = getopt(argc, argv, "begjo:rs:vC:")) != -1) @@ -109,7 +109,7 @@ main(int argc, char **argv) build_iovec(&iov, &iovlen, "nojoliet", NULL, (size_t)-1); break; case 'o': - getmntopts(optarg, mopts, &mntflags, &opts); + getmntopts(optarg, mopts, &mntflags, NULL); p = strchr(optarg, '='); val = NULL; if (p != NULL) { Modified: head/sbin/mount_msdosfs/mount_msdosfs.c ============================================================================== --- head/sbin/mount_msdosfs/mount_msdosfs.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_msdosfs/mount_msdosfs.c Tue Mar 5 22:41:35 2013 (r247856) @@ -69,7 +69,7 @@ main(int argc, char **argv) struct iovec *iov = NULL; int iovlen = 0; struct stat sb; - int c, mntflags, set_gid, set_uid, set_mask, set_dirmask; + int c, set_gid, set_uid, set_mask, set_dirmask; char *dev, *dir, mntpath[MAXPATHLEN], *csp; char fstype[] = "msdosfs"; char errmsg[255] = {0}; @@ -78,9 +78,8 @@ main(int argc, char **argv) mode_t mask = 0, dirmask = 0; uid_t uid = 0; gid_t gid = 0; - getmnt_silent = 1; - mntflags = set_gid = set_uid = set_mask = set_dirmask = 0; + set_gid = set_uid = set_mask = set_dirmask = 0; while ((c = getopt(argc, argv, "sl9u:g:m:M:o:L:D:W:")) != -1) { switch (c) { @@ -219,7 +218,7 @@ main(int argc, char **argv) build_iovec_argf(&iov, &iovlen, "mask", "%u", mask); build_iovec_argf(&iov, &iovlen, "dirmask", "%u", dirmask); - if (nmount(iov, iovlen, mntflags) < 0) { + if (nmount(iov, iovlen, 0) < 0) { if (errmsg[0]) err(1, "%s: %s", dev, errmsg); else Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_nfs/mount_nfs.c Tue Mar 5 22:41:35 2013 (r247856) @@ -130,7 +130,7 @@ enum tryret { TRYRET_LOCALERR /* Local failure. */ }; -static int fallback_mount(struct iovec *iov, int iovlen, int mntflags); +static int fallback_mount(struct iovec *iov, int iovlen); static int sec_name_to_num(char *sec); static char *sec_num_to_name(int num); static int getnfsargs(char *, struct iovec **iov, int *iovlen); @@ -149,13 +149,12 @@ main(int argc, char *argv[]) { int c; struct iovec *iov; - int mntflags, num, iovlen; + int num, iovlen; int osversion; char *name, *p, *spec, *fstype; char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50]; - mntflags = 0; iov = NULL; iovlen = 0; memset(errmsg, 0, sizeof(errmsg)); @@ -427,10 +426,10 @@ main(int argc, char *argv[]) */ osversion = getosreldate(); if (osversion >= 702100) { - if (nmount(iov, iovlen, mntflags)) + if (nmount(iov, iovlen, 0)) err(1, "%s, %s", mntpath, errmsg); } else { - if (fallback_mount(iov, iovlen, mntflags)) + if (fallback_mount(iov, iovlen)) err(1, "%s, %s", mntpath, errmsg); } @@ -473,7 +472,7 @@ copyopt(struct iovec **newiov, int *newi * parameters. It should be eventually be removed. */ static int -fallback_mount(struct iovec *iov, int iovlen, int mntflags) +fallback_mount(struct iovec *iov, int iovlen) { struct nfs_args args = { .version = NFS_ARGSVERSION, @@ -663,7 +662,7 @@ fallback_mount(struct iovec *iov, int io copyopt(&newiov, &newiovlen, iov, iovlen, "fspath"); copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg"); - return nmount(newiov, newiovlen, mntflags); + return nmount(newiov, newiovlen, 0); } static int Modified: head/sbin/mount_nullfs/mount_nullfs.c ============================================================================== --- head/sbin/mount_nullfs/mount_nullfs.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_nullfs/mount_nullfs.c Tue Mar 5 22:41:35 2013 (r247856) @@ -68,12 +68,11 @@ main(int argc, char *argv[]) char source[MAXPATHLEN]; char target[MAXPATHLEN]; char errmsg[255]; - int ch, mntflags, iovlen; + int ch, iovlen; char nullfs[] = "nullfs"; iov = NULL; iovlen = 0; - mntflags = 0; errmsg[0] = '\0'; while ((ch = getopt(argc, argv, "o:")) != -1) switch(ch) { @@ -111,7 +110,7 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1); build_iovec(&iov, &iovlen, "target", target, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - if (nmount(iov, iovlen, mntflags) < 0) { + if (nmount(iov, iovlen, 0) < 0) { if (errmsg[0] != 0) err(1, "%s: %s", source, errmsg); else Modified: head/sbin/mount_reiserfs/mount_reiserfs.c ============================================================================== --- head/sbin/mount_reiserfs/mount_reiserfs.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_reiserfs/mount_reiserfs.c Tue Mar 5 22:41:35 2013 (r247856) @@ -58,7 +58,7 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "o:")) != -1) { switch(ch) { case 'o': - getmntopts(optarg, mopts, &mntflags, 0); + getmntopts(optarg, mopts, &mntflags, NULL); break; case '?': default: Modified: head/sbin/mount_std/mount_std.c ============================================================================== --- head/sbin/mount_std/mount_std.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_std/mount_std.c Tue Mar 5 22:41:35 2013 (r247856) @@ -99,7 +99,7 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "o:")) != -1) switch (ch) { case 'o': - getmntopts(optarg, mopts, &mntflags, 0); + getmntopts(optarg, mopts, &mntflags, NULL); break; case '?': default: Modified: head/sbin/mount_udf/mount_udf.c ============================================================================== --- head/sbin/mount_udf/mount_udf.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_udf/mount_udf.c Tue Mar 5 22:41:35 2013 (r247856) @@ -74,17 +74,17 @@ int main(int argc, char **argv) { struct iovec iov[12]; - int ch, i, mntflags, opts, udf_flags; + int ch, i, mntflags, udf_flags; char *dev, *dir, mntpath[MAXPATHLEN]; char *cs_disk, *cs_local; int verbose; - i = mntflags = opts = udf_flags = verbose = 0; + i = mntflags = udf_flags = verbose = 0; cs_disk = cs_local = NULL; while ((ch = getopt(argc, argv, "o:vC:")) != -1) switch (ch) { case 'o': - getmntopts(optarg, mopts, &mntflags, &opts); + getmntopts(optarg, mopts, &mntflags, NULL); break; case 'v': verbose++; Modified: head/sbin/mount_unionfs/mount_unionfs.c ============================================================================== --- head/sbin/mount_unionfs/mount_unionfs.c Tue Mar 5 20:00:11 2013 (r247855) +++ head/sbin/mount_unionfs/mount_unionfs.c Tue Mar 5 22:41:35 2013 (r247856) @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) { struct iovec *iov; - int ch, mntflags, iovlen; + int ch, iovlen; char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255]; char uid_str[20], gid_str[20]; char fstype[] = "unionfs"; @@ -137,7 +137,6 @@ main(int argc, char *argv[]) iov = NULL; iovlen = 0; - mntflags = 0; memset(errmsg, 0, sizeof(errmsg)); while ((ch = getopt(argc, argv, "bo:")) != -1) { @@ -190,7 +189,7 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "from", target, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - if (nmount(iov, iovlen, mntflags)) + if (nmount(iov, iovlen, 0)) err(EX_OSERR, "%s: %s", source, errmsg); exit(0); } From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 23:05:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B0270EB1; Tue, 5 Mar 2013 23:05:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A2F3F250; Tue, 5 Mar 2013 23:05:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25N5iWa065191; Tue, 5 Mar 2013 23:05:44 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25N5i3B065190; Tue, 5 Mar 2013 23:05:44 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303052305.r25N5i3B065190@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 5 Mar 2013 23:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247859 - head/sbin/mount_cd9660 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 23:05:44 -0000 Author: jkim Date: Tue Mar 5 23:05:43 2013 New Revision: 247859 URL: http://svnweb.freebsd.org/changeset/base/247859 Log: Update the manual page to reflect reality. With r138509 and r152355, "nostrictjoliet" option for mount_cd9660(8) was completely replaced with "brokenjoliet" somehow. MFC after: 3 days Modified: head/sbin/mount_cd9660/mount_cd9660.8 Modified: head/sbin/mount_cd9660/mount_cd9660.8 ============================================================================== --- head/sbin/mount_cd9660/mount_cd9660.8 Tue Mar 5 22:58:53 2013 (r247858) +++ head/sbin/mount_cd9660/mount_cd9660.8 Tue Mar 5 23:05:43 2013 (r247859) @@ -32,7 +32,7 @@ .\" @(#)mount_cd9660.8 8.3 (Berkeley) 3/27/94 .\" $FreeBSD$ .\" -.Dd October 3, 2005 +.Dd March 5, 2013 .Dt MOUNT_CD9660 8 .Os .Sh NAME @@ -80,7 +80,7 @@ See the man page for possible options and their meanings. The following cd9660 specific options are available: .Pp -.Bl -tag -width "nostrictjoliet" -compact +.Bl -tag -width "brokenjoliet" -compact .It Cm extatt Same as .Fl e . @@ -93,7 +93,7 @@ Same as .It Cm norrip Same as .Fl r . -.It Cm nostrictjoliet +.It Cm brokenjoliet Same as .Fl b . .El From owner-svn-src-head@FreeBSD.ORG Tue Mar 5 23:53:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E61228A4; Tue, 5 Mar 2013 23:53:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D77C3CE; Tue, 5 Mar 2013 23:53:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r25NrcKD079580; Tue, 5 Mar 2013 23:53:38 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r25Nrcld079578; Tue, 5 Mar 2013 23:53:38 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303052353.r25Nrcld079578@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 5 Mar 2013 23:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247860 - in head/sbin: mount_ext2fs mount_reiserfs mount_std X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2013 23:53:40 -0000 Author: jkim Date: Tue Mar 5 23:53:37 2013 New Revision: 247860 URL: http://svnweb.freebsd.org/changeset/base/247860 Log: GC unused mount_* directories. mount_reiserfs was disconnected from build with r158666. mount_ext2fs and mount_std were disconnected with r164527. Deleted: head/sbin/mount_ext2fs/ head/sbin/mount_reiserfs/ head/sbin/mount_std/ From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 00:36:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 49E7753C; Wed, 6 Mar 2013 00:36:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC726ED; Wed, 6 Mar 2013 00:36:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r260aXPi092631; Wed, 6 Mar 2013 00:36:33 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r260aXkA092627; Wed, 6 Mar 2013 00:36:33 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201303060036.r260aXkA092627@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 6 Mar 2013 00:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247861 - head/sbin/mount_udf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 00:36:34 -0000 Author: jkim Date: Wed Mar 6 00:36:33 2013 New Revision: 247861 URL: http://svnweb.freebsd.org/changeset/base/247861 Log: Use build_iovec() to make it less cryptic. This also fixes warnings. Modified: head/sbin/mount_udf/Makefile head/sbin/mount_udf/mount_udf.c Modified: head/sbin/mount_udf/Makefile ============================================================================== --- head/sbin/mount_udf/Makefile Tue Mar 5 23:53:37 2013 (r247860) +++ head/sbin/mount_udf/Makefile Wed Mar 6 00:36:33 2013 (r247861) @@ -9,7 +9,6 @@ LDADD= -lkiconv MOUNT= ${.CURDIR}/../mount CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys .PATH: ${MOUNT} -WARNS?= 1 # Needs to be dynamically linked for optional dlopen() access to # userland libiconv Modified: head/sbin/mount_udf/mount_udf.c ============================================================================== --- head/sbin/mount_udf/mount_udf.c Tue Mar 5 23:53:37 2013 (r247860) +++ head/sbin/mount_udf/mount_udf.c Wed Mar 6 00:36:33 2013 (r247861) @@ -73,14 +73,15 @@ void usage(void); int main(int argc, char **argv) { - struct iovec iov[12]; - int ch, i, mntflags, udf_flags; - char *dev, *dir, mntpath[MAXPATHLEN]; - char *cs_disk, *cs_local; - int verbose; + char mntpath[MAXPATHLEN]; + char fstype[] = "udf"; + struct iovec *iov; + char *cs_disk, *cs_local, *dev, *dir; + int ch, i, iovlen, mntflags, udf_flags, verbose; - i = mntflags = udf_flags = verbose = 0; + i = iovlen = mntflags = udf_flags = verbose = 0; cs_disk = cs_local = NULL; + iov = NULL; while ((ch = getopt(argc, argv, "o:vC:")) != -1) switch (ch) { case 'o': @@ -120,32 +121,13 @@ main(int argc, char **argv) */ mntflags |= MNT_RDONLY; - iov[i].iov_base = "fstype"; - iov[i++].iov_len = sizeof("fstype"); - iov[i].iov_base = "udf"; - iov[i].iov_len = strlen(iov[i].iov_base) + 1; - i++; - iov[i].iov_base = "fspath"; - iov[i++].iov_len = sizeof("fspath"); - iov[i].iov_base = mntpath; - iov[i++].iov_len = strlen(mntpath) + 1; - iov[i].iov_base = "from"; - iov[i++].iov_len = sizeof("from"); - iov[i].iov_base = dev; - iov[i++].iov_len = strlen(dev) + 1; - iov[i].iov_base = "flags"; - iov[i++].iov_len = sizeof("flags"); - iov[i].iov_base = &udf_flags; - iov[i++].iov_len = sizeof(udf_flags); + build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); + build_iovec(&iov, &iovlen, "from", dev, (size_t)-1); + build_iovec(&iov, &iovlen, "flags", &udf_flags, sizeof(udf_flags)); if (udf_flags & UDFMNT_KICONV) { - iov[i].iov_base = "cs_disk"; - iov[i++].iov_len = sizeof("cs_disk"); - iov[i].iov_base = cs_disk; - iov[i++].iov_len = strlen(cs_disk) + 1; - iov[i].iov_base = "cs_local"; - iov[i++].iov_len = sizeof("cs_local"); - iov[i].iov_base = cs_local; - iov[i++].iov_len = strlen(cs_local) + 1; + build_iovec(&iov, &iovlen, "cs_disk", cs_disk, (size_t)-1); + build_iovec(&iov, &iovlen, "cs_local", cs_local, (size_t)-1); } if (nmount(iov, i, mntflags) < 0) err(1, "%s", dev); From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 04:58:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38534448; Wed, 6 Mar 2013 04:58:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 266D8D7; Wed, 6 Mar 2013 04:58:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r264wmgf072792; Wed, 6 Mar 2013 04:58:48 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r264wmDe072791; Wed, 6 Mar 2013 04:58:48 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201303060458.r264wmDe072791@svn.freebsd.org> From: Hiroki Sato Date: Wed, 6 Mar 2013 04:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247863 - head/usr.sbin/rtadvd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 04:58:49 -0000 Author: hrs Date: Wed Mar 6 04:58:48 2013 New Revision: 247863 URL: http://svnweb.freebsd.org/changeset/base/247863 Log: Fix SIGSEGV when set_short_delay() is called when ifi->ifi_ra_timer is NULL. This can happen in a short period when a prefix is changed by a rtmsg and a new interface arrives. Modified: head/usr.sbin/rtadvd/rtadvd.c Modified: head/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- head/usr.sbin/rtadvd/rtadvd.c Wed Mar 6 01:21:56 2013 (r247862) +++ head/usr.sbin/rtadvd/rtadvd.c Wed Mar 6 04:58:48 2013 (r247863) @@ -1008,6 +1008,8 @@ set_short_delay(struct ifinfo *ifi) long delay; /* must not be greater than 1000000 */ struct timeval interval, now, min_delay, tm_tmp, *rest; + if (ifi->ifi_ra_timer == NULL) + return; /* * Compute a random delay. If the computed value * corresponds to a time later than the time the next From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 05:21:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC58B8C0 for ; Wed, 6 Mar 2013 05:21:04 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com [IPv6:2a00:1450:4010:c03::233]) by mx1.freebsd.org (Postfix) with ESMTP id 6D1E616A for ; Wed, 6 Mar 2013 05:21:04 +0000 (UTC) Received: by mail-la0-f51.google.com with SMTP id fo13so7014219lab.38 for ; Tue, 05 Mar 2013 21:21:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=FVxmpNg86SuFF5OuLbzxmV6Y7hLjw7cenydkNKqFq9s=; b=g+pgMQop02GnpEPWVwN0D2ZNTmgL26LVBj1XkAIcUVoNU1vMr6FA/mag6wQpSx8cw+ TwNaVhgYMD+ncgcUxtay1dOo05CIr+6r6mTKEtu37Dia/Lx5fhkwCeZByLEfkBFGjm3l 5zy2IzmDBUsF5OI/SEGjAxutA+47xVP2IhHPREXNHbIzd59J68Dect7Ue6QtRF56TARW 37cLu9n91OMJ/jSol1Qi9mWZAQNZf3ASjKTNCLVFSGG893FwgNN88XTnmfa+z1wFjOWO Dr6bH1rk0z+gGZf0EVvoZFTVg4VP98xqgidqo0JLVN3vQiRt4d/zBBGP8kB9D00mNK+O f1tA== X-Received: by 10.112.17.41 with SMTP id l9mr6766945lbd.91.1362547263221; Tue, 05 Mar 2013 21:21:03 -0800 (PST) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.152.133.196 with HTTP; Tue, 5 Mar 2013 21:20:43 -0800 (PST) In-Reply-To: <201303052353.r25Nrcld079578@svn.freebsd.org> References: <201303052353.r25Nrcld079578@svn.freebsd.org> From: Juli Mallett Date: Tue, 5 Mar 2013 21:20:43 -0800 X-Google-Sender-Auth: dJRayuclwG8PPvTJXBmER-76jT8 Message-ID: Subject: Re: svn commit: r247860 - in head/sbin: mount_ext2fs mount_reiserfs mount_std To: Jung-uk Kim Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlwzNN2Oxo+k21UX4/eQGtTww2xf6h51Qaa2p8MPrk2tdp5+NXYQ59Jr4F/RbZcJmNFWoP5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 05:21:04 -0000 Thanks! On Tue, Mar 5, 2013 at 3:53 PM, Jung-uk Kim wrote: > Author: jkim > Date: Tue Mar 5 23:53:37 2013 > New Revision: 247860 > URL: http://svnweb.freebsd.org/changeset/base/247860 > > Log: > GC unused mount_* directories. mount_reiserfs was disconnected from build > with r158666. mount_ext2fs and mount_std were disconnected with r164527. > > Deleted: > head/sbin/mount_ext2fs/ > head/sbin/mount_reiserfs/ > head/sbin/mount_std/ From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 06:19:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9EF4D461; Wed, 6 Mar 2013 06:19:57 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 781F932A; Wed, 6 Mar 2013 06:19:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266Jv38097214; Wed, 6 Mar 2013 06:19:57 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266JuVA097211; Wed, 6 Mar 2013 06:19:56 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303060619.r266JuVA097211@svn.freebsd.org> From: Andrew Turner Date: Wed, 6 Mar 2013 06:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247864 - in head/sys/arm: 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:19:57 -0000 Author: andrew Date: Wed Mar 6 06:19:56 2013 New Revision: 247864 URL: http://svnweb.freebsd.org/changeset/base/247864 Log: Fix stack alignment in the kernel to be on an 8 byte boundary as required by AAPCS. Modified: head/sys/arm/arm/swtch.S head/sys/arm/arm/vm_machdep.c head/sys/arm/include/frame.h Modified: head/sys/arm/arm/swtch.S ============================================================================== --- head/sys/arm/arm/swtch.S Wed Mar 6 04:58:48 2013 (r247863) +++ head/sys/arm/arm/swtch.S Wed Mar 6 06:19:56 2013 (r247864) @@ -211,10 +211,12 @@ ENTRY(cpu_throw) GET_PCPU(r6) str r7, [r6, #PC_CURPCB] + add sp, sp, #4; ldmfd sp!, {r4-r7, pc} ENTRY(cpu_switch) stmfd sp!, {r4-r7, lr} + sub sp, sp, #4; mov r6, r2 /* Save the mutex */ .Lswitch_resume: @@ -488,6 +490,7 @@ ENTRY(cpu_switch) * Pull the registers that got pushed when either savectx() or * cpu_switch() was called and return. */ + add sp, sp, #4; ldmfd sp!, {r4-r7, pc} #ifdef DIAGNOSTIC .Lswitch_bogons: @@ -501,6 +504,7 @@ ENTRY(cpu_switch) #endif ENTRY(savectx) stmfd sp!, {r4-r7, lr} + sub sp, sp, #4 /* * r0 = pcb */ @@ -528,6 +532,7 @@ ENTRY(savectx) bl _C_LABEL(vfp_store) 1: #endif /* ARM_VFP_SUPPORT */ + add sp, sp, #4; ldmfd sp!, {r4-r7, pc} ENTRY(fork_trampoline) Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Wed Mar 6 04:58:48 2013 (r247863) +++ head/sys/arm/arm/vm_machdep.c Wed Mar 6 06:19:56 2013 (r247864) @@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$"); #include +/* + * struct switchframe must be a multiple of 8 for correct stack alignment + */ +CTASSERT(sizeof(struct switchframe) == 24); +CTASSERT(sizeof(struct trapframe) == 76); + #ifndef NSFBUFS #define NSFBUFS (512 + maxusers * 16) #endif @@ -131,8 +137,8 @@ cpu_fork(register struct thread *td1, re pcb2->un_32.pcb32_sp = td2->td_kstack + USPACE_SVC_STACK_TOP - sizeof(*pcb2); pmap_activate(td2); - td2->td_frame = tf = - (struct trapframe *)pcb2->un_32.pcb32_sp - 1; + td2->td_frame = tf = (struct trapframe *)STACKALIGN( + pcb2->un_32.pcb32_sp - sizeof(struct trapframe)); *tf = *td1->td_frame; sf = (struct switchframe *)tf - 1; sf->sf_r4 = (u_int)fork_return; @@ -142,6 +148,8 @@ cpu_fork(register struct thread *td1, re tf->tf_r0 = 0; tf->tf_r1 = 0; pcb2->un_32.pcb32_sp = (u_int)sf; + KASSERT((pcb2->un_32.pcb32_sp & 7) == 0, + ("cpu_fork: Incorrect stack alignment")); /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; @@ -345,6 +353,8 @@ cpu_set_upcall(struct thread *td, struct tf->tf_r0 = 0; td->td_pcb->un_32.pcb32_sp = (u_int)sf; td->td_pcb->un_32.pcb32_und_sp = td->td_kstack + USPACE_UNDEF_STACK_TOP; + KASSERT((td->td_pcb->un_32.pcb32_sp & 7) == 0, + ("cpu_set_upcall: Incorrect stack alignment")); /* Setup to release spin count in fork_exit(). */ td->td_md.md_spinlock_count = 1; @@ -438,6 +448,8 @@ cpu_set_fork_handler(struct thread *td, sf->sf_r4 = (u_int)func; sf->sf_r5 = (u_int)arg; td->td_pcb->un_32.pcb32_sp = (u_int)sf; + KASSERT((td->td_pcb->un_32.pcb32_sp & 7) == 0, + ("cpu_set_fork_handler: Incorrect stack alignment")); } /* Modified: head/sys/arm/include/frame.h ============================================================================== --- head/sys/arm/include/frame.h Wed Mar 6 04:58:48 2013 (r247863) +++ head/sys/arm/include/frame.h Wed Mar 6 06:19:56 2013 (r247864) @@ -138,10 +138,14 @@ typedef struct irqframe { } irqframe_t; /* - * Switch frame + * Switch frame. + * + * It is important this is a multiple of 8 bytes so the stack is correctly + * aligned when we create new threads. */ struct switchframe { + u_int pad; /* Used to pad the struct to a multiple of 8-bytes */ u_int sf_r4; u_int sf_r5; u_int sf_r6; From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 06:24:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C75D2641; Wed, 6 Mar 2013 06:24:09 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A31F7350; Wed, 6 Mar 2013 06:24:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r266O9Zl099407; Wed, 6 Mar 2013 06:24:09 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r266O94q099406; Wed, 6 Mar 2013 06:24:09 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201303060624.r266O94q099406@svn.freebsd.org> From: Peter Grehan Date: Wed, 6 Mar 2013 06:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247865 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 06:24:09 -0000 Author: grehan Date: Wed Mar 6 06:24:09 2013 New Revision: 247865 URL: http://svnweb.freebsd.org/changeset/base/247865 Log: Reorder code to avoid the stat buffer being used uninitialized. Obtained from: NetApp Modified: head/usr.sbin/bhyve/acpi.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Wed Mar 6 06:19:56 2013 (r247864) +++ head/usr.sbin/bhyve/acpi.c Wed Mar 6 06:24:09 2013 (r247865) @@ -687,12 +687,16 @@ basl_load(int fd, uint64_t off) int err; err = 0; - gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); - if (gaddr != NULL) { - if (fstat(fd, &sb) < 0 || read(fd, gaddr, sb.st_size) < 0) - err = errno; - } else - err = EFAULT; + if (fstat(fd, &sb) < 0) { + err = errno; + } else { + gaddr = paddr_guest2host(basl_acpi_base + off, sb.st_size); + if (gaddr != NULL) { + if (read(fd, gaddr, sb.st_size) < 0) + err = errno; + } else + err = EFAULT; + } return (err); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 07:17:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 31DF5A06; Wed, 6 Mar 2013 07:17:55 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1928C70F; Wed, 6 Mar 2013 07:17:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r267HsRf015437; Wed, 6 Mar 2013 07:17:54 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r267Hsl8015433; Wed, 6 Mar 2013 07:17:54 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201303060717.r267Hsl8015433@svn.freebsd.org> From: Bryan Venteicher Date: Wed, 6 Mar 2013 07:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247870 - in head/sys: amd64/conf conf i386/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 07:17:55 -0000 Author: bryanv Date: Wed Mar 6 07:17:53 2013 New Revision: 247870 URL: http://svnweb.freebsd.org/changeset/base/247870 Log: Remove the virtio dependency entry for the VirtIO device drivers. This will prevent the kernel from linking if the device driver are included without the virtio module. Remove pci and scbus for the same reason. Also explain the relationship and necessity of the virtio and virtio_pci modules. Currently in FreeBSD, we only support VirtIO PCI, but it could be replaced with a different interface (like MMIO) and the device (network, block, etc) will still function. Requested by: luigi Approved by: grehan (mentor) MFC after: 3 days Modified: head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Wed Mar 6 06:59:42 2013 (r247869) +++ head/sys/amd64/conf/NOTES Wed Mar 6 07:17:53 2013 (r247870) @@ -442,6 +442,13 @@ options SAFE_RNDTEST # enable rndtest s # # VirtIO support +# +# The virtio entry provides a generic bus for use by the device drivers. +# It must be combined with an interface that communicates with the host. +# Multiple such interfaces defined by the VirtIO specification. FreeBSD +# only has support for PCI. Therefore, virtio_pci must be statically +# compiled in or loaded as a module for the device drivers to function. +# device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI Interface device vtnet # VirtIO Ethernet device Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Mar 6 06:59:42 2013 (r247869) +++ head/sys/conf/files.amd64 Wed Mar 6 07:17:53 2013 (r247870) @@ -393,11 +393,11 @@ dev/virtio/virtio.c optional virtio dev/virtio/virtqueue.c optional virtio dev/virtio/virtio_bus_if.m optional virtio dev/virtio/virtio_if.m optional virtio -dev/virtio/pci/virtio_pci.c optional virtio_pci virtio pci -dev/virtio/network/if_vtnet.c optional vtnet virtio -dev/virtio/block/virtio_blk.c optional virtio_blk virtio -dev/virtio/balloon/virtio_balloon.c optional virtio_balloon virtio -dev/virtio/scsi/virtio_scsi.c optional virtio_scsi virtio scbus +dev/virtio/pci/virtio_pci.c optional virtio_pci +dev/virtio/network/if_vtnet.c optional vtnet +dev/virtio/block/virtio_blk.c optional virtio_blk +dev/virtio/balloon/virtio_balloon.c optional virtio_balloon +dev/virtio/scsi/virtio_scsi.c optional virtio_scsi isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/kern_clocksource.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Mar 6 06:59:42 2013 (r247869) +++ head/sys/conf/files.i386 Wed Mar 6 07:17:53 2013 (r247870) @@ -374,11 +374,11 @@ dev/virtio/virtio.c optional virtio dev/virtio/virtqueue.c optional virtio dev/virtio/virtio_bus_if.m optional virtio dev/virtio/virtio_if.m optional virtio -dev/virtio/pci/virtio_pci.c optional virtio_pci virtio pci -dev/virtio/network/if_vtnet.c optional vtnet virtio -dev/virtio/block/virtio_blk.c optional virtio_blk virtio -dev/virtio/balloon/virtio_balloon.c optional virtio_balloon virtio -dev/virtio/scsi/virtio_scsi.c optional virtio_scsi virtio scbus +dev/virtio/pci/virtio_pci.c optional virtio_pci +dev/virtio/network/if_vtnet.c optional vtnet +dev/virtio/block/virtio_blk.c optional virtio_blk +dev/virtio/balloon/virtio_balloon.c optional virtio_balloon +dev/virtio/scsi/virtio_scsi.c optional virtio_scsi i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Wed Mar 6 06:59:42 2013 (r247869) +++ head/sys/i386/conf/NOTES Wed Mar 6 07:17:53 2013 (r247870) @@ -773,6 +773,13 @@ device glxsb # AMD Geode LX Security B # # VirtIO support +# +# The virtio entry provides a generic bus for use by the device drivers. +# It must be combined with an interface that communicates with the host. +# Multiple such interfaces defined by the VirtIO specification. FreeBSD +# only has support for PCI. Therefore, virtio_pci must be statically +# compiled in or loaded as a module for the device drivers to function. +# device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI Interface device vtnet # VirtIO Ethernet device From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 07:28:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ED2A5D8D; Wed, 6 Mar 2013 07:28:20 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C74A1785; Wed, 6 Mar 2013 07:28:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r267SK7E018483; Wed, 6 Mar 2013 07:28:20 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r267SKP3018477; Wed, 6 Mar 2013 07:28:20 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201303060728.r267SKP3018477@svn.freebsd.org> From: Peter Grehan Date: Wed, 6 Mar 2013 07:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247871 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 07:28:21 -0000 Author: grehan Date: Wed Mar 6 07:28:20 2013 New Revision: 247871 URL: http://svnweb.freebsd.org/changeset/base/247871 Log: Simplify virtio ring num-available calculation. Submitted by: Chris Torek, torek at torek dot net Modified: head/usr.sbin/bhyve/pci_virtio_block.c head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Wed Mar 6 07:17:53 2013 (r247870) +++ head/usr.sbin/bhyve/pci_virtio_block.c Wed Mar 6 07:28:20 2013 (r247871) @@ -164,14 +164,19 @@ pci_vtblk_iosize(struct pci_devinst *pi) static int hq_num_avail(struct vring_hqueue *hq) { - int ndesc; + uint16_t ndesc; - if (*hq->hq_avail_idx >= hq->hq_cur_aidx) - ndesc = *hq->hq_avail_idx - hq->hq_cur_aidx; - else - ndesc = UINT16_MAX - hq->hq_cur_aidx + *hq->hq_avail_idx + 1; + /* + * We're just computing (a-b) in GF(216). + * + * The only glitch here is that in standard C, + * uint16_t promotes to (signed) int when int has + * more than 16 bits (pretty much always now), so + * we have to force it back to unsigned. + */ + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; - assert(ndesc >= 0 && ndesc <= hq->hq_size); + assert(ndesc <= hq->hq_size); return (ndesc); } Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Wed Mar 6 07:17:53 2013 (r247870) +++ head/usr.sbin/bhyve/pci_virtio_net.c Wed Mar 6 07:28:20 2013 (r247871) @@ -172,12 +172,17 @@ hq_num_avail(struct vring_hqueue *hq) { int ndesc; - if (*hq->hq_avail_idx >= hq->hq_cur_aidx) - ndesc = *hq->hq_avail_idx - hq->hq_cur_aidx; - else - ndesc = UINT16_MAX - hq->hq_cur_aidx + *hq->hq_avail_idx + 1; + /* + * We're just computing (a-b) in GF(216). + * + * The only glitch here is that in standard C, + * uint16_t promotes to (signed) int when int has + * more than 16 bits (pretty much always now), so + * we have to force it back to unsigned. + */ + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; - assert(ndesc >= 0 && ndesc <= hq->hq_size); + assert(ndesc <= hq->hq_size); return (ndesc); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 09:53:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 699F791F; Wed, 6 Mar 2013 09:53:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C3DBE0D; Wed, 6 Mar 2013 09:53:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r269rdmS063293; Wed, 6 Mar 2013 09:53:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r269rcsF063284; Wed, 6 Mar 2013 09:53:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303060953.r269rcsF063284@svn.freebsd.org> From: Xin LI Date: Wed, 6 Mar 2013 09:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247880 - head/sys/dev/oce X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 09:53:39 -0000 Author: delphij Date: Wed Mar 6 09:53:38 2013 New Revision: 247880 URL: http://svnweb.freebsd.org/changeset/base/247880 Log: Update driver to version 4.6.95.0. Submitted by: "Duvvuru,Venkat Kumar" MFC after: 3 days Modified: head/sys/dev/oce/oce_hw.c head/sys/dev/oce/oce_hw.h head/sys/dev/oce/oce_if.c head/sys/dev/oce/oce_if.h head/sys/dev/oce/oce_mbox.c head/sys/dev/oce/oce_queue.c head/sys/dev/oce/oce_sysctl.c head/sys/dev/oce/oce_util.c Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Wed Mar 6 09:33:16 2013 (r247879) +++ head/sys/dev/oce/oce_hw.c Wed Mar 6 09:53:38 2013 (r247880) @@ -405,11 +405,6 @@ oce_create_nw_interface(POCE_SOFTC sc) sc->if_cap_flags = capab_en_flags; - /* Enable VLAN Promisc on HW */ - rc = oce_config_vlan(sc, (uint8_t) sc->if_id, NULL, 0, 1, 1); - if (rc) - goto error; - /* set default flow control */ rc = oce_set_flow_control(sc, sc->flow_control); if (rc) @@ -477,12 +472,9 @@ oce_hw_start(POCE_SOFTC sc) return 1; if (link.logical_link_status == NTWK_LOGICAL_LINK_UP) { - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->link_status = NTWK_LOGICAL_LINK_UP; if_link_state_change(sc->ifp, LINK_STATE_UP); } else { - sc->ifp->if_drv_flags &= - ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); sc->link_status = NTWK_LOGICAL_LINK_DOWN; if_link_state_change(sc->ifp, LINK_STATE_DOWN); } Modified: head/sys/dev/oce/oce_hw.h ============================================================================== --- head/sys/dev/oce/oce_hw.h Wed Mar 6 09:33:16 2013 (r247879) +++ head/sys/dev/oce/oce_hw.h Wed Mar 6 09:53:38 2013 (r247880) @@ -38,6 +38,8 @@ /* $FreeBSD$ */ +/* $FreeBSD$ */ + #include #undef _BIG_ENDIAN /* TODO */ @@ -155,7 +157,10 @@ #define ASYNC_EVENT_LINK_UP 0x1 #define ASYNC_EVENT_LINK_DOWN 0x0 #define ASYNC_EVENT_GRP5 0x5 +#define ASYNC_EVENT_CODE_DEBUG 0x6 #define ASYNC_EVENT_PVID_STATE 0x3 +#define ASYNC_EVENT_DEBUG_QNQ 0x1 +#define ASYNC_EVENT_CODE_SLIPORT 0x11 #define VLAN_VID_MASK 0x0FFF /* port link_status */ @@ -707,6 +712,17 @@ struct oce_async_event_grp5_pvid_state { uint32_t code; }; +/* async event indicating outer VLAN tag in QnQ */ +struct oce_async_event_qnq { + uint8_t valid; /* Indicates if outer VLAN is valid */ + uint8_t rsvd0; + uint16_t vlan_tag; + uint32_t event_tag; + uint8_t rsvd1[4]; + uint32_t code; +} ; + + typedef union oce_mq_ext_ctx_u { uint32_t dw[6]; struct { @@ -750,6 +766,44 @@ typedef union oce_mq_ext_ctx_u { /* dw5 */ uint32_t dw8rsvd1; } v0; + struct { + #ifdef _BIG_ENDIAN + /* dw0 */ + uint32_t cq_id:16; + uint32_t num_pages:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t dw5rsvd2:12; + uint32_t ring_size:4; + uint32_t async_cq_id:16; + /* dw3 */ + uint32_t valid:1; + uint32_t dw6rsvd1:31; + /* dw4 */ + uint32_t dw7rsvd1:31; + uint32_t async_cq_valid:1; + #else + /* dw0 */ + uint32_t num_pages:16; + uint32_t cq_id:16; + /* dw1 */ + uint32_t async_evt_bitmap; + /* dw2 */ + uint32_t async_cq_id:16; + uint32_t ring_size:4; + uint32_t dw5rsvd2:12; + /* dw3 */ + uint32_t dw6rsvd1:31; + uint32_t valid:1; + /* dw4 */ + uint32_t async_cq_valid:1; + uint32_t dw7rsvd1:31; + #endif + /* dw5 */ + uint32_t dw8rsvd1; + } v1; + } oce_mq_ext_ctx_t; @@ -826,6 +880,7 @@ enum COMMON_SUBSYSTEM_OPCODES { OPCODE_COMMON_SET_BEACON_CONFIG = 69, OPCODE_COMMON_GET_BEACON_CONFIG = 70, OPCODE_COMMON_GET_PHYSICAL_LINK_CONFIG = 71, + OPCODE_COMMON_READ_TRANSRECEIVER_DATA = 73, OPCODE_COMMON_GET_OEM_ATTRIBUTES = 76, OPCODE_COMMON_GET_PORT_NAME = 77, OPCODE_COMMON_GET_CONFIG_SIGNATURE = 78, @@ -1724,6 +1779,12 @@ struct mbx_set_common_iface_rx_filter { } params; }; +struct be_set_eqd { + uint32_t eq_id; + uint32_t phase; + uint32_t dm; +}; + /* [41] OPCODE_COMMON_MODIFY_EQ_DELAY */ struct mbx_modify_common_eq_delay { struct mbx_hdr hdr; @@ -1743,6 +1804,76 @@ struct mbx_modify_common_eq_delay { } params; }; +/* [32] OPCODE_COMMON_GET_CNTL_ATTRIBUTES */ + +struct mgmt_hba_attr { + int8_t flashrom_ver_str[32]; + int8_t manufac_name[32]; + uint32_t supp_modes; + int8_t seeprom_ver_lo; + int8_t seeprom_ver_hi; + int8_t rsvd0[2]; + uint32_t ioctl_data_struct_ver; + uint32_t ep_fw_data_struct_ver; + uint8_t ncsi_ver_str[12]; + uint32_t def_ext_to; + int8_t cntl_mod_num[32]; + int8_t cntl_desc[64]; + int8_t cntl_ser_num[32]; + int8_t ip_ver_str[32]; + int8_t fw_ver_str[32]; + int8_t bios_ver_str[32]; + int8_t redboot_ver_str[32]; + int8_t drv_ver_str[32]; + int8_t fw_on_flash_ver_str[32]; + uint32_t funcs_supp; + uint16_t max_cdblen; + uint8_t asic_rev; + uint8_t gen_guid[16]; + uint8_t hba_port_count; + uint16_t default_link_down_timeout; + uint8_t iscsi_ver_min_max; + uint8_t multifunc_dev; + uint8_t cache_valid; + uint8_t hba_status; + uint8_t max_domains_supp; + uint8_t phy_port; + uint32_t fw_post_status; + uint32_t hba_mtu[8]; + uint8_t iSCSI_feat; + uint8_t asic_gen; + uint8_t future_u8[2]; + uint32_t future_u32[3]; +}; + +struct mgmt_cntl_attr { + struct mgmt_hba_attr hba_attr; + uint16_t pci_vendor_id; + uint16_t pci_device_id; + uint16_t pci_sub_vendor_id; + uint16_t pci_sub_system_id; + uint8_t pci_bus_num; + uint8_t pci_dev_num; + uint8_t pci_func_num; + uint8_t interface_type; + uint64_t unique_id; + uint8_t netfilters; + uint8_t rsvd0[3]; + uint32_t future_u32[4]; +}; + +struct mbx_common_get_cntl_attr { + struct mbx_hdr hdr; + union { + struct { + uint32_t rsvd0; + } req; + struct { + struct mgmt_cntl_attr cntl_attr_info; + } rsp; + } params; +}; + /* [59] OPCODE_ADD_COMMON_IFACE_MAC */ struct mbx_add_common_iface_mac { struct mbx_hdr hdr; @@ -1785,6 +1916,23 @@ struct ioctl_common_function_reset { struct mbx_hdr hdr; }; +/* [73] OPCODE_COMMON_READ_TRANSRECEIVER_DATA */ +struct mbx_read_common_transrecv_data { + struct mbx_hdr hdr; + union { + struct { + uint32_t page_num; + uint32_t port; + } req; + struct { + uint32_t page_num; + uint32_t port; + uint32_t page_data[32]; + } rsp; + } params; + +}; + /* [80] OPCODE_COMMON_FUNCTION_LINK_CONFIG */ struct mbx_common_func_link_cfg { struct mbx_hdr hdr; @@ -2110,7 +2258,9 @@ enum RSS_ENABLE_FLAGS { RSS_ENABLE_IPV4 = 0x1, /* (IPV4 HASH enabled ) */ RSS_ENABLE_TCP_IPV4 = 0x2, /* (TCP IPV4 Hash enabled) */ RSS_ENABLE_IPV6 = 0x4, /* (IPV6 HASH enabled) */ - RSS_ENABLE_TCP_IPV6 = 0x8 /* (TCP IPV6 HASH */ + RSS_ENABLE_TCP_IPV6 = 0x8, /* (TCP IPV6 HASH */ + RSS_ENABLE_UDP_IPV4 = 0x10, /* UDP IPV4 HASH */ + RSS_ENABLE_UDP_IPV6 = 0x20 /* UDP IPV6 HASH */ }; #define RSS_ENABLE (RSS_ENABLE_IPV4 | RSS_ENABLE_TCP_IPV4) #define RSS_DISABLE RSS_ENABLE_NONE Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Wed Mar 6 09:33:16 2013 (r247879) +++ head/sys/dev/oce/oce_if.c Wed Mar 6 09:53:38 2013 (r247880) @@ -36,6 +36,7 @@ * Costa Mesa, CA 92626 */ + /* $FreeBSD$ */ #include "opt_inet6.h" @@ -94,7 +95,8 @@ static void setup_max_queues_want(POCE_S static void update_queues_got(POCE_SOFTC sc); static void process_link_state(POCE_SOFTC sc, struct oce_async_cqe_link_state *acqe); - +static int oce_tx_asic_stall_verify(POCE_SOFTC sc, struct mbuf *m); +static struct mbuf *oce_insert_vlan_tag(POCE_SOFTC sc, struct mbuf *m, boolean_t *complete); /* IP specific */ #if defined(INET6) || defined(INET) @@ -266,8 +268,6 @@ oce_attach(device_t dev) rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc); if (rc) goto stats_free; -#ifdef DEV_NETMAP -#endif /* DEV_NETMAP */ return 0; @@ -485,7 +485,7 @@ oce_multiq_start(struct ifnet *ifp, stru struct oce_wq *wq = NULL; int queue_index = 0; int status = 0; - + if ((m->m_flags & M_FLOWID) != 0) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -568,6 +568,7 @@ oce_intr(void *arg, int pending) eq_arm: oce_arm_eq(sc, eq->eq_id, 0, TRUE, FALSE); + return; } @@ -633,6 +634,8 @@ oce_fast_isr(void *arg) taskqueue_enqueue_fast(ii->tq, &ii->task); + ii->eq->intr++; + return FILTER_HANDLED; } @@ -780,6 +783,7 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, struct oce_nic_frag_wqe *nicfrag; int num_wqes; uint32_t reg_value; + boolean_t complete = TRUE; m = *mpp; if (!m) @@ -790,6 +794,15 @@ oce_tx(POCE_SOFTC sc, struct mbuf **mpp, goto free_ret; } + if(oce_tx_asic_stall_verify(sc, m)) { + m = oce_insert_vlan_tag(sc, m, &complete); + if(!m) { + device_printf(sc->dev, "Insertion unsuccessful\n"); + return 0; + } + + } + if (m->m_pkthdr.csum_flags & CSUM_TSO) { /* consolidate packet buffers for TSO/LSO segment offload */ #if defined(INET6) || defined(INET) @@ -837,15 +850,15 @@ retry: nichdr->u0.dw[2] = 0; nichdr->u0.dw[3] = 0; - nichdr->u0.s.complete = 1; + nichdr->u0.s.complete = complete; nichdr->u0.s.event = 1; nichdr->u0.s.crc = 1; nichdr->u0.s.forward = 0; nichdr->u0.s.ipcs = (m->m_pkthdr.csum_flags & CSUM_IP) ? 1 : 0; nichdr->u0.s.udpcs = - (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_UDP) ? 1 : 0; nichdr->u0.s.tcpcs = - (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; + (m->m_pkthdr.csum_flags & CSUM_TCP) ? 1 : 0; nichdr->u0.s.num_wqe = num_wqes; nichdr->u0.s.total_length = m->m_pkthdr.len; if (m->m_flags & M_VLANTAG) { @@ -895,7 +908,7 @@ retry: wq->tx_stats.tx_wrbs += num_wqes; wq->tx_stats.tx_bytes += m->m_pkthdr.len; wq->tx_stats.tx_pkts++; - + bus_dmamap_sync(wq->ring->dma.tag, wq->ring->dma.map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); reg_value = (num_wqes << 16) | wq->wq_id; @@ -1081,6 +1094,9 @@ oce_start(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + + if (!sc->link_status) + return; do { IF_DEQUEUE(&sc->ifp->if_snd, m); @@ -1303,7 +1319,6 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_i #if defined(INET6) || defined(INET) /* Try to queue to LRO */ if (IF_LRO_ENABLED(sc) && - !(m->m_flags & M_VLANTAG) && (cqe->u0.s.ip_cksum_pass) && (cqe->u0.s.l4_cksum_pass) && (!cqe->u0.s.ip_ver) && @@ -1343,13 +1358,6 @@ oce_discard_rx_comp(struct oce_rq *rq, s POCE_SOFTC sc = (POCE_SOFTC) rq->parent; int num_frags = cqe->u0.s.num_fragments; - if (IS_XE201(sc) && cqe->u0.s.error) { - /* Lancer A0 workaround - * num_frags will be 1 more than actual in case of error - */ - if (num_frags) - num_frags -= 1; - } for (i = 0; i < num_frags; i++) { if (rq->packets_out == rq->packets_in) { device_printf(sc->dev, @@ -1458,7 +1466,7 @@ oce_free_lro(POCE_SOFTC sc) tcp_lro_free(lro); } } -#endif /* INET6 || INET */ +#endif int oce_alloc_rx_bufs(struct oce_rq *rq, int count) @@ -1471,7 +1479,7 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int struct oce_nic_rqe *rqe; pd_rxulp_db_t rxdb_reg; - + bzero(&rxdb_reg, sizeof(pd_rxulp_db_t)); for (i = 0; i < count; i++) { in = rq->packets_in + 1; if (in == OCE_RQ_PACKET_ARRAY_SIZE) @@ -1512,14 +1520,12 @@ oce_alloc_rx_bufs(struct oce_rq *rq, int } if (added != 0) { for (i = added / OCE_MAX_RQ_POSTS; i > 0; i--) { - DELAY(1); rxdb_reg.bits.num_posted = OCE_MAX_RQ_POSTS; rxdb_reg.bits.qid = rq->rq_id; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); added -= OCE_MAX_RQ_POSTS; } if (added > 0) { - DELAY(1); rxdb_reg.bits.qid = rq->rq_id; rxdb_reg.bits.num_posted = added; OCE_WRITE_REG32(sc, db, PD_RXULP_DB, rxdb_reg.dw0); @@ -1554,13 +1560,8 @@ oce_rq_handler(void *arg) } else { rq->rx_stats.rxcp_err++; sc->ifp->if_ierrors++; - if (IS_XE201(sc)) - /* Lancer A0 no buffer workaround */ - oce_discard_rx_comp(rq, cqe); - else - /* Post L3/L4 errors to stack.*/ - oce_rx(rq, cqe->u0.s.frag_index, cqe); - + /* Post L3/L4 errors to stack.*/ + oce_rx(rq, cqe->u0.s.frag_index, cqe); } rq->rx_stats.rx_compl++; cqe->u0.dw[2] = 0; @@ -1757,18 +1758,18 @@ oce_handle_passthrough(struct ifnet *ifp uint32_t req_size; struct mbx_hdr req; OCE_DMA_MEM dma_mem; - + struct mbx_common_get_cntl_attr *fw_cmd; if (copyin(priv_data, cookie, strlen(IOCTL_COOKIE))) return EFAULT; - + if (memcmp(cookie, IOCTL_COOKIE, strlen(IOCTL_COOKIE))) return EINVAL; - + ioctl_ptr = (char *)priv_data + strlen(IOCTL_COOKIE); if (copyin(ioctl_ptr, &req, sizeof(struct mbx_hdr))) return EFAULT; - + req_size = le32toh(req.u0.req.request_length); if (req_size > 65536) return EINVAL; @@ -1792,12 +1793,86 @@ oce_handle_passthrough(struct ifnet *ifp if (copyout(OCE_DMAPTR(&dma_mem,char), ioctl_ptr, req_size)) rc = EFAULT; + /* + firmware is filling all the attributes for this ioctl except + the driver version..so fill it + */ + if(req.u0.rsp.opcode == OPCODE_COMMON_GET_CNTL_ATTRIBUTES) { + fw_cmd = (struct mbx_common_get_cntl_attr *) ioctl_ptr; + strncpy(fw_cmd->params.rsp.cntl_attr_info.hba_attr.drv_ver_str, + COMPONENT_REVISION, strlen(COMPONENT_REVISION)); + } + dma_free: oce_dma_free(sc, &dma_mem); return rc; } +static void +oce_eqd_set_periodic(POCE_SOFTC sc) +{ + struct oce_set_eqd set_eqd[OCE_MAX_EQ]; + struct oce_aic_obj *aic; + struct oce_eq *eqo; + uint64_t now = 0, delta; + int eqd, i, num = 0; + uint32_t ips = 0; + int tps; + + for (i = 0 ; i < sc->neqs; i++) { + eqo = sc->eq[i]; + aic = &sc->aic_obj[i]; + /* When setting the static eq delay from the user space */ + if (!aic->enable) { + eqd = aic->et_eqd; + goto modify_eqd; + } + + now = ticks; + + /* Over flow check */ + if ((now < aic->ticks) || (eqo->intr < aic->intr_prev)) + goto done; + + delta = now - aic->ticks; + tps = delta/hz; + + /* Interrupt rate based on elapsed ticks */ + if(tps) + ips = (uint32_t)(eqo->intr - aic->intr_prev) / tps; + + if (ips > INTR_RATE_HWM) + eqd = aic->cur_eqd + 20; + else if (ips < INTR_RATE_LWM) + eqd = aic->cur_eqd / 2; + else + goto done; + + if (eqd < 10) + eqd = 0; + + /* Make sure that the eq delay is in the known range */ + eqd = min(eqd, aic->max_eqd); + eqd = max(eqd, aic->min_eqd); + +modify_eqd: + if (eqd != aic->cur_eqd) { + set_eqd[num].delay_multiplier = (eqd * 65)/100; + set_eqd[num].eq_id = eqo->eq_id; + aic->cur_eqd = eqd; + num++; + } +done: + aic->intr_prev = eqo->intr; + aic->ticks = now; + } + + /* Is there atleast one eq that needs to be modified? */ + if(num) + oce_mbox_eqd_modify_periodic(sc, set_eqd, num); + +} static void oce_local_timer(void *arg) @@ -1813,6 +1888,10 @@ oce_local_timer(void *arg) for (i = 0; i < sc->nwqs; i++) oce_tx_restart(sc, sc->wq[i]); + /* calculate and set the eq delay for optimal interrupt rate */ + if (IS_BE(sc)) + oce_eqd_set_periodic(sc); + callout_reset(&sc->timer, hz, oce_local_timer, sc); } @@ -1849,17 +1928,17 @@ oce_if_deactivate(POCE_SOFTC sc) /* Stop intrs and finish any bottom halves pending */ oce_hw_intr_disable(sc); - /* Since taskqueue_drain takes a Giant Lock, We should not acquire - any other lock. So unlock device lock and require after - completing taskqueue_drain. - */ - UNLOCK(&sc->dev_lock); + /* Since taskqueue_drain takes a Gaint Lock, We should not acquire + any other lock. So unlock device lock and require after + completing taskqueue_drain. + */ + UNLOCK(&sc->dev_lock); for (i = 0; i < sc->intr_count; i++) { if (sc->intrs[i].tq != NULL) { taskqueue_drain(sc->intrs[i].tq, &sc->intrs[i].task); } } - LOCK(&sc->dev_lock); + LOCK(&sc->dev_lock); /* Delete RX queue in card with flush param */ oce_stop_rx(sc); @@ -1874,7 +1953,7 @@ oce_if_deactivate(POCE_SOFTC sc) /* But still we need to get MCC aync events. So enable intrs and also arm first EQ - */ + */ oce_hw_intr_enable(sc); oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE); @@ -1947,6 +2026,7 @@ oce_mq_handler(void *arg) struct oce_mq_cqe *cqe; struct oce_async_cqe_link_state *acqe; struct oce_async_event_grp5_pvid_state *gcqe; + struct oce_async_event_qnq *dbgcqe; bus_dmamap_sync(cq->ring->dma.tag, @@ -1973,6 +2053,14 @@ oce_mq_handler(void *arg) sc->pvid = 0; } + else if(evt_type == ASYNC_EVENT_CODE_DEBUG && + optype == ASYNC_EVENT_DEBUG_QNQ) { + dbgcqe = + (struct oce_async_event_qnq *)cqe; + if(dbgcqe->valid) + sc->qnqid = dbgcqe->vlan_tag; + sc->qnq_debug_event = TRUE; + } } cqe->u0.dw[3] = 0; RING_GET(cq->ring, 1); @@ -2032,3 +2120,79 @@ update_queues_got(POCE_SOFTC sc) } } +static int +oce_check_ipv6_ext_hdr(struct mbuf *m) +{ + struct ether_header *eh = mtod(m, struct ether_header *); + caddr_t m_datatemp = m->m_data; + + if (eh->ether_type == htons(ETHERTYPE_IPV6)) { + m->m_data += sizeof(struct ether_header); + struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + + if((ip6->ip6_nxt != IPPROTO_TCP) && \ + (ip6->ip6_nxt != IPPROTO_UDP)){ + struct ip6_ext *ip6e = NULL; + m->m_data += sizeof(struct ip6_hdr); + + ip6e = (struct ip6_ext *) mtod(m, struct ip6_ext *); + if(ip6e->ip6e_len == 0xff) { + m->m_data = m_datatemp; + return TRUE; + } + } + m->m_data = m_datatemp; + } + return FALSE; +} + +static int +is_be3_a1(POCE_SOFTC sc) +{ + if((sc->flags & OCE_FLAGS_BE3) && ((sc->asic_revision & 0xFF) < 2)) { + return TRUE; + } + return FALSE; +} + +static struct mbuf * +oce_insert_vlan_tag(POCE_SOFTC sc, struct mbuf *m, boolean_t *complete) +{ + uint16_t vlan_tag = 0; + + if(!M_WRITABLE(m)) + return NULL; + + /* Embed vlan tag in the packet if it is not part of it */ + if(m->m_flags & M_VLANTAG) { + vlan_tag = EVL_VLANOFTAG(m->m_pkthdr.ether_vtag); + m->m_flags &= ~M_VLANTAG; + } + + /* if UMC, ignore vlan tag insertion and instead insert pvid */ + if(sc->pvid) { + if(!vlan_tag) + vlan_tag = sc->pvid; + *complete = FALSE; + } + + if(vlan_tag) { + m = ether_vlanencap(m, vlan_tag); + } + + if(sc->qnqid) { + m = ether_vlanencap(m, sc->qnqid); + *complete = FALSE; + } + return m; +} + +static int +oce_tx_asic_stall_verify(POCE_SOFTC sc, struct mbuf *m) +{ + if(is_be3_a1(sc) && IS_QNQ_OR_UMC(sc) && \ + oce_check_ipv6_ext_hdr(m)) { + return TRUE; + } + return FALSE; +} Modified: head/sys/dev/oce/oce_if.h ============================================================================== --- head/sys/dev/oce/oce_if.h Wed Mar 6 09:33:16 2013 (r247879) +++ head/sys/dev/oce/oce_if.h Wed Mar 6 09:53:38 2013 (r247880) @@ -36,6 +36,7 @@ * Costa Mesa, CA 92626 */ + /* $FreeBSD$ */ #include @@ -87,9 +88,7 @@ #include "oce_hw.h" -/* OCE device driver module component revision informaiton */ -#define COMPONENT_REVISION "4.2.127.0" - +#define COMPONENT_REVISION "4.6.95.0" /* OCE devices supported by this driver */ #define PCI_VENDOR_EMULEX 0x10df /* Emulex */ @@ -132,7 +131,7 @@ extern int mp_ncpus; /* system's total #define OCE_RQ_BUF_SIZE 2048 #define OCE_LSO_MAX_SIZE (64 * 1024) #define LONG_TIMEOUT 30 -#define OCE_MAX_JUMBO_FRAME_SIZE 16360 +#define OCE_MAX_JUMBO_FRAME_SIZE 9018 #define OCE_MAX_MTU (OCE_MAX_JUMBO_FRAME_SIZE - \ ETHER_VLAN_ENCAP_LEN - \ ETHER_HDR_LEN) @@ -481,7 +480,27 @@ struct oce_drv_stats { } u0; }; +#define INTR_RATE_HWM 15000 +#define INTR_RATE_LWM 10000 + +#define OCE_MAX_EQD 128u +#define OCE_MIN_EQD 50u + +struct oce_set_eqd { + uint32_t eq_id; + uint32_t phase; + uint32_t delay_multiplier; +}; +struct oce_aic_obj { /* Adaptive interrupt coalescing (AIC) info */ + boolean_t enable; + uint32_t min_eqd; /* in usecs */ + uint32_t max_eqd; /* in usecs */ + uint32_t cur_eqd; /* in usecs */ + uint32_t et_eqd; /* configured value when aic is off */ + uint64_t ticks; + uint64_t intr_prev; +}; #define MAX_LOCK_DESC_LEN 32 struct oce_lock { @@ -565,6 +584,7 @@ struct oce_eq { int cq_valid; struct eq_config eq_cfg; int vector; + uint64_t intr; }; enum cq_len { @@ -827,6 +847,9 @@ typedef struct oce_softc { uint32_t flow_control; uint32_t promisc; + + struct oce_aic_obj aic_obj[OCE_MAX_EQ]; + /*Vlan Filtering related */ eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; @@ -837,7 +860,9 @@ typedef struct oce_softc { struct oce_drv_stats oce_stats_info; struct callout timer; int8_t be3_native; - uint32_t pvid; + uint16_t qnq_debug_event; + uint16_t qnqid; + uint16_t pvid; } OCE_SOFTC, *POCE_SOFTC; @@ -996,6 +1021,9 @@ int oce_mbox_create_wq(struct oce_wq *wq int oce_mbox_create_eq(struct oce_eq *eq); int oce_mbox_cq_create(struct oce_cq *cq, uint32_t ncoalesce, uint32_t is_eventable); +int oce_mbox_read_transrecv_data(POCE_SOFTC sc, uint32_t page_num); +void oce_mbox_eqd_modify_periodic(POCE_SOFTC sc, struct oce_set_eqd *set_eqd, + int num); void mbx_common_req_hdr_init(struct mbx_hdr *hdr, uint8_t dom, uint8_t port, @@ -1076,3 +1104,12 @@ static inline uint32_t oce_highbit(uint3 return 0; } +#define TRANSCEIVER_DATA_NUM_ELE 64 +#define TRANSCEIVER_DATA_SIZE 256 +#define TRANSCEIVER_A0_SIZE 128 +#define TRANSCEIVER_A2_SIZE 128 +#define PAGE_NUM_A0 0xa0 +#define PAGE_NUM_A2 0xa2 +#define IS_QNQ_OR_UMC(sc) ((sc->pvid && (sc->function_mode & FNM_UMC_MODE ))\ + || (sc->qnqid && (sc->function_mode & FNM_FLEX10_MODE))) + Modified: head/sys/dev/oce/oce_mbox.c ============================================================================== --- head/sys/dev/oce/oce_mbox.c Wed Mar 6 09:33:16 2013 (r247879) +++ head/sys/dev/oce/oce_mbox.c Wed Mar 6 09:53:38 2013 (r247880) @@ -37,10 +37,12 @@ */ + /* $FreeBSD$ */ -#include "oce_if.h" +#include "oce_if.h" +extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE]; /** * @brief Reset (firmware) common function @@ -276,12 +278,17 @@ oce_get_fw_version(POCE_SOFTC sc) DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); ret = oce_mbox_post(sc, &mbx, NULL); - if (ret) - return ret; + if (!ret) + ret = fwcmd->hdr.u0.rsp.status; + if (ret) { + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, ret); + goto error; + } bcopy(fwcmd->params.rsp.fw_ver_str, sc->fw_version, 32); - - return 0; +error: + return ret; } @@ -428,15 +435,20 @@ oce_read_mac_addr(POCE_SOFTC sc, uint32_ DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); ret = oce_mbox_post(sc, &mbx, NULL); - if (ret) - return ret; + if (!ret) + ret = fwcmd->hdr.u0.rsp.status; + if (ret) { + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, ret); + goto error; + } /* copy the mac addres in the output parameter */ mac->size_of_struct = fwcmd->params.rsp.mac.size_of_struct; bcopy(&fwcmd->params.rsp.mac.mac_addr[0], &mac->mac_addr[0], mac->size_of_struct); - - return 0; +error: + return ret; } /** @@ -466,8 +478,13 @@ oce_get_fw_config(POCE_SOFTC sc) DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); ret = oce_mbox_post(sc, &mbx, NULL); - if (ret) - return ret; + if (!ret) + ret = fwcmd->hdr.u0.rsp.status; + if (ret) { + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, ret); + goto error; + } DW_SWAP(u32ptr(fwcmd), sizeof(struct mbx_common_query_fw_config)); @@ -485,7 +502,8 @@ oce_get_fw_config(POCE_SOFTC sc) sc->max_rx_rings = fwcmd->params.rsp.ulp[1].lro_rqid_tot; } - return 0; +error: + return ret; } @@ -540,15 +558,20 @@ oce_if_create(POCE_SOFTC sc, DW_SWAP(u32ptr(&mbx), OCE_BMBX_RHDR_SZ); rc = oce_mbox_post(sc, &mbx, NULL); - if (rc) - return rc; + if (!rc) + rc = fwcmd->hdr.u0.rsp.status; + if (rc) { + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, rc); + goto error; + } *if_id = LE_32(fwcmd->params.rsp.if_id); if (mac_addr != NULL) sc->pmac_id = LE_32(fwcmd->params.rsp.pmac_id); - - return 0; +error: + return rc; } /** @@ -581,6 +604,11 @@ oce_if_del(POCE_SOFTC sc, uint32_t if_id DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); rc = oce_mbox_post(sc, &mbx, NULL); + if (!rc) + rc = fwcmd->hdr.u0.rsp.status; + if (rc) + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, rc); return rc; } @@ -628,8 +656,12 @@ oce_config_vlan(POCE_SOFTC sc, DW_SWAP(u32ptr(&mbx), (OCE_BMBX_RHDR_SZ + mbx.payload_length)); rc = oce_mbox_post(sc, &mbx, NULL); - - return rc; + if (!rc) + rc = fwcmd->hdr.u0.rsp.status; + if (rc) + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, rc); + return 0; } @@ -667,7 +699,11 @@ oce_set_flow_control(POCE_SOFTC sc, uint DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); rc = oce_mbox_post(sc, &mbx, NULL); - + if (!rc) + rc = fwcmd->hdr.u0.rsp.status; + if (rc) + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, rc); return rc; } @@ -726,20 +762,28 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32 struct oce_mbx mbx; struct mbx_config_nic_rss *fwcmd = (struct mbx_config_nic_rss *)&mbx.payload; + int version; bzero(&mbx, sizeof(struct oce_mbx)); + if (IS_XE201(sc)) { + version = OCE_MBX_VER_V1; + fwcmd->params.req.enable_rss = RSS_ENABLE_UDP_IPV4 | + RSS_ENABLE_UDP_IPV6; + } else + version = OCE_MBX_VER_V0; + mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, MBX_SUBSYSTEM_NIC, NIC_CONFIG_RSS, MBX_TIMEOUT_SEC, sizeof(struct mbx_config_nic_rss), - OCE_MBX_VER_V0); + version); if (enable_rss) - fwcmd->params.req.enable_rss = (RSS_ENABLE_IPV4 | - RSS_ENABLE_TCP_IPV4 | - RSS_ENABLE_IPV6 | - RSS_ENABLE_TCP_IPV6); + fwcmd->params.req.enable_rss |= (RSS_ENABLE_IPV4 | + RSS_ENABLE_TCP_IPV4 | + RSS_ENABLE_IPV6 | + RSS_ENABLE_TCP_IPV6); fwcmd->params.req.flush = OCE_FLUSH; fwcmd->params.req.if_id = LE_32(if_id); @@ -753,9 +797,12 @@ oce_config_nic_rss(POCE_SOFTC sc, uint32 DW_SWAP(u32ptr(&mbx), mbx.payload_length + OCE_BMBX_RHDR_SZ); rc = oce_mbox_post(sc, &mbx, NULL); - + if (!rc) + rc = fwcmd->hdr.u0.rsp.status; + if (rc) + device_printf(sc->dev,"%s failed - cmd status: %d\n", + __FUNCTION__, rc); } - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 11:44:19 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D75D0326; Wed, 6 Mar 2013 11:44:19 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C9C84384; Wed, 6 Mar 2013 11:44:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26BiJgT097211; Wed, 6 Mar 2013 11:44:19 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26BiJnw097210; Wed, 6 Mar 2013 11:44:19 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201303061144.r26BiJnw097210@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 6 Mar 2013 11:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247891 - head/sys/modules/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 11:44:19 -0000 Author: uqs Date: Wed Mar 6 11:44:19 2013 New Revision: 247891 URL: http://svnweb.freebsd.org/changeset/base/247891 Log: Fix 'make depend' Modified: head/sys/modules/uart/Makefile Modified: head/sys/modules/uart/Makefile ============================================================================== --- head/sys/modules/uart/Makefile Wed Mar 6 11:33:25 2013 (r247890) +++ head/sys/modules/uart/Makefile Wed Mar 6 11:44:19 2013 (r247891) @@ -26,6 +26,7 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} u SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \ power_if.h pccarddevs.h serdev_if.h +SRCS+= opt_platform.h MFILES= dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ dev/ofw/ofw_bus_if.m dev/uart/uart_if.m isa/isa_if.m kern/bus_if.m \ From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 13:46:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 44AEF3BE; Wed, 6 Mar 2013 13:46:21 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2804DB44; Wed, 6 Mar 2013 13:46:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26DkLJO034462; Wed, 6 Mar 2013 13:46:21 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26DkKab034460; Wed, 6 Mar 2013 13:46:20 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303061346.r26DkKab034460@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Wed, 6 Mar 2013 13:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247892 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 13:46:21 -0000 Author: des Date: Wed Mar 6 13:46:20 2013 New Revision: 247892 URL: http://svnweb.freebsd.org/changeset/base/247892 Log: Explicitly disable lastlog, utmp and wtmp. Modified: head/crypto/openssh/FREEBSD-upgrade head/crypto/openssh/config.h Modified: head/crypto/openssh/FREEBSD-upgrade ============================================================================== --- head/crypto/openssh/FREEBSD-upgrade Wed Mar 6 11:44:19 2013 (r247891) +++ head/crypto/openssh/FREEBSD-upgrade Wed Mar 6 13:46:20 2013 (r247892) @@ -43,6 +43,7 @@ 7) Run configure with the appropriate arguments: $ ./configure --prefix=/usr --sysconfdir=/etc/ssh \ + --disable-lastlog --disable-utmp --disable-wtmp \ --with-pam --with-tcp-wrappers --with-libedit \ --with-ssl-engine Modified: head/crypto/openssh/config.h ============================================================================== --- head/crypto/openssh/config.h Wed Mar 6 11:44:19 2013 (r247891) +++ head/crypto/openssh/config.h Wed Mar 6 13:46:20 2013 (r247892) @@ -17,6 +17,9 @@ /* Define if your resolver libs need this for getrrsetbyname */ /* #undef BIND_8_COMPAT */ +/* The system has incomplete BSM API */ +/* #undef BROKEN_BSM_API */ + /* Define if cmsg_type is not passed correctly */ /* #undef BROKEN_CMSG_TYPE */ @@ -97,7 +100,7 @@ /* #undef DISABLE_FD_PASSING */ /* Define if you don't want to use lastlog */ -/* #undef DISABLE_LASTLOG */ +#define DISABLE_LASTLOG 1 /* Define if you don't want to use your system's login() call */ /* #undef DISABLE_LOGIN */ @@ -307,7 +310,7 @@ #define HAVE_DECL__GETSHORT 0 /* Define if you have /dev/ptmx */ -#define HAVE_DEV_PTMX 1 +/* #undef HAVE_DEV_PTMX */ /* Define if you have /dev/ptc */ /* #undef HAVE_DEV_PTS_AND_PTC */ @@ -316,7 +319,7 @@ #define HAVE_DIRENT_H 1 /* Define to 1 if you have the `dirfd' function. */ -/* #undef HAVE_DIRFD */ +#define HAVE_DIRFD 1 /* Define to 1 if you have the `dirname' function. */ #define HAVE_DIRNAME 1 @@ -501,6 +504,9 @@ /* Define if HEADER.ad exists in arpa/nameser.h */ #define HAVE_HEADER_AD 1 +/* Define to 1 if you have the `HMAC_CTX_init' function. */ +#define HAVE_HMAC_CTX_INIT 1 + /* Define if you have ut_host in utmp.h */ /* #undef HAVE_HOST_IN_UTMP */ @@ -552,6 +558,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_LASTLOG_H */ +/* Define if you want ldns support */ +/* #undef HAVE_LDNS */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBAUDIT_H */ @@ -594,10 +603,19 @@ /* Define to 1 if you have the header file. */ #define HAVE_LIMITS_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_AUDIT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_FILTER_H */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_LINUX_IF_TUN_H */ -/* Define if your libraries define login() */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_SECCOMP_H */ + +/* Define to 1 if you have the `login' function. */ /* #undef HAVE_LOGIN */ /* Define to 1 if you have the header file. */ @@ -805,6 +823,9 @@ /* Define to 1 if you have the `setgroups' function. */ #define HAVE_SETGROUPS 1 +/* Define to 1 if you have the `setlinebuf' function. */ +#define HAVE_SETLINEBUF 1 + /* Define to 1 if you have the `setlogin' function. */ #define HAVE_SETLOGIN 1 @@ -931,8 +952,11 @@ /* Define to 1 if you have the `strmode' function. */ #define HAVE_STRMODE 1 +/* Define to 1 if you have the `strnlen' function. */ +#define HAVE_STRNLEN 1 + /* Define to 1 if you have the `strnvis' function. */ -/* #undef HAVE_STRNVIS */ +#define HAVE_STRNVIS 1 /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 @@ -1351,15 +1375,21 @@ /* Sandbox using setrlimit(2) */ #define SANDBOX_RLIMIT 1 +/* Sandbox using seccomp filter */ +/* #undef SANDBOX_SECCOMP_FILTER */ + +/* setrlimit RLIMIT_FSIZE works */ +/* #undef SANDBOX_SKIP_RLIMIT_FSIZE */ + /* Sandbox using systrace(4) */ /* #undef SANDBOX_SYSTRACE */ +/* Specify the system call convention in use */ +/* #undef SECCOMP_AUDIT_ARCH */ + /* Define if your platform breaks doing a seteuid before a setuid */ /* #undef SETEUID_BREAKS_SETUID */ -/* The size of `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 - /* The size of `int', as computed by sizeof. */ #define SIZEOF_INT 4 @@ -1500,6 +1530,11 @@ /* Define if xauth is found in your path */ /* #undef XAUTH_PATH */ +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 13:48:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id AC59055C; Wed, 6 Mar 2013 13:48:50 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6FCE9B60; Wed, 6 Mar 2013 13:48:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26DmolE034830; Wed, 6 Mar 2013 13:48:50 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26Dmofl034829; Wed, 6 Mar 2013 13:48:50 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303061348.r26Dmofl034829@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Wed, 6 Mar 2013 13:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247893 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 13:48:50 -0000 Author: des Date: Wed Mar 6 13:48:49 2013 New Revision: 247893 URL: http://svnweb.freebsd.org/changeset/base/247893 Log: Forced commit to note that this file had not been regenerated since 5.8 due to issues with the configure script incorrectly detecting utmp and lastlog despite the fact that FreeBSD 10 does not have them any more. Modified: head/crypto/openssh/config.h Modified: head/crypto/openssh/config.h ============================================================================== From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 15:01:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 089835D5; Wed, 6 Mar 2013 15:01:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 88F4EF70; Wed, 6 Mar 2013 15:01:43 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r26F1XpW062308; Wed, 6 Mar 2013 19:01:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r26F1X44062307; Wed, 6 Mar 2013 19:01:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 6 Mar 2013 19:01:33 +0400 From: Gleb Smirnoff To: Jung-uk Kim Subject: Re: svn commit: r246856 - head/etc Message-ID: <20130306150133.GB48089@FreeBSD.org> References: <201302152258.r1FMwiQp033077@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201302152258.r1FMwiQp033077@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 15:01:45 -0000 Jung-uk, On Fri, Feb 15, 2013 at 10:58:44PM +0000, Jung-uk Kim wrote: J> Author: jkim J> Date: Fri Feb 15 22:58:44 2013 J> New Revision: 246856 J> URL: http://svnweb.freebsd.org/changeset/base/246856 J> J> Log: J> Revert r227528 and r227787. This hack is no longer necessary since r233580. I'm sorry, but it doesn't work. Mouse isn't working after resume for me on r247873. Please return the code back, and I'd appreciate if next time you back something out, you communicate with the person who added the code to give him a chance to confirm or decline whether code is still needed or not. Thanks. J> Modified: J> head/etc/rc.resume J> J> Modified: head/etc/rc.resume J> ============================================================================== J> --- head/etc/rc.resume Fri Feb 15 22:43:08 2013 (r246855) J> +++ head/etc/rc.resume Fri Feb 15 22:58:44 2013 (r246856) J> @@ -43,10 +43,6 @@ if [ -r /var/run/rc.suspend.pid ]; then J> echo 'rc.resume: killed rc.suspend that was still around' J> fi J> J> -if [ -r /var/run/moused.pid ]; then J> - pkill -HUP -F /var/run/moused.pid J> -fi J> - J> # Turns on a power supply of a card in the slot inactivated. J> # See also contrib/pccardq.c (only for PAO users). J> # pccardq | awk -F '~' '$5 == "inactive" \ -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 18:45:01 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC304B56; Wed, 6 Mar 2013 18:45:01 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 28CEDE6D; Wed, 6 Mar 2013 18:45:01 +0000 (UTC) Message-ID: <51378E2E.4090709@FreeBSD.org> Date: Wed, 06 Mar 2013 13:42:54 -0500 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130220 Thunderbird/17.0.3 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r246856 - head/etc References: <201302152258.r1FMwiQp033077@svn.freebsd.org> <20130306150133.GB48089@FreeBSD.org> In-Reply-To: <20130306150133.GB48089@FreeBSD.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=KOI8-R 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 18:45:01 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-03-06 10:01:33 -0500, Gleb Smirnoff wrote: > Jung-uk, > > On Fri, Feb 15, 2013 at 10:58:44PM +0000, Jung-uk Kim wrote: J> > Author: jkim J> Date: Fri Feb 15 22:58:44 2013 J> New Revision: > 246856 J> URL: http://svnweb.freebsd.org/changeset/base/246856 J> > J> Log: J> Revert r227528 and r227787. This hack is no longer > necessary since r233580. > > I'm sorry, but it doesn't work. Mouse isn't working after resume > for me on r247873. > > Please return the code back, and I'd appreciate if next time you > back something out, you communicate with the person who added the > code to give him a chance to confirm or decline whether code is > still needed or not. > > Thanks. > > J> Modified: J> head/etc/rc.resume J> J> Modified: > head/etc/rc.resume J> > ============================================================================== > > J> --- head/etc/rc.resume Fri Feb 15 22:43:08 2013 (r246855) > J> +++ head/etc/rc.resume Fri Feb 15 22:58:44 2013 (r246856) J> @@ > -43,10 +43,6 @@ if [ -r /var/run/rc.suspend.pid ]; then J> echo > 'rc.resume: killed rc.suspend that was still around' J> fi J> J> > -if [ -r /var/run/moused.pid ]; then J> - pkill -HUP -F > /var/run/moused.pid J> -fi J> - J> # Turns on a power supply of a > card in the slot inactivated. J> # See also contrib/pccardq.c > (only for PAO users). J> # pccardq | awk -F '~' '$5 == "inactive" > \ > You know, I disagreed with the above change because this type of quirks can be easily handled by the driver. IMHO, /etc/rc.resume is the last place to put it. When I committed r233580 to fix resuming psm(4) and MFC'd it to stable/9 (r234713), we had an agreement to back it out if we hear no user complaints for enough time *without* merging your /etc/rc.resume changes. At least, that's what I remember. In fact, you never MFC'd your changes. So, I thought the agreement is still valid and it is safe to back out. I am sorry for not asking your confirmation, though. Now, please consider fixing psm. If you can't find a generic solution, it is okay to add your model-specific quirk in sys/dev/atkbdc/psm.c like this: http://svnweb.freebsd.org/base/head/sys/dev/atkbdc/psm.c?annotate=233580#l1441 Also, please mention it in the manual page, i.e., the CAVEATS section of psm(4). Thanks, Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJRN44uAAoJECXpabHZMqHO1loH/3/lBVpM/mo+VhOJmK3u2qqk /8o7Lxyv6sLZ0Og9hCoyi1EKVFUAxuPoVWeyeydPFSs2NcbJZvP9E80T4ompCGX9 m6wOs3SqI1LBNwIpWWa7O6M0rGhkP4Y0uFUe7MLN5/8FW1OEEChcboo11iq2Ftex mzaElMFjefXbw3DDyknqZNyBbEWkSsPyhuMN1TpLXR0VVSM8/dzUsxwbYk1rrWrf TY4U9wzvJz0rgMkjAhB8SPJl/JO7NLQGMlnhLNzIR7EMbtO2EZ5OLxNFJsqZ4pjf XbRDFrtGT3N90UIKhpivBSG9+929hAwS+y29wn3xn5B8aUdmfcgT5mHH8LXY7DI= =KcJ+ -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 18:47:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 37AFDF4F for ; Wed, 6 Mar 2013 18:47:42 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx1.freebsd.org (Postfix) with ESMTP id 65937E9E for ; Wed, 6 Mar 2013 18:47:42 +0000 (UTC) Received: by mail-ve0-f177.google.com with SMTP id m1so6928635ves.8 for ; Wed, 06 Mar 2013 10:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=XybkFQiQVo+gyAjcMhyXBZJz5nZ/eiZ0VBfFJXLdDe4=; b=cyRr0nkfoEkl0cs4g7Owuu+gmPYzxp0TaZFLzTao4DgARZ4yOsVW1v7crDP07Tn8wz xhQYjy99pOt3haTCUACLmLoGkZZlOaiVaqDKRwlAnJ3DP0P9NdrtcfRB1EaHrqqPtZcY hYErqtX35hivjhA4E76gsWycvz8oEoFBXLeLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding :x-gm-message-state; bh=XybkFQiQVo+gyAjcMhyXBZJz5nZ/eiZ0VBfFJXLdDe4=; b=RCWK9fOeVYgi5kK0jPBQHtAZVBd2pCRbpy4r7i0AE/2+OHfLs80TPXrTShyjFVpGBD 9exzuWC2Fvobx5sBtdVyYUhtasYYHIQmmkboynw2To31Et6uq6QXFwioauwma/9xws8o nSDbAMmBQ0DuZ+BUhbILRJUu4mRSKFosuREJCDFosJGPX/0j/ubNRdBx3c9MTkheRCah y82DkvKK48yGgV+Z57/a9F8WzA7riMoLDIKYYw4/gH9KVGGcwHprt8J9V5xW7awoz0tv L+OdbHe4+y05CHYmqyeF3Yd4i0U3WNlVrhK4sDTvCZWw54nhYf5LxBmQXIhi8RK4diH3 wdxw== MIME-Version: 1.0 X-Received: by 10.52.72.137 with SMTP id d9mr10305346vdv.105.1362595655760; Wed, 06 Mar 2013 10:47:35 -0800 (PST) Received: by 10.221.11.72 with HTTP; Wed, 6 Mar 2013 10:47:35 -0800 (PST) In-Reply-To: <201303061346.r26DkKab034460@svn.freebsd.org> References: <201303061346.r26DkKab034460@svn.freebsd.org> Date: Wed, 6 Mar 2013 10:47:35 -0800 Message-ID: Subject: Re: svn commit: r247892 - head/crypto/openssh From: Peter Wemm To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQk/oiUE4pkc9EiSBGrUcMJ+mvXL8OB9oqLdXyUgesCW9X7Bn7sTm4dZr9FWJRFuN4utXElO Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 18:47:43 -0000 On Wed, Mar 6, 2013 at 5:46 AM, Dag-Erling Sm=F8rgrav wro= te: > @@ -931,8 +952,11 @@ > /* Define to 1 if you have the `strmode' function. */ > #define HAVE_STRMODE 1 > > +/* Define to 1 if you have the `strnlen' function. */ > +#define HAVE_STRNLEN 1 > + > /* Define to 1 if you have the `strnvis' function. */ > -/* #undef HAVE_STRNVIS */ > +#define HAVE_STRNVIS 1 We may have a derp moment here: =3D=3D=3D> secure/libexec/sftp-server (all) ... /usr/obj/scratch/src/tmp/usr/lib/libssh.so: undefined reference to `ssh_strnvis'^M cc: error: linker command failed with exit code 1 (use -v to see invocation= )^M ... --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 18:59:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5008154F for ; Wed, 6 Mar 2013 18:59:57 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-vb0-x22f.google.com (mail-vb0-x22f.google.com [IPv6:2607:f8b0:400c:c02::22f]) by mx1.freebsd.org (Postfix) with ESMTP id E8C91F21 for ; Wed, 6 Mar 2013 18:59:56 +0000 (UTC) Received: by mail-vb0-f47.google.com with SMTP id e21so1827778vbm.34 for ; Wed, 06 Mar 2013 10:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=SnK12Sb4YyGEMd1QdKAwCtnOstU2RWvBkG87olUiAh0=; b=JbcF2PPRT/trhNm2VxVBqSG/DAKgiHTCIN14lQEdH+c+Rs3gtyUSIrZHS6sKH4L6Tc I+pyuhS0bsMobS8Ckc97Lu2h7mGpQSa7VkGnS4xigC57/9aSjMf44G6SWXfUlPt5Q0M/ iTA3E1ds6VqNgskscXYgwkSZZPQJ86wkwoBOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding :x-gm-message-state; bh=SnK12Sb4YyGEMd1QdKAwCtnOstU2RWvBkG87olUiAh0=; b=YKBi1NeEOW017r+fxN8vgEwDejYC811+08/qFw39pLW+7md4ifhB84/QS4Wag4dk7P /Nd2+2HJo/LqnmzaLj0eStnEohiziddbkAoDztseuC7mTh79whSyV7hUX2IUzno+xi76 29mTm+HolPlxSJfZ5lw7SO5ZNP5SelmunXNeUFfAmE5z6ZYOKrNFETb2caQIEVsgV5Wz ZKZ2ROeiqE1poACLed9VbpMMX34fNXP6rxNxit1h9XzKnll32ZVXXClzDeu3hN085OAC yyJw37QIAc78GDTF1Yo2RLWj1jBXjzjBCuqHxtsfo+0fyK01pNc1EiZI2X/oAlfst6Ox LrGA== MIME-Version: 1.0 X-Received: by 10.52.31.103 with SMTP id z7mr10291736vdh.56.1362596396404; Wed, 06 Mar 2013 10:59:56 -0800 (PST) Received: by 10.221.11.72 with HTTP; Wed, 6 Mar 2013 10:59:56 -0800 (PST) In-Reply-To: References: <201303061346.r26DkKab034460@svn.freebsd.org> Date: Wed, 6 Mar 2013 10:59:56 -0800 Message-ID: Subject: Re: svn commit: r247892 - head/crypto/openssh From: Peter Wemm To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnqs/Pn2zC0U4bktkNcXrBe5xZE+hkA6eI4ltOWozZs8aD+tEGNg2G+2NYiemZa2ZOghHn1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 18:59:57 -0000 On Wed, Mar 6, 2013 at 10:47 AM, Peter Wemm wrote: > On Wed, Mar 6, 2013 at 5:46 AM, Dag-Erling Sm=F8rgrav w= rote: > >> @@ -931,8 +952,11 @@ >> /* Define to 1 if you have the `strmode' function. */ >> #define HAVE_STRMODE 1 >> >> +/* Define to 1 if you have the `strnlen' function. */ >> +#define HAVE_STRNLEN 1 >> + >> /* Define to 1 if you have the `strnvis' function. */ >> -/* #undef HAVE_STRNVIS */ >> +#define HAVE_STRNVIS 1 > > > We may have a derp moment here: > =3D=3D=3D> secure/libexec/sftp-server (all) > ... > /usr/obj/scratch/src/tmp/usr/lib/libssh.so: undefined reference to > `ssh_strnvis'^M > cc: error: linker command failed with exit code 1 (use -v to see invocati= on)^M > ... Probably need to remove: * $FreeBSD: head/crypto/openssh/ssh_namespace.h 240075 2012-09-03 16:51:41Z des $ ... #define strnvis ssh_strnvis ... if the compat stub is being disabled. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV bitcoin:188ZjyYLFJiEheQZw4UtU27e2FMLmuRBUE From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 19:37:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D257AF6B; Wed, 6 Mar 2013 19:37:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C026B1B4; Wed, 6 Mar 2013 19:37:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26JbdKn044061; Wed, 6 Mar 2013 19:37:39 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26JbdNR044058; Wed, 6 Mar 2013 19:37:39 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303061937.r26JbdNR044058@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Mar 2013 19:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247898 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 19:37:39 -0000 Author: mav Date: Wed Mar 6 19:37:38 2013 New Revision: 247898 URL: http://svnweb.freebsd.org/changeset/base/247898 Log: Fix time math overflows and improve zero intervals handling in poll(), select(), nanosleep() and kevent() functions after calloutng changes. Reported by: bde Modified: head/sys/kern/kern_event.c head/sys/kern/kern_time.c head/sys/kern/sys_generic.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Wed Mar 6 18:45:11 2013 (r247897) +++ head/sys/kern/kern_event.c Wed Mar 6 19:37:38 2013 (r247898) @@ -1329,11 +1329,16 @@ kqueue_scan(struct kqueue *kq, int maxev goto done_nl; } if (timespecisset(tsp)) { - rsbt = tstosbt(*tsp); - if (TIMESEL(&asbt, rsbt)) - asbt += tc_tick_sbt; - asbt += rsbt; - rsbt >>= tc_precexp; + if (tsp->tv_sec < INT32_MAX) { + rsbt = tstosbt(*tsp); + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + if (asbt < rsbt) + asbt = 0; + rsbt >>= tc_precexp; + } else + asbt = 0; } else asbt = -1; } else Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Wed Mar 6 18:45:11 2013 (r247897) +++ head/sys/kern/kern_time.c Wed Mar 6 19:37:38 2013 (r247898) @@ -484,13 +484,20 @@ kern_nanosleep(struct thread *td, struct { struct timespec ts; sbintime_t sbt, sbtt, prec, tmp; + time_t over; int error; if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) return (EINVAL); if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) return (0); - tmp = tstosbt(*rqt); + ts = *rqt; + if (ts.tv_sec > INT32_MAX / 2) { + over = ts.tv_sec - INT32_MAX / 2; + ts.tv_sec -= over; + } else + over = 0; + tmp = tstosbt(ts); prec = tmp; prec >>= tc_precexp; if (TIMESEL(&sbt, tmp)) @@ -504,6 +511,7 @@ kern_nanosleep(struct thread *td, struct TIMESEL(&sbtt, tmp); if (rmt != NULL) { ts = sbttots(sbt - sbtt); + ts.tv_sec += over; if (ts.tv_sec < 0) timespecclear(&ts); *rmt = ts; Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Wed Mar 6 18:45:11 2013 (r247897) +++ head/sys/kern/sys_generic.c Wed Mar 6 19:37:38 2013 (r247898) @@ -1051,12 +1051,19 @@ kern_select(struct thread *td, int nd, f error = EINVAL; goto done; } - rsbt = tvtosbt(rtv); - precision = rsbt; - precision >>= tc_precexp; - if (TIMESEL(&asbt, rsbt)) - asbt += tc_tick_sbt; - asbt += rsbt; + if (rtv.tv_sec == 0 && rtv.tv_usec == 0) + asbt = 0; + else if (rtv.tv_sec < INT32_MAX) { + rsbt = tvtosbt(rtv); + precision = rsbt; + precision >>= tc_precexp; + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + if (asbt < rsbt) + asbt = -1; + } else + asbt = -1; } else asbt = -1; seltdinit(td); @@ -1295,12 +1302,16 @@ sys_poll(td, uap) error = EINVAL; goto done; } - rsbt = SBT_1MS * uap->timeout; - precision = rsbt; - precision >>= tc_precexp; - if (TIMESEL(&asbt, rsbt)) - asbt += tc_tick_sbt; - asbt += rsbt; + if (uap->timeout == 0) + asbt = 0; + else { + rsbt = SBT_1MS * uap->timeout; + precision = rsbt; + precision >>= tc_precexp; + if (TIMESEL(&asbt, rsbt)) + asbt += tc_tick_sbt; + asbt += rsbt; + } } else asbt = -1; seltdinit(td); From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 20:00:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 757695E5; Wed, 6 Mar 2013 20:00:31 +0000 (UTC) (envelope-from zeising@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4553A2CB; Wed, 6 Mar 2013 20:00:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26K05rg048883; Wed, 6 Mar 2013 20:00:15 GMT (envelope-from zeising@svn.freebsd.org) Received: (from zeising@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26JxrBR048869; Wed, 6 Mar 2013 19:59:53 GMT (envelope-from zeising@svn.freebsd.org) Message-Id: <201303061959.r26JxrBR048869@svn.freebsd.org> From: Niclas Zeising Date: Wed, 6 Mar 2013 19:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247899 - head/lib/libc/string X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 20:00:31 -0000 Author: zeising (doc,ports committer) Date: Wed Mar 6 19:59:42 2013 New Revision: 247899 URL: http://svnweb.freebsd.org/changeset/base/247899 Log: Create a symlink from strchrnul.3 to strchr.3. This was forgotten in the initial commit of strchrnul() Approved by: theraven Modified: head/lib/libc/string/Makefile.inc Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Wed Mar 6 19:37:38 2013 (r247898) +++ head/lib/libc/string/Makefile.inc Wed Mar 6 19:59:42 2013 (r247899) @@ -46,7 +46,8 @@ MLINKS+=strcasecmp.3 strncasecmp.3 \ strcasecmp.3 strcasecmp_l.3 \ strcasecmp.3 strncasecmp_l.3 MLINKS+=strcat.3 strncat.3 -MLINKS+=strchr.3 strrchr.3 +MLINKS+=strchr.3 strrchr.3 \ + strchr.3 strchrnul.3 MLINKS+=strcmp.3 strncmp.3 MLINKS+=strcoll.3 strcoll_l.3 MLINKS+=strcpy.3 stpcpy.3 \ From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 22:40:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BFE4F9BF; Wed, 6 Mar 2013 22:40:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B1160D6F; Wed, 6 Mar 2013 22:40:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26MelrE095464; Wed, 6 Mar 2013 22:40:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26MelaH095463; Wed, 6 Mar 2013 22:40:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303062240.r26MelaH095463@svn.freebsd.org> From: Alexander Motin Date: Wed, 6 Mar 2013 22:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247903 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 22:40:47 -0000 Author: mav Date: Wed Mar 6 22:40:47 2013 New Revision: 247903 URL: http://svnweb.freebsd.org/changeset/base/247903 Log: Reduce minimal time intervals of setitimer(2) from 1/HZ to 1/(16*HZ) by using callout_reset_sbt() instead of callout_reset(). We can't remove lower limit completely in this case because of significant processing overhead, caused by unability to use direct callout execution due to using process mutex in callout handler for sending SEGALRM signal. With support of periodic events that would allow unprivileged user to abuse the system. Reviewed by: davide Modified: head/sys/kern/kern_time.c Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Wed Mar 6 22:12:45 2013 (r247902) +++ head/sys/kern/kern_time.c Wed Mar 6 22:40:47 2013 (r247903) @@ -691,7 +691,7 @@ kern_getitimer(struct thread *td, u_int *aitv = p->p_realtimer; PROC_UNLOCK(p); if (timevalisset(&aitv->it_value)) { - getmicrouptime(&ctv); + microuptime(&ctv); if (timevalcmp(&aitv->it_value, &ctv, <)) timevalclear(&aitv->it_value); else @@ -736,28 +736,33 @@ kern_setitimer(struct thread *td, u_int { struct proc *p = td->td_proc; struct timeval ctv; + sbintime_t sbt, pr; if (aitv == NULL) return (kern_getitimer(td, which, oitv)); if (which > ITIMER_PROF) return (EINVAL); - if (itimerfix(&aitv->it_value)) + if (itimerfix(&aitv->it_value) || + aitv->it_value.tv_sec > INT32_MAX / 2) return (EINVAL); if (!timevalisset(&aitv->it_value)) timevalclear(&aitv->it_interval); - else if (itimerfix(&aitv->it_interval)) + else if (itimerfix(&aitv->it_interval) || + aitv->it_interval.tv_sec > INT32_MAX / 2) return (EINVAL); if (which == ITIMER_REAL) { PROC_LOCK(p); if (timevalisset(&p->p_realtimer.it_value)) callout_stop(&p->p_itcallout); - getmicrouptime(&ctv); + microuptime(&ctv); if (timevalisset(&aitv->it_value)) { - callout_reset(&p->p_itcallout, tvtohz(&aitv->it_value), - realitexpire, p); + pr = tvtosbt(aitv->it_value) >> tc_precexp; timevaladd(&aitv->it_value, &ctv); + sbt = tvtosbt(aitv->it_value); + callout_reset_sbt(&p->p_itcallout, sbt, pr, + realitexpire, p, C_ABSOLUTE); } *oitv = p->p_realtimer; p->p_realtimer = *aitv; @@ -793,7 +798,8 @@ void realitexpire(void *arg) { struct proc *p; - struct timeval ctv, ntv; + struct timeval ctv; + sbintime_t isbt; p = (struct proc *)arg; kern_psignal(p, SIGALRM); @@ -803,19 +809,17 @@ realitexpire(void *arg) wakeup(&p->p_itcallout); return; } - for (;;) { + isbt = tvtosbt(p->p_realtimer.it_interval); + if (isbt >= sbt_timethreshold) + getmicrouptime(&ctv); + else + microuptime(&ctv); + do { timevaladd(&p->p_realtimer.it_value, &p->p_realtimer.it_interval); - getmicrouptime(&ctv); - if (timevalcmp(&p->p_realtimer.it_value, &ctv, >)) { - ntv = p->p_realtimer.it_value; - timevalsub(&ntv, &ctv); - callout_reset(&p->p_itcallout, tvtohz(&ntv) - 1, - realitexpire, p); - return; - } - } - /*NOTREACHED*/ + } while (timevalcmp(&p->p_realtimer.it_value, &ctv, <=)); + callout_reset_sbt(&p->p_itcallout, tvtosbt(p->p_realtimer.it_value), + isbt >> tc_precexp, realitexpire, p, C_ABSOLUTE); } /* @@ -830,8 +834,9 @@ itimerfix(struct timeval *tv) if (tv->tv_sec < 0 || tv->tv_usec < 0 || tv->tv_usec >= 1000000) return (EINVAL); - if (tv->tv_sec == 0 && tv->tv_usec != 0 && tv->tv_usec < tick) - tv->tv_usec = tick; + if (tv->tv_sec == 0 && tv->tv_usec != 0 && + tv->tv_usec < (u_int)tick / 16) + tv->tv_usec = (u_int)tick / 16; return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 23:16:18 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2ED5D8F7; Wed, 6 Mar 2013 23:16:18 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [IPv6:2001:770:10:300::86e2:510b]) by mx1.freebsd.org (Postfix) with SMTP id 14BE8F56; Wed, 6 Mar 2013 23:16:16 +0000 (UTC) Received: from walton.maths.tcd.ie ([IPv6:2001:770:10:300::86e2:510a] helo=walton.maths.tcd.ie) by salmon.maths.tcd.ie with SMTP id ; 6 Mar 2013 23:16:14 +0000 (GMT) Received: by walton.maths.tcd.ie (Postfix, from userid 238) id 3769E7306E; Wed, 6 Mar 2013 23:16:13 +0000 (GMT) Date: Wed, 6 Mar 2013 23:16:13 +0000 From: David Malone To: Peter Grehan Subject: Re: svn commit: r247871 - head/usr.sbin/bhyve Message-ID: <20130306231613.GA5146@walton.maths.tcd.ie> References: <201303060728.r267SKP3018477@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201303060728.r267SKP3018477@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 23:16:18 -0000 > + /* > + * We're just computing (a-b) in GF(216). > + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; I think the comment here is wrong? Subtraction (and addition) in GF(2^16) is just xor of 16 bit numbers. You seem to actually be working in Z(2^16), where subtraction is normal subtraction mod 65536. David. From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 23:20:48 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B391FC10 for ; Wed, 6 Mar 2013 23:20:48 +0000 (UTC) (envelope-from bounces+73574-9504-svn-src-head=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 599F9F9A for ; Wed, 6 Mar 2013 23:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=from :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpapi; bh=X2op83wuBKEbem2TabqVUR /EwbI=; b=zlgbcVYyV1FPwXp32Mzaqc6UnytKC9rZiJ8+hx4OOjvVuxqutAEh9W NFFc/jc869/utj3E9xJjasD2cNw7zzN5EiX3SdwGibOeia62Sd9XJeqQwFhnFEr5 jfqa2dxNWd35TeLym1SeLpA8GAAtxV6+nHTQ21hp465ojWJVi6h64= Received: by 10.8.40.13 with SMTP id mf11.828.5137CF4F1 Wed, 06 Mar 2013 17:20:47 -0600 (CST) Received: from mail.tarsnap.com (unknown [10.60.208.15]) by mi23 (SG) with ESMTP id 5137cf4e.6521.21d0e42 for ; Wed, 06 Mar 2013 17:20:46 -0600 (CST) Received: (qmail 17564 invoked from network); 6 Mar 2013 23:20:45 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 6 Mar 2013 23:20:45 -0000 Received: (qmail 3337 invoked from network); 6 Mar 2013 23:19:57 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 6 Mar 2013 23:19:57 -0000 Message-ID: <5137CF1D.3020506@freebsd.org> Date: Wed, 06 Mar 2013 15:19:57 -0800 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130131 Thunderbird/17.0.2 MIME-Version: 1.0 To: David Malone Subject: Re: svn commit: r247871 - head/usr.sbin/bhyve References: <201303060728.r267SKP3018477@svn.freebsd.org> <20130306231613.GA5146@walton.maths.tcd.ie> In-Reply-To: <20130306231613.GA5146@walton.maths.tcd.ie> X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Sendgrid-EID: EvYvoie/qnEezyq2t4eRKjDm9X7ZKbCMt75WvXA+XNFMC+UNrRjf/ALTc81ggaE6x8LCkDd/jDle3GhgMtXsyKPg/AlDbavqlklHUTbraZxR28TnoA1RS2FYmlT3Hn8+ Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 23:20:48 -0000 On 03/06/13 15:16, David Malone wrote: >> + /* >> + * We're just computing (a-b) in GF(216). > >> + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; > > I think the comment here is wrong? Subtraction (and addition) in > GF(2^16) is just xor of 16 bit numbers. You seem to actually be > working in Z(2^16), where subtraction is normal subtraction mod > 65536. Given that there's no such thing as GF(216) due to 216 = 2^3 * 3^3 not being a prime power, the comment is definitely wrong. ;-) -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 23:22:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AADA0F49; Wed, 6 Mar 2013 23:22:40 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9D5DFFB4; Wed, 6 Mar 2013 23:22:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r26NMeBH009011; Wed, 6 Mar 2013 23:22:40 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r26NMebp009010; Wed, 6 Mar 2013 23:22:40 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303062322.r26NMebp009010@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Wed, 6 Mar 2013 23:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247904 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 23:22:40 -0000 Author: des Date: Wed Mar 6 23:22:40 2013 New Revision: 247904 URL: http://svnweb.freebsd.org/changeset/base/247904 Log: Remove strnvis(), strvis(), strvisx(). Modified: head/crypto/openssh/ssh_namespace.h Modified: head/crypto/openssh/ssh_namespace.h ============================================================================== --- head/crypto/openssh/ssh_namespace.h Wed Mar 6 22:40:47 2013 (r247903) +++ head/crypto/openssh/ssh_namespace.h Wed Mar 6 23:22:40 2013 (r247904) @@ -451,9 +451,6 @@ #define start_progress_meter ssh_start_progress_meter #define stop_progress_meter ssh_stop_progress_meter #define strdelim ssh_strdelim -#define strnvis ssh_strnvis -#define strvis ssh_strvis -#define strvisx ssh_strvisx #define sys_tun_open ssh_sys_tun_open #define temporarily_use_uid ssh_temporarily_use_uid #define tilde_expand_filename ssh_tilde_expand_filename From owner-svn-src-head@FreeBSD.ORG Wed Mar 6 23:33:02 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 99FA4434; Wed, 6 Mar 2013 23:33:02 +0000 (UTC) (envelope-from grehan@freebsd.org) Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12]) by mx1.freebsd.org (Postfix) with ESMTP id 12BB2102; Wed, 6 Mar 2013 23:33:02 +0000 (UTC) Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57]) by alto.onthenet.com.au (Postfix) with ESMTPS id CAC08122D0; Thu, 7 Mar 2013 09:33:00 +1000 (EST) Received: (from dommail.onthenet.com.au [67.190.11.104]) by dommail.onthenet.com.au (MOS 4.2.4-GA) with HTTP/1.1 id BKL73109 (AUTH peterg@ptree32.com.au); Thu, 7 Mar 2013 09:33:00 +1000 (EST) From: Peter Grehan Subject: Re: svn commit: r247871 - head/usr.sbin/bhyve To: "Colin Percival" , "David Malone" X-Mailer: Mirapoint Webmail Direct 4.2.4-GA MIME-Version: 1.0 In-Reply-To: <5137CF1D.3020506@freebsd.org> References: <201303060728.r267SKP3018477@svn.freebsd.org> <20130306231613.GA5146@walton.maths.tcd.ie> <5137CF1D.3020506@freebsd.org> Message-Id: <201303062333.042821@dommail.onthenet.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 7 Mar 2013 09:33:00 +1000 (EST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 23:33:02 -0000 >On 03/06/13 15:16, David Malone wrote: >>> + /* >>> + * We're just computing (a-b) in GF(216). >> >>> + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; >> >> I think the comment here is wrong? Subtraction (and addition) in >> GF(2^16) is just xor of 16 bit numbers. You seem to actually be >> working in Z(2^16), where subtraction is normal subtraction mod >> 65536. > >Given that there's no such thing as GF(216) due to 216 = 2^3 * 3^3 not >being a prime power, the comment is definitely wrong. ;-) Any suggestions for better wording ? I submitted the comment block unchanged from the patch. later, Peter. later, Peter. From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 02:28:41 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A463CE83; Thu, 7 Mar 2013 02:28:41 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [IPv6:2607:fc50:1000:c200::face]) by mx1.freebsd.org (Postfix) with ESMTP id 6B1D4946; Thu, 7 Mar 2013 02:28:41 +0000 (UTC) Received: from glenbarber.us (kaos.glenbarber.us [71.224.221.174]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id 0265E23F645; Wed, 6 Mar 2013 21:28:37 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.8.0 onyx.glenbarber.us 0265E23F645 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Wed, 6 Mar 2013 21:28:35 -0500 From: Glen Barber To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Subject: Re: svn commit: r247904 - head/crypto/openssh Message-ID: <20130307022835.GA1496@glenbarber.us> References: <201303062322.r26NMebp009010@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fdj2RfSjLxBAspz7" Content-Disposition: inline In-Reply-To: <201303062322.r26NMebp009010@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 02:28:41 -0000 --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 06, 2013 at 11:22:40PM +0000, Dag-Erling Sm=F8rgrav wrote: > Author: des > Date: Wed Mar 6 23:22:40 2013 > New Revision: 247904 > URL: http://svnweb.freebsd.org/changeset/base/247904 >=20 > Log: > Remove strnvis(), strvis(), strvisx(). >=20 > Modified: > head/crypto/openssh/ssh_namespace.h >=20 This commit now causes ssh(1) to dump core. Glen --fdj2RfSjLxBAspz7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBCAAGBQJRN/tTAAoJEFJPDDeguUaj4WQIAKeH+3sZWGPZD+TF8eqmhABh /uTQNoVXW5cbaZ0qjXEH5lYK19Bm+TKew04RlPD74i/2OVnd3zTW0RN4RNe1avRP EnBe8d+3deldzH51HuJP8McwUloZ/MmGlxMQapSeXt4fAKJDJhpmRSAgTQ+NDLk3 Mz0VmYp3aqE2/XzFVUC9osaiimgBqxmwYwhFec5FxbeqPmIlgj7vIwx4Egc9S0JR sXqxUT+IH2yDnw5CndfIocUt69vpt/fK6CzibUtun18ChEOsU2alTVzyjQDJDZT3 7kkegabu+OQar8mrrvkCmlA6luwWpmrnHjbAzWsM8kfQvnQX0I+YMedclZJlsks= =yBcm -----END PGP SIGNATURE----- --fdj2RfSjLxBAspz7-- From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 02:40:15 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0A843F9; Thu, 7 Mar 2013 02:40:15 +0000 (UTC) (envelope-from seanwbruno@gmail.com) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx1.freebsd.org (Postfix) with ESMTP id B98B898A; Thu, 7 Mar 2013 02:40:14 +0000 (UTC) Received: by mail-pb0-f43.google.com with SMTP id md12so6948186pbc.16 for ; Wed, 06 Mar 2013 18:40:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:from:reply-to:to:cc:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=FQdu/TR57rKlCphO75DInoYIFzdoYI50YLtxrAPiWx0=; b=SjtxICXHcP7RfQ3gSWGODHdb3vM7ssicayxJzZ/BsKkzjz42eheTruyV0XXO8pj3md R9bZ6KHDTLUhpGq2znqEpV/+bIPwIr0uptxy5aFlXZRj1QDSPMoaUIJbefjXgLy3tnop ALFAwnDJWnGwyL/1iyEDcA6AupDQY5/nX1QbyWtNwwEWYKDYP6FsMgD2oq/UuBwCCVTy GmaajXzPUr1GL3yh4k4hreL7ERH8GD5sNWCd4Htl0oJrt/ZwjAkvlBYDX4dD8+Nbk1A0 r8NNnODZjtREYLyLZ/o1Zmx6BtPUluLMgS7sowMDFO5O2FTH+MZSYD4AuqSfYl/pLDK4 UaBw== X-Received: by 10.66.116.104 with SMTP id jv8mr478846pab.136.1362624014094; Wed, 06 Mar 2013 18:40:14 -0800 (PST) Received: from [192.168.43.121] (10.sub-70-199-80.myvzw.com. [70.199.80.10]) by mx.google.com with ESMTPS id eg1sm22794945pbb.33.2013.03.06.18.40.11 (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 06 Mar 2013 18:40:13 -0800 (PST) Subject: Re: svn commit: r247904 - head/crypto/openssh From: Sean Bruno To: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <201303062322.r26NMebp009010@svn.freebsd.org> References: <201303062322.r26NMebp009010@svn.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" Date: Wed, 06 Mar 2013 18:40:08 +0000 Message-ID: <1362595208.1429.1.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: sbruno@freebsd.org List-Id: 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, 07 Mar 2013 02:40:15 -0000 On Wed, 2013-03-06 at 23:22 +0000, Dag-Erling Smørgrav wrote: > Author: des > Date: Wed Mar 6 23:22:40 2013 > New Revision: 247904 > URL: http://svnweb.freebsd.org/changeset/base/247904 > > Log: > Remove strnvis(), strvis(), strvisx(). I don't think that this is the "right" solution as it results in a "derped" version of ssh. I've been running *without* r247904 and the following patch all day long without issue: Index: crypto/openssh/config.h =================================================================== --- crypto/openssh/config.h (revision 247893) +++ crypto/openssh/config.h (working copy) @@ -956,7 +956,7 @@ #define HAVE_STRNLEN 1 /* Define to 1 if you have the `strnvis' function. */ -#define HAVE_STRNVIS 1 +/* #undef HAVE_STRNVIS */ /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 Sean From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 02:53:30 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 42C5734B; Thu, 7 Mar 2013 02:53:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04D649E8; Thu, 7 Mar 2013 02:53:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r272rT5t071791; Thu, 7 Mar 2013 02:53:29 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r272rTUr071790; Thu, 7 Mar 2013 02:53:29 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303070253.r272rTUr071790@svn.freebsd.org> From: Ian Lepore Date: Thu, 7 Mar 2013 02:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247905 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 02:53:30 -0000 Author: ian Date: Thu Mar 7 02:53:29 2013 New Revision: 247905 URL: http://svnweb.freebsd.org/changeset/base/247905 Log: Call sched_prio() to immediately change the priority of the thread in response to an rtprio_thread() call, when the priority is different than the old priority, and either the old or the new priority class is not RTP_PRIO_NORMAL (timeshare). The reasoning for the second half of the test is that if it's a change in timeshare priority, then the scheduler is going to adjust that priority in a way that completely wipes out the requested change anyway, so what's the point? (If that's not true, then allowing a thread to change its own timeshare priority would subvert the scheduler's adjustments and let a cpu-bound thread monopolize the cpu; if allowed at all, that should require priveleges.) On the other hand, if either the old or new priority class is not timeshare, then the scheduler doesn't make automatic adjustments, so we should honor the request and make the priority change right away. The reason the old class gets caught up in this is the very reason for this change: when thread A changes the priority of its child thread B from idle back to timeshare, thread B never actually gets moved to a timeshare-range run queue unless there are some idle cycles available to allow it to first get scheduled again as an idle thread. Reviewed by: jhb@ Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Wed Mar 6 23:22:40 2013 (r247904) +++ head/sys/kern/kern_resource.c Thu Mar 7 02:53:29 2013 (r247905) @@ -469,8 +469,7 @@ sys_rtprio(td, uap) int rtp_to_pri(struct rtprio *rtp, struct thread *td) { - u_char newpri; - u_char oldpri; + u_char newpri, oldclass, oldpri; switch (RTP_PRIO_BASE(rtp->type)) { case RTP_PRIO_REALTIME: @@ -493,11 +492,12 @@ rtp_to_pri(struct rtprio *rtp, struct th } thread_lock(td); + oldclass = td->td_pri_class; sched_class(td, rtp->type); /* XXX fix */ oldpri = td->td_user_pri; sched_user_prio(td, newpri); - if (td->td_user_pri != oldpri && (td == curthread || - td->td_priority == oldpri || td->td_user_pri <= PRI_MAX_REALTIME)) + if (td->td_user_pri != oldpri && (oldclass != RTP_PRIO_NORMAL || + td->td_pri_class != RTP_PRIO_NORMAL)) sched_prio(td, td->td_user_pri); if (TD_ON_UPILOCK(td) && oldpri != newpri) { critical_enter(); From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 04:42:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E385C307; Thu, 7 Mar 2013 04:42:20 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D2FD4E6D; Thu, 7 Mar 2013 04:42:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r274gK7E008464; Thu, 7 Mar 2013 04:42:20 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r274gKgW008463; Thu, 7 Mar 2013 04:42:20 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201303070442.r274gKgW008463@svn.freebsd.org> From: Lawrence Stewart Date: Thu, 7 Mar 2013 04:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247906 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 04:42:21 -0000 Author: lstewart Date: Thu Mar 7 04:42:20 2013 New Revision: 247906 URL: http://svnweb.freebsd.org/changeset/base/247906 Log: The hashmask returned by hashinit() is a valid index in the returned hash array. Fix a siftr(4) potential memory leak and INVARIANTS triggered kernel panic in hashdestroy() by ensuring the last array index in the flow counter hash table is flushed of entries. MFC after: 3 days Modified: head/sys/netinet/siftr.c Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Thu Mar 7 02:53:29 2013 (r247905) +++ head/sys/netinet/siftr.c Thu Mar 7 04:42:20 2013 (r247906) @@ -1314,7 +1314,7 @@ siftr_manage_ops(uint8_t action) * flow seen and freeing any malloc'd memory. * The hash consists of an array of LISTs (man 3 queue). */ - for (i = 0; i < siftr_hashmask; i++) { + for (i = 0; i <= siftr_hashmask; i++) { LIST_FOREACH_SAFE(counter, counter_hash + i, nodes, tmp_counter) { key = counter->key; From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 07:54:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A7B1D34B; Thu, 7 Mar 2013 07:54:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8FA096A9; Thu, 7 Mar 2013 07:54:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r277sofI065604; Thu, 7 Mar 2013 07:54:50 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r277soET065603; Thu, 7 Mar 2013 07:54:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303070754.r277soET065603@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Mar 2013 07:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247910 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 07:54:50 -0000 Author: glebius Date: Thu Mar 7 07:54:50 2013 New Revision: 247910 URL: http://svnweb.freebsd.org/changeset/base/247910 Log: Plug a memory leak. Reviewed by: mav Sponsored by: Nginx, Inc. Modified: head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Thu Mar 7 07:28:05 2013 (r247909) +++ head/sys/dev/sound/pci/hda/hdacc.c Thu Mar 7 07:54:50 2013 (r247910) @@ -460,8 +460,12 @@ hdacc_attach(device_t dev) static int hdacc_detach(device_t dev) { + struct hdacc_softc *codec = device_get_softc(dev); + int error; - return (device_delete_children(dev)); + error = device_delete_children(dev); + free(codec->fgs, M_HDACC); + return (error); } static int From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 08:00:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 471395B4; Thu, 7 Mar 2013 08:00:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 21BCC6D2; Thu, 7 Mar 2013 08:00:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27805n8066466; Thu, 7 Mar 2013 08:00:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27804kJ066462; Thu, 7 Mar 2013 08:00:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201303070800.r27804kJ066462@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Mar 2013 08:00:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247911 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 08:00:05 -0000 Author: glebius Date: Thu Mar 7 08:00:04 2013 New Revision: 247911 URL: http://svnweb.freebsd.org/changeset/base/247911 Log: Add quirks to enable headphones redirection on number of Lenovo laptops, namely X1, X1 Carbon, T420, T520. PR: misc/176656 Submitted by: Hiren Panchasar Tested by: glebius, X1 Carbon Tested by: osa, X1 Tested by: Hiren Panchasar, T420 Tested by: sbruno, T520 Reviewed by: mav Sponsored by: Nginx, Inc. 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 Thu Mar 7 07:54:50 2013 (r247910) +++ head/sys/dev/sound/pci/hda/hdaa_patches.c Thu Mar 7 08:00:04 2013 (r247911) @@ -334,12 +334,22 @@ hdac_pin_patch(struct hdaa_widget *w) break; } } else if (id == HDA_CODEC_CX20590 && - subid == LENOVO_X220_SUBVENDOR) { + (subid == LENOVO_X1_SUBVENDOR || + subid == LENOVO_X220_SUBVENDOR || + subid == LENOVO_T420_SUBVENDOR || + subid == LENOVO_T520_SUBVENDOR)) { switch (nid) { case 25: patch = "as=1 seq=15"; break; } + } else if (id == HDA_CODEC_ALC269 && + subid == LENOVO_X1CRBN_SUBVENDOR) { + switch (nid) { + case 21: + patch = "as=1 seq=15"; + break; + } } if (patch != NULL) Modified: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Thu Mar 7 07:54:50 2013 (r247910) +++ head/sys/dev/sound/pci/hda/hdac.h Thu Mar 7 08:00:04 2013 (r247911) @@ -220,8 +220,12 @@ #define LENOVO_3KN200_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x384e) #define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d) #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015) +#define LENOVO_X1_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21e8) +#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_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) +#define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) /* Samsung */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 08:19:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5CD5F9C7; Thu, 7 Mar 2013 08:19:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id B2EAA788; Thu, 7 Mar 2013 08:19:09 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r278J728066383; Thu, 7 Mar 2013 12:19:07 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r278J7NX066382; Thu, 7 Mar 2013 12:19:07 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 7 Mar 2013 12:19:07 +0400 From: Gleb Smirnoff To: Jung-uk Kim Subject: Re: svn commit: r246856 - head/etc Message-ID: <20130307081907.GF48089@glebius.int.ru> References: <201302152258.r1FMwiQp033077@svn.freebsd.org> <20130306150133.GB48089@FreeBSD.org> <51378E2E.4090709@FreeBSD.org> <20130307080756.GE48089@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20130307080756.GE48089@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 08:19:11 -0000 On Thu, Mar 07, 2013 at 12:07:56PM +0400, Gleb Smirnoff wrote: T> On Wed, Mar 06, 2013 at 01:42:54PM -0500, Jung-uk Kim wrote: T> J> You know, I disagreed with the above change because this type of T> J> quirks can be easily handled by the driver. IMHO, /etc/rc.resume is T> J> the last place to put it. When I committed r233580 to fix resuming T> J> psm(4) and MFC'd it to stable/9 (r234713), we had an agreement to back T> J> it out if we hear no user complaints for enough time *without* merging T> J> your /etc/rc.resume changes. At least, that's what I remember. In T> J> fact, you never MFC'd your changes. So, I thought the agreement is T> J> still valid and it is safe to back out. I am sorry for not asking T> J> your confirmation, though. T> J> T> J> Now, please consider fixing psm. If you can't find a generic T> J> solution, it is okay to add your model-specific quirk in T> J> sys/dev/atkbdc/psm.c like this: T> J> T> J> http://svnweb.freebsd.org/base/head/sys/dev/atkbdc/psm.c?annotate=233580#l1441 T> J> T> J> Also, please mention it in the manual page, i.e., the CAVEATS section of T> J> psm(4). T> T> On my laptop the psm(4) is a generic mouse: T> T> psm0: irq 12 on atkbdc0 T> psm0: [GIANT-LOCKED] T> psm0: model Generic PS/2 mouse, device ID 0 T> T> Do you suggest to add PSM_CONFIG_INITAFTERSUSPEND flag for all generic mice? P.S. I've tested this and it works. Index: psm.c =================================================================== --- psm.c (revision 247911) +++ psm.c (working copy) @@ -1449,6 +1449,7 @@ case MOUSE_MODEL_SYNAPTICS: case MOUSE_MODEL_GLIDEPOINT: case MOUSE_MODEL_VERSAPAD: + case MOUSE_MODEL_GENERIC: sc->config |= PSM_CONFIG_INITAFTERSUSPEND; break; default: -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 08:42:21 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0251F56A; Thu, 7 Mar 2013 08:42:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 613FAB1C; Thu, 7 Mar 2013 08:42:19 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r2787urN066298; Thu, 7 Mar 2013 12:07:56 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r2787uwB066297; Thu, 7 Mar 2013 12:07:56 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 7 Mar 2013 12:07:56 +0400 From: Gleb Smirnoff To: Jung-uk Kim Subject: Re: svn commit: r246856 - head/etc Message-ID: <20130307080756.GE48089@FreeBSD.org> References: <201302152258.r1FMwiQp033077@svn.freebsd.org> <20130306150133.GB48089@FreeBSD.org> <51378E2E.4090709@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <51378E2E.4090709@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 08:42:21 -0000 Jung-uk, On Wed, Mar 06, 2013 at 01:42:54PM -0500, Jung-uk Kim wrote: J> You know, I disagreed with the above change because this type of J> quirks can be easily handled by the driver. IMHO, /etc/rc.resume is J> the last place to put it. When I committed r233580 to fix resuming J> psm(4) and MFC'd it to stable/9 (r234713), we had an agreement to back J> it out if we hear no user complaints for enough time *without* merging J> your /etc/rc.resume changes. At least, that's what I remember. In J> fact, you never MFC'd your changes. So, I thought the agreement is J> still valid and it is safe to back out. I am sorry for not asking J> your confirmation, though. J> J> Now, please consider fixing psm. If you can't find a generic J> solution, it is okay to add your model-specific quirk in J> sys/dev/atkbdc/psm.c like this: J> J> http://svnweb.freebsd.org/base/head/sys/dev/atkbdc/psm.c?annotate=233580#l1441 J> J> Also, please mention it in the manual page, i.e., the CAVEATS section of J> psm(4). On my laptop the psm(4) is a generic mouse: psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model Generic PS/2 mouse, device ID 0 Do you suggest to add PSM_CONFIG_INITAFTERSUSPEND flag for all generic mice? -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 09:18:53 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9C119A2A; Thu, 7 Mar 2013 09:18:53 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC2ED08; Thu, 7 Mar 2013 09:18:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r279IrKO090550; Thu, 7 Mar 2013 09:18:53 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r279IrCC090549; Thu, 7 Mar 2013 09:18:53 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303070918.r279IrCC090549@svn.freebsd.org> From: Andrew Turner Date: Thu, 7 Mar 2013 09:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247912 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 09:18:53 -0000 Author: andrew Date: Thu Mar 7 09:18:52 2013 New Revision: 247912 URL: http://svnweb.freebsd.org/changeset/base/247912 Log: Add __clzsi2 and ctzsi2. They are required on ARMv4 and ARMv5 to implement a number of builtin functions. Modified: head/lib/libstand/Makefile Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Thu Mar 7 08:00:04 2013 (r247911) +++ head/lib/libstand/Makefile Thu Mar 7 09:18:52 2013 (r247912) @@ -67,6 +67,9 @@ SRCS+= divsi3.S .else # Compiler support functions .PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/ +# __clzsi2 and ctzsi2 for various builtin functions +SRCS+= clzsi2.c ctzsi2.c +# Divide and modulus functions called by the compiler SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c moddi3.c modsi3.c SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 10:29:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C4E9394B; Thu, 7 Mar 2013 10:29:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id 88B58FCE; Thu, 7 Mar 2013 10:29:57 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a] (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 1D4325C43; Thu, 7 Mar 2013 11:29:54 +0100 (CET) Message-ID: <51386C23.2020600@FreeBSD.org> Date: Thu, 07 Mar 2013 11:29:55 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: Glen Barber , =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= Subject: Re: svn commit: r247904 - head/crypto/openssh References: <201303062322.r26NMebp009010@svn.freebsd.org> <20130307022835.GA1496@glenbarber.us> In-Reply-To: <20130307022835.GA1496@glenbarber.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 10:29:57 -0000 On 2013-03-07 03:28, Glen Barber wrote: > On Wed, Mar 06, 2013 at 11:22:40PM +0000, Dag-Erling Sm=F8rgrav wrote: >> Author: des >> Date: Wed Mar 6 23:22:40 2013 >> New Revision: 247904 >> URL: http://svnweb.freebsd.org/changeset/base/247904 >> >> Log: >> Remove strnvis(), strvis(), strvisx(). >> >> Modified: >> head/crypto/openssh/ssh_namespace.h >> > > This commit now causes ssh(1) to dump core. Indeed, it will be the same problem that was reported many times on ports@; our strnvis() is not compatible with OpenBSD's strnvis(). :( From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 11:54:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4C3F8FB5; Thu, 7 Mar 2013 11:54:37 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0ECF8384; Thu, 7 Mar 2013 11:54:36 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id A5B7AC000; Thu, 7 Mar 2013 11:54:29 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 6F1F59940; Thu, 7 Mar 2013 12:54:29 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Dimitry Andric Subject: Re: svn commit: r247904 - head/crypto/openssh References: <201303062322.r26NMebp009010@svn.freebsd.org> <20130307022835.GA1496@glenbarber.us> <51386C23.2020600@FreeBSD.org> Date: Thu, 07 Mar 2013 12:54:29 +0100 In-Reply-To: <51386C23.2020600@FreeBSD.org> (Dimitry Andric's message of "Thu, 07 Mar 2013 11:29:55 +0100") Message-ID: <86txonqvbe.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Glen Barber , svn-src-all@freebsd.org, src-committers@freebsd.org, Sean Bruno X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 11:54:37 -0000 Dimitry Andric writes: > Glen Barber writes: > > This commit now causes ssh(1) to dump core. > Indeed, it will be the same problem that was reported many times on > ports@; our strnvis() is not compatible with OpenBSD's strnvis(). :( Thank you, and my apologies for the string of f*ups. I am currently testing a patch based on Dimitry's and Sean's suggestions. I've been working like a dog on OpenPAM and OpenSSH the last couple of weeks and made a few too many assumptions... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 12:27:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B30CCBED; Thu, 7 Mar 2013 12:27:59 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [IPv6:2001:770:10:300::86e2:510b]) by mx1.freebsd.org (Postfix) with SMTP id 577E1730; Thu, 7 Mar 2013 12:27:58 +0000 (UTC) Received: from walton.maths.tcd.ie ([134.226.81.10] helo=walton.maths.tcd.ie) by salmon.maths.tcd.ie with SMTP id ; 7 Mar 2013 12:27:57 +0000 (GMT) Received: from maths.tcd.ie (localhost [127.0.0.1]) by walton.maths.tcd.ie (Postfix) with ESMTP id 2A5AD7306D; Thu, 7 Mar 2013 12:27:57 +0000 (GMT) To: Peter Grehan Subject: Re: svn commit: r247871 - head/usr.sbin/bhyve In-reply-to: Your message of "Thu, 07 Mar 2013 09:33:00 +1000." <201303062333.042821@dommail.onthenet.com.au> Date: Thu, 07 Mar 2013 12:27:56 +0000 From: David Malone Message-Id: <20130307122757.2A5AD7306D@walton.maths.tcd.ie> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 12:27:59 -0000 > Any suggestions for better wording ? I submitted the comment block unchanged I think you could probably replace it with "Z(2^16)" or "mod 65536". In the code, it might be worth checking with bde@ to see what is the least amount of casting required to get the right answer. David. From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 13:24:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 47231BF9; Thu, 7 Mar 2013 13:24:17 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37F6598E; Thu, 7 Mar 2013 13:24:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27DOHNl066225; Thu, 7 Mar 2013 13:24:17 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27DOHXB066224; Thu, 7 Mar 2013 13:24:17 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201303071324.r27DOHXB066224@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 7 Mar 2013 13:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247913 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 13:24:17 -0000 Author: gavin Date: Thu Mar 7 13:24:16 2013 New Revision: 247913 URL: http://svnweb.freebsd.org/changeset/base/247913 Log: Suggest using the https: protocol not the svn: protocol to retrieve the various repositories. Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Thu Mar 7 09:18:52 2013 (r247912) +++ head/share/man/man7/development.7 Thu Mar 7 13:24:16 2013 (r247913) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 19, 2012 +.Dd March 7, 2013 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -109,9 +109,9 @@ your clients automatically pick up the c .Bd -literal -offset 4n mkdir /FreeBSD cd /FreeBSD -svn co svn://svn.freebsd.org/ports/head ports -svn co svn://svn.freebsd.org/doc/head doc -svn co svn://svn.freebsd.org/base/head src +svn co https://svn.freebsd.org/ports/head ports +svn co https://svn.freebsd.org/doc/head doc +svn co https://svn.freebsd.org/base/head src cd /usr rm -rf src ln -s /FreeBSD/src src From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 13:24:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 05BC9D73; Thu, 7 Mar 2013 13:24:50 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EAFF899C; Thu, 7 Mar 2013 13:24:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27DOnR9066327; Thu, 7 Mar 2013 13:24:49 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27DOnXJ066326; Thu, 7 Mar 2013 13:24:49 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201303071324.r27DOnXJ066326@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 7 Mar 2013 13:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247914 - head/sys/sparc64/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 13:24:50 -0000 Author: gavin Date: Thu Mar 7 13:24:49 2013 New Revision: 247914 URL: http://svnweb.freebsd.org/changeset/base/247914 Log: Correct two spelling mistakes in a comment. Modified: head/sys/sparc64/pci/psycho.c Modified: head/sys/sparc64/pci/psycho.c ============================================================================== --- head/sys/sparc64/pci/psycho.c Thu Mar 7 13:24:16 2013 (r247913) +++ head/sys/sparc64/pci/psycho.c Thu Mar 7 13:24:49 2013 (r247914) @@ -200,7 +200,7 @@ struct psycho_icarg { * "Sabre" is the UltraSPARC IIi onboard UPA to PCI bridge. It manages a * single PCI bus and does not have a streaming buffer. It often has an APB * (advanced PCI bridge) connected to it, which was designed specifically for - * the IIi. The APB let's the IIi handle two independednt PCI buses, and + * the IIi. The APB lets the IIi handle two independent PCI buses, and * appears as two "Simba"'s underneath the Sabre. * * "Hummingbird" is the UltraSPARC IIe onboard UPA to PCI bridge. It's From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 13:26:55 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5F297F07; Thu, 7 Mar 2013 13:26:55 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 51C0A9B4; Thu, 7 Mar 2013 13:26:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27DQtQ3066660; Thu, 7 Mar 2013 13:26:55 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27DQt6l066659; Thu, 7 Mar 2013 13:26:55 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201303071326.r27DQt6l066659@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 7 Mar 2013 13:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247915 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 13:26:55 -0000 Author: gavin Date: Thu Mar 7 13:26:54 2013 New Revision: 247915 URL: http://svnweb.freebsd.org/changeset/base/247915 Log: The ZyXEL ZyAIR G-202 is also supported by zyd(4) MFC after: 1 week Modified: head/share/man/man4/zyd.4 Modified: head/share/man/man4/zyd.4 ============================================================================== --- head/share/man/man4/zyd.4 Thu Mar 7 13:24:49 2013 (r247914) +++ head/share/man/man4/zyd.4 Thu Mar 7 13:26:54 2013 (r247915) @@ -32,7 +32,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF .\" THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 2, 2009 +.Dd March 7, 2013 .Dt ZYD 4 .Os .Sh NAME @@ -121,6 +121,7 @@ driver: .It X-Micro XWL-11GUZX .It Yakumo QuickWLAN USB .It Zonet ZEW2501 +.It ZyXEL ZyAIR G-202 .It ZyXEL ZyAIR G-220 .El .Sh EXAMPLES From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 14:38:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BD838917; Thu, 7 Mar 2013 14:38:44 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5D48E71; Thu, 7 Mar 2013 14:38:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27EciXw088586; Thu, 7 Mar 2013 14:38:44 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27EciLY088584; Thu, 7 Mar 2013 14:38:44 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201303071438.r27EciLY088584@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Thu, 7 Mar 2013 14:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247916 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 14:38:44 -0000 Author: des Date: Thu Mar 7 14:38:43 2013 New Revision: 247916 URL: http://svnweb.freebsd.org/changeset/base/247916 Log: Partially revert r247892 and r247904 since our strnvis() does not behave the way OpenSSH expects. Modified: head/crypto/openssh/config.h head/crypto/openssh/ssh_namespace.h Modified: head/crypto/openssh/config.h ============================================================================== --- head/crypto/openssh/config.h Thu Mar 7 13:26:54 2013 (r247915) +++ head/crypto/openssh/config.h Thu Mar 7 14:38:43 2013 (r247916) @@ -956,7 +956,7 @@ #define HAVE_STRNLEN 1 /* Define to 1 if you have the `strnvis' function. */ -#define HAVE_STRNVIS 1 +/* #undef HAVE_STRNVIS */ /* Define to 1 if you have the `strptime' function. */ #define HAVE_STRPTIME 1 @@ -1196,7 +1196,7 @@ /* #undef HAVE_VHANGUP */ /* Define to 1 if you have the header file. */ -#define HAVE_VIS_H 1 +/* #undef HAVE_VIS_H */ /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 1 Modified: head/crypto/openssh/ssh_namespace.h ============================================================================== --- head/crypto/openssh/ssh_namespace.h Thu Mar 7 13:26:54 2013 (r247915) +++ head/crypto/openssh/ssh_namespace.h Thu Mar 7 14:38:43 2013 (r247916) @@ -451,6 +451,9 @@ #define start_progress_meter ssh_start_progress_meter #define stop_progress_meter ssh_stop_progress_meter #define strdelim ssh_strdelim +#define strnvis ssh_strnvis +#define strvis ssh_strvis +#define strvisx ssh_strvisx #define sys_tun_open ssh_sys_tun_open #define temporarily_use_uid ssh_temporarily_use_uid #define tilde_expand_filename ssh_tilde_expand_filename From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 15:00:28 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A42F24F9; Thu, 7 Mar 2013 15:00:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 3C295F89; Thu, 7 Mar 2013 15:00:27 +0000 (UTC) Received: from c211-30-173-106.carlnfd1.nsw.optusnet.com.au (c211-30-173-106.carlnfd1.nsw.optusnet.com.au [211.30.173.106]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id r27F0HdK016105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 8 Mar 2013 02:00:18 +1100 Date: Fri, 8 Mar 2013 02:00:17 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Colin Percival Subject: Re: svn commit: r247871 - head/usr.sbin/bhyve In-Reply-To: <5137CF1D.3020506@freebsd.org> Message-ID: <20130308004634.W1510@besplex.bde.org> References: <201303060728.r267SKP3018477@svn.freebsd.org> <20130306231613.GA5146@walton.maths.tcd.ie> <5137CF1D.3020506@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.0 cv=D4sfsYtj c=1 sm=1 a=Elr93avQcp4A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=QQmxuq8U6XYA:10 a=BcfssYsZeSQLbLEJ4oIA:9 a=CjuIK1q_8ugA:10 a=TEtd8y5WR3g2ypngnwZWYw==:117 Cc: David Malone , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Peter Grehan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 15:00:28 -0000 On Wed, 6 Mar 2013, Colin Percival wrote: > On 03/06/13 15:16, David Malone wrote: >>> + /* >>> + * We're just computing (a-b) in GF(216). >> >>> + ndesc = (unsigned)*hq->hq_avail_idx - (unsigned)hq->hq_cur_aidx; >> >> I think the comment here is wrong? Subtraction (and addition) in >> GF(2^16) is just xor of 16 bit numbers. You seem to actually be >> working in Z(2^16), where subtraction is normal subtraction mod >> 65536. > > Given that there's no such thing as GF(216) due to 216 = 2^3 * 3^3 not > being a prime power, the comment is definitely wrong. ;-) 216 looks like a typo for 2**16, but 2**16 is even more obviously not a prime :-). 2^16 looks like way of writing 2**16 in non-C contexts where '^' isn't the xor operator. The `unsigned' casts seem to be wrong too: - 'unsigned' is spelled u_int in KNF, and bhyve used the latter everywhere else in the directory. (However, it only spelled 'unsigned char' as u_char in 12 out of 15 instances.) - they don't actually work to give subtraction mod 2**16. Assume a result that carries (this was the complicated case in the old code). Say first term = 1 and second term = 3. These promote to int, thanks to C90's broken "value-preserving" promotion rules. The result with uncast ints would be -2. Assigning this to "int ndesc;" doesn't change the value. With the ints cast to unsigned, the result is 1U - 3U = -2U. Assigning this to "int ndesc;" gives an implementation-defined result that is usually -2. Not what we want. We want (uint16_t)-2 = 0xFFFE. The casts of the terms make no difference except to give implementation- defined behaviour. The cast of the result of the expression has the same defined behaviour of adding 1 more than UINT16_MAX that was coded explicitly for the case that carries in the old version. The broken promotion rules actually help here, by avoiding the implementation-defined behaviour provided int is larger than uint16_t. However, ndesc shouild be u_int to avoid the immplementation-defined behaviour from assigning large u_ints to it, or better uint16_t to discard the top bits without a cast. The general method that works here is: u_int result, t1, t2; result = t1 - t2; or uintN_t result, t1, t2; result = t1 - t2; where uintN_t has promotion rank higher than u_int. Using a uintN_t that has promotion rank smaller than u_int gives promotions to int, or using int directly, give a morass of sign extension problems. However, when promotion occurs, it prevents overflow of the signed int expression, and the result of that is usable of you convert it back to uintN_t before really using it. That is not done here -- the next use is an assert() that will fail when ndesc = -2, or, if ndesc is changed to u_int, then it will fail when ndesc = -2U ~= infinity. The code seems to be quite broken apart from this. Maybe just the assert() in it. Wrap probably doesn't give numbers like 1-3 (mod 2**16) = 65534, but more like 1-63 (mod 2**16) = 65536-62 = 65474. Here the magic 63 is the queue size - 1. We want a difference of 2, and would get that by evaluating mod the queue size, but we evaluate modulo 2**16 modulo bugs. 65474 exceeds the queue size so the assertion fails. The modulo by 2**16 can be done a bit faster, at least if ints are 16 bits, but the critical uses of the indexes seem to mostly do a slow runtime modulo (uidx % hq->hq_size), so they will be slow but will work if the indexes are taken mod 2**16 or even mod 2**(number of bits in u_int). Calculating the difference with a sloppy modulo might work too. But not when we assert that it gives a small value. Also, if the indexes are allowed to exceed the queue size, then even the non-carry case may give a large value. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 16:50:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C936529B; Thu, 7 Mar 2013 16:50:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BC3B86C8; Thu, 7 Mar 2013 16:50:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Go8xS028745; Thu, 7 Mar 2013 16:50:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Go8KE028744; Thu, 7 Mar 2013 16:50:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303071650.r27Go8KE028744@svn.freebsd.org> From: Alexander Motin Date: Thu, 7 Mar 2013 16:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247917 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 16:50:08 -0000 Author: mav Date: Thu Mar 7 16:50:07 2013 New Revision: 247917 URL: http://svnweb.freebsd.org/changeset/base/247917 Log: Fix off-by-one error in nanoseconds validation. Submitted by: bde Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Thu Mar 7 14:38:43 2013 (r247916) +++ head/sys/kern/kern_event.c Thu Mar 7 16:50:07 2013 (r247917) @@ -1324,7 +1324,7 @@ kqueue_scan(struct kqueue *kq, int maxev rsbt = 0; if (tsp != NULL) { if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || - tsp->tv_nsec > 1000000000) { + tsp->tv_nsec >= 1000000000) { error = EINVAL; goto done_nl; } From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 18:55:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5E1A3A36; Thu, 7 Mar 2013 18:55:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5114FCE5; Thu, 7 Mar 2013 18:55:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27ItbAX067581; Thu, 7 Mar 2013 18:55:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27ItbM9067580; Thu, 7 Mar 2013 18:55:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303071855.r27ItbM9067580@svn.freebsd.org> From: Alexander Motin Date: Thu, 7 Mar 2013 18:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247918 - head/sys/geom/raid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 18:55:38 -0000 Author: mav Date: Thu Mar 7 18:55:37 2013 New Revision: 247918 URL: http://svnweb.freebsd.org/changeset/base/247918 Log: Fix panic when Secondary_Element_Count == 1 and Secondary_Element_Seq is not set (255). Reported by: sbruno MFC after: 1 week Modified: head/sys/geom/raid/md_ddf.c Modified: head/sys/geom/raid/md_ddf.c ============================================================================== --- head/sys/geom/raid/md_ddf.c Thu Mar 7 16:50:07 2013 (r247917) +++ head/sys/geom/raid/md_ddf.c Thu Mar 7 18:55:37 2013 (r247918) @@ -881,7 +881,10 @@ ddf_vol_meta_update(struct ddf_vol_meta hdr = src->hdr; vde = &src->vdr->entry[ddf_meta_find_vd(src, GUID)]; vdc = ddf_meta_find_vdc(src, GUID); - bvd = GET8D(src, vdc->Secondary_Element_Seq); + if (GET8D(src, vdc->Secondary_Element_Count) == 1) + bvd = 0; + else + bvd = GET8D(src, vdc->Secondary_Element_Seq); size = GET16(src, hdr->Configuration_Record_Length) * src->sectorsize; if (dst->vdc == NULL || From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 19:00:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EE16BD23; Thu, 7 Mar 2013 19:00:00 +0000 (UTC) (envelope-from db@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D228ED30; Thu, 7 Mar 2013 19:00:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27J00uM068248; Thu, 7 Mar 2013 19:00:00 GMT (envelope-from db@svn.freebsd.org) Received: (from db@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27J006A068238; Thu, 7 Mar 2013 19:00:00 GMT (envelope-from db@svn.freebsd.org) Message-Id: <201303071900.r27J006A068238@svn.freebsd.org> From: Diane Bruce Date: Thu, 7 Mar 2013 19:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247919 - head/lib/libutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:00:01 -0000 Author: db (ports committer) Date: Thu Mar 7 19:00:00 2013 New Revision: 247919 URL: http://svnweb.freebsd.org/changeset/base/247919 Log: Cleanup gr_add() so it does not leak mem This is part of ongoing work on sbin/pw M libutil.h M gr_util.c Approved by: theraven Modified: head/lib/libutil/gr_util.c head/lib/libutil/libutil.h Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Thu Mar 7 18:55:37 2013 (r247918) +++ head/lib/libutil/gr_util.c Thu Mar 7 19:00:00 2013 (r247919) @@ -49,6 +49,8 @@ static char group_dir[PATH_MAX]; static char group_file[PATH_MAX]; static char tempname[PATH_MAX]; static int initialized; +static size_t grmemlen(const struct group *, const char *, int *); +static struct group *grcopy(const struct group *gr, struct group *newgr, const char *, int ndx); /* * Initialize statics @@ -429,90 +431,121 @@ gr_make(const struct group *gr) struct group * gr_dup(const struct group *gr) { + return (gr_add(gr, NULL)); +} +/* + * Add a new member name to a struct group. + */ +struct group * +gr_add(const struct group *gr, const char *newmember) +{ struct group *newgr; - char *dst; size_t len; - int ndx; int num_mem; - /* Calculate size of the group. */ - len = sizeof(*newgr); - if (gr->gr_name != NULL) - len += strlen(gr->gr_name) + 1; - if (gr->gr_passwd != NULL) - len += strlen(gr->gr_passwd) + 1; - if (gr->gr_mem != NULL) { - for (num_mem = 0; gr->gr_mem[num_mem] != NULL; num_mem++) - len += strlen(gr->gr_mem[num_mem]) + 1; - len += (num_mem + 1) * sizeof(*gr->gr_mem); - } else - num_mem = -1; + num_mem = 0; + len = grmemlen(gr, newmember, &num_mem); /* Create new group and copy old group into it. */ if ((newgr = malloc(len)) == NULL) return (NULL); - /* point new gr_mem to end of struct + 1 */ - if (gr->gr_mem != NULL) + return (grcopy(gr, newgr, newmember, num_mem)); +} + +/* It is safer to walk the pointers given at gr_mem since there is no + * guarantee the gr_mem + strings are continguous in the given struct group + * but compact the new group into the following form. + * + * The new struct is laid out like this in memory. The example given is + * for a group with two members only. + * + * { + * (char *name) + * (char *passwd) + * (int gid) + * (gr_mem * newgrp + sizeof(struct group) + sizeof(**)) points to gr_mem area + * gr_mem area + * (member1 *) + * (member2 *) + * (NULL) + * (name string) + * (passwd string) + * (member1 string) + * (member2 string) + * } + */ +/* + * Copy the guts of a group plus given name to a preallocated group struct + */ +static struct group * +grcopy(const struct group *gr, struct group *newgr, const char *name, int ndx) +{ + char *dst; + int i; + + if (name != NULL) + ndx++; + /* point new gr_mem to end of struct + 1 if there are names */ + if (ndx != 0) newgr->gr_mem = (char **)(newgr + 1); else newgr->gr_mem = NULL; /* point dst after the end of all the gr_mem pointers in newgr */ - dst = (char *)&newgr->gr_mem[num_mem + 1]; + dst = (char *)&newgr->gr_mem[ndx + 1]; if (gr->gr_name != NULL) { newgr->gr_name = dst; dst = stpcpy(dst, gr->gr_name) + 1; - } else { + } else newgr->gr_name = NULL; - } if (gr->gr_passwd != NULL) { newgr->gr_passwd = dst; dst = stpcpy(dst, gr->gr_passwd) + 1; - } else { + } else newgr->gr_passwd = NULL; - } newgr->gr_gid = gr->gr_gid; - if (gr->gr_mem != NULL) { - for (ndx = 0; ndx < num_mem; ndx++) { - newgr->gr_mem[ndx] = dst; - dst = stpcpy(dst, gr->gr_mem[ndx]) + 1; + if (ndx != 0) { + for (i = 0; gr->gr_mem[i] != NULL; i++) { + newgr->gr_mem[i] = dst; + dst = stpcpy(dst, gr->gr_mem[i]) + 1; + } + if (name != NULL) { + newgr->gr_mem[i++] = dst; + dst = stpcpy(dst, name) + 1; } - newgr->gr_mem[ndx] = NULL; + newgr->gr_mem[i] = NULL; } return (newgr); } /* - * Add a new member name to a struct group. + * Calculate length of a struct group + given name */ -struct group * -gr_add(struct group *gr, char *newmember) +static size_t +grmemlen(const struct group *gr, const char *name, int *num_mem) { - size_t mlen; - int num_mem=0; - char **members; - struct group *newgr; - - if (newmember == NULL) - return(gr_dup(gr)); + size_t len; + int i; + if (gr == NULL) + return (0); + /* Calculate size of the group. */ + len = sizeof(*gr); + if (gr->gr_name != NULL) + len += strlen(gr->gr_name) + 1; + if (gr->gr_passwd != NULL) + len += strlen(gr->gr_passwd) + 1; if (gr->gr_mem != NULL) { - for (num_mem = 0; gr->gr_mem[num_mem] != NULL; num_mem++) { - if (strcmp(gr->gr_mem[num_mem], newmember) == 0) { - errno = EEXIST; - return (NULL); - } + for (len = i = 0; gr->gr_mem[i] != NULL; i++) { + len += strlen(gr->gr_mem[i]) + 1; + len += sizeof(*gr->gr_mem); } + *num_mem = i; } - /* Allocate enough for current pointers + 1 more and NULL marker */ - mlen = (num_mem + 2) * sizeof(*gr->gr_mem); - if ((members = malloc(mlen)) == NULL) - return (NULL); - memcpy(members, gr->gr_mem, num_mem * sizeof(*gr->gr_mem)); - members[num_mem++] = newmember; - members[num_mem] = NULL; - gr->gr_mem = members; - newgr = gr_dup(gr); - free(members); - return (newgr); + if (name != NULL) { + len += strlen(name) + 1; + if (gr->gr_mem == NULL) + len += sizeof(*gr->gr_mem); + } + return(len); } /* Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu Mar 7 18:55:37 2013 (r247918) +++ head/lib/libutil/libutil.h Thu Mar 7 19:00:00 2013 (r247919) @@ -167,7 +167,7 @@ int gr_copy(int __ffd, int _tfd, const struct group * gr_dup(const struct group *_gr); struct group * - gr_add(struct group *_gr, char *_newmember); + gr_add(const struct group *_gr, const char *_newmember); int gr_equal(const struct group *_gr1, const struct group *_gr2); void gr_fini(void); int gr_init(const char *_dir, const char *_master); From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 19:16:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 943A9436; Thu, 7 Mar 2013 19:16:57 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 24085DEA; Thu, 7 Mar 2013 19:16:57 +0000 (UTC) Message-ID: <5138E729.6070309@FreeBSD.org> Date: Thu, 07 Mar 2013 14:14:49 -0500 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130220 Thunderbird/17.0.3 MIME-Version: 1.0 To: Gleb Smirnoff Subject: Re: svn commit: r246856 - head/etc References: <201302152258.r1FMwiQp033077@svn.freebsd.org> <20130306150133.GB48089@FreeBSD.org> <51378E2E.4090709@FreeBSD.org> <20130307080756.GE48089@FreeBSD.org> <20130307081907.GF48089@glebius.int.ru> In-Reply-To: <20130307081907.GF48089@glebius.int.ru> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=KOI8-R 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 19:16:57 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-03-07 03:19:07 -0500, Gleb Smirnoff wrote: > On Thu, Mar 07, 2013 at 12:07:56PM +0400, Gleb Smirnoff wrote: T> > On Wed, Mar 06, 2013 at 01:42:54PM -0500, Jung-uk Kim wrote: T> J> > You know, I disagreed with the above change because this type of T> > J> quirks can be easily handled by the driver. IMHO, > /etc/rc.resume is T> J> the last place to put it. When I committed > r233580 to fix resuming T> J> psm(4) and MFC'd it to stable/9 > (r234713), we had an agreement to back T> J> it out if we hear no > user complaints for enough time *without* merging T> J> your > /etc/rc.resume changes. At least, that's what I remember. In T> > J> fact, you never MFC'd your changes. So, I thought the agreement > is T> J> still valid and it is safe to back out. I am sorry for > not asking T> J> your confirmation, though. T> J> T> J> Now, please > consider fixing psm. If you can't find a generic T> J> solution, > it is okay to add your model-specific quirk in T> J> > sys/dev/atkbdc/psm.c like this: T> J> T> J> > http://svnweb.freebsd.org/base/head/sys/dev/atkbdc/psm.c?annotate=233580#l1441 > > T> J> > T> J> Also, please mention it in the manual page, i.e., the CAVEATS > section of T> J> psm(4). T> T> On my laptop the psm(4) is a generic > mouse: T> T> psm0: irq 12 on atkbdc0 T> psm0: > [GIANT-LOCKED] T> psm0: model Generic PS/2 mouse, device ID 0 T> T> > Do you suggest to add PSM_CONFIG_INITAFTERSUSPEND flag for all > generic mice? > > P.S. I've tested this and it works. > > Index: psm.c > =================================================================== > > - --- psm.c (revision 247911) > +++ psm.c (working copy) @@ -1449,6 +1449,7 @@ case > MOUSE_MODEL_SYNAPTICS: case MOUSE_MODEL_GLIDEPOINT: case > MOUSE_MODEL_VERSAPAD: + case MOUSE_MODEL_GENERIC: sc->config > |= PSM_CONFIG_INITAFTERSUSPEND; break; default: > If we really have no other choice, it should be added to GENERIC.hints. Index: sys/amd64/conf/GENERIC.hints =================================================================== - --- sys/amd64/conf/GENERIC.hints (revision 247917) +++ sys/amd64/conf/GENERIC.hints (working copy) @@ -12,6 +12,7 @@ hint.atkbdc.0.port="0x060" hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" hint.psm.0.at="atkbdc" +hint.psm.0.flags="0x6000" hint.psm.0.irq="12" hint.sc.0.at="isa" hint.sc.0.flags="0x100" Index: sys/i386/conf/GENERIC.hints =================================================================== - --- sys/i386/conf/GENERIC.hints (revision 247917) +++ sys/i386/conf/GENERIC.hints (working copy) @@ -18,6 +18,7 @@ hint.atkbdc.0.port="0x060" hint.atkbd.0.at="atkbdc" hint.atkbd.0.irq="1" hint.psm.0.at="atkbdc" +hint.psm.0.flags="0x6000" hint.psm.0.irq="12" hint.sc.0.at="isa" hint.sc.0.flags="0x100" Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJROOcpAAoJECXpabHZMqHO8VAIAIqogDH/140qIZSkql7UtFPt zCBsNw2Td5XiHx8dOQ5F9X6bneahxN2PhPQ6uvVgBbIj6z9mDfRZMWXJb7IqugqX 5o0tJCCRGc2RH9/Qq/H68VFKCPj3d1SX+29yeV1Oj3ORPboZ5h4tSq5kaidv7CrD kEGUNUYQzgnXiycWx8Bd6D5A2tll8TxtK4WB0zzJ94gU3wGJfo/SBzDRaJv/m622 4gzzt8WmP5ObqWL1gYvfP+/81bF709OrDfUsmHNN0bByc/VVd3ebvrTAxLNtZNa+ T0zoABdE0FpnlBam5yNniHzGpWdwStaCKY5zi19bu4EqN9m4nfl94HLMoU47V7k= =ouzq -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 20:48:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 90282624; Thu, 7 Mar 2013 20:48:37 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C84F20B; Thu, 7 Mar 2013 20:48:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27KmbW3002902; Thu, 7 Mar 2013 20:48:37 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27KmbcK002901; Thu, 7 Mar 2013 20:48:37 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201303072048.r27KmbcK002901@svn.freebsd.org> From: Colin Percival Date: Thu, 7 Mar 2013 20:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247940 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 20:48:37 -0000 Author: cperciva Date: Thu Mar 7 20:48:36 2013 New Revision: 247940 URL: http://svnweb.freebsd.org/changeset/base/247940 Log: Now that stable/7 is EOL, stop building INDEX-7. MFC after: 1 week Modified: head/etc/portsnap.conf Modified: head/etc/portsnap.conf ============================================================================== --- head/etc/portsnap.conf Thu Mar 7 20:41:36 2013 (r247939) +++ head/etc/portsnap.conf Thu Mar 7 20:48:36 2013 (r247940) @@ -30,6 +30,5 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddb # REFUSE korean polish portuguese russian ukrainian vietnamese # List of INDEX files to build and the DESCRIBE file to use for each -INDEX INDEX-7 DESCRIBE.7 INDEX INDEX-8 DESCRIBE.8 INDEX INDEX-9 DESCRIBE.9 From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 21:34:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 02C22C6D; Thu, 7 Mar 2013 21:34:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EA1C6402; Thu, 7 Mar 2013 21:34:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LYGNE018109; Thu, 7 Mar 2013 21:34:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LYGbA018108; Thu, 7 Mar 2013 21:34:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201303072134.r27LYGbA018108@svn.freebsd.org> From: Dimitry Andric Date: Thu, 7 Mar 2013 21:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247951 - head/usr.bin/c89 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:34:17 -0000 Author: dim Date: Thu Mar 7 21:34:16 2013 New Revision: 247951 URL: http://svnweb.freebsd.org/changeset/base/247951 Log: Make c89(1) invoke /usr/bin/cc with argv[0] also set to /usr/bin/cc, similar to what c99(1) does, to prevent "c89: illegal option -- 1" messages, when clang is /usr/bin/cc. Reported by: tijl MFC after: 3 days Modified: head/usr.bin/c89/c89.c Modified: head/usr.bin/c89/c89.c ============================================================================== --- head/usr.bin/c89/c89.c Thu Mar 7 21:34:04 2013 (r247950) +++ head/usr.bin/c89/c89.c Thu Mar 7 21:34:16 2013 (r247951) @@ -72,7 +72,7 @@ main(int argc, char **argv) Argv.a = malloc((argc + 1 + N_ARGS_PREPENDED) * sizeof *Argv.a); if (Argv.a == NULL) err(1, "malloc"); - Argv.a[Argc++] = argv[0]; + Argv.a[Argc++] = CC; for (j = 0; j < N_ARGS_PREPENDED; ++j) Argv.a[Argc++] = args_prepended[j]; while ((i = getopt(argc, argv, "cD:EgI:l:L:o:OsU:")) != -1) { From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 21:37:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1D484FDD; Thu, 7 Mar 2013 21:37:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 04DB0600; Thu, 7 Mar 2013 21:37:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27LbNCi018641; Thu, 7 Mar 2013 21:37:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27LbNBC018640; Thu, 7 Mar 2013 21:37:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201303072137.r27LbNBC018640@svn.freebsd.org> From: Dimitry Andric Date: Thu, 7 Mar 2013 21:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247953 - head/usr.bin/c99 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 21:37:24 -0000 Author: dim Date: Thu Mar 7 21:37:23 2013 New Revision: 247953 URL: http://svnweb.freebsd.org/changeset/base/247953 Log: Make c99(1) invoke /usr/bin/cc with argv[0] set to "/usr/bin/cc" instead of just "cc", since there is no reason to cause additional path searches in this case. MFC after: 3 days Modified: head/usr.bin/c99/c99.c Modified: head/usr.bin/c99/c99.c ============================================================================== --- head/usr.bin/c99/c99.c Thu Mar 7 21:36:04 2013 (r247952) +++ head/usr.bin/c99/c99.c Thu Mar 7 21:37:23 2013 (r247953) @@ -70,7 +70,7 @@ main(int argc, char *argv[]) usage(); } - addarg("cc"); + addarg("/usr/bin/cc"); addarg("-std=iso9899:1999"); addarg("-pedantic"); for (i = 1; i < optind; i++) From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 22:16:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 73F0617F; Thu, 7 Mar 2013 22:16:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 653D07B0; Thu, 7 Mar 2013 22:16:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27MGaAf031062; Thu, 7 Mar 2013 22:16:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27MGZ1b031061; Thu, 7 Mar 2013 22:16:35 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201303072216.r27MGZ1b031061@svn.freebsd.org> From: Dimitry Andric Date: Thu, 7 Mar 2013 22:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:16:36 -0000 Author: dim Date: Thu Mar 7 22:16:35 2013 New Revision: 247960 URL: http://svnweb.freebsd.org/changeset/base/247960 Log: Make ctfconvert work correctly on clang-compiled object files. Clang puts the full original source filename in the STT_FILE entry of the ELF symbol table, while gcc saves only the basename. Since the DWARF DW_AT_name attribute contains the full source filename, both for clang and gcc, ctfconvert takes just the basename of it, for matching with the STT_FILE entry. So when attempting to match with such an entry, use its basename, if necessary. Reported by: avg MFC after: 1 week Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:05:27 2013 (r247959) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:16:35 2013 (r247960) @@ -363,6 +363,7 @@ sort_iidescs(Elf *elf, const char *file, for (i = 0; i < nent; i++) { GElf_Sym sym; + char *bname; iidesc_t **tolist; GElf_Sym ssym; iidesc_match_t smatch; @@ -377,6 +378,8 @@ sort_iidescs(Elf *elf, const char *file, switch (GELF_ST_TYPE(sym.st_info)) { case STT_FILE: + bname = strrchr(match.iim_name, '/'); + bname = bname == NULL ? match.iim_name : bname + 1; match.iim_file = match.iim_name; continue; case STT_OBJECT: From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 22:29:38 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 003204DC; Thu, 7 Mar 2013 22:29:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 8DFD681B; Thu, 7 Mar 2013 22:29:36 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id AAA23343; Fri, 08 Mar 2013 00:29:28 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1UDjJY-000AsI-1j; Fri, 08 Mar 2013 00:29:28 +0200 Message-ID: <513914C4.4010001@FreeBSD.org> Date: Fri, 08 Mar 2013 00:29:24 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130220 Thunderbird/17.0.3 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt References: <201303072216.r27MGZ1b031061@svn.freebsd.org> In-Reply-To: <201303072216.r27MGZ1b031061@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:29:38 -0000 on 08/03/2013 00:16 Dimitry Andric said the following: > Author: dim > Date: Thu Mar 7 22:16:35 2013 > New Revision: 247960 > URL: http://svnweb.freebsd.org/changeset/base/247960 > > Log: > Make ctfconvert work correctly on clang-compiled object files. Clang > puts the full original source filename in the STT_FILE entry of the ELF > symbol table, while gcc saves only the basename. > > Since the DWARF DW_AT_name attribute contains the full source filename, > both for clang and gcc, ctfconvert takes just the basename of it, for > matching with the STT_FILE entry. So when attempting to match with such > an entry, use its basename, if necessary. I was not really kidding when I said that this change, as is, is a nop: > Reported by: avg > MFC after: 1 week > > Modified: > head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c > > Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c > ============================================================================== > --- head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:05:27 2013 (r247959) > +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:16:35 2013 (r247960) > @@ -363,6 +363,7 @@ sort_iidescs(Elf *elf, const char *file, > > for (i = 0; i < nent; i++) { > GElf_Sym sym; > + char *bname; > iidesc_t **tolist; > GElf_Sym ssym; > iidesc_match_t smatch; > @@ -377,6 +378,8 @@ sort_iidescs(Elf *elf, const char *file, > > switch (GELF_ST_TYPE(sym.st_info)) { > case STT_FILE: > + bname = strrchr(match.iim_name, '/'); > + bname = bname == NULL ? match.iim_name : bname + 1; It would probably make sense to make use of bname after going to through all the trouble of calculating it: > match.iim_file = match.iim_name; Should be match.iim_file = bname ? Surprised that clang hasn't warned you about this one :-) > continue; > case STT_OBJECT: > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 22:32:43 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 24C46675; Thu, 7 Mar 2013 22:32:43 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E873C837; Thu, 7 Mar 2013 22:32:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27MWgAq036406; Thu, 7 Mar 2013 22:32:42 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27MWgFN036402; Thu, 7 Mar 2013 22:32:42 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201303072232.r27MWgFN036402@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 7 Mar 2013 22:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247961 - in head/sys: geom/part 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:32:43 -0000 Author: gavin Date: Thu Mar 7 22:32:41 2013 New Revision: 247961 URL: http://svnweb.freebsd.org/changeset/base/247961 Log: Support the FAT16 partition type in gpart(8) PR: kern/174714 Submitted by: 4721 at hushmail dot com MFC after: 1 week Modified: head/sys/geom/part/g_part.c head/sys/geom/part/g_part.h head/sys/geom/part/g_part_mbr.c head/sys/sys/diskmbr.h Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Thu Mar 7 22:16:35 2013 (r247960) +++ head/sys/geom/part/g_part.c Thu Mar 7 22:32:41 2013 (r247961) @@ -80,6 +80,7 @@ struct g_part_alias_list { { "bios-boot", G_PART_ALIAS_BIOS_BOOT }, { "ebr", G_PART_ALIAS_EBR }, { "efi", G_PART_ALIAS_EFI }, + { "fat16", G_PART_ALIAS_MS_FAT16 }, { "fat32", G_PART_ALIAS_MS_FAT32 }, { "freebsd", G_PART_ALIAS_FREEBSD }, { "freebsd-boot", G_PART_ALIAS_FREEBSD_BOOT }, Modified: head/sys/geom/part/g_part.h ============================================================================== --- head/sys/geom/part/g_part.h Thu Mar 7 22:16:35 2013 (r247960) +++ head/sys/geom/part/g_part.h Thu Mar 7 22:32:41 2013 (r247961) @@ -68,6 +68,7 @@ enum g_part_alias { G_PART_ALIAS_NETBSD_SWAP, /* A NetBSD swap partition entry. */ G_PART_ALIAS_NETBSD_LFS, /* A NetBSD LFS partition entry. */ G_PART_ALIAS_EBR, /* A EBR partition entry. */ + G_PART_ALIAS_MS_FAT16, /* A Microsoft FAT16 partition entry. */ G_PART_ALIAS_MS_FAT32, /* A Microsoft FAT32 partition entry. */ G_PART_ALIAS_BIOS_BOOT, /* A GRUB 2 boot partition entry. */ G_PART_ALIAS_VMFS, /* A VMware VMFS partition entry */ Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Thu Mar 7 22:16:35 2013 (r247960) +++ head/sys/geom/part/g_part_mbr.c Thu Mar 7 22:32:41 2013 (r247961) @@ -118,6 +118,7 @@ static struct g_part_mbr_alias { { DOSPTYP_386BSD, G_PART_ALIAS_FREEBSD }, { DOSPTYP_EXT, G_PART_ALIAS_EBR }, { DOSPTYP_NTFS, G_PART_ALIAS_MS_NTFS }, + { DOSPTYP_FAT16, G_PART_ALIAS_MS_FAT16 }, { DOSPTYP_FAT32, G_PART_ALIAS_MS_FAT32 }, { DOSPTYP_EXTLBA, G_PART_ALIAS_EBR }, { DOSPTYP_LDM, G_PART_ALIAS_MS_LDM_DATA }, Modified: head/sys/sys/diskmbr.h ============================================================================== --- head/sys/sys/diskmbr.h Thu Mar 7 22:16:35 2013 (r247960) +++ head/sys/sys/diskmbr.h Thu Mar 7 22:32:41 2013 (r247961) @@ -45,6 +45,7 @@ #define DOSMAGIC 0xAA55 #define DOSPTYP_EXT 0x05 /* DOS extended partition */ +#define DOSPTYP_FAT16 0x06 /* FAT16 partition */ #define DOSPTYP_NTFS 0x07 /* NTFS partition */ #define DOSPTYP_FAT32 0x0b /* FAT32 partition */ #define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */ From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 22:43:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 708A7927; Thu, 7 Mar 2013 22:43:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58ECD8AF; Thu, 7 Mar 2013 22:43:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27Mhov4039450; Thu, 7 Mar 2013 22:43:50 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27Mhopv039449; Thu, 7 Mar 2013 22:43:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201303072243.r27Mhopv039449@svn.freebsd.org> From: Dimitry Andric Date: Thu, 7 Mar 2013 22:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247962 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:43:51 -0000 Author: dim Date: Thu Mar 7 22:43:50 2013 New Revision: 247962 URL: http://svnweb.freebsd.org/changeset/base/247962 Log: Fix error in r247960: actually assign the basename to match.iim_file. Pointed out by: avg Pointy hat to: dim MFC after: 1 week X-MFC-With: r247960 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:32:41 2013 (r247961) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:43:50 2013 (r247962) @@ -379,8 +379,7 @@ sort_iidescs(Elf *elf, const char *file, switch (GELF_ST_TYPE(sym.st_info)) { case STT_FILE: bname = strrchr(match.iim_name, '/'); - bname = bname == NULL ? match.iim_name : bname + 1; - match.iim_file = match.iim_name; + match.iim_file = bname == NULL ? match.iim_name : bname + 1; continue; case STT_OBJECT: tolist = iiburst->iib_objts; From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 22:54:29 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2C99AD76; Thu, 7 Mar 2013 22:54:29 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC0A927; Thu, 7 Mar 2013 22:54:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27MsSDm042528; Thu, 7 Mar 2013 22:54:29 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27MsSMl042526; Thu, 7 Mar 2013 22:54:28 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201303072254.r27MsSMl042526@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 7 Mar 2013 22:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247963 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 22:54:29 -0000 Author: obrien Date: Thu Mar 7 22:54:28 2013 New Revision: 247963 URL: http://svnweb.freebsd.org/changeset/base/247963 Log: Fix GCC build: /usr/src/sys/modules/nvme/../../dev/nvme/nvme.c:211: warning: format '%qx' expects type 'long unsigned int', but argument 9 has type 'long long unsigned int' [-Wformat] Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Mar 7 22:43:50 2013 (r247962) +++ head/sys/dev/nvme/nvme.c Thu Mar 7 22:54:28 2013 (r247963) @@ -200,13 +200,11 @@ nvme_modevent(module_t mod, int type, vo void nvme_dump_command(struct nvme_command *cmd) { - printf("opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x " - "mptr:%qx prp1:%qx prp2:%qx cdw:%x %x %x %x %x %x\n", + printf( +"opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx cdw:%x %x %x %x %x %x\n", cmd->opc, cmd->fuse, cmd->rsvd1, cmd->cid, cmd->nsid, cmd->rsvd2, cmd->rsvd3, - (long long unsigned int)cmd->mptr, - (long long unsigned int)cmd->prp1, - (long long unsigned int)cmd->prp2, + (uintmax_t)cmd->mptr, (uintmax_t)cmd->prp1, (uintmax_t)cmd->prp2, cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, cmd->cdw15); } Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Mar 7 22:43:50 2013 (r247962) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Mar 7 22:54:28 2013 (r247963) @@ -131,8 +131,8 @@ nvme_ctrlr_setup_chatham(struct nvme_con ctrlr->chatham_lbas = chatham_read_4(ctrlr, 0x8068) - 0x110; ctrlr->chatham_size = ctrlr->chatham_lbas * 512; - device_printf(ctrlr->dev, "Chatham size: %lld\n", - (long long)ctrlr->chatham_size); + device_printf(ctrlr->dev, "Chatham size: %jd\n", + (intmax_t)ctrlr->chatham_size); reg1 = reg2 = reg3 = ctrlr->chatham_size - 1; From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 23:00:52 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id ED05CF48; Thu, 7 Mar 2013 23:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id AD0A495C; Thu, 7 Mar 2013 23:00:52 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a] (spaceball.andric.com [IPv6:2001:7b8:3a7:0:204:4bff:fe01:de8a]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 9B5655C44; Fri, 8 Mar 2013 00:00:45 +0100 (CET) Message-ID: <51391C1E.5030905@FreeBSD.org> Date: Fri, 08 Mar 2013 00:00:46 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt References: <201303072216.r27MGZ1b031061@svn.freebsd.org> <513914C4.4010001@FreeBSD.org> In-Reply-To: <513914C4.4010001@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:00:53 -0000 On 2013-03-07 23:29, Andriy Gapon wrote: ... > I was not really kidding when I said that this change, as is, is a nop: ... >> + bname = strrchr(match.iim_name, '/'); >> + bname = bname == NULL ? match.iim_name : bname + 1; > > It would probably make sense to make use of bname after going to through all the > trouble of calculating it: > >> match.iim_file = match.iim_name; > > Should be match.iim_file = bname ? Yes, I actually had this in my test code, and committed the wrong diff by accident. :( Fixed in r247962, in any case. > Surprised that clang hasn't warned you about this one :-) Clang currently does not have the -Wunused-but-set-variable warning; it is apparently available in the static analyzer. On the other hand, that warning is one of the most annoying ones that newer gcc's have. :-) From owner-svn-src-head@FreeBSD.ORG Thu Mar 7 23:44:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 555279A3; Thu, 7 Mar 2013 23:44:36 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 46E1DB08; Thu, 7 Mar 2013 23:44:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r27NiaiB058394; Thu, 7 Mar 2013 23:44:36 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r27NiZGl058387; Thu, 7 Mar 2013 23:44:35 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201303072344.r27NiZGl058387@svn.freebsd.org> From: Olivier Houchard Date: Thu, 7 Mar 2013 23:44:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247975 - in head/usr.bin: . truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 23:44:36 -0000 Author: cognet Date: Thu Mar 7 23:44:35 2013 New Revision: 247975 URL: http://svnweb.freebsd.org/changeset/base/247975 Log: Add arm bits to truss. Added: head/usr.bin/truss/arm-fbsd.c (contents, props changed) Modified: head/usr.bin/Makefile.arm head/usr.bin/truss/extern.h head/usr.bin/truss/main.c Modified: head/usr.bin/Makefile.arm ============================================================================== --- head/usr.bin/Makefile.arm Thu Mar 7 23:44:02 2013 (r247974) +++ head/usr.bin/Makefile.arm Thu Mar 7 23:44:35 2013 (r247975) @@ -1,3 +1,2 @@ # $FreeBSD$ -SUBDIR:= ${SUBDIR:Ntruss} Added: head/usr.bin/truss/arm-fbsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/arm-fbsd.c Thu Mar 7 23:44:35 2013 (r247975) @@ -0,0 +1,369 @@ +/* + * Copyright 1997 Sean Eric Fagan + * + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Sean Eric Fagan + * 4. Neither the name of the author may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * 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/arm-specific system call handling. This is probably the most + * complex part of the entire truss program, although I've got lots of + * it handled relatively cleanly now. The system call names are generated + * automatically, thanks to /usr/src/sys/kern/syscalls.master. The + * names used for the various structures are confusing, I sadly admit. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "truss.h" +#include "syscall.h" +#include "extern.h" + +#include "syscalls.h" + + +static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]); + +/* + * This is what this particular file uses to keep track of a system call. + * It is probably not quite sufficient -- I can probably use the same + * structure for the various syscall personalities, and I also probably + * need to nest system calls (for signal handlers). + * + * 'struct syscall' describes the system call; it may be NULL, however, + * if we don't know about this particular system call yet. + */ +struct freebsd_syscall { + struct syscall *sc; + const char *name; + int number; + unsigned long *args; + int nargs; /* number of arguments -- *not* number of words! */ + char **s_args; /* the printable arguments */ +}; + +static struct freebsd_syscall * +alloc_fsc(void) +{ + + return (malloc(sizeof(struct freebsd_syscall))); +} + +/* Clear up and free parts of the fsc structure. */ +static void +free_fsc(struct freebsd_syscall *fsc) +{ + int i; + + free(fsc->args); + if (fsc->s_args) { + for (i = 0; i < fsc->nargs; i++) + free(fsc->s_args[i]); + free(fsc->s_args); + } + free(fsc); +} + +/* + * Called when a process has entered a system call. nargs is the + * number of words, not number of arguments (a necessary distinction + * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c + * is ever changed these functions need to keep up. + */ + +void +arm_syscall_entry(struct trussinfo *trussinfo, int nargs) +{ + struct ptrace_io_desc iorequest; + struct reg regs; + struct freebsd_syscall *fsc; + struct syscall *sc; + lwpid_t tid; + int i, syscall_num; + register_t *ap; + + tid = trussinfo->curthread->tid; + + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return; + } + ap = ®s.r[0]; + + /* + * FreeBSD has two special kinds of system call redirctions -- + * SYS_syscall, and SYS___syscall. The former is the old syscall() + * routine, basically; the latter is for quad-aligned arguments. + */ +#ifdef __ARM_EABI__ + syscall_num = regs.r[7]; +#else + if ((syscall_num = ptrace(PT_READ_I, tid, + (caddr_t)(regs.r[_REG_PC] - INSN_SIZE), 0)) == -1) { + fprintf(trussinfo->outfile, "-- CANNOT READ PC --\n"); + return; + } + syscall_num = syscall_num & 0x000fffff; +#endif + switch (syscall_num) { + case SYS_syscall: + syscall_num = *ap++; + nargs--; + break; + case SYS___syscall: + syscall_num = ap[_QUAD_LOWWORD]; + ap += 2; + nargs -= 2; + break; + } + + fsc = alloc_fsc(); + if (fsc == NULL) + return; + fsc->number = syscall_num; + fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? + NULL : syscallnames[syscall_num]; + if (!fsc->name) { + fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", + syscall_num); + } + + if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && + (strcmp(fsc->name, "fork") == 0 || + strcmp(fsc->name, "rfork") == 0 || + strcmp(fsc->name, "vfork") == 0)) + trussinfo->curthread->in_fork = 1; + + if (nargs == 0) + return; + + fsc->args = malloc((1 + nargs) * sizeof(unsigned long)); + switch (nargs) { + default: + /* + * The OS doesn't seem to allow more than 10 words of + * parameters (yay!). So we shouldn't be here. + */ + warn("More than 10 words (%d) of arguments!\n", nargs); + break; + case 10: + case 9: + case 8: + case 7: + case 6: + case 5: + /* + * If there are 7-10 words of arguments, they are placed + * on the stack, as is normal for other processors. + * The fall-through for all of these is deliberate!!! + */ + // XXX BAD constant used here + iorequest.piod_op = PIOD_READ_D; + iorequest.piod_offs = (void *)(regs.r[_REG_SP] + + 4 * sizeof(uint32_t)); + iorequest.piod_addr = &fsc->args[4]; + iorequest.piod_len = (nargs - 4) * sizeof(fsc->args[0]); + ptrace(PT_IO, tid, (caddr_t)&iorequest, 0); + if (iorequest.piod_len == 0) + return; + case 4: fsc->args[3] = ap[3]; + case 3: fsc->args[2] = ap[2]; + case 2: fsc->args[1] = ap[1]; + case 1: fsc->args[0] = ap[0]; + case 0: break; + } + + sc = NULL; + if (fsc->name) + sc = get_syscall(fsc->name); + if (sc) + fsc->nargs = sc->nargs; + else { +#if DEBUG + fprintf(trussinfo->outfile, "unknown syscall %s -- setting " + "args to %d\n", fsc->name, nargs); +#endif + fsc->nargs = nargs; + } + + fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); + fsc->sc = sc; + + /* + * At this point, we set up the system call arguments. + * We ignore any OUT ones, however -- those are arguments that + * are set by the system call, and so are probably meaningless + * now. This doesn't currently support arguments that are + * passed in *and* out, however. + */ + + if (fsc->name) { +#if DEBUG + fprintf(stderr, "syscall %s(", fsc->name); +#endif + for (i = 0; i < fsc->nargs; i++) { +#if DEBUG + fprintf(stderr, "0x%x%s", sc ? + fsc->args[sc->args[i].offset] : fsc->args[i], + i < (fsc->nargs - 1) ? "," : ""); +#endif + if (sc && !(sc->args[i].type & OUT)) { + fsc->s_args[i] = print_arg(&sc->args[i], + fsc->args, 0, trussinfo); + } + } +#if DEBUG + fprintf(stderr, ")\n"); +#endif + } + +#if DEBUG + fprintf(trussinfo->outfile, "\n"); +#endif + + if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 || + strcmp(fsc->name, "exit") == 0)) { + /* + * XXX + * This could be done in a more general + * manner but it still wouldn't be very pretty. + */ + if (strcmp(fsc->name, "execve") == 0) { + if ((trussinfo->flags & EXECVEARGS) == 0) { + if (fsc->s_args[1]) { + free(fsc->s_args[1]); + fsc->s_args[1] = NULL; + } + } + if ((trussinfo->flags & EXECVEENVS) == 0) { + if (fsc->s_args[2]) { + free(fsc->s_args[2]); + fsc->s_args[2] = NULL; + } + } + } + } + trussinfo->curthread->fsc = fsc; +} + +/* + * And when the system call is done, we handle it here. + * Currently, no attempt is made to ensure that the system calls + * match -- this needs to be fixed (and is, in fact, why S_SCX includes + * the system call number instead of, say, an error status). + */ + +long +arm_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +{ + struct reg regs; + struct freebsd_syscall *fsc; + struct syscall *sc; + lwpid_t tid; + long retval; + int errorp, i; + + if (trussinfo->curthread->fsc == NULL) + return (-1); + + tid = trussinfo->curthread->tid; + + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + retval = regs.r[0]; + errorp = !!(regs.r_cpsr & PSR_C_bit); + + /* + * This code, while simpler than the initial versions I used, could + * stand some significant cleaning. + */ + + fsc = trussinfo->curthread->fsc; + sc = fsc->sc; + if (!sc) { + for (i = 0; i < fsc->nargs; i++) + asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); + } else { + /* + * Here, we only look for arguments that have OUT masked in -- + * otherwise, they were handled in the syscall_entry function. + */ + for (i = 0; i < sc->nargs; i++) { + char *temp; + if (sc->args[i].type & OUT) { + /* + * If an error occurred, then don't bother + * getting the data; it may not be valid. + */ + if (errorp) { + asprintf(&temp, "0x%lx", + fsc->args[sc->args[i].offset]); + } else { + temp = print_arg(&sc->args[i], + fsc->args, retval, trussinfo); + } + fsc->s_args[i] = temp; + } + } + } + + if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 || + strcmp(fsc->name, "exit") == 0)) + trussinfo->curthread->in_syscall = 1; + + /* + * It would probably be a good idea to merge the error handling, + * but that complicates things considerably. + */ + + print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, + retval, fsc->sc); + free_fsc(fsc); + + return (retval); +} Modified: head/usr.bin/truss/extern.h ============================================================================== --- head/usr.bin/truss/extern.h Thu Mar 7 23:44:02 2013 (r247974) +++ head/usr.bin/truss/extern.h Thu Mar 7 23:44:35 2013 (r247975) @@ -37,6 +37,10 @@ extern void restore_proc(int); extern void waitevent(struct trussinfo *); extern const char *ioctlname(unsigned long val); extern char *strsig(int sig); +#ifdef __arm__ +extern void arm_syscall_entry(struct trussinfo *, int); +extern long arm_syscall_exit(struct trussinfo *, int); +#endif #ifdef __amd64__ extern void amd64_syscall_entry(struct trussinfo *, int); extern long amd64_syscall_exit(struct trussinfo *, int); Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Thu Mar 7 23:44:02 2013 (r247974) +++ head/usr.bin/truss/main.c Thu Mar 7 23:44:35 2013 (r247975) @@ -79,6 +79,9 @@ static struct ex_types { void (*enter_syscall)(struct trussinfo *, int); long (*exit_syscall)(struct trussinfo *, int); } ex_types[] = { +#ifdef __arm__ + { "FreeBSD ELF32", arm_syscall_entry, arm_syscall_exit }, +#endif #ifdef __amd64__ { "FreeBSD ELF64", amd64_syscall_entry, amd64_syscall_exit }, { "FreeBSD ELF32", amd64_fbsd32_syscall_entry, amd64_fbsd32_syscall_exit }, From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 00:18:12 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A784E8A4; Fri, 8 Mar 2013 00:18:12 +0000 (UTC) (envelope-from john@jnielsen.net) Received: from ns1.jnielsen.net (secure.freebsdsolutions.net [69.55.234.48]) by mx1.freebsd.org (Postfix) with ESMTP id 8AECDD06; Fri, 8 Mar 2013 00:18:12 +0000 (UTC) Received: from [192.168.2.93] (c-67-182-217-170.hsd1.ut.comcast.net [67.182.217.170]) (authenticated bits=0) by ns1.jnielsen.net (8.14.4/8.14.4) with ESMTP id r27NqU2R063968 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 7 Mar 2013 18:52:31 -0500 (EST) (envelope-from john@jnielsen.net) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: svn commit: r247904 - head/crypto/openssh From: John Nielsen In-Reply-To: <86txonqvbe.fsf@ds4.des.no> Date: Thu, 7 Mar 2013 16:52:26 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201303062322.r26NMebp009010@svn.freebsd.org> <20130307022835.GA1496@glenbarber.us> <51386C23.2020600@FreeBSD.org> <86txonqvbe.fsf@ds4.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1499) X-DCC-sonic.net-Metrics: ns1.jnielsen.net 1117; Body=7 Fuz1=7 Fuz2=7 X-Virus-Scanned: clamav-milter 0.97.5 at ns1.jnielsen.net X-Virus-Status: Clean Cc: src-committers@freebsd.org, Sean Bruno , svn-src-all@freebsd.org, Dimitry Andric , Glen Barber , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 00:18:12 -0000 On Mar 7, 2013, at 4:54 AM, Dag-Erling Sm=F8rgrav wrote: > Dimitry Andric writes: >> Glen Barber writes: >>> This commit now causes ssh(1) to dump core. >> Indeed, it will be the same problem that was reported many times on >> ports@; our strnvis() is not compatible with OpenBSD's strnvis(). :( >=20 > Thank you, and my apologies for the string of f*ups. I am currently > testing a patch based on Dimitry's and Sean's suggestions. >=20 > I've been working like a dog on OpenPAM and OpenSSH the last couple of > weeks and made a few too many assumptions... Thanks DES. As another data point, I did basically the same thing as = Sean yesterday before you committed r247904--undefined HAVE_STRNVIS. = Working fine, but I don't know what all that change affects. FreeBSD 10.0-CURRENT (STEALTH) #0 r247897M: Wed Mar 6 15:05:54 MST 2013 JN From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 01:45:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F3206107 for ; Fri, 8 Mar 2013 01:45:52 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-we0-x235.google.com (mail-we0-x235.google.com [IPv6:2a00:1450:400c:c03::235]) by mx1.freebsd.org (Postfix) with ESMTP id 8DB97FE0 for ; Fri, 8 Mar 2013 01:45:52 +0000 (UTC) Received: by mail-we0-f181.google.com with SMTP id t44so399353wey.26 for ; Thu, 07 Mar 2013 17:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=HhY+Vg9FV2a9+kG0TIfXjg2JifwJz4uNyArS21BjVrw=; b=kxB7C9hfC/ij3iPRopSVirbc46K0I6FWX4htUCK9G5TE+wD4tUH+/8po0800b7xbAE T9xbgpmaNkUvyl8nCsLe7HaEAINaxAp5IINALbg0Ebe6yo67t3QQJptByO9Lya6cbjKu utTVcTtALfINMcEf9J0f/9rmxT6Xninv9ymjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:x-gm-message-state; bh=HhY+Vg9FV2a9+kG0TIfXjg2JifwJz4uNyArS21BjVrw=; b=HjzDe+fG97eXln+DiHyurVhOFuv+X0z6RbS8VbcNKGFJQ4YN7RIJIx5AACyq+DeWTN 9FNslZuL62AjLIaPdIhkKKpnwDmky6GQ/bMRyBc8rPApxNDbEZKusCMhdwMrJoxrR/jK KkroGmHsKN5/abzIT2J/LmddZGrkGcA7Be25qibI1F2z5Hv9NRt5XvtFmtJ2UjzdVoN/ O0A9Fv9WgqZVq8aTtF6SREmug+v28q3YCmVSP1zBMaa6HGPlhkWzvEe5WtGYdprl3h7x qWlYCkhd+FyAmt4t+6GPYBrtrJpSkSNRq2Tq88Z+bxyCcW4j08ubq30/39rcqdkERaYV nXeQ== X-Received: by 10.194.89.169 with SMTP id bp9mr552853wjb.57.1362707150899; Thu, 07 Mar 2013 17:45:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.179.194 with HTTP; Thu, 7 Mar 2013 17:45:20 -0800 (PST) In-Reply-To: <51391C1E.5030905@FreeBSD.org> References: <201303072216.r27MGZ1b031061@svn.freebsd.org> <513914C4.4010001@FreeBSD.org> <51391C1E.5030905@FreeBSD.org> From: Eitan Adler Date: Thu, 7 Mar 2013 20:45:20 -0500 Message-ID: Subject: Re: svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt To: Dimitry Andric Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmQk2J4WhUz0YNWkg4fFSgOP8+BpXy5KuBF3WZQjyRfyf+gCbEF9daFiyM/b1Ci59JSwcpc Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 01:45:53 -0000 On 7 March 2013 18:00, Dimitry Andric wrote: > On 2013-03-07 23:29, Andriy Gapon wrote: > ... > >> I was not really kidding when I said that this change, as is, is a nop: > > ... > >>> + bname = strrchr(match.iim_name, '/'); >>> + bname = bname == NULL ? match.iim_name : bname + >>> 1; >> >> >> It would probably make sense to make use of bname after going to through >> all the >> trouble of calculating it: >> >>> match.iim_file = match.iim_name; >> >> >> Should be match.iim_file = bname ? > > > Yes, I actually had this in my test code, and committed the wrong diff > by accident. :( Fixed in r247962, in any case. > > > >> Surprised that clang hasn't warned you about this one :-) > > > Clang currently does not have the -Wunused-but-set-variable warning; it > is apparently available in the static analyzer. On the other hand, that > warning is one of the most annoying ones that newer gcc's have. :-) I have found real bugs in FreeBSD's code base as a result of this warning, but the vast majority were more annoying than useful. -- Eitan Adler From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 02:00:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id ABD526BE; Fri, 8 Mar 2013 02:00:50 +0000 (UTC) Date: Fri, 8 Mar 2013 02:00:50 +0000 From: Alexey Dokuchaev To: Gleb Smirnoff Subject: Re: svn commit: r247910 - head/sys/dev/sound/pci/hda Message-ID: <20130308020050.GC83162@FreeBSD.org> References: <201303070754.r277soET065603@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201303070754.r277soET065603@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 02:00:50 -0000 On Thu, Mar 07, 2013 at 07:54:50AM +0000, Gleb Smirnoff wrote: > New Revision: 247910 > URL: http://svnweb.freebsd.org/changeset/base/247910 > > Log: > Plug a memory leak. > > Reviewed by: mav > Sponsored by: Nginx, Inc. Any MFCs planned? ./danfe From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 03:29:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9BDB093F; Fri, 8 Mar 2013 03:29:06 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7032A3E8; Fri, 8 Mar 2013 03:29:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r283T6gT030669; Fri, 8 Mar 2013 03:29:06 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r283T6i4030668; Fri, 8 Mar 2013 03:29:06 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201303080329.r283T6i4030668@svn.freebsd.org> From: Tim Kientzle Date: Fri, 8 Mar 2013 03:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248028 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 03:29:06 -0000 Author: kientzle Date: Fri Mar 8 03:29:05 2013 New Revision: 248028 URL: http://svnweb.freebsd.org/changeset/base/248028 Log: This file is specific to arm11x6 processors, so tell the assembler it's okay to use arm11x6 instructions. Modified: head/sys/arm/arm/cpufunc_asm_arm11x6.S Modified: head/sys/arm/arm/cpufunc_asm_arm11x6.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm11x6.S Fri Mar 8 02:40:07 2013 (r248027) +++ head/sys/arm/arm/cpufunc_asm_arm11x6.S Fri Mar 8 03:29:05 2013 (r248028) @@ -62,6 +62,8 @@ #include __FBSDID("$FreeBSD$"); + .cpu arm1136js + #if 0 #define Invalidate_I_cache(Rtmp1, Rtmp2) \ mcr p15, 0, Rtmp1, c7, c5, 0 /* Invalidate Entire I cache */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 10:14:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8F2EABD; Fri, 8 Mar 2013 10:14:59 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7CEFE7DC; Fri, 8 Mar 2013 10:14:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28AExcs053199; Fri, 8 Mar 2013 10:14:59 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28AEwet053196; Fri, 8 Mar 2013 10:14:58 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303081014.r28AEwet053196@svn.freebsd.org> From: Andre Oppermann Date: Fri, 8 Mar 2013 10:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248031 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 10:14:59 -0000 Author: andre Date: Fri Mar 8 10:14:58 2013 New Revision: 248031 URL: http://svnweb.freebsd.org/changeset/base/248031 Log: Move the auto-sizing of the callout array from init_param2() to kern_timeout_callwheel_alloc() where it is actually used. This is a mechanical move and no tuning parameters are changed. The pre-allocated callout array is only used for legacy timeout(9) calls and is only allocated and active on cpu0. Eventually all remaining users of timeout(9) should switch to the callout_* API. Reviewed by: davide Modified: head/sys/kern/kern_timeout.c head/sys/kern/subr_param.c head/sys/sys/callout.h Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Fri Mar 8 08:19:50 2013 (r248030) +++ head/sys/kern/kern_timeout.c Fri Mar 8 10:14:58 2013 (r248031) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -101,6 +102,11 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_mpca 0, "Average number of MP direct callouts made per callout_process call. " "Units = 1/1000"); #endif + +static int ncallout; +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, + "Number of entries in callwheel and size of timeout() preallocation"); + /* * TODO: * allocate more timeout table slots when table overflows. @@ -252,6 +258,14 @@ kern_timeout_callwheel_alloc(caddr_t v) timeout_cpu = PCPU_GET(cpuid); cc = CC_CPU(timeout_cpu); + + /* + * Calculate the size of the callout wheel and the preallocated + * timeout() structures. + */ + ncallout = imin(16 + maxproc + maxfiles, 18508); + TUNABLE_INT_FETCH("kern.ncallout", &ncallout); + /* * Calculate callout wheel size, should be next power of two higher * than 'ncallout'. Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Fri Mar 8 08:19:50 2013 (r248030) +++ head/sys/kern/subr_param.c Fri Mar 8 10:14:58 2013 (r248031) @@ -91,7 +91,6 @@ int maxprocperuid; /* max # of procs p int maxfiles; /* sys. wide open files limit */ int maxfilesperproc; /* per-proc open files limit */ int msgbufsize; /* size of kernel message buffer */ -int ncallout; /* maximum # of timer events */ int nbuf; int ngroups_max; /* max # groups per process */ int nswbuf; @@ -109,8 +108,6 @@ u_long sgrowsiz; /* amount to grow sta SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, "Number of clock ticks per second"); -SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, - "Number of pre-allocated timer events"); SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0, "Number of buffers in the buffer cache"); SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, @@ -327,15 +324,6 @@ init_param2(long physpages) TUNABLE_INT_FETCH("kern.nbuf", &nbuf); /* - * XXX: Does the callout wheel have to be so big? - * - * Clip callout to result of previous function of maxusers maximum - * 384. This is still huge, but acceptable. - */ - ncallout = imin(16 + maxproc + maxfiles, 18508); - TUNABLE_INT_FETCH("kern.ncallout", &ncallout); - - /* * The default for maxpipekva is min(1/64 of the kernel address space, * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. */ Modified: head/sys/sys/callout.h ============================================================================== --- head/sys/sys/callout.h Fri Mar 8 08:19:50 2013 (r248030) +++ head/sys/sys/callout.h Fri Mar 8 10:14:58 2013 (r248031) @@ -63,8 +63,6 @@ struct callout_handle { }; #ifdef _KERNEL -extern int ncallout; - #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) #define callout_drain(c) _callout_stop_safe(c, 1) From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 10:37:18 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3A64051E; Fri, 8 Mar 2013 10:37:18 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1D2018A6; Fri, 8 Mar 2013 10:37:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28AbHXd059454; Fri, 8 Mar 2013 10:37:17 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28AbHff059451; Fri, 8 Mar 2013 10:37:17 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201303081037.r28AbHff059451@svn.freebsd.org> From: Andre Oppermann Date: Fri, 8 Mar 2013 10:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248032 - in head/sys: kern sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 10:37:18 -0000 Author: andre Date: Fri Mar 8 10:37:17 2013 New Revision: 248032 URL: http://svnweb.freebsd.org/changeset/base/248032 Log: Move the callout subsystem initialization to its own SYSINIT() from being indirectly called via cpu_startup()+vm_ksubmap_init(). The boot order position remains the same at SI_SUB_CPU. Allocation of the callout array is changed to stardard kernel malloc from a slightly obscure direct kernel_map allocation. kern_timeout_callwheel_alloc() is renamed to callout_callwheel_init() to better describe its purpose. kern_timeout_callwheel_init() is removed simplifying the per-cpu initialization. Reviewed by: davide Modified: head/sys/kern/kern_timeout.c head/sys/sys/systm.h head/sys/vm/vm_init.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Fri Mar 8 10:14:58 2013 (r248031) +++ head/sys/kern/kern_timeout.c Fri Mar 8 10:37:17 2013 (r248032) @@ -187,6 +187,7 @@ struct callout_cpu cc_cpu; static int timeout_cpu; +static void callout_cpu_init(struct callout_cpu *cc); static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, #ifdef CALLOUT_PROFILING int *mpcalls, int *lockcalls, int *gcalls, @@ -246,19 +247,14 @@ cc_cce_migrating(struct callout_cpu *cc, } /* - * kern_timeout_callwheel_alloc() - kernel low level callwheel initialization - * - * This code is called very early in the kernel initialization sequence, - * and may be called more then once. + * Kernel low level callwheel initialization + * called on cpu0 during kernel startup. */ -caddr_t -kern_timeout_callwheel_alloc(caddr_t v) +static void +callout_callwheel_init(void *dummy) { struct callout_cpu *cc; - timeout_cpu = PCPU_GET(cpuid); - cc = CC_CPU(timeout_cpu); - /* * Calculate the size of the callout wheel and the preallocated * timeout() structures. @@ -273,13 +269,23 @@ kern_timeout_callwheel_alloc(caddr_t v) callwheelsize = 1 << fls(ncallout); callwheelmask = callwheelsize - 1; - cc->cc_callout = (struct callout *)v; - v = (caddr_t)(cc->cc_callout + ncallout); - cc->cc_callwheel = (struct callout_list *)v; - v = (caddr_t)(cc->cc_callwheel + callwheelsize); - return(v); + /* + * Only cpu0 handles timeout(9) and receives a preallocation. + * + * XXX: Once all timeout(9) consumers are converted this can + * be removed. + */ + timeout_cpu = PCPU_GET(cpuid); + cc = CC_CPU(timeout_cpu); + cc->cc_callout = malloc(ncallout * sizeof(struct callout), + M_CALLOUT, M_WAITOK); + callout_cpu_init(cc); } +SYSINIT(callwheel_init, SI_SUB_CPU, SI_ORDER_ANY, callout_callwheel_init, NULL); +/* + * Initialize the per-cpu callout structures. + */ static void callout_cpu_init(struct callout_cpu *cc) { @@ -288,13 +294,15 @@ callout_cpu_init(struct callout_cpu *cc) mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); + cc->cc_callwheel = malloc(sizeof(struct callout_tailq) * callwheelsize, + M_CALLOUT, M_WAITOK); for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); TAILQ_INIT(&cc->cc_expireq); cc->cc_firstevent = INT64_MAX; for (i = 0; i < 2; i++) cc_cce_cleanup(cc, i); - if (cc->cc_callout == NULL) + if (cc->cc_callout == NULL) /* Only cpu0 handles timeout(9) */ return; for (i = 0; i < ncallout; i++) { c = &cc->cc_callout[i]; @@ -335,19 +343,6 @@ callout_cpu_switch(struct callout *c, st #endif /* - * kern_timeout_callwheel_init() - initialize previously reserved callwheel - * space. - * - * This code is called just once, after the space reserved for the - * callout wheel has been finalized. - */ -void -kern_timeout_callwheel_init(void) -{ - callout_cpu_init(CC_CPU(timeout_cpu)); -} - -/* * Start standard softclock thread. */ static void @@ -367,18 +362,14 @@ start_softclock(void *dummy) if (cpu == timeout_cpu) continue; cc = CC_CPU(cpu); + cc->cc_callout = NULL; /* Only cpu0 handles timeout(9). */ + callout_cpu_init(cc); if (swi_add(NULL, "clock", softclock, cc, SWI_CLOCK, INTR_MPSAFE, &cc->cc_cookie)) panic("died while creating standard software ithreads"); - cc->cc_callout = NULL; /* Only cpu0 handles timeout(). */ - cc->cc_callwheel = malloc( - sizeof(struct callout_list) * callwheelsize, M_CALLOUT, - M_WAITOK); - callout_cpu_init(cc); } #endif } - SYSINIT(start_softclock, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softclock, NULL); #define CC_HASH_SHIFT 8 Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Mar 8 10:14:58 2013 (r248031) +++ head/sys/sys/systm.h Fri Mar 8 10:37:17 2013 (r248032) @@ -321,8 +321,6 @@ typedef void timeout_t(void *); /* timeo void callout_handle_init(struct callout_handle *); struct callout_handle timeout(timeout_t *, void *, int); void untimeout(timeout_t *, void *, struct callout_handle); -caddr_t kern_timeout_callwheel_alloc(caddr_t v); -void kern_timeout_callwheel_init(void); /* Stubs for obsolete functions that used to be for interrupt management */ static __inline intrmask_t splbio(void) { return 0; } Modified: head/sys/vm/vm_init.c ============================================================================== --- head/sys/vm/vm_init.c Fri Mar 8 10:14:58 2013 (r248031) +++ head/sys/vm/vm_init.c Fri Mar 8 10:37:17 2013 (r248032) @@ -157,8 +157,6 @@ vm_ksubmap_init(struct kva_md_info *kmi) again: v = (caddr_t)firstaddr; - v = kern_timeout_callwheel_alloc(v); - /* * Discount the physical memory larger than the size of kernel_map * to avoid eating up all of KVA space. @@ -202,10 +200,5 @@ again: * XXX: Mbuf system machine-specific initializations should * go here, if anywhere. */ - - /* - * Initialize the callouts we just allocated. - */ - kern_timeout_callwheel_init(); } From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 10:43:04 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 345AD701; Fri, 8 Mar 2013 10:43:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0EA548D8; Fri, 8 Mar 2013 10:43:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28Ah3Gd061801; Fri, 8 Mar 2013 10:43:03 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28Ah363061800; Fri, 8 Mar 2013 10:43:03 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201303081043.r28Ah363061800@svn.freebsd.org> From: Baptiste Daroussin Date: Fri, 8 Mar 2013 10:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248033 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 10:43:04 -0000 Author: bapt Date: Fri Mar 8 10:43:03 2013 New Revision: 248033 URL: http://svnweb.freebsd.org/changeset/base/248033 Log: Fix bootstrapping pkgng by not appending "/latest/" to PACKAGESITE. Reporter by : Alexander Yerenkow (via irc) Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Fri Mar 8 10:37:17 2013 (r248032) +++ head/usr.sbin/pkg/pkg.c Fri Mar 8 10:43:03 2013 (r248033) @@ -167,7 +167,7 @@ bootstrap_pkg(void) warnx("No MIRROR_TYPE defined"); return (-1); } - snprintf(url, MAXPATHLEN, "%s/latest/Latest/pkg.txz", packagesite); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 13:11:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6920C81C; Fri, 8 Mar 2013 13:11:46 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5B961FD9; Fri, 8 Mar 2013 13:11:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28DBkkR016523; Fri, 8 Mar 2013 13:11:46 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28DBjdH016521; Fri, 8 Mar 2013 13:11:45 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201303081311.r28DBjdH016521@svn.freebsd.org> From: Marius Strobl Date: Fri, 8 Mar 2013 13:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248055 - in head: . sys/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 13:11:46 -0000 Author: marius Date: Fri Mar 8 13:11:45 2013 New Revision: 248055 URL: http://svnweb.freebsd.org/changeset/base/248055 Log: Merge r247814 from x86 modulo whitespace bug: Turn on the CTL disable tunable by default. This will allow GENERIC configurations to boot on small memory boxes, but not require end users who want to use CTL to recompile their kernel. They can simply set kern.cam.ctl.disable=0 in loader.conf. Modified: head/UPDATING head/sys/sparc64/conf/GENERIC Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Mar 8 12:59:06 2013 (r248054) +++ head/UPDATING Fri Mar 8 13:11:45 2013 (r248055) @@ -26,6 +26,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130308: + CTL_DISABLE has also been added to the sparc64 GENERIC (for further + information, see the respective 20130304 entry). + 20130304: Recent commits to callout(9) changed the size of struct callout, so the KBI is probably heavily disturbed. Also, some functions Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Fri Mar 8 12:59:06 2013 (r248054) +++ head/sys/sparc64/conf/GENERIC Fri Mar 8 13:11:45 2013 (r248055) @@ -122,6 +122,9 @@ device cd # CD device pass # Passthrough device (direct ATA/SCSI access) device ses # Enclosure Services (SES and SAF-TE) device ctl # CAM Target Layer +options CTL_DISABLE # Disable CTL by default to save memory. + # Re-enable with kern.cam.ctl.disable=0 in + # /boot/loader.conf # RAID controllers #device amr # AMI MegaRAID From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:07:44 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5767639C; Fri, 8 Mar 2013 18:07:44 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3F579ABF; Fri, 8 Mar 2013 18:07:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28I7iBG006738; Fri, 8 Mar 2013 18:07:44 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28I7id2006737; Fri, 8 Mar 2013 18:07:44 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303081807.r28I7id2006737@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Fri, 8 Mar 2013 18:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248058 - head/sys/geom/label X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:07:44 -0000 Author: dumbbell Date: Fri Mar 8 18:07:43 2013 New Revision: 248058 URL: http://svnweb.freebsd.org/changeset/base/248058 Log: g_label_ntfs_taste: Abort taste is recsize == 0 This will avoid a 0-byte read (in g_read_data()) leading to a panic, if previously read data are erroneous. Suggested by: John-Mark Gurney Modified: head/sys/geom/label/g_label_ntfs.c Modified: head/sys/geom/label/g_label_ntfs.c ============================================================================== --- head/sys/geom/label/g_label_ntfs.c Fri Mar 8 17:28:40 2013 (r248057) +++ head/sys/geom/label/g_label_ntfs.c Fri Mar 8 18:07:43 2013 (r248058) @@ -115,7 +115,7 @@ g_label_ntfs_taste(struct g_consumer *cp mftrecsz = (char)bf->bf_mftrecsz; recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz); - if (recsize % pp->sectorsize != 0) + if (recsize == 0 || recsize % pp->sectorsize != 0) goto done; voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps + From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:08:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B8B4A522; Fri, 8 Mar 2013 18:08:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AB79FAD0; Fri, 8 Mar 2013 18:08:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28I8D1D006877; Fri, 8 Mar 2013 18:08:13 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28I8D9H006872; Fri, 8 Mar 2013 18:08:13 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201303081808.r28I8D9H006872@svn.freebsd.org> From: Xin LI Date: Fri, 8 Mar 2013 18:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248059 - head/sys/dev/oce X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:08:13 -0000 Author: delphij Date: Fri Mar 8 18:08:12 2013 New Revision: 248059 URL: http://svnweb.freebsd.org/changeset/base/248059 Log: Eliminate excessive $FreeBSD$ headers. Noticed by: jmallett Modified: head/sys/dev/oce/oce_hw.h head/sys/dev/oce/oce_sysctl.c Modified: head/sys/dev/oce/oce_hw.h ============================================================================== --- head/sys/dev/oce/oce_hw.h Fri Mar 8 18:07:43 2013 (r248058) +++ head/sys/dev/oce/oce_hw.h Fri Mar 8 18:08:12 2013 (r248059) @@ -38,8 +38,6 @@ /* $FreeBSD$ */ -/* $FreeBSD$ */ - #include #undef _BIG_ENDIAN /* TODO */ Modified: head/sys/dev/oce/oce_sysctl.c ============================================================================== --- head/sys/dev/oce/oce_sysctl.c Fri Mar 8 18:07:43 2013 (r248058) +++ head/sys/dev/oce/oce_sysctl.c Fri Mar 8 18:08:12 2013 (r248059) @@ -38,8 +38,6 @@ /* $FreeBSD$ */ -/* $FreeBSD$ */ - #include "oce_if.h" From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:11:03 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 684D875C; Fri, 8 Mar 2013 18:11:03 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5AC89B33; Fri, 8 Mar 2013 18:11:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28IB3J2009021; Fri, 8 Mar 2013 18:11:03 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28IB2JI009017; Fri, 8 Mar 2013 18:11:02 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303081811.r28IB2JI009017@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Fri, 8 Mar 2013 18:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248060 - in head/sys/dev/drm2: . ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:11:03 -0000 Author: dumbbell Date: Fri Mar 8 18:11:02 2013 New Revision: 248060 URL: http://svnweb.freebsd.org/changeset/base/248060 Log: drm: Fix a call to free(9) with an incorrect malloc type While here, the call to free(9) is moved to drm_global.c, near the initial malloc(9). Reviewed by: Konstantin Belousov (kib@) Modified: head/sys/dev/drm2/drm_global.c head/sys/dev/drm2/ttm/ttm_bo.c head/sys/dev/drm2/ttm/ttm_memory.c Modified: head/sys/dev/drm2/drm_global.c ============================================================================== --- head/sys/dev/drm2/drm_global.c Fri Mar 8 18:08:12 2013 (r248059) +++ head/sys/dev/drm2/drm_global.c Fri Mar 8 18:11:02 2013 (r248060) @@ -104,6 +104,7 @@ void drm_global_item_unref(struct drm_gl MPASS(ref->object == item->object); if (--item->refcount == 0) { ref->release(ref); + free(item->object, M_DRM_GLOBAL); item->object = NULL; } sx_xunlock(&item->mutex); Modified: head/sys/dev/drm2/ttm/ttm_bo.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo.c Fri Mar 8 18:08:12 2013 (r248059) +++ head/sys/dev/drm2/ttm/ttm_bo.c Fri Mar 8 18:11:02 2013 (r248060) @@ -1400,7 +1400,6 @@ static void ttm_bo_global_kobj_release(s ttm_mem_unregister_shrink(glob->mem_glob, &glob->shrink); vm_page_free(glob->dummy_read_page); - free(glob, M_DRM_GLOBAL); } void ttm_bo_global_release(struct drm_global_reference *ref) Modified: head/sys/dev/drm2/ttm/ttm_memory.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_memory.c Fri Mar 8 18:08:12 2013 (r248059) +++ head/sys/dev/drm2/ttm/ttm_memory.c Fri Mar 8 18:11:02 2013 (r248060) @@ -125,8 +125,6 @@ static ssize_t ttm_mem_zone_store(struct static void ttm_mem_global_kobj_release(struct ttm_mem_global *glob) { - - free(glob, M_TTM_ZONE); } static bool ttm_zones_above_swap_target(struct ttm_mem_global *glob, From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:14:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id EE2ACA52 for ; Fri, 8 Mar 2013 18:14:51 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-ob0-x22e.google.com (mail-ob0-x22e.google.com [IPv6:2607:f8b0:4003:c01::22e]) by mx1.freebsd.org (Postfix) with ESMTP id B654BBEA for ; Fri, 8 Mar 2013 18:14:51 +0000 (UTC) Received: by mail-ob0-f174.google.com with SMTP id 16so1527995obc.5 for ; Fri, 08 Mar 2013 10:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=TjCuDfxHyrg03Jk28/ieQzvJh8LUmDfPaRlTWaxsiwo=; b=qGCSYGO36r5Pxxc8Iy2rCzUQ8Xb45s6mjgppgxf1Zi1Nh5cayFzP9JNQ8TjXzGKCp9 IgAyQhD1HXq/35erytU6vIij8Pa1/++uyo/cjxYNsquH4JSO6hGx4cl5DsdEAYC8ZBYa txuyxgxwbuOY59Op8ftd9fPh/qq+y+DsGvZVs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=TjCuDfxHyrg03Jk28/ieQzvJh8LUmDfPaRlTWaxsiwo=; b=YZujZzG3vkZXg8sioJgXVhco7GJif9TYh3aLvjlvh1k6yz7bHG6I5KhMjrYAhQ4kFm ZKNOIfd8/mCYjxoeOgWrdzF7TG5FEqQeNBjjD6Dgau3tvFdOrSguzeG2I5DLTMtLXnsc NmDodwbWX3e5zd4CzQsm2dTwTWgCS6Evh8SL+8wO6gBcnaXBXrO7Ch52iyuTEvwReazx h8YuKxFIOAtq8aU6ygb8GTqvXAs78w1/3A53d+F0NScJwDTpV3BN0M5vDT5MM8PwzJEJ Z1c94HZ77u8dPNIL27SHGufreIIH2xT0mjNQjixkgyB9wB5qm9OXFSedcg/ZsOJYThEQ tPQQ== X-Received: by 10.60.31.170 with SMTP id b10mr2519201oei.34.1362766491171; Fri, 08 Mar 2013 10:14:51 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.60.26.74 with HTTP; Fri, 8 Mar 2013 10:14:21 -0800 (PST) In-Reply-To: <201303081811.r28IB2JI009017@svn.freebsd.org> References: <201303081811.r28IB2JI009017@svn.freebsd.org> From: Eitan Adler Date: Fri, 8 Mar 2013 13:14:21 -0500 X-Google-Sender-Auth: 4HlVdUsnnvj024OPZA_w8CXi_l4 Message-ID: Subject: Re: svn commit: r248060 - in head/sys/dev/drm2: . ttm To: Jean-Sebastien Pedron Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQmmlSLpG2rvAIx9YykaUQtWLZI4dVTnXVD6mAUk3oilKxHCz13BMOPRmzgEi9IXcsAyeFbm Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:14:52 -0000 On 8 March 2013 13:11, Jean-Sebastien Pedron wrote: > @@ -125,8 +125,6 @@ static ssize_t ttm_mem_zone_store(struct > > static void ttm_mem_global_kobj_release(struct ttm_mem_global *glob) > { > - > - free(glob, M_TTM_ZONE); > } Can this function now be removed, because it appears to be empty? -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:15:08 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38CB7BC4; Fri, 8 Mar 2013 18:15:08 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2A7DDBF1; Fri, 8 Mar 2013 18:15:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28IF8le009804; Fri, 8 Mar 2013 18:15:08 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28IF8Cs009803; Fri, 8 Mar 2013 18:15:08 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201303081815.r28IF8Cs009803@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Fri, 8 Mar 2013 18:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248061 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:15:08 -0000 Author: dumbbell Date: Fri Mar 8 18:15:07 2013 New Revision: 248061 URL: http://svnweb.freebsd.org/changeset/base/248061 Log: Import Linux commit a1b7736dac5f2d5876e68c47a0fce3f423840070 Author: Sascha Hauer Date: Wed Feb 1 11:38:22 2012 +0100 drm drm_fb_helper: destroy modes drm_setup_crtcs allocated modes using drm_mode_duplicate. Free them in drm_fb_helper_crtc_free. Signed-off-by: Sascha Hauer Signed-off-by: Dave Airlie Discussed with: Konstantin Belousov (kib@) Modified: head/sys/dev/drm2/drm_fb_helper.c Modified: head/sys/dev/drm2/drm_fb_helper.c ============================================================================== --- head/sys/dev/drm2/drm_fb_helper.c Fri Mar 8 18:11:02 2013 (r248060) +++ head/sys/dev/drm2/drm_fb_helper.c Fri Mar 8 18:15:07 2013 (r248061) @@ -555,8 +555,11 @@ static void drm_fb_helper_crtc_free(stru for (i = 0; i < helper->connector_count; i++) free(helper->connector_info[i], DRM_MEM_KMS); free(helper->connector_info, DRM_MEM_KMS); - for (i = 0; i < helper->crtc_count; i++) + for (i = 0; i < helper->crtc_count; i++) { free(helper->crtc_info[i].mode_set.connectors, DRM_MEM_KMS); + if (helper->crtc_info[i].mode_set.mode) + drm_mode_destroy(helper->dev, helper->crtc_info[i].mode_set.mode); + } free(helper->crtc_info, DRM_MEM_KMS); } From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 18:17:38 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 81DA0D8B; Fri, 8 Mar 2013 18:17:38 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) by mx1.freebsd.org (Postfix) with ESMTP id 333D2C2C; Fri, 8 Mar 2013 18:17:37 +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 r28BYs8u029991; Fri, 8 Mar 2013 12:17:36 -0600 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp1.rice.edu with ESMTP id 1axwq1geg2-1; Fri, 08 Mar 2013 12:17:36 -0600 Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 80C205001AD; Fri, 8 Mar 2013 12:17:36 -0600 (CST) Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 7F4D1500110; Fri, 8 Mar 2013 12:17:36 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from mh2.mail.rice.edu ([127.0.0.1]) by mh2.mail.rice.edu (mh2.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id WugWxzyevXTX; Fri, 8 Mar 2013 12:17:36 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 052775001AB; Fri, 8 Mar 2013 12:17:35 -0600 (CST) Message-ID: <513A2B3E.2070804@rice.edu> Date: Fri, 08 Mar 2013 12:17:34 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r248031 - in head/sys: kern sys References: <201303081014.r28AEwet053196@svn.freebsd.org> In-Reply-To: <201303081014.r28AEwet053196@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5400 definitions=5800 signatures=585085 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=4 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1111160001 definitions=main-1101130121 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 18:17:38 -0000 On 03/08/2013 04:14, Andre Oppermann wrote: > Author: andre > Date: Fri Mar 8 10:14:58 2013 > New Revision: 248031 > URL: http://svnweb.freebsd.org/changeset/base/248031 > > Log: > Move the auto-sizing of the callout array from init_param2() to > kern_timeout_callwheel_alloc() where it is actually used. > > This is a mechanical move and no tuning parameters are changed. > > The pre-allocated callout array is only used for legacy timeout(9) > calls and is only allocated and active on cpu0. Eventually all > remaining users of timeout(9) should switch to the callout_* API. > In the meantime, until all legacy timeout(9) users are updated, I think that it would be wise to retain the comment that describes where the magic number 18508 comes from. Regards, Alan > Reviewed by: davide > > Modified: > head/sys/kern/kern_timeout.c > head/sys/kern/subr_param.c > head/sys/sys/callout.h > > Modified: head/sys/kern/kern_timeout.c > ============================================================================== > --- head/sys/kern/kern_timeout.c Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/kern/kern_timeout.c Fri Mar 8 10:14:58 2013 (r248031) > @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > #include > @@ -101,6 +102,11 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_mpca > 0, "Average number of MP direct callouts made per callout_process call. " > "Units = 1/1000"); > #endif > + > +static int ncallout; > +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, > + "Number of entries in callwheel and size of timeout() preallocation"); > + > /* > * TODO: > * allocate more timeout table slots when table overflows. > @@ -252,6 +258,14 @@ kern_timeout_callwheel_alloc(caddr_t v) > > timeout_cpu = PCPU_GET(cpuid); > cc = CC_CPU(timeout_cpu); > + > + /* > + * Calculate the size of the callout wheel and the preallocated > + * timeout() structures. > + */ > + ncallout = imin(16 + maxproc + maxfiles, 18508); > + TUNABLE_INT_FETCH("kern.ncallout", &ncallout); > + > /* > * Calculate callout wheel size, should be next power of two higher > * than 'ncallout'. > > Modified: head/sys/kern/subr_param.c > ============================================================================== > --- head/sys/kern/subr_param.c Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/kern/subr_param.c Fri Mar 8 10:14:58 2013 (r248031) > @@ -91,7 +91,6 @@ int maxprocperuid; /* max # of procs p > int maxfiles; /* sys. wide open files limit */ > int maxfilesperproc; /* per-proc open files limit */ > int msgbufsize; /* size of kernel message buffer */ > -int ncallout; /* maximum # of timer events */ > int nbuf; > int ngroups_max; /* max # groups per process */ > int nswbuf; > @@ -109,8 +108,6 @@ u_long sgrowsiz; /* amount to grow sta > > SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, > "Number of clock ticks per second"); > -SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, > - "Number of pre-allocated timer events"); > SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0, > "Number of buffers in the buffer cache"); > SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, > @@ -327,15 +324,6 @@ init_param2(long physpages) > TUNABLE_INT_FETCH("kern.nbuf", &nbuf); > > /* > - * XXX: Does the callout wheel have to be so big? > - * > - * Clip callout to result of previous function of maxusers maximum > - * 384. This is still huge, but acceptable. > - */ > - ncallout = imin(16 + maxproc + maxfiles, 18508); > - TUNABLE_INT_FETCH("kern.ncallout", &ncallout); > - > - /* > * The default for maxpipekva is min(1/64 of the kernel address space, > * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. > */ > > Modified: head/sys/sys/callout.h > ============================================================================== > --- head/sys/sys/callout.h Fri Mar 8 08:19:50 2013 (r248030) > +++ head/sys/sys/callout.h Fri Mar 8 10:14:58 2013 (r248031) > @@ -63,8 +63,6 @@ struct callout_handle { > }; > > #ifdef _KERNEL > -extern int ncallout; > - > #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) > #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) > #define callout_drain(c) _callout_stop_safe(c, 1) > From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 20:07:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7A9866CA; Fri, 8 Mar 2013 20:07:33 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C328809; Fri, 8 Mar 2013 20:07:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28K7XVs047055; Fri, 8 Mar 2013 20:07:33 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28K7XQH047053; Fri, 8 Mar 2013 20:07:33 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201303082007.r28K7XQH047053@svn.freebsd.org> From: Sean Bruno Date: Fri, 8 Mar 2013 20:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248068 - in head: sbin/geom/class/raid sys/geom/raid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 20:07:33 -0000 Author: sbruno Date: Fri Mar 8 20:07:32 2013 New Revision: 248068 URL: http://svnweb.freebsd.org/changeset/base/248068 Log: Add legacy support to geom raid to create a /dev/arX device for support of upgrading older machines using ataraid(4) to newer releases. This optional parameter is controlled via kern.geom.raid.legacy_aliases and will create a /dev/ar0 device that will point at /dev/raid/r0 for example. Tested on Dell SC 1425 DDF-1 format software raid controllers installing from stable/7 and upgrading to stable/9 without having to adjust /etc/fstab Reviewed by: mav Obtained from: Yahoo! MFC after: 2 Weeks Modified: head/sbin/geom/class/raid/graid.8 head/sys/geom/raid/g_raid.c Modified: head/sbin/geom/class/raid/graid.8 ============================================================================== --- head/sbin/geom/class/raid/graid.8 Fri Mar 8 19:36:44 2013 (r248067) +++ head/sbin/geom/class/raid/graid.8 Fri Mar 8 20:07:32 2013 (r248068) @@ -305,6 +305,9 @@ Write errors are always considered as di Time to wait for missing array components on startup. .It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1 Enable taste for specific metadata or transformation module. +.It Va kern.geom.raid.legacy_aliases : No 0 +Enable geom raid emulation of /dev/ar%d devices from ataraid(4) +This should aid the upgrade of systems from legacy to modern releases. .El .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Fri Mar 8 19:36:44 2013 (r248067) +++ head/sys/geom/raid/g_raid.c Fri Mar 8 20:07:32 2013 (r248068) @@ -92,6 +92,11 @@ TUNABLE_INT("kern.geom.raid.idle_thresho SYSCTL_UINT(_kern_geom_raid, OID_AUTO, idle_threshold, CTLFLAG_RW, &g_raid_idle_threshold, 1000000, "Time in microseconds to consider a volume idle."); +static u_int ar_legacy_aliases = 1; +SYSCTL_INT(_kern_geom_raid, OID_AUTO, legacy_aliases, CTLFLAG_RW, + &ar_legacy_aliases, 0, "Create aliases named as the legacy ataraid style."); +TUNABLE_INT("kern.geom_raid.legacy_aliases", &ar_legacy_aliases); + #define MSLEEP(rv, ident, mtx, priority, wmesg, timeout) do { \ G_RAID_DEBUG(4, "%s: Sleeping %p.", __func__, (ident)); \ @@ -1637,6 +1642,7 @@ g_raid_launch_provider(struct g_raid_vol struct g_raid_softc *sc; struct g_provider *pp; char name[G_RAID_MAX_VOLUMENAME]; + char announce_buf[80], buf1[32]; off_t off; sc = vol->v_softc; @@ -1650,6 +1656,22 @@ g_raid_launch_provider(struct g_raid_vol /* Otherwise use sequential volume number. */ snprintf(name, sizeof(name), "raid/r%d", vol->v_global_id); } + + /* + * Create a /dev/ar%d that the old ataraid(4) stack once + * created as an alias for /dev/raid/r%d if requested. + * This helps going from stable/7 ataraid devices to newer + * FreeBSD releases. sbruno 07 MAY 2013 + */ + + if (ar_legacy_aliases) { + snprintf(announce_buf, sizeof(announce_buf), + "kern.devalias.%s", name); + snprintf(buf1, sizeof(buf1), + "ar%d", vol->v_global_id); + setenv(announce_buf, buf1); + } + pp = g_new_providerf(sc->sc_geom, "%s", name); pp->private = vol; pp->mediasize = vol->v_mediasize; From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 20:23:57 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CBE67CA9; Fri, 8 Mar 2013 20:23:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD4908B9; Fri, 8 Mar 2013 20:23:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28KNvbd054407; Fri, 8 Mar 2013 20:23:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28KNufc054395; Fri, 8 Mar 2013 20:23:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303082023.r28KNufc054395@svn.freebsd.org> From: Adrian Chadd Date: Fri, 8 Mar 2013 20:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248069 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 20:23:57 -0000 Author: adrian Date: Fri Mar 8 20:23:55 2013 New Revision: 248069 URL: http://svnweb.freebsd.org/changeset/base/248069 Log: Bring over my initial work from the net80211 TX locking branch. This patchset implements a new TX lock, covering both the per-VAP (and thus per-node) TX locking and the serialisation through to the underlying physical device. This implements the hard requirement that frames to the underlying physical device are scheduled to the underlying device in the same order that they are processed at the VAP layer. This includes adding extra encapsulation state (such as sequence numbers and CCMP IV numbers.) Any order mismatch here will result in dropped packets at the receiver. There are multiple transmit contexts from the upper protocol layers as well as the "raw" interface via the management and BPF transmit paths. All of these need to be correctly serialised or bad behaviour will result under load. The specifics: * add a new TX IC lock - it will eventually just be used for serialisation to the underlying physical device but for now it's used for both the VAP encapsulation/serialisation and the physical device dispatch. This lock is specifically non-recursive. * Methodize the parent transmit, vap transmit and ic_raw_xmit function pointers; use lock assertions in the parent/vap transmit routines. * Add a lock assertion in ieee80211_encap() - the TX lock must be held here to guarantee sensible behaviour. * Refactor out the packet sending code from ieee80211_start() - now ieee80211_start() is just a loop over the ifnet queue and it dispatches each VAP packet send through ieee80211_start_pkt(). Yes, I will likely rename ieee80211_start_pkt() to something that better reflects its status as a VAP packet transmit path. More on that later. * Add locking around the management and BAR TX sending - to ensure that encapsulation and TX are done hand-in-hand. * Add locking in the mesh code - again, to ensure that encapsulation and mesh transmit are done hand-in-hand. * Add locking around the power save queue and ageq handling, when dispatching to the parent interface. * Add locking around the WDS handoff. * Add a note in the mesh dispatch code that the TX path needs to be re-thought-out - right now it's doing a direct parent device transmit rather than going via the vap layer. It may "work", but it's likely incorrect (as it bypasses any possible per-node power save and aggregation handling.) Why not a per-VAP or per-node lock? Because in order to ensure per-VAP ordering, we'd have to hold the VAP lock across parent->if_transmit(). There are a few problems with this: * There's some state being setup during each driver transmit - specifically, the encryption encap / CCMP IV setup. That should eventually be dragged back into the encapsulation phase but for now it lives in the driver TX path. This should be locked. * Two drivers (ath, iwn) re-use the node->ni_txseqs array in order to allocate sequence numbers when doing transmit aggregation. This should also be locked. * Drivers may have multiple frames queued already - so when one calls if_transmit(), it may end up dispatching multiple frames for different VAPs/nodes, each needing a different lock when handling that particular end destination. So to be "correct" locking-wise, we'd end up needing to grab a VAP or node lock inside the driver TX path when setting up crypto / AMPDU sequence numbers, and we may already _have_ a TX lock held - mostly for the same destination vap/node, but sometimes it'll be for others. That could lead to LORs and thus deadlocks. So for now, I'm sticking with an IC TX lock. It has the advantage of papering over the above and it also has the added advantage that I can assert that it's being held when doing a parent device transmit. I'll look at splitting the locks out a bit more later on. General outstanding net80211 TX path issues / TODO: * Look into separating out the VAP serialisation and the IC handoff. It's going to be tricky as parent->if_transmit() doesn't give me the opportunity to split queuing from driver dispatch. See above. * Work with monthadar to fix up the mesh transmit path so it doesn't go via the parent interface when retransmitting frames. * Push the encryption handling back into the driver, if it's at all architectually sane to do so. I know it's possible - it's what mac80211 in Linux does. * Make ieee80211_raw_xmit() queue a frame into VAP or parent queue rather than doing a short-cut direct into the driver. There are QoS issues here - you do want your management frames to be encapsulated and pushed onto the stack sooner than the (large, bursty) amount of data frames that are queued. But there has to be a saner way to do this. * Fragments are still broken - drivers need to be upgraded to an if_transmit() implementation and then fragmentation handling needs to be properly fixed. Tested: * STA - AR5416, AR9280, Intel 5300 abgn wifi * Hostap - AR5416, AR9160, AR9280 * Mesh - some testing by monthadar@, more to come. Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_power.c head/sys/net80211/ieee80211_proto.h head/sys/net80211/ieee80211_superg.c head/sys/net80211/ieee80211_var.h head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211.c Fri Mar 8 20:23:55 2013 (r248069) @@ -278,6 +278,7 @@ ieee80211_ifattach(struct ieee80211com * KASSERT(ifp->if_type == IFT_IEEE80211, ("if_type %d", ifp->if_type)); IEEE80211_LOCK_INIT(ic, ifp->if_xname); + IEEE80211_TX_LOCK_INIT(ic, ifp->if_xname); TAILQ_INIT(&ic->ic_vaps); /* Create a taskqueue for all state changes */ @@ -385,6 +386,7 @@ ieee80211_ifdetach(struct ieee80211com * ifmedia_removeall(&ic->ic_media); taskqueue_free(ic->ic_tq); + IEEE80211_TX_LOCK_DESTROY(ic); IEEE80211_LOCK_DESTROY(ic); } Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_freebsd.c Fri Mar 8 20:23:55 2013 (r248069) @@ -504,6 +504,44 @@ ieee80211_process_callback(struct ieee80 } } +/* + * Transmit a frame to the parent interface. + * + * TODO: if the transmission fails, make sure the parent node is freed + * (the callers will first need modifying.) + */ +int +ieee80211_parent_transmit(struct ieee80211com *ic, + struct mbuf *m) +{ + struct ifnet *parent = ic->ic_ifp; + /* + * Assert the IC TX lock is held - this enforces the + * processing -> queuing order is maintained + */ + IEEE80211_TX_LOCK_ASSERT(ic); + + return (parent->if_transmit(parent, m)); +} + +/* + * Transmit a frame to the VAP interface. + */ +int +ieee80211_vap_transmit(struct ieee80211vap *vap, struct mbuf *m) +{ + struct ifnet *ifp = vap->iv_ifp; + + /* + * When transmitting via the VAP, we shouldn't hold + * any IC TX lock as the VAP TX path will acquire it. + */ + IEEE80211_TX_UNLOCK_ASSERT(vap->iv_ic); + + return (ifp->if_transmit(ifp, m)); + +} + #include void Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_freebsd.h Fri Mar 8 20:23:55 2013 (r248069) @@ -57,6 +57,30 @@ typedef struct { mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) /* + * Transmit lock. + * + * This is a (mostly) temporary lock designed to serialise all of the + * transmission operations throughout the stack. + */ +typedef struct { + char name[16]; /* e.g. "ath0_com_lock" */ + struct mtx mtx; +} ieee80211_tx_lock_t; +#define IEEE80211_TX_LOCK_INIT(_ic, _name) do { \ + ieee80211_tx_lock_t *cl = &(_ic)->ic_txlock; \ + snprintf(cl->name, sizeof(cl->name), "%s_tx_lock", _name); \ + mtx_init(&cl->mtx, cl->name, NULL, MTX_DEF); \ +} while (0) +#define IEEE80211_TX_LOCK_OBJ(_ic) (&(_ic)->ic_txlock.mtx) +#define IEEE80211_TX_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic)) +#define IEEE80211_TX_LOCK(_ic) mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic)) +#define IEEE80211_TX_UNLOCK(_ic) mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic)) +#define IEEE80211_TX_LOCK_ASSERT(_ic) \ + mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED) +#define IEEE80211_TX_UNLOCK_ASSERT(_ic) \ + mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED) + +/* * Node locking definitions. */ typedef struct { @@ -272,9 +296,11 @@ int ieee80211_add_callback(struct mbuf * void (*func)(struct ieee80211_node *, void *, int), void *arg); void ieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int); -void get_random_bytes(void *, size_t); - struct ieee80211com; +int ieee80211_parent_transmit(struct ieee80211com *, struct mbuf *); +int ieee80211_vap_transmit(struct ieee80211vap *, struct mbuf *); + +void get_random_bytes(void *, size_t); void ieee80211_sysctl_attach(struct ieee80211com *); void ieee80211_sysctl_detach(struct ieee80211com *); Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_hostap.c Fri Mar 8 20:23:55 2013 (r248069) @@ -412,7 +412,7 @@ hostap_deliver_data(struct ieee80211vap if (mcopy != NULL) { int len, err; len = mcopy->m_pkthdr.len; - err = ifp->if_transmit(ifp, mcopy); + err = ieee80211_vap_transmit(vap, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mcopy */ } else { @@ -2255,8 +2255,8 @@ void ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = vap->iv_ic; struct ieee80211_frame_min *wh; - struct ifnet *ifp; struct mbuf *m; uint16_t aid; int qlen; @@ -2320,23 +2320,15 @@ ieee80211_recv_pspoll(struct ieee80211_n } m->m_flags |= M_PWR_SAV; /* bypass PS handling */ - if (m->m_flags & M_ENCAP) - ifp = vap->iv_ic->ic_ifp; - else - ifp = vap->iv_ifp; - /* - * Free any node ref which this mbuf may have. - * - * Much like psq_mfree(), we assume that M_ENCAP nodes have - * node references. + * Do the right thing; if it's an encap'ed frame then + * call ieee80211_parent_transmit() (and free the ref) else + * call ieee80211_vap_transmit(). */ - if (ifp->if_transmit(ifp, m) != 0) { - /* - * XXX m is invalid (freed) at this point, determine M_ENCAP - * an alternate way. - */ - if (ifp == vap->iv_ic->ic_ifp) + if (m->m_flags & M_ENCAP) { + if (ieee80211_parent_transmit(ic, m) != 0) ieee80211_free_node(ni); + } else { + (void) ieee80211_vap_transmit(vap, m); } } Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_ht.c Fri Mar 8 20:23:55 2013 (r248069) @@ -2392,7 +2392,9 @@ ieee80211_send_bar(struct ieee80211_node * ic_raw_xmit will free the node reference * regardless of queue/TX success or failure. */ - ret = ic->ic_raw_xmit(ni, m, NULL); + IEEE80211_TX_LOCK(ic); + ret = ieee80211_raw_output(vap, ni, m, NULL); + IEEE80211_TX_UNLOCK(ic); if (ret != 0) { IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_11N, ni, "send BAR: failed: (ret = %d)\n", Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_hwmp.c Fri Mar 8 20:23:55 2013 (r248069) @@ -592,6 +592,7 @@ hwmp_send_action(struct ieee80211vap *va struct ieee80211_bpf_params params; struct mbuf *m; uint8_t *frm; + int ret; if (IEEE80211_IS_MULTICAST(da)) { ni = ieee80211_ref_node(vap->iv_bss); @@ -654,6 +655,9 @@ hwmp_send_action(struct ieee80211vap *va vap->iv_stats.is_tx_nobuf++; return ENOMEM; } + + IEEE80211_TX_LOCK(ic); + ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION, IEEE80211_NONQOS_TID, vap->iv_myaddr, da, vap->iv_myaddr); @@ -669,7 +673,9 @@ hwmp_send_action(struct ieee80211vap *va else params.ibp_try0 = ni->ni_txparms->maxretry; params.ibp_power = ni->ni_txpower; - return ic->ic_raw_xmit(ni, m, ¶ms); + ret = ieee80211_raw_output(vap, ni, m, ¶ms); + IEEE80211_TX_UNLOCK(ic); + return (ret); } #define ADDSHORT(frm, v) do { \ @@ -1271,12 +1277,9 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_mesh_route *rtext = NULL; struct ieee80211_hwmp_route *hr; struct ieee80211com *ic = vap->iv_ic; - struct ifnet *ifp = vap->iv_ifp; struct mbuf *m, *next; uint32_t metric = 0; const uint8_t *addr; - int is_encap; - struct ieee80211_node *ni_encap; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":", @@ -1450,22 +1453,21 @@ hwmp_recv_prep(struct ieee80211vap *vap, m = ieee80211_ageq_remove(&ic->ic_stageq, (struct ieee80211_node *)(uintptr_t) ieee80211_mac_hash(ic, addr)); /* either dest or ext_dest */ + + /* + * All frames in the stageq here should be non-M_ENCAP; or things + * will get very unhappy. + */ for (; m != NULL; m = next) { - is_encap = !! (m->m_flags & M_ENCAP); - ni_encap = (struct ieee80211_node *) m->m_pkthdr.rcvif; next = m->m_nextpkt; m->m_nextpkt = NULL; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "flush queued frame %p len %d", m, m->m_pkthdr.len); - /* * If the mbuf has M_ENCAP set, ensure we free it. * Note that after if_transmit() is called, m is invalid. */ - if (ifp->if_transmit(ifp, m) != 0) { - if (is_encap) - ieee80211_free_node(ni_encap); - } + (void) ieee80211_vap_transmit(vap, m); } #undef IS_PROXY #undef PROXIED_BY_US Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_mesh.c Fri Mar 8 20:23:55 2013 (r248069) @@ -1041,11 +1041,12 @@ mesh_transmit_to_gate(struct ieee80211va { struct ifnet *ifp = vap->iv_ifp; struct ieee80211com *ic = vap->iv_ic; - struct ifnet *parent = ic->ic_ifp; struct ieee80211_node *ni; struct ether_header *eh; int error; + IEEE80211_TX_UNLOCK_ASSERT(ic); + eh = mtod(m, struct ether_header *); ni = ieee80211_mesh_find_txnode(vap, rt_gate->rt_dest); if (ni == NULL) { @@ -1132,6 +1133,8 @@ mesh_transmit_to_gate(struct ieee80211va } } #endif /* IEEE80211_SUPPORT_SUPERG */ + + IEEE80211_TX_LOCK(ic); if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { /* * Encapsulate the packet in prep for transmission. @@ -1143,9 +1146,9 @@ mesh_transmit_to_gate(struct ieee80211va return; } } - error = parent->if_transmit(parent, m); + error = ieee80211_parent_transmit(ic, m); + IEEE80211_TX_UNLOCK(ic); if (error != 0) { - m_freem(m); ieee80211_free_node(ni); } else { ifp->if_opackets++; @@ -1171,6 +1174,8 @@ ieee80211_mesh_forward_to_gates(struct i struct ieee80211_mesh_gate_route *gr = NULL, *gr_next; struct mbuf *m, *mcopy, *next; + IEEE80211_TX_UNLOCK_ASSERT(ic); + KASSERT( rt_dest->rt_flags == IEEE80211_MESHRT_FLAGS_DISCOVER, ("Route is not marked with IEEE80211_MESHRT_FLAGS_DISCOVER")); @@ -1240,7 +1245,6 @@ mesh_forward(struct ieee80211vap *vap, s struct ieee80211com *ic = vap->iv_ic; struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ifnet *ifp = vap->iv_ifp; - struct ifnet *parent = ic->ic_ifp; const struct ieee80211_frame *wh = mtod(m, const struct ieee80211_frame *); struct mbuf *mcopy; @@ -1249,6 +1253,9 @@ mesh_forward(struct ieee80211vap *vap, s struct ieee80211_node *ni; int err; + /* This is called from the RX path - don't hold this lock */ + IEEE80211_TX_UNLOCK_ASSERT(ic); + /* * mesh ttl of 1 means we are the last one receving it, * according to amendment we decrement and then check if @@ -1320,7 +1327,20 @@ mesh_forward(struct ieee80211vap *vap, s /* XXX do we know m_nextpkt is NULL? */ mcopy->m_pkthdr.rcvif = (void *) ni; - err = parent->if_transmit(parent, mcopy); + + /* + * XXX this bypasses all of the VAP TX handling; it passes frames + * directly to the parent interface. + * + * Because of this, there's no TX lock being held as there's no + * encaps state being used. + * + * Doing a direct parent transmit may not be the correct thing + * to do here; we'll have to re-think this soon. + */ + IEEE80211_TX_LOCK(ic); + err = ieee80211_parent_transmit(ic, mcopy); + IEEE80211_TX_UNLOCK(ic); if (err != 0) { /* NB: IFQ_HANDOFF reclaims mbuf */ ieee80211_free_node(ni); @@ -1457,6 +1477,10 @@ mesh_recv_indiv_data_to_fwrd(struct ieee struct ieee80211_qosframe_addr4 *qwh; struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt_meshda, *rt_meshsa; + struct ieee80211com *ic = vap->iv_ic; + + /* This is called from the RX path - don't hold this lock */ + IEEE80211_TX_UNLOCK_ASSERT(ic); qwh = (struct ieee80211_qosframe_addr4 *)wh; @@ -1512,8 +1536,12 @@ mesh_recv_indiv_data_to_me(struct ieee80 const struct ieee80211_meshcntl_ae10 *mc10; struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; + struct ieee80211com *ic = vap->iv_ic; int ae; + /* This is called from the RX path - don't hold this lock */ + IEEE80211_TX_UNLOCK_ASSERT(ic); + qwh = (struct ieee80211_qosframe_addr4 *)wh; mc10 = (const struct ieee80211_meshcntl_ae10 *)mc; @@ -1575,6 +1603,10 @@ mesh_recv_group_data(struct ieee80211vap { #define MC01(mc) ((const struct ieee80211_meshcntl_ae01 *)mc) struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211com *ic = vap->iv_ic; + + /* This is called from the RX path - don't hold this lock */ + IEEE80211_TX_UNLOCK_ASSERT(ic); mesh_forward(vap, m, mc); @@ -1621,6 +1653,9 @@ mesh_input(struct ieee80211_node *ni, st need_tap = 1; /* mbuf need to be tapped. */ type = -1; /* undefined */ + /* This is called from the RX path - don't hold this lock */ + IEEE80211_TX_UNLOCK_ASSERT(ic); + if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_min)) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY, ni->ni_macaddr, NULL, @@ -2743,6 +2778,7 @@ mesh_send_action(struct ieee80211_node * struct ieee80211com *ic = ni->ni_ic; struct ieee80211_bpf_params params; struct ieee80211_frame *wh; + int ret; KASSERT(ni != NULL, ("null node")); @@ -2761,6 +2797,7 @@ mesh_send_action(struct ieee80211_node * return ENOMEM; } + IEEE80211_TX_LOCK(ic); wh = mtod(m, struct ieee80211_frame *); ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_ACTION, @@ -2778,7 +2815,9 @@ mesh_send_action(struct ieee80211_node * IEEE80211_NODE_STAT(ni, tx_mgmt); - return ic->ic_raw_xmit(ni, m, ¶ms); + ret = ieee80211_raw_output(vap, ni, m, ¶ms); + IEEE80211_TX_UNLOCK(ic); + return (ret); } #define ADDSHORT(frm, v) do { \ Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Fri Mar 8 20:07:32 2013 (r248068) +++ head/sys/net80211/ieee80211_output.c Fri Mar 8 20:23:55 2013 (r248069) @@ -110,6 +110,255 @@ doprint(struct ieee80211vap *vap, int su #endif /* + * Send the given mbuf through the given vap. + * + * This consumes the mbuf regardless of whether the transmit + * was successful or not. + * + * This does none of the initial checks that ieee80211_start() + * does (eg CAC timeout, interface wakeup) - the caller must + * do this first. + */ +static int +ieee80211_start_pkt(struct ieee80211vap *vap, struct mbuf *m) +{ +#define IS_DWDS(vap) \ + (vap->iv_opmode == IEEE80211_M_WDS && \ + (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY) == 0) + struct ieee80211com *ic = vap->iv_ic; + struct ifnet *ifp = vap->iv_ifp; + struct ieee80211_node *ni; + struct ether_header *eh; + int error; + + /* + * Cancel any background scan. + */ + if (ic->ic_flags & IEEE80211_F_SCAN) + ieee80211_cancel_anyscan(vap); + /* + * Find the node for the destination so we can do + * things like power save and fast frames aggregation. + * + * NB: past this point various code assumes the first + * mbuf has the 802.3 header present (and contiguous). + */ + ni = NULL; + if (m->m_len < sizeof(struct ether_header) && + (m = m_pullup(m, sizeof(struct ether_header))) == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, + "discard frame, %s\n", "m_pullup failed"); + vap->iv_stats.is_tx_nobuf++; /* XXX */ + ifp->if_oerrors++; + return (ENOBUFS); + } + eh = mtod(m, struct ether_header *); + if (ETHER_IS_MULTICAST(eh->ether_dhost)) { + if (IS_DWDS(vap)) { + /* + * Only unicast frames from the above go out + * DWDS vaps; multicast frames are handled by + * dispatching the frame as it comes through + * the AP vap (see below). + */ + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_WDS, + eh->ether_dhost, "mcast", "%s", "on DWDS"); + vap->iv_stats.is_dwds_mcast++; + m_freem(m); + /* XXX better status? */ + return (ENOBUFS); + } + if (vap->iv_opmode == IEEE80211_M_HOSTAP) { + /* + * Spam DWDS vap's w/ multicast traffic. + */ + /* XXX only if dwds in use? */ + ieee80211_dwds_mcast(vap, m); + } + } +#ifdef IEEE80211_SUPPORT_MESH + if (vap->iv_opmode != IEEE80211_M_MBSS) { +#endif + ni = ieee80211_find_txnode(vap, eh->ether_dhost); + if (ni == NULL) { + /* NB: ieee80211_find_txnode does stat+msg */ + ifp->if_oerrors++; + m_freem(m); + /* XXX better status? */ + return (ENOBUFS); + } + if (ni->ni_associd == 0 && + (ni->ni_flags & IEEE80211_NODE_ASSOCID)) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, + eh->ether_dhost, NULL, + "sta not associated (type 0x%04x)", + htons(eh->ether_type)); + vap->iv_stats.is_tx_notassoc++; + ifp->if_oerrors++; + m_freem(m); + ieee80211_free_node(ni); + /* XXX better status? */ + return (ENOBUFS); + } +#ifdef IEEE80211_SUPPORT_MESH + } else { + if (!IEEE80211_ADDR_EQ(eh->ether_shost, vap->iv_myaddr)) { + /* + * Proxy station only if configured. + */ + if (!ieee80211_mesh_isproxyena(vap)) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_OUTPUT | + IEEE80211_MSG_MESH, + eh->ether_dhost, NULL, + "%s", "proxy not enabled"); + vap->iv_stats.is_mesh_notproxy++; + ifp->if_oerrors++; + m_freem(m); + /* XXX better status? */ + return (ENOBUFS); + } + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, + "forward frame from DS SA(%6D), DA(%6D)\n", + eh->ether_shost, ":", + eh->ether_dhost, ":"); + ieee80211_mesh_proxy_check(vap, eh->ether_shost); + } + ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); + if (ni == NULL) { + /* + * NB: ieee80211_mesh_discover holds/disposes + * frame (e.g. queueing on path discovery). + */ + ifp->if_oerrors++; + /* XXX better status? */ + return (ENOBUFS); + } + } +#endif + if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && + (m->m_flags & M_PWR_SAV) == 0) { + /* + * Station in power save mode; pass the frame + * to the 802.11 layer and continue. We'll get + * the frame back when the time is right. + * XXX lose WDS vap linkage? + */ + (void) ieee80211_pwrsave(ni, m); + ieee80211_free_node(ni); + /* XXX better status? */ + return (ENOBUFS); + } + /* calculate priority so drivers can find the tx queue */ + if (ieee80211_classify(ni, m)) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, + eh->ether_dhost, NULL, + "%s", "classification failure"); + vap->iv_stats.is_tx_classify++; + ifp->if_oerrors++; + m_freem(m); + ieee80211_free_node(ni); + /* XXX better status? */ + return (ENOBUFS); + } + /* + * Stash the node pointer. Note that we do this after + * any call to ieee80211_dwds_mcast because that code + * uses any existing value for rcvif to identify the + * interface it (might have been) received on. + */ + m->m_pkthdr.rcvif = (void *)ni; + + BPF_MTAP(ifp, m); /* 802.3 tx */ + + + /* + * Check if A-MPDU tx aggregation is setup or if we + * should try to enable it. The sta must be associated + * with HT and A-MPDU enabled for use. When the policy + * routine decides we should enable A-MPDU we issue an + * ADDBA request and wait for a reply. The frame being + * encapsulated will go out w/o using A-MPDU, or possibly + * it might be collected by the driver and held/retransmit. + * The default ic_ampdu_enable routine handles staggering + * ADDBA requests in case the receiver NAK's us or we are + * otherwise unable to establish a BA stream. + */ + if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && + (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) && + (m->m_flags & M_EAPOL) == 0) { + int tid = WME_AC_TO_TID(M_WME_GETAC(m)); + struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; + + ieee80211_txampdu_count_packet(tap); + if (IEEE80211_AMPDU_RUNNING(tap)) { + /* + * Operational, mark frame for aggregation. + * + * XXX do tx aggregation here + */ + m->m_flags |= M_AMPDU_MPDU; + } else if (!IEEE80211_AMPDU_REQUESTED(tap) && + ic->ic_ampdu_enable(ni, tap)) { + /* + * Not negotiated yet, request service. + */ + ieee80211_ampdu_request(ni, tap); + /* XXX hold frame for reply? */ + } + } + +#ifdef IEEE80211_SUPPORT_SUPERG + else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { + m = ieee80211_ff_check(ni, m); + if (m == NULL) { + /* NB: any ni ref held on stageq */ + /* XXX better status? */ + return (ENOBUFS); + } + } +#endif /* IEEE80211_SUPPORT_SUPERG */ + + /* + * Grab the TX lock - serialise the TX process from this + * point (where TX state is being checked/modified) + * through to driver queue. + */ + IEEE80211_TX_LOCK(ic); + + if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { + /* + * Encapsulate the packet in prep for transmission. + */ + m = ieee80211_encap(vap, ni, m); + if (m == NULL) { + /* NB: stat+msg handled in ieee80211_encap */ + IEEE80211_TX_UNLOCK(ic); + ieee80211_free_node(ni); + /* XXX better status? */ + return (ENOBUFS); + } + } + error = ieee80211_parent_transmit(ic, m); + + /* + * Unlock at this point - no need to hold it across + * ieee80211_free_node() (ie, the comlock) + */ + IEEE80211_TX_UNLOCK(ic); + if (error != 0) { + /* NB: IFQ_HANDOFF reclaims mbuf */ + ieee80211_free_node(ni); + } else { + ifp->if_opackets++; + } + ic->ic_lastdata = ticks; + + return (0); +#undef IS_DWDS +} + +/* * Start method for vap's. All packets from the stack come * through here. We handle common processing of the packets * before dispatching them to the underlying device. @@ -117,16 +366,10 @@ doprint(struct ieee80211vap *vap, int su void ieee80211_start(struct ifnet *ifp) { -#define IS_DWDS(vap) \ - (vap->iv_opmode == IEEE80211_M_WDS && \ - (vap->iv_flags_ext & IEEE80211_FEXT_WDSLEGACY) == 0) struct ieee80211vap *vap = ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; struct ifnet *parent = ic->ic_ifp; - struct ieee80211_node *ni; struct mbuf *m; - struct ether_header *eh; - int error; /* NB: parent must be up and running */ if (!IFNET_IS_UP_RUNNING(parent)) { @@ -165,6 +408,7 @@ ieee80211_start(struct ifnet *ifp) } IEEE80211_UNLOCK(ic); } + for (;;) { IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -180,203 +424,23 @@ ieee80211_start(struct ifnet *ifp) */ m->m_flags &= ~(M_80211_TX - M_PWR_SAV - M_MORE_DATA); /* - * Cancel any background scan. - */ - if (ic->ic_flags & IEEE80211_F_SCAN) - ieee80211_cancel_anyscan(vap); - /* - * Find the node for the destination so we can do - * things like power save and fast frames aggregation. - * - * NB: past this point various code assumes the first - * mbuf has the 802.3 header present (and contiguous). + * Bump to the packet transmission path. */ - ni = NULL; - if (m->m_len < sizeof(struct ether_header) && - (m = m_pullup(m, sizeof(struct ether_header))) == NULL) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, - "discard frame, %s\n", "m_pullup failed"); - vap->iv_stats.is_tx_nobuf++; /* XXX */ - ifp->if_oerrors++; - continue; - } - eh = mtod(m, struct ether_header *); - if (ETHER_IS_MULTICAST(eh->ether_dhost)) { - if (IS_DWDS(vap)) { - /* - * Only unicast frames from the above go out - * DWDS vaps; multicast frames are handled by - * dispatching the frame as it comes through - * the AP vap (see below). - */ - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_WDS, - eh->ether_dhost, "mcast", "%s", "on DWDS"); - vap->iv_stats.is_dwds_mcast++; - m_freem(m); - continue; - } - if (vap->iv_opmode == IEEE80211_M_HOSTAP) { - /* - * Spam DWDS vap's w/ multicast traffic. - */ - /* XXX only if dwds in use? */ - ieee80211_dwds_mcast(vap, m); - } - } -#ifdef IEEE80211_SUPPORT_MESH - if (vap->iv_opmode != IEEE80211_M_MBSS) { -#endif - ni = ieee80211_find_txnode(vap, eh->ether_dhost); - if (ni == NULL) { - /* NB: ieee80211_find_txnode does stat+msg */ - ifp->if_oerrors++; - m_freem(m); - continue; - } - if (ni->ni_associd == 0 && - (ni->ni_flags & IEEE80211_NODE_ASSOCID)) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, - eh->ether_dhost, NULL, - "sta not associated (type 0x%04x)", - htons(eh->ether_type)); - vap->iv_stats.is_tx_notassoc++; - ifp->if_oerrors++; - m_freem(m); - ieee80211_free_node(ni); - continue; - } -#ifdef IEEE80211_SUPPORT_MESH - } else { - if (!IEEE80211_ADDR_EQ(eh->ether_shost, vap->iv_myaddr)) { - /* - * Proxy station only if configured. - */ - if (!ieee80211_mesh_isproxyena(vap)) { - IEEE80211_DISCARD_MAC(vap, - IEEE80211_MSG_OUTPUT | - IEEE80211_MSG_MESH, - eh->ether_dhost, NULL, - "%s", "proxy not enabled"); - vap->iv_stats.is_mesh_notproxy++; - ifp->if_oerrors++; - m_freem(m); - continue; - } - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, - "forward frame from DS SA(%6D), DA(%6D)\n", - eh->ether_shost, ":", - eh->ether_dhost, ":"); - ieee80211_mesh_proxy_check(vap, eh->ether_shost); - } - ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m); - if (ni == NULL) { - /* - * NB: ieee80211_mesh_discover holds/disposes - * frame (e.g. queueing on path discovery). - */ - ifp->if_oerrors++; - continue; - } - } -#endif - if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) && - (m->m_flags & M_PWR_SAV) == 0) { - /* - * Station in power save mode; pass the frame - * to the 802.11 layer and continue. We'll get - * the frame back when the time is right. - * XXX lose WDS vap linkage? - */ - (void) ieee80211_pwrsave(ni, m); - ieee80211_free_node(ni); - continue; - } - /* calculate priority so drivers can find the tx queue */ - if (ieee80211_classify(ni, m)) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT, - eh->ether_dhost, NULL, - "%s", "classification failure"); - vap->iv_stats.is_tx_classify++; - ifp->if_oerrors++; - m_freem(m); - ieee80211_free_node(ni); - continue; - } - /* - * Stash the node pointer. Note that we do this after - * any call to ieee80211_dwds_mcast because that code - * uses any existing value for rcvif to identify the - * interface it (might have been) received on. - */ - m->m_pkthdr.rcvif = (void *)ni; - - BPF_MTAP(ifp, m); /* 802.3 tx */ - - /* - * Check if A-MPDU tx aggregation is setup or if we - * should try to enable it. The sta must be associated - * with HT and A-MPDU enabled for use. When the policy - * routine decides we should enable A-MPDU we issue an - * ADDBA request and wait for a reply. The frame being - * encapsulated will go out w/o using A-MPDU, or possibly - * it might be collected by the driver and held/retransmit. - * The default ic_ampdu_enable routine handles staggering - * ADDBA requests in case the receiver NAK's us or we are - * otherwise unable to establish a BA stream. - */ - if ((ni->ni_flags & IEEE80211_NODE_AMPDU_TX) && - (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) && - (m->m_flags & M_EAPOL) == 0) { - int tid = WME_AC_TO_TID(M_WME_GETAC(m)); - struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; - - ieee80211_txampdu_count_packet(tap); - if (IEEE80211_AMPDU_RUNNING(tap)) { - /* - * Operational, mark frame for aggregation. - * - * XXX do tx aggregation here - */ - m->m_flags |= M_AMPDU_MPDU; - } else if (!IEEE80211_AMPDU_REQUESTED(tap) && - ic->ic_ampdu_enable(ni, tap)) { - /* - * Not negotiated yet, request service. - */ - ieee80211_ampdu_request(ni, tap); - /* XXX hold frame for reply? */ - } - } -#ifdef IEEE80211_SUPPORT_SUPERG - else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { - m = ieee80211_ff_check(ni, m); - if (m == NULL) { - /* NB: any ni ref held on stageq */ - continue; - } - } -#endif /* IEEE80211_SUPPORT_SUPERG */ - if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { - /* - * Encapsulate the packet in prep for transmission. - */ - m = ieee80211_encap(vap, ni, m); - if (m == NULL) { - /* NB: stat+msg handled in ieee80211_encap */ - ieee80211_free_node(ni); - continue; - } - } - error = parent->if_transmit(parent, m); - if (error != 0) { - /* NB: IFQ_HANDOFF reclaims mbuf */ - ieee80211_free_node(ni); - } else { - ifp->if_opackets++; - } - ic->ic_lastdata = ticks; + (void) ieee80211_start_pkt(vap, m); + /* mbuf is consumed here */ } -#undef IS_DWDS +} + +/* + * 802.11 raw output routine. + */ +int +ieee80211_raw_output(struct ieee80211vap *vap, struct ieee80211_node *ni, + struct mbuf *m, const struct ieee80211_bpf_params *params) +{ + struct ieee80211com *ic = vap->iv_ic; + + return (ic->ic_raw_xmit(ni, m, params)); } /* @@ -392,7 +456,9 @@ ieee80211_output(struct ifnet *ifp, stru struct ieee80211_node *ni = NULL; struct ieee80211vap *vap; struct ieee80211_frame *wh; + struct ieee80211com *ic = NULL; int error; + int ret; IFQ_LOCK(&ifp->if_snd); if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { @@ -409,6 +475,7 @@ ieee80211_output(struct ifnet *ifp, stru } IFQ_UNLOCK(&ifp->if_snd); vap = ifp->if_softc; + ic = vap->iv_ic; /* * Hand to the 802.3 code if not tagged as * a raw 802.11 frame. @@ -489,15 +556,19 @@ ieee80211_output(struct ifnet *ifp, stru /* NB: ieee80211_encap does not include 802.11 header */ IEEE80211_NODE_STAT_ADD(ni, tx_bytes, m->m_pkthdr.len); + IEEE80211_TX_LOCK(ic); + /* * NB: DLT_IEEE802_11_RADIO identifies the parameters are * present by setting the sa_len field of the sockaddr (yes, * this is a hack). * NB: we assume sa_data is suitably aligned to cast. */ - return vap->iv_ic->ic_raw_xmit(ni, m, + ret = ieee80211_raw_output(vap, ni, m, (const struct ieee80211_bpf_params *)(dst->sa_len ? dst->sa_data : NULL)); + IEEE80211_TX_UNLOCK(ic); + return (ret); bad: if (m != NULL) m_freem(m); @@ -526,8 +597,11 @@ ieee80211_send_setup( struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_tx_ampdu *tap; struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); + struct ieee80211com *ic = ni->ni_ic; ieee80211_seq seqno; + IEEE80211_TX_LOCK_ASSERT(ic); + wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type; if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) { switch (vap->iv_opmode) { @@ -621,6 +695,7 @@ ieee80211_mgmt_output(struct ieee80211_n struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; struct ieee80211_frame *wh; + int ret; KASSERT(ni != NULL, ("null node")); @@ -642,6 +717,8 @@ ieee80211_mgmt_output(struct ieee80211_n return ENOMEM; } + IEEE80211_TX_LOCK(ic); + wh = mtod(m, struct ieee80211_frame *); ieee80211_send_setup(ni, m, IEEE80211_FC0_TYPE_MGT | type, IEEE80211_NONQOS_TID, @@ -670,7 +747,9 @@ ieee80211_mgmt_output(struct ieee80211_n #endif IEEE80211_NODE_STAT(ni, tx_mgmt); - return ic->ic_raw_xmit(ni, m, params); + ret = ieee80211_raw_output(vap, ni, m, params); + IEEE80211_TX_UNLOCK(ic); + return (ret); } /* @@ -694,6 +773,7 @@ ieee80211_send_nulldata(struct ieee80211 struct ieee80211_frame *wh; int hdrlen; uint8_t *frm; + int ret; if (vap->iv_state == IEEE80211_S_CAC) { IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT | IEEE80211_MSG_DOTH, @@ -729,6 +809,8 @@ ieee80211_send_nulldata(struct ieee80211 return ENOMEM; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 20:33:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9700B16F; Fri, 8 Mar 2013 20:33:51 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 88C3791B; Fri, 8 Mar 2013 20:33:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28KXpra057471; Fri, 8 Mar 2013 20:33:51 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28KXpKK057468; Fri, 8 Mar 2013 20:33:51 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303082033.r28KXpKK057468@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 8 Mar 2013 20:33:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248070 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 20:33:51 -0000 Author: melifaro Date: Fri Mar 8 20:33:50 2013 New Revision: 248070 URL: http://svnweb.freebsd.org/changeset/base/248070 Log: Fix long-standing issue with interface routes being unprotected: Use RTM_PINNED flag to mark route as immutable. Forbid deleting immutable routes without special rtrequest1_fib() flag. Adding interface address with prefix already in route table is handled by atomically deleting old prefix and adding interface one. Discussed with: andre, eri MFC after: 3 weeks Modified: head/sys/net/if.c head/sys/net/route.c head/sys/net/route.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Mar 8 20:23:55 2013 (r248069) +++ head/sys/net/if.c Fri Mar 8 20:33:50 2013 (r248070) @@ -1357,7 +1357,8 @@ if_rtdel(struct radix_node *rn, void *ar return (0); err = rtrequest_fib(RTM_DELETE, rt_key(rt), rt->rt_gateway, - rt_mask(rt), rt->rt_flags|RTF_RNH_LOCKED, + rt_mask(rt), + rt->rt_flags|RTF_RNH_LOCKED|RTF_PINNED, (struct rtentry **) NULL, rt->rt_fibnum); if (err) { log(LOG_WARNING, "if_rtdel: error %d\n", err); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Fri Mar 8 20:23:55 2013 (r248069) +++ head/sys/net/route.c Fri Mar 8 20:33:50 2013 (r248070) @@ -1112,6 +1112,14 @@ rtrequest1_fib(int req, struct rt_addrin error = 0; } #endif + if ((flags & RTF_PINNED) == 0) { + /* Check if target route can be deleted */ + rt = (struct rtentry *)rnh->rnh_lookup(dst, + netmask, rnh); + if ((rt != NULL) && (rt->rt_flags & RTF_PINNED)) + senderr(EADDRINUSE); + } + /* * Remove the item from the tree and return it. * Complain if it is not there and do no more processing. @@ -1430,6 +1438,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int int didwork = 0; int a_failure = 0; static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; + struct radix_node_head *rnh; if (flags & RTF_HOST) { dst = ifa->ifa_dstaddr; @@ -1488,7 +1497,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int */ for ( fibnum = startfib; fibnum <= endfib; fibnum++) { if (cmd == RTM_DELETE) { - struct radix_node_head *rnh; struct radix_node *rn; /* * Look up an rtentry that is in the routing tree and @@ -1538,7 +1546,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int */ bzero((caddr_t)&info, sizeof(info)); info.rti_ifa = ifa; - info.rti_flags = flags | (ifa->ifa_flags & ~IFA_RTSELF); + info.rti_flags = flags | + (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; info.rti_info[RTAX_DST] = dst; /* * doing this for compatibility reasons @@ -1550,6 +1559,33 @@ rtinit1(struct ifaddr *ifa, int cmd, int info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr; info.rti_info[RTAX_NETMASK] = netmask; error = rtrequest1_fib(cmd, &info, &rt, fibnum); + + if ((error == EEXIST) && (cmd == RTM_ADD)) { + /* + * Interface route addition failed. + * Atomically delete current prefix generating + * RTM_DELETE message, and retry adding + * interface prefix. + */ + rnh = rt_tables_get_rnh(fibnum, dst->sa_family); + RADIX_NODE_HEAD_LOCK(rnh); + + /* Delete old prefix */ + info.rti_ifa = NULL; + info.rti_flags = RTF_RNH_LOCKED; + + error = rtrequest1_fib(RTM_DELETE, &info, &rt, fibnum); + if (error == 0) { + info.rti_ifa = ifa; + info.rti_flags = flags | RTF_RNH_LOCKED | + (ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED; + error = rtrequest1_fib(cmd, &info, &rt, fibnum); + } + + RADIX_NODE_HEAD_UNLOCK(rnh); + } + + if (error == 0 && rt != NULL) { /* * notify any listening routing agents of the change Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Fri Mar 8 20:23:55 2013 (r248069) +++ head/sys/net/route.h Fri Mar 8 20:33:50 2013 (r248070) @@ -176,7 +176,7 @@ struct ortentry { /* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ /* 0x80000 unused */ -#define RTF_PINNED 0x100000 /* future use */ +#define RTF_PINNED 0x100000 /* route is immutable */ #define RTF_LOCAL 0x200000 /* route represents a local address */ #define RTF_BROADCAST 0x400000 /* route represents a bcast address */ #define RTF_MULTICAST 0x800000 /* route represents a mcast address */ From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 22:14:26 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8057AB07; Fri, 8 Mar 2013 22:14:26 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id 64B2BD29; Fri, 8 Mar 2013 22:14:26 +0000 (UTC) Received: from epsilon.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 3F81934FD; Fri, 8 Mar 2013 14:14:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1362780866; bh=1/KQKSHXqyZD/8U0WLr4qkJ42U1gSqWPhOwc97BhS5Y=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=10df+YgMHeT4tZrSz3RstLdlweZM1yJ+R+AYgqIWJhD7BleTpEHvA2kgcVTsDSnj6 uuRuYp+8DNrNLcg8EuH+aB/d7Z1xNnTjaPBlr6prA+Yqj0uwyFeq5Es/VSxlsANUT/ nhBZ8hN0ZNjeD/hdNxIAdGRfPOLPZrEz0ESP+WPc= Message-ID: <513A62C0.2080104@delphij.net> Date: Fri, 08 Mar 2013 14:14:24 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Diane Bruce Subject: Re: svn commit: r247919 - head/lib/libutil References: <201303071900.r27J006A068238@svn.freebsd.org> In-Reply-To: <201303071900.r27J006A068238@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Chisnall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: 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, 08 Mar 2013 22:14:26 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 03/07/13 11:00, Diane Bruce wrote: > Author: db (ports committer) Date: Thu Mar 7 19:00:00 2013 New > Revision: 247919 URL: > http://svnweb.freebsd.org/changeset/base/247919 > > Log: Cleanup gr_add() so it does not leak mem This is part of > ongoing work on sbin/pw > > M libutil.h M gr_util.c > > Approved by: theraven This breaks 'pw groupadd -n someone -g 1234'... Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJROmK/AAoJEG80Jeu8UPuz7RgIAKpeaJIFOiP9zRzoMqDIdjKc tq9E2x9USxmwLHlk6aoKpPVMGfVVjrPllI5WeSv48plrVBq4amg998dkh9tZ1j/+ MhQNCKGnaKLXrXHQy/HD7f9jMfwiZug+dXWFn5ajgDqcNhTQ32pIB2vlWZEdhtM6 8gTQajTZU4zdIecHWOp5q+1vww95SDtFm8rENsh9ulUtD0TJyT8ouPvicwq6Hufr +5DxOF7wBWFSWOEI2Oax0f86xGy9PVuF/ZvcX+Sqkfvf7io1qwkNwQl6DkpvYVdt +jdzMUomN0VOyLO5b7UrJyXjXz9/RDj1Khf4hQZcx563hJXC7xhu8xFIcbGQtWw= =NX+s -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 22:56:51 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C1F945FE; Fri, 8 Mar 2013 22:56:51 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id B1651E56; Fri, 8 Mar 2013 22:56:51 +0000 (UTC) Received: from kruse-124.4.ixsystems.com (drawbridge.ixsystems.com [206.40.55.65]) by elvis.mu.org (Postfix) with ESMTPSA id 921FF1A3CBC; Fri, 8 Mar 2013 14:56:43 -0800 (PST) Message-ID: <513A6CA1.3000005@mu.org> Date: Fri, 08 Mar 2013 14:56:33 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: Alan Cox Subject: Re: svn commit: r248031 - in head/sys: kern sys References: <201303081014.r28AEwet053196@svn.freebsd.org> <513A2B3E.2070804@rice.edu> In-Reply-To: <513A2B3E.2070804@rice.edu> 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, Andre Oppermann X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 22:56:51 -0000 Agreed, Andre, please stop removing my comments. -Alfred On 3/8/13 10:17 AM, Alan Cox wrote: > On 03/08/2013 04:14, Andre Oppermann wrote: >> Author: andre >> Date: Fri Mar 8 10:14:58 2013 >> New Revision: 248031 >> URL: http://svnweb.freebsd.org/changeset/base/248031 >> >> Log: >> Move the auto-sizing of the callout array from init_param2() to >> kern_timeout_callwheel_alloc() where it is actually used. >> >> This is a mechanical move and no tuning parameters are changed. >> >> The pre-allocated callout array is only used for legacy timeout(9) >> calls and is only allocated and active on cpu0. Eventually all >> remaining users of timeout(9) should switch to the callout_* API. >> > In the meantime, until all legacy timeout(9) users are updated, I think > that it would be wise to retain the comment that describes where the > magic number 18508 comes from. > > Regards, > Alan > >> Reviewed by: davide >> >> Modified: >> head/sys/kern/kern_timeout.c >> head/sys/kern/subr_param.c >> head/sys/sys/callout.h >> >> Modified: head/sys/kern/kern_timeout.c >> ============================================================================== >> --- head/sys/kern/kern_timeout.c Fri Mar 8 08:19:50 2013 (r248030) >> +++ head/sys/kern/kern_timeout.c Fri Mar 8 10:14:58 2013 (r248031) >> @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -101,6 +102,11 @@ SYSCTL_INT(_debug, OID_AUTO, to_avg_mpca >> 0, "Average number of MP direct callouts made per callout_process call. " >> "Units = 1/1000"); >> #endif >> + >> +static int ncallout; >> +SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, >> + "Number of entries in callwheel and size of timeout() preallocation"); >> + >> /* >> * TODO: >> * allocate more timeout table slots when table overflows. >> @@ -252,6 +258,14 @@ kern_timeout_callwheel_alloc(caddr_t v) >> >> timeout_cpu = PCPU_GET(cpuid); >> cc = CC_CPU(timeout_cpu); >> + >> + /* >> + * Calculate the size of the callout wheel and the preallocated >> + * timeout() structures. >> + */ >> + ncallout = imin(16 + maxproc + maxfiles, 18508); >> + TUNABLE_INT_FETCH("kern.ncallout", &ncallout); >> + >> /* >> * Calculate callout wheel size, should be next power of two higher >> * than 'ncallout'. >> >> Modified: head/sys/kern/subr_param.c >> ============================================================================== >> --- head/sys/kern/subr_param.c Fri Mar 8 08:19:50 2013 (r248030) >> +++ head/sys/kern/subr_param.c Fri Mar 8 10:14:58 2013 (r248031) >> @@ -91,7 +91,6 @@ int maxprocperuid; /* max # of procs p >> int maxfiles; /* sys. wide open files limit */ >> int maxfilesperproc; /* per-proc open files limit */ >> int msgbufsize; /* size of kernel message buffer */ >> -int ncallout; /* maximum # of timer events */ >> int nbuf; >> int ngroups_max; /* max # groups per process */ >> int nswbuf; >> @@ -109,8 +108,6 @@ u_long sgrowsiz; /* amount to grow sta >> >> SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0, >> "Number of clock ticks per second"); >> -SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0, >> - "Number of pre-allocated timer events"); >> SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0, >> "Number of buffers in the buffer cache"); >> SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, >> @@ -327,15 +324,6 @@ init_param2(long physpages) >> TUNABLE_INT_FETCH("kern.nbuf", &nbuf); >> >> /* >> - * XXX: Does the callout wheel have to be so big? >> - * >> - * Clip callout to result of previous function of maxusers maximum >> - * 384. This is still huge, but acceptable. >> - */ >> - ncallout = imin(16 + maxproc + maxfiles, 18508); >> - TUNABLE_INT_FETCH("kern.ncallout", &ncallout); >> - >> - /* >> * The default for maxpipekva is min(1/64 of the kernel address space, >> * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. >> */ >> >> Modified: head/sys/sys/callout.h >> ============================================================================== >> --- head/sys/sys/callout.h Fri Mar 8 08:19:50 2013 (r248030) >> +++ head/sys/sys/callout.h Fri Mar 8 10:14:58 2013 (r248031) >> @@ -63,8 +63,6 @@ struct callout_handle { >> }; >> >> #ifdef _KERNEL >> -extern int ncallout; >> - >> #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) >> #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) >> #define callout_drain(c) _callout_stop_safe(c, 1) >> From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 01:05:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1CD251B1; Sat, 9 Mar 2013 01:05:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09ED928F; Sat, 9 Mar 2013 01:05:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2915aPc040019; Sat, 9 Mar 2013 01:05:36 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2915aDt040018; Sat, 9 Mar 2013 01:05:36 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303090105.r2915aDt040018@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Mar 2013 01:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248079 - head/sys/modules/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 01:05:37 -0000 Author: adrian Date: Sat Mar 9 01:05:36 2013 New Revision: 248079 URL: http://svnweb.freebsd.org/changeset/base/248079 Log: Placeholder for the upcoming AR9300 HAL code. Modified: head/sys/modules/ath/Makefile Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Sat Mar 9 00:39:54 2013 (r248078) +++ head/sys/modules/ath/Makefile Sat Mar 9 01:05:36 2013 (r248079) @@ -123,6 +123,15 @@ SRCS+= ah_eeprom_9287.c .PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9002 SRCS+= ar9287.c ar9287_reset.c ar9287_attach.c ar9287_cal.c ar9287_olc.c +# + AR9300 HAL +# .PATH: ${.CURDIR}/../../dev/ath/ath_hal/ar9003 +#SRCS+= ar9300_interrupts.c ar9300_radar.c ar9300_ani.c ar9300_keycache.c +#SRCS+= ar9300_radio.c ar9300_xmit.c ar9300_attach.c ar9300_mci.c ar9300_stub.c +#SRCS+= ar9300_xmit_ds.c ar9300_beacon.c ar9300_misc.c ar9300_recv.c +#SRCS+= ar9300_stub_funcs.c ar9300_eeprom.c ar9300_paprd.c ar9300_recv_ds.c +#SRCS+= ar9300_freebsd.c ar9300_phy.c ar9300_reset.c ar9300_gpio.c +#SRCS+= ar9300_power.c ar9300_timer.c + # NB: rate control is bound to the driver by symbol names so only pick one .if ${ATH_RATE} == "sample" .PATH: ${.CURDIR}/../../dev/ath/ath_rate/sample From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 02:05:31 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 276D7E10; Sat, 9 Mar 2013 02:05:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 14A83643; Sat, 9 Mar 2013 02:05:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2925Ut3058283; Sat, 9 Mar 2013 02:05:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2925UQv058279; Sat, 9 Mar 2013 02:05:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303090205.r2925UQv058279@svn.freebsd.org> From: Attilio Rao Date: Sat, 9 Mar 2013 02:05:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248082 - in head/sys: cddl/compat/opensolaris/sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 02:05:31 -0000 Author: attilio Date: Sat Mar 9 02:05:29 2013 New Revision: 248082 URL: http://svnweb.freebsd.org/changeset/base/248082 Log: Merge from vmc-playground: Introduce a new KPI that verifies if the page cache is empty for a specified vm_object. This KPI does not make assumptions about the locking in order to be used also for building assertions at init and destroy time. It is mostly used to hide implementation details of the page cache. Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: alc (vm_radix based version) Tested by: flo, pho, jhb, davide Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Sat Mar 9 01:54:26 2013 (r248081) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Sat Mar 9 02:05:29 2013 (r248082) @@ -76,7 +76,7 @@ vn_is_readonly(vnode_t *vp) #define vn_has_cached_data(vp) \ ((vp)->v_object != NULL && \ ((vp)->v_object->resident_page_count > 0 || \ - (vp)->v_object->cache != NULL)) + !vm_object_cache_is_empty((vp)->v_object))) #define vn_exists(vp) do { } while (0) #define vn_invalid(vp) do { } while (0) #define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0) Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sat Mar 9 01:54:26 2013 (r248081) +++ head/sys/vm/vm_object.c Sat Mar 9 02:05:29 2013 (r248082) @@ -173,7 +173,7 @@ vm_object_zdtor(void *mem, int size, voi ("object %p has reservations", object)); #endif - KASSERT(object->cache == NULL, + KASSERT(vm_object_cache_is_empty(object), ("object %p has cached pages", object)); KASSERT(object->paging_in_progress == 0, @@ -752,7 +752,7 @@ vm_object_terminate(vm_object_t object) if (__predict_false(!LIST_EMPTY(&object->rvq))) vm_reserv_break_all(object); #endif - if (__predict_false(object->cache != NULL)) + if (__predict_false(!vm_object_cache_is_empty(object))) vm_page_cache_free(object, 0, 0); /* @@ -1377,7 +1377,7 @@ retry: * should still be OBJT_DEFAULT and orig_object should not * contain any cached pages within the specified range. */ - if (__predict_false(orig_object->cache != NULL)) + if (__predict_false(!vm_object_cache_is_empty(orig_object))) vm_page_cache_transfer(orig_object, offidxstart, new_object); } @@ -1726,7 +1726,8 @@ vm_object_collapse(vm_object_t object) /* * Free any cached pages from backing_object. */ - if (__predict_false(backing_object->cache != NULL)) + if (__predict_false( + !vm_object_cache_is_empty(backing_object))) vm_page_cache_free(backing_object, 0, 0); } /* @@ -1920,7 +1921,7 @@ again: } vm_object_pip_wakeup(object); skipmemq: - if (__predict_false(object->cache != NULL)) + if (__predict_false(!vm_object_cache_is_empty(object))) vm_page_cache_free(object, start, end); } Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Sat Mar 9 01:54:26 2013 (r248081) +++ head/sys/vm/vm_object.h Sat Mar 9 02:05:29 2013 (r248082) @@ -229,6 +229,13 @@ void vm_object_pip_wakeup(vm_object_t ob void vm_object_pip_wakeupn(vm_object_t object, short i); void vm_object_pip_wait(vm_object_t object, char *waitid); +static __inline boolean_t +vm_object_cache_is_empty(vm_object_t object) +{ + + return (object->cache == NULL); +} + vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, boolean_t); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Mar 9 01:54:26 2013 (r248081) +++ head/sys/vm/vm_page.c Sat Mar 9 02:05:29 2013 (r248082) @@ -1129,7 +1129,7 @@ vm_page_cache_free(vm_object_t object, v boolean_t empty; mtx_lock(&vm_page_queue_free_mtx); - if (__predict_false(object->cache == NULL)) { + if (__predict_false(vm_object_cache_is_empty(object))) { mtx_unlock(&vm_page_queue_free_mtx); return; } @@ -1173,7 +1173,7 @@ vm_page_cache_free(vm_object_t object, v cnt.v_cache_count--; cnt.v_free_count++; } - empty = object->cache == NULL; + empty = vm_object_cache_is_empty(object); mtx_unlock(&vm_page_queue_free_mtx); if (object->type == OBJT_VNODE && empty) vdrop(object->handle); @@ -1257,7 +1257,7 @@ vm_page_cache_transfer(vm_object_t orig_ * not. */ VM_OBJECT_LOCK_ASSERT(new_object, MA_OWNED); - KASSERT(new_object->cache == NULL, + KASSERT(vm_object_cache_is_empty(new_object), ("vm_page_cache_transfer: object %p has cached pages", new_object)); mtx_lock(&vm_page_queue_free_mtx); @@ -1300,7 +1300,7 @@ vm_page_cache_transfer(vm_object_t orig_ m_next->left = m; new_object->cache = m_next; } - KASSERT(new_object->cache == NULL || + KASSERT(vm_object_cache_is_empty(new_object) || new_object->type == OBJT_SWAP, ("vm_page_cache_transfer: object %p's type is incompatible" " with cached pages", new_object)); @@ -1327,7 +1327,7 @@ vm_page_is_cached(vm_object_t object, vm * exist. */ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if (__predict_true(object->cache == NULL)) + if (__predict_true(vm_object_cache_is_empty(object))) return (FALSE); mtx_lock(&vm_page_queue_free_mtx); m = vm_page_cache_lookup(object, pindex); @@ -1465,7 +1465,8 @@ vm_page_alloc(vm_object_t object, vm_pin m->valid = 0; m_object = m->object; vm_page_cache_remove(m); - if (m_object->type == OBJT_VNODE && m_object->cache == NULL) + if (m_object->type == OBJT_VNODE && + vm_object_cache_is_empty(m_object)) vp = m_object->handle; } else { KASSERT(VM_PAGE_IS_FREE(m), @@ -1722,7 +1723,8 @@ vm_page_alloc_init(vm_page_t m) m->valid = 0; m_object = m->object; vm_page_cache_remove(m); - if (m_object->type == OBJT_VNODE && m_object->cache == NULL) + if (m_object->type == OBJT_VNODE && + vm_object_cache_is_empty(m_object)) drop = m_object->handle; } else { KASSERT(VM_PAGE_IS_FREE(m), From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 02:32:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A6EB92B4; Sat, 9 Mar 2013 02:32:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 909A76FF; Sat, 9 Mar 2013 02:32:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r292WRmQ067186; Sat, 9 Mar 2013 02:32:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r292WN6W067161; Sat, 9 Mar 2013 02:32:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303090232.r292WN6W067161@svn.freebsd.org> From: Attilio Rao Date: Sat, 9 Mar 2013 02:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248084 - in head/sys: amd64/amd64 arm/arm cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 02:32:27 -0000 Author: attilio Date: Sat Mar 9 02:32:23 2013 New Revision: 248084 URL: http://svnweb.freebsd.org/changeset/base/248084 Log: Switch the vm_object mutex to be a rwlock. This will enable in the future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c - copied unchanged from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h - copied unchanged from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h head/sys/cddl/compat/opensolaris/sys/vm.h - copied unchanged from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/vm.h Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/pmap.c head/sys/arm/arm/machdep.c head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/compat/linprocfs/linprocfs.c head/sys/conf/files head/sys/dev/agp/agp.c head/sys/dev/agp/agp_i810.c head/sys/dev/drm/drmP.h head/sys/dev/drm2/drmP.h head/sys/dev/drm2/i915/i915_gem.c head/sys/dev/drm2/ttm/ttm_bo_vm.c head/sys/dev/drm2/ttm/ttm_tt.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/dev/md/md.c head/sys/dev/netmap/netmap.c head/sys/dev/sound/pcm/dsp.c head/sys/fs/fuse/fuse_io.c head/sys/fs/fuse/fuse_vnops.c head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/procfs/procfs_map.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/i386/i386/machdep.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/pmap.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/kern/kern_proc.c head/sys/kern/kern_sharedpage.c head/sys/kern/kern_shutdown.c head/sys/kern/subr_uio.c head/sys/kern/sys_process.c head/sys/kern/sysv_shm.c head/sys/kern/uipc_shm.c head/sys/kern/uipc_syscalls.c head/sys/kern/vfs_aio.c head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/kern/vfs_default.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/mips/mips/machdep.c head/sys/mips/mips/pmap.c head/sys/modules/zfs/Makefile head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsserver/nfs_serv.c head/sys/ofed/drivers/infiniband/core/umem.c head/sys/ofed/include/linux/linux_compat.c head/sys/pc98/pc98/machdep.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/machdep.c head/sys/powerpc/booke/pmap.c head/sys/security/mac/mac_process.c head/sys/sparc64/sparc64/machdep.c head/sys/sparc64/sparc64/pmap.c head/sys/ufs/ffs/ffs_rawread.c head/sys/ufs/ffs/ffs_vnops.c head/sys/vm/default_pager.c head/sys/vm/device_pager.c head/sys/vm/phys_pager.c head/sys/vm/sg_pager.c head/sys/vm/swap_pager.c head/sys/vm/uma_core.c head/sys/vm/vm_fault.c head/sys/vm/vm_glue.c head/sys/vm/vm_init.c head/sys/vm/vm_kern.c head/sys/vm/vm_map.c head/sys/vm/vm_meter.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pager.c head/sys/vm/vm_pager.h head/sys/vm/vm_reserv.c head/sys/vm/vnode_pager.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/amd64/amd64/machdep.c Sat Mar 9 02:32:23 2013 (r248084) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #ifdef SMP Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/amd64/amd64/pmap.c Sat Mar 9 02:32:23 2013 (r248084) @@ -3493,7 +3493,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == 0) - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); pa = VM_PAGE_TO_PHYS(m); newpte = (pt_entry_t)(pa | PG_A | PG_V); if ((access & VM_PROT_WRITE) != 0) @@ -3760,7 +3760,7 @@ pmap_enter_object(pmap_t pmap, vm_offset vm_page_t m, mpte; vm_pindex_t diff, psize; - VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m_start->object); psize = atop(end - start); mpte = NULL; m = m_start; @@ -3942,7 +3942,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs vm_page_t p, pdpg; int pat_mode; - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); if ((addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) { @@ -4556,7 +4556,7 @@ pmap_is_modified(vm_page_t m) * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PG_M set. */ - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); @@ -4687,7 +4687,7 @@ pmap_remove_write(vm_page_t m) * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return; @@ -4831,7 +4831,7 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT((m->oflags & VPO_BUSY) == 0, ("pmap_clear_modify: page %p is busy", m)); Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/arm/arm/machdep.c Sat Mar 9 02:32:23 2013 (r248084) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/arm/arm/pmap-v6.c Sat Mar 9 02:32:23 2013 (r248084) @@ -2212,7 +2212,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs vm_pindex_t pindex, vm_size_t size) { - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); } @@ -3428,7 +3428,7 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT((m->oflags & VPO_BUSY) == 0, ("pmap_clear_modify: page %p is busy", m)); @@ -3475,7 +3475,7 @@ pmap_remove_write(vm_page_t m) * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); if ((m->oflags & VPO_BUSY) != 0 || (m->aflags & PGA_WRITEABLE) != 0) pmap_clearbit(m, PVF_WRITE); Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/arm/arm/pmap.c Sat Mar 9 02:32:23 2013 (r248084) @@ -3006,7 +3006,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs vm_pindex_t pindex, vm_size_t size) { - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(object); KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); } @@ -4461,7 +4461,7 @@ pmap_clear_modify(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_modify: page %p is not managed", m)); - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); KASSERT((m->oflags & VPO_BUSY) == 0, ("pmap_clear_modify: page %p is busy", m)); @@ -4523,7 +4523,7 @@ pmap_remove_write(vm_page_t m) * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(m->object); if ((m->oflags & VPO_BUSY) != 0 || (m->aflags & PGA_WRITEABLE) != 0) pmap_clearbit(m, PVF_WRITE); Copied: head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c (from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c Sat Mar 9 02:32:23 2013 (r248084, copy of r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c) @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2013 EMC Corp. + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +const int zfs_vm_pagerret_bad = VM_PAGER_BAD; +const int zfs_vm_pagerret_error = VM_PAGER_ERROR; +const int zfs_vm_pagerret_ok = VM_PAGER_OK; + +void +zfs_vmobject_assert_wlocked(vm_object_t object) +{ + + /* + * This is not ideal because FILE/LINE used by assertions will not + * be too helpful, but it must be an hard function for + * compatibility reasons. + */ + VM_OBJECT_ASSERT_WLOCKED(object); +} + +void +zfs_vmobject_wlock(vm_object_t object) +{ + + VM_OBJECT_WLOCK(object); +} + +void +zfs_vmobject_wunlock(vm_object_t object) +{ + + VM_OBJECT_WUNLOCK(object); +} Copied: head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h (from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h Sat Mar 9 02:32:23 2013 (r248084, copy of r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/freebsd_rwlock.h) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2013 EMC Corp. + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SYS_FREEBSD_RWLOCK_H_ +#define _OPENSOLARIS_SYS_FREEBSD_RWLOCK_H_ + +#include_next + +#endif Copied: head/sys/cddl/compat/opensolaris/sys/vm.h (from r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/vm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/sys/vm.h Sat Mar 9 02:32:23 2013 (r248084, copy of r248082, user/attilio/vmobj-rwlock/sys/cddl/compat/opensolaris/sys/vm.h) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2013 EMC Corp. + * 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 AUTHORS 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 AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SYS_VM_H_ +#define _OPENSOLARIS_SYS_VM_H_ + +#ifdef _KERNEL + +extern const int zfs_vm_pagerret_bad; +extern const int zfs_vm_pagerret_error; +extern const int zfs_vm_pagerret_ok; + +void zfs_vmobject_assert_wlocked(vm_object_t object); +void zfs_vmobject_wlock(vm_object_t object); +void zfs_vmobject_wunlock(vm_object_t object); + +#endif /* _KERNEL */ + +#endif /* _OPENSOLARIS_SYS_VM_H_ */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Sat Mar 9 02:32:23 2013 (r248084) @@ -103,7 +103,6 @@ extern "C" { #include #include #include -#include #include #include /* There is clash. vm_map.h defines the two below and vdev_cache.c use them. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Mar 9 02:32:23 2013 (r248084) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -329,7 +330,7 @@ page_busy(vnode_t *vp, int64_t start, in vm_page_t pp; obj = vp->v_object; - VM_OBJECT_LOCK_ASSERT(obj, MA_OWNED); + zfs_vmobject_assert_wlocked(obj); for (;;) { if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && @@ -377,7 +378,7 @@ page_hold(vnode_t *vp, int64_t start) vm_page_t pp; obj = vp->v_object; - VM_OBJECT_LOCK_ASSERT(obj, MA_OWNED); + zfs_vmobject_assert_wlocked(obj); for (;;) { if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && @@ -450,7 +451,7 @@ update_pages(vnode_t *vp, int64_t start, ASSERT(obj != NULL); off = start & PAGEOFFSET; - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); for (start &= PAGEMASK; len > 0; start += PAGESIZE) { vm_page_t pp; int nbytes = imin(PAGESIZE - off, len); @@ -467,23 +468,23 @@ update_pages(vnode_t *vp, int64_t start, ("zfs update_pages: unbusy page in putpages case")); KASSERT(!pmap_page_is_write_mapped(pp), ("zfs update_pages: writable page in putpages case")); - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); (void) dmu_write(os, oid, start, nbytes, va, tx); zfs_unmap_page(sf); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); vm_page_undirty(pp); } else if ((pp = page_busy(vp, start, off, nbytes)) != NULL) { - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); (void) dmu_read(os, oid, start+off, nbytes, va+off, DMU_READ_PREFETCH);; zfs_unmap_page(sf); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); page_unbusy(pp); } len -= nbytes; @@ -491,7 +492,7 @@ update_pages(vnode_t *vp, int64_t start, } if (segflg != UIO_NOCOPY) vm_object_pip_wakeupn(obj, 0); - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); } /* @@ -523,7 +524,7 @@ mappedread_sf(vnode_t *vp, int nbytes, u ASSERT(obj != NULL); ASSERT((uio->uio_loffset & PAGEOFFSET) == 0); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); for (start = uio->uio_loffset; len > 0; start += PAGESIZE) { int bytes = MIN(PAGESIZE, len); @@ -531,14 +532,14 @@ mappedread_sf(vnode_t *vp, int nbytes, u VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_IGN_SBUSY); if (pp->valid == 0) { vm_page_io_start(pp); - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); error = dmu_read(os, zp->z_id, start, bytes, va, DMU_READ_PREFETCH); if (bytes != PAGESIZE && error == 0) bzero(va + bytes, PAGESIZE - bytes); zfs_unmap_page(sf); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); vm_page_io_finish(pp); vm_page_lock(pp); if (error) { @@ -555,7 +556,7 @@ mappedread_sf(vnode_t *vp, int nbytes, u uio->uio_offset += bytes; len -= bytes; } - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); return (error); } @@ -587,7 +588,7 @@ mappedread(vnode_t *vp, int nbytes, uio_ start = uio->uio_loffset; off = start & PAGEOFFSET; - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); for (start &= PAGEMASK; len > 0; start += PAGESIZE) { vm_page_t pp; uint64_t bytes = MIN(PAGESIZE - off, len); @@ -596,23 +597,23 @@ mappedread(vnode_t *vp, int nbytes, uio_ struct sf_buf *sf; caddr_t va; - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); va = zfs_map_page(pp, &sf); error = uiomove(va + off, bytes, UIO_READ, uio); zfs_unmap_page(sf); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); page_unhold(pp); } else { - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); error = dmu_read_uio(os, zp->z_id, uio, bytes); - VM_OBJECT_LOCK(obj); + zfs_vmobject_wlock(obj); } len -= bytes; off = 0; if (error) break; } - VM_OBJECT_UNLOCK(obj); + zfs_vmobject_wunlock(obj); return (error); } @@ -5684,7 +5685,7 @@ zfs_getpages(struct vnode *vp, vm_page_t mfirst = m[reqstart]; mlast = m[reqstart + reqsize - 1]; - VM_OBJECT_LOCK(object); + zfs_vmobject_wlock(object); for (i = 0; i < reqstart; i++) { vm_page_lock(m[i]); @@ -5700,9 +5701,9 @@ zfs_getpages(struct vnode *vp, vm_page_t if (mreq->valid && reqsize == 1) { if (mreq->valid != VM_PAGE_BITS_ALL) vm_page_zero_invalid(mreq, TRUE); - VM_OBJECT_UNLOCK(object); + zfs_vmobject_wunlock(object); ZFS_EXIT(zfsvfs); - return (VM_PAGER_OK); + return (zfs_vm_pagerret_ok); } PCPU_INC(cnt.v_vnodein); @@ -5716,16 +5717,16 @@ zfs_getpages(struct vnode *vp, vm_page_t vm_page_unlock(m[i]); } } - VM_OBJECT_UNLOCK(object); + zfs_vmobject_wunlock(object); ZFS_EXIT(zfsvfs); - return (VM_PAGER_BAD); + return (zfs_vm_pagerret_bad); } lsize = PAGE_SIZE; if (IDX_TO_OFF(mlast->pindex) + lsize > object->un_pager.vnp.vnp_size) lsize = object->un_pager.vnp.vnp_size - IDX_TO_OFF(mlast->pindex); - VM_OBJECT_UNLOCK(object); + zfs_vmobject_wunlock(object); for (i = reqstart; i < reqstart + reqsize; i++) { size = PAGE_SIZE; @@ -5741,7 +5742,7 @@ zfs_getpages(struct vnode *vp, vm_page_t break; } - VM_OBJECT_LOCK(object); + zfs_vmobject_wlock(object); for (i = reqstart; i < reqstart + reqsize; i++) { if (!error) @@ -5751,11 +5752,11 @@ zfs_getpages(struct vnode *vp, vm_page_t vm_page_readahead_finish(m[i]); } - VM_OBJECT_UNLOCK(object); + zfs_vmobject_wunlock(object); ZFS_ACCESSTIME_STAMP(zfsvfs, zp); ZFS_EXIT(zfsvfs); - return (error ? VM_PAGER_ERROR : VM_PAGER_OK); + return (error ? zfs_vm_pagerret_error : zfs_vm_pagerret_ok); } static int Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/compat/linprocfs/linprocfs.c Sat Mar 9 02:32:23 2013 (r248084) @@ -1031,9 +1031,9 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) e_end = entry->end; obj = entry->object.vm_object; for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { - VM_OBJECT_LOCK(tobj); + VM_OBJECT_WLOCK(tobj); if (lobj != obj) - VM_OBJECT_UNLOCK(lobj); + VM_OBJECT_WUNLOCK(lobj); lobj = tobj; } last_timestamp = map->timestamp; @@ -1049,11 +1049,11 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) else vp = NULL; if (lobj != obj) - VM_OBJECT_UNLOCK(lobj); + VM_OBJECT_WUNLOCK(lobj); flags = obj->flags; ref_count = obj->ref_count; shadow_count = obj->shadow_count; - VM_OBJECT_UNLOCK(obj); + VM_OBJECT_WUNLOCK(obj); if (vp) { vn_fullpath(td, vp, &name, &freename); vn_lock(vp, LK_SHARED | LK_RETRY); Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/conf/files Sat Mar 9 02:32:23 2013 (r248084) @@ -157,6 +157,7 @@ cddl/compat/opensolaris/kern/opensolaris cddl/compat/opensolaris/kern/opensolaris_taskq.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_uio.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_vfs.c optional zfs compile-with "${ZFS_C}" +cddl/compat/opensolaris/kern/opensolaris_vm.c optional zfs compile-with "${ZFS_C}" cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/agp/agp.c Sat Mar 9 02:32:23 2013 (r248084) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -544,7 +545,7 @@ agp_generic_bind_memory(device_t dev, st * because vm_page_grab() may sleep and we can't hold a mutex * while sleeping. */ - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); for (i = 0; i < mem->am_size; i += PAGE_SIZE) { /* * Find a page from the object and wire it @@ -557,14 +558,14 @@ agp_generic_bind_memory(device_t dev, st VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY); AGP_DPF("found page pa=%#jx\n", (uintmax_t)VM_PAGE_TO_PHYS(m)); } - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); mtx_lock(&sc->as_lock); if (mem->am_is_bound) { device_printf(dev, "memory already bound\n"); error = EINVAL; - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); i = 0; goto bad; } @@ -573,7 +574,7 @@ agp_generic_bind_memory(device_t dev, st * Bind the individual pages and flush the chipset's * TLB. */ - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); for (i = 0; i < mem->am_size; i += PAGE_SIZE) { m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(i)); @@ -601,7 +602,7 @@ agp_generic_bind_memory(device_t dev, st } vm_page_wakeup(m); } - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); /* * Flush the cpu cache since we are providing a new mapping @@ -622,7 +623,7 @@ agp_generic_bind_memory(device_t dev, st return 0; bad: mtx_unlock(&sc->as_lock); - VM_OBJECT_LOCK_ASSERT(mem->am_obj, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(mem->am_obj); for (k = 0; k < mem->am_size; k += PAGE_SIZE) { m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(k)); if (k >= i) @@ -631,7 +632,7 @@ bad: vm_page_unwire(m, 0); vm_page_unlock(m); } - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); return error; } @@ -658,14 +659,14 @@ agp_generic_unbind_memory(device_t dev, */ for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE) AGP_UNBIND_PAGE(dev, mem->am_offset + i); - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); for (i = 0; i < mem->am_size; i += PAGE_SIZE) { m = vm_page_lookup(mem->am_obj, atop(i)); vm_page_lock(m); vm_page_unwire(m, 0); vm_page_unlock(m); } - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); agp_flush_cache(); AGP_FLUSH_TLB(dev); Modified: head/sys/dev/agp/agp_i810.c ============================================================================== --- head/sys/dev/agp/agp_i810.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/agp/agp_i810.c Sat Mar 9 02:32:23 2013 (r248084) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1967,10 +1968,10 @@ agp_i810_alloc_memory(device_t dev, int * Allocate and wire down the page now so that we can * get its physical address. */ - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); m = vm_page_grab(mem->am_obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY); - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); mem->am_physical = VM_PAGE_TO_PHYS(m); } else { /* Our allocation is already nicely wired down for us. @@ -2005,12 +2006,12 @@ agp_i810_free_memory(device_t dev, struc /* * Unwire the page which we wired in alloc_memory. */ - VM_OBJECT_LOCK(mem->am_obj); + VM_OBJECT_WLOCK(mem->am_obj); m = vm_page_lookup(mem->am_obj, 0); vm_page_lock(m); vm_page_unwire(m, 0); vm_page_unlock(m); - VM_OBJECT_UNLOCK(mem->am_obj); + VM_OBJECT_WUNLOCK(mem->am_obj); } else { contigfree(sc->argb_cursor, mem->am_size, M_AGP); sc->argb_cursor = NULL; Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/drm/drmP.h Sat Mar 9 02:32:23 2013 (r248084) @@ -59,6 +59,7 @@ struct drm_file; #include #include #include +#include #include #include #include Modified: head/sys/dev/drm2/drmP.h ============================================================================== --- head/sys/dev/drm2/drmP.h Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/drm2/drmP.h Sat Mar 9 02:32:23 2013 (r248084) @@ -58,6 +58,7 @@ struct drm_file; #include #include #include +#include #include #include #include Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/drm2/i915/i915_gem.c Sat Mar 9 02:32:23 2013 (r248084) @@ -990,14 +990,14 @@ i915_gem_swap_io(struct drm_device *dev, vm_obj = obj->base.vm_obj; ret = 0; - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); vm_object_pip_add(vm_obj, 1); while (size > 0) { obj_pi = OFF_TO_IDX(offset); obj_po = offset & PAGE_MASK; m = i915_gem_wire_page(vm_obj, obj_pi); - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); sched_pin(); sf = sf_buf_alloc(m, SFB_CPUPRIVATE); @@ -1031,7 +1031,7 @@ i915_gem_swap_io(struct drm_device *dev, } sf_buf_free(sf); sched_unpin(); - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); if (rw == UIO_WRITE) vm_page_dirty(m); vm_page_reference(m); @@ -1044,7 +1044,7 @@ i915_gem_swap_io(struct drm_device *dev, break; } vm_object_pip_wakeup(vm_obj); - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); return (ret); } @@ -1357,7 +1357,7 @@ i915_gem_pager_fault(vm_object_t vm_obj, } else oldm = NULL; retry: - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); unlocked_vmobj: cause = ret = 0; m = NULL; @@ -1407,7 +1407,7 @@ unlocked_vmobj: list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list); obj->fault_mappable = true; - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); m = vm_phys_fictitious_to_vm_page(dev->agp->base + obj->gtt_offset + offset); if (m == NULL) { @@ -1452,7 +1452,7 @@ out: kern_yield(PRI_USER); goto unlocked_vmobj; } - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); vm_object_pip_wakeup(vm_obj); return (VM_PAGER_ERROR); } @@ -2208,12 +2208,12 @@ i915_gem_object_get_pages_gtt(struct drm obj->pages = malloc(page_count * sizeof(vm_page_t), DRM_I915_GEM, M_WAITOK); vm_obj = obj->base.vm_obj; - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); for (i = 0; i < page_count; i++) { if ((obj->pages[i] = i915_gem_wire_page(vm_obj, i)) == NULL) goto failed; } - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); if (i915_gem_object_needs_bit17_swizzle(obj)) i915_gem_object_do_bit_17_swizzle(obj); return (0); @@ -2226,7 +2226,7 @@ failed: vm_page_unlock(m); atomic_add_long(&i915_gem_wired_pages_cnt, -1); } - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); free(obj->pages, DRM_I915_GEM); obj->pages = NULL; return (-EIO); @@ -2272,7 +2272,7 @@ i915_gem_object_put_pages_gtt(struct drm if (obj->madv == I915_MADV_DONTNEED) obj->dirty = 0; page_count = obj->base.size / PAGE_SIZE; - VM_OBJECT_LOCK(obj->base.vm_obj); + VM_OBJECT_WLOCK(obj->base.vm_obj); #if GEM_PARANOID_CHECK_GTT i915_gem_assert_pages_not_mapped(obj->base.dev, obj->pages, page_count); #endif @@ -2287,7 +2287,7 @@ i915_gem_object_put_pages_gtt(struct drm vm_page_unlock(m); atomic_add_long(&i915_gem_wired_pages_cnt, -1); } - VM_OBJECT_UNLOCK(obj->base.vm_obj); + VM_OBJECT_WUNLOCK(obj->base.vm_obj); obj->dirty = 0; free(obj->pages, DRM_I915_GEM); obj->pages = NULL; @@ -2309,7 +2309,7 @@ i915_gem_release_mmap(struct drm_i915_ge if (devobj != NULL) { page_count = OFF_TO_IDX(obj->base.size); - VM_OBJECT_LOCK(devobj); + VM_OBJECT_WLOCK(devobj); retry: for (i = 0; i < page_count; i++) { m = vm_page_lookup(devobj, i); @@ -2319,7 +2319,7 @@ retry: goto retry; cdev_pager_free_page(devobj, m); } - VM_OBJECT_UNLOCK(devobj); + VM_OBJECT_WUNLOCK(devobj); vm_object_deallocate(devobj); } @@ -2437,9 +2437,9 @@ i915_gem_object_truncate(struct drm_i915 vm_object_t vm_obj; vm_obj = obj->base.vm_obj; - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); vm_object_page_remove(vm_obj, 0, 0, false); - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); obj->madv = I915_MADV_PURGED_INTERNAL; } @@ -2488,7 +2488,7 @@ i915_gem_wire_page(vm_object_t object, v vm_page_t m; int rv; - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + VM_OBJECT_ASSERT_WLOCKED(object); m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(object, pindex, NULL, NULL)) { @@ -3567,13 +3567,13 @@ i915_gem_detach_phys_object(struct drm_d vaddr = obj->phys_obj->handle->vaddr; page_count = obj->base.size / PAGE_SIZE; - VM_OBJECT_LOCK(obj->base.vm_obj); + VM_OBJECT_WLOCK(obj->base.vm_obj); for (i = 0; i < page_count; i++) { m = i915_gem_wire_page(obj->base.vm_obj, i); if (m == NULL) continue; /* XXX */ - VM_OBJECT_UNLOCK(obj->base.vm_obj); + VM_OBJECT_WUNLOCK(obj->base.vm_obj); sf = sf_buf_alloc(m, 0); if (sf != NULL) { dst = (char *)sf_buf_kva(sf); @@ -3582,7 +3582,7 @@ i915_gem_detach_phys_object(struct drm_d } drm_clflush_pages(&m, 1); - VM_OBJECT_LOCK(obj->base.vm_obj); + VM_OBJECT_WLOCK(obj->base.vm_obj); vm_page_reference(m); vm_page_lock(m); vm_page_dirty(m); @@ -3590,7 +3590,7 @@ i915_gem_detach_phys_object(struct drm_d vm_page_unlock(m); atomic_add_long(&i915_gem_wired_pages_cnt, -1); } - VM_OBJECT_UNLOCK(obj->base.vm_obj); + VM_OBJECT_WUNLOCK(obj->base.vm_obj); intel_gtt_chipset_flush(); obj->phys_obj->cur_obj = NULL; @@ -3632,7 +3632,7 @@ i915_gem_attach_phys_object(struct drm_d page_count = obj->base.size / PAGE_SIZE; - VM_OBJECT_LOCK(obj->base.vm_obj); + VM_OBJECT_WLOCK(obj->base.vm_obj); ret = 0; for (i = 0; i < page_count; i++) { m = i915_gem_wire_page(obj->base.vm_obj, i); @@ -3640,14 +3640,14 @@ i915_gem_attach_phys_object(struct drm_d ret = -EIO; break; } - VM_OBJECT_UNLOCK(obj->base.vm_obj); + VM_OBJECT_WUNLOCK(obj->base.vm_obj); sf = sf_buf_alloc(m, 0); src = (char *)sf_buf_kva(sf); dst = (char *)obj->phys_obj->handle->vaddr + IDX_TO_OFF(i); memcpy(dst, src, PAGE_SIZE); sf_buf_free(sf); - VM_OBJECT_LOCK(obj->base.vm_obj); + VM_OBJECT_WLOCK(obj->base.vm_obj); vm_page_reference(m); vm_page_lock(m); @@ -3655,7 +3655,7 @@ i915_gem_attach_phys_object(struct drm_d vm_page_unlock(m); atomic_add_long(&i915_gem_wired_pages_cnt, -1); } - VM_OBJECT_UNLOCK(obj->base.vm_obj); + VM_OBJECT_WUNLOCK(obj->base.vm_obj); return (0); } Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/drm2/ttm/ttm_bo_vm.c Sat Mar 9 02:32:23 2013 (r248084) @@ -118,7 +118,7 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_o } else oldm = NULL; retry: - VM_OBJECT_UNLOCK(vm_obj); + VM_OBJECT_WUNLOCK(vm_obj); m = NULL; reserve: @@ -213,7 +213,7 @@ reserve: VM_MEMATTR_WRITE_BACK : ttm_io_prot(bo->mem.placement)); } - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); if ((m->flags & VPO_BUSY) != 0) { vm_page_sleep(m, "ttmpbs"); ttm_mem_io_unlock(man); @@ -241,11 +241,11 @@ out_unlock1: return (retval); out_io_unlock: - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); goto out_io_unlock1; out_unlock: - VM_OBJECT_LOCK(vm_obj); + VM_OBJECT_WLOCK(vm_obj); goto out_unlock1; } Modified: head/sys/dev/drm2/ttm/ttm_tt.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_tt.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/drm2/ttm/ttm_tt.c Sat Mar 9 02:32:23 2013 (r248084) @@ -285,7 +285,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) obj = ttm->swap_storage; - VM_OBJECT_LOCK(obj); + VM_OBJECT_WLOCK(obj); vm_object_pip_add(obj, 1); for (i = 0; i < ttm->num_pages; ++i) { from_page = vm_page_grab(obj, i, VM_ALLOC_RETRY); @@ -312,7 +312,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) vm_page_wakeup(from_page); } vm_object_pip_wakeup(obj); - VM_OBJECT_UNLOCK(obj); + VM_OBJECT_WUNLOCK(obj); if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP)) vm_object_deallocate(obj); @@ -322,7 +322,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) err_ret: vm_object_pip_wakeup(obj); - VM_OBJECT_UNLOCK(obj); + VM_OBJECT_WUNLOCK(obj); return (ret); } @@ -346,7 +346,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, v } else obj = persistent_swap_storage; - VM_OBJECT_LOCK(obj); + VM_OBJECT_WLOCK(obj); vm_object_pip_add(obj, 1); for (i = 0; i < ttm->num_pages; ++i) { from_page = ttm->pages[i]; @@ -359,7 +359,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, v vm_page_wakeup(to_page); } vm_object_pip_wakeup(obj); - VM_OBJECT_UNLOCK(obj); + VM_OBJECT_WUNLOCK(obj); ttm->bdev->driver->ttm_tt_unpopulate(ttm); ttm->swap_storage = obj; Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Mar 9 02:13:24 2013 (r248083) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Mar 9 02:32:23 2013 (r248084) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 05:20:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8FC2A6E1; Sat, 9 Mar 2013 05:20:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 69AD5BE4; Sat, 9 Mar 2013 05:20:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r295KY4J018308; Sat, 9 Mar 2013 05:20:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r295KYU4018307; Sat, 9 Mar 2013 05:20:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303090520.r295KYU4018307@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Mar 2013 05:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248089 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 05:20:34 -0000 Author: adrian Date: Sat Mar 9 05:20:33 2013 New Revision: 248089 URL: http://svnweb.freebsd.org/changeset/base/248089 Log: Fix non-invariant compilation. Modified: head/sys/net80211/ieee80211_mesh.c Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Sat Mar 9 03:19:53 2013 (r248088) +++ head/sys/net80211/ieee80211_mesh.c Sat Mar 9 05:20:33 2013 (r248089) @@ -1477,10 +1477,9 @@ mesh_recv_indiv_data_to_fwrd(struct ieee struct ieee80211_qosframe_addr4 *qwh; struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt_meshda, *rt_meshsa; - struct ieee80211com *ic = vap->iv_ic; /* This is called from the RX path - don't hold this lock */ - IEEE80211_TX_UNLOCK_ASSERT(ic); + IEEE80211_TX_UNLOCK_ASSERT(vap->iv_ic); qwh = (struct ieee80211_qosframe_addr4 *)wh; @@ -1536,11 +1535,10 @@ mesh_recv_indiv_data_to_me(struct ieee80 const struct ieee80211_meshcntl_ae10 *mc10; struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_mesh_route *rt; - struct ieee80211com *ic = vap->iv_ic; int ae; /* This is called from the RX path - don't hold this lock */ - IEEE80211_TX_UNLOCK_ASSERT(ic); + IEEE80211_TX_UNLOCK_ASSERT(vap->iv_ic); qwh = (struct ieee80211_qosframe_addr4 *)wh; mc10 = (const struct ieee80211_meshcntl_ae10 *)mc; @@ -1603,10 +1601,9 @@ mesh_recv_group_data(struct ieee80211vap { #define MC01(mc) ((const struct ieee80211_meshcntl_ae01 *)mc) struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211com *ic = vap->iv_ic; /* This is called from the RX path - don't hold this lock */ - IEEE80211_TX_UNLOCK_ASSERT(ic); + IEEE80211_TX_UNLOCK_ASSERT(vap->iv_ic); mesh_forward(vap, m, mc); From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 06:11:59 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0A0F6E9F; Sat, 9 Mar 2013 06:11:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D76BAD52; Sat, 9 Mar 2013 06:11:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r296Bwml035021; Sat, 9 Mar 2013 06:11:58 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r296BwGh035020; Sat, 9 Mar 2013 06:11:58 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303090611.r296BwGh035020@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Mar 2013 06:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248090 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 06:11:59 -0000 Author: adrian Date: Sat Mar 9 06:11:58 2013 New Revision: 248090 URL: http://svnweb.freebsd.org/changeset/base/248090 Log: Print out the queue flags during a TX DMA shutdown. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Mar 9 05:20:33 2013 (r248089) +++ head/sys/dev/ath/if_ath.c Sat Mar 9 06:11:58 2013 (r248090) @@ -4342,9 +4342,12 @@ ath_tx_stopdma(struct ath_softc *sc, str { struct ath_hal *ah = sc->sc_ah; - DPRINTF(sc, ATH_DEBUG_RESET, "%s: tx queue [%u] %p, link %p\n", - __func__, txq->axq_qnum, + DPRINTF(sc, ATH_DEBUG_RESET, + "%s: tx queue [%u] %p, flags 0x%08x, link %p\n", + __func__, + txq->axq_qnum, (caddr_t)(uintptr_t) ath_hal_gettxbuf(ah, txq->axq_qnum), + txq->axq_flags, txq->axq_link); (void) ath_hal_stoptxdma(ah, txq->axq_qnum); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 08:50:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E449FC6B; Sat, 9 Mar 2013 08:50:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99FF9609; Sat, 9 Mar 2013 08:50:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r298oHBR082396; Sat, 9 Mar 2013 08:50:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r298oHjn082395; Sat, 9 Mar 2013 08:50:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303090850.r298oHjn082395@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Mar 2013 08:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248091 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 08:50:18 -0000 Author: adrian Date: Sat Mar 9 08:50:17 2013 New Revision: 248091 URL: http://svnweb.freebsd.org/changeset/base/248091 Log: Disable the hw TID != buffer TID check. I can 100% reliably trigger this on TID 1 traffic by using iperf -S 32 to create traffic that maps to TID 1. The reference driver doesn't do this check. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sat Mar 9 06:11:58 2013 (r248090) +++ head/sys/dev/ath/if_ath_tx.c Sat Mar 9 08:50:17 2013 (r248091) @@ -4340,12 +4340,23 @@ ath_tx_aggr_comp_aggr(struct ath_softc * __func__, tap->txa_start, tx_ok, ts.ts_status, ts.ts_flags, isaggr, seq_st, hasba, ba[0], ba[1]); + /* + * The reference driver doesn't do this; it simply ignores + * this check in its entirety. + * + * I've seen this occur when using iperf to send traffic + * out tid 1 - the aggregate frames are all marked as TID 1, + * but the TXSTATUS has TID=0. So, let's just ignore this + * check. + */ +#if 0 /* Occasionally, the MAC sends a tx status for the wrong TID. */ if (tid != ts.ts_tid) { device_printf(sc->sc_dev, "%s: tid %d != hw tid %d\n", __func__, tid, ts.ts_tid); tx_ok = 0; } +#endif /* AR5416 BA bug; this requires an interface reset */ if (isaggr && tx_ok && (! hasba)) { From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 09:07:13 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E68C72CA; Sat, 9 Mar 2013 09:07:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D93FB69B; Sat, 9 Mar 2013 09:07:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2997DjQ086807; Sat, 9 Mar 2013 09:07:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2997DjA086805; Sat, 9 Mar 2013 09:07:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201303090907.r2997DjA086805@svn.freebsd.org> From: Alexander Motin Date: Sat, 9 Mar 2013 09:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248092 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 09:07:14 -0000 Author: mav Date: Sat Mar 9 09:07:13 2013 New Revision: 248092 URL: http://svnweb.freebsd.org/changeset/base/248092 Log: Rework overflow checks of r247898 to not let too "intelligent" compiler to optimize it out. Submitted by: bde Modified: head/sys/kern/kern_event.c head/sys/kern/sys_generic.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Sat Mar 9 08:50:17 2013 (r248091) +++ head/sys/kern/kern_event.c Sat Mar 9 09:07:13 2013 (r248092) @@ -1329,12 +1329,13 @@ kqueue_scan(struct kqueue *kq, int maxev goto done_nl; } if (timespecisset(tsp)) { - if (tsp->tv_sec < INT32_MAX) { + if (tsp->tv_sec <= INT32_MAX) { rsbt = tstosbt(*tsp); if (TIMESEL(&asbt, rsbt)) asbt += tc_tick_sbt; - asbt += rsbt; - if (asbt < rsbt) + if (asbt <= INT64_MAX - rsbt) + asbt += rsbt; + else asbt = 0; rsbt >>= tc_precexp; } else Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sat Mar 9 08:50:17 2013 (r248091) +++ head/sys/kern/sys_generic.c Sat Mar 9 09:07:13 2013 (r248092) @@ -1051,16 +1051,17 @@ kern_select(struct thread *td, int nd, f error = EINVAL; goto done; } - if (rtv.tv_sec == 0 && rtv.tv_usec == 0) + if (!timevalisset(&rtv)) asbt = 0; - else if (rtv.tv_sec < INT32_MAX) { + else if (rtv.tv_sec <= INT32_MAX) { rsbt = tvtosbt(rtv); precision = rsbt; precision >>= tc_precexp; if (TIMESEL(&asbt, rsbt)) asbt += tc_tick_sbt; - asbt += rsbt; - if (asbt < rsbt) + if (asbt <= INT64_MAX - rsbt) + asbt += rsbt; + else asbt = -1; } else asbt = -1; From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 10:16:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0BDDA3C2; Sat, 9 Mar 2013 10:16:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F138A8E4; Sat, 9 Mar 2013 10:16:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29AG8lY008041; Sat, 9 Mar 2013 10:16:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29AG8jK008040; Sat, 9 Mar 2013 10:16:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303091016.r29AG8jK008040@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 9 Mar 2013 10:16:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248093 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 10:16:09 -0000 Author: kib Date: Sat Mar 9 10:16:08 2013 New Revision: 248093 URL: http://svnweb.freebsd.org/changeset/base/248093 Log: Correct the lock class for the vm object lock. Reported and tested by: joel Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Mar 9 09:07:13 2013 (r248092) +++ head/sys/kern/subr_witness.c Sat Mar 9 10:16:08 2013 (r248093) @@ -602,7 +602,7 @@ static struct witness_order_list_entry o * VM */ { "vm map (user)", &lock_class_sx }, - { "vm object", &lock_class_mtx_sleep }, + { "vm object", &lock_class_rw }, { "vm page", &lock_class_mtx_sleep }, { "vm page queue", &lock_class_mtx_sleep }, { "pmap pv global", &lock_class_rw }, From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 11:48:14 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F152C6FC; Sat, 9 Mar 2013 11:48:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 6C41BB37; Sat, 9 Mar 2013 11:48:12 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r29Bm4RL078693; Sat, 9 Mar 2013 15:48:04 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r29Bm4ah078692; Sat, 9 Mar 2013 15:48:04 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 9 Mar 2013 15:48:04 +0400 From: Gleb Smirnoff To: Alexey Dokuchaev Subject: Re: svn commit: r247910 - head/sys/dev/sound/pci/hda Message-ID: <20130309114804.GI48089@FreeBSD.org> References: <201303070754.r277soET065603@svn.freebsd.org> <20130308020050.GC83162@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20130308020050.GC83162@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 11:48:14 -0000 On Fri, Mar 08, 2013 at 02:00:50AM +0000, Alexey Dokuchaev wrote: A> On Thu, Mar 07, 2013 at 07:54:50AM +0000, Gleb Smirnoff wrote: A> > New Revision: 247910 A> > URL: http://svnweb.freebsd.org/changeset/base/247910 A> > A> > Log: A> > Plug a memory leak. A> > A> > Reviewed by: mav A> > Sponsored by: Nginx, Inc. A> A> Any MFCs planned? Yes, to stable/9. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 12:45:37 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D02CBBC1; Sat, 9 Mar 2013 12:45:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8FC1CEFB; Sat, 9 Mar 2013 12:45:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29Cjbq1054005; Sat, 9 Mar 2013 12:45:37 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29Cjbr3054004; Sat, 9 Mar 2013 12:45:37 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303091245.r29Cjbr3054004@svn.freebsd.org> From: Attilio Rao Date: Sat, 9 Mar 2013 12:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248097 - in head: . lib/libncp lib/libprocstat share/examples/nwclient sys/fs/nwfs sys/modules/ncp sys/modules/nwfs sys/netncp usr.bin/ncplist usr.bin/ncplogin usr.sbin/mount_nwfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 12:45:37 -0000 Author: attilio Date: Sat Mar 9 12:45:36 2013 New Revision: 248097 URL: http://svnweb.freebsd.org/changeset/base/248097 Log: Garbage collect NWFS and NCP bits which are now completely disconnected from the tree since few months. This patch is not targeted for MFC. Deleted: head/lib/libncp/ head/lib/libprocstat/nwfs.c head/share/examples/nwclient/ head/sys/fs/nwfs/ head/sys/modules/ncp/ head/sys/modules/nwfs/ head/sys/netncp/ head/usr.bin/ncplist/ head/usr.bin/ncplogin/ head/usr.sbin/mount_nwfs/ Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Mar 9 12:34:45 2013 (r248096) +++ head/ObsoleteFiles.inc Sat Mar 9 12:45:36 2013 (r248097) @@ -38,6 +38,43 @@ # xargs -n1 | sort | uniq -d; # done +# 20130902: NWFS and NCP supports removed +OLD_FILES+=usr/bin/ncplist +OLD_FILES+=usr/bin/ncplogin +OLD_FILES+=usr/bin/ncplogout +OLD_FILES+=usr/include/fs/nwfs/nwfs.h +OLD_FILES+=usr/include/fs/nwfs/nwfs_mount.h +OLD_FILES+=usr/include/fs/nwfs/nwfs_node.h +OLD_FILES+=usr/include/fs/nwfs/nwfs_subr.h +OLD_DIRS+=usr/include/fs/nwfs +OLD_FILES+=usr/include/netncp/ncp.h +OLD_FILES+=usr/include/netncp/ncp_cfg.h +OLD_FILES+=usr/include/netncp/ncp_conn.h +OLD_FILES+=usr/include/netncp/ncp_file.h +OLD_FILES+=usr/include/netncp/ncp_lib.h +OLD_FILES+=usr/include/netncp/ncp_ncp.h +OLD_FILES+=usr/include/netncp/ncp_nls.h +OLD_FILES+=usr/include/netncp/ncp_rcfile.h +OLD_FILES+=usr/include/netncp/ncp_rq.h +OLD_FILES+=usr/include/netncp/ncp_sock.h +OLD_FILES+=usr/include/netncp/ncp_subr.h +OLD_FILES+=usr/include/netncp/ncp_user.h +OLD_FILES+=usr/include/netncp/ncpio.h +OLD_FILES+=usr/include/netncp/nwerror.h +OLD_DIRS+=usr/include/netncp +OLD_FILES+=usr/lib/libncp.a +OLD_FILES+=usr/lib/libncp.so +OLD_LIBS+=usr/lib/libncp.so.4 +OLD_FILES+=usr/lib/libncp_p.a +OLD_FILES+=usr/lib32/libncp.a +OLD_FILES+=usr/lib32/libncp.so +OLD_LIBS+=usr/lib32/libncp.so.4 +OLD_FILES+=usr/lib32/libncp_p.a +OLD_FILES+=usr/sbin/mount_nwfs +OLD_FILES+=usr/share/man/man1/ncplist.1.gz +OLD_FILES+=usr/share/man/man1/ncplogin.1.gz +OLD_FILES+=usr/share/man/man1/ncplogout.1.gz +OLD_FILES+=usr/share/man/man8/mount_nwfs.8.gz # 20130302: NTFS support removed OLD_FILES+=rescue/mount_ntfs OLD_FILES+=sbin/mount_ntfs From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 13:05:22 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 399CC162; Sat, 9 Mar 2013 13:05:22 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C5B6FD3; Sat, 9 Mar 2013 13:05:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29D5LvE060077; Sat, 9 Mar 2013 13:05:21 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29D5LDA060076; Sat, 9 Mar 2013 13:05:21 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303091305.r29D5LDA060076@svn.freebsd.org> From: Davide Italiano Date: Sat, 9 Mar 2013 13:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248099 - head/sys/fs/smbfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 13:05:22 -0000 Author: davide Date: Sat Mar 9 13:05:21 2013 New Revision: 248099 URL: http://svnweb.freebsd.org/changeset/base/248099 Log: - Initialize variable in smbfs_rename() to silent compiler warning - Fix smbfs_mkdir() return value (in case of error). Reported by: pho Modified: head/sys/fs/smbfs/smbfs_vnops.c Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Sat Mar 9 12:51:39 2013 (r248098) +++ head/sys/fs/smbfs/smbfs_vnops.c Sat Mar 9 13:05:21 2013 (r248099) @@ -580,6 +580,7 @@ smbfs_rename(ap) u_int16_t flags = 6; int error=0; + scred = NULL; /* Check for cross-device rename */ if ((fvp->v_mount != tdvp->v_mount) || (tvp && (fvp->v_mount != tvp->v_mount))) { @@ -730,7 +731,7 @@ smbfs_mkdir(ap) *ap->a_vpp = vp; out: smbfs_free_scred(scred); - return 0; + return error; } /* From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 13:25:46 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3081D632; Sat, 9 Mar 2013 13:25:46 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0A94E13F; Sat, 9 Mar 2013 13:25:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29DPjN3066320; Sat, 9 Mar 2013 13:25:45 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29DPjfS066318; Sat, 9 Mar 2013 13:25:45 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303091325.r29DPjfS066318@svn.freebsd.org> From: Davide Italiano Date: Sat, 9 Mar 2013 13:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248101 - head/sys/fs/smbfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 13:25:46 -0000 Author: davide Date: Sat Mar 9 13:25:45 2013 New Revision: 248101 URL: http://svnweb.freebsd.org/changeset/base/248101 Log: smbfs_lookup() in the DOTDOT case operates on dvp->n_parent without proper locking. This doesn't prevent in any case reclaim of the vnode. Avoid this not going over-the-wire in this case and relying on subsequent smbfs_getattr() call to restore consistency. While I'm here, change a couple of SMBVDEBUG() in MPASS(). sbmfs_smb_lookup() doesn't and shouldn't know about '.' and '..' Reported by: pho's stress2 suite Modified: head/sys/fs/smbfs/smbfs_smb.c head/sys/fs/smbfs/smbfs_vnops.c Modified: head/sys/fs/smbfs/smbfs_smb.c ============================================================================== --- head/sys/fs/smbfs/smbfs_smb.c Sat Mar 9 13:12:12 2013 (r248100) +++ head/sys/fs/smbfs/smbfs_smb.c Sat Mar 9 13:25:45 2013 (r248101) @@ -1455,15 +1455,9 @@ smbfs_smb_lookup(struct smbnode *dnp, co fap->fa_ino = 2; return 0; } - if (nmlen == 1 && name[0] == '.') { - error = smbfs_smb_lookup(dnp, NULL, 0, fap, scred); - return error; - } else if (nmlen == 2 && name[0] == '.' && name[1] == '.') { - error = smbfs_smb_lookup(VTOSMB(dnp->n_parent), NULL, 0, fap, - scred); - printf("%s: knows NOTHING about '..'\n", __func__); - return error; - } + MPASS(!(nmlen == 2 && name[0] == '.' && name[1] == '.')); + MPASS(!(nmlen == 1 && name[0] == '.')); + ASSERT_VOP_ELOCKED(dnp->n_vnode, "smbfs_smb_lookup"); error = smbfs_findopen(dnp, name, nmlen, SMB_FA_SYSTEM | SMB_FA_HIDDEN | SMB_FA_DIR, scred, &ctx); if (error) Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Sat Mar 9 13:12:12 2013 (r248100) +++ head/sys/fs/smbfs/smbfs_vnops.c Sat Mar 9 13:25:45 2013 (r248101) @@ -1204,13 +1204,20 @@ smbfs_lookup(ap) smb_makescred(scred, td, cnp->cn_cred); fap = &fattr; if (flags & ISDOTDOT) { - error = smbfs_smb_lookup(VTOSMB(dnp->n_parent), NULL, 0, fap, - scred); - SMBVDEBUG("result of dotdot lookup: %d\n", error); - } else { - fap = &fattr; + /* + * In the DOTDOT case, don't go over-the-wire + * in order to request attributes. We already + * know it's a directory and subsequent call to + * smbfs_getattr() will restore consistency. + * + */ + SMBVDEBUG("smbfs_smb_lookup: dotdot\n"); + } else if (isdot) { + error = smbfs_smb_lookup(dnp, NULL, 0, fap, scred); + SMBVDEBUG("result of smbfs_smb_lookup: %d\n", error); + } + else { error = smbfs_smb_lookup(dnp, name, nmlen, fap, scred); -/* if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.')*/ SMBVDEBUG("result of smbfs_smb_lookup: %d\n", error); } if (error && error != ENOENT) From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 13:30:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0A54849; Sat, 9 Mar 2013 13:30:06 +0000 (UTC) (envelope-from db@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A50AE182; Sat, 9 Mar 2013 13:30:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29DU6lR067102; Sat, 9 Mar 2013 13:30:06 GMT (envelope-from db@svn.freebsd.org) Received: (from db@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29DU6s1067101; Sat, 9 Mar 2013 13:30:06 GMT (envelope-from db@svn.freebsd.org) Message-Id: <201303091330.r29DU6s1067101@svn.freebsd.org> From: Diane Bruce Date: Sat, 9 Mar 2013 13:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248102 - head/lib/libutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 13:30:06 -0000 Author: db (ports committer) Date: Sat Mar 9 13:30:06 2013 New Revision: 248102 URL: http://svnweb.freebsd.org/changeset/base/248102 Log: commit correct tested fix for gr_util.c Approved by: theraven Modified: head/lib/libutil/gr_util.c Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Sat Mar 9 13:25:45 2013 (r248101) +++ head/lib/libutil/gr_util.c Sat Mar 9 13:30:06 2013 (r248102) @@ -50,7 +50,7 @@ static char group_file[PATH_MAX]; static char tempname[PATH_MAX]; static int initialized; static size_t grmemlen(const struct group *, const char *, int *); -static struct group *grcopy(const struct group *gr, struct group *newgr, const char *, int ndx); +static struct group *grcopy(const struct group *gr, char *mem, const char *, int ndx); /* * Initialize statics @@ -361,26 +361,30 @@ gr_equal(const struct group *gr1, const if (gr1->gr_gid != gr2->gr_gid) return (false); - /* Check all members in both groups. */ - if (gr1->gr_mem == NULL || gr2->gr_mem == NULL) { - if (gr1->gr_mem != gr2->gr_mem) - return (false); - } else { - for (gr1_ndx = 0; gr1->gr_mem[gr1_ndx] != NULL; gr1_ndx++) { - for (gr2_ndx = 0;; gr2_ndx++) { - if (gr2->gr_mem[gr2_ndx] == NULL) - return (false); - if (strcmp(gr1->gr_mem[gr1_ndx], - gr2->gr_mem[gr2_ndx]) == 0) { - break; - } - } - } - - /* Check that group2 does not have more members than group1. */ - if (gr2->gr_mem[gr1_ndx] != NULL) - return (false); - } + /* Check all members in both groups. + * getgrnam can return gr_mem with a pointer to NULL. + * gr_dup and gr_add strip out this superfluous NULL, setting + * gr_mem to NULL for no members. + */ + if (gr1->gr_mem != NULL && gr2->gr_mem != NULL) { + int i; + + for (i = 0; gr1->gr_mem[i] != NULL; i++) { + if (strcmp(gr1->gr_mem[i], gr2->gr_mem[i]) != 0) + return (false); + } + } + /* Count number of members in both structs */ + gr2_ndx = 0; + if (gr2->gr_mem != NULL) + for(; gr2->gr_mem[gr2_ndx] != NULL; gr2_ndx++) + /* empty */; + gr1_ndx = 0; + if (gr1->gr_mem != NULL) + for(; gr1->gr_mem[gr1_ndx] != NULL; gr1_ndx++) + /* empty */; + if (gr1_ndx != gr2_ndx) + return (false); return (true); } @@ -439,21 +443,21 @@ gr_dup(const struct group *gr) struct group * gr_add(const struct group *gr, const char *newmember) { - struct group *newgr; + char *mem; size_t len; int num_mem; num_mem = 0; len = grmemlen(gr, newmember, &num_mem); /* Create new group and copy old group into it. */ - if ((newgr = malloc(len)) == NULL) + if ((mem = malloc(len)) == NULL) return (NULL); - return (grcopy(gr, newgr, newmember, num_mem)); + return (grcopy(gr, mem, newmember, num_mem)); } /* It is safer to walk the pointers given at gr_mem since there is no - * guarantee the gr_mem + strings are continguous in the given struct group - * but compact the new group into the following form. + * guarantee the gr_mem + strings are contiguous in the given struct group + * but compactify the new group into the following form. * * The new struct is laid out like this in memory. The example given is * for a group with two members only. @@ -474,23 +478,21 @@ gr_add(const struct group *gr, const cha * } */ /* - * Copy the guts of a group plus given name to a preallocated group struct + * Copy the contents of a group plus given name to a preallocated group struct */ static struct group * -grcopy(const struct group *gr, struct group *newgr, const char *name, int ndx) +grcopy(const struct group *gr, char *dst, const char *name, int ndx) { - char *dst; int i; + struct group *newgr; - if (name != NULL) - ndx++; - /* point new gr_mem to end of struct + 1 if there are names */ - if (ndx != 0) - newgr->gr_mem = (char **)(newgr + 1); - else + newgr = (struct group *)(void *)dst; /* avoid alignment warning */ + dst += sizeof(*newgr); + if (ndx != 0) { + newgr->gr_mem = (char **)(void *)(dst); /* avoid alignment warning */ + dst += (ndx + 1) * sizeof(*newgr->gr_mem); + } else newgr->gr_mem = NULL; - /* point dst after the end of all the gr_mem pointers in newgr */ - dst = (char *)&newgr->gr_mem[ndx + 1]; if (gr->gr_name != NULL) { newgr->gr_name = dst; dst = stpcpy(dst, gr->gr_name) + 1; @@ -502,17 +504,23 @@ grcopy(const struct group *gr, struct gr } else newgr->gr_passwd = NULL; newgr->gr_gid = gr->gr_gid; - if (ndx != 0) { - for (i = 0; gr->gr_mem[i] != NULL; i++) { + i = 0; + /* Original group struct might have a NULL gr_mem */ + if (gr->gr_mem != NULL) { + for (; gr->gr_mem[i] != NULL; i++) { newgr->gr_mem[i] = dst; dst = stpcpy(dst, gr->gr_mem[i]) + 1; } - if (name != NULL) { - newgr->gr_mem[i++] = dst; - dst = stpcpy(dst, name) + 1; - } - newgr->gr_mem[i] = NULL; } + /* If name is not NULL, newgr->gr_mem is known to be not NULL */ + if (name != NULL) { + newgr->gr_mem[i++] = dst; + dst = stpcpy(dst, name) + 1; + } + /* if newgr->gr_mem is not NULL add NULL marker */ + if (newgr->gr_mem != NULL) + newgr->gr_mem[i] = NULL; + return (newgr); } @@ -533,18 +541,22 @@ grmemlen(const struct group *gr, const c len += strlen(gr->gr_name) + 1; if (gr->gr_passwd != NULL) len += strlen(gr->gr_passwd) + 1; + i = 0; if (gr->gr_mem != NULL) { - for (len = i = 0; gr->gr_mem[i] != NULL; i++) { + for (; gr->gr_mem[i] != NULL; i++) { len += strlen(gr->gr_mem[i]) + 1; len += sizeof(*gr->gr_mem); } - *num_mem = i; } if (name != NULL) { + i++; len += strlen(name) + 1; - if (gr->gr_mem == NULL) - len += sizeof(*gr->gr_mem); + len += sizeof(*gr->gr_mem); } + /* Allow for NULL pointer */ + if (i != 0) + len += sizeof(*gr->gr_mem); + *num_mem = i; return(len); } From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 15:02:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C0FC68B9; Sat, 9 Mar 2013 15:02:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 99370789; Sat, 9 Mar 2013 15:02:35 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 2A03A46B2E; Sat, 9 Mar 2013 10:02:35 -0500 (EST) Date: Sat, 9 Mar 2013 15:02:35 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Attilio Rao Subject: Re: svn commit: r248097 - in head: . lib/libncp lib/libprocstat share/examples/nwclient sys/fs/nwfs sys/modules/ncp sys/modules/nwfs sys/netncp usr.bin/ncplist usr.bin/ncplogin usr.sbin/mount_nwfs In-Reply-To: <201303091245.r29Cjbr3054004@svn.freebsd.org> Message-ID: References: <201303091245.r29Cjbr3054004@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 15:02:35 -0000 Hi Attilio: It's really great to see the continued progress towards the goal entirely-MPSAFE VFS in 10.x -- we owe you a huge vote of thanks for pursuing this! Robert N M Watson Computer Laboratory University of Cambridge On Sat, 9 Mar 2013, Attilio Rao wrote: > Author: attilio > Date: Sat Mar 9 12:45:36 2013 > New Revision: 248097 > URL: http://svnweb.freebsd.org/changeset/base/248097 > > Log: > Garbage collect NWFS and NCP bits which are now completely disconnected > from the tree since few months. > > This patch is not targeted for MFC. > > Deleted: > head/lib/libncp/ > head/lib/libprocstat/nwfs.c > head/share/examples/nwclient/ > head/sys/fs/nwfs/ > head/sys/modules/ncp/ > head/sys/modules/nwfs/ > head/sys/netncp/ > head/usr.bin/ncplist/ > head/usr.bin/ncplogin/ > head/usr.sbin/mount_nwfs/ > Modified: > head/ObsoleteFiles.inc > > Modified: head/ObsoleteFiles.inc > ============================================================================== > --- head/ObsoleteFiles.inc Sat Mar 9 12:34:45 2013 (r248096) > +++ head/ObsoleteFiles.inc Sat Mar 9 12:45:36 2013 (r248097) > @@ -38,6 +38,43 @@ > # xargs -n1 | sort | uniq -d; > # done > > +# 20130902: NWFS and NCP supports removed > +OLD_FILES+=usr/bin/ncplist > +OLD_FILES+=usr/bin/ncplogin > +OLD_FILES+=usr/bin/ncplogout > +OLD_FILES+=usr/include/fs/nwfs/nwfs.h > +OLD_FILES+=usr/include/fs/nwfs/nwfs_mount.h > +OLD_FILES+=usr/include/fs/nwfs/nwfs_node.h > +OLD_FILES+=usr/include/fs/nwfs/nwfs_subr.h > +OLD_DIRS+=usr/include/fs/nwfs > +OLD_FILES+=usr/include/netncp/ncp.h > +OLD_FILES+=usr/include/netncp/ncp_cfg.h > +OLD_FILES+=usr/include/netncp/ncp_conn.h > +OLD_FILES+=usr/include/netncp/ncp_file.h > +OLD_FILES+=usr/include/netncp/ncp_lib.h > +OLD_FILES+=usr/include/netncp/ncp_ncp.h > +OLD_FILES+=usr/include/netncp/ncp_nls.h > +OLD_FILES+=usr/include/netncp/ncp_rcfile.h > +OLD_FILES+=usr/include/netncp/ncp_rq.h > +OLD_FILES+=usr/include/netncp/ncp_sock.h > +OLD_FILES+=usr/include/netncp/ncp_subr.h > +OLD_FILES+=usr/include/netncp/ncp_user.h > +OLD_FILES+=usr/include/netncp/ncpio.h > +OLD_FILES+=usr/include/netncp/nwerror.h > +OLD_DIRS+=usr/include/netncp > +OLD_FILES+=usr/lib/libncp.a > +OLD_FILES+=usr/lib/libncp.so > +OLD_LIBS+=usr/lib/libncp.so.4 > +OLD_FILES+=usr/lib/libncp_p.a > +OLD_FILES+=usr/lib32/libncp.a > +OLD_FILES+=usr/lib32/libncp.so > +OLD_LIBS+=usr/lib32/libncp.so.4 > +OLD_FILES+=usr/lib32/libncp_p.a > +OLD_FILES+=usr/sbin/mount_nwfs > +OLD_FILES+=usr/share/man/man1/ncplist.1.gz > +OLD_FILES+=usr/share/man/man1/ncplogin.1.gz > +OLD_FILES+=usr/share/man/man1/ncplogout.1.gz > +OLD_FILES+=usr/share/man/man8/mount_nwfs.8.gz > # 20130302: NTFS support removed > OLD_FILES+=rescue/mount_ntfs > OLD_FILES+=sbin/mount_ntfs > From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 15:04:45 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AEB9FB64; Sat, 9 Mar 2013 15:04:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A20B97B7; Sat, 9 Mar 2013 15:04:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29F4j2x096577; Sat, 9 Mar 2013 15:04:45 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29F4jiC096573; Sat, 9 Mar 2013 15:04:45 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201303091504.r29F4jiC096573@svn.freebsd.org> From: Mark Johnston Date: Sat, 9 Mar 2013 15:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248104 - head/sys/dev/ichwd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 15:04:45 -0000 Author: markj Date: Sat Mar 9 15:04:44 2013 New Revision: 248104 URL: http://svnweb.freebsd.org/changeset/base/248104 Log: Don't log a message when the watchdog is reloaded. It's not useful to do so and these messages flood the log when bootverbose is enabled. Approved by: rstone (co-mentor) Modified: head/sys/dev/ichwd/ichwd.c Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Sat Mar 9 14:34:53 2013 (r248103) +++ head/sys/dev/ichwd/ichwd.c Sat Mar 9 15:04:44 2013 (r248104) @@ -323,8 +323,6 @@ ichwd_tmr_reload(struct ichwd_softc *sc) ichwd_write_tco_1(sc, TCO_RLD, 1); else ichwd_write_tco_2(sc, TCO_RLD, 1); - - ichwd_verbose_printf(sc->device, "timer reloaded\n"); } /* From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 15:17:56 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B4C38FCC; Sat, 9 Mar 2013 15:17:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) by mx1.freebsd.org (Postfix) with ESMTP id 6E2EE843; Sat, 9 Mar 2013 15:17:56 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id 16so3093336iea.8 for ; Sat, 09 Mar 2013 07:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=fiIXaWjzoAWODtQp30iP6R7qjas3BPTQU5RwBxwOIgg=; b=bij9ahUGks+8z6FK3vdVy5DZzgU9nXIUgZljfYxH9OQ1uvY+RnQcJ7PeHKlX/k4KpC VgXEOZA3i9Knf4CP8hR5j5LQHUyOBKYXq1alAhDuk9J4pEwo0HD9/vcqiEB/4iTiRWDS +wjlkAjjB8mRJKiZGmeacT8NQxfKe1dYiXyg0ljD8vQcPYhSuzOpK8uOfP6F0YBLtnvm dAPXBhDR+5W1CS+axT2AVSKTu3nTFr5jYekItQnJBtAiuRjKvu88R2I5MC1+gm287qUP DcTq8lIGoR8SXOIzlMBSf4COVQYH+ygrjluVuxd3UyTIyA5xIyzQcNKunuJTQmV3KAwQ rL4g== MIME-Version: 1.0 X-Received: by 10.43.103.195 with SMTP id dj3mr4366900icc.3.1362842276141; Sat, 09 Mar 2013 07:17:56 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Sat, 9 Mar 2013 07:17:56 -0800 (PST) In-Reply-To: References: <201303091245.r29Cjbr3054004@svn.freebsd.org> Date: Sat, 9 Mar 2013 16:17:56 +0100 X-Google-Sender-Auth: 5I1DAw6bPZ2U5HwF2cymejg7Byw Message-ID: Subject: Re: svn commit: r248097 - in head: . lib/libncp lib/libprocstat share/examples/nwclient sys/fs/nwfs sys/modules/ncp sys/modules/nwfs sys/netncp usr.bin/ncplist usr.bin/ncplogin usr.sbin/mount_nwfs From: Attilio Rao To: Robert Watson 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.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: 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, 09 Mar 2013 15:17:56 -0000 On Sat, Mar 9, 2013 at 4:02 PM, Robert Watson wrote: > Hi Attilio: > > It's really great to see the continued progress towards the goal > entirely-MPSAFE VFS in 10.x -- we owe you a huge vote of thanks for pursuing > this! Thanks for the kind words. The VFS can be considered completely MPSAFE by date, the only remaining thing to do is sweeping out smbfs/netsmb. However a known FreeBSD shops has patches to make smbfs MPSAFE and I'd rather give them more time to commit them and re-add smbfs as a MPSAFE filesystem rather than get into their way and remove the support. This is the last bit to sort out. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 15:31:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7B21D8EA; Sat, 9 Mar 2013 15:31:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 68CF794E; Sat, 9 Mar 2013 15:31:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29FVKU4005496; Sat, 9 Mar 2013 15:31:20 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29FVKXc005495; Sat, 9 Mar 2013 15:31:20 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201303091531.r29FVKXc005495@svn.freebsd.org> From: Attilio Rao Date: Sat, 9 Mar 2013 15:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248105 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 15:31:20 -0000 Author: attilio Date: Sat Mar 9 15:31:19 2013 New Revision: 248105 URL: http://svnweb.freebsd.org/changeset/base/248105 Log: Improve UMTX_PROFILING: - Use u_int values for length and max_length values - Add a way to reset the max_length heuristic in order to have the possibility to reuse the mechanism consecutively without rebooting the machine - Add a way to quick display top5 contented buckets in the system for the max_length value. This should give a quick overview on the quality of the hash table distribution. Sponsored by: EMC / Isilon storage division Reviewed by: jeff, davide Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Mar 9 15:04:44 2013 (r248104) +++ head/sys/kern/kern_umtx.c Sat Mar 9 15:31:19 2013 (r248105) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -64,6 +65,11 @@ __FBSDID("$FreeBSD$"); #define _UMUTEX_TRY 1 #define _UMUTEX_WAIT 2 +#ifdef UMTX_PROFILING +#define UPROF_PERC_BIGGER(w, f, sw, sf) \ + (((w) > (sw)) || ((w) == (sw) && (f) > (sf))) +#endif + /* Priority inheritance mutex info. */ struct umtx_pi { /* Owner thread */ @@ -157,8 +163,8 @@ struct umtxq_chain { TAILQ_HEAD(,umtx_pi) uc_pi_list; #ifdef UMTX_PROFILING - int length; - int max_length; + u_int length; + u_int max_length; #endif }; @@ -252,6 +258,117 @@ umtx_init_profiling(void) "max_length1", CTLFLAG_RD, &umtxq_chains[1][i].max_length, 0, NULL); } } + +static int +sysctl_debug_umtx_chains_peaks(SYSCTL_HANDLER_ARGS) +{ + char buf[512]; + struct sbuf sb; + struct umtxq_chain *uc; + u_int fract, i, j, tot, whole; + u_int sf0, sf1, sf2, sf3, sf4; + u_int si0, si1, si2, si3, si4; + u_int sw0, sw1, sw2, sw3, sw4; + + sbuf_new(&sb, buf, sizeof(buf), SBUF_FIXEDLEN); + for (i = 0; i < 2; i++) { + tot = 0; + for (j = 0; j < UMTX_CHAINS; ++j) { + uc = &umtxq_chains[i][j]; + mtx_lock(&uc->uc_lock); + tot += uc->max_length; + mtx_unlock(&uc->uc_lock); + } + if (tot == 0) + sbuf_printf(&sb, "%u) Empty ", i); + else { + sf0 = sf1 = sf2 = sf3 = sf4 = 0; + si0 = si1 = si2 = si3 = si4 = 0; + sw0 = sw1 = sw2 = sw3 = sw4 = 0; + for (j = 0; j < UMTX_CHAINS; j++) { + uc = &umtxq_chains[i][j]; + mtx_lock(&uc->uc_lock); + whole = uc->max_length * 100; + mtx_unlock(&uc->uc_lock); + fract = (whole % tot) * 100; + if (UPROF_PERC_BIGGER(whole, fract, sw0, sf0)) { + sf0 = fract; + si0 = j; + sw0 = whole; + } else if (UPROF_PERC_BIGGER(whole, fract, sw1, + sf1)) { + sf1 = fract; + si1 = j; + sw1 = whole; + } else if (UPROF_PERC_BIGGER(whole, fract, sw2, + sf2)) { + sf2 = fract; + si2 = j; + sw2 = whole; + } else if (UPROF_PERC_BIGGER(whole, fract, sw3, + sf3)) { + sf3 = fract; + si3 = j; + sw3 = whole; + } else if (UPROF_PERC_BIGGER(whole, fract, sw4, + sf4)) { + sf4 = fract; + si4 = j; + sw4 = whole; + } + } + sbuf_printf(&sb, "queue %u:\n", i); + sbuf_printf(&sb, "1st: %u.%u%% idx: %u\n", sw0 / tot, + sf0 / tot, si0); + sbuf_printf(&sb, "2nd: %u.%u%% idx: %u\n", sw1 / tot, + sf1 / tot, si1); + sbuf_printf(&sb, "3rd: %u.%u%% idx: %u\n", sw2 / tot, + sf2 / tot, si2); + sbuf_printf(&sb, "4th: %u.%u%% idx: %u\n", sw3 / tot, + sf3 / tot, si3); + sbuf_printf(&sb, "5th: %u.%u%% idx: %u\n", sw4 / tot, + sf4 / tot, si4); + } + } + sbuf_trim(&sb); + sbuf_finish(&sb); + sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); + sbuf_delete(&sb); + return (0); +} + +static int +sysctl_debug_umtx_chains_clear(SYSCTL_HANDLER_ARGS) +{ + struct umtxq_chain *uc; + u_int i, j; + int clear, error; + + clear = 0; + error = sysctl_handle_int(oidp, &clear, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + if (clear != 0) { + for (i = 0; i < 2; ++i) { + for (j = 0; j < UMTX_CHAINS; ++j) { + uc = &umtxq_chains[i][j]; + mtx_lock(&uc->uc_lock); + uc->length = 0; + uc->max_length = 0; + mtx_unlock(&uc->uc_lock); + } + } + } + return (0); +} + +SYSCTL_PROC(_debug_umtx_chains, OID_AUTO, clear, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, + sysctl_debug_umtx_chains_clear, "I", "Clear umtx chains statistics"); +SYSCTL_PROC(_debug_umtx_chains, OID_AUTO, peaks, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 0, + sysctl_debug_umtx_chains_peaks, "A", "Highest peaks in chains max length"); #endif static void From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 15:35:32 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8317FDD1; Sat, 9 Mar 2013 15:35:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7654C9AD; Sat, 9 Mar 2013 15:35:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29FZWo6006099; Sat, 9 Mar 2013 15:35:32 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29FZWdO006098; Sat, 9 Mar 2013 15:35:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201303091535.r29FZWdO006098@svn.freebsd.org> From: Adrian Chadd Date: Sat, 9 Mar 2013 15:35:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248106 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 15:35:32 -0000 Author: adrian Date: Sat Mar 9 15:35:31 2013 New Revision: 248106 URL: http://svnweb.freebsd.org/changeset/base/248106 Log: Fix another compiler warning issue when invariants are disabled. Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Mar 9 15:31:19 2013 (r248105) +++ head/sys/net80211/ieee80211_output.c Sat Mar 9 15:35:31 2013 (r248106) @@ -597,10 +597,9 @@ ieee80211_send_setup( struct ieee80211vap *vap = ni->ni_vap; struct ieee80211_tx_ampdu *tap; struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); - struct ieee80211com *ic = ni->ni_ic; ieee80211_seq seqno; - IEEE80211_TX_LOCK_ASSERT(ic); + IEEE80211_TX_LOCK_ASSERT(ni->ni_ic); wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | type; if ((type & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) { From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 16:29:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3274D170; Sat, 9 Mar 2013 16:29:27 +0000 (UTC) (envelope-from joel@vnode.se) Received: from mail.vnode.se (mail.vnode.se [212.247.52.13]) by mx1.freebsd.org (Postfix) with ESMTP id E3A5AE81; Sat, 9 Mar 2013 16:29:26 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id 9877AE3F07A; Sat, 9 Mar 2013 17:29:25 +0100 (CET) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ylhf8KM87skr; Sat, 9 Mar 2013 17:29:23 +0100 (CET) Received: from devbox.vnode.local (unknown [83.223.1.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id 03553E3F079; Sat, 9 Mar 2013 17:29:22 +0100 (CET) Date: Sat, 9 Mar 2013 17:29:22 +0100 From: Joel Dahl To: Attilio Rao Subject: Re: svn commit: r248097 - in head: . lib/libncp lib/libprocstat share/examples/nwclient sys/fs/nwfs sys/modules/ncp sys/modules/nwfs sys/netncp usr.bin/ncplist usr.bin/ncplogin usr.sbin/mount_nwfs Message-ID: <20130309162921.GL17537@devbox.vnode.local> References: <201303091245.r29Cjbr3054004@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 16:29:27 -0000 On Sat, Mar 09, 2013 at 04:17:56PM +0100, Attilio Rao wrote: > On Sat, Mar 9, 2013 at 4:02 PM, Robert Watson wrote: > > Hi Attilio: > > > > It's really great to see the continued progress towards the goal > > entirely-MPSAFE VFS in 10.x -- we owe you a huge vote of thanks for pursuing > > this! > > Thanks for the kind words. > > The VFS can be considered completely MPSAFE by date, the only > remaining thing to do is sweeping out smbfs/netsmb. > However a known FreeBSD shops has patches to make smbfs MPSAFE and I'd > rather give them more time to commit them and re-add smbfs as a MPSAFE > filesystem rather than get into their way and remove the support. Have they given you any ETA for this? 10.0 is approaching ... :-) -- Joel From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 16:47:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DE6E6F70; Sat, 9 Mar 2013 16:47:16 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [IPv6:2607:f8b0:400c:c02::229]) by mx1.freebsd.org (Postfix) with ESMTP id 55C25F6A; Sat, 9 Mar 2013 16:47:16 +0000 (UTC) Received: by mail-vb0-f41.google.com with SMTP id l22so1063458vbn.28 for ; Sat, 09 Mar 2013 08:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=WML4Uwtt1d7rqzIFdsOBwDSSmxBfH01aDSZfGuAOyhM=; b=uc70ZbW11agPA4B8r7Jw40ikx75DvOIza/TPoH6ZLFOvkNR/aqstmKfREM9xpjDjU1 4z//oXwxGknpr+YnvO0V1BUUG0g7PCPWzqx9JWJgTycLz6RI9YLhxh/JGhAqN/qoZNSV GMfx6vIHQwBWupTakWt5qJ4QNblP+GccwX+QS1LTMMlX+MEDYTETTJsYX/M4BDUtKInY KdDTEvGUqdwBBL5IEUB4XsFeaNT5yW9fVqK1SlPuLhuNPKe28/w80SZukyLD3hD/qds8 yYNaImDUyBGikBk6JTu2hHoXvILaMU/NUaS41x77aj0BnAuyqgQLKj0Ka8eW22uTwJwg kQfg== MIME-Version: 1.0 X-Received: by 10.52.88.237 with SMTP id bj13mr2209920vdb.75.1362847635818; Sat, 09 Mar 2013 08:47:15 -0800 (PST) Sender: davide.italiano@gmail.com Received: by 10.220.34.203 with HTTP; Sat, 9 Mar 2013 08:47:15 -0800 (PST) In-Reply-To: <20130309162921.GL17537@devbox.vnode.local> References: <201303091245.r29Cjbr3054004@svn.freebsd.org> <20130309162921.GL17537@devbox.vnode.local> Date: Sat, 9 Mar 2013 17:47:15 +0100 X-Google-Sender-Auth: K6hFw3cSVG9ltU1kV4C7YQns6f8 Message-ID: Subject: Re: svn commit: r248097 - in head: . lib/libncp lib/libprocstat share/examples/nwclient sys/fs/nwfs sys/modules/ncp sys/modules/nwfs sys/netncp usr.bin/ncplist usr.bin/ncplogin usr.sbin/mount_nwfs From: Davide Italiano To: Joel Dahl Content-Type: text/plain; charset=ISO-8859-1 Cc: Attilio Rao , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 16:47:17 -0000 On Sat, Mar 9, 2013 at 5:29 PM, Joel Dahl wrote: > On Sat, Mar 09, 2013 at 04:17:56PM +0100, Attilio Rao wrote: >> On Sat, Mar 9, 2013 at 4:02 PM, Robert Watson wrote: >> > Hi Attilio: >> > >> > It's really great to see the continued progress towards the goal >> > entirely-MPSAFE VFS in 10.x -- we owe you a huge vote of thanks for pursuing >> > this! >> >> Thanks for the kind words. >> >> The VFS can be considered completely MPSAFE by date, the only >> remaining thing to do is sweeping out smbfs/netsmb. >> However a known FreeBSD shops has patches to make smbfs MPSAFE and I'd >> rather give them more time to commit them and re-add smbfs as a MPSAFE >> filesystem rather than get into their way and remove the support. > > Have they given you any ETA for this? 10.0 is approaching ... :-) > > -- > Joel I'm working on this right now and should be addressed in few days. Thanks, -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 16:58:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3C53E576; Sat, 9 Mar 2013 16:58:20 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2F07AFE2; Sat, 9 Mar 2013 16:58:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29GwKEt030989; Sat, 9 Mar 2013 16:58:20 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29GwKaW030988; Sat, 9 Mar 2013 16:58:20 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303091658.r29GwKaW030988@svn.freebsd.org> From: Davide Italiano Date: Sat, 9 Mar 2013 16:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248109 - head/sys/netsmb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 16:58:20 -0000 Author: davide Date: Sat Mar 9 16:58:19 2013 New Revision: 248109 URL: http://svnweb.freebsd.org/changeset/base/248109 Log: Call make_dev_credf() rather than using the couple make_dev()/dev_ref(). This closes a race with clone_cleanup(). Modified: head/sys/netsmb/smb_dev.c Modified: head/sys/netsmb/smb_dev.c ============================================================================== --- head/sys/netsmb/smb_dev.c Sat Mar 9 16:11:29 2013 (r248108) +++ head/sys/netsmb/smb_dev.c Sat Mar 9 16:58:19 2013 (r248109) @@ -107,14 +107,9 @@ nsmb_dev_clone(void *arg, struct ucred * else if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) return; i = clone_create(&nsmb_clones, &nsmb_cdevsw, &u, dev, 0); - if (i) { - *dev = make_dev(&nsmb_cdevsw, u, UID_ROOT, GID_WHEEL, 0600, - "%s%d", NSMB_NAME, u); - if (*dev != NULL) { - dev_ref(*dev); - (*dev)->si_flags |= SI_CHEAPCLONE; - } - } + if (i) + *dev = make_dev_credf(MAKEDEV_REF, &nsmb_cdevsw, u, cred, + UID_ROOT, GID_WHEEL, 0600, "%s%d", NSMB_NAME, u); } static int From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 20:01:36 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F879CF5; Sat, 9 Mar 2013 20:01:36 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1DCCC80C; Sat, 9 Mar 2013 20:01:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29K1Z0J088875; Sat, 9 Mar 2013 20:01:35 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29K1ZS9088874; Sat, 9 Mar 2013 20:01:35 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303092001.r29K1ZS9088874@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 9 Mar 2013 20:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248112 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 20:01:36 -0000 Author: melifaro Date: Sat Mar 9 20:01:35 2013 New Revision: 248112 URL: http://svnweb.freebsd.org/changeset/base/248112 Log: Document netstat -Q flags meaning. MFC after: 1 week Modified: head/usr.bin/netstat/netstat.1 Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Sat Mar 9 18:40:37 2013 (r248111) +++ head/usr.bin/netstat/netstat.1 Sat Mar 9 20:01:35 2013 (r248112) @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 22, 2010 +.Dd March 10, 2013 .Dt NETSTAT 1 .Os .Sh NAME @@ -301,6 +301,11 @@ is repeated, counters with a value of ze Show .Xr netisr 9 statistics. +The flags field shows available ISR handlers: +.Bl -column ".Li W" ".Dv NETISR_SNP_FLAGS_DRAINEDCPU" +.It Li C Ta Dv NETISR_SNP_FLAGS_M2CPUID Ta "Able to map mbuf to cpu id" +.It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler" +.It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id" .El .Pp Some options have the general meaning: From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 20:03:11 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 657B6E7A; Sat, 9 Mar 2013 20:03:11 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 53E7381B; Sat, 9 Mar 2013 20:03:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29K3B9W089196; Sat, 9 Mar 2013 20:03:11 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29K3BPc089195; Sat, 9 Mar 2013 20:03:11 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201303092003.r29K3BPc089195@svn.freebsd.org> From: Davide Italiano Date: Sat, 9 Mar 2013 20:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248113 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 20:03:11 -0000 Author: davide Date: Sat Mar 9 20:03:10 2013 New Revision: 248113 URL: http://svnweb.freebsd.org/changeset/base/248113 Log: Fixup r248032: Change size requested to malloc(9) now that callwheel buckets are callout_list and not callout_tailq anymore. This change was already there but it seems it got lost after code churn in r248032. Reported by: alc, kib Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Sat Mar 9 20:01:35 2013 (r248112) +++ head/sys/kern/kern_timeout.c Sat Mar 9 20:03:10 2013 (r248113) @@ -294,7 +294,7 @@ callout_cpu_init(struct callout_cpu *cc) mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); - cc->cc_callwheel = malloc(sizeof(struct callout_tailq) * callwheelsize, + cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, M_CALLOUT, M_WAITOK); for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 20:04:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C5229187; Sat, 9 Mar 2013 20:04:47 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B36DA831; Sat, 9 Mar 2013 20:04:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29K4lej089498; Sat, 9 Mar 2013 20:04:47 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29K4lk7089497; Sat, 9 Mar 2013 20:04:47 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201303092004.r29K4lk7089497@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 9 Mar 2013 20:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248114 - head/usr.bin/netstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 20:04:47 -0000 Author: melifaro Date: Sat Mar 9 20:04:47 2013 New Revision: 248114 URL: http://svnweb.freebsd.org/changeset/base/248114 Log: Add forgotten .El MFC with: r248112 Modified: head/usr.bin/netstat/netstat.1 Modified: head/usr.bin/netstat/netstat.1 ============================================================================== --- head/usr.bin/netstat/netstat.1 Sat Mar 9 20:03:10 2013 (r248113) +++ head/usr.bin/netstat/netstat.1 Sat Mar 9 20:04:47 2013 (r248114) @@ -307,6 +307,7 @@ The flags field shows available ISR hand .It Li D Ta Dv NETISR_SNP_FLAGS_DRAINEDCPU Ta "Has queue drain handler" .It Li F Ta Dv NETISR_SNP_FLAGS_M2FLOW Ta "Able to map mbuf to flow id" .El +.El .Pp Some options have the general meaning: .Bl -tag -width flag From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 21:32:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E6F79B46; Sat, 9 Mar 2013 21:32:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D01CDAE8; Sat, 9 Mar 2013 21:32:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29LWOm1016888; Sat, 9 Mar 2013 21:32:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29LWOLR016887; Sat, 9 Mar 2013 21:32:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201303092132.r29LWOLR016887@svn.freebsd.org> From: Alan Cox Date: Sat, 9 Mar 2013 21:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248117 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 21:32:25 -0000 Author: alc Date: Sat Mar 9 21:32:24 2013 New Revision: 248117 URL: http://svnweb.freebsd.org/changeset/base/248117 Log: Update a comment: The object lock is no longer a mutex. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Mar 9 21:21:47 2013 (r248116) +++ head/sys/vm/vm_page.c Sat Mar 9 21:32:24 2013 (r248117) @@ -73,7 +73,7 @@ * * The page daemon can acquire and hold any pair of page queue * locks in any order. * - * - The object mutex is held when inserting or removing + * - The object lock is required when inserting or removing * pages from an object (vm_page_insert() or vm_page_remove()). * */ From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 23:05:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E9B41D32; Sat, 9 Mar 2013 23:05:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B9E02EA5; Sat, 9 Mar 2013 23:05:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29N5KoH045847; Sat, 9 Mar 2013 23:05:20 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29N5KWW045846; Sat, 9 Mar 2013 23:05:20 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201303092305.r29N5KWW045846@svn.freebsd.org> From: Ian Lepore Date: Sat, 9 Mar 2013 23:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248118 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 23:05:21 -0000 Author: ian Date: Sat Mar 9 23:05:19 2013 New Revision: 248118 URL: http://svnweb.freebsd.org/changeset/base/248118 Log: Since ubldr doesn't necessarily load a kernel at the physical address in the elf headers, mask out the high nibble of that address. This effectly makes the entry point the offset from the load address, and it gets adjusted for the actual load address before jumping to it. Masking the high nibble makes assumptions about memory layout that are true for all the arm platforms we support right now, but it makes me uneasy. This needs to be revisited. Modified: head/sys/boot/common/load_elf.c Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Sat Mar 9 21:32:24 2013 (r248117) +++ head/sys/boot/common/load_elf.c Sat Mar 9 23:05:19 2013 (r248118) @@ -297,15 +297,16 @@ __elfN(loadimage)(struct preloaded_file * the MI code below uses the p_vaddr fields with an offset added for * loading (doing so is arguably wrong). To make loading work, we need * an offset that represents the difference between physical and virtual - * addressing. ARM kernels are always linked at 0xC0000000. Depending + * addressing. ARM kernels are always linked at 0xCnnnnnnn. Depending * on the headers, the offset value passed in may be physical or virtual * (because it typically comes from e_entry), but we always replace * whatever is passed in with the va<->pa offset. On the other hand, we - * only adjust the entry point if it's a virtual address to begin with. + * always remove the high-order part of the entry address whether it's + * physical or virtual, because it will be adjusted later for the actual + * physical entry point based on where the image gets loaded. */ - off = -0xc0000000u; - if ((ehdr->e_entry & 0xc0000000u) == 0xc0000000u) - ehdr->e_entry += off; + off = -0xc0000000; + ehdr->e_entry &= ~0xf0000000; #ifdef ELF_VERBOSE printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off); #endif From owner-svn-src-head@FreeBSD.ORG Sat Mar 9 23:55:24 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6D639E4E; Sat, 9 Mar 2013 23:55:24 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5EC4213F; Sat, 9 Mar 2013 23:55:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r29NtOuR061571; Sat, 9 Mar 2013 23:55:24 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r29NtORC061569; Sat, 9 Mar 2013 23:55:24 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201303092355.r29NtORC061569@svn.freebsd.org> From: Andrew Turner Date: Sat, 9 Mar 2013 23:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248119 - in head/sys/arm: 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 23:55:24 -0000 Author: andrew Date: Sat Mar 9 23:55:23 2013 New Revision: 248119 URL: http://svnweb.freebsd.org/changeset/base/248119 Log: __FreeBSD_ARCH_armv6__ is undefined on clang. We can use __ARM_ARCH in it's place. This makes 'uname -p' correctly output 'armv6' on a kernel built with clang. Modified: head/sys/arm/arm/disassem.c head/sys/arm/include/param.h Modified: head/sys/arm/arm/disassem.c ============================================================================== --- head/sys/arm/arm/disassem.c Sat Mar 9 23:05:19 2013 (r248118) +++ head/sys/arm/arm/disassem.c Sat Mar 9 23:55:23 2013 (r248119) @@ -130,7 +130,7 @@ static const struct arm32_insn arm32_i[] { 0x0c500000, 0x04100000, "ldr", "daW" }, { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, -#ifdef __FreeBSD_ARCH_armv6__ +#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6) { 0xffffffff, 0xf57ff01f, "clrex", "c" }, { 0x0ff00ff0, 0x01800f90, "strex", "dmo" }, { 0x0ff00fff, 0x01900f9f, "ldrex", "do" }, Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Sat Mar 9 23:05:19 2013 (r248118) +++ head/sys/arm/include/param.h Sat Mar 9 23:55:23 2013 (r248119) @@ -56,7 +56,7 @@ #define MACHINE "arm" #endif #ifndef MACHINE_ARCH -#ifdef __FreeBSD_ARCH_armv6__ +#if defined(__FreeBSD_ARCH_armv6__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 6) #ifdef __ARMEB__ #define MACHINE_ARCH "armv6eb" #else