From owner-svn-src-stable-7@FreeBSD.ORG Sun Jan 15 20:52:02 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31A2A1065670; Sun, 15 Jan 2012 20:52:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE018FC16; Sun, 15 Jan 2012 20:52:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0FKq2Gl099540; Sun, 15 Jan 2012 20:52:02 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0FKq1TB099538; Sun, 15 Jan 2012 20:52:01 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201152052.q0FKq1TB099538@svn.freebsd.org> From: Eitan Adler Date: Sun, 15 Jan 2012 20:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230158 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2012 20:52:02 -0000 Author: eadler (ports committer) Date: Sun Jan 15 20:52:01 2012 New Revision: 230158 URL: http://svn.freebsd.org/changeset/base/230158 Log: MFC r228343: - Fix ktrace leakage if error is set PR: kern/163098 Approved by: sbruno Modified: stable/7/sys/kern/kern_ktrace.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/kern/kern_ktrace.c ============================================================================== --- stable/7/sys/kern/kern_ktrace.c Sun Jan 15 20:43:39 2012 (r230157) +++ stable/7/sys/kern/kern_ktrace.c Sun Jan 15 20:52:01 2012 (r230158) @@ -462,7 +462,7 @@ ktrsysret(code, error, retval) ktp = &req->ktr_data.ktr_sysret; ktp->ktr_code = code; ktp->ktr_error = error; - ktp->ktr_retval = retval; /* what about val2 ? */ + ktp->ktr_retval = ((error == 0) ? retval: 0); /* what about val2 ? */ ktr_submitrequest(curthread, req); } From owner-svn-src-stable-7@FreeBSD.ORG Tue Jan 17 22:02:31 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FE43106567B; Tue, 17 Jan 2012 22:02:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D3B58FC12; Tue, 17 Jan 2012 22:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0HM2VuE009351; Tue, 17 Jan 2012 22:02:31 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HM2UPQ009347; Tue, 17 Jan 2012 22:02:30 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201172202.q0HM2UPQ009347@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 17 Jan 2012 22:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230283 - in stable/7/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2012 22:02:31 -0000 Author: bz Date: Tue Jan 17 22:02:30 2012 New Revision: 230283 URL: http://svn.freebsd.org/changeset/base/230283 Log: MFC r224516: Introduce a tunable to disable the time consuming parts of bootup memtesting, which can easily save seconds to minutes of boot time. The tunable name is kept general to allow reusing the code in alternate frameworks. Modified: stable/7/sys/amd64/amd64/machdep.c stable/7/sys/i386/i386/machdep.c stable/7/sys/pc98/pc98/machdep.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/amd64/amd64/machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:02:11 2012 (r230282) +++ stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:02:30 2012 (r230283) @@ -956,7 +956,7 @@ getmemsize(caddr_t kmdp, u_int64_t first { int i, off, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; pt_entry_t *pte; struct bios_smap *smapbase, *smap, *smapend; u_int32_t smapsize; @@ -1019,6 +1019,14 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + + /* * Don't allow MAXMEM or hw.physmem to extend the amount of memory * in the system. */ @@ -1080,6 +1088,8 @@ getmemsize(caddr_t kmdp, u_int64_t first goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -1117,6 +1127,7 @@ getmemsize(caddr_t kmdp, u_int64_t first */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ Modified: stable/7/sys/i386/i386/machdep.c ============================================================================== --- stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:02:11 2012 (r230282) +++ stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:02:30 2012 (r230283) @@ -1809,7 +1809,7 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -2005,6 +2005,14 @@ physmap_done: if (has_smap && Maxmem > atop(physmap[physmap_idx + 1])) Maxmem = atop(physmap[physmap_idx + 1]); + /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); @@ -2067,6 +2075,8 @@ physmap_done: goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -2104,6 +2114,7 @@ physmap_done: */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ Modified: stable/7/sys/pc98/pc98/machdep.c ============================================================================== --- stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:02:11 2012 (r230282) +++ stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:02:30 2012 (r230283) @@ -1697,7 +1697,7 @@ static void getmemsize(int first) { int off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable; + u_long physmem_tunable, memtest, tmpul; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -1757,6 +1757,14 @@ getmemsize(int first) if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); + /* + * By default keep the memtest enabled. Use a general name so that + * one could eventually do more with the code than just disable it. + */ + memtest = 1; + if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) + memtest = tmpul; + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); @@ -1833,6 +1841,8 @@ getmemsize(int first) goto do_dump_avail; page_bad = FALSE; + if (memtest == 0) + goto skip_memtest; /* * map page into kernel: valid, read/write,non-cacheable @@ -1870,6 +1880,7 @@ getmemsize(int first) */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ From owner-svn-src-stable-7@FreeBSD.ORG Tue Jan 17 22:09:33 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AA051065787; Tue, 17 Jan 2012 22:09:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7568FC17; Tue, 17 Jan 2012 22:09:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0HM9XTV009662; Tue, 17 Jan 2012 22:09:33 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0HM9X3u009658; Tue, 17 Jan 2012 22:09:33 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201172209.q0HM9X3u009658@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 17 Jan 2012 22:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230285 - in stable/7/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2012 22:09:33 -0000 Author: bz Date: Tue Jan 17 22:09:33 2012 New Revision: 230285 URL: http://svn.freebsd.org/changeset/base/230285 Log: MFC r225048: In this branch when doing no further checkes there is no reason use the temporary variable and check with if as TUNABLE_*_FETCH do not alter values unless successfully found the tunable. Modified: stable/7/sys/amd64/amd64/machdep.c stable/7/sys/i386/i386/machdep.c stable/7/sys/pc98/pc98/machdep.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/amd64/amd64/machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:08:58 2012 (r230284) +++ stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:09:33 2012 (r230285) @@ -956,7 +956,7 @@ getmemsize(caddr_t kmdp, u_int64_t first { int i, off, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; pt_entry_t *pte; struct bios_smap *smapbase, *smap, *smapend; u_int32_t smapsize; @@ -1023,8 +1023,7 @@ getmemsize(caddr_t kmdp, u_int64_t first * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* * Don't allow MAXMEM or hw.physmem to extend the amount of memory Modified: stable/7/sys/i386/i386/machdep.c ============================================================================== --- stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:08:58 2012 (r230284) +++ stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:09:33 2012 (r230285) @@ -1809,7 +1809,7 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -2010,8 +2010,7 @@ physmap_done: * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) Modified: stable/7/sys/pc98/pc98/machdep.c ============================================================================== --- stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:08:58 2012 (r230284) +++ stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:09:33 2012 (r230285) @@ -1697,7 +1697,7 @@ static void getmemsize(int first) { int off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest, tmpul; + u_long physmem_tunable, memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; quad_t dcons_addr, dcons_size; @@ -1762,8 +1762,7 @@ getmemsize(int first) * one could eventually do more with the code than just disable it. */ memtest = 1; - if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul)) - memtest = tmpul; + TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) From owner-svn-src-stable-7@FreeBSD.ORG Wed Jan 18 21:51:56 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3AD8106564A; Wed, 18 Jan 2012 21:51:56 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1DFD8FC29; Wed, 18 Jan 2012 21:51:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0ILpuwq058501; Wed, 18 Jan 2012 21:51:56 GMT (envelope-from truckman@svn.freebsd.org) Received: (from truckman@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0ILpurr058499; Wed, 18 Jan 2012 21:51:56 GMT (envelope-from truckman@svn.freebsd.org) Message-Id: <201201182151.q0ILpurr058499@svn.freebsd.org> From: Don Lewis Date: Wed, 18 Jan 2012 21:51:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230319 - stable/7/sys/dev/pst X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2012 21:51:56 -0000 Author: truckman Date: Wed Jan 18 21:51:56 2012 New Revision: 230319 URL: http://svn.freebsd.org/changeset/base/230319 Log: MFC: r229984 Pass the arguments to mtx_init() in the correct order. There should be no change to the binary because the value of MTX_DEF is zero and there is a visible function prototype. Modified: stable/7/sys/dev/pst/pst-pci.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/pst/pst-pci.c ============================================================================== --- stable/7/sys/dev/pst/pst-pci.c Wed Jan 18 21:50:59 2012 (r230318) +++ stable/7/sys/dev/pst/pst-pci.c Wed Jan 18 21:51:56 2012 (r230319) @@ -95,7 +95,7 @@ iop_pci_attach(device_t dev) sc->ibase = rman_get_virtual(sc->r_mem); sc->reg = (struct i2o_registers *)sc->ibase; sc->dev = dev; - mtx_init(&sc->mtx, "pst lock", MTX_DEF, 0); + mtx_init(&sc->mtx, "pst lock", NULL, MTX_DEF); if (!iop_init(sc)) return 0; From owner-svn-src-stable-7@FreeBSD.ORG Fri Jan 20 15:46:47 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D9661065674; Fri, 20 Jan 2012 15:46:47 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A298FC12; Fri, 20 Jan 2012 15:46:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0KFkllF048088; Fri, 20 Jan 2012 15:46:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0KFklMM048086; Fri, 20 Jan 2012 15:46:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201201546.q0KFklMM048086@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 20 Jan 2012 15:46:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230383 - stable/7/usr.bin/xlint/xlint X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2012 15:46:47 -0000 Author: jilles Date: Fri Jan 20 15:46:46 2012 New Revision: 230383 URL: http://svn.freebsd.org/changeset/base/230383 Log: MFC r227123: lint: Fix lseek() argument order. Because SEEK_SET is 0, this seems to have no effect on the generated code. PR: bin/160806 Submitted by: Henning Petersen Obtained from: NetBSD Modified: stable/7/usr.bin/xlint/xlint/xlint.c Directory Properties: stable/7/usr.bin/xlint/ (props changed) Modified: stable/7/usr.bin/xlint/xlint/xlint.c ============================================================================== --- stable/7/usr.bin/xlint/xlint/xlint.c Fri Jan 20 15:44:39 2012 (r230382) +++ stable/7/usr.bin/xlint/xlint/xlint.c Fri Jan 20 15:46:46 2012 (r230383) @@ -655,7 +655,7 @@ fname(const char *name) appcstrg(&args, name); /* we reuse the same tmp file for cpp output, so rewind and truncate */ - if (lseek(cppoutfd, SEEK_SET, (off_t)0) != 0) { + if (lseek(cppoutfd, (off_t)0, SEEK_SET) != 0) { warn("lseek"); terminate(-1); } From owner-svn-src-stable-7@FreeBSD.ORG Fri Jan 20 16:34:15 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096AD106566B; Fri, 20 Jan 2012 16:34:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7ADA8FC08; Fri, 20 Jan 2012 16:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0KGYECH049769; Fri, 20 Jan 2012 16:34:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0KGYEwq049767; Fri, 20 Jan 2012 16:34:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201201634.q0KGYEwq049767@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 20 Jan 2012 16:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230386 - stable/7/tools/regression/fifo/fifo_misc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2012 16:34:15 -0000 Author: jilles Date: Fri Jan 20 16:34:14 2012 New Revision: 230386 URL: http://svn.freebsd.org/changeset/base/230386 Log: MFC r227124: fifo_misc test: Fix swapped lseek arguments. It worked regardless because SEEK_CUR happens to be 1. PR: misc/160866 Modified: stable/7/tools/regression/fifo/fifo_misc/fifo_misc.c Directory Properties: stable/7/tools/regression/fifo/ (props changed) Modified: stable/7/tools/regression/fifo/fifo_misc/fifo_misc.c ============================================================================== --- stable/7/tools/regression/fifo/fifo_misc/fifo_misc.c Fri Jan 20 16:31:44 2012 (r230385) +++ stable/7/tools/regression/fifo/fifo_misc/fifo_misc.c Fri Jan 20 16:34:14 2012 (r230386) @@ -115,7 +115,7 @@ test_lseek(void) exit(-1); } - if (lseek(reader_fd, SEEK_CUR, 1) >= 0) { + if (lseek(reader_fd, 1, SEEK_CUR) >= 0) { warnx("%s: lseek succeeded instead of returning ESPIPE", __func__); cleanfifo("testfifo", reader_fd, writer_fd); From owner-svn-src-stable-7@FreeBSD.ORG Sat Jan 21 04:24:20 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAFDA106566C; Sat, 21 Jan 2012 04:24:20 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EC328FC0A; Sat, 21 Jan 2012 04:24:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0L4OKQ5073871; Sat, 21 Jan 2012 04:24:20 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L4OKmO073869; Sat, 21 Jan 2012 04:24:20 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201201210424.q0L4OKmO073869@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 21 Jan 2012 04:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230417 - stable/7/sys/net X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 04:24:20 -0000 Author: lstewart Date: Sat Jan 21 04:24:19 2012 New Revision: 230417 URL: http://svn.freebsd.org/changeset/base/230417 Log: MFC r229898: Consumers of bpfdetach() expect it to remove all bpf_if structs from the bpf_iflist list which reference the specified ifnet. The existing implementation only removes the first matching bpf_if found in the list, effectively leaking list entries if an ifnet has been bpfattach()ed multiple times with different DLTs. Fix the leak by performing the detach logic in a loop, stopping when all bpf_if structs referencing the specified ifnet have been detached and removed from the bpf_iflist list. Whilst here, also: - Remove the unnecessary "bp->bif_ifp == NULL" check, as a bpf_if should never exist in the list with a NULL ifnet pointer. - Except when INVARIANTS is in the kernel config, silently ignore the case where no bpf_if referencing the specified ifnet is found, as it is harmless and does not require user attention. Reviewed by: csjp Modified: stable/7/sys/net/bpf.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/net/bpf.c ============================================================================== --- stable/7/sys/net/bpf.c Sat Jan 21 04:22:19 2012 (r230416) +++ stable/7/sys/net/bpf.c Sat Jan 21 04:24:19 2012 (r230417) @@ -1658,33 +1658,42 @@ bpfdetach(struct ifnet *ifp) { struct bpf_if *bp; struct bpf_d *d; +#ifdef INVARIANTS + int ndetached; - /* Locate BPF interface information */ - mtx_lock(&bpf_mtx); - LIST_FOREACH(bp, &bpf_iflist, bif_next) { - if (ifp == bp->bif_ifp) - break; - } + ndetached = 0; +#endif - /* Interface wasn't attached */ - if ((bp == NULL) || (bp->bif_ifp == NULL)) { + /* Find all bpf_if struct's which reference ifp and detach them. */ + do { + mtx_lock(&bpf_mtx); + LIST_FOREACH(bp, &bpf_iflist, bif_next) { + if (ifp == bp->bif_ifp) + break; + } + if (bp != NULL) + LIST_REMOVE(bp, bif_next); mtx_unlock(&bpf_mtx); - printf("bpfdetach: %s was not attached\n", ifp->if_xname); - return; - } - LIST_REMOVE(bp, bif_next); - mtx_unlock(&bpf_mtx); - - while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { - bpf_detachd(d); - BPFD_LOCK(d); - bpf_wakeup(d); - BPFD_UNLOCK(d); - } + if (bp != NULL) { +#ifdef INVARIANTS + ndetached++; +#endif + while ((d = LIST_FIRST(&bp->bif_dlist)) != NULL) { + bpf_detachd(d); + BPFD_LOCK(d); + bpf_wakeup(d); + BPFD_UNLOCK(d); + } + mtx_destroy(&bp->bif_mtx); + free(bp, M_BPF); + } + } while (bp != NULL); - mtx_destroy(&bp->bif_mtx); - free(bp, M_BPF); +#ifdef INVARIANTS + if (ndetached == 0) + printf("bpfdetach: %s was not attached\n", ifp->if_xname); +#endif } /* From owner-svn-src-stable-7@FreeBSD.ORG Sat Jan 21 07:57:28 2012 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB5F9106566C; Sat, 21 Jan 2012 07:57:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8AE8FC0C; Sat, 21 Jan 2012 07:57:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0L7vS5v080932; Sat, 21 Jan 2012 07:57:28 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0L7vS0h080930; Sat, 21 Jan 2012 07:57:28 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201210757.q0L7vS0h080930@svn.freebsd.org> From: Alan Cox Date: Sat, 21 Jan 2012 07:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230420 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 07:57:28 -0000 Author: alc Date: Sat Jan 21 07:57:27 2012 New Revision: 230420 URL: http://svn.freebsd.org/changeset/base/230420 Log: MFC r226163, r228317, and r228324 Fix the handling of an empty kmem map by sysctl_kmem_map_free(). Eliminate the possibility of 32-bit arithmetic overflow in the calculation of vm_kmem_size that may occur if the system administrator has specified a vm.vm_kmem_size tunable value that exceeds the hard cap. Eliminate stale numbers from a comment. PR: 162741 Modified: stable/7/sys/kern/kern_malloc.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/kern_malloc.c ============================================================================== --- stable/7/sys/kern/kern_malloc.c Sat Jan 21 07:21:44 2012 (r230419) +++ stable/7/sys/kern/kern_malloc.c Sat Jan 21 07:57:27 2012 (r230420) @@ -258,8 +258,8 @@ sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS u_long size; vm_map_lock_read(kmem_map); - size = kmem_map->root != NULL ? - kmem_map->root->max_free : kmem_map->size; + size = kmem_map->root != NULL ? kmem_map->root->max_free : + kmem_map->max_offset - kmem_map->min_offset; vm_map_unlock_read(kmem_map); return (sysctl_handle_long(oidp, &size, 0, req)); } @@ -594,12 +594,9 @@ kmeminit(void *dummy) /* * Try to auto-tune the kernel memory size, so that it is - * more applicable for a wider range of machine sizes. - * On an X86, a VM_KMEM_SIZE_SCALE value of 4 is good, while - * a VM_KMEM_SIZE of 12MB is a fair compromise. The + * more applicable for a wider range of machine sizes. The * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space - * available, and on an X86 with a total KVA space of 256MB, - * try to keep VM_KMEM_SIZE_MAX at 80MB or below. + * available. * * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. @@ -640,11 +637,11 @@ kmeminit(void *dummy) /* * Limit kmem virtual size to twice the physical memory. * This allows for kmem map sparseness, but limits the size - * to something sane. Be careful to not overflow the 32bit - * ints while doing the check. + * to something sane. Be careful to not overflow the 32bit + * ints while doing the check or the adjustment. */ - if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count) - vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; + if (vm_kmem_size / 2 / PAGE_SIZE > mem_size) + vm_kmem_size = 2 * mem_size * PAGE_SIZE; /* * Tune settings based on the kmem map's size at this time.