From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 13:55:34 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0308EDD6; Sun, 5 Jan 2014 13:55:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E23BE121B; Sun, 5 Jan 2014 13:55:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05DtXlm098074; Sun, 5 Jan 2014 13:55:33 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05DtXP5098073; Sun, 5 Jan 2014 13:55:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401051355.s05DtXP5098073@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 5 Jan 2014 13:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260319 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 13:55:34 -0000 Author: glebius Date: Sun Jan 5 13:55:33 2014 New Revision: 260319 URL: http://svnweb.freebsd.org/changeset/base/260319 Log: Merge r260188 from head: Fix regression from r249894. Now we pass "gw" as argument to if_output method, thus for multicast case we need it to point at "dst". PR: 185395 Modified: stable/10/sys/netinet/ip_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_output.c ============================================================================== --- stable/10/sys/netinet/ip_output.c Sun Jan 5 11:58:07 2014 (r260318) +++ stable/10/sys/netinet/ip_output.c Sun Jan 5 13:55:33 2014 (r260319) @@ -331,6 +331,12 @@ again: if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { m->m_flags |= M_MCAST; /* + * IP destination address is multicast. Make sure "gw" + * still points to the address in "ro". (It may have been + * changed to point to a gateway address, above.) + */ + gw = dst; + /* * See if the caller provided any multicast options */ if (imo != NULL) { From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 15:39:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3883DD55; Sun, 5 Jan 2014 15:39:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 21BC319F3; Sun, 5 Jan 2014 15:39:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05FdfQx043557; Sun, 5 Jan 2014 15:39:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05Fddno043545; Sun, 5 Jan 2014 15:39:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201401051539.s05Fddno043545@svn.freebsd.org> From: Dimitry Andric Date: Sun, 5 Jan 2014 15:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260321 - in stable: 10/sys/conf 10/sys/modules/drm2/radeonkms 10/sys/modules/ibcore 10/sys/modules/ipoib 10/sys/modules/mlx4 10/sys/modules/mlx4ib 10/sys/modules/mlxen 10/sys/modules/m... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 15:39:41 -0000 Author: dim Date: Sun Jan 5 15:39:37 2014 New Revision: 260321 URL: http://svnweb.freebsd.org/changeset/base/260321 Log: Revert MFC of r260102 for now, until I can merge the required fix from head. This should fix building modules which require -fms-extensions to compile them with gcc. Modified: stable/10/sys/conf/kern.pre.mk stable/10/sys/modules/drm2/radeonkms/Makefile stable/10/sys/modules/ibcore/Makefile stable/10/sys/modules/ipoib/Makefile stable/10/sys/modules/mlx4/Makefile stable/10/sys/modules/mlx4ib/Makefile stable/10/sys/modules/mlxen/Makefile stable/10/sys/modules/mthca/Makefile stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile stable/10/sys/ofed/drivers/net/mlx4/Makefile Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/conf/kern.pre.mk stable/9/sys/modules/mlx4/Makefile stable/9/sys/modules/mlx4ib/Makefile stable/9/sys/modules/mlxen/Makefile stable/9/sys/modules/mthca/Makefile Directory Properties: stable/9/sys/ (props changed) Modified: stable/10/sys/conf/kern.pre.mk ============================================================================== --- stable/10/sys/conf/kern.pre.mk Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/conf/kern.pre.mk Sun Jan 5 15:39:37 2014 (r260321) @@ -99,8 +99,6 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO .if ${COMPILER_TYPE} == "clang" CLANG_NO_IAS= -no-integrated-as -.else -GCC_MS_EXTENSIONS= -fms-extensions .endif .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 @@ -159,7 +157,7 @@ NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLA # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include/ -OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} Modified: stable/10/sys/modules/drm2/radeonkms/Makefile ============================================================================== --- stable/10/sys/modules/drm2/radeonkms/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/drm2/radeonkms/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -103,6 +103,9 @@ SRCS += \ iicbus_if.h \ pci_if.h -CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon ${GCC_MS_EXTENSIONS} +CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon +.if ${COMPILER_TYPE} == "gcc" +CFLAGS += -fms-extensions +.endif .include Modified: stable/10/sys/modules/ibcore/Makefile ============================================================================== --- stable/10/sys/modules/ibcore/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/ibcore/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -20,7 +20,7 @@ CFLAGS+= -DINET6 -DINET -DOFED .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions CWARNFLAGS.cm.c= -Wno-unused-function CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/10/sys/modules/ipoib/Makefile ============================================================================== --- stable/10/sys/modules/ipoib/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/ipoib/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Modified: stable/10/sys/modules/mlx4/Makefile ============================================================================== --- stable/10/sys/modules/mlx4/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/mlx4/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -27,6 +27,7 @@ opt_inet6.h: .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions CWARNFLAGS.mcg.c= -Wno-unused CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/10/sys/modules/mlx4ib/Makefile ============================================================================== --- stable/10/sys/modules/mlx4ib/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/mlx4ib/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -31,4 +31,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Modified: stable/10/sys/modules/mlxen/Makefile ============================================================================== --- stable/10/sys/modules/mlxen/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/mlxen/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -25,4 +25,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Modified: stable/10/sys/modules/mthca/Makefile ============================================================================== --- stable/10/sys/modules/mthca/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/modules/mthca/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Modified: stable/10/sys/ofed/drivers/net/mlx4/Makefile ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/Makefile Sun Jan 5 15:33:33 2014 (r260320) +++ stable/10/sys/ofed/drivers/net/mlx4/Makefile Sun Jan 5 15:39:37 2014 (r260321) @@ -30,5 +30,5 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 17:29:54 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31E01959; Sun, 5 Jan 2014 17:29:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1DB6E138D; Sun, 5 Jan 2014 17:29:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05HTrBp089906; Sun, 5 Jan 2014 17:29:53 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05HTrR8089905; Sun, 5 Jan 2014 17:29:53 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201401051729.s05HTrR8089905@svn.freebsd.org> From: Sean Bruno Date: Sun, 5 Jan 2014 17:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260324 - stable/10/usr.sbin/mfiutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 17:29:54 -0000 Author: sbruno Date: Sun Jan 5 17:29:53 2014 New Revision: 260324 URL: http://svnweb.freebsd.org/changeset/base/260324 Log: MFC r258901: svn r251516 resized the buf argument a bit too much. Pass a hardcoded size of 6 to humanize_number() to resolve this. PR: bin/184405 Submitted by: jhb Modified: stable/10/usr.sbin/mfiutil/mfi_show.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- stable/10/usr.sbin/mfiutil/mfi_show.c Sun Jan 5 16:45:34 2014 (r260323) +++ stable/10/usr.sbin/mfiutil/mfi_show.c Sun Jan 5 17:29:53 2014 (r260324) @@ -320,7 +320,7 @@ print_pd(struct mfi_pd_info *info, int s const char *s; char buf[256]; - humanize_number(buf, sizeof(buf), info->raw_size * 512, "", + humanize_number(buf, 6, info->raw_size * 512, "", HN_AUTOSCALE, HN_B | HN_NOSPACE |HN_DECIMAL); printf("(%6s) ", buf); if (info->state.ddf.v.pd_type.is_foreign) { From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:09:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D6AA41F; Sun, 5 Jan 2014 22:09:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 87B6C1865; Sun, 5 Jan 2014 22:09:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05M9Jjm099970; Sun, 5 Jan 2014 22:09:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05M9IlX099965; Sun, 5 Jan 2014 22:09:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052209.s05M9IlX099965@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260337 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:09:19 -0000 Author: mav Date: Sun Jan 5 22:09:18 2014 New Revision: 260337 URL: http://svnweb.freebsd.org/changeset/base/260337 Log: MFC r258137: Introduce allocation cache to store LZ4 compression contexts without kicking VM subsystem twice for every written record. Tests on 24-core system show double reduction of CPU time spent on copying single large well-compressed file. This patch is not really needed on illumos (while not harm either) since their memory allocator by default uses caching for all requests up to 128K. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sun Jan 5 21:44:04 2014 (r260336) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Sun Jan 5 22:09:18 2014 (r260337) @@ -44,6 +44,8 @@ static int LZ4_compressCtx(void *ctx, co static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest, int isize, int osize); +static kmem_cache_t *lz4_ctx_cache; + /*ARGSUSED*/ size_t lz4_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n) @@ -840,7 +842,7 @@ static int real_LZ4_compress(const char *source, char *dest, int isize, int osize) { #if HEAPMODE - void *ctx = kmem_zalloc(sizeof (struct refTables), KM_NOSLEEP); + void *ctx = kmem_cache_alloc(lz4_ctx_cache, KM_NOSLEEP); int result; /* @@ -850,12 +852,13 @@ real_LZ4_compress(const char *source, ch if (ctx == NULL) return (0); + bzero(ctx, sizeof(struct refTables)); if (isize < LZ4_64KLIMIT) result = LZ4_compress64kCtx(ctx, source, dest, isize, osize); else result = LZ4_compressCtx(ctx, source, dest, isize, osize); - kmem_free(ctx, sizeof (struct refTables)); + kmem_cache_free(lz4_ctx_cache, ctx); return (result); #else if (isize < (int)LZ4_64KLIMIT) @@ -1001,3 +1004,22 @@ LZ4_uncompress_unknownOutputSize(const c _output_error: return (int)(-(((char *)ip) - source)); } + +extern void +lz4_init(void) +{ + +#if HEAPMODE + lz4_ctx_cache = kmem_cache_create("lz4_ctx", sizeof(struct refTables), + 0, NULL, NULL, NULL, NULL, NULL, 0); +#endif +} + +extern void +lz4_fini(void) +{ + +#if HEAPMODE + kmem_cache_destroy(lz4_ctx_cache); +#endif +} Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Jan 5 21:44:04 2014 (r260336) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Jan 5 22:09:18 2014 (r260337) @@ -1739,6 +1739,7 @@ spa_init(int mode) unique_init(); space_map_init(); zio_init(); + lz4_init(); dmu_init(); zil_init(); vdev_cache_stat_init(); @@ -1764,6 +1765,7 @@ spa_fini(void) vdev_cache_stat_fini(); zil_fini(); dmu_fini(); + lz4_fini(); zio_fini(); space_map_fini(); unique_fini(); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sun Jan 5 21:44:04 2014 (r260336) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h Sun Jan 5 22:09:18 2014 (r260337) @@ -70,6 +70,8 @@ extern size_t zle_compress(void *src, vo int level); extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len, int level); +extern void lz4_init(void); +extern void lz4_fini(void); extern size_t lz4_compress(void *src, void *dst, size_t s_len, size_t d_len, int level); extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len, From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:12:46 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8182E61F; Sun, 5 Jan 2014 22:12:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 65D5F18D4; Sun, 5 Jan 2014 22:12:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MCknE003256; Sun, 5 Jan 2014 22:12:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MCkh8003255; Sun, 5 Jan 2014 22:12:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052212.s05MCkh8003255@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:12:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260338 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:12:46 -0000 Author: mav Date: Sun Jan 5 22:12:45 2014 New Revision: 260338 URL: http://svnweb.freebsd.org/changeset/base/260338 Log: MFC r258342: Reenable vfs.zfs.zio.use_uma for amd64, disabled at r209261. On machines with seveal CPUs and enough RAM this can easily twice improve ZFS performance or twice reduce CPU usage. It was disabled three years ago due to memory and KVA exhaustion reports, but our VM subsystem got improved a lot since that time, hopefully enough to make another try. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Jan 5 22:09:18 2014 (r260337) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Jan 5 22:12:45 2014 (r260338) @@ -39,7 +39,11 @@ SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, zio, CTLFLAG_RW, 0, "ZFS ZIO"); +#if defined(__amd64__) +static int zio_use_uma = 1; +#else static int zio_use_uma = 0; +#endif TUNABLE_INT("vfs.zfs.zio.use_uma", &zio_use_uma); SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, use_uma, CTLFLAG_RDTUN, &zio_use_uma, 0, "Use uma(9) for ZIO allocations"); From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:14:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17772783; Sun, 5 Jan 2014 22:14:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EBED318DC; Sun, 5 Jan 2014 22:14:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MECXl003513; Sun, 5 Jan 2014 22:14:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MECxh003510; Sun, 5 Jan 2014 22:14:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052214.s05MECxh003510@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260339 - in stable/10: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:14:13 -0000 Author: mav Date: Sun Jan 5 22:14:12 2014 New Revision: 260339 URL: http://svnweb.freebsd.org/changeset/base/260339 Log: MFC r259168: Don't even try to read vdev labels from devices smaller then SPA_MINDEVSIZE (64MB). Even if we would find one somehow, ZFS kernel code rejects such devices. It is funny to look on attempts to read 4 256K vdev labels from 1.44MB floppy, though it is not very practical and quite slow. Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Sun Jan 5 22:12:45 2014 (r260338) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Sun Jan 5 22:14:12 2014 (r260339) @@ -995,10 +995,10 @@ nozpool_all_slices(avl_tree_t *r, const #endif /* sun */ } +#ifdef sun static void check_slices(avl_tree_t *r, int fd, const char *sname) { -#ifdef sun struct extvtoc vtoc; struct dk_gpt *gpt; char diskname[MAXNAMELEN]; @@ -1028,8 +1028,8 @@ check_slices(avl_tree_t *r, int fd, cons check_one_slice(r, diskname, i, 0, 1); efi_free(gpt); } -#endif /* sun */ } +#endif /* sun */ static void zpool_open_func(void *arg) @@ -1059,6 +1059,7 @@ zpool_open_func(void *arg) return; } /* this file is too small to hold a zpool */ +#ifdef sun if (S_ISREG(statbuf.st_mode) && statbuf.st_size < SPA_MINDEVSIZE) { (void) close(fd); @@ -1070,6 +1071,12 @@ zpool_open_func(void *arg) */ check_slices(rn->rn_avl, fd, rn->rn_name); } +#else /* !sun */ + if (statbuf.st_size < SPA_MINDEVSIZE) { + (void) close(fd); + return; + } +#endif /* sun */ if ((zpool_read_label(fd, &config)) != 0) { (void) close(fd); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jan 5 22:12:45 2014 (r260338) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jan 5 22:14:12 2014 (r260339) @@ -370,10 +370,16 @@ vdev_geom_attach_taster(struct g_consume if (pp->flags & G_PF_WITHER) return (EINVAL); - if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) - return (EINVAL); g_attach(cp, pp); error = g_access(cp, 1, 0, 0); + if (error == 0) { + if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) + error = EINVAL; + else if (pp->mediasize < SPA_MINDEVSIZE) + error = EINVAL; + if (error != 0) + g_access(cp, -1, 0, 0); + } if (error != 0) g_detach(cp); return (error); From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:38:45 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B2BC7289; Sun, 5 Jan 2014 22:38:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 82A681A92; Sun, 5 Jan 2014 22:38:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05McjCi011440; Sun, 5 Jan 2014 22:38:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MciDn011436; Sun, 5 Jan 2014 22:38:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052238.s05MciDn011436@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260341 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:38:45 -0000 Author: mav Date: Sun Jan 5 22:38:44 2014 New Revision: 260341 URL: http://svnweb.freebsd.org/changeset/base/260341 Log: MFC r256705: Optimize isp(4) to reduce CPU usage, especially in target mode: - Remove two excessive and slow register reads from isp_intr(). Instead of rereading value every time, assume that registers contain what we have written there. - Avoid sequential search through 4096 array elements when looking for command tag. Use hash of lists to store active tags separately from free ones and so greatly speedup the searches. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Sun Jan 5 22:36:34 2014 (r260340) +++ stable/10/sys/dev/isp/isp.c Sun Jan 5 22:38:44 2014 (r260341) @@ -1422,7 +1422,7 @@ isp_scsi_init(ispsoftc_t *isp) if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; } - isp->isp_residx = mbs.param[5]; + isp->isp_residx = isp->isp_resodx = mbs.param[5]; MBSINIT(&mbs, MBOX_INIT_REQ_QUEUE_A64, MBLOGALL, 0); mbs.param[1] = RQUEST_QUEUE_LEN(isp); @@ -1446,7 +1446,7 @@ isp_scsi_init(ispsoftc_t *isp) if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; } - isp->isp_residx = mbs.param[5]; + isp->isp_residx = isp->isp_resodx = mbs.param[5]; MBSINIT(&mbs, MBOX_INIT_REQ_QUEUE, MBLOGALL, 0); mbs.param[1] = RQUEST_QUEUE_LEN(isp); @@ -1918,6 +1918,7 @@ isp_fibre_init(ispsoftc_t *isp) isp->isp_reqidx = 0; isp->isp_reqodx = 0; isp->isp_residx = 0; + isp->isp_resodx = 0; /* * Whatever happens, we're now committed to being here. @@ -2208,6 +2209,8 @@ isp_fibre_init_2400(ispsoftc_t *isp) isp->isp_reqidx = 0; isp->isp_reqodx = 0; isp->isp_residx = 0; + isp->isp_resodx = 0; + isp->isp_atioodx = 0; /* * Whatever happens, we're now committed to being here. @@ -5015,7 +5018,6 @@ isp_intr(ispsoftc_t *isp, uint32_t isr, int etype, last_etype = 0; again: - optr = isp->isp_residx; /* * Is this a mailbox related interrupt? * The mailbox semaphore will be nonzero if so. @@ -5067,7 +5069,9 @@ again: /* * Thank you very much! *Burrrp*! */ - ISP_WRITE(isp, isp->isp_respoutrp, ISP_READ(isp, isp->isp_respinrp)); + isp->isp_residx = ISP_READ(isp, isp->isp_respinrp); + isp->isp_resodx = isp->isp_residx; + ISP_WRITE(isp, isp->isp_respoutrp, isp->isp_resodx); if (IS_24XX(isp)) { ISP_DISABLE_INTS(isp); } @@ -5080,7 +5084,7 @@ again: */ if (IS_24XX(isp)) { iptr = ISP_READ(isp, BIU2400_ATIO_RSPINP); - optr = ISP_READ(isp, BIU2400_ATIO_RSPOUTP); + optr = isp->isp_atioodx; while (optr != iptr) { uint8_t qe[QENTRY_LEN]; @@ -5105,7 +5109,7 @@ again: optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp)); ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, optr); } - optr = isp->isp_residx; + isp->isp_atioodx = optr; } #endif @@ -5114,18 +5118,19 @@ again: * * If we're a 2300 or 2400, we can ask what hardware what it thinks. */ +#if 0 if (IS_23XX(isp) || IS_24XX(isp)) { optr = ISP_READ(isp, isp->isp_respoutrp); /* * Debug: to be taken out eventually */ - if (isp->isp_residx != optr) { - isp_prt(isp, ISP_LOGINFO, "isp_intr: hard optr=%x, soft optr %x", optr, isp->isp_residx); - isp->isp_residx = optr; + if (isp->isp_resodx != optr) { + isp_prt(isp, ISP_LOGINFO, "isp_intr: hard optr=%x, soft optr %x", optr, isp->isp_resodx); + isp->isp_resodx = optr; } - } else { - optr = isp->isp_residx; - } + } else +#endif + optr = isp->isp_resodx; /* * You *must* read the Response Queue In Pointer @@ -5147,8 +5152,6 @@ again: } else { iptr = ISP_READ(isp, isp->isp_respinrp); } - isp->isp_resodx = iptr; - if (optr == iptr && sema == 0) { /* @@ -5182,7 +5185,7 @@ again: isp_prt(isp, ISP_LOGDEBUG1, "bogus intr- isr %x (%x) iptr %x optr %x", isr, junk, iptr, optr); } } - isp->isp_resodx = iptr; + isp->isp_residx = iptr; while (optr != iptr) { uint8_t qe[QENTRY_LEN]; @@ -5552,13 +5555,9 @@ again: */ if (nlooked) { ISP_WRITE(isp, isp->isp_respoutrp, optr); - /* - * While we're at it, read the requst queue out pointer. - */ - isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); - if (isp->isp_rscchiwater < ndone) { + isp->isp_resodx = optr; + if (isp->isp_rscchiwater < ndone) isp->isp_rscchiwater = ndone; - } } out: @@ -5570,7 +5569,6 @@ out: ISP_WRITE(isp, BIU_SEMA, 0); } - isp->isp_residx = optr; for (i = 0; i < ndone; i++) { xs = complist[i]; if (xs) { Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Sun Jan 5 22:36:34 2014 (r260340) +++ stable/10/sys/dev/isp/isp_freebsd.c Sun Jan 5 22:38:44 2014 (r260341) @@ -804,6 +804,7 @@ static ISP_INLINE tstate_t *get_lun_stat static ISP_INLINE void rls_lun_statep(ispsoftc_t *, tstate_t *); static ISP_INLINE inot_private_data_t *get_ntp_from_tagdata(ispsoftc_t *, uint32_t, uint32_t, tstate_t **); static ISP_INLINE atio_private_data_t *isp_get_atpd(ispsoftc_t *, tstate_t *, uint32_t); +static ISP_INLINE atio_private_data_t *isp_find_atpd(ispsoftc_t *, tstate_t *, uint32_t); static ISP_INLINE void isp_put_atpd(ispsoftc_t *, tstate_t *, atio_private_data_t *); static ISP_INLINE inot_private_data_t *isp_get_ntpd(ispsoftc_t *, tstate_t *); static ISP_INLINE inot_private_data_t *isp_find_ntpd(ispsoftc_t *, tstate_t *, uint32_t, uint32_t); @@ -937,8 +938,8 @@ get_lun_statep_from_tag(ispsoftc_t *isp, for (i = 0; i < LUN_HASH_SIZE; i++) { ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); SLIST_FOREACH(tptr, lhp, next) { - atp = isp_get_atpd(isp, tptr, tagval); - if (atp && atp->tag == tagval) { + atp = isp_find_atpd(isp, tptr, tagval); + if (atp) { tptr->hold++; return (tptr); } @@ -1034,17 +1035,23 @@ isp_get_atpd(ispsoftc_t *isp, tstate_t * { atio_private_data_t *atp; - if (tag == 0) { - atp = tptr->atfree; - if (atp) { - tptr->atfree = atp->next; - } - return (atp); + atp = LIST_FIRST(&tptr->atfree); + if (atp) { + LIST_REMOVE(atp, next); + atp->tag = tag; + LIST_INSERT_HEAD(&tptr->atused[ATPDPHASH(tag)], atp, next); } - for (atp = tptr->atpool; atp < &tptr->atpool[ATPDPSIZE]; atp++) { - if (atp->tag == tag) { + return (atp); +} + +static ISP_INLINE atio_private_data_t * +isp_find_atpd(ispsoftc_t *isp, tstate_t *tptr, uint32_t tag) +{ + atio_private_data_t *atp; + + LIST_FOREACH(atp, &tptr->atused[ATPDPHASH(tag)], next) { + if (atp->tag == tag) return (atp); - } } return (NULL); } @@ -1055,9 +1062,9 @@ isp_put_atpd(ispsoftc_t *isp, tstate_t * if (atp->ests) { isp_put_ecmd(isp, atp->ests); } + LIST_REMOVE(atp, next); memset(atp, 0, sizeof (*atp)); - atp->next = tptr->atfree; - tptr->atfree = atp; + LIST_INSERT_HEAD(&tptr->atfree, atp, next); } static void @@ -1067,11 +1074,8 @@ isp_dump_atpd(ispsoftc_t *isp, tstate_t const char *states[8] = { "Free", "ATIO", "CAM", "CTIO", "LAST_CTIO", "PDON", "?6", "7" }; for (atp = tptr->atpool; atp < &tptr->atpool[ATPDPSIZE]; atp++) { - if (atp->tag == 0) { - continue; - } xpt_print(tptr->owner, "ATP: [0x%x] origdlen %u bytes_xfrd %u lun %u nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s\n", - atp->tag, atp->orig_datalen, atp->bytes_xfered, atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]); + atp->tag, atp->orig_datalen, atp->bytes_xfered, atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]); } } @@ -1137,11 +1141,13 @@ create_lun_state(ispsoftc_t *isp, int bu SLIST_INIT(&tptr->atios); SLIST_INIT(&tptr->inots); TAILQ_INIT(&tptr->waitq); - for (i = 0; i < ATPDPSIZE-1; i++) { - tptr->atpool[i].next = &tptr->atpool[i+1]; + LIST_INIT(&tptr->atfree); + for (i = ATPDPSIZE-1; i >= 0; i--) + LIST_INSERT_HEAD(&tptr->atfree, &tptr->atpool[i], next); + for (i = 0; i < ATPDPHASHSIZE; i++) + LIST_INIT(&tptr->atused[i]); + for (i = 0; i < ATPDPSIZE-1; i++) tptr->ntpool[i].next = &tptr->ntpool[i+1]; - } - tptr->atfree = tptr->atpool; tptr->ntfree = tptr->ntpool; tptr->hold = 1; ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); @@ -1620,7 +1626,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u } } - atp = isp_get_atpd(isp, tptr, cso->tag_id); + atp = isp_find_atpd(isp, tptr, cso->tag_id); if (atp == NULL) { isp_prt(isp, ISP_LOGERR, "%s: [0x%x] cannot find private data adjunct in %s", __func__, cso->tag_id, __func__); isp_dump_atpd(isp, tptr); @@ -2252,7 +2258,7 @@ isp_handle_platform_atio(ispsoftc_t *isp } } - atp = isp_get_atpd(isp, tptr, 0); + atp = isp_get_atpd(isp, tptr, aep->at_handle); atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios); if (atiop == NULL || atp == NULL) { /* @@ -2272,7 +2278,6 @@ isp_handle_platform_atio(ispsoftc_t *isp rls_lun_statep(isp, tptr); return; } - atp->tag = aep->at_handle; atp->rxid = aep->at_tag_val; atp->state = ATPD_STATE_ATIO; SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); @@ -2401,12 +2406,11 @@ isp_handle_platform_atio2(ispsoftc_t *is goto noresrc; } - atp = isp_get_atpd(isp, tptr, 0); + atp = isp_get_atpd(isp, tptr, aep->at_rxid); if (atp == NULL) { goto noresrc; } - atp->tag = aep->at_rxid; atp->state = ATPD_STATE_ATIO; SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); tptr->atio_count--; @@ -2638,12 +2642,7 @@ isp_handle_platform_atio7(ispsoftc_t *is goto noresrc; } - atp = isp_get_atpd(isp, tptr, 0); - if (atp == NULL) { - isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid); - goto noresrc; - } - oatp = isp_get_atpd(isp, tptr, aep->at_rxid); + oatp = isp_find_atpd(isp, tptr, aep->at_rxid); if (oatp) { isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x) oatp state %d", aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id, oatp->state); @@ -2652,8 +2651,12 @@ isp_handle_platform_atio7(ispsoftc_t *is */ goto noresrc; } + atp = isp_get_atpd(isp, tptr, aep->at_rxid); + if (atp == NULL) { + isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid); + goto noresrc; + } atp->word3 = lp->prli_word3; - atp->tag = aep->at_rxid; atp->state = ATPD_STATE_ATIO; SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); tptr->atio_count--; @@ -2846,7 +2849,7 @@ isp_handle_srr_notify(ispsoftc_t *isp, v isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot); return; } - atp = isp_get_atpd(isp, tptr, tag); + atp = isp_find_atpd(isp, tptr, tag); if (atp == NULL) { rls_lun_statep(isp, tptr); isp_prt(isp, ISP_LOGERR, "%s: cannot find adjunct for %x in SRR Notify", __func__, tag); @@ -2905,11 +2908,11 @@ isp_handle_platform_ctio(ispsoftc_t *isp } if (IS_24XX(isp)) { - atp = isp_get_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid); + atp = isp_find_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid); } else if (IS_FC(isp)) { - atp = isp_get_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid); + atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid); } else { - atp = isp_get_atpd(isp, tptr, ((ct_entry_t *)arg)->ct_fwhandle); + atp = isp_find_atpd(isp, tptr, ((ct_entry_t *)arg)->ct_fwhandle); } if (atp == NULL) { rls_lun_statep(isp, tptr); @@ -3093,7 +3096,7 @@ isp_handle_platform_notify_fc(ispsoftc_t return; } } - atp = isp_get_atpd(isp, tptr, inp->in_seqid); + atp = isp_find_atpd(isp, tptr, inp->in_seqid); if (atp) { inot = (struct ccb_immediate_notify *) SLIST_FIRST(&tptr->inots); @@ -3516,7 +3519,7 @@ isp_target_mark_aborted(ispsoftc_t *isp, } } - atp = isp_get_atpd(isp, tptr, accb->atio.tag_id); + atp = isp_find_atpd(isp, tptr, accb->atio.tag_id); if (atp == NULL) { ccb->ccb_h.status = CAM_REQ_INVALID; } else { @@ -5005,7 +5008,7 @@ isp_action(struct cam_sim *sim, union cc if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) { if (ccb->atio.tag_id) { - atio_private_data_t *atp = isp_get_atpd(isp, tptr, ccb->atio.tag_id); + atio_private_data_t *atp = isp_find_atpd(isp, tptr, ccb->atio.tag_id); if (atp) { isp_put_atpd(isp, tptr, atp); } Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Sun Jan 5 22:36:34 2014 (r260340) +++ stable/10/sys/dev/isp/isp_freebsd.h Sun Jan 5 22:38:44 2014 (r260341) @@ -95,11 +95,13 @@ void isp_put_ecmd(struct ispsoftc *, is #define ISP_TARGET_FUNCTIONS 1 #define ATPDPSIZE 4096 +#define ATPDPHASHSIZE 16 +#define ATPDPHASH(x) ((((x) >> 24) ^ ((x) >> 16) ^ ((x) >> 8) ^ (x)) & \ + ((ATPDPHASHSIZE) - 1)) #include - -typedef struct { - void * next; +typedef struct atio_private_data { + LIST_ENTRY(atio_private_data) next; uint32_t orig_datalen; uint32_t bytes_xfered; uint32_t bytes_in_transit; @@ -173,7 +175,8 @@ typedef struct tstate { inot_private_data_t * restart_queue; inot_private_data_t * ntfree; inot_private_data_t ntpool[ATPDPSIZE]; - atio_private_data_t * atfree; + LIST_HEAD(, atio_private_data) atfree; + LIST_HEAD(, atio_private_data) atused[ATPDPHASHSIZE]; atio_private_data_t atpool[ATPDPSIZE]; } tstate_t; Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Sun Jan 5 22:36:34 2014 (r260340) +++ stable/10/sys/dev/isp/ispvar.h Sun Jan 5 22:38:44 2014 (r260341) @@ -614,8 +614,9 @@ struct ispsoftc { volatile mbreg_t isp_curmbx; /* currently active mailbox command */ volatile uint32_t isp_reqodx; /* index of last ISP pickup */ volatile uint32_t isp_reqidx; /* index of next request */ - volatile uint32_t isp_residx; /* index of next result */ + volatile uint32_t isp_residx; /* index of last ISP write */ volatile uint32_t isp_resodx; /* index of next result */ + volatile uint32_t isp_atioodx; /* index of next ATIO */ volatile uint32_t isp_obits; /* mailbox command output */ volatile uint32_t isp_serno; /* rolling serial number */ volatile uint16_t isp_mboxtmp[MAX_MAILBOX]; From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:40:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22CE944F; Sun, 5 Jan 2014 22:40:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 02A6B1AA7; Sun, 5 Jan 2014 22:40:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MeT9A014247; Sun, 5 Jan 2014 22:40:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MeSHs014241; Sun, 5 Jan 2014 22:40:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052240.s05MeSHs014241@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260342 - in stable/10/sys/dev: aic7xxx firewire isp mpt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:40:30 -0000 Author: mav Date: Sun Jan 5 22:40:28 2014 New Revision: 260342 URL: http://svnweb.freebsd.org/changeset/base/260342 Log: MFC r256826: Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them. Modified: stable/10/sys/dev/aic7xxx/aic79xx.c stable/10/sys/dev/aic7xxx/aic7xxx.c stable/10/sys/dev/firewire/sbp_targ.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/mpt/mpt_cam.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/aic7xxx/aic79xx.c ============================================================================== --- stable/10/sys/dev/aic7xxx/aic79xx.c Sun Jan 5 22:38:44 2014 (r260341) +++ stable/10/sys/dev/aic7xxx/aic79xx.c Sun Jan 5 22:40:28 2014 (r260342) @@ -10342,9 +10342,9 @@ ahd_handle_target_cmd(struct ahd_softc * /* Tag was included */ atio->tag_action = *byte++; atio->tag_id = *byte++; - atio->ccb_h.flags = CAM_TAG_ACTION_VALID; + atio->ccb_h.flags |= CAM_TAG_ACTION_VALID; } else { - atio->ccb_h.flags = 0; + atio->ccb_h.flags &= ~CAM_TAG_ACTION_VALID; } byte++; Modified: stable/10/sys/dev/aic7xxx/aic7xxx.c ============================================================================== --- stable/10/sys/dev/aic7xxx/aic7xxx.c Sun Jan 5 22:38:44 2014 (r260341) +++ stable/10/sys/dev/aic7xxx/aic7xxx.c Sun Jan 5 22:40:28 2014 (r260342) @@ -7842,9 +7842,9 @@ ahc_handle_target_cmd(struct ahc_softc * /* Tag was included */ atio->tag_action = *byte++; atio->tag_id = *byte++; - atio->ccb_h.flags = CAM_TAG_ACTION_VALID; + atio->ccb_h.flags |= CAM_TAG_ACTION_VALID; } else { - atio->ccb_h.flags = 0; + atio->ccb_h.flags &= ~CAM_TAG_ACTION_VALID; } byte++; Modified: stable/10/sys/dev/firewire/sbp_targ.c ============================================================================== --- stable/10/sys/dev/firewire/sbp_targ.c Sun Jan 5 22:38:44 2014 (r260341) +++ stable/10/sys/dev/firewire/sbp_targ.c Sun Jan 5 22:40:28 2014 (r260342) @@ -1483,7 +1483,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfe atio->tag_id = orbi->orb_lo; atio->init_id = orbi->login->id; - atio->ccb_h.flags = CAM_TAG_ACTION_VALID; + atio->ccb_h.flags |= CAM_TAG_ACTION_VALID; bytes = (u_char *)&orb[5]; if (debug) printf("%s: %p %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Sun Jan 5 22:38:44 2014 (r260341) +++ stable/10/sys/dev/isp/isp_freebsd.c Sun Jan 5 22:40:28 2014 (r260342) @@ -2286,9 +2286,9 @@ isp_handle_platform_atio(ispsoftc_t *isp atiop->ccb_h.target_id = aep->at_tgt; atiop->ccb_h.target_lun = aep->at_lun; if (aep->at_flags & AT_NODISC) { - atiop->ccb_h.flags = CAM_DIS_DISCONNECT; + atiop->ccb_h.flags |= CAM_DIS_DISCONNECT; } else { - atiop->ccb_h.flags = 0; + atiop->ccb_h.flags &= ~CAM_DIS_DISCONNECT; } if (status & QLTM_SVALID) { @@ -2456,15 +2456,15 @@ isp_handle_platform_atio2(ispsoftc_t *is atiop->tag_id = atp->tag; switch (aep->at_taskflags & ATIO2_TC_ATTR_MASK) { case ATIO2_TC_ATTR_SIMPLEQ: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_SIMPLE_Q_TAG; break; case ATIO2_TC_ATTR_HEADOFQ: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_HEAD_OF_Q_TAG; break; case ATIO2_TC_ATTR_ORDERED: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_ORDERED_Q_TAG; break; case ATIO2_TC_ATTR_ACAQ: /* ?? */ @@ -2676,15 +2676,15 @@ isp_handle_platform_atio7(ispsoftc_t *is atiop->tag_id = atp->tag; switch (aep->at_cmnd.fcp_cmnd_task_attribute & FCP_CMND_TASK_ATTR_MASK) { case FCP_CMND_TASK_ATTR_SIMPLE: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_SIMPLE_Q_TAG; break; case FCP_CMND_TASK_ATTR_HEAD: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_HEAD_OF_Q_TAG; break; case FCP_CMND_TASK_ATTR_ORDERED: - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; atiop->tag_action = MSG_ORDERED_Q_TAG; break; default: @@ -5004,7 +5004,6 @@ isp_action(struct cam_sim *sim, union cc } ccb->ccb_h.spriv_field0 = 0; ccb->ccb_h.spriv_ptr1 = isp; - ccb->ccb_h.flags = 0; if (ccb->ccb_h.func_code == XPT_ACCEPT_TARGET_IO) { if (ccb->atio.tag_id) { Modified: stable/10/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/10/sys/dev/mpt/mpt_cam.c Sun Jan 5 22:38:44 2014 (r260341) +++ stable/10/sys/dev/mpt/mpt_cam.c Sun Jan 5 22:40:28 2014 (r260342) @@ -3683,7 +3683,6 @@ mpt_action(struct cam_sim *sim, union cc lun_id_t lun = ccb->ccb_h.target_lun; ccb->ccb_h.sim_priv.entries[0].field = 0; ccb->ccb_h.sim_priv.entries[1].ptr = mpt; - ccb->ccb_h.flags = 0; if (lun == CAM_LUN_WILDCARD) { if (ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) { @@ -5156,7 +5155,7 @@ mpt_scsi_tgt_atio(struct mpt_softc *mpt, tgt->tag_id = atiop->tag_id; if (tag_action) { atiop->tag_action = tag_action; - atiop->ccb_h.flags = CAM_TAG_ACTION_VALID; + atiop->ccb_h.flags |= CAM_TAG_ACTION_VALID; } if (mpt->verbose >= MPT_PRT_DEBUG) { int i; From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:42:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78791645; Sun, 5 Jan 2014 22:42:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 643F91B09; Sun, 5 Jan 2014 22:42:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MghJe014590; Sun, 5 Jan 2014 22:42:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MghKa014589; Sun, 5 Jan 2014 22:42:43 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052242.s05MghKa014589@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260343 - stable/10/sys/dev/aha X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:42:43 -0000 Author: mav Date: Sun Jan 5 22:42:42 2014 New Revision: 260343 URL: http://svnweb.freebsd.org/changeset/base/260343 Log: MFC r256887: Fix memory and references leak due to unfreed path. Coverity CID: 1109817 Modified: stable/10/sys/dev/aha/aha.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/aha/aha.c ============================================================================== --- stable/10/sys/dev/aha/aha.c Sun Jan 5 22:40:28 2014 (r260342) +++ stable/10/sys/dev/aha/aha.c Sun Jan 5 22:42:42 2014 (r260343) @@ -1168,8 +1168,10 @@ ahadone(struct aha_softc *aha, struct ah cam_sim_path(aha->sim), accb->hccb.target, CAM_LUN_WILDCARD); - if (error == CAM_REQ_CMP) + if (error == CAM_REQ_CMP) { xpt_async(AC_SENT_BDR, path, NULL); + xpt_free_path(path); + } ccb_h = LIST_FIRST(&aha->pending_ccbs); while (ccb_h != NULL) { From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:43:40 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4E2779A; Sun, 5 Jan 2014 22:43:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C05BD1B12; Sun, 5 Jan 2014 22:43:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05Mheo0014739; Sun, 5 Jan 2014 22:43:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MheBB014738; Sun, 5 Jan 2014 22:43:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052243.s05MheBB014738@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260344 - stable/10/sys/dev/buslogic X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:43:40 -0000 Author: mav Date: Sun Jan 5 22:43:40 2014 New Revision: 260344 URL: http://svnweb.freebsd.org/changeset/base/260344 Log: MFC r256893: Fix memory and references leak due to unfreed path. Coverity CID: 1109815 Modified: stable/10/sys/dev/buslogic/bt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/buslogic/bt.c ============================================================================== --- stable/10/sys/dev/buslogic/bt.c Sun Jan 5 22:42:42 2014 (r260343) +++ stable/10/sys/dev/buslogic/bt.c Sun Jan 5 22:43:40 2014 (r260344) @@ -1586,8 +1586,10 @@ btdone(struct bt_softc *bt, struct bt_cc bccb->hccb.target_id, CAM_LUN_WILDCARD); - if (error == CAM_REQ_CMP) + if (error == CAM_REQ_CMP) { xpt_async(AC_SENT_BDR, path, NULL); + xpt_free_path(path); + } ccb_h = LIST_FIRST(&bt->pending_ccbs); while (ccb_h != NULL) { From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:45:46 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0FE18F2; Sun, 5 Jan 2014 22:45:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD0901B1C; Sun, 5 Jan 2014 22:45:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05Mjk3C015099; Sun, 5 Jan 2014 22:45:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MjkCF015098; Sun, 5 Jan 2014 22:45:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052245.s05MjkCF015098@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260345 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:45:47 -0000 Author: mav Date: Sun Jan 5 22:45:46 2014 New Revision: 260345 URL: http://svnweb.freebsd.org/changeset/base/260345 Log: MFC r257916: Save one more register read per command by not reading rqstoutrp register every time. The purpose of that register is unlikely output queue overflow detection, so read it only when its last known (and probably stale now) value signals overflow. Modified: stable/10/sys/dev/isp/isp_library.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Sun Jan 5 22:43:40 2014 (r260344) +++ stable/10/sys/dev/isp/isp_library.c Sun Jan 5 22:45:46 2014 (r260345) @@ -322,9 +322,13 @@ isp_destroy_handle(ispsoftc_t *isp, uint void * isp_getrqentry(ispsoftc_t *isp) { - isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); - if (ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)) == isp->isp_reqodx) { - return (NULL); + uint32_t next; + + next = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); + if (next == isp->isp_reqodx) { + isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); + if (next == isp->isp_reqodx) + return (NULL); } return (ISP_QUEUE_ENTRY(isp->isp_rquest, isp->isp_reqidx)); } From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:47:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9462CACC; Sun, 5 Jan 2014 22:47:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 672571B2F; Sun, 5 Jan 2014 22:47:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MlDA8015351; Sun, 5 Jan 2014 22:47:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MlDId015350; Sun, 5 Jan 2014 22:47:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052247.s05MlDId015350@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260346 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:47:13 -0000 Author: mav Date: Sun Jan 5 22:47:12 2014 New Revision: 260346 URL: http://svnweb.freebsd.org/changeset/base/260346 Log: MFC r257930: Some more registers access optimizations: - Process ATIO queue only if interrupt status tells so; - Do not update queue out pointers after each processed command, do it only once at the end of the loop. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Sun Jan 5 22:45:46 2014 (r260345) +++ stable/10/sys/dev/isp/isp.c Sun Jan 5 22:47:12 2014 (r260346) @@ -5082,7 +5082,9 @@ again: /* * Check for ATIO Queue entries. */ - if (IS_24XX(isp)) { + if (IS_24XX(isp) && + ((isr & BIU2400_R2HST_ISTAT_MASK) == ISP2400R2HST_ATIO_RSPQ_UPDATE || + (isr & BIU2400_R2HST_ISTAT_MASK) == ISP2400R2HST_ATIO_RQST_UPDATE)) { iptr = ISP_READ(isp, BIU2400_ATIO_RSPINP); optr = isp->isp_atioodx; @@ -5107,9 +5109,11 @@ again: break; } optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp)); + } + if (isp->isp_atioodx != optr) { ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, optr); + isp->isp_atioodx = optr; } - isp->isp_atioodx = optr; } #endif @@ -5284,7 +5288,6 @@ again: optr = ISP_NXT_QENTRY(tsto, RESULT_QUEUE_LEN(isp)); } if (r > 0) { - ISP_WRITE(isp, isp->isp_respoutrp, optr); ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ last_etype = etype; continue; @@ -5319,7 +5322,6 @@ again: if (sp->req_header.rqs_flags & RQSFLAG_MASK) { if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) { isp_print_bytes(isp, "unexpected continuation segment", QENTRY_LEN, sp); - ISP_WRITE(isp, isp->isp_respoutrp, optr); last_etype = etype; continue; } @@ -5343,7 +5345,6 @@ again: } if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) { isp_print_bytes(isp, "invalid IOCB ordering", QENTRY_LEN, sp); - ISP_WRITE(isp, isp->isp_respoutrp, optr); last_etype = etype; continue; } @@ -5352,7 +5353,6 @@ again: if (!ISP_VALID_HANDLE(isp, sp->req_handle)) { isp_prt(isp, ISP_LOGERR, "bad request handle 0x%x (iocb type 0x%x)", sp->req_handle, etype); ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - ISP_WRITE(isp, isp->isp_respoutrp, optr); last_etype = etype; continue; } @@ -5369,7 +5369,6 @@ again: isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - ISP_WRITE(isp, isp->isp_respoutrp, optr); last_etype = etype; continue; } From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:48:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31660C3C; Sun, 5 Jan 2014 22:48:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F40B41B41; Sun, 5 Jan 2014 22:48:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MmC7K015501; Sun, 5 Jan 2014 22:48:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MmCUc015498; Sun, 5 Jan 2014 22:48:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052248.s05MmCUc015498@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260347 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:48:13 -0000 Author: mav Date: Sun Jan 5 22:48:12 2014 New Revision: 260347 URL: http://svnweb.freebsd.org/changeset/base/260347 Log: MFC r257932: Use relaxed (write-only) memory barriers when writing some of queue index registers (for now on ISP2400+). We never read those registers back and AFAIK their semantics does not require any immediate reaction on write. Modified: stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Sun Jan 5 22:47:12 2014 (r260346) +++ stable/10/sys/dev/isp/isp_freebsd.h Sun Jan 5 22:48:12 2014 (r260347) @@ -459,6 +459,39 @@ default: \ break; \ } +#define MEMORYBARRIERW(isp, type, offset, size, chan) \ +switch (type) { \ +case SYNC_SFORDEV: \ +{ \ + struct isp_fc *fc = ISP_FC_PC(isp, chan); \ + bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + BUS_DMASYNC_PREWRITE); \ + break; \ +} \ +case SYNC_REQUEST: \ + bus_dmamap_sync(isp->isp_osinfo.cdmat, \ + isp->isp_osinfo.cdmap, BUS_DMASYNC_PREWRITE); \ + break; \ +case SYNC_SFORCPU: \ +{ \ + struct isp_fc *fc = ISP_FC_PC(isp, chan); \ + bus_dmamap_sync(fc->tdmat, fc->tdmap, \ + BUS_DMASYNC_POSTWRITE); \ + break; \ +} \ +case SYNC_RESULT: \ + bus_dmamap_sync(isp->isp_osinfo.cdmat, \ + isp->isp_osinfo.cdmap, BUS_DMASYNC_POSTWRITE); \ + break; \ +case SYNC_REG: \ + bus_space_barrier(isp->isp_osinfo.bus_tag, \ + isp->isp_osinfo.bus_handle, offset, size, \ + BUS_SPACE_BARRIER_WRITE); \ + break; \ +default: \ + break; \ +} + #define MBOX_ACQUIRE isp_mbox_acquire #define MBOX_WAIT_COMPLETE isp_mbox_wait_complete #define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Sun Jan 5 22:47:12 2014 (r260346) +++ stable/10/sys/dev/isp/isp_pci.c Sun Jan 5 22:48:12 2014 (r260347) @@ -1432,6 +1432,15 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int case BIU2400_GPIOE: case BIU2400_HSEMA: BXW4(isp, IspVirt2Off(isp, regoff), val); +#ifdef MEMORYBARRIERW + if (regoff == BIU2400_REQINP || + regoff == BIU2400_RSPOUTP || + regoff == BIU2400_PRI_REQINP || + regoff == BIU2400_ATIO_RSPOUTP) + MEMORYBARRIERW(isp, SYNC_REG, + IspVirt2Off(isp, regoff), 4, -1) + else +#endif MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4, -1); break; default: From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:49:55 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 511F1D85; Sun, 5 Jan 2014 22:49:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 315841B48; Sun, 5 Jan 2014 22:49:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05Mnt5C015704; Sun, 5 Jan 2014 22:49:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05Mnsmc015699; Sun, 5 Jan 2014 22:49:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052249.s05Mnsmc015699@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260348 - in stable/10/sys/dev: ahci ata ata/chipsets usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:49:55 -0000 Author: mav Date: Sun Jan 5 22:49:54 2014 New Revision: 260348 URL: http://svnweb.freebsd.org/changeset/base/260348 Log: MFC r258162: Add some more IDs for Intel ATA, AHCI and USB controllers. Modified: stable/10/sys/dev/ahci/ahci.c stable/10/sys/dev/ata/ata-pci.h stable/10/sys/dev/ata/chipsets/ata-intel.c stable/10/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ahci/ahci.c ============================================================================== --- stable/10/sys/dev/ahci/ahci.c Sun Jan 5 22:48:12 2014 (r260347) +++ stable/10/sys/dev/ahci/ahci.c Sun Jan 5 22:49:54 2014 (r260348) @@ -190,21 +190,54 @@ static struct { {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, - {0x1e048086, 0x00, "Intel Panther Point", 0}, - {0x1e058086, 0x00, "Intel Panther Point", 0}, - {0x1e068086, 0x00, "Intel Panther Point", 0}, - {0x1e078086, 0x00, "Intel Panther Point", 0}, - {0x1e0e8086, 0x00, "Intel Panther Point", 0}, - {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x1e048086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1e058086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1e068086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1e078086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1e0e8086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1e0f8086, 0x00, "Intel Panther Point (RAID)", 0}, + {0x1f228086, 0x00, "Intel Avoton", 0}, + {0x1f238086, 0x00, "Intel Avoton", 0}, + {0x1f248086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f258086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f268086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f278086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f2e8086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f2f8086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f328086, 0x00, "Intel Avoton", 0}, + {0x1f338086, 0x00, "Intel Avoton", 0}, + {0x1f348086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f358086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f368086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f378086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f3e8086, 0x00, "Intel Avoton (RAID)", 0}, + {0x1f3f8086, 0x00, "Intel Avoton (RAID)", 0}, {0x23a38086, 0x00, "Intel Coleto Creek", 0}, + {0x28238086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x28278086, 0x00, "Intel Wellsburg (RAID)", 0}, {0x8c028086, 0x00, "Intel Lynx Point", 0}, {0x8c038086, 0x00, "Intel Lynx Point", 0}, - {0x8c048086, 0x00, "Intel Lynx Point", 0}, - {0x8c058086, 0x00, "Intel Lynx Point", 0}, - {0x8c068086, 0x00, "Intel Lynx Point", 0}, - {0x8c078086, 0x00, "Intel Lynx Point", 0}, - {0x8c0e8086, 0x00, "Intel Lynx Point", 0}, - {0x8c0f8086, 0x00, "Intel Lynx Point", 0}, + {0x8c048086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8c058086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8c068086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8c078086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8c0e8086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8c0f8086, 0x00, "Intel Lynx Point (RAID)", 0}, + {0x8d028086, 0x00, "Intel Wellsburg", 0}, + {0x8d048086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x8d068086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x8d628086, 0x00, "Intel Wellsburg", 0}, + {0x8d648086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x8d668086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x8d6e8086, 0x00, "Intel Wellsburg (RAID)", 0}, + {0x9c028086, 0x00, "Intel Lynx Point-LP", 0}, + {0x9c038086, 0x00, "Intel Lynx Point-LP", 0}, + {0x9c048086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c058086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c068086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c078086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c0e8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, Modified: stable/10/sys/dev/ata/ata-pci.h ============================================================================== --- stable/10/sys/dev/ata/ata-pci.h Sun Jan 5 22:48:12 2014 (r260347) +++ stable/10/sys/dev/ata/ata-pci.h Sun Jan 5 22:49:54 2014 (r260348) @@ -257,6 +257,11 @@ struct ata_pci_controller { #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 +#define ATA_AVOTON_S1 0x1f208086 +#define ATA_AVOTON_S2 0x1f218086 +#define ATA_AVOTON_S3 0x1f308086 +#define ATA_AVOTON_S4 0x1f318086 + #define ATA_LPT_S1 0x8c008086 #define ATA_LPT_S2 0x8c018086 #define ATA_LPT_AH1 0x8c028086 @@ -270,6 +275,16 @@ struct ata_pci_controller { #define ATA_LPT_R5 0x8c0e8086 #define ATA_LPT_R6 0x8c0f8086 +#define ATA_WELLS_S1 0x8d008086 +#define ATA_WELLS_S2 0x8d088086 +#define ATA_WELLS_S3 0x8d608086 +#define ATA_WELLS_S4 0x8d688086 + +#define ATA_LPTLP_S1 0x9c008086 +#define ATA_LPTLP_S2 0x9c018086 +#define ATA_LPTLP_S3 0x9c088086 +#define ATA_LPTLP_S4 0x9c098086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: stable/10/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/10/sys/dev/ata/chipsets/ata-intel.c Sun Jan 5 22:48:12 2014 (r260347) +++ stable/10/sys/dev/ata/chipsets/ata-intel.c Sun Jan 5 22:49:54 2014 (r260348) @@ -211,6 +211,10 @@ ata_intel_probe(device_t dev) { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_AVOTON_S1, 0, INTEL_6CH, 0, ATA_SA300, "Avoton" }, + { ATA_AVOTON_S2, 0, INTEL_6CH, 0, ATA_SA300, "Avoton" }, + { ATA_AVOTON_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Avoton" }, + { ATA_AVOTON_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Avoton" }, { ATA_LPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, @@ -223,6 +227,14 @@ ata_intel_probe(device_t dev) { ATA_LPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_LPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_WELLS_S1, 0, INTEL_6CH, 0, ATA_SA300, "Wellsburg" }, + { ATA_WELLS_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Wellsburg" }, + { ATA_WELLS_S3, 0, INTEL_6CH, 0, ATA_SA300, "Wellsburg" }, + { ATA_WELLS_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Wellsburg" }, + { ATA_LPTLP_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point-LP" }, + { ATA_LPTLP_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point-LP" }, + { ATA_LPTLP_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point-LP" }, + { ATA_LPTLP_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point-LP" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, Modified: stable/10/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_pci.c Sun Jan 5 22:48:12 2014 (r260347) +++ stable/10/sys/dev/usb/controller/ehci_pci.c Sun Jan 5 22:49:54 2014 (r260348) @@ -124,6 +124,8 @@ ehci_pci_match(device_t self) return ("Intel Panther Point USB 2.0 controller"); case 0x1e2d8086: return ("Intel Panther Point USB 2.0 controller"); + case 0x1f2c8086: + return ("Intel Avoton USB 2.0 controller"); case 0x25ad8086: return "Intel 6300ESB USB 2.0 controller"; case 0x24cd8086: From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:51:10 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8099F9D; Sun, 5 Jan 2014 22:51:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3501CB2; Sun, 5 Jan 2014 22:51:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MpA9O016652; Sun, 5 Jan 2014 22:51:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MpAk1016651; Sun, 5 Jan 2014 22:51:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052251.s05MpAk1016651@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260350 - stable/10/sys/dev/acpica X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:51:10 -0000 Author: mav Date: Sun Jan 5 22:51:09 2014 New Revision: 260350 URL: http://svnweb.freebsd.org/changeset/base/260350 Log: MFC r258164: Handle case when ACPI reports HPET device, but does not provide memory resource for it. In such case take the address range from the HPET table. This fixes hpet(4) driver attach on Asrock C2750D4I board. Modified: stable/10/sys/dev/acpica/acpi_hpet.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/acpica/acpi_hpet.c ============================================================================== --- stable/10/sys/dev/acpica/acpi_hpet.c Sun Jan 5 22:50:32 2014 (r260349) +++ stable/10/sys/dev/acpica/acpi_hpet.c Sun Jan 5 22:51:09 2014 (r260350) @@ -293,7 +293,7 @@ hpet_find(ACPI_HANDLE handle, UINT32 lev return (AE_OK); if (ACPI_FAILURE(acpi_GetInteger(handle, "_UID", &uid)) || id == uid) - *((int *)status) = 1; + *status = acpi_get_device(handle); return (AE_OK); } @@ -321,7 +321,7 @@ hpet_identify(driver_t *driver, device_t ACPI_TABLE_HPET *hpet; ACPI_STATUS status; device_t child; - int i, found; + int i; /* Only one HPET device can be added. */ if (devclass_get_device(hpet_devclass, 0)) @@ -332,12 +332,18 @@ hpet_identify(driver_t *driver, device_t if (ACPI_FAILURE(status)) return; /* Search for HPET device with same ID. */ - found = 0; + child = NULL; AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - 100, hpet_find, NULL, (void *)(uintptr_t)hpet->Sequence, (void *)&found); + 100, hpet_find, NULL, (void *)(uintptr_t)hpet->Sequence, + (void *)&child); /* If found - let it be probed in normal way. */ - if (found) + if (child) { + if (bus_get_resource(child, SYS_RES_MEMORY, 0, + NULL, NULL) != 0) + bus_set_resource(child, SYS_RES_MEMORY, 0, + hpet->Address.Address, HPET_MEM_WIDTH); continue; + } /* If not - create it from table info. */ child = BUS_ADD_CHILD(parent, 2, "hpet", 0); if (child == NULL) { From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:53:01 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E83C31BD; Sun, 5 Jan 2014 22:53:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D37A11CBB; Sun, 5 Jan 2014 22:53:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05Mr0aj018776; Sun, 5 Jan 2014 22:53:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05Mr0PL018772; Sun, 5 Jan 2014 22:53:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052253.s05Mr0PL018772@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260351 - stable/10/sys/dev/sound/pci/hda X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:53:01 -0000 Author: mav Date: Sun Jan 5 22:52:59 2014 New Revision: 260351 URL: http://svnweb.freebsd.org/changeset/base/260351 Log: MFC r258168, r258170: Add some more Intel HDA controller and CODEC IDs. Modified: stable/10/sys/dev/sound/pci/hda/hdac.c stable/10/sys/dev/sound/pci/hda/hdac.h stable/10/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/10/sys/dev/sound/pci/hda/hdac.c Sun Jan 5 22:51:09 2014 (r260350) +++ stable/10/sys/dev/sound/pci/hda/hdac.c Sun Jan 5 22:52:59 2014 (r260351) @@ -78,11 +78,20 @@ static const struct { char quirks_on; char quirks_off; } hdac_devices[] = { + { HDA_INTEL_OAK, "Intel Oaktrail", 0, 0 }, + { HDA_INTEL_BAY, "Intel BayTrail", 0, 0 }, + { HDA_INTEL_HSW1, "Intel Haswell", 0, 0 }, + { HDA_INTEL_HSW2, "Intel Haswell", 0, 0 }, + { HDA_INTEL_HSW3, "Intel Haswell", 0, 0 }, { HDA_INTEL_CPT, "Intel Cougar Point", 0, 0 }, { HDA_INTEL_PATSBURG,"Intel Patsburg", 0, 0 }, { HDA_INTEL_PPT1, "Intel Panther Point", 0, 0 }, { HDA_INTEL_LPT1, "Intel Lynx Point", 0, 0 }, { HDA_INTEL_LPT2, "Intel Lynx Point", 0, 0 }, + { HDA_INTEL_WELLS1, "Intel Wellsburg", 0, 0 }, + { HDA_INTEL_WELLS2, "Intel Wellsburg", 0, 0 }, + { HDA_INTEL_LPTLP1, "Intel Lynx Point-LP", 0, 0 }, + { HDA_INTEL_LPTLP2, "Intel Lynx Point-LP", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: stable/10/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/10/sys/dev/sound/pci/hda/hdac.h Sun Jan 5 22:51:09 2014 (r260350) +++ stable/10/sys/dev/sound/pci/hda/hdac.h Sun Jan 5 22:52:59 2014 (r260351) @@ -41,6 +41,11 @@ /* Intel */ #define INTEL_VENDORID 0x8086 +#define HDA_INTEL_OAK HDA_MODEL_CONSTRUCT(INTEL, 0x080a) +#define HDA_INTEL_BAY HDA_MODEL_CONSTRUCT(INTEL, 0x0f04) +#define HDA_INTEL_HSW1 HDA_MODEL_CONSTRUCT(INTEL, 0x0a0c) +#define HDA_INTEL_HSW2 HDA_MODEL_CONSTRUCT(INTEL, 0x0c0c) +#define HDA_INTEL_HSW3 HDA_MODEL_CONSTRUCT(INTEL, 0x0d0c) #define HDA_INTEL_CPT HDA_MODEL_CONSTRUCT(INTEL, 0x1c20) #define HDA_INTEL_PATSBURG HDA_MODEL_CONSTRUCT(INTEL, 0x1d20) #define HDA_INTEL_PPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x1e20) @@ -56,6 +61,10 @@ #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) #define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) #define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) +#define HDA_INTEL_WELLS1 HDA_MODEL_CONSTRUCT(INTEL, 0x8d20) +#define HDA_INTEL_WELLS2 HDA_MODEL_CONSTRUCT(INTEL, 0x8d21) +#define HDA_INTEL_LPTLP1 HDA_MODEL_CONSTRUCT(INTEL, 0x9c20) +#define HDA_INTEL_LPTLP2 HDA_MODEL_CONSTRUCT(INTEL, 0x9c21) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ @@ -605,6 +614,7 @@ #define HDA_CODEC_INTELIP2 HDA_CODEC_CONSTRUCT(INTEL, 0x2804) #define HDA_CODEC_INTELCPT HDA_CODEC_CONSTRUCT(INTEL, 0x2805) #define HDA_CODEC_INTELPPT HDA_CODEC_CONSTRUCT(INTEL, 0x2806) +#define HDA_CODEC_INTELHSW HDA_CODEC_CONSTRUCT(INTEL, 0x2807) #define HDA_CODEC_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) Modified: stable/10/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/10/sys/dev/sound/pci/hda/hdacc.c Sun Jan 5 22:51:09 2014 (r260350) +++ stable/10/sys/dev/sound/pci/hda/hdacc.c Sun Jan 5 22:52:59 2014 (r260351) @@ -318,6 +318,7 @@ static const struct { { HDA_CODEC_INTELIP2, 0, "Intel Ibex Peak" }, { HDA_CODEC_INTELCPT, 0, "Intel Cougar Point" }, { HDA_CODEC_INTELPPT, 0, "Intel Panther Point" }, + { HDA_CODEC_INTELHSW, 0, "Intel Haswell" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:53:56 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75C2832F; Sun, 5 Jan 2014 22:53:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 613FA1CC1; Sun, 5 Jan 2014 22:53:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MrupW018905; Sun, 5 Jan 2014 22:53:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MruUn018904; Sun, 5 Jan 2014 22:53:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052253.s05MruUn018904@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260352 - stable/10/sys/dev/ichsmb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:53:56 -0000 Author: mav Date: Sun Jan 5 22:53:55 2014 New Revision: 260352 URL: http://svnweb.freebsd.org/changeset/base/260352 Log: MFC r258169: Add ID for Intel Avoton SMBus controller. Modified: stable/10/sys/dev/ichsmb/ichsmb_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- stable/10/sys/dev/ichsmb/ichsmb_pci.c Sun Jan 5 22:52:59 2014 (r260351) +++ stable/10/sys/dev/ichsmb/ichsmb_pci.c Sun Jan 5 22:53:55 2014 (r260352) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #define ID_PATSBURG 0x1d228086 #define ID_CPT 0x1c228086 #define ID_PPT 0x1e228086 +#define ID_AVOTON 0x1f3c8086 #define ID_COLETOCRK 0x23B08086 #define ID_LPT 0x8c228086 @@ -190,6 +191,9 @@ ichsmb_pci_probe(device_t dev) case ID_PPT: device_set_desc(dev, "Intel Panther Point SMBus controller"); break; + case ID_AVOTON: + device_set_desc(dev, "Intel Avoton SMBus controller"); + break; case ID_LPT: device_set_desc(dev, "Intel Lynx Point SMBus controller"); break; From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 22:55:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6467B470; Sun, 5 Jan 2014 22:55:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 443F41CC7; Sun, 5 Jan 2014 22:55:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05MtM8G019191; Sun, 5 Jan 2014 22:55:22 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05MtLlX019188; Sun, 5 Jan 2014 22:55:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052255.s05MtLlX019188@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 22:55:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260353 - stable/10/sys/dev/ahci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 22:55:22 -0000 Author: mav Date: Sun Jan 5 22:55:21 2014 New Revision: 260353 URL: http://svnweb.freebsd.org/changeset/base/260353 Log: MFC r258173: Add few more minor parts of DevSleep support from AHCI 1.3.1 proposal. Modified: stable/10/sys/dev/ahci/ahci.c stable/10/sys/dev/ahci/ahci.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ahci/ahci.c ============================================================================== --- stable/10/sys/dev/ahci/ahci.c Sun Jan 5 22:53:55 2014 (r260352) +++ stable/10/sys/dev/ahci/ahci.c Sun Jan 5 22:55:21 2014 (r260353) @@ -1087,13 +1087,16 @@ ahci_ch_attach(device_t dev) version = ATA_INL(ctlr->r_mem, AHCI_VS); if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) ch->chcaps |= AHCI_P_CMD_FBSCP; + if (ch->caps2 & AHCI_CAP2_SDS) + ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); if (bootverbose) { - device_printf(dev, "Caps:%s%s%s%s%s\n", + device_printf(dev, "Caps:%s%s%s%s%s%s\n", (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", - (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":""); + (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", + (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); } /* Create the device queue for our SIM. */ devq = cam_simq_alloc(ch->numslots); Modified: stable/10/sys/dev/ahci/ahci.h ============================================================================== --- stable/10/sys/dev/ahci/ahci.h Sun Jan 5 22:53:55 2014 (r260352) +++ stable/10/sys/dev/ahci/ahci.h Sun Jan 5 22:55:21 2014 (r260353) @@ -137,6 +137,7 @@ #define ATA_SC_IPM_NONE 0x00000000 #define ATA_SC_IPM_DIS_PARTIAL 0x00000100 #define ATA_SC_IPM_DIS_SLUMBER 0x00000200 +#define ATA_SC_IPM_DIS_DEVSLEEP 0x00000400 #define ATA_SACTIVE 16 @@ -286,6 +287,17 @@ #define AHCI_P_FBS_ADO_SHIFT 12 #define AHCI_P_FBS_DWE 0x000f0000 #define AHCI_P_FBS_DWE_SHIFT 16 +#define AHCI_P_DEVSLP 0x44 +#define AHCI_P_DEVSLP_ADSE 0x00000001 +#define AHCI_P_DEVSLP_DSP 0x00000002 +#define AHCI_P_DEVSLP_DETO 0x000003fc +#define AHCI_P_DEVSLP_DETO_SHIFT 2 +#define AHCI_P_DEVSLP_MDAT 0x00007c00 +#define AHCI_P_DEVSLP_MDAT_SHIFT 10 +#define AHCI_P_DEVSLP_DITO 0x01ff8000 +#define AHCI_P_DEVSLP_DITO_SHIFT 15 +#define AHCI_P_DEVSLP_DM 0x0e000000 +#define AHCI_P_DEVSLP_DM_SHIFT 25 /* Just to be sure, if building as module. */ #if MAXPHYS < 512 * 1024 @@ -402,6 +414,7 @@ struct ahci_channel { uint32_t caps; /* Controller capabilities */ uint32_t caps2; /* Controller capabilities */ uint32_t chcaps; /* Channel capabilities */ + uint32_t chscaps; /* Channel sleep capabilities */ int quirks; int numslots; /* Number of present slots */ int pm_level; /* power management level */ From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 23:00:39 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11A196B3; Sun, 5 Jan 2014 23:00:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D7FDE1CF0; Sun, 5 Jan 2014 23:00:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05N0ccl020618; Sun, 5 Jan 2014 23:00:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05N0cPs020617; Sun, 5 Jan 2014 23:00:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052300.s05N0cPs020617@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 23:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260354 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 23:00:39 -0000 Author: mav Date: Sun Jan 5 23:00:38 2014 New Revision: 260354 URL: http://svnweb.freebsd.org/changeset/base/260354 Log: MFC r256614: - Take BIO lock in biodone() only when there is no completion callback set and so we should wake up thread waiting in biowait(). - Remove msleep() timeout from biowait(). It was added 11 years ago, when there was no locks used, and it should not be needed any more. Modified: stable/10/sys/kern/vfs_bio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_bio.c ============================================================================== --- stable/10/sys/kern/vfs_bio.c Sun Jan 5 22:55:21 2014 (r260353) +++ stable/10/sys/kern/vfs_bio.c Sun Jan 5 23:00:38 2014 (r260354) @@ -3559,9 +3559,6 @@ biodone(struct bio *bp) vm_offset_t start, end; int transient; - mtxp = mtx_pool_find(mtxpool_sleep, bp); - mtx_lock(mtxp); - bp->bio_flags |= BIO_DONE; if ((bp->bio_flags & BIO_TRANSIENT_MAPPING) != 0) { start = trunc_page((vm_offset_t)bp->bio_data); end = round_page((vm_offset_t)bp->bio_data + bp->bio_length); @@ -3571,11 +3568,16 @@ biodone(struct bio *bp) start = end = 0; } done = bp->bio_done; - if (done == NULL) + if (done == NULL) { + mtxp = mtx_pool_find(mtxpool_sleep, bp); + mtx_lock(mtxp); + bp->bio_flags |= BIO_DONE; wakeup(bp); - mtx_unlock(mtxp); - if (done != NULL) + mtx_unlock(mtxp); + } else { + bp->bio_flags |= BIO_DONE; done(bp); + } if (transient) { pmap_qremove(start, OFF_TO_IDX(end - start)); vmem_free(transient_arena, start, end - start); @@ -3585,9 +3587,6 @@ biodone(struct bio *bp) /* * Wait for a BIO to finish. - * - * XXX: resort to a timeout for now. The optimal locking (if any) for this - * case is not yet clear. */ int biowait(struct bio *bp, const char *wchan) @@ -3597,7 +3596,7 @@ biowait(struct bio *bp, const char *wcha mtxp = mtx_pool_find(mtxpool_sleep, bp); mtx_lock(mtxp); while ((bp->bio_flags & BIO_DONE) == 0) - msleep(bp, mtxp, PRIBIO, wchan, hz / 10); + msleep(bp, mtxp, PRIBIO, wchan, 0); mtx_unlock(mtxp); if (bp->bio_error != 0) return (bp->bio_error); From owner-svn-src-stable-10@FreeBSD.ORG Sun Jan 5 23:02:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9AEA494E; Sun, 5 Jan 2014 23:02:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 86D351D54; Sun, 5 Jan 2014 23:02:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05N23E9022829; Sun, 5 Jan 2014 23:02:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05N23WY022828; Sun, 5 Jan 2014 23:02:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401052302.s05N23WY022828@svn.freebsd.org> From: Alexander Motin Date: Sun, 5 Jan 2014 23:02:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260356 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 23:02:03 -0000 Author: mav Date: Sun Jan 5 23:02:03 2014 New Revision: 260356 URL: http://svnweb.freebsd.org/changeset/base/260356 Log: MFC r256885: Remove global device lock acquisition from dev_relthread(), replacing it with atomics on per-device data. Modified: stable/10/sys/kern/kern_conf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_conf.c ============================================================================== --- stable/10/sys/kern/kern_conf.c Sun Jan 5 23:01:28 2014 (r260355) +++ stable/10/sys/kern/kern_conf.c Sun Jan 5 23:02:03 2014 (r260356) @@ -193,7 +193,7 @@ dev_refthread(struct cdev *dev, int *ref if (csw != NULL) { cdp = cdev2priv(dev); if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) - dev->si_threadcount++; + atomic_add_long(&dev->si_threadcount, 1); else csw = NULL; } @@ -234,7 +234,7 @@ devvn_refthread(struct vnode *vp, struct if ((cdp->cdp_flags & CDP_SCHED_DTR) == 0) { csw = dev->si_devsw; if (csw != NULL) - dev->si_threadcount++; + atomic_add_long(&dev->si_threadcount, 1); } dev_unlock(); if (csw != NULL) { @@ -251,11 +251,9 @@ dev_relthread(struct cdev *dev, int ref) mtx_assert(&devmtx, MA_NOTOWNED); if (!ref) return; - dev_lock(); KASSERT(dev->si_threadcount > 0, ("%s threadcount is wrong", dev->si_name)); - dev->si_threadcount--; - dev_unlock(); + atomic_subtract_rel_long(&dev->si_threadcount, 1); } int From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 01:32:27 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 145E7200; Tue, 7 Jan 2014 01:32:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EFF98115B; Tue, 7 Jan 2014 01:32:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s071WQPB048315; Tue, 7 Jan 2014 01:32:26 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s071WO8N048296; Tue, 7 Jan 2014 01:32:24 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201401070132.s071WO8N048296@svn.freebsd.org> From: Scott Long Date: Tue, 7 Jan 2014 01:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260385 - in stable/10/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs dev/md geom geom/concat geom/gate geom/mirror geom/multipath geom/nop geom/part geom/raid geom/st... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 01:32:27 -0000 Author: scottl Date: Tue Jan 7 01:32:23 2014 New Revision: 260385 URL: http://svnweb.freebsd.org/changeset/base/260385 Log: MFC Alexander Motin's GEOM direct dispatch work: r256603: Introduce new function devstat_end_transaction_bio_bt(), adding new argument to specify present time. Use this function to move binuptime() out of lock, substantially reducing lock congestion when slow timecounter is used. r256606: Move g_io_deliver() out of the lock, as required for direct dispatch. Move g_destroy_bio() out too to reduce lock scope even more. r256607: Fix passing uninitialized bio_resid argument to g_trace(). r256610: Add unmapped I/O support to GEOM RAID. r256830: Restore BIO_UNMAPPED and BIO_TRANSIENT_MAPPING in biodonne() when unmapping temporary mapped buffer. That fixes double unmap if biodone() called twice for the same BIO (but with different done methods). r256880: Merge GEOM direct dispatch changes from the projects/camlock branch. When safety requirements are met, it allows to avoid passing I/O requests to GEOM g_up/g_down thread, executing them directly in the caller context. That allows to avoid CPU bottlenecks in g_up/g_down threads, plus avoid several context switches per I/O. r259247: Fix bug introduced at r256607. We have to recalculate bp_resid here since sizes of original and completed requests may differ due to end of media. Testing of the stable/10 merge was done by Netflix, but all of the credit goes to Alexander and iX Systems. Submitted by: mav Sponsored by: iX Systems Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/scsi/scsi_da.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c stable/10/sys/dev/md/md.c stable/10/sys/geom/concat/g_concat.c stable/10/sys/geom/concat/g_concat.h stable/10/sys/geom/gate/g_gate.c stable/10/sys/geom/geom.h stable/10/sys/geom/geom_dev.c stable/10/sys/geom/geom_disk.c stable/10/sys/geom/geom_disk.h stable/10/sys/geom/geom_int.h stable/10/sys/geom/geom_io.c stable/10/sys/geom/geom_kern.c stable/10/sys/geom/geom_slice.c stable/10/sys/geom/geom_vfs.c stable/10/sys/geom/mirror/g_mirror.c stable/10/sys/geom/mirror/g_mirror.h stable/10/sys/geom/multipath/g_multipath.c stable/10/sys/geom/nop/g_nop.c stable/10/sys/geom/nop/g_nop.h stable/10/sys/geom/part/g_part.c stable/10/sys/geom/raid/g_raid.c stable/10/sys/geom/raid/g_raid.h stable/10/sys/geom/raid/md_ddf.c stable/10/sys/geom/raid/md_intel.c stable/10/sys/geom/raid/md_jmicron.c stable/10/sys/geom/raid/md_nvidia.c stable/10/sys/geom/raid/md_promise.c stable/10/sys/geom/raid/md_sii.c stable/10/sys/geom/raid/tr_concat.c stable/10/sys/geom/raid/tr_raid0.c stable/10/sys/geom/raid/tr_raid1.c stable/10/sys/geom/raid/tr_raid1e.c stable/10/sys/geom/raid/tr_raid5.c stable/10/sys/geom/stripe/g_stripe.c stable/10/sys/geom/stripe/g_stripe.h stable/10/sys/geom/zero/g_zero.c stable/10/sys/kern/subr_devstat.c stable/10/sys/kern/vfs_bio.c stable/10/sys/sys/devicestat.h stable/10/sys/sys/proc.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/cam/ata/ata_da.c Tue Jan 7 01:32:23 2014 (r260385) @@ -1254,7 +1254,7 @@ adaregister(struct cam_periph *periph, v maxio = min(maxio, 256 * softc->params.secsize); softc->disk->d_maxsize = maxio; softc->disk->d_unit = periph->unit_number; - softc->disk->d_flags = 0; + softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION; if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if (softc->flags & ADA_FLAG_CAN_TRIM) { Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/cam/scsi/scsi_da.c Tue Jan 7 01:32:23 2014 (r260385) @@ -2133,7 +2133,7 @@ daregister(struct cam_periph *periph, vo else softc->disk->d_maxsize = cpi.maxio; softc->disk->d_unit = periph->unit_number; - softc->disk->d_flags = 0; + softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION; if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((cpi.hba_misc & PIM_UNMAPPED) != 0) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Jan 7 01:32:23 2014 (r260385) @@ -147,6 +147,7 @@ vdev_geom_attach(struct g_provider *pp) ZFS_LOG(1, "Used existing consumer for %s.", pp->name); } } + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; return (cp); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Jan 7 01:32:23 2014 (r260385) @@ -2153,6 +2153,7 @@ zvol_geom_create(const char *name) gp->start = zvol_geom_start; gp->access = zvol_geom_access; pp = g_new_providerf(gp, "%s/%s", ZVOL_DRIVER, name); + pp->flags |= G_PF_DIRECT_RECEIVE | G_PF_DIRECT_SEND; pp->sectorsize = DEV_BSIZE; zv = kmem_zalloc(sizeof(*zv), KM_SLEEP); @@ -2256,18 +2257,20 @@ zvol_geom_start(struct bio *bp) zvol_state_t *zv; boolean_t first; + zv = bp->bio_to->private; + ASSERT(zv != NULL); switch (bp->bio_cmd) { + case BIO_FLUSH: + if (!THREAD_CAN_SLEEP()) + goto enqueue; + zil_commit(zv->zv_zilog, ZVOL_OBJ); + g_io_deliver(bp, 0); + break; case BIO_READ: case BIO_WRITE: - case BIO_FLUSH: - zv = bp->bio_to->private; - ASSERT(zv != NULL); - mtx_lock(&zv->zv_queue_mtx); - first = (bioq_first(&zv->zv_queue) == NULL); - bioq_insert_tail(&zv->zv_queue, bp); - mtx_unlock(&zv->zv_queue_mtx); - if (first) - wakeup_one(&zv->zv_queue); + if (!THREAD_CAN_SLEEP()) + goto enqueue; + zvol_strategy(bp); break; case BIO_GETATTR: case BIO_DELETE: @@ -2275,6 +2278,15 @@ zvol_geom_start(struct bio *bp) g_io_deliver(bp, EOPNOTSUPP); break; } + return; + +enqueue: + mtx_lock(&zv->zv_queue_mtx); + first = (bioq_first(&zv->zv_queue) == NULL); + bioq_insert_tail(&zv->zv_queue, bp); + mtx_unlock(&zv->zv_queue_mtx); + if (first) + wakeup_one(&zv->zv_queue); } static void @@ -2449,6 +2461,7 @@ zvol_rename_minor(struct g_geom *gp, con g_wither_provider(pp, ENXIO); pp = g_new_providerf(gp, "%s/%s", ZVOL_DRIVER, newname); + pp->flags |= G_PF_DIRECT_RECEIVE | G_PF_DIRECT_SEND; pp->sectorsize = DEV_BSIZE; pp->mediasize = zv->zv_volsize; pp->private = zv; Modified: stable/10/sys/dev/md/md.c ============================================================================== --- stable/10/sys/dev/md/md.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/dev/md/md.c Tue Jan 7 01:32:23 2014 (r260385) @@ -189,6 +189,7 @@ struct md_s { LIST_ENTRY(md_s) list; struct bio_queue_head bio_queue; struct mtx queue_mtx; + struct mtx stat_mtx; struct cdev *dev; enum md_types type; off_t mediasize; @@ -415,8 +416,11 @@ g_md_start(struct bio *bp) struct md_s *sc; sc = bp->bio_to->geom->softc; - if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE)) + if ((bp->bio_cmd == BIO_READ) || (bp->bio_cmd == BIO_WRITE)) { + mtx_lock(&sc->stat_mtx); devstat_start_transaction_bio(sc->devstat, bp); + mtx_unlock(&sc->stat_mtx); + } mtx_lock(&sc->queue_mtx); bioq_disksort(&sc->bio_queue, bp); mtx_unlock(&sc->queue_mtx); @@ -987,6 +991,7 @@ mdnew(int unit, int *errp, enum md_types sc->type = type; bioq_init(&sc->bio_queue); mtx_init(&sc->queue_mtx, "md bio queue", NULL, MTX_DEF); + mtx_init(&sc->stat_mtx, "md stat", NULL, MTX_DEF); sc->unit = unit; sprintf(sc->name, "md%d", unit); LIST_INSERT_HEAD(&md_softc_list, sc, list); @@ -994,6 +999,7 @@ mdnew(int unit, int *errp, enum md_types if (error == 0) return (sc); LIST_REMOVE(sc, list); + mtx_destroy(&sc->stat_mtx); mtx_destroy(&sc->queue_mtx); free_unr(md_uh, sc->unit); free(sc, M_MD); @@ -1011,6 +1017,7 @@ mdinit(struct md_s *sc) gp = g_new_geomf(&g_md_class, "md%d", sc->unit); gp->softc = sc; pp = g_new_providerf(gp, "md%d", sc->unit); + pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; pp->mediasize = sc->mediasize; pp->sectorsize = sc->sectorsize; switch (sc->type) { @@ -1206,6 +1213,7 @@ mddestroy(struct md_s *sc, struct thread while (!(sc->flags & MD_EXITING)) msleep(sc->procp, &sc->queue_mtx, PRIBIO, "mddestroy", hz / 10); mtx_unlock(&sc->queue_mtx); + mtx_destroy(&sc->stat_mtx); mtx_destroy(&sc->queue_mtx); if (sc->vnode != NULL) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY); Modified: stable/10/sys/geom/concat/g_concat.c ============================================================================== --- stable/10/sys/geom/concat/g_concat.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/concat/g_concat.c Tue Jan 7 01:32:23 2014 (r260385) @@ -239,6 +239,27 @@ g_concat_kernel_dump(struct bio *bp) } static void +g_concat_done(struct bio *bp) +{ + struct g_concat_softc *sc; + struct bio *pbp; + + pbp = bp->bio_parent; + sc = pbp->bio_to->geom->softc; + mtx_lock(&sc->sc_lock); + if (pbp->bio_error == 0) + pbp->bio_error = bp->bio_error; + pbp->bio_completed += bp->bio_completed; + pbp->bio_inbed++; + if (pbp->bio_children == pbp->bio_inbed) { + mtx_unlock(&sc->sc_lock); + g_io_deliver(pbp, pbp->bio_error); + } else + mtx_unlock(&sc->sc_lock); + g_destroy_bio(bp); +} + +static void g_concat_flush(struct g_concat_softc *sc, struct bio *bp) { struct bio_queue_head queue; @@ -250,23 +271,19 @@ g_concat_flush(struct g_concat_softc *sc for (no = 0; no < sc->sc_ndisks; no++) { cbp = g_clone_bio(bp); if (cbp == NULL) { - for (cbp = bioq_first(&queue); cbp != NULL; - cbp = bioq_first(&queue)) { - bioq_remove(&queue, cbp); + while ((cbp = bioq_takefirst(&queue)) != NULL) g_destroy_bio(cbp); - } if (bp->bio_error == 0) bp->bio_error = ENOMEM; g_io_deliver(bp, bp->bio_error); return; } bioq_insert_tail(&queue, cbp); - cbp->bio_done = g_std_done; + cbp->bio_done = g_concat_done; cbp->bio_caller1 = sc->sc_disks[no].d_consumer; cbp->bio_to = sc->sc_disks[no].d_consumer->provider; } - for (cbp = bioq_first(&queue); cbp != NULL; cbp = bioq_first(&queue)) { - bioq_remove(&queue, cbp); + while ((cbp = bioq_takefirst(&queue)) != NULL) { G_CONCAT_LOGREQ(cbp, "Sending request."); cp = cbp->bio_caller1; cbp->bio_caller1 = NULL; @@ -320,7 +337,10 @@ g_concat_start(struct bio *bp) offset = bp->bio_offset; length = bp->bio_length; - addr = bp->bio_data; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) + addr = NULL; + else + addr = bp->bio_data; end = offset + length; bioq_init(&queue); @@ -338,11 +358,8 @@ g_concat_start(struct bio *bp) cbp = g_clone_bio(bp); if (cbp == NULL) { - for (cbp = bioq_first(&queue); cbp != NULL; - cbp = bioq_first(&queue)) { - bioq_remove(&queue, cbp); + while ((cbp = bioq_takefirst(&queue)) != NULL) g_destroy_bio(cbp); - } if (bp->bio_error == 0) bp->bio_error = ENOMEM; g_io_deliver(bp, bp->bio_error); @@ -352,11 +369,21 @@ g_concat_start(struct bio *bp) /* * Fill in the component buf structure. */ - cbp->bio_done = g_std_done; + if (len == bp->bio_length) + cbp->bio_done = g_std_done; + else + cbp->bio_done = g_concat_done; cbp->bio_offset = off; - cbp->bio_data = addr; - addr += len; cbp->bio_length = len; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + cbp->bio_ma_offset += (uintptr_t)addr; + cbp->bio_ma += cbp->bio_ma_offset / PAGE_SIZE; + cbp->bio_ma_offset %= PAGE_SIZE; + cbp->bio_ma_n = round_page(cbp->bio_ma_offset + + cbp->bio_length) / PAGE_SIZE; + } else + cbp->bio_data = addr; + addr += len; cbp->bio_to = disk->d_consumer->provider; cbp->bio_caller1 = disk; @@ -366,8 +393,7 @@ g_concat_start(struct bio *bp) KASSERT(length == 0, ("Length is still greater than 0 (class=%s, name=%s).", bp->bio_to->geom->class->name, bp->bio_to->geom->name)); - for (cbp = bioq_first(&queue); cbp != NULL; cbp = bioq_first(&queue)) { - bioq_remove(&queue, cbp); + while ((cbp = bioq_takefirst(&queue)) != NULL) { G_CONCAT_LOGREQ(cbp, "Sending request."); disk = cbp->bio_caller1; cbp->bio_caller1 = NULL; @@ -379,7 +405,7 @@ static void g_concat_check_and_run(struct g_concat_softc *sc) { struct g_concat_disk *disk; - struct g_provider *pp; + struct g_provider *dp, *pp; u_int no, sectorsize = 0; off_t start; @@ -388,20 +414,27 @@ g_concat_check_and_run(struct g_concat_s return; pp = g_new_providerf(sc->sc_geom, "concat/%s", sc->sc_name); + pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE | + G_PF_ACCEPT_UNMAPPED; start = 0; for (no = 0; no < sc->sc_ndisks; no++) { disk = &sc->sc_disks[no]; + dp = disk->d_consumer->provider; disk->d_start = start; - disk->d_end = disk->d_start + - disk->d_consumer->provider->mediasize; + disk->d_end = disk->d_start + dp->mediasize; if (sc->sc_type == G_CONCAT_TYPE_AUTOMATIC) - disk->d_end -= disk->d_consumer->provider->sectorsize; + disk->d_end -= dp->sectorsize; start = disk->d_end; if (no == 0) - sectorsize = disk->d_consumer->provider->sectorsize; - else { - sectorsize = lcm(sectorsize, - disk->d_consumer->provider->sectorsize); + sectorsize = dp->sectorsize; + else + sectorsize = lcm(sectorsize, dp->sectorsize); + + /* A provider underneath us doesn't support unmapped */ + if ((dp->flags & G_PF_ACCEPT_UNMAPPED) == 0) { + G_CONCAT_DEBUG(1, "Cancelling unmapped " + "because of %s.", dp->name); + pp->flags &= ~G_PF_ACCEPT_UNMAPPED; } } pp->sectorsize = sectorsize; @@ -468,6 +501,7 @@ g_concat_add_disk(struct g_concat_softc fcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) { g_destroy_consumer(cp); @@ -557,6 +591,7 @@ g_concat_create(struct g_class *mp, cons for (no = 0; no < sc->sc_ndisks; no++) sc->sc_disks[no].d_consumer = NULL; sc->sc_type = type; + mtx_init(&sc->sc_lock, "gconcat lock", NULL, MTX_DEF); gp->softc = sc; sc->sc_geom = gp; @@ -605,6 +640,7 @@ g_concat_destroy(struct g_concat_softc * KASSERT(sc->sc_provider == NULL, ("Provider still exists? (device=%s)", gp->name)); free(sc->sc_disks, M_CONCAT); + mtx_destroy(&sc->sc_lock); free(sc, M_CONCAT); G_CONCAT_DEBUG(0, "Device %s destroyed.", gp->name); Modified: stable/10/sys/geom/concat/g_concat.h ============================================================================== --- stable/10/sys/geom/concat/g_concat.h Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/concat/g_concat.h Tue Jan 7 01:32:23 2014 (r260385) @@ -83,6 +83,7 @@ struct g_concat_softc { struct g_concat_disk *sc_disks; uint16_t sc_ndisks; + struct mtx sc_lock; }; #define sc_name sc_geom->name #endif /* _KERNEL */ Modified: stable/10/sys/geom/gate/g_gate.c ============================================================================== --- stable/10/sys/geom/gate/g_gate.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/gate/g_gate.c Tue Jan 7 01:32:23 2014 (r260385) @@ -91,6 +91,7 @@ static struct mtx g_gate_units_lock; static int g_gate_destroy(struct g_gate_softc *sc, boolean_t force) { + struct bio_queue_head queue; struct g_provider *pp; struct g_consumer *cp; struct g_geom *gp; @@ -113,21 +114,22 @@ g_gate_destroy(struct g_gate_softc *sc, pp->flags |= G_PF_WITHER; g_orphan_provider(pp, ENXIO); callout_drain(&sc->sc_callout); + bioq_init(&queue); mtx_lock(&sc->sc_queue_mtx); - while ((bp = bioq_first(&sc->sc_inqueue)) != NULL) { - bioq_remove(&sc->sc_inqueue, bp); + while ((bp = bioq_takefirst(&sc->sc_inqueue)) != NULL) { sc->sc_queue_count--; - G_GATE_LOGREQ(1, bp, "Request canceled."); - g_io_deliver(bp, ENXIO); + bioq_insert_tail(&queue, bp); } - while ((bp = bioq_first(&sc->sc_outqueue)) != NULL) { - bioq_remove(&sc->sc_outqueue, bp); + while ((bp = bioq_takefirst(&sc->sc_outqueue)) != NULL) { sc->sc_queue_count--; - G_GATE_LOGREQ(1, bp, "Request canceled."); - g_io_deliver(bp, ENXIO); + bioq_insert_tail(&queue, bp); } mtx_unlock(&sc->sc_queue_mtx); g_topology_unlock(); + while ((bp = bioq_takefirst(&queue)) != NULL) { + G_GATE_LOGREQ(1, bp, "Request canceled."); + g_io_deliver(bp, ENXIO); + } mtx_lock(&g_gate_units_lock); /* One reference is ours. */ sc->sc_ref--; @@ -334,6 +336,7 @@ g_gate_getunit(int unit, int *errorp) static void g_gate_guard(void *arg) { + struct bio_queue_head queue; struct g_gate_softc *sc; struct bintime curtime; struct bio *bp, *bp2; @@ -341,24 +344,27 @@ g_gate_guard(void *arg) sc = arg; binuptime(&curtime); g_gate_hold(sc->sc_unit, NULL); + bioq_init(&queue); mtx_lock(&sc->sc_queue_mtx); TAILQ_FOREACH_SAFE(bp, &sc->sc_inqueue.queue, bio_queue, bp2) { if (curtime.sec - bp->bio_t0.sec < 5) continue; bioq_remove(&sc->sc_inqueue, bp); sc->sc_queue_count--; - G_GATE_LOGREQ(1, bp, "Request timeout."); - g_io_deliver(bp, EIO); + bioq_insert_tail(&queue, bp); } TAILQ_FOREACH_SAFE(bp, &sc->sc_outqueue.queue, bio_queue, bp2) { if (curtime.sec - bp->bio_t0.sec < 5) continue; bioq_remove(&sc->sc_outqueue, bp); sc->sc_queue_count--; + bioq_insert_tail(&queue, bp); + } + mtx_unlock(&sc->sc_queue_mtx); + while ((bp = bioq_takefirst(&queue)) != NULL) { G_GATE_LOGREQ(1, bp, "Request timeout."); g_io_deliver(bp, EIO); } - mtx_unlock(&sc->sc_queue_mtx); if ((sc->sc_flags & G_GATE_FLAG_DESTROY) == 0) { callout_reset(&sc->sc_callout, sc->sc_timeout * hz, g_gate_guard, sc); @@ -542,6 +548,7 @@ g_gate_create(struct g_gate_ctl_create * if (ropp != NULL) { cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, ropp); if (error != 0) { G_GATE_DEBUG(1, "Unable to attach to %s.", ropp->name); @@ -560,6 +567,7 @@ g_gate_create(struct g_gate_ctl_create * ggio->gctl_unit = sc->sc_unit; pp = g_new_providerf(gp, "%s", name); + pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; pp->mediasize = ggio->gctl_mediasize; pp->sectorsize = ggio->gctl_sectorsize; sc->sc_provider = pp; @@ -636,6 +644,7 @@ g_gate_modify(struct g_gate_softc *sc, s return (EINVAL); } cp = g_new_consumer(sc->sc_provider->geom); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) { G_GATE_DEBUG(1, "Unable to attach to %s.", Modified: stable/10/sys/geom/geom.h ============================================================================== --- stable/10/sys/geom/geom.h Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom.h Tue Jan 7 01:32:23 2014 (r260385) @@ -177,6 +177,8 @@ struct g_consumer { int flags; #define G_CF_SPOILED 0x1 #define G_CF_ORPHAN 0x4 +#define G_CF_DIRECT_SEND 0x10 +#define G_CF_DIRECT_RECEIVE 0x20 struct devstat *stat; u_int nstart, nend; @@ -206,6 +208,8 @@ struct g_provider { #define G_PF_WITHER 0x2 #define G_PF_ORPHAN 0x4 #define G_PF_ACCEPT_UNMAPPED 0x8 +#define G_PF_DIRECT_SEND 0x10 +#define G_PF_DIRECT_RECEIVE 0x20 /* Two fields for the implementing class to use */ void *private; @@ -393,6 +397,8 @@ g_free(void *ptr) }; \ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +int g_is_geom_thread(struct thread *td); + #endif /* _KERNEL */ /* geom_ctl.c */ Modified: stable/10/sys/geom/geom_dev.c ============================================================================== --- stable/10/sys/geom/geom_dev.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom_dev.c Tue Jan 7 01:32:23 2014 (r260385) @@ -222,6 +222,7 @@ g_dev_taste(struct g_class *mp, struct g mtx_init(&sc->sc_mtx, "g_dev", NULL, MTX_DEF); cp = g_new_consumer(gp); cp->private = sc; + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); KASSERT(error == 0, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); @@ -485,16 +486,16 @@ g_dev_done(struct bio *bp2) sc = cp->private; bp = bp2->bio_parent; bp->bio_error = bp2->bio_error; - if (bp->bio_error != 0) { + bp->bio_completed = bp2->bio_completed; + bp->bio_resid = bp->bio_length - bp2->bio_completed; + if (bp2->bio_error != 0) { g_trace(G_T_BIO, "g_dev_done(%p) had error %d", - bp2, bp->bio_error); + bp2, bp2->bio_error); bp->bio_flags |= BIO_ERROR; } else { g_trace(G_T_BIO, "g_dev_done(%p/%p) resid %ld completed %jd", - bp2, bp, bp->bio_resid, (intmax_t)bp2->bio_completed); + bp2, bp, bp2->bio_resid, (intmax_t)bp2->bio_completed); } - bp->bio_resid = bp->bio_length - bp2->bio_completed; - bp->bio_completed = bp2->bio_completed; g_destroy_bio(bp2); destroy = 0; mtx_lock(&sc->sc_mtx); Modified: stable/10/sys/geom/geom_disk.c ============================================================================== --- stable/10/sys/geom/geom_disk.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom_disk.c Tue Jan 7 01:32:23 2014 (r260385) @@ -66,6 +66,7 @@ struct g_disk_softc { struct sysctl_oid *sysctl_tree; char led[64]; uint32_t state; + struct mtx start_mtx; }; static g_access_t g_disk_access; @@ -229,6 +230,7 @@ g_disk_setstate(struct bio *bp, struct g static void g_disk_done(struct bio *bp) { + struct bintime now; struct bio *bp2; struct g_disk_softc *sc; @@ -237,19 +239,40 @@ g_disk_done(struct bio *bp) bp2 = bp->bio_parent; sc = bp2->bio_to->private; bp->bio_completed = bp->bio_length - bp->bio_resid; + binuptime(&now); mtx_lock(&sc->done_mtx); if (bp2->bio_error == 0) bp2->bio_error = bp->bio_error; bp2->bio_completed += bp->bio_completed; if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0) - devstat_end_transaction_bio(sc->dp->d_devstat, bp); - g_destroy_bio(bp); + devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); bp2->bio_inbed++; if (bp2->bio_children == bp2->bio_inbed) { + mtx_unlock(&sc->done_mtx); bp2->bio_resid = bp2->bio_bcount - bp2->bio_completed; g_io_deliver(bp2, bp2->bio_error); + } else + mtx_unlock(&sc->done_mtx); + g_destroy_bio(bp); +} + +static void +g_disk_done_single(struct bio *bp) +{ + struct bintime now; + struct g_disk_softc *sc; + + bp->bio_completed = bp->bio_length - bp->bio_resid; + bp->bio_done = (void *)bp->bio_to; + bp->bio_to = LIST_FIRST(&bp->bio_disk->d_geom->provider); + if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0) { + binuptime(&now); + sc = bp->bio_to->private; + mtx_lock(&sc->done_mtx); + devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); + mtx_unlock(&sc->done_mtx); } - mtx_unlock(&sc->done_mtx); + g_io_deliver(bp, bp->bio_error); } static int @@ -277,7 +300,7 @@ g_disk_start(struct bio *bp) struct disk *dp; struct g_disk_softc *sc; int error; - off_t off; + off_t d_maxsize, off; sc = bp->bio_to->private; if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { @@ -294,6 +317,22 @@ g_disk_start(struct bio *bp) /* fall-through */ case BIO_READ: case BIO_WRITE: + d_maxsize = (bp->bio_cmd == BIO_DELETE) ? + dp->d_delmaxsize : dp->d_maxsize; + if (bp->bio_length <= d_maxsize) { + bp->bio_disk = dp; + bp->bio_to = (void *)bp->bio_done; + bp->bio_done = g_disk_done_single; + bp->bio_pblkno = bp->bio_offset / dp->d_sectorsize; + bp->bio_bcount = bp->bio_length; + mtx_lock(&sc->start_mtx); + devstat_start_transaction_bio(dp->d_devstat, bp); + mtx_unlock(&sc->start_mtx); + g_disk_lock_giant(dp); + dp->d_strategy(bp); + g_disk_unlock_giant(dp); + break; + } off = 0; bp3 = NULL; bp2 = g_clone_bio(bp); @@ -302,10 +341,6 @@ g_disk_start(struct bio *bp) break; } do { - off_t d_maxsize; - - d_maxsize = (bp->bio_cmd == BIO_DELETE) ? - dp->d_delmaxsize : dp->d_maxsize; bp2->bio_offset += off; bp2->bio_length -= off; if ((bp->bio_flags & BIO_UNMAPPED) == 0) { @@ -346,7 +381,9 @@ g_disk_start(struct bio *bp) bp2->bio_pblkno = bp2->bio_offset / dp->d_sectorsize; bp2->bio_bcount = bp2->bio_length; bp2->bio_disk = dp; + mtx_lock(&sc->start_mtx); devstat_start_transaction_bio(dp->d_devstat, bp2); + mtx_unlock(&sc->start_mtx); g_disk_lock_giant(dp); dp->d_strategy(bp2); g_disk_unlock_giant(dp); @@ -402,15 +439,11 @@ g_disk_start(struct bio *bp) error = EOPNOTSUPP; break; } - bp2 = g_clone_bio(bp); - if (bp2 == NULL) { - g_io_deliver(bp, ENOMEM); - return; - } - bp2->bio_done = g_disk_done; - bp2->bio_disk = dp; + bp->bio_disk = dp; + bp->bio_to = (void *)bp->bio_done; + bp->bio_done = g_disk_done_single; g_disk_lock_giant(dp); - dp->d_strategy(bp2); + dp->d_strategy(bp); g_disk_unlock_giant(dp); break; default: @@ -515,17 +548,24 @@ g_disk_create(void *arg, int flag) g_topology_assert(); dp = arg; sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); + mtx_init(&sc->start_mtx, "g_disk_start", NULL, MTX_DEF); mtx_init(&sc->done_mtx, "g_disk_done", NULL, MTX_DEF); sc->dp = dp; gp = g_new_geomf(&g_disk_class, "%s%d", dp->d_name, dp->d_unit); gp->softc = sc; pp = g_new_providerf(gp, "%s", gp->name); + devstat_remove_entry(pp->stat); + pp->stat = NULL; + dp->d_devstat->id = pp; pp->mediasize = dp->d_mediasize; pp->sectorsize = dp->d_sectorsize; pp->stripeoffset = dp->d_stripeoffset; pp->stripesize = dp->d_stripesize; if ((dp->d_flags & DISKFLAG_UNMAPPED_BIO) != 0) pp->flags |= G_PF_ACCEPT_UNMAPPED; + if ((dp->d_flags & DISKFLAG_DIRECT_COMPLETION) != 0) + pp->flags |= G_PF_DIRECT_SEND; + pp->flags |= G_PF_DIRECT_RECEIVE; if (bootverbose) printf("GEOM: new disk %s\n", gp->name); sysctl_ctx_init(&sc->sysctl_ctx); @@ -574,6 +614,7 @@ g_disk_providergone(struct g_provider *p pp->private = NULL; pp->geom->softc = NULL; mtx_destroy(&sc->done_mtx); + mtx_destroy(&sc->start_mtx); g_free(sc); } Modified: stable/10/sys/geom/geom_disk.h ============================================================================== --- stable/10/sys/geom/geom_disk.h Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom_disk.h Tue Jan 7 01:32:23 2014 (r260385) @@ -107,6 +107,7 @@ struct disk { #define DISKFLAG_CANDELETE 0x4 #define DISKFLAG_CANFLUSHCACHE 0x8 #define DISKFLAG_UNMAPPED_BIO 0x10 +#define DISKFLAG_DIRECT_COMPLETION 0x20 struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); Modified: stable/10/sys/geom/geom_int.h ============================================================================== --- stable/10/sys/geom/geom_int.h Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom_int.h Tue Jan 7 01:32:23 2014 (r260385) @@ -39,6 +39,9 @@ LIST_HEAD(class_list_head, g_class); TAILQ_HEAD(g_tailq_head, g_geom); extern int g_collectstats; +#define G_STATS_PROVIDERS 1 /* Collect I/O stats for providers */ +#define G_STATS_CONSUMERS 2 /* Collect I/O stats for consumers */ + extern int g_debugflags; /* * 1 G_T_TOPOLOGY Modified: stable/10/sys/geom/geom_io.c ============================================================================== --- stable/10/sys/geom/geom_io.c Tue Jan 7 01:17:27 2014 (r260384) +++ stable/10/sys/geom/geom_io.c Tue Jan 7 01:32:23 2014 (r260385) @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); #include #include +static int g_io_transient_map_bio(struct bio *bp); + static struct g_bioq g_bio_run_down; static struct g_bioq g_bio_run_up; static struct g_bioq g_bio_run_task; @@ -310,6 +312,8 @@ g_io_check(struct bio *bp) { struct g_consumer *cp; struct g_provider *pp; + off_t excess; + int error; cp = bp->bio_from; pp = bp->bio_to; @@ -354,11 +358,44 @@ g_io_check(struct bio *bp) return (EIO); if (bp->bio_offset > pp->mediasize) return (EIO); + + /* Truncate requests to the end of providers media. */ + excess = bp->bio_offset + bp->bio_length; + if (excess > bp->bio_to->mediasize) { + KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 || + round_page(bp->bio_ma_offset + + bp->bio_length) / PAGE_SIZE == bp->bio_ma_n, + ("excess bio %p too short", bp)); + excess -= bp->bio_to->mediasize; + bp->bio_length -= excess; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + bp->bio_ma_n = round_page(bp->bio_ma_offset + + bp->bio_length) / PAGE_SIZE; + } + if (excess > 0) + CTR3(KTR_GEOM, "g_down truncated bio " + "%p provider %s by %d", bp, + bp->bio_to->name, excess); + } + + /* Deliver zero length transfers right here. */ + if (bp->bio_length == 0) { + CTR2(KTR_GEOM, "g_down terminated 0-length " + "bp %p provider %s", bp, bp->bio_to->name); + return (0); + } + + if ((bp->bio_flags & BIO_UNMAPPED) != 0 && + (bp->bio_to->flags & G_PF_ACCEPT_UNMAPPED) == 0 && + (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE)) { + if ((error = g_io_transient_map_bio(bp)) >= 0) + return (error); + } break; default: break; } - return (0); + return (EJUSTRETURN); } /* @@ -422,7 +459,8 @@ void g_io_request(struct bio *bp, struct g_consumer *cp) { struct g_provider *pp; - int first; + struct mtx *mtxp; + int direct, error, first; KASSERT(cp != NULL, ("NULL cp in g_io_request")); KASSERT(bp != NULL, ("NULL bp in g_io_request")); @@ -472,48 +510,81 @@ g_io_request(struct bio *bp, struct g_co KASSERT(!(bp->bio_flags & BIO_ONQUEUE), ("Bio already on queue bp=%p", bp)); - bp->bio_flags |= BIO_ONQUEUE; - - if (g_collectstats) + if ((g_collectstats & G_STATS_CONSUMERS) != 0 || + ((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL)) binuptime(&bp->bio_t0); else getbinuptime(&bp->bio_t0); +#ifdef GET_STACK_USAGE + direct = (cp->flags & G_CF_DIRECT_SEND) && + (pp->flags & G_PF_DIRECT_RECEIVE) && + !g_is_geom_thread(curthread) && + (((pp->flags & G_PF_ACCEPT_UNMAPPED) == 0 && + (bp->bio_flags & BIO_UNMAPPED) != 0) || THREAD_CAN_SLEEP()); + if (direct) { + /* Block direct execution if less then half of stack left. */ + size_t st, su; + GET_STACK_USAGE(st, su); + if (su * 2 > st) + direct = 0; + } +#else + direct = 0; +#endif + + if (!TAILQ_EMPTY(&g_classifier_tailq) && !bp->bio_classifier1) { + g_bioq_lock(&g_bio_run_down); + g_run_classifiers(bp); + g_bioq_unlock(&g_bio_run_down); + } + /* * The statistics collection is lockless, as such, but we * can not update one instance of the statistics from more * than one thread at a time, so grab the lock first. - * - * We also use the lock to protect the list of classifiers. */ - g_bioq_lock(&g_bio_run_down); - - if (!TAILQ_EMPTY(&g_classifier_tailq) && !bp->bio_classifier1) - g_run_classifiers(bp); - - if (g_collectstats & 1) + mtxp = mtx_pool_find(mtxpool_sleep, pp); + mtx_lock(mtxp); + if (g_collectstats & G_STATS_PROVIDERS) devstat_start_transaction(pp->stat, &bp->bio_t0); - if (g_collectstats & 2) + if (g_collectstats & G_STATS_CONSUMERS) devstat_start_transaction(cp->stat, &bp->bio_t0); - pp->nstart++; cp->nstart++; - first = TAILQ_EMPTY(&g_bio_run_down.bio_queue); - TAILQ_INSERT_TAIL(&g_bio_run_down.bio_queue, bp, bio_queue); - g_bio_run_down.bio_queue_length++; - g_bioq_unlock(&g_bio_run_down); + mtx_unlock(mtxp); - /* Pass it on down. */ - if (first) - wakeup(&g_wait_down); + if (direct) { + error = g_io_check(bp); + if (error >= 0) { + CTR3(KTR_GEOM, "g_io_request g_io_check on bp %p " + "provider %s returned %d", bp, bp->bio_to->name, + error); + g_io_deliver(bp, error); + return; + } + bp->bio_to->geom->start(bp); + } else { + g_bioq_lock(&g_bio_run_down); + first = TAILQ_EMPTY(&g_bio_run_down.bio_queue); + TAILQ_INSERT_TAIL(&g_bio_run_down.bio_queue, bp, bio_queue); + bp->bio_flags |= BIO_ONQUEUE; + g_bio_run_down.bio_queue_length++; + g_bioq_unlock(&g_bio_run_down); + /* Pass it on down. */ + if (first) + wakeup(&g_wait_down); + } } void g_io_deliver(struct bio *bp, int error) { + struct bintime now; struct g_consumer *cp; struct g_provider *pp; - int first; + struct mtx *mtxp; + int direct, first; KASSERT(bp != NULL, ("NULL bp in g_io_deliver")); pp = bp->bio_to; @@ -559,31 +630,55 @@ g_io_deliver(struct bio *bp, int error) bp->bio_bcount = bp->bio_length; bp->bio_resid = bp->bio_bcount - bp->bio_completed; +#ifdef GET_STACK_USAGE + direct = (pp->flags & G_PF_DIRECT_SEND) && + (cp->flags & G_CF_DIRECT_RECEIVE) && + !g_is_geom_thread(curthread); + if (direct) { + /* Block direct execution if less then half of stack left. */ + size_t st, su; + GET_STACK_USAGE(st, su); + if (su * 2 > st) + direct = 0; + } +#else + direct = 0; +#endif + /* * The statistics collection is lockless, as such, but we * can not update one instance of the statistics from more * than one thread at a time, so grab the lock first. */ - g_bioq_lock(&g_bio_run_up); - if (g_collectstats & 1) - devstat_end_transaction_bio(pp->stat, bp); - if (g_collectstats & 2) - devstat_end_transaction_bio(cp->stat, bp); - + if ((g_collectstats & G_STATS_CONSUMERS) != 0 || + ((g_collectstats & G_STATS_PROVIDERS) != 0 && pp->stat != NULL)) + binuptime(&now); + mtxp = mtx_pool_find(mtxpool_sleep, cp); + mtx_lock(mtxp); + if (g_collectstats & G_STATS_PROVIDERS) + devstat_end_transaction_bio_bt(pp->stat, bp, &now); + if (g_collectstats & G_STATS_CONSUMERS) + devstat_end_transaction_bio_bt(cp->stat, bp, &now); cp->nend++; pp->nend++; + mtx_unlock(mtxp); + if (error != ENOMEM) { bp->bio_error = error; - first = TAILQ_EMPTY(&g_bio_run_up.bio_queue); - TAILQ_INSERT_TAIL(&g_bio_run_up.bio_queue, bp, bio_queue); - bp->bio_flags |= BIO_ONQUEUE; - g_bio_run_up.bio_queue_length++; - g_bioq_unlock(&g_bio_run_up); - if (first) - wakeup(&g_wait_up); + if (direct) { + biodone(bp); + } else { + g_bioq_lock(&g_bio_run_up); + first = TAILQ_EMPTY(&g_bio_run_up.bio_queue); + TAILQ_INSERT_TAIL(&g_bio_run_up.bio_queue, bp, bio_queue); + bp->bio_flags |= BIO_ONQUEUE; + g_bio_run_up.bio_queue_length++; + g_bioq_unlock(&g_bio_run_up); + if (first) + wakeup(&g_wait_up); + } return; } - g_bioq_unlock(&g_bio_run_up); if (bootverbose) printf("ENOMEM %p on %p(%s)\n", bp, pp, pp->name); @@ -639,11 +734,10 @@ retry: if (vmem_alloc(transient_arena, size, M_BESTFIT | M_NOWAIT, &addr)) { if (transient_map_retries != 0 && retried >= transient_map_retries) { - g_io_deliver(bp, EDEADLK/* XXXKIB */); CTR2(KTR_GEOM, "g_down cannot map bp %p provider %s", bp, bp->bio_to->name); atomic_add_int(&transient_map_hard_failures, 1); - return (1); + return (EDEADLK/* XXXKIB */); } else { /* * Naive attempt to quisce the I/O to get more @@ -663,14 +757,13 @@ retry: bp->bio_data = (caddr_t)addr + bp->bio_ma_offset; bp->bio_flags |= BIO_TRANSIENT_MAPPING; bp->bio_flags &= ~BIO_UNMAPPED; - return (0); + return (EJUSTRETURN); } void g_io_schedule_down(struct thread *tp __unused) { struct bio *bp; - off_t excess; int error; for(;;) { @@ -689,59 +782,15 @@ g_io_schedule_down(struct thread *tp __u pause("g_down", hz/10); pace--; } + CTR2(KTR_GEOM, "g_down processing bp %p provider %s", bp, + bp->bio_to->name); error = g_io_check(bp); - if (error) { + if (error >= 0) { CTR3(KTR_GEOM, "g_down g_io_check on bp %p provider " "%s returned %d", bp, bp->bio_to->name, error); g_io_deliver(bp, error); continue; } - CTR2(KTR_GEOM, "g_down processing bp %p provider %s", bp, - bp->bio_to->name); - switch (bp->bio_cmd) { - case BIO_READ: - case BIO_WRITE: - case BIO_DELETE: - /* Truncate requests to the end of providers media. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 01:51:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33FFE877; Tue, 7 Jan 2014 01:51:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA221296; Tue, 7 Jan 2014 01:51:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s071poKW055909; Tue, 7 Jan 2014 01:51:50 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s071pmLP055901; Tue, 7 Jan 2014 01:51:48 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201401070151.s071pmLP055901@svn.freebsd.org> From: Scott Long Date: Tue, 7 Jan 2014 01:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260387 - in stable/10/sys: cam cam/ata cam/ctl cam/scsi dev/ahci dev/ata dev/isp dev/mvs dev/siis kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 01:51:50 -0000 Author: scottl Date: Tue Jan 7 01:51:48 2014 New Revision: 260387 URL: http://svnweb.freebsd.org/changeset/base/260387 Log: MFC Alexander Motin's direct dispatch, multi-queue, and finer-grained locking support for CAM r256826: Fix several target mode SIMs to not blindly clear ccb_h.flags field of ATIO CCBs. Not all CCB flags there belong to them. r256836: Remove hard limit on number of BIOs handled with one ATA TRIM request. r256843: Merge CAM locking changes from the projects/camlock branch to radically reduce lock congestion and improve SMP scalability of the SCSI/ATA stack, preparing the ground for the coming next GEOM direct dispatch support. r256888: Unconditionally acquire periph reference on CCB allocation failure. r256895: Fix memory and references leak due to unfreed path. r256960: Move CAM_UNQUEUED_INDEX setting to the last moment and under the periph lock. This fixes race condition with cam_periph_ccbwait(), causing use-after-free. r256975: Minor (mostly cosmetical) addition to r256960. r257054: Some microoptimizations for da and ada drivers: - Replace ordered_tag_count counter with single flag; - From da remove outstanding_cmds counter, duplicating pending_ccbs list; - From da_softc remove unused links field. r257482: Fix lock recursion, triggered by `smartctl -a /dev/adaX`. r257501: Make getenv_*() functions and respectively TUNABLE_*_FETCH() macros not allocate memory and so not require sleepable environment. getenv() has already used on-stack temporary storage, so just use it more rationally. getenv_string() receives buffer as argument, so don't need another one. r257914: Some CAM locks polishing: - Fix LOR and possible lock recursion when handling high-power commands. Introduce new lock to protect left power quota and list of frozen devices. - Correct locking around xpt periph creation. - Remove seems never used XPT_FLAG_OPEN xpt periph flag. Again, Netflix assisted with testing the merge, but all of the credit goes to Alexander and iX Systems. Submitted by: mav Sponsored by: iX Systems Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/ata/ata_pmp.c stable/10/sys/cam/ata/ata_xpt.c stable/10/sys/cam/cam_ccb.h stable/10/sys/cam/cam_periph.c stable/10/sys/cam/cam_periph.h stable/10/sys/cam/cam_queue.c stable/10/sys/cam/cam_queue.h stable/10/sys/cam/cam_sim.c stable/10/sys/cam/cam_sim.h stable/10/sys/cam/cam_xpt.c stable/10/sys/cam/cam_xpt.h stable/10/sys/cam/cam_xpt_internal.h stable/10/sys/cam/cam_xpt_sim.h stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_cd.c stable/10/sys/cam/scsi/scsi_ch.c stable/10/sys/cam/scsi/scsi_da.c stable/10/sys/cam/scsi/scsi_enc.c stable/10/sys/cam/scsi/scsi_enc_internal.h stable/10/sys/cam/scsi/scsi_enc_safte.c stable/10/sys/cam/scsi/scsi_enc_ses.c stable/10/sys/cam/scsi/scsi_pass.c stable/10/sys/cam/scsi/scsi_pt.c stable/10/sys/cam/scsi/scsi_sa.c stable/10/sys/cam/scsi/scsi_sg.c stable/10/sys/cam/scsi/scsi_targ_bh.c stable/10/sys/cam/scsi/scsi_target.c stable/10/sys/cam/scsi/scsi_xpt.c stable/10/sys/dev/ahci/ahci.c stable/10/sys/dev/ahci/ahci.h stable/10/sys/dev/ata/ata-all.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/mvs/mvs.c stable/10/sys/dev/siis/siis.c stable/10/sys/kern/kern_environment.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/ata/ata_da.c Tue Jan 7 01:51:48 2014 (r260387) @@ -80,7 +80,7 @@ typedef enum { ADA_FLAG_CAN_NCQ = 0x0008, ADA_FLAG_CAN_DMA = 0x0010, ADA_FLAG_NEED_OTAG = 0x0020, - ADA_FLAG_WENT_IDLE = 0x0040, + ADA_FLAG_WAS_OTAG = 0x0040, ADA_FLAG_CAN_TRIM = 0x0080, ADA_FLAG_OPEN = 0x0100, ADA_FLAG_SCTX_INIT = 0x0200, @@ -103,7 +103,6 @@ typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, - ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, ADA_CCB_TRIM = 0x06, ADA_CCB_TYPE_MASK = 0x0F, @@ -123,21 +122,20 @@ struct disk_params { #define TRIM_MAX_BLOCKS 8 #define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES) -#define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { uint8_t data[TRIM_MAX_RANGES * ATA_DSM_RANGE_SIZE]; - struct bio *bps[TRIM_MAX_BIOS]; + TAILQ_HEAD(, bio) bps; }; struct ada_softc { struct bio_queue_head bio_queue; struct bio_queue_head trim_queue; + int outstanding_cmds; /* Number of active commands */ + int refcount; /* Active xpt_action() calls */ ada_state state; - ada_flags flags; + ada_flags flags; ada_quirks quirks; int sort_io_queue; - int ordered_tag_count; - int outstanding_cmds; int trim_max_ranges; int trim_running; int read_ahead; @@ -630,14 +628,8 @@ adaclose(struct disk *dp) int error; periph = (struct cam_periph *)dp->d_drv1; - cam_periph_lock(periph); - if (cam_periph_hold(periph, PRIBIO) != 0) { - cam_periph_unlock(periph); - cam_periph_release(periph); - return (0); - } - softc = (struct ada_softc *)periph->softc; + cam_periph_lock(periph); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaclose\n")); @@ -645,7 +637,8 @@ adaclose(struct disk *dp) /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_DIRTY) != 0 && (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && - (periph->flags & CAM_PERIPH_INVALID) == 0) { + (periph->flags & CAM_PERIPH_INVALID) == 0 && + cam_periph_hold(periph, PRIBIO) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, @@ -669,10 +662,13 @@ adaclose(struct disk *dp) else softc->flags &= ~ADA_FLAG_DIRTY; xpt_release_ccb(ccb); + cam_periph_unhold(periph); } softc->flags &= ~ADA_FLAG_OPEN; - cam_periph_unhold(periph); + + while (softc->refcount != 0) + cam_periph_sleep(periph, &softc->refcount, PRIBIO, "adaclose", 1); cam_periph_unlock(periph); cam_periph_release(periph); return (0); @@ -682,23 +678,15 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; - uint32_t prio; if (softc->state != ADA_STATE_NORMAL) return; - /* Check if cam_periph_getccb() was called. */ - prio = periph->immediate_priority; - /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - prio = CAM_PRIORITY_NORMAL; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); } - - /* Schedule CCB if any of above is true. */ - if (prio != CAM_PRIORITY_NONE) - xpt_schedule(periph, prio); } /* @@ -962,7 +950,7 @@ adaasync(void *callback_arg, u_int32_t c status = cam_periph_alloc(adaregister, adaoninvalidate, adacleanup, adastart, "ada", CAM_PERIPH_BIO, - cgd->ccb_h.path, adaasync, + path, adaasync, AC_FOUND_DEVICE, cgd); if (status != CAM_REQ_CMP @@ -1038,8 +1026,10 @@ adaasync(void *callback_arg, u_int32_t c softc->state = ADA_STATE_WCACHE; else break; - cam_periph_acquire(periph); - xpt_schedule(periph, CAM_PRIORITY_DEV); + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + softc->state = ADA_STATE_NORMAL; + else + xpt_schedule(periph, CAM_PRIORITY_DEV); } default: cam_periph_async(periph, code, path, arg); @@ -1346,8 +1336,8 @@ adaregister(struct cam_periph *periph, v * Create our sysctl variables, now that we know * we have successfully attached. */ - cam_periph_acquire(periph); - taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); + if (cam_periph_acquire(periph) == CAM_REQ_CMP) + taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); /* * Add async callbacks for bus reset and @@ -1365,7 +1355,7 @@ adaregister(struct cam_periph *periph, v * Schedule a periodic event to occasionally send an * ordered tag to a device. */ - callout_init_mtx(&softc->sendordered_c, periph->sim->mtx, 0); + callout_init_mtx(&softc->sendordered_c, cam_periph_mtx(periph), 0); callout_reset(&softc->sendordered_c, (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); @@ -1373,16 +1363,17 @@ adaregister(struct cam_periph *periph, v if (ADA_RA >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_LOOKAHEAD) { softc->state = ADA_STATE_RAHEAD; - cam_periph_acquire(periph); - xpt_schedule(periph, CAM_PRIORITY_DEV); } else if (ADA_WC >= 0 && cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { softc->state = ADA_STATE_WCACHE; - cam_periph_acquire(periph); - xpt_schedule(periph, CAM_PRIORITY_DEV); - } else + } else { softc->state = ADA_STATE_NORMAL; - + return(CAM_REQ_CMP); + } + if (cam_periph_acquire(periph) != CAM_REQ_CMP) + softc->state = ADA_STATE_NORMAL; + else + xpt_schedule(periph, CAM_PRIORITY_DEV); return(CAM_REQ_CMP); } @@ -1400,29 +1391,17 @@ adastart(struct cam_periph *periph, unio struct bio *bp; u_int8_t tag_code; - /* Execute immediate CCB if waiting. */ - if (periph->immediate_priority <= periph->pinfo.priority) { - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, - ("queuing for immediate ccb\n")); - start_ccb->ccb_h.ccb_state = ADA_CCB_WAITING; - SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, - periph_links.sle); - periph->immediate_priority = CAM_PRIORITY_NONE; - wakeup(&periph->ccb_list); - /* Have more work to do, so ensure we stay scheduled */ - adaschedule(periph); - break; - } /* Run TRIM if not running yet. */ if (!softc->trim_running && (bp = bioq_first(&softc->trim_queue)) != 0) { struct trim_request *req = &softc->trim_req; struct bio *bp1; uint64_t lastlba = (uint64_t)-1; - int bps = 0, c, lastcount = 0, off, ranges = 0; + int c, lastcount = 0, off, ranges = 0; softc->trim_running = 1; bzero(req, sizeof(*req)); + TAILQ_INIT(&req->bps); bp1 = bp; do { uint64_t lba = bp1->bio_pblkno; @@ -1465,10 +1444,9 @@ adastart(struct cam_periph *periph, unio */ } lastlba = lba; - req->bps[bps++] = bp1; + TAILQ_INSERT_TAIL(&req->bps, bp1, bio_queue); bp1 = bioq_first(&softc->trim_queue); - if (bps >= TRIM_MAX_BIOS || - bp1 == NULL || + if (bp1 == NULL || bp1->bio_bcount / softc->params.secsize > (softc->trim_max_ranges - ranges) * ATA_DSM_RANGE_MAX) @@ -1487,6 +1465,7 @@ adastart(struct cam_periph *periph, unio ATA_DSM_TRIM, 0, (ranges + ATA_DSM_BLK_RANGES - 1) / ATA_DSM_BLK_RANGES); start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM; + start_ccb->ccb_h.flags |= CAM_UNLOCKED; goto out; } /* Run regular command. */ @@ -1500,7 +1479,7 @@ adastart(struct cam_periph *periph, unio if ((bp->bio_flags & BIO_ORDERED) != 0 || (softc->flags & ADA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~ADA_FLAG_NEED_OTAG; - softc->ordered_tag_count++; + softc->flags |= ADA_FLAG_WAS_OTAG; tag_code = 0; } else { tag_code = 1; @@ -1655,10 +1634,15 @@ adastart(struct cam_periph *periph, unio break; } start_ccb->ccb_h.ccb_state = ADA_CCB_BUFFER_IO; + start_ccb->ccb_h.flags |= CAM_UNLOCKED; out: start_ccb->ccb_h.ccb_bp = bp; softc->outstanding_cmds++; + softc->refcount++; + cam_periph_unlock(periph); xpt_action(start_ccb); + cam_periph_lock(periph); + softc->refcount--; /* May have more work to do, so ensure we stay scheduled */ adaschedule(periph); @@ -1667,13 +1651,6 @@ out: case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { - if ((periph->flags & CAM_PERIPH_INVALID) != 0) { - softc->state = ADA_STATE_NORMAL; - xpt_release_ccb(start_ccb); - cam_periph_release_locked(periph); - return; - } - cam_fill_ataio(ataio, 1, adadone, @@ -1722,10 +1699,12 @@ adadone(struct cam_periph *periph, union struct bio *bp; int error; + cam_periph_lock(periph); if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { error = adaerror(done_ccb, 0, 0); if (error == ERESTART) { /* A retry was scheduled, so just return. */ + cam_periph_unlock(periph); return; } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -1754,29 +1733,32 @@ adadone(struct cam_periph *periph, union } softc->outstanding_cmds--; if (softc->outstanding_cmds == 0) - softc->flags |= ADA_FLAG_WENT_IDLE; + softc->flags |= ADA_FLAG_WAS_OTAG; + xpt_release_ccb(done_ccb); if (state == ADA_CCB_TRIM) { - struct trim_request *req = - (struct trim_request *)ataio->data_ptr; - int i; - - for (i = 1; i < TRIM_MAX_BIOS && req->bps[i]; i++) { - struct bio *bp1 = req->bps[i]; + TAILQ_HEAD(, bio) queue; + struct bio *bp1; - bp1->bio_error = bp->bio_error; - if (bp->bio_flags & BIO_ERROR) { + TAILQ_INIT(&queue); + TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue); + softc->trim_running = 0; + adaschedule(periph); + cam_periph_unlock(periph); + while ((bp1 = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, bp1, bio_queue); + bp1->bio_error = error; + if (error != 0) { bp1->bio_flags |= BIO_ERROR; bp1->bio_resid = bp1->bio_bcount; } else bp1->bio_resid = 0; biodone(bp1); } - softc->trim_running = 0; - biodone(bp); - adaschedule(periph); - } else + } else { + cam_periph_unlock(periph); biodone(bp); - break; + } + return; } case ADA_CCB_RAHEAD: { @@ -1852,12 +1834,6 @@ out: cam_periph_release_locked(periph); return; } - case ADA_CCB_WAITING: - { - /* Caller will release the CCB */ - wakeup(&done_ccb->ccb_h.cbfcnp); - return; - } case ADA_CCB_DUMP: /* No-op. We're polling */ return; @@ -1919,14 +1895,11 @@ adasendorderedtag(void *arg) struct ada_softc *softc = arg; if (ada_send_ordered) { - if ((softc->ordered_tag_count == 0) - && ((softc->flags & ADA_FLAG_WENT_IDLE) == 0)) { - softc->flags |= ADA_FLAG_NEED_OTAG; + if (softc->outstanding_cmds > 0) { + if ((softc->flags & ADA_FLAG_WAS_OTAG) == 0) + softc->flags |= ADA_FLAG_NEED_OTAG; + softc->flags &= ~ADA_FLAG_WAS_OTAG; } - if (softc->outstanding_cmds > 0) - softc->flags &= ~ADA_FLAG_WENT_IDLE; - - softc->ordered_tag_count = 0; } /* Queue us up again */ callout_reset(&softc->sendordered_c, Modified: stable/10/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/10/sys/cam/ata/ata_pmp.c Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/ata/ata_pmp.c Tue Jan 7 01:51:48 2014 (r260387) @@ -293,7 +293,7 @@ pmpasync(void *callback_arg, u_int32_t c status = cam_periph_alloc(pmpregister, pmponinvalidate, pmpcleanup, pmpstart, "pmp", CAM_PERIPH_BIO, - cgd->ccb_h.path, pmpasync, + path, pmpasync, AC_FOUND_DEVICE, cgd); if (status != CAM_REQ_CMP @@ -318,13 +318,17 @@ pmpasync(void *callback_arg, u_int32_t c if (code == AC_SENT_BDR || code == AC_BUS_RESET) softc->found = 0; /* We have to reset everything. */ if (softc->state == PMP_STATE_NORMAL) { - if (softc->pm_pid == 0x37261095 || - softc->pm_pid == 0x38261095) - softc->state = PMP_STATE_PM_QUIRKS_1; - else - softc->state = PMP_STATE_PRECONFIG; - cam_periph_acquire(periph); - xpt_schedule(periph, CAM_PRIORITY_DEV); + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + if (softc->pm_pid == 0x37261095 || + softc->pm_pid == 0x38261095) + softc->state = PMP_STATE_PM_QUIRKS_1; + else + softc->state = PMP_STATE_PRECONFIG; + xpt_schedule(periph, CAM_PRIORITY_DEV); + } else { + pmprelease(periph, softc->found); + xpt_release_boot(); + } } else softc->restart = 1; break; Modified: stable/10/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/10/sys/cam/ata/ata_xpt.c Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/ata/ata_xpt.c Tue Jan 7 01:51:48 2014 (r260387) @@ -182,7 +182,7 @@ static struct cam_ed * static void ata_device_transport(struct cam_path *path); static void ata_get_transfer_settings(struct ccb_trans_settings *cts); static void ata_set_transfer_settings(struct ccb_trans_settings *cts, - struct cam_ed *device, + struct cam_path *path, int async_update); static void ata_dev_async(u_int32_t async_code, struct cam_eb *bus, @@ -249,6 +249,7 @@ proberegister(struct cam_periph *periph, return (status); } CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n")); + ata_device_transport(periph->path); probeschedule(periph); return(CAM_REQ_CMP); } @@ -1320,6 +1321,7 @@ ata_scan_bus(struct cam_periph *periph, struct cam_path *path; ata_scan_bus_info *scan_info; union ccb *work_ccb, *reset_ccb; + struct mtx *mtx; cam_status status; CAM_DEBUG(request_ccb->ccb_h.path, CAM_DEBUG_TRACE, @@ -1395,11 +1397,14 @@ ata_scan_bus(struct cam_periph *periph, xpt_done(request_ccb); break; } + mtx = xpt_path_mtx(scan_info->request_ccb->ccb_h.path); goto scan_next; case XPT_SCAN_LUN: work_ccb = request_ccb; /* Reuse the same CCB to query if a device was really found */ scan_info = (ata_scan_bus_info *)work_ccb->ccb_h.ppriv_ptr0; + mtx = xpt_path_mtx(scan_info->request_ccb->ccb_h.path); + mtx_lock(mtx); /* If there is PMP... */ if ((scan_info->cpi->hba_inquiry & PI_SATAPM) && (scan_info->counter == scan_info->cpi->max_target)) { @@ -1428,6 +1433,7 @@ ata_scan_bus(struct cam_periph *periph, ((scan_info->cpi->hba_inquiry & PI_SATAPM) ? 0 : scan_info->cpi->max_target)) { done: + mtx_unlock(mtx); xpt_free_ccb(work_ccb); xpt_free_ccb((union ccb *)scan_info->cpi); request_ccb = scan_info->request_ccb; @@ -1444,6 +1450,8 @@ scan_next: scan_info->request_ccb->ccb_h.path_id, scan_info->counter, 0); if (status != CAM_REQ_CMP) { + if (request_ccb->ccb_h.func_code == XPT_SCAN_LUN) + mtx_unlock(mtx); printf("xpt_scan_bus: xpt_create_path failed" " with status %#x, bus scan halted\n", status); @@ -1459,9 +1467,15 @@ scan_next: scan_info->request_ccb->ccb_h.pinfo.priority); work_ccb->ccb_h.func_code = XPT_SCAN_LUN; work_ccb->ccb_h.cbfcnp = ata_scan_bus; + work_ccb->ccb_h.flags |= CAM_UNLOCKED; work_ccb->ccb_h.ppriv_ptr0 = scan_info; work_ccb->crcn.flags = scan_info->request_ccb->crcn.flags; + mtx_unlock(mtx); + if (request_ccb->ccb_h.func_code == XPT_SCAN_LUN) + mtx = NULL; xpt_action(work_ccb); + if (mtx != NULL) + mtx_lock(mtx); break; default: break; @@ -1476,6 +1490,7 @@ ata_scan_lun(struct cam_periph *periph, cam_status status; struct cam_path *new_path; struct cam_periph *old_periph; + int lock; CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n")); @@ -1510,10 +1525,14 @@ ata_scan_lun(struct cam_periph *periph, } xpt_setup_ccb(&request_ccb->ccb_h, new_path, CAM_PRIORITY_XPT); request_ccb->ccb_h.cbfcnp = xptscandone; + request_ccb->ccb_h.flags |= CAM_UNLOCKED; request_ccb->ccb_h.func_code = XPT_SCAN_LUN; request_ccb->crcn.flags = flags; } + lock = (xpt_path_owned(path) == 0); + if (lock) + xpt_path_lock(path); if ((old_periph = cam_periph_find(path, "aprobe")) != NULL) { if ((old_periph->flags & CAM_PERIPH_INVALID) == 0) { probe_softc *softc; @@ -1540,6 +1559,8 @@ ata_scan_lun(struct cam_periph *periph, xpt_done(request_ccb); } } + if (lock) + xpt_path_unlock(path); } static void @@ -1553,7 +1574,6 @@ xptscandone(struct cam_periph *periph, u static struct cam_ed * ata_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id) { - struct cam_path path; struct ata_quirk_entry *quirk; struct cam_ed *device; @@ -1574,22 +1594,6 @@ ata_alloc_device(struct cam_eb *bus, str device->queue_flags = 0; device->serial_num = NULL; device->serial_num_len = 0; - - /* - * XXX should be limited by number of CCBs this bus can - * do. - */ - bus->sim->max_ccbs += device->ccbq.devq_openings; - if (lun_id != CAM_LUN_WILDCARD) { - xpt_compile_path(&path, - NULL, - bus->path_id, - target->target_id, - lun_id); - ata_device_transport(&path); - xpt_release_path(&path); - } - return (device); } @@ -1712,15 +1716,8 @@ ata_dev_advinfo(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; if (cdai->flags & CDAI_FLAG_STORE) { - int owned; - - owned = mtx_owned(start_ccb->ccb_h.path->bus->sim->mtx); - if (owned == 0) - mtx_lock(start_ccb->ccb_h.path->bus->sim->mtx); xpt_async(AC_ADVINFO_CHANGED, start_ccb->ccb_h.path, (void *)(uintptr_t)cdai->buftype); - if (owned == 0) - mtx_unlock(start_ccb->ccb_h.path->bus->sim->mtx); } } @@ -1732,7 +1729,7 @@ ata_action(union ccb *start_ccb) case XPT_SET_TRAN_SETTINGS: { ata_set_transfer_settings(&start_ccb->cts, - start_ccb->ccb_h.path->device, + start_ccb->ccb_h.path, /*async_update*/FALSE); break; } @@ -1791,11 +1788,9 @@ ata_get_transfer_settings(struct ccb_tra struct ccb_trans_settings_ata *ata; struct ccb_trans_settings_scsi *scsi; struct cam_ed *device; - struct cam_sim *sim; device = cts->ccb_h.path->device; - sim = cts->ccb_h.path->bus->sim; - (*(sim->sim_action))(sim, (union ccb *)cts); + xpt_action_default((union ccb *)cts); if (cts->protocol == PROTO_UNKNOWN || cts->protocol == PROTO_UNSPECIFIED) { @@ -1832,17 +1827,17 @@ ata_get_transfer_settings(struct ccb_tra } static void -ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, +ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path, int async_update) { struct ccb_pathinq cpi; struct ccb_trans_settings_ata *ata; struct ccb_trans_settings_scsi *scsi; - struct cam_sim *sim; struct ata_params *ident_data; struct scsi_inquiry_data *inq_data; + struct cam_ed *device; - if (device == NULL) { + if (path == NULL || (device = path->device) == NULL) { cts->ccb_h.status = CAM_PATH_INVALID; xpt_done((union ccb *)cts); return; @@ -1859,14 +1854,14 @@ ata_set_transfer_settings(struct ccb_tra cts->protocol_version = device->protocol_version; if (cts->protocol != device->protocol) { - xpt_print(cts->ccb_h.path, "Uninitialized Protocol %x:%x?\n", + xpt_print(path, "Uninitialized Protocol %x:%x?\n", cts->protocol, device->protocol); cts->protocol = device->protocol; } if (cts->protocol_version > device->protocol_version) { if (bootverbose) { - xpt_print(cts->ccb_h.path, "Down reving Protocol " + xpt_print(path, "Down reving Protocol " "Version from %d to %d?\n", cts->protocol_version, device->protocol_version); } @@ -1884,21 +1879,20 @@ ata_set_transfer_settings(struct ccb_tra cts->transport_version = device->transport_version; if (cts->transport != device->transport) { - xpt_print(cts->ccb_h.path, "Uninitialized Transport %x:%x?\n", + xpt_print(path, "Uninitialized Transport %x:%x?\n", cts->transport, device->transport); cts->transport = device->transport; } if (cts->transport_version > device->transport_version) { if (bootverbose) { - xpt_print(cts->ccb_h.path, "Down reving Transport " + xpt_print(path, "Down reving Transport " "Version from %d to %d?\n", cts->transport_version, device->transport_version); } cts->transport_version = device->transport_version; } - sim = cts->ccb_h.path->bus->sim; ident_data = &device->ident_data; inq_data = &device->inq_data; if (cts->protocol == PROTO_ATA) @@ -1909,7 +1903,7 @@ ata_set_transfer_settings(struct ccb_tra scsi = &cts->proto_specific.scsi; else scsi = NULL; - xpt_setup_ccb(&cpi.ccb_h, cts->ccb_h.path, CAM_PRIORITY_NONE); + xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -1953,11 +1947,11 @@ ata_set_transfer_settings(struct ccb_tra device->tag_delay_count = CAM_TAG_DELAY_COUNT; device->flags |= CAM_DEV_TAG_AFTER_COUNT; } else if (nowt && !newt) - xpt_stop_tags(cts->ccb_h.path); + xpt_stop_tags(path); } if (async_update == FALSE) - (*(sim->sim_action))(sim, (union ccb *)cts); + xpt_action_default((union ccb *)cts); } /* @@ -2014,10 +2008,14 @@ ata_dev_async(u_int32_t async_code, stru xpt_release_device(device); } else if (async_code == AC_TRANSFER_NEG) { struct ccb_trans_settings *settings; + struct cam_path path; settings = (struct ccb_trans_settings *)async_arg; - ata_set_transfer_settings(settings, device, + xpt_compile_path(&path, NULL, bus->path_id, target->target_id, + device->lun_id); + ata_set_transfer_settings(settings, &path, /*async_update*/TRUE); + xpt_release_path(&path); } } @@ -2030,7 +2028,7 @@ ata_announce_periph(struct cam_periph *p u_int speed; u_int mb; - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; Modified: stable/10/sys/cam/cam_ccb.h ============================================================================== --- stable/10/sys/cam/cam_ccb.h Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/cam_ccb.h Tue Jan 7 01:51:48 2014 (r260387) @@ -104,7 +104,9 @@ typedef enum { CAM_SEND_SENSE = 0x08000000,/* Send sense data with status */ CAM_TERM_IO = 0x10000000,/* Terminate I/O Message sup. */ CAM_DISCONNECT = 0x20000000,/* Disconnects are mandatory */ - CAM_SEND_STATUS = 0x40000000 /* Send status after data phase */ + CAM_SEND_STATUS = 0x40000000,/* Send status after data phase */ + + CAM_UNLOCKED = 0x80000000 /* Call callback without lock. */ } ccb_flags; typedef enum { @@ -151,6 +153,9 @@ typedef enum { /* Device statistics (error counts, etc.) */ XPT_DEV_ADVINFO = 0x0e, /* Get/Set Device advanced information */ + XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB + | XPT_FC_XPT_ONLY, + /* Asynchronous event */ /* SCSI Control Functions: 0x10->0x1F */ XPT_ABORT = 0x10, /* Abort the specified CCB */ @@ -1154,6 +1159,16 @@ struct ccb_dev_advinfo { }; /* + * CCB for sending async events + */ +struct ccb_async { + struct ccb_hdr ccb_h; + uint32_t async_code; + off_t async_arg_size; + void *async_arg_ptr; +}; + +/* * Union of all CCB types for kernel space allocation. This union should * never be used for manipulating CCBs - its only use is for the allocation * and deallocation of raw CCB space and is the return type of xpt_ccb_alloc @@ -1192,6 +1207,7 @@ union ccb { struct ccb_debug cdbg; struct ccb_ataio ataio; struct ccb_dev_advinfo cdai; + struct ccb_async casync; }; __BEGIN_DECLS Modified: stable/10/sys/cam/cam_periph.c ============================================================================== --- stable/10/sys/cam/cam_periph.c Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/cam_periph.c Tue Jan 7 01:51:48 2014 (r260387) @@ -196,12 +196,12 @@ cam_periph_alloc(periph_ctor_t *periph_c path_id = xpt_path_path_id(path); target_id = xpt_path_target_id(path); lun_id = xpt_path_lun_id(path); - cam_init_pinfo(&periph->pinfo); periph->periph_start = periph_start; periph->periph_dtor = periph_dtor; periph->periph_oninval = periph_oninvalidate; periph->type = type; periph->periph_name = name; + periph->scheduled_priority = CAM_PRIORITY_NONE; periph->immediate_priority = CAM_PRIORITY_NONE; periph->refcount = 1; /* Dropped by invalidation. */ periph->sim = sim; @@ -298,7 +298,7 @@ cam_periph_find(struct cam_path *path, c TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) { if (xpt_path_comp(periph->path, path) == 0) { xpt_unlock_buses(); - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); return(periph); } } @@ -379,7 +379,7 @@ void cam_periph_release_locked_buses(struct cam_periph *periph) { - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); KASSERT(periph->refcount >= 1, ("periph->refcount >= 1")); if (--periph->refcount == 0) camperiphfree(periph); @@ -400,16 +400,16 @@ cam_periph_release_locked(struct cam_per void cam_periph_release(struct cam_periph *periph) { - struct cam_sim *sim; + struct mtx *mtx; if (periph == NULL) return; - sim = periph->sim; - mtx_assert(sim->mtx, MA_NOTOWNED); - mtx_lock(sim->mtx); + cam_periph_assert(periph, MA_NOTOWNED); + mtx = cam_periph_mtx(periph); + mtx_lock(mtx); cam_periph_release_locked(periph); - mtx_unlock(sim->mtx); + mtx_unlock(mtx); } int @@ -427,10 +427,10 @@ cam_periph_hold(struct cam_periph *perip if (cam_periph_acquire(periph) != CAM_REQ_CMP) return (ENXIO); - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { periph->flags |= CAM_PERIPH_LOCK_WANTED; - if ((error = mtx_sleep(periph, periph->sim->mtx, priority, + if ((error = cam_periph_sleep(periph, periph, priority, "caplck", 0)) != 0) { cam_periph_release_locked(periph); return (error); @@ -449,7 +449,7 @@ void cam_periph_unhold(struct cam_periph *periph) { - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); periph->flags &= ~CAM_PERIPH_LOCKED; if ((periph->flags & CAM_PERIPH_LOCK_WANTED) != 0) { @@ -577,7 +577,7 @@ void cam_periph_invalidate(struct cam_periph *periph) { - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); /* * We only call this routine the first time a peripheral is * invalidated. @@ -600,7 +600,9 @@ camperiphfree(struct cam_periph *periph) { struct periph_driver **p_drv; - mtx_assert(periph->sim->mtx, MA_OWNED); + cam_periph_assert(periph, MA_OWNED); + KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating", + periph->periph_name, periph->unit_number)); for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0) break; @@ -947,40 +949,14 @@ cam_periph_unmapmem(union ccb *ccb, stru PRELE(curproc); } -union ccb * -cam_periph_getccb(struct cam_periph *periph, u_int32_t priority) -{ - struct ccb_hdr *ccb_h; - - mtx_assert(periph->sim->mtx, MA_OWNED); - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdgetccb\n")); - - while (SLIST_FIRST(&periph->ccb_list) == NULL) { - if (periph->immediate_priority > priority) - periph->immediate_priority = priority; - xpt_schedule(periph, priority); - if ((SLIST_FIRST(&periph->ccb_list) != NULL) - && (SLIST_FIRST(&periph->ccb_list)->pinfo.priority == priority)) - break; - mtx_assert(periph->sim->mtx, MA_OWNED); - mtx_sleep(&periph->ccb_list, periph->sim->mtx, PRIBIO, "cgticb", - 0); - } - - ccb_h = SLIST_FIRST(&periph->ccb_list); - SLIST_REMOVE_HEAD(&periph->ccb_list, periph_links.sle); - return ((union ccb *)ccb_h); -} - void cam_periph_ccbwait(union ccb *ccb) { - struct cam_sim *sim; - sim = xpt_path_sim(ccb->ccb_h.path); if ((ccb->ccb_h.pinfo.index != CAM_UNQUEUED_INDEX) || ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)) - mtx_sleep(&ccb->ccb_h.cbfcnp, sim->mtx, PRIBIO, "cbwait", 0); + xpt_path_sleep(ccb->ccb_h.path, &ccb->ccb_h.cbfcnp, PRIBIO, + "cbwait", 0); } int @@ -1045,6 +1021,14 @@ cam_periph_ioctl(struct cam_periph *peri return(error); } +static void +cam_periph_done(struct cam_periph *periph, union ccb *done_ccb) +{ + + /* Caller will release the CCB */ + wakeup(&done_ccb->ccb_h.cbfcnp); +} + int cam_periph_runccb(union ccb *ccb, int (*error_routine)(union ccb *ccb, @@ -1053,12 +1037,9 @@ cam_periph_runccb(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, struct devstat *ds) { - struct cam_sim *sim; int error; - error = 0; - sim = xpt_path_sim(ccb->ccb_h.path); - mtx_assert(sim->mtx, MA_OWNED); + xpt_path_assert(ccb->ccb_h.path, MA_OWNED); /* * If the user has supplied a stats structure, and if we understand @@ -1068,6 +1049,7 @@ cam_periph_runccb(union ccb *ccb, ccb->ccb_h.func_code == XPT_ATA_IO)) devstat_start_transaction(ds, NULL); + ccb->ccb_h.cbfcnp = cam_periph_done; xpt_action(ccb); do { @@ -1786,9 +1768,11 @@ cam_periph_error(union ccb *ccb, cam_fla scan_ccb->ccb_h.func_code = XPT_SCAN_TGT; scan_ccb->crcn.flags = 0; xpt_rescan(scan_ccb); - } else + } else { xpt_print(newpath, "Can't allocate CCB to rescan target\n"); + xpt_free_path(newpath); + } } } Modified: stable/10/sys/cam/cam_periph.h ============================================================================== --- stable/10/sys/cam/cam_periph.h Tue Jan 7 01:40:49 2014 (r260386) +++ stable/10/sys/cam/cam_periph.h Tue Jan 7 01:51:48 2014 (r260387) @@ -35,6 +35,7 @@ #include #ifdef _KERNEL +#include #include @@ -103,7 +104,6 @@ typedef cam_status periph_ctor_t (struct typedef void periph_oninv_t (struct cam_periph *periph); typedef void periph_dtor_t (struct cam_periph *periph); struct cam_periph { - cam_pinfo pinfo; periph_start_t *periph_start; periph_oninv_t *periph_oninval; periph_dtor_t *periph_dtor; @@ -120,15 +120,20 @@ struct cam_periph { #define CAM_PERIPH_INVALID 0x08 #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 +#define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 - u_int32_t immediate_priority; + uint32_t scheduled_priority; + uint32_t immediate_priority; + int periph_allocating; + int periph_allocated; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ SLIST_ENTRY(cam_periph) periph_links; TAILQ_ENTRY(cam_periph) unit_links; ac_callback_t *deferred_callback; ac_code deferred_ac; + struct task periph_run_task; }; #define CAM_PERIPH_MAXMAPS 2 @@ -185,30 +190,26 @@ void cam_periph_freeze_after_event(stru int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb); -static __inline void -cam_periph_lock(struct cam_periph *periph) +static __inline struct mtx * +cam_periph_mtx(struct cam_periph *periph) { - mtx_lock(periph->sim->mtx); + return (xpt_path_mtx(periph->path)); } -static __inline void -cam_periph_unlock(struct cam_periph *periph) -{ - mtx_unlock(periph->sim->mtx); -} +#define cam_periph_owned(periph) \ + mtx_owned(xpt_path_mtx((periph)->path)) -static __inline int -cam_periph_owned(struct cam_periph *periph) -{ - return (mtx_owned(periph->sim->mtx)); -} +#define cam_periph_lock(periph) \ + mtx_lock(xpt_path_mtx((periph)->path)) -static __inline int -cam_periph_sleep(struct cam_periph *periph, void *chan, int priority, - const char *wmesg, int timo) -{ - return (msleep(chan, periph->sim->mtx, priority, wmesg, timo)); -} +#define cam_periph_unlock(periph) \ + mtx_unlock(xpt_path_mtx((periph)->path)) + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 18:32:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C89EE28E; Tue, 7 Jan 2014 18:32:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B2926120E; Tue, 7 Jan 2014 18:32:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07IWWIX035774; Tue, 7 Jan 2014 18:32:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07IWVgt035768; Tue, 7 Jan 2014 18:32:32 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401071832.s07IWVgt035768@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 7 Jan 2014 18:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260395 - in stable/10/contrib/gcc: . config X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 18:32:32 -0000 Author: pfg Date: Tue Jan 7 18:32:31 2014 New Revision: 260395 URL: http://svnweb.freebsd.org/changeset/base/260395 Log: MFC r259841 gcc: Add ability to generate DWARF pubtypes section if DEBUG_PUBTYPES_SECTION is defined. Obtained from: gcc 4.3 (rev. 118826; GPLv2) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/config/darwin.c stable/10/contrib/gcc/config/darwin.h stable/10/contrib/gcc/dwarf2out.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Tue Jan 7 15:59:33 2014 (r260394) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Tue Jan 7 18:32:31 2014 (r260395) @@ -555,6 +555,37 @@ (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. +2006-11-14 Caroline Tice (r118826) + + * dwarf2out.c (debug_pubtypes_section): New static global variable. + (pubname_entry): Add DEF_VEC_O and DEF_VEC_ALLOC_O statements for + this type. + (pubname_table): Redefine as a vector. + (pubtype_table): New static global variable, defined as a vector. + (pubname_table_allocated): Remove static global variable. + (pubname_table_in_use): Remove static global variable. + (PUBNAME_TABLE_INCREMENT): Remove constant. + (size_of_pubnames): Add parameter to deal with either pubnames or + pubtypes, and change code to deal with table being a vector. + (add_pubname): Change to deal with table being a vector. + (add_pubtype): New function. + (output_pubnames): Add parameter to deal with either pubnames or + pubtypes, and change code to deal with table being a vector. + (gen_array_type_die): Add call to add_pubtype. + (gen_enumeration_type_die): Add call to add_pubtype. + (gen_struct_or_union_type_die): Add call to add_pubtype. + (gen_subroutine_type_die): Add call to add_pubtype. + (gen_typedef_die): Add call to add_pubtype. + (dwarf2out_init): Add code to initialize pubname_table and + pubtype_table vectors; also initialize debug_pubtypes_section. + (prune_unused_types): Change to deal with pubnames being a vector. + (dwarf2out_finish): Change to deal with pubnames being a vector; add + pubnames table to call to output_pubnames; Add code to output pubtypes + table if DEBUG_PUBTYPES_SECTION is defined. + * config/darwin.c (darwin_file_start): Add DEBUG_PUBTYPES_SECTION to + debugnames. + * config/darwin.h (DEBUG_PUBTYPES_SECTION): Define new global variable. + 2006-11-07 Eric Christopher (r118576) * libgcc2.c (__bswapdi2): Rename from bswapDI2. Modified: stable/10/contrib/gcc/config/darwin.c ============================================================================== --- stable/10/contrib/gcc/config/darwin.c Tue Jan 7 15:59:33 2014 (r260394) +++ stable/10/contrib/gcc/config/darwin.c Tue Jan 7 18:32:31 2014 (r260395) @@ -1517,6 +1517,7 @@ darwin_file_start (void) DEBUG_LINE_SECTION, DEBUG_LOC_SECTION, DEBUG_PUBNAMES_SECTION, + DEBUG_PUBTYPES_SECTION, DEBUG_STR_SECTION, DEBUG_RANGES_SECTION }; Modified: stable/10/contrib/gcc/config/darwin.h ============================================================================== --- stable/10/contrib/gcc/config/darwin.h Tue Jan 7 15:59:33 2014 (r260394) +++ stable/10/contrib/gcc/config/darwin.h Tue Jan 7 18:32:31 2014 (r260395) @@ -401,6 +401,7 @@ extern GTY(()) int darwin_ms_struct; #define DEBUG_LINE_SECTION "__DWARF,__debug_line,regular,debug" #define DEBUG_LOC_SECTION "__DWARF,__debug_loc,regular,debug" #define DEBUG_PUBNAMES_SECTION "__DWARF,__debug_pubnames,regular,debug" +#define DEBUG_PUBTYPES_SECTION "__DWARF,__debug_pubtypes,regular,debug" #define DEBUG_STR_SECTION "__DWARF,__debug_str,regular,debug" #define DEBUG_RANGES_SECTION "__DWARF,__debug_ranges,regular,debug" Modified: stable/10/contrib/gcc/dwarf2out.c ============================================================================== --- stable/10/contrib/gcc/dwarf2out.c Tue Jan 7 15:59:33 2014 (r260394) +++ stable/10/contrib/gcc/dwarf2out.c Tue Jan 7 18:32:31 2014 (r260395) @@ -156,6 +156,7 @@ static GTY(()) section *debug_macinfo_se static GTY(()) section *debug_line_section; static GTY(()) section *debug_loc_section; static GTY(()) section *debug_pubnames_section; +static GTY(()) section *debug_pubtypes_section; static GTY(()) section *debug_str_section; static GTY(()) section *debug_ranges_section; static GTY(()) section *debug_frame_section; @@ -3759,6 +3760,9 @@ typedef struct pubname_struct GTY(()) } pubname_entry; +DEF_VEC_O(pubname_entry); +DEF_VEC_ALLOC_O(pubname_entry, gc); + struct dw_ranges_struct GTY(()) { int block_num; @@ -3940,17 +3944,11 @@ static GTY(()) unsigned separate_line_in /* A pointer to the base of a table that contains a list of publicly accessible names. */ -static GTY ((length ("pubname_table_allocated"))) pubname_ref pubname_table; - -/* Number of elements currently allocated for pubname_table. */ -static GTY(()) unsigned pubname_table_allocated; - -/* Number of elements in pubname_table currently in use. */ -static GTY(()) unsigned pubname_table_in_use; +static GTY (()) VEC (pubname_entry, gc) * pubname_table; -/* Size (in elements) of increments by which we may expand the - pubname_table. */ -#define PUBNAME_TABLE_INCREMENT 64 +/* A pointer to the base of a table that contains a list of publicly + accessible types. */ +static GTY (()) VEC (pubname_entry, gc) * pubtype_table; /* Array of dies for which we should generate .debug_arange info. */ static GTY((length ("arange_table_allocated"))) dw_die_ref *arange_table; @@ -4115,7 +4113,7 @@ static void calc_die_sizes (dw_die_ref); static void mark_dies (dw_die_ref); static void unmark_dies (dw_die_ref); static void unmark_all_dies (dw_die_ref); -static unsigned long size_of_pubnames (void); +static unsigned long size_of_pubnames (VEC (pubname_entry,gc) *); static unsigned long size_of_aranges (void); static enum dwarf_form value_format (dw_attr_ref); static void output_value_format (dw_attr_ref); @@ -4126,7 +4124,8 @@ static void output_compilation_unit_head static void output_comp_unit (dw_die_ref, int); static const char *dwarf2_name (tree, int); static void add_pubname (tree, dw_die_ref); -static void output_pubnames (void); +static void add_pubtype (tree, dw_die_ref); +static void output_pubnames (VEC (pubname_entry,gc) *); static void add_arange (tree, dw_die_ref); static void output_aranges (void); static unsigned int add_ranges (tree); @@ -6750,21 +6749,22 @@ unmark_all_dies (dw_die_ref die) unmark_all_dies (AT_ref (a)); } -/* Return the size of the .debug_pubnames table generated for the - compilation unit. */ +/* Return the size of the .debug_pubnames or .debug_pubtypes table + generated for the compilation unit. */ static unsigned long -size_of_pubnames (void) +size_of_pubnames (VEC (pubname_entry, gc) * names) { unsigned long size; unsigned i; + pubname_ref p; size = DWARF_PUBNAMES_HEADER_SIZE; - for (i = 0; i < pubname_table_in_use; i++) - { - pubname_ref p = &pubname_table[i]; - size += DWARF_OFFSET_SIZE + strlen (p->name) + 1; - } + for (i = 0; VEC_iterate (pubname_entry, names, i, p); i++) + if (names != pubtype_table + || p->die->die_offset != 0 + || !flag_eliminate_unused_debug_types) + size += strlen (p->name) + DWARF_OFFSET_SIZE + 1; size += DWARF_OFFSET_SIZE; return size; @@ -7332,41 +7332,73 @@ dwarf2_name (tree decl, int scope) static void add_pubname (tree decl, dw_die_ref die) { - pubname_ref p; + pubname_entry e; if (! TREE_PUBLIC (decl)) return; - if (pubname_table_in_use == pubname_table_allocated) + e.die = die; + e.name = xstrdup (dwarf2_name (decl, 1)); + VEC_safe_push (pubname_entry, gc, pubname_table, &e); +} + +/* Add a new entry to .debug_pubtypes if appropriate. */ + +static void +add_pubtype (tree decl, dw_die_ref die) +{ + pubname_entry e; + + e.name = NULL; + if ((TREE_PUBLIC (decl) + || die->die_parent == comp_unit_die) + && (die->die_tag == DW_TAG_typedef || COMPLETE_TYPE_P (decl))) { - pubname_table_allocated += PUBNAME_TABLE_INCREMENT; - pubname_table - = ggc_realloc (pubname_table, - (pubname_table_allocated * sizeof (pubname_entry))); - memset (pubname_table + pubname_table_in_use, 0, - PUBNAME_TABLE_INCREMENT * sizeof (pubname_entry)); - } + e.die = die; + if (TYPE_P (decl)) + { + if (TYPE_NAME (decl)) + { + if (TREE_CODE (TYPE_NAME (decl)) == IDENTIFIER_NODE) + e.name = xstrdup ((const char *) IDENTIFIER_POINTER + (TYPE_NAME (decl))); + else if (TREE_CODE (TYPE_NAME (decl)) == TYPE_DECL + && DECL_NAME (TYPE_NAME (decl))) + e.name = xstrdup ((const char *) IDENTIFIER_POINTER + (DECL_NAME (TYPE_NAME (decl)))); + else + e.name = xstrdup ((const char *) get_AT_string (die, DW_AT_name)); + } + } + else + e.name = xstrdup (dwarf2_name (decl, 1)); - p = &pubname_table[pubname_table_in_use++]; - p->die = die; - p->name = xstrdup (dwarf2_name (decl, 1)); + /* If we don't have a name for the type, there's no point in adding + it to the table. */ + if (e.name && e.name[0] != '\0') + VEC_safe_push (pubname_entry, gc, pubtype_table, &e); + } } /* Output the public names table used to speed up access to externally - visible names. For now, only generate entries for externally - visible procedures. */ + visible names; or the public types table used to find type definitions. */ static void -output_pubnames (void) +output_pubnames (VEC (pubname_entry, gc) * names) { unsigned i; - unsigned long pubnames_length = size_of_pubnames (); + unsigned long pubnames_length = size_of_pubnames (names); + pubname_ref pub; if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) dw2_asm_output_data (4, 0xffffffff, "Initial length escape value indicating 64-bit DWARF extension"); - dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, - "Length of Public Names Info"); + if (names == pubname_table) + dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, + "Length of Public Names Info"); + else + dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length, + "Length of Public Type Names Info"); dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version"); dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label, debug_info_section, @@ -7374,17 +7406,21 @@ output_pubnames (void) dw2_asm_output_data (DWARF_OFFSET_SIZE, next_die_offset, "Compilation Unit Length"); - for (i = 0; i < pubname_table_in_use; i++) + for (i = 0; VEC_iterate (pubname_entry, names, i, pub); i++) { - pubname_ref pub = &pubname_table[i]; - - /* We shouldn't see pubnames for DIEs outside of the main CU. */ - gcc_assert (pub->die->die_mark); + /* We shouldn't see pubnames for DIEs outside of the main CU. */ + if (names == pubname_table) + gcc_assert (pub->die->die_mark); - dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset, - "DIE offset"); + if (names != pubtype_table + || pub->die->die_offset != 0 + || !flag_eliminate_unused_debug_types) + { + dw2_asm_output_data (DWARF_OFFSET_SIZE, pub->die->die_offset, + "DIE offset"); - dw2_asm_output_nstring (pub->name, -1, "external name"); + dw2_asm_output_nstring (pub->name, -1, "external name"); + } } dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL); @@ -11298,6 +11334,9 @@ gen_array_type_die (tree type, dw_die_re #endif add_type_attribute (array_die, element_type, 0, 0, context_die); + + if (get_AT (array_die, DW_AT_name)) + add_pubtype (type, array_die); } #if 0 @@ -11433,6 +11472,9 @@ gen_enumeration_type_die (tree type, dw_ else add_AT_flag (type_die, DW_AT_declaration, 1); + if (get_AT (type_die, DW_AT_name)) + add_pubtype (type, type_die); + return type_die; } @@ -12553,6 +12595,9 @@ gen_struct_or_union_type_die (tree type, && ! decl_function_context (TYPE_STUB_DECL (type))) VEC_safe_push (tree, gc, incomplete_types, type); } + + if (get_AT (type_die, DW_AT_name)) + add_pubtype (type, type_die); } /* Generate a DIE for a subroutine _type_. */ @@ -12569,6 +12614,9 @@ gen_subroutine_type_die (tree type, dw_d add_prototyped_attribute (subr_die, type); add_type_attribute (subr_die, return_type, 0, 0, context_die); gen_formal_types_die (type, subr_die); + + if (get_AT (subr_die, DW_AT_name)) + add_pubtype (type, subr_die); } /* Generate a DIE for a type definition. */ @@ -12608,6 +12656,9 @@ gen_typedef_die (tree decl, dw_die_ref c if (DECL_ABSTRACT (decl)) equate_decl_number_to_die (decl, type_die); + + if (get_AT (type_die, DW_AT_name)) + add_pubtype (decl, type_die); } /* Generate a type description DIE. */ @@ -13932,6 +13983,10 @@ dwarf2out_init (const char *filename ATT /* Zero-th entry is allocated, but unused. */ line_info_table_in_use = 1; + /* Allocate the pubtypes and pubnames vectors. */ + pubname_table = VEC_alloc (pubname_entry, gc, 32); + pubtype_table = VEC_alloc (pubname_entry, gc, 32); + /* Generate the initial DIE for the .debug section. Note that the (string) value given in the DW_AT_name attribute of the DW_TAG_compile_unit DIE will (typically) be a relative pathname and that this pathname should be @@ -13958,6 +14013,10 @@ dwarf2out_init (const char *filename ATT SECTION_DEBUG, NULL); debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION, SECTION_DEBUG, NULL); +#ifdef DEBUG_PUBTYPES_SECTION + debug_pubtypes_section = get_section (DEBUG_PUBTYPES_SECTION, + SECTION_DEBUG, NULL); +#endif debug_str_section = get_section (DEBUG_STR_SECTION, DEBUG_STR_SECTION_FLAGS, NULL); debug_ranges_section = get_section (DEBUG_RANGES_SECTION, @@ -14240,6 +14299,7 @@ prune_unused_types (void) { unsigned int i; limbo_die_node *node; + pubname_ref pub; #if ENABLE_ASSERT_CHECKING /* All the marks should already be clear. */ @@ -14255,8 +14315,8 @@ prune_unused_types (void) /* Also set the mark on nodes referenced from the pubname_table or arange_table. */ - for (i = 0; i < pubname_table_in_use; i++) - prune_unused_types_mark (pubname_table[i].die, 1); + for (i = 0; VEC_iterate (pubname_entry, pubname_table, i, pub); i++) + prune_unused_types_mark (pub->die, 1); for (i = 0; i < arange_table_in_use; i++) prune_unused_types_mark (arange_table[i], 1); @@ -14437,12 +14497,21 @@ dwarf2out_finish (const char *filename) output_abbrev_section (); /* Output public names table if necessary. */ - if (pubname_table_in_use) + if (!VEC_empty (pubname_entry, pubname_table)) { switch_to_section (debug_pubnames_section); - output_pubnames (); + output_pubnames (pubname_table); } +#ifdef DEBUG_PUBTYPES_SECTION + /* Output public types table if necessary. */ + if (!VEC_empty (pubname_entry, pubtype_table)) + { + switch_to_section (debug_pubtypes_section); + output_pubnames (pubtype_table); + } +#endif + /* Output the address range information. We only put functions in the arange table, so don't write it out if we don't have any. */ if (fde_table_in_use) From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 19:28:11 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50F6CFD3; Tue, 7 Jan 2014 19:28:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3C37815E1; Tue, 7 Jan 2014 19:28:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07JSBvP056103; Tue, 7 Jan 2014 19:28:11 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07JSB2s056102; Tue, 7 Jan 2014 19:28:11 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201401071928.s07JSB2s056102@svn.freebsd.org> From: Mateusz Guzik Date: Tue, 7 Jan 2014 19:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260400 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 19:28:11 -0000 Author: mjg Date: Tue Jan 7 19:28:10 2014 New Revision: 260400 URL: http://svnweb.freebsd.org/changeset/base/260400 Log: MFC r260232: Don't check for fd limits in fdgrowtable_exp. Callers do that already and additional check races with process decreasing limits and can result in not growing the table at all, which is currently not handled. Modified: stable/10/sys/kern/kern_descrip.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Tue Jan 7 19:02:08 2014 (r260399) +++ stable/10/sys/kern/kern_descrip.c Tue Jan 7 19:28:10 2014 (r260400) @@ -1482,18 +1482,13 @@ filecaps_validate(const struct filecaps static void fdgrowtable_exp(struct filedesc *fdp, int nfd) { - int nfd1, maxfd; + int nfd1; FILEDESC_XLOCK_ASSERT(fdp); nfd1 = fdp->fd_nfiles * 2; if (nfd1 < nfd) nfd1 = nfd; - maxfd = getmaxfd(curproc); - if (maxfd < nfd1) - nfd1 = maxfd; - KASSERT(nfd <= nfd1, - ("too low nfd1 %d %d %d %d", nfd, fdp->fd_nfiles, maxfd, nfd1)); fdgrowtable(fdp, nfd1); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 19:46:18 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 780099AB; Tue, 7 Jan 2014 19:46:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 631F5173C; Tue, 7 Jan 2014 19:46:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07JkIO9063617; Tue, 7 Jan 2014 19:46:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07JkI6S063616; Tue, 7 Jan 2014 19:46:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401071946.s07JkI6S063616@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 7 Jan 2014 19:46:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260402 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 19:46:18 -0000 Author: pjd Date: Tue Jan 7 19:46:17 2014 New Revision: 260402 URL: http://svnweb.freebsd.org/changeset/base/260402 Log: MFC r260290: Bring back the old size of the kinfo_file structure to preserve ABI. Keep only one uint64_t spare for further cap_rights_t expension. Add a comment clarifying that if the size of this structure changes, a new sysctl MIB has to be allocate for it and the old structure has to be returned by the old sysctl MIB. Requested by: re Modified: stable/10/sys/sys/user.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/user.h ============================================================================== --- stable/10/sys/sys/user.h Tue Jan 7 19:33:17 2014 (r260401) +++ stable/10/sys/sys/user.h Tue Jan 7 19:46:17 2014 (r260402) @@ -320,7 +320,13 @@ struct kinfo_ofile { }; #if defined(__amd64__) || defined(__i386__) -#define KINFO_FILE_SIZE 1424 +/* + * This size should never be changed. If you really need to, you must provide + * backward ABI compatibility by allocating a new sysctl MIB that will return + * the new structure. The current structure has to be returned by the current + * sysctl MIB. See how it is done for the kinfo_ofile structure. + */ +#define KINFO_FILE_SIZE 1392 #endif struct kinfo_file { @@ -391,8 +397,7 @@ struct kinfo_file { uint16_t kf_pad1; /* Round to 32 bit alignment. */ int _kf_ispare0; /* Space for more stuff. */ cap_rights_t kf_cap_rights; /* Capability rights. */ - uint64_t _kf_cap_spare[3]; /* Space for future cap_rights_t. */ - int _kf_ispare[4]; /* Space for more stuff. */ + uint64_t _kf_cap_spare; /* Space for future cap_rights_t. */ /* Truncated before copyout in sysctl */ char kf_path[PATH_MAX]; /* Path to file, if any. */ }; From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 20:04:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8527221C; Tue, 7 Jan 2014 20:04:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 64D7718C1; Tue, 7 Jan 2014 20:04:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07K4gHv071625; Tue, 7 Jan 2014 20:04:42 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07K4fMq071619; Tue, 7 Jan 2014 20:04:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401072004.s07K4fMq071619@svn.freebsd.org> From: Xin LI Date: Tue, 7 Jan 2014 20:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260404 - stable/10/crypto/openssl/ssl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 20:04:42 -0000 Author: delphij Date: Tue Jan 7 20:04:41 2014 New Revision: 260404 URL: http://svnweb.freebsd.org/changeset/base/260404 Log: MFC r260403 (MFV r260399): Apply vendor commits: 197e0ea Fix for TLS record tampering bug. (CVE-2013-4353). 3462896 For DTLS we might need to retransmit messages from the previous session so keep a copy of write context in DTLS retransmission buffers instead of replacing it after sending CCS. (CVE-2013-6450). ca98926 When deciding whether to use TLS 1.2 PRF and record hash algorithms use the version number in the corresponding SSL_METHOD structure instead of the SSL structure. The SSL structure version is sometimes inaccurate. Note: OpenSSL 1.0.2 and later effectively do this already. (CVE-2013-6449). Security: CVE-2013-4353 Security: CVE-2013-6449 Security: CVE-2013-6450 Modified: stable/10/crypto/openssl/ssl/d1_both.c stable/10/crypto/openssl/ssl/s3_both.c stable/10/crypto/openssl/ssl/s3_lib.c stable/10/crypto/openssl/ssl/ssl_locl.h stable/10/crypto/openssl/ssl/t1_enc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/crypto/openssl/ssl/d1_both.c ============================================================================== --- stable/10/crypto/openssl/ssl/d1_both.c Tue Jan 7 19:58:45 2014 (r260403) +++ stable/10/crypto/openssl/ssl/d1_both.c Tue Jan 7 20:04:41 2014 (r260404) @@ -214,6 +214,12 @@ dtls1_hm_fragment_new(unsigned long frag static void dtls1_hm_fragment_free(hm_fragment *frag) { + + if (frag->msg_header.is_ccs) + { + EVP_CIPHER_CTX_free(frag->msg_header.saved_retransmit_state.enc_write_ctx); + EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash); + } if (frag->fragment) OPENSSL_free(frag->fragment); if (frag->reassembly) OPENSSL_free(frag->reassembly); OPENSSL_free(frag); Modified: stable/10/crypto/openssl/ssl/s3_both.c ============================================================================== --- stable/10/crypto/openssl/ssl/s3_both.c Tue Jan 7 19:58:45 2014 (r260403) +++ stable/10/crypto/openssl/ssl/s3_both.c Tue Jan 7 20:04:41 2014 (r260404) @@ -208,7 +208,11 @@ static void ssl3_take_mac(SSL *s) { const char *sender; int slen; - + /* If no new cipher setup return immediately: other functions will + * set the appropriate error. + */ + if (s->s3->tmp.new_cipher == NULL) + return; if (s->state & SSL_ST_CONNECT) { sender=s->method->ssl3_enc->server_finished_label; Modified: stable/10/crypto/openssl/ssl/s3_lib.c ============================================================================== --- stable/10/crypto/openssl/ssl/s3_lib.c Tue Jan 7 19:58:45 2014 (r260403) +++ stable/10/crypto/openssl/ssl/s3_lib.c Tue Jan 7 20:04:41 2014 (r260404) @@ -4274,7 +4274,7 @@ need to go to SSL_ST_ACCEPT. long ssl_get_algorithm2(SSL *s) { long alg2 = s->s3->tmp.new_cipher->algorithm2; - if (TLS1_get_version(s) >= TLS1_2_VERSION && + if (s->method->version == TLS1_2_VERSION && alg2 == (SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF)) return SSL_HANDSHAKE_MAC_SHA256 | TLS1_PRF_SHA256; return alg2; Modified: stable/10/crypto/openssl/ssl/ssl_locl.h ============================================================================== --- stable/10/crypto/openssl/ssl/ssl_locl.h Tue Jan 7 19:58:45 2014 (r260403) +++ stable/10/crypto/openssl/ssl/ssl_locl.h Tue Jan 7 20:04:41 2014 (r260404) @@ -621,6 +621,8 @@ extern SSL3_ENC_METHOD TLSv1_enc_data; extern SSL3_ENC_METHOD SSLv3_enc_data; extern SSL3_ENC_METHOD DTLSv1_enc_data; +#define SSL_IS_DTLS(s) (s->method->version == DTLS1_VERSION) + #define IMPLEMENT_tls_meth_func(version, func_name, s_accept, s_connect, \ s_get_meth) \ const SSL_METHOD *func_name(void) \ Modified: stable/10/crypto/openssl/ssl/t1_enc.c ============================================================================== --- stable/10/crypto/openssl/ssl/t1_enc.c Tue Jan 7 19:58:45 2014 (r260403) +++ stable/10/crypto/openssl/ssl/t1_enc.c Tue Jan 7 20:04:41 2014 (r260404) @@ -414,15 +414,20 @@ int tls1_change_cipher_state(SSL *s, int s->mac_flags |= SSL_MAC_FLAG_WRITE_MAC_STREAM; else s->mac_flags &= ~SSL_MAC_FLAG_WRITE_MAC_STREAM; - if (s->enc_write_ctx != NULL) + if (s->enc_write_ctx != NULL && !SSL_IS_DTLS(s)) reuse_dd = 1; - else if ((s->enc_write_ctx=OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL) + else if ((s->enc_write_ctx=EVP_CIPHER_CTX_new()) == NULL) goto err; - else - /* make sure it's intialized in case we exit later with an error */ - EVP_CIPHER_CTX_init(s->enc_write_ctx); dd= s->enc_write_ctx; - mac_ctx = ssl_replace_hash(&s->write_hash,NULL); + if (SSL_IS_DTLS(s)) + { + mac_ctx = EVP_MD_CTX_create(); + if (!mac_ctx) + goto err; + s->write_hash = mac_ctx; + } + else + mac_ctx = ssl_replace_hash(&s->write_hash,NULL); #ifndef OPENSSL_NO_COMP if (s->compress != NULL) { From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 21:23:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EA4F204; Tue, 7 Jan 2014 21:23:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E299E1FE1; Tue, 7 Jan 2014 21:23:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07LNgZu003375; Tue, 7 Jan 2014 21:23:42 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07LNg6g003372; Tue, 7 Jan 2014 21:23:42 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201401072123.s07LNg6g003372@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 7 Jan 2014 21:23:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260412 - stable/10/usr.sbin/bsnmpd/modules/snmp_hast X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 21:23:43 -0000 Author: trociny Date: Tue Jan 7 21:23:41 2014 New Revision: 260412 URL: http://svnweb.freebsd.org/changeset/base/260412 Log: MFC r260049: Add mibs for hastd(1) queue stats. Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt ============================================================================== --- stable/10/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Tue Jan 7 21:14:28 2014 (r260411) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt Tue Jan 7 21:23:41 2014 (r260412) @@ -60,6 +60,11 @@ begemotHast MODULE-IDENTITY REVISION "201307010000Z" DESCRIPTION "Added hastResourceWorkerPid." + REVISION "201312290000Z" + DESCRIPTION + "Added hastResourceLocalQueue, hastResourceSendQueue, + hastResourceRecvQueue, hastResourceDoneQueue, + hastResourceIdleQueue." ::= { begemot 220 } begemotHastObjects OBJECT IDENTIFIER ::= { begemotHast 1 } @@ -120,7 +125,12 @@ HastResourceEntry ::= SEQUENCE { hastResourceWriteErrors Counter64, hastResourceDeleteErrors Counter64, hastResourceFlushErrors Counter64, - hastResourceWorkerPid INTEGER + hastResourceWorkerPid INTEGER, + hastResourceLocalQueue UNSIGNED32, + hastResourceSendQueue UNSIGNED32, + hastResourceRecvQueue UNSIGNED32, + hastResourceDoneQueue UNSIGNED32, + hastResourceIdleQueue UNSIGNED32 } hastResourceIndex OBJECT-TYPE @@ -307,4 +317,46 @@ hastResourceWorkerPid OBJECT-TYPE "Worker process ID." ::= { hastResourceEntry 22 } +hastResourceLocalQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests to the local component." + ::= { hastResourceEntry 23 } + +hastResourceSendQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests to send to the remote + component." + ::= { hastResourceEntry 24 } + +hastResourceRecvQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of outstanding I/O requests waiting for response + from the remote component." + ::= { hastResourceEntry 25 } + +hastResourceDoneQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of processed I/O requests to return to the kernel." + ::= { hastResourceEntry 26 } + +hastResourceIdleQueue OBJECT-TYPE + SYNTAX UNSIGNED32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of request objects in the free bucket." + ::= { hastResourceEntry 27 } + END Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Tue Jan 7 21:14:28 2014 (r260411) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c Tue Jan 7 21:23:41 2014 (r260412) @@ -79,6 +79,11 @@ struct hast_snmp_resource { uint64_t delete_errors; uint64_t flush_errors; pid_t workerpid; + uint32_t local_queue; + uint32_t send_queue; + uint32_t recv_queue; + uint32_t done_queue; + uint32_t idle_queue; }; static TAILQ_HEAD(, hast_snmp_resource) resources = @@ -345,6 +350,16 @@ update_resources(void) res->flush_errors = nv_get_uint64(nvout, "stat_flush_error%u", i); res->workerpid = nv_get_int32(nvout, "workerpid%u", i); + res->local_queue = + nv_get_uint64(nvout, "local_queue_size%u", i); + res->send_queue = + nv_get_uint64(nvout, "send_queue_size%u", i); + res->recv_queue = + nv_get_uint64(nvout, "recv_queue_size%u", i); + res->done_queue = + nv_get_uint64(nvout, "done_queue_size%u", i); + res->idle_queue = + nv_get_uint64(nvout, "idle_queue_size%u", i); TAILQ_INSERT_TAIL(&resources, res, link); } nv_free(nvout); @@ -503,6 +518,21 @@ op_hastResourceTable(struct snmp_context case LEAF_hastResourceWorkerPid: value->v.integer = res->workerpid; break; + case LEAF_hastResourceLocalQueue: + value->v.uint32 = res->local_queue; + break; + case LEAF_hastResourceSendQueue: + value->v.uint32 = res->send_queue; + break; + case LEAF_hastResourceRecvQueue: + value->v.uint32 = res->recv_queue; + break; + case LEAF_hastResourceDoneQueue: + value->v.uint32 = res->done_queue; + break; + case LEAF_hastResourceIdleQueue: + value->v.uint32 = res->idle_queue; + break; default: ret = SNMP_ERR_RES_UNAVAIL; break; Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def ============================================================================== --- stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Tue Jan 7 21:14:28 2014 (r260411) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def Tue Jan 7 21:23:41 2014 (r260412) @@ -60,6 +60,11 @@ (20 hastResourceDeleteErrors COUNTER64 GET) (21 hastResourceFlushErrors COUNTER64 GET) (22 hastResourceWorkerPid INTEGER GET) + (23 hastResourceLocalQueue UNSIGNED32 GET) + (24 hastResourceSendQueue UNSIGNED32 GET) + (25 hastResourceRecvQueue UNSIGNED32 GET) + (26 hastResourceDoneQueue UNSIGNED32 GET) + (27 hastResourceIdleQueue UNSIGNED32 GET) ) ) ) From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 22:59:34 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECF1644A; Tue, 7 Jan 2014 22:59:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CCFA817B5; Tue, 7 Jan 2014 22:59:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07MxXku038772; Tue, 7 Jan 2014 22:59:33 GMT (envelope-from edavis@svn.freebsd.org) Received: (from edavis@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07MxX35038770; Tue, 7 Jan 2014 22:59:33 GMT (envelope-from edavis@svn.freebsd.org) Message-Id: <201401072259.s07MxX35038770@svn.freebsd.org> From: Eric Davis Date: Tue, 7 Jan 2014 22:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260416 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 22:59:34 -0000 Author: edavis Date: Tue Jan 7 22:59:33 2014 New Revision: 260416 URL: http://svnweb.freebsd.org/changeset/base/260416 Log: Merged r260415 from head. Approved by: davidch Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/ecore_hsi.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Tue Jan 7 22:26:20 2014 (r260415) +++ stable/10/sys/dev/bxe/bxe.c Tue Jan 7 22:59:33 2014 (r260416) @@ -34,7 +34,7 @@ #include __FBSDID("$FreeBSD$"); -#define BXE_DRIVER_VERSION "1.78.76" +#define BXE_DRIVER_VERSION "1.78.77" #include "bxe.h" #include "ecore_sp.h" @@ -5501,10 +5501,31 @@ bxe_tx_encap(struct bxe_fastpath *fp, st fp->eth_q_stats.tx_window_violation_std++; } - /* XXX I don't like this, change to double copy packet */ + /* lets try to defragment this mbuf */ + fp->eth_q_stats.mbuf_defrag_attempts++; - /* no sense trying to defrag again, just drop the frame */ - rc = ENODEV; + m0 = m_defrag(*m_head, M_DONTWAIT); + if (m0 == NULL) { + fp->eth_q_stats.mbuf_defrag_failures++; + /* Ugh, just drop the frame... :( */ + rc = ENOBUFS; + } else { + /* defrag successful, try mapping again */ + *m_head = m0; + error = bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag, + tx_buf->m_map, m0, + segs, &nsegs, BUS_DMA_NOWAIT); + if (error) { + fp->eth_q_stats.tx_dma_mapping_failure++; + /* No sense in trying to defrag/copy chain, drop it. :( */ + rc = error; + } + + /* if the chain is still too long then drop it */ + if (__predict_false(nsegs > 12)) { + rc = ENODEV; + } + } } bxe_tx_encap_continue: Modified: stable/10/sys/dev/bxe/ecore_hsi.h ============================================================================== --- stable/10/sys/dev/bxe/ecore_hsi.h Tue Jan 7 22:26:20 2014 (r260415) +++ stable/10/sys/dev/bxe/ecore_hsi.h Tue Jan 7 22:59:33 2014 (r260416) @@ -1305,6 +1305,13 @@ struct extended_dev_info_shared_cfg { #define EXTENDED_DEV_INFO_SHARED_CFG_SRIOV_SHOW_MENU 0x00000000 #define EXTENDED_DEV_INFO_SHARED_CFG_SRIOV_HIDE_MENU 0x00000200 + /* Overide PCIE revision ID when enabled the, + revision ID will set to B1=='0x11' */ + #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_MASK 0x00000400 + #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_SHIFT 10 + #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_DISABLED 0x00000000 + #define EXTENDED_DEV_INFO_SHARED_CFG_OVR_REV_ID_ENABLED 0x00000400 + /* Threshold in celcius for max continuous operation */ uint32_t temperature_report; /* 0x4014 */ #define EXTENDED_DEV_INFO_SHARED_CFG_TEMP_MCOT_MASK 0x0000007F From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 23:00:59 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 495E1725; Tue, 7 Jan 2014 23:00:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3568617FA; Tue, 7 Jan 2014 23:00:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07N0xEV040147; Tue, 7 Jan 2014 23:00:59 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07N0x2b040145; Tue, 7 Jan 2014 23:00:59 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201401072300.s07N0x2b040145@svn.freebsd.org> From: Peter Wemm Date: Tue, 7 Jan 2014 23:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260417 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 23:00:59 -0000 Author: peter Date: Tue Jan 7 23:00:58 2014 New Revision: 260417 URL: http://svnweb.freebsd.org/changeset/base/260417 Log: MFC r258821 - fix tcp simultaneous close PR: kern/99188 Modified: stable/10/sys/netinet/tcp_input.c Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Tue Jan 7 22:59:33 2014 (r260416) +++ stable/10/sys/netinet/tcp_input.c Tue Jan 7 23:00:58 2014 (r260417) @@ -2429,13 +2429,15 @@ tcp_do_segment(struct mbuf *m, struct tc hhook_run_tcp_est_in(tp, th, &to); if (SEQ_LEQ(th->th_ack, tp->snd_una)) { - if (tlen == 0 && tiwin == tp->snd_wnd) { + if (tlen == 0 && tiwin == tp->snd_wnd && + !(thflags & TH_FIN)) { TCPSTAT_INC(tcps_rcvdupack); /* * If we have outstanding data (other than * a window probe), this is a completely * duplicate ack (ie, window info didn't - * change), the ack is the biggest we've + * change and FIN isn't set), + * the ack is the biggest we've * seen and we've seen exactly our rexmt * threshhold of them, assume a packet * has been dropped and retransmit it. From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 23:50:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42DB1408; Tue, 7 Jan 2014 23:50:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2EB361D0E; Tue, 7 Jan 2014 23:50:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07No3MW064574; Tue, 7 Jan 2014 23:50:03 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07No2aa064570; Tue, 7 Jan 2014 23:50:02 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201401072350.s07No2aa064570@svn.freebsd.org> From: Michael Tuexen Date: Tue, 7 Jan 2014 23:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260426 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 23:50:03 -0000 Author: tuexen Date: Tue Jan 7 23:50:02 2014 New Revision: 260426 URL: http://svnweb.freebsd.org/changeset/base/260426 Log: MFC r259943: Address some warnings which showed up on the userland version. Modified: stable/10/sys/netinet/sctp_usrreq.c stable/10/sys/netinet/sctputil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/10/sys/netinet/sctp_usrreq.c Tue Jan 7 23:20:21 2014 (r260425) +++ stable/10/sys/netinet/sctp_usrreq.c Tue Jan 7 23:50:02 2014 (r260426) @@ -2788,7 +2788,7 @@ flags_out: if (stcb) { /* simply copy out the sockaddr_storage... */ - int len; + size_t len; len = *optsize; if (len > stcb->asoc.primary_destination->ro._l_addr.sa.sa_len) Modified: stable/10/sys/netinet/sctputil.c ============================================================================== --- stable/10/sys/netinet/sctputil.c Tue Jan 7 23:20:21 2014 (r260425) +++ stable/10/sys/netinet/sctputil.c Tue Jan 7 23:50:02 2014 (r260426) @@ -5868,8 +5868,8 @@ get_more_data: goto release; } if ((uio->uio_resid == 0) || - ((in_eeor_mode) && (copied_so_far >= max(so->so_rcv.sb_lowat, 1))) - ) { + ((in_eeor_mode) && + (copied_so_far >= (uint32_t) max(so->so_rcv.sb_lowat, 1)))) { goto release; } /* From owner-svn-src-stable-10@FreeBSD.ORG Tue Jan 7 23:51:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 62929671; Tue, 7 Jan 2014 23:51:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 34AED1D70; Tue, 7 Jan 2014 23:51:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s07NpgVN067351; Tue, 7 Jan 2014 23:51:42 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s07NpgsD067350; Tue, 7 Jan 2014 23:51:42 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201401072351.s07NpgsD067350@svn.freebsd.org> From: Michael Tuexen Date: Tue, 7 Jan 2014 23:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260428 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jan 2014 23:51:42 -0000 Author: tuexen Date: Tue Jan 7 23:51:41 2014 New Revision: 260428 URL: http://svnweb.freebsd.org/changeset/base/260428 Log: MFC r260257: Fix several bugs in sctp_bindx(): * Set errno to EAFNOSUPPORT if an address is provided which is neither AF_INET nor AF_INET6. * Don't modify the arguments. * Don't smash the stack when provided with a non-zero port. * Handle the case correctly where the first address provided is an IPv6 address. Modified: stable/10/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/10/lib/libc/net/sctp_sys_calls.c Tue Jan 7 23:50:15 2014 (r260427) +++ stable/10/lib/libc/net/sctp_sys_calls.c Tue Jan 7 23:51:41 2014 (r260428) @@ -233,19 +233,11 @@ sctp_bindx(int sd, struct sockaddr *addr break; default: /* Invalid address family specified. */ - errno = EINVAL; + errno = EAFNOSUPPORT; return (-1); } sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } - /* - * Now if there was a port mentioned, assure that the first address - * has that port to make sure it fails or succeeds correctly. - */ - if (sport) { - sin = (struct sockaddr_in *)sa; - sin->sin_port = sport; - } argsz = sizeof(struct sctp_getaddresses) + sizeof(struct sockaddr_storage); if ((gaddrs = (struct sctp_getaddresses *)malloc(argsz)) == NULL) { @@ -257,6 +249,23 @@ sctp_bindx(int sd, struct sockaddr *addr memset(gaddrs, 0, argsz); gaddrs->sget_assoc_id = 0; memcpy(gaddrs->addr, sa, sa->sa_len); + /* + * Now, if there was a port mentioned, assure that the first + * address has that port to make sure it fails or succeeds + * correctly. + */ + if ((i == 0) && (sport != 0)) { + switch (gaddrs->addr->sa_family) { + case AF_INET: + sin = (struct sockaddr_in *)gaddrs->addr; + sin->sin_port = sport; + break; + case AF_INET6: + sin6 = (struct sockaddr_in6 *)gaddrs->addr; + sin6->sin6_port = sport; + break; + } + } if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs, (socklen_t) argsz) != 0) { free(gaddrs); From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 8 02:19:40 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E38B5CA; Wed, 8 Jan 2014 02:19:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 799C51F10; Wed, 8 Jan 2014 02:19:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s082JevL022436; Wed, 8 Jan 2014 02:19:40 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s082JesG022435; Wed, 8 Jan 2014 02:19:40 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201401080219.s082JesG022435@svn.freebsd.org> From: Colin Percival Date: Wed, 8 Jan 2014 02:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260431 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jan 2014 02:19:40 -0000 Author: cperciva Date: Wed Jan 8 02:19:39 2014 New Revision: 260431 URL: http://svnweb.freebsd.org/changeset/base/260431 Log: MFC r258893, r258956: Add a new sysctl / loader tunable kern.panic_reboot_wait_time which defaults to PANIC_REBOOT_WAIT_TIME (a long-existing kernel config setting). Use this now-variable value in place of the defined constant to control how long the system waits after a panic before rebooting. Modified: stable/10/sys/kern/kern_shutdown.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_shutdown.c ============================================================================== --- stable/10/sys/kern/kern_shutdown.c Wed Jan 8 01:26:09 2014 (r260430) +++ stable/10/sys/kern/kern_shutdown.c Wed Jan 8 02:19:39 2014 (r260431) @@ -89,6 +89,11 @@ __FBSDID("$FreeBSD$"); #ifndef PANIC_REBOOT_WAIT_TIME #define PANIC_REBOOT_WAIT_TIME 15 /* default to 15 seconds */ #endif +static int panic_reboot_wait_time = PANIC_REBOOT_WAIT_TIME; +SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CTLFLAG_RW | CTLFLAG_TUN, + &panic_reboot_wait_time, 0, + "Seconds to wait before rebooting after a panic"); +TUNABLE_INT("kern.panic_reboot_wait_time", &panic_reboot_wait_time); /* * Note that stdarg.h and the ANSI style va_start macro is used for both @@ -485,12 +490,12 @@ shutdown_panic(void *junk, int howto) int loop; if (howto & RB_DUMP) { - if (PANIC_REBOOT_WAIT_TIME != 0) { - if (PANIC_REBOOT_WAIT_TIME != -1) { + if (panic_reboot_wait_time != 0) { + if (panic_reboot_wait_time != -1) { printf("Automatic reboot in %d seconds - " "press a key on the console to abort\n", - PANIC_REBOOT_WAIT_TIME); - for (loop = PANIC_REBOOT_WAIT_TIME * 10; + panic_reboot_wait_time); + for (loop = panic_reboot_wait_time * 10; loop > 0; --loop) { DELAY(1000 * 100); /* 1/10th second */ /* Did user type a key? */ From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 8 03:16:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C6023BA; Wed, 8 Jan 2014 03:16:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6812E1369; Wed, 8 Jan 2014 03:16:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s083GMM7046260; Wed, 8 Jan 2014 03:16:22 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s083GMfF046259; Wed, 8 Jan 2014 03:16:22 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201401080316.s083GMfF046259@svn.freebsd.org> From: Peter Wemm Date: Wed, 8 Jan 2014 03:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260434 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jan 2014 03:16:22 -0000 Author: peter Date: Wed Jan 8 03:16:21 2014 New Revision: 260434 URL: http://svnweb.freebsd.org/changeset/base/260434 Log: Revert MFC of r258821 - it was already handled by MFC of r239672. Pointy hat to: peter Modified: stable/10/sys/netinet/tcp_input.c Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Wed Jan 8 02:31:35 2014 (r260433) +++ stable/10/sys/netinet/tcp_input.c Wed Jan 8 03:16:21 2014 (r260434) @@ -2429,15 +2429,13 @@ tcp_do_segment(struct mbuf *m, struct tc hhook_run_tcp_est_in(tp, th, &to); if (SEQ_LEQ(th->th_ack, tp->snd_una)) { - if (tlen == 0 && tiwin == tp->snd_wnd && - !(thflags & TH_FIN)) { + if (tlen == 0 && tiwin == tp->snd_wnd) { TCPSTAT_INC(tcps_rcvdupack); /* * If we have outstanding data (other than * a window probe), this is a completely * duplicate ack (ie, window info didn't - * change and FIN isn't set), - * the ack is the biggest we've + * change), the ack is the biggest we've * seen and we've seen exactly our rexmt * threshhold of them, assume a packet * has been dropped and retransmit it. From owner-svn-src-stable-10@FreeBSD.ORG Wed Jan 8 19:33:17 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 412903D5; Wed, 8 Jan 2014 19:33:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2BCA819B8; Wed, 8 Jan 2014 19:33:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s08JXHTf031473; Wed, 8 Jan 2014 19:33:17 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s08JXG9d031470; Wed, 8 Jan 2014 19:33:16 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401081933.s08JXG9d031470@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 8 Jan 2014 19:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260455 - in stable/10/contrib/gcc: . config/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jan 2014 19:33:17 -0000 Author: pfg Date: Wed Jan 8 19:33:16 2014 New Revision: 260455 URL: http://svnweb.freebsd.org/changeset/base/260455 Log: MFC r259873: gcc: small enhancements for the arm support. fixes GCC-PR target/31152 Obtained from: gcc 4.3 (rev. r118461, 125973: GPLv2) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 stable/10/contrib/gcc/config/arm/arm.c stable/10/contrib/gcc/config/arm/arm.md Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/10/contrib/gcc/ChangeLog.gcc43 Wed Jan 8 18:16:40 2014 (r260454) +++ stable/10/contrib/gcc/ChangeLog.gcc43 Wed Jan 8 19:33:16 2014 (r260455) @@ -65,6 +65,12 @@ fvisibility-ms-compat. * c.opt (fvisibility-ms-compat): New. +2007-06-23 Richard Earnshaw (r125973) + + PR target/31152 + * arm.md (negscc): Match the correct operand for optimized LT0 test. + Remove optimization for GT. + 2007-06-05 Joerg Wunsch (r125346) PR preprocessor/23479 @@ -594,6 +600,14 @@ * config/i386/i386.md (bswapsi2): New. (bswapdi2): Ditto. +2006-11-03 Paul Brook (r118461) + + gcc/ + * config/arm/arm.c (arm_file_start): New function. + (TARGET_ASM_FILE_START): Define. + (arm_default_cpu): New variable. + (arm_override_options): Set arm_default_cpu. + 2006-10-31 Geoffrey Keating (r118360) * coverage.c (coverage_checksum_string): Update comment. Modified: stable/10/contrib/gcc/config/arm/arm.c ============================================================================== --- stable/10/contrib/gcc/config/arm/arm.c Wed Jan 8 18:16:40 2014 (r260454) +++ stable/10/contrib/gcc/config/arm/arm.c Wed Jan 8 19:33:16 2014 (r260455) @@ -154,6 +154,7 @@ static void arm_encode_section_info (tre #endif static void arm_file_end (void); +static void arm_file_start (void); #ifdef AOF_ASSEMBLER static void aof_globalize_label (FILE *, const char *); @@ -202,6 +203,9 @@ static bool arm_tls_symbol_p (rtx x); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE arm_attribute_table +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START arm_file_start + #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END arm_file_end @@ -390,6 +394,9 @@ rtx arm_compare_op0, arm_compare_op1; /* The processor for which instructions should be scheduled. */ enum processor_type arm_tune = arm_none; +/* The default processor used if not overriden by commandline. */ +static enum processor_type arm_default_cpu = arm_none; + /* Which floating point model to use. */ enum arm_fp_model arm_fp_model; @@ -1020,8 +1027,9 @@ arm_override_options (void) insn_flags = sel->flags; } sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); + arm_default_cpu = (enum processor_type) (sel - all_cores); if (arm_tune == arm_none) - arm_tune = (enum processor_type) (sel - all_cores); + arm_tune = arm_default_cpu; } /* The processor for which we should tune should now have been @@ -14458,6 +14466,105 @@ arm_asm_output_labelref (FILE *stream, c } static void +arm_file_start (void) +{ + int val; + + if (TARGET_BPABI) + { + const char *fpu_name; + if (arm_select[0].string) + asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_select[0].string); + else if (arm_select[1].string) + asm_fprintf (asm_out_file, "\t.arch %s\n", arm_select[1].string); + else + asm_fprintf (asm_out_file, "\t.cpu %s\n", + all_cores[arm_default_cpu].name); + + if (TARGET_SOFT_FLOAT) + { + if (TARGET_VFP) + fpu_name = "softvfp"; + else + fpu_name = "softfpa"; + } + else + { + switch (arm_fpu_arch) + { + case FPUTYPE_FPA: + fpu_name = "fpa"; + break; + case FPUTYPE_FPA_EMU2: + fpu_name = "fpe2"; + break; + case FPUTYPE_FPA_EMU3: + fpu_name = "fpe3"; + break; + case FPUTYPE_MAVERICK: + fpu_name = "maverick"; + break; + case FPUTYPE_VFP: + if (TARGET_HARD_FLOAT) + asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n"); + if (TARGET_HARD_FLOAT_ABI) + asm_fprintf (asm_out_file, "\t.eabi_attribute 28, 1\n"); + fpu_name = "vfp"; + break; + default: + abort(); + } + } + asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name); + + /* Some of these attributes only apply when the corresponding features + are used. However we don't have any easy way of figuring this out. + Conservatively record the setting that would have been used. */ + + /* Tag_ABI_PCS_wchar_t. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\n", + (int)WCHAR_TYPE_SIZE / BITS_PER_UNIT); + + /* Tag_ABI_FP_rounding. */ + if (flag_rounding_math) + asm_fprintf (asm_out_file, "\t.eabi_attribute 19, 1\n"); + if (!flag_unsafe_math_optimizations) + { + /* Tag_ABI_FP_denomal. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 20, 1\n"); + /* Tag_ABI_FP_exceptions. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 21, 1\n"); + } + /* Tag_ABI_FP_user_exceptions. */ + if (flag_signaling_nans) + asm_fprintf (asm_out_file, "\t.eabi_attribute 22, 1\n"); + /* Tag_ABI_FP_number_model. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 23, %d\n", + flag_finite_math_only ? 1 : 3); + + /* Tag_ABI_align8_needed. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 24, 1\n"); + /* Tag_ABI_align8_preserved. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 25, 1\n"); + /* Tag_ABI_enum_size. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 26, %d\n", + flag_short_enums ? 1 : 2); + + /* Tag_ABI_optimization_goals. */ + if (optimize_size) + val = 4; + else if (optimize >= 2) + val = 2; + else if (optimize) + val = 1; + else + val = 6; + asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val); + } + default_file_start(); +} + +static void arm_file_end (void) { int regno; Modified: stable/10/contrib/gcc/config/arm/arm.md ============================================================================== --- stable/10/contrib/gcc/config/arm/arm.md Wed Jan 8 18:16:40 2014 (r260454) +++ stable/10/contrib/gcc/config/arm/arm.md Wed Jan 8 19:33:16 2014 (r260455) @@ -8841,15 +8841,12 @@ (clobber (reg:CC CC_REGNUM))] "TARGET_ARM" "* - if (GET_CODE (operands[3]) == LT && operands[3] == const0_rtx) + if (GET_CODE (operands[3]) == LT && operands[2] == const0_rtx) return \"mov\\t%0, %1, asr #31\"; if (GET_CODE (operands[3]) == NE) return \"subs\\t%0, %1, %2\;mvnne\\t%0, #0\"; - if (GET_CODE (operands[3]) == GT) - return \"subs\\t%0, %1, %2\;mvnne\\t%0, %0, asr #31\"; - output_asm_insn (\"cmp\\t%1, %2\", operands); output_asm_insn (\"mov%D3\\t%0, #0\", operands); return \"mvn%d3\\t%0, #0\"; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 00:27:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C19A886; Thu, 9 Jan 2014 00:27:42 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F00CF1173; Thu, 9 Jan 2014 00:27:41 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id s090Re2g089416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 9 Jan 2014 04:27:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id s090RePl089415; Thu, 9 Jan 2014 04:27:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 9 Jan 2014 04:27:40 +0400 From: Gleb Smirnoff To: Eric Davis Subject: Re: svn commit: r260416 - stable/10/sys/dev/bxe Message-ID: <20140109002740.GM71033@FreeBSD.org> References: <201401072259.s07MxX35038770@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201401072259.s07MxX35038770@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 00:27:42 -0000 Eric, On Tue, Jan 07, 2014 at 10:59:33PM +0000, Eric Davis wrote: E> Author: edavis E> Date: Tue Jan 7 22:59:33 2014 E> New Revision: 260416 E> URL: http://svnweb.freebsd.org/changeset/base/260416 E> E> Log: E> Merged r260415 from head. E> E> Approved by: davidch We have policy in FreeBSD that minimum period between initial commit and MFC is at least 3 days. -- Totus tuus, Glebius. From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 00:56:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C6CEEFD; Thu, 9 Jan 2014 00:56:43 +0000 (UTC) Received: from mail-gw3-out.broadcom.com (mail-gw3-out.broadcom.com [216.31.210.64]) by mx1.freebsd.org (Postfix) with ESMTP id EEF091375; Thu, 9 Jan 2014 00:56:42 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.95,627,1384329600"; d="scan'208";a="8111639" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw3-out.broadcom.com with ESMTP; 08 Jan 2014 17:01:14 -0800 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Wed, 8 Jan 2014 16:56:35 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.1.438.0; Wed, 8 Jan 2014 16:56:35 -0800 Received: from localhost (dhcp-10-12-137-51.irv.broadcom.com [10.12.137.51]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id C50A1246A7; Wed, 8 Jan 2014 16:56:35 -0800 (PST) Date: Wed, 8 Jan 2014 16:56:35 -0800 From: Eric Davis To: Gleb Smirnoff Subject: Re: svn commit: r260416 - stable/10/sys/dev/bxe Message-ID: <20140109005635.GA8780@broadcom.com> References: <201401072259.s07MxX35038770@svn.freebsd.org> <20140109002740.GM71033@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <20140109002740.GM71033@FreeBSD.org> User-Agent: Mutt/1.5.21 (2012-12-30) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Eric Davis List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 00:56:43 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 09, 2014 at 04:27:40AM +0400, Gleb Smirnoff wrote: > Eric, >=20 > On Tue, Jan 07, 2014 at 10:59:33PM +0000, Eric Davis wrote: > E> Author: edavis > E> Date: Tue Jan 7 22:59:33 2014 > E> New Revision: 260416 > E> URL: http://svnweb.freebsd.org/changeset/base/260416 > E>=20 > E> Log: > E> Merged r260415 from head. > E> =20 > E> Approved by: davidch >=20 > We have policy in FreeBSD that minimum period between initial > commit and MFC is at least 3 days. >=20 > --=20 > Totus tuus, Glebius. Hi Gleb, Yes, I know that now after I've been told by multiple people. :-) Thanks, - e --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJSzfPDAAoJEPUt8GDsVYPdyD0IAIKkpe2kSq9+WcTYBLG8y8Ox bWa8718snJ1Zd4pY6YI6vZBlirLBEj3166XyT7FrNi2fnxoYj3eL5xDb54aj4k99 6eryk+Vh6bvnxjvwdB9WgqhSsi/78dpM46GDS1f29apRploqMpCpyd3xqIC9100Q PoJyKnhmAl3hS73FC+3J6BxxtTu+YA8iuWn9QOimZZogAWDCT8ayzU3kmJw6ew1Z 5LkrFkHighK6JAyJDjr/wEMh657HFsff9VvWoGOlUJPCuBTshh8SJ3PPZGPNDlK9 W2kJspUG2wb3wB7oD+b0KwWalnuvDs5mFijG46MkeCujzmeB+NaKClMgwuOxZDY= =bP8f -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 03:24:37 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3163D86D; Thu, 9 Jan 2014 03:24:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CCFA10E5; Thu, 9 Jan 2014 03:24:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s093Oa6t013685; Thu, 9 Jan 2014 03:24:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s093OaDQ013684; Thu, 9 Jan 2014 03:24:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201401090324.s093OaDQ013684@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 9 Jan 2014 03:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260464 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 03:24:37 -0000 Author: kib Date: Thu Jan 9 03:24:36 2014 New Revision: 260464 URL: http://svnweb.freebsd.org/changeset/base/260464 Log: MFC r260204: Assert that accounting for the pmap resident pages does not underflow. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Thu Jan 9 01:48:33 2014 (r260463) +++ stable/10/sys/amd64/amd64/pmap.c Thu Jan 9 03:24:36 2014 (r260464) @@ -608,6 +608,9 @@ pmap_resident_count_dec(pmap_t pmap, int { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT(pmap->pm_stats.resident_count >= count, + ("pmap %p resident count underflow %ld %d", pmap, + pmap->pm_stats.resident_count, count)); pmap->pm_stats.resident_count -= count; } From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 03:32:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F552C6B; Thu, 9 Jan 2014 03:32:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5F9D51171; Thu, 9 Jan 2014 03:32:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s093W4F9017208; Thu, 9 Jan 2014 03:32:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s093W4VV017207; Thu, 9 Jan 2014 03:32:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201401090332.s093W4VV017207@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 9 Jan 2014 03:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260467 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 03:32:04 -0000 Author: kib Date: Thu Jan 9 03:32:03 2014 New Revision: 260467 URL: http://svnweb.freebsd.org/changeset/base/260467 Log: MFC r260205: Update the description for pmap_remove_pages() to match the modern times. Assert that the pmap passed to pmap_remove_pages() is only active on current CPU. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Thu Jan 9 03:25:54 2014 (r260466) +++ stable/10/sys/amd64/amd64/pmap.c Thu Jan 9 03:32:03 2014 (r260467) @@ -5124,12 +5124,20 @@ pmap_page_is_mapped(vm_page_t m) } /* - * Remove all pages from specified address space - * this aids process exit speeds. Also, this code - * is special cased for current process only, but - * can have the more generic (and slightly slower) - * mode enabled. This is much faster than pmap_remove - * in the case of running down an entire address space. + * Destroy all managed, non-wired mappings in the given user-space + * pmap. This pmap cannot be active on any processor besides the + * caller. + * + * This function cannot be applied to the kernel pmap. Moreover, it + * is not intended for general use. It is only to be used during + * process termination. Consequently, it can be implemented in ways + * that make it faster than pmap_remove(). First, it can more quickly + * destroy mappings by iterating over the pmap's collection of PV + * entries, rather than searching the page table. Second, it doesn't + * have to test and clear the page table entries atomically, because + * no processor is currently accessing the user address space. In + * particular, a page table entry's dirty bit won't change state once + * this function starts. */ void pmap_remove_pages(pmap_t pmap) @@ -5149,10 +5157,24 @@ pmap_remove_pages(pmap_t pmap) boolean_t superpage; vm_paddr_t pa; - if (pmap != PCPU_GET(curpmap)) { - printf("warning: pmap_remove_pages called with non-current pmap\n"); - return; + /* + * Assert that the given pmap is only active on the current + * CPU. Unfortunately, we cannot block another CPU from + * activating the pmap while this function is executing. + */ + KASSERT(pmap == PCPU_GET(curpmap), ("non-current pmap %p", pmap)); +#ifdef INVARIANTS + { + cpuset_t other_cpus; + + other_cpus = all_cpus; + critical_enter(); + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + CPU_AND(&other_cpus, &pmap->pm_active); + critical_exit(); + KASSERT(CPU_EMPTY(&other_cpus), ("pmap active %p", pmap)); } +#endif lock = NULL; PG_M = pmap_modified_bit(pmap); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 10:44:27 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CEC062F9; Thu, 9 Jan 2014 10:44:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B9A88160E; Thu, 9 Jan 2014 10:44:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09AiRfM083491; Thu, 9 Jan 2014 10:44:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09AiRZ7083490; Thu, 9 Jan 2014 10:44:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091044.s09AiRZ7083490@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 10:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260473 - stable/10/sys/x86/cpufreq X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 10:44:27 -0000 Author: mav Date: Thu Jan 9 10:44:27 2014 New Revision: 260473 URL: http://svnweb.freebsd.org/changeset/base/260473 Log: MFC r259197: Do not DELAY() for P-state transition unless we want to see the result. Intel manual says: "If a transition is already in progress, transition to a new value will subsequently take effect. Reads of IA32_PERF_CTL determine the last targeted operating point." So seems it should be fine to just trigger wanted transition and go. Linux does the same. Modified: stable/10/sys/x86/cpufreq/est.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/cpufreq/est.c ============================================================================== --- stable/10/sys/x86/cpufreq/est.c Thu Jan 9 10:40:36 2014 (r260472) +++ stable/10/sys/x86/cpufreq/est.c Thu Jan 9 10:44:27 2014 (r260473) @@ -1288,10 +1288,9 @@ est_set_id16(device_t dev, uint16_t id16 msr = (msr & ~0xffff) | id16; wrmsr(MSR_PERF_CTL, msr); - /* Wait a short while for the new setting. XXX Is this necessary? */ - DELAY(EST_TRANS_LAT); - if (need_check) { + /* Wait a short while and read the new status. */ + DELAY(EST_TRANS_LAT); est_get_id16(&new_id16); if (new_id16 != id16) { if (bootverbose) From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 10:49:15 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F44A5E6; Thu, 9 Jan 2014 10:49:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6AD1A164D; Thu, 9 Jan 2014 10:49:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09AnFFx084178; Thu, 9 Jan 2014 10:49:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09AnF9Z084176; Thu, 9 Jan 2014 10:49:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091049.s09AnF9Z084176@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 10:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260475 - in stable/10/sys/cam: ata scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 10:49:15 -0000 Author: mav Date: Thu Jan 9 10:49:14 2014 New Revision: 260475 URL: http://svnweb.freebsd.org/changeset/base/260475 Log: MFC r256547 (by smh): Added 4K quirks for Corsair Neutron GTX SSD's Modified: stable/10/sys/cam/ata/ata_da.c stable/10/sys/cam/scsi/scsi_da.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ata/ata_da.c ============================================================================== --- stable/10/sys/cam/ata/ata_da.c Thu Jan 9 10:45:37 2014 (r260474) +++ stable/10/sys/cam/ata/ata_da.c Thu Jan 9 10:49:14 2014 (r260475) @@ -291,6 +291,14 @@ static struct ada_quirk_entry ada_quirk_ }, { /* + * Corsair Neutron GTX SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Neutron GTX*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * Corsair Force GT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ Modified: stable/10/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.c Thu Jan 9 10:45:37 2014 (r260474) +++ stable/10/sys/cam/scsi/scsi_da.c Thu Jan 9 10:49:14 2014 (r260475) @@ -947,6 +947,14 @@ static struct da_quirk_entry da_quirk_ta { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Corsair Force 3*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Corsair Neutron GTX SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Neutron GTX*", "*" }, + /*quirks*/DA_Q_4K + }, { /* * Corsair Force GT SSDs From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 10:50:21 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 13C2977D; Thu, 9 Jan 2014 10:50:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F3D191660; Thu, 9 Jan 2014 10:50:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09AoKpV084402; Thu, 9 Jan 2014 10:50:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09AoKEw084401; Thu, 9 Jan 2014 10:50:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091050.s09AoKEw084401@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 10:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260476 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 10:50:21 -0000 Author: mav Date: Thu Jan 9 10:50:20 2014 New Revision: 260476 URL: http://svnweb.freebsd.org/changeset/base/260476 Log: MFC r256995: Remove 128KB bzero() call done for every block I/O data buffer. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Thu Jan 9 10:49:14 2014 (r260475) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Thu Jan 9 10:50:20 2014 (r260476) @@ -1607,18 +1607,6 @@ ctl_be_block_open(struct ctl_be_block_so } static int -ctl_be_block_mem_ctor(void *mem, int size, void *arg, int flags) -{ - return (0); -} - -static void -ctl_be_block_mem_dtor(void *mem, int size, void *arg) -{ - bzero(mem, size); -} - -static int ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req) { struct ctl_be_block_lun *be_lun; @@ -1646,8 +1634,7 @@ ctl_be_block_create(struct ctl_be_block_ mtx_init(&be_lun->lock, be_lun->lunname, NULL, MTX_DEF); be_lun->lun_zone = uma_zcreate(be_lun->lunname, MAXPHYS, - ctl_be_block_mem_ctor, ctl_be_block_mem_dtor, NULL, NULL, - /*align*/ 0, /*flags*/0); + NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 10:59:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE5A29C6; Thu, 9 Jan 2014 10:59:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE03E1721; Thu, 9 Jan 2014 10:59:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09AxWkM087899; Thu, 9 Jan 2014 10:59:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09AxW7B087896; Thu, 9 Jan 2014 10:59:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091059.s09AxW7B087896@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 10:59:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260477 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 10:59:33 -0000 Author: mav Date: Thu Jan 9 10:59:31 2014 New Revision: 260477 URL: http://svnweb.freebsd.org/changeset/base/260477 Log: MFC r257946: Introduce seperate mutex lock to protect protect CTL I/O pools, slightly reducing global CTL lock scope and congestion. While there, simplify CTL I/O pools KPI, hiding implementation details. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Jan 9 10:50:20 2014 (r260476) +++ stable/10/sys/cam/ctl/ctl.c Thu Jan 9 10:59:31 2014 (r260477) @@ -360,7 +360,6 @@ static union ctl_io *ctl_malloc_io(ctl_i int can_wait); static void ctl_kfree_io(union ctl_io *io); #endif /* unused */ -static void ctl_free_io_internal(union ctl_io *io, int have_lock); static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun, struct ctl_be_lun *be_lun, struct ctl_id target_id); static int ctl_free_lun(struct ctl_lun *lun); @@ -998,6 +997,7 @@ ctl_init(void) "Report no lun possible for invalid LUNs"); mtx_init(&softc->ctl_lock, "CTL mutex", NULL, MTX_DEF); + mtx_init(&softc->pool_lock, "CTL pool mutex", NULL, MTX_DEF); softc->open_count = 0; /* @@ -1057,7 +1057,7 @@ ctl_init(void) CTL_POOL_ENTRIES_EMERGENCY, &emergency_pool) != 0) { printf("ctl: can't allocate %d entry emergency pool, " "exiting\n", CTL_POOL_ENTRIES_EMERGENCY); - ctl_pool_free(softc, internal_pool); + ctl_pool_free(internal_pool); return (ENOMEM); } @@ -1066,8 +1066,8 @@ ctl_init(void) { printf("ctl: can't allocate %d entry other SC pool, " "exiting\n", CTL_POOL_ENTRIES_OTHER_SC); - ctl_pool_free(softc, internal_pool); - ctl_pool_free(softc, emergency_pool); + ctl_pool_free(internal_pool); + ctl_pool_free(emergency_pool); return (ENOMEM); } @@ -1075,12 +1075,6 @@ ctl_init(void) softc->emergency_pool = emergency_pool; softc->othersc_pool = other_pool; - mtx_lock(&softc->ctl_lock); - ctl_pool_acquire(internal_pool); - ctl_pool_acquire(emergency_pool); - ctl_pool_acquire(other_pool); - mtx_unlock(&softc->ctl_lock); - /* * We used to allocate a processor LUN here. The new scheme is to * just let the user allocate LUNs as he sees fit. @@ -1097,10 +1091,10 @@ ctl_init(void) printf("error creating CTL work thread!\n"); mtx_lock(&softc->ctl_lock); ctl_free_lun(lun); - ctl_pool_free(softc, internal_pool); - ctl_pool_free(softc, emergency_pool); - ctl_pool_free(softc, other_pool); mtx_unlock(&softc->ctl_lock); + ctl_pool_free(internal_pool); + ctl_pool_free(emergency_pool); + ctl_pool_free(other_pool); return (error); } if (bootverbose) @@ -1154,7 +1148,7 @@ ctl_shutdown(void) { struct ctl_softc *softc; struct ctl_lun *lun, *next_lun; - struct ctl_io_pool *pool, *next_pool; + struct ctl_io_pool *pool; softc = (struct ctl_softc *)control_softc; @@ -1171,6 +1165,8 @@ ctl_shutdown(void) ctl_free_lun(lun); } + mtx_unlock(&softc->ctl_lock); + /* * This will rip the rug out from under any FETDs or anyone else * that has a pool allocated. Since we increment our module @@ -1179,18 +1175,14 @@ ctl_shutdown(void) * able to unload the CTL module until client modules have * successfully unloaded. */ - for (pool = STAILQ_FIRST(&softc->io_pools); pool != NULL; - pool = next_pool) { - next_pool = STAILQ_NEXT(pool, links); - ctl_pool_free(softc, pool); - } - - mtx_unlock(&softc->ctl_lock); + while ((pool = STAILQ_FIRST(&softc->io_pools)) != NULL) + ctl_pool_free(pool); #if 0 ctl_shutdown_thread(softc->work_thread); #endif + mtx_destroy(&softc->pool_lock); mtx_destroy(&softc->ctl_lock); destroy_dev(softc->dev); @@ -3367,11 +3359,12 @@ ctl_pool_create(struct ctl_softc *ctl_so pool->type = pool_type; pool->ctl_softc = ctl_softc; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&ctl_softc->pool_lock); pool->id = ctl_softc->cur_pool_id++; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); pool->flags = CTL_POOL_FLAG_NONE; + pool->refcount = 1; /* Reference for validity. */ STAILQ_INIT(&pool->free_queue); /* @@ -3407,7 +3400,7 @@ ctl_pool_create(struct ctl_softc *ctl_so free(pool, M_CTL); goto bailout; } - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&ctl_softc->pool_lock); ctl_softc->num_pools++; STAILQ_INSERT_TAIL(&ctl_softc->io_pools, pool, links); /* @@ -3426,7 +3419,7 @@ ctl_pool_create(struct ctl_softc *ctl_so MOD_INC_USE_COUNT; #endif - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); *npool = pool; @@ -3435,14 +3428,11 @@ bailout: return (retval); } -int +static int ctl_pool_acquire(struct ctl_io_pool *pool) { - mtx_assert(&control_softc->ctl_lock, MA_OWNED); - - if (pool == NULL) - return (-EINVAL); + mtx_assert(&pool->ctl_softc->pool_lock, MA_OWNED); if (pool->flags & CTL_POOL_FLAG_INVALID) return (-EINVAL); @@ -3452,51 +3442,21 @@ ctl_pool_acquire(struct ctl_io_pool *poo return (0); } -int -ctl_pool_invalidate(struct ctl_io_pool *pool) -{ - - mtx_assert(&control_softc->ctl_lock, MA_OWNED); - - if (pool == NULL) - return (-EINVAL); - - pool->flags |= CTL_POOL_FLAG_INVALID; - - return (0); -} - -int +static void ctl_pool_release(struct ctl_io_pool *pool) { + struct ctl_softc *ctl_softc = pool->ctl_softc; + union ctl_io *io; - mtx_assert(&control_softc->ctl_lock, MA_OWNED); - - if (pool == NULL) - return (-EINVAL); - - if ((--pool->refcount == 0) - && (pool->flags & CTL_POOL_FLAG_INVALID)) { - ctl_pool_free(pool->ctl_softc, pool); - } - - return (0); -} - -void -ctl_pool_free(struct ctl_softc *ctl_softc, struct ctl_io_pool *pool) -{ - union ctl_io *cur_io, *next_io; + mtx_assert(&ctl_softc->pool_lock, MA_OWNED); - mtx_assert(&ctl_softc->ctl_lock, MA_OWNED); + if (--pool->refcount != 0) + return; - for (cur_io = (union ctl_io *)STAILQ_FIRST(&pool->free_queue); - cur_io != NULL; cur_io = next_io) { - next_io = (union ctl_io *)STAILQ_NEXT(&cur_io->io_hdr, - links); - STAILQ_REMOVE(&pool->free_queue, &cur_io->io_hdr, ctl_io_hdr, + while ((io = (union ctl_io *)STAILQ_FIRST(&pool->free_queue)) != NULL) { + STAILQ_REMOVE(&pool->free_queue, &io->io_hdr, ctl_io_hdr, links); - free(cur_io, M_CTL); + free(io, M_CTL); } STAILQ_REMOVE(&ctl_softc->io_pools, pool, ctl_io_pool, links); @@ -3515,6 +3475,21 @@ ctl_pool_free(struct ctl_softc *ctl_soft free(pool, M_CTL); } +void +ctl_pool_free(struct ctl_io_pool *pool) +{ + struct ctl_softc *ctl_softc; + + if (pool == NULL) + return; + + ctl_softc = pool->ctl_softc; + mtx_lock(&ctl_softc->pool_lock); + pool->flags |= CTL_POOL_FLAG_INVALID; + ctl_pool_release(pool); + mtx_unlock(&ctl_softc->pool_lock); +} + /* * This routine does not block (except for spinlocks of course). * It tries to allocate a ctl_io union from the caller's pool as quickly as @@ -3539,7 +3514,7 @@ ctl_alloc_io(void *pool_ref) ctl_softc = pool->ctl_softc; - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&ctl_softc->pool_lock); /* * First, try to get the io structure from the user's pool. */ @@ -3549,7 +3524,7 @@ ctl_alloc_io(void *pool_ref) STAILQ_REMOVE_HEAD(&pool->free_queue, links); pool->total_allocated++; pool->free_ctl_io--; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); return (io); } else ctl_pool_release(pool); @@ -3572,14 +3547,14 @@ ctl_alloc_io(void *pool_ref) STAILQ_REMOVE_HEAD(&npool->free_queue, links); npool->total_allocated++; npool->free_ctl_io--; - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); return (io); } else ctl_pool_release(npool); } /* Drop the spinlock before we malloc */ - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); /* * The emergency pool (if it exists) didn't have one, so try an @@ -3592,7 +3567,7 @@ ctl_alloc_io(void *pool_ref) * ctl_io to its list when it gets freed. */ if (emergency_pool != NULL) { - mtx_lock(&ctl_softc->ctl_lock); + mtx_lock(&ctl_softc->pool_lock); if (ctl_pool_acquire(emergency_pool) == 0) { io->io_hdr.pool = emergency_pool; emergency_pool->total_ctl_io++; @@ -3604,7 +3579,7 @@ ctl_alloc_io(void *pool_ref) */ emergency_pool->total_allocated++; } - mtx_unlock(&ctl_softc->ctl_lock); + mtx_unlock(&ctl_softc->pool_lock); } else io->io_hdr.pool = NULL; } @@ -3612,8 +3587,8 @@ ctl_alloc_io(void *pool_ref) return (io); } -static void -ctl_free_io_internal(union ctl_io *io, int have_lock) +void +ctl_free_io(union ctl_io *io) { if (io == NULL) return; @@ -3634,8 +3609,7 @@ ctl_free_io_internal(union ctl_io *io, i pool = (struct ctl_io_pool *)io->io_hdr.pool; - if (have_lock == 0) - mtx_lock(&pool->ctl_softc->ctl_lock); + mtx_lock(&pool->ctl_softc->pool_lock); #if 0 save_flags(xflags); @@ -3672,8 +3646,7 @@ ctl_free_io_internal(union ctl_io *io, i pool->total_freed++; pool->free_ctl_io++; ctl_pool_release(pool); - if (have_lock == 0) - mtx_unlock(&pool->ctl_softc->ctl_lock); + mtx_unlock(&pool->ctl_softc->pool_lock); } else { /* * Otherwise, just free it. We probably malloced it and @@ -3685,12 +3658,6 @@ ctl_free_io_internal(union ctl_io *io, i } void -ctl_free_io(union ctl_io *io) -{ - ctl_free_io_internal(io, /*have_lock*/ 0); -} - -void ctl_zero_io(union ctl_io *io) { void *pool_ref; @@ -4496,7 +4463,7 @@ ctl_free_lun(struct ctl_lun *lun) io = next_io) { next_io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, ooa_links); TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); - ctl_free_io_internal(io, /*have_lock*/ 1); + ctl_free_io(io); } softc->num_luns--; @@ -10211,7 +10178,7 @@ ctl_failover(void) TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); - ctl_free_io_internal(io, 1); + ctl_free_io(io); } } @@ -10227,7 +10194,7 @@ ctl_failover(void) &io->io_hdr, ooa_links); - ctl_free_io_internal(io, 1); + ctl_free_io(io); } } ctl_check_blocked(lun); @@ -11118,7 +11085,7 @@ ctl_run_task_queue(struct ctl_softc *ctl io->taskio.tag_num : io->scsiio.tag_num); STAILQ_REMOVE(&ctl_softc->task_queue, &io->io_hdr, ctl_io_hdr, links); - ctl_free_io_internal(io, 1); + ctl_free_io(io); break; } } @@ -11215,7 +11182,7 @@ ctl_handle_isc(union ctl_io *io) break; } if (free_io) - ctl_free_io_internal(io, 0); + ctl_free_io(io); } @@ -12363,7 +12330,7 @@ ctl_process_done(union ctl_io *io, int h case CTL_IO_TASK: ctl_io_error_print(io, NULL); if (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) - ctl_free_io_internal(io, /*have_lock*/ 0); + ctl_free_io(io); else fe_done(io); return (CTL_RETVAL_COMPLETE); @@ -12682,7 +12649,7 @@ ctl_process_done(union ctl_io *io, int h /* XXX do something here */ } - ctl_free_io_internal(io, /*have_lock*/ 0); + ctl_free_io(io); } else fe_done(io); Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 9 10:50:20 2014 (r260476) +++ stable/10/sys/cam/ctl/ctl_frontend.c Thu Jan 9 10:59:31 2014 (r260477) @@ -114,7 +114,6 @@ ctl_frontend_register(struct ctl_fronten fe->targ_port = port_num + (master_shelf!=0 ? 0 : CTL_MAX_PORTS); fe->max_initiators = CTL_MAX_INIT_PER_PORT; STAILQ_INSERT_TAIL(&control_softc->fe_list, fe, links); - ctl_pool_acquire(pool); control_softc->ctl_ports[port_num] = fe; mtx_unlock(&control_softc->ctl_lock); @@ -141,10 +140,6 @@ ctl_frontend_deregister(struct ctl_front } mtx_lock(&control_softc->ctl_lock); - - ctl_pool_invalidate(pool); - ctl_pool_release(pool); - STAILQ_REMOVE(&control_softc->fe_list, fe, ctl_frontend, links); control_softc->num_frontends--; port_num = (fe->targ_port < CTL_MAX_PORTS) ? fe->targ_port : @@ -152,6 +147,9 @@ ctl_frontend_deregister(struct ctl_front ctl_clear_mask(&control_softc->ctl_port_mask, port_num); control_softc->ctl_ports[port_num] = NULL; mtx_unlock(&control_softc->ctl_lock); + + ctl_pool_free(pool); + bailout: return (retval); } Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Jan 9 10:50:20 2014 (r260476) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Jan 9 10:59:31 2014 (r260477) @@ -448,6 +448,7 @@ struct ctl_softc { struct ctl_frontend *ctl_ports[CTL_MAX_PORTS]; uint32_t num_backends; STAILQ_HEAD(, ctl_backend_driver) be_list; + struct mtx pool_lock; uint32_t num_pools; uint32_t cur_pool_id; STAILQ_HEAD(, ctl_io_pool) io_pools; @@ -462,10 +463,7 @@ extern struct ctl_cmd_entry ctl_cmd_tabl uint32_t ctl_get_initindex(struct ctl_nexus *nexus); int ctl_pool_create(struct ctl_softc *ctl_softc, ctl_pool_type pool_type, uint32_t total_ctl_io, struct ctl_io_pool **npool); -int ctl_pool_acquire(struct ctl_io_pool *pool); -int ctl_pool_invalidate(struct ctl_io_pool *pool); -int ctl_pool_release(struct ctl_io_pool *pool); -void ctl_pool_free(struct ctl_softc *ctl_softc, struct ctl_io_pool *pool); +void ctl_pool_free(struct ctl_io_pool *pool); int ctl_scsi_release(struct ctl_scsiio *ctsio); int ctl_scsi_reserve(struct ctl_scsiio *ctsio); int ctl_start_stop(struct ctl_scsiio *ctsio); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 11:11:48 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0524EE2E; Thu, 9 Jan 2014 11:11:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E414D1897; Thu, 9 Jan 2014 11:11:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09BBl2u095032; Thu, 9 Jan 2014 11:11:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09BBlR3095030; Thu, 9 Jan 2014 11:11:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091111.s09BBlR3095030@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 11:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260478 - stable/10/sys/geom/multipath X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 11:11:48 -0000 Author: mav Date: Thu Jan 9 11:11:47 2014 New Revision: 260478 URL: http://svnweb.freebsd.org/changeset/base/260478 Log: MFC r258220, r258251: Implement automatic live resize support for GEOM MULTIPATH class. In "manual" mode just automatically resize provider in any direction. In "automatic" mode allow growth (with new metadata write); in case of shrinking check if there is already valid metadata found at the new location. This should allow easy transparent recovery if first resize was done by mistake. While there, unify metadata write code and fix minor memory leak. Modified: stable/10/sys/geom/multipath/g_multipath.c stable/10/sys/geom/multipath/g_multipath.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/10/sys/geom/multipath/g_multipath.c Thu Jan 9 10:59:31 2014 (r260477) +++ stable/10/sys/geom/multipath/g_multipath.c Thu Jan 9 11:11:47 2014 (r260478) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2011-2013 Alexander Motin * Copyright (c) 2006-2007 Matthew Jacob * All rights reserved. * @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -66,7 +67,13 @@ static enum { static struct bio_queue_head gmtbq; static struct mtx gmtbq_mtx; +static int g_multipath_read_metadata(struct g_consumer *cp, + struct g_multipath_metadata *md); +static int g_multipath_write_metadata(struct g_consumer *cp, + struct g_multipath_metadata *md); + static void g_multipath_orphan(struct g_consumer *); +static void g_multipath_resize(struct g_consumer *); static void g_multipath_start(struct bio *); static void g_multipath_done(struct bio *); static void g_multipath_done_error(struct bio *); @@ -237,6 +244,79 @@ g_multipath_orphan(struct g_consumer *cp } static void +g_multipath_resize(struct g_consumer *cp) +{ + struct g_multipath_softc *sc; + struct g_geom *gp; + struct g_consumer *cp1; + struct g_provider *pp; + struct g_multipath_metadata md; + off_t size, psize, ssize; + int error; + + g_topology_assert(); + + gp = cp->geom; + pp = cp->provider; + sc = gp->softc; + + if (sc->sc_stopping) + return; + + if (pp->mediasize < sc->sc_size) { + size = pp->mediasize; + ssize = pp->sectorsize; + } else { + size = ssize = OFF_MAX; + mtx_lock(&sc->sc_mtx); + LIST_FOREACH(cp1, &gp->consumer, consumer) { + pp = cp1->provider; + if (pp == NULL) + continue; + if (pp->mediasize < size) { + size = pp->mediasize; + ssize = pp->sectorsize; + } + } + mtx_unlock(&sc->sc_mtx); + if (size == OFF_MAX || size == sc->sc_size) + return; + } + psize = size - ((sc->sc_uuid[0] != 0) ? ssize : 0); + printf("GEOM_MULTIPATH: %s size changed from %jd to %jd\n", + sc->sc_name, sc->sc_pp->mediasize, psize); + if (sc->sc_uuid[0] != 0 && size < sc->sc_size) { + error = g_multipath_read_metadata(cp, &md); + if (error || + (strcmp(md.md_magic, G_MULTIPATH_MAGIC) != 0) || + (memcmp(md.md_uuid, sc->sc_uuid, sizeof(sc->sc_uuid)) != 0) || + (strcmp(md.md_name, sc->sc_name) != 0) || + (md.md_size != 0 && md.md_size != size) || + (md.md_sectorsize != 0 && md.md_sectorsize != ssize)) { + g_multipath_destroy(gp); + return; + } + } + sc->sc_size = size; + g_resize_provider(sc->sc_pp, psize); + + if (sc->sc_uuid[0] != 0) { + pp = cp->provider; + strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic)); + memcpy(md.md_uuid, sc->sc_uuid, sizeof (sc->sc_uuid)); + strlcpy(md.md_name, sc->sc_name, sizeof(md.md_name)); + md.md_version = G_MULTIPATH_VERSION; + md.md_size = size; + md.md_sectorsize = ssize; + md.md_active_active = sc->sc_active_active; + error = g_multipath_write_metadata(cp, &md); + if (error != 0) + printf("GEOM_MULTIPATH: Can't update metadata on %s " + "(%d)\n", pp->name, error); + } +} + +static void g_multipath_start(struct bio *bp) { struct g_multipath_softc *sc; @@ -435,9 +515,11 @@ g_multipath_create(struct g_class *mp, s memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); sc->sc_active_active = md->md_active_active; + sc->sc_size = md->md_size; gp->softc = sc; gp->start = g_multipath_start; gp->orphan = g_multipath_orphan; + gp->resize = g_multipath_resize; gp->access = g_multipath_access; gp->dumpconf = g_multipath_dumpconf; @@ -514,18 +596,17 @@ g_multipath_add_disk(struct g_geom *gp, g_destroy_consumer(cp); return (error); } - if (sc->sc_pp != NULL && sc->sc_pp->mediasize == 0) { - sc->sc_pp->mediasize = pp->mediasize - + if (sc->sc_size == 0) { + sc->sc_size = pp->mediasize - ((sc->sc_uuid[0] != 0) ? pp->sectorsize : 0); + sc->sc_pp->mediasize = sc->sc_size; sc->sc_pp->sectorsize = pp->sectorsize; } - if (sc->sc_pp != NULL && - sc->sc_pp->stripesize == 0 && sc->sc_pp->stripeoffset == 0) { + if (sc->sc_pp->stripesize == 0 && sc->sc_pp->stripeoffset == 0) { sc->sc_pp->stripesize = pp->stripesize; sc->sc_pp->stripeoffset = pp->stripeoffset; } - if (sc->sc_pp != NULL) - sc->sc_pp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED; + sc->sc_pp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED; mtx_lock(&sc->sc_mtx); cp->index = 0; sc->sc_ndisks++; @@ -556,10 +637,8 @@ g_multipath_destroy(struct g_geom *gp) sc->sc_stopping = 1; } if (sc->sc_opened != 0) { - if (sc->sc_pp != NULL) { - g_wither_provider(sc->sc_pp, ENXIO); - sc->sc_pp = NULL; - } + g_wither_provider(sc->sc_pp, ENXIO); + sc->sc_pp = NULL; return (EINPROGRESS); } LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) { @@ -668,6 +747,30 @@ g_multipath_read_metadata(struct g_consu return (0); } +static int +g_multipath_write_metadata(struct g_consumer *cp, + struct g_multipath_metadata *md) +{ + struct g_provider *pp; + u_char *buf; + int error; + + g_topology_assert(); + error = g_access(cp, 1, 1, 1); + if (error != 0) + return (error); + pp = cp->provider; + g_topology_unlock(); + buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); + multipath_metadata_encode(md, buf); + error = g_write_data(cp, pp->mediasize - pp->sectorsize, + buf, pp->sectorsize); + g_topology_lock(); + g_access(cp, -1, -1, -1); + g_free(buf); + return (error); +} + static struct g_geom * g_multipath_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) { @@ -837,7 +940,7 @@ g_multipath_ctl_add_name(struct gctl_req return; } } - if (sc->sc_pp != NULL && sc->sc_pp->mediasize != 0 && + if (sc->sc_pp->mediasize != 0 && sc->sc_pp->mediasize + (sc->sc_uuid[0] != 0 ? pp->sectorsize : 0) != pp->mediasize) { gctl_error(req, "Providers size mismatch %jd != %jd", @@ -846,7 +949,7 @@ g_multipath_ctl_add_name(struct gctl_req (intmax_t) pp->mediasize); return; } - if (sc->sc_pp != NULL && sc->sc_pp->sectorsize != 0 && + if (sc->sc_pp->sectorsize != 0 && sc->sc_pp->sectorsize != pp->sectorsize) { gctl_error(req, "Providers sectorsize mismatch %u != %u", sc->sc_pp->sectorsize, pp->sectorsize); @@ -1030,7 +1133,6 @@ g_multipath_ctl_configure(struct gctl_re struct g_multipath_metadata md; const char *name; int error, *val; - void *buf; g_topology_assert(); @@ -1057,13 +1159,6 @@ g_multipath_ctl_configure(struct gctl_re if (sc->sc_uuid[0] != 0 && sc->sc_active != NULL) { cp = sc->sc_active; pp = cp->provider; - error = g_access(cp, 1, 1, 1); - if (error != 0) { - gctl_error(req, "Can't open %s (%d)", pp->name, error); - return; - } - g_topology_unlock(); - buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); strlcpy(md.md_magic, G_MULTIPATH_MAGIC, sizeof(md.md_magic)); memcpy(md.md_uuid, sc->sc_uuid, sizeof (sc->sc_uuid)); strlcpy(md.md_name, name, sizeof(md.md_name)); @@ -1071,11 +1166,7 @@ g_multipath_ctl_configure(struct gctl_re md.md_size = pp->mediasize; md.md_sectorsize = pp->sectorsize; md.md_active_active = sc->sc_active_active; - multipath_metadata_encode(&md, buf); - error = g_write_data(cp, pp->mediasize - pp->sectorsize, - buf, pp->sectorsize); - g_topology_lock(); - g_access(cp, -1, -1, -1); + error = g_multipath_write_metadata(cp, &md); if (error != 0) gctl_error(req, "Can't update metadata on %s (%d)", pp->name, error); Modified: stable/10/sys/geom/multipath/g_multipath.h ============================================================================== --- stable/10/sys/geom/multipath/g_multipath.h Thu Jan 9 10:59:31 2014 (r260477) +++ stable/10/sys/geom/multipath/g_multipath.h Thu Jan 9 11:11:47 2014 (r260478) @@ -48,6 +48,7 @@ struct g_multipath_softc { struct mtx sc_mtx; char sc_name[16]; char sc_uuid[40]; + off_t sc_size; int sc_opened; int sc_stopping; int sc_ndisks; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 11:13:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBC1310A; Thu, 9 Jan 2014 11:13:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BCC5918B4; Thu, 9 Jan 2014 11:13:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09BD47U095277; Thu, 9 Jan 2014 11:13:04 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09BD4NU095274; Thu, 9 Jan 2014 11:13:04 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401091113.s09BD4NU095274@svn.freebsd.org> From: Alexander Motin Date: Thu, 9 Jan 2014 11:13:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260479 - stable/10/sys/geom X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 11:13:04 -0000 Author: mav Date: Thu Jan 9 11:13:03 2014 New Revision: 260479 URL: http://svnweb.freebsd.org/changeset/base/260479 Log: MFC r258683: Escape special XML chars, returned by some devices, confusing XML parsers. Modified: stable/10/sys/geom/geom_disk.c stable/10/sys/geom/geom_dump.c stable/10/sys/geom/geom_int.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/geom_disk.c ============================================================================== --- stable/10/sys/geom/geom_disk.c Thu Jan 9 11:11:47 2014 (r260478) +++ stable/10/sys/geom/geom_disk.c Thu Jan 9 11:13:03 2014 (r260479) @@ -485,26 +485,36 @@ g_disk_dumpconf(struct sbuf *sb, const c bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; res = dp->d_getattr(bp); - sbuf_printf(sb, "%s%s\n", indent, + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", res == 0 ? buf: dp->d_ident); + sbuf_printf(sb, "\n"); bp->bio_attribute = "GEOM::lunid"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; - if (dp->d_getattr(bp) == 0) - sbuf_printf(sb, "%s%s\n", - indent, buf); + if (dp->d_getattr(bp) == 0) { + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", buf); + sbuf_printf(sb, "\n"); + } bp->bio_attribute = "GEOM::lunname"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; - if (dp->d_getattr(bp) == 0) - sbuf_printf(sb, "%s%s\n", - indent, buf); + if (dp->d_getattr(bp) == 0) { + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", buf); + sbuf_printf(sb, "\n"); + } g_destroy_bio(bp); g_free(buf); - } else - sbuf_printf(sb, "%s%s\n", indent, - dp->d_ident); - sbuf_printf(sb, "%s%s\n", indent, dp->d_descr); + } else { + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", dp->d_ident); + sbuf_printf(sb, "\n"); + } + sbuf_printf(sb, "%s", indent); + g_conf_printf_escaped(sb, "%s", dp->d_descr); + sbuf_printf(sb, "\n"); } } Modified: stable/10/sys/geom/geom_dump.c ============================================================================== --- stable/10/sys/geom/geom_dump.c Thu Jan 9 11:11:47 2014 (r260478) +++ stable/10/sys/geom/geom_dump.c Thu Jan 9 11:13:03 2014 (r260479) @@ -154,25 +154,28 @@ g_conftxt(void *p, int flag) } -static void -g_conf_print_escaped(struct sbuf *sb, const char *fmt, const char *str) +void +g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...) { struct sbuf *s; const u_char *c; + va_list ap; s = sbuf_new_auto(); + va_start(ap, fmt); + sbuf_vprintf(s, fmt, ap); + va_end(ap); + sbuf_finish(s); - for (c = str; *c != '\0'; c++) { + for (c = sbuf_data(s); *c != '\0'; c++) { if (*c == '&' || *c == '<' || *c == '>' || *c == '\'' || *c == '"' || *c > 0x7e) - sbuf_printf(s, "&#x%X;", *c); + sbuf_printf(sb, "&#x%X;", *c); else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) - sbuf_putc(s, *c); + sbuf_putc(sb, *c); else - sbuf_putc(s, '?'); + sbuf_putc(sb, '?'); } - sbuf_finish(s); - sbuf_printf(sb, fmt, sbuf_data(s)); sbuf_delete(s); } @@ -204,7 +207,9 @@ g_conf_provider(struct sbuf *sb, struct sbuf_printf(sb, "\t \n", pp->geom); sbuf_printf(sb, "\t r%dw%de%d\n", pp->acr, pp->acw, pp->ace); - g_conf_print_escaped(sb, "\t %s\n", pp->name); + sbuf_printf(sb, "\t "); + g_conf_printf_escaped(sb, "%s", pp->name); + sbuf_printf(sb, "\n"); sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); @@ -229,7 +234,9 @@ g_conf_geom(struct sbuf *sb, struct g_ge sbuf_printf(sb, " \n", gp); sbuf_printf(sb, " \n", gp->class); - g_conf_print_escaped(sb, " %s\n", gp->name); + sbuf_printf(sb, " "); + g_conf_printf_escaped(sb, "%s", gp->name); + sbuf_printf(sb, "\n"); sbuf_printf(sb, " %d\n", gp->rank); if (gp->flags & G_GEOM_WITHER) sbuf_printf(sb, " \n"); @@ -258,7 +265,9 @@ g_conf_class(struct sbuf *sb, struct g_c struct g_geom *gp2; sbuf_printf(sb, " \n", mp); - g_conf_print_escaped(sb, " %s\n", mp->name); + sbuf_printf(sb, " "); + g_conf_printf_escaped(sb, "%s", mp->name); + sbuf_printf(sb, "\n"); LIST_FOREACH(gp2, &mp->geom, geom) { if (gp != NULL && gp != gp2) continue; Modified: stable/10/sys/geom/geom_int.h ============================================================================== --- stable/10/sys/geom/geom_int.h Thu Jan 9 11:11:47 2014 (r260478) +++ stable/10/sys/geom/geom_int.h Thu Jan 9 11:13:03 2014 (r260479) @@ -57,6 +57,7 @@ extern int g_debugflags; /* geom_dump.c */ void g_confxml(void *, int flag); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); +void g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...); void g_confdot(void *, int flag); void g_conftxt(void *, int flag); From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 18:28:59 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5059F64; Thu, 9 Jan 2014 18:28:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 84F40109A; Thu, 9 Jan 2014 18:28:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09ISxB9062560; Thu, 9 Jan 2014 18:28:59 GMT (envelope-from loos@svn.freebsd.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09ISwhM062556; Thu, 9 Jan 2014 18:28:58 GMT (envelope-from loos@svn.freebsd.org) Message-Id: <201401091828.s09ISwhM062556@svn.freebsd.org> From: Luiz Otavio O Souza Date: Thu, 9 Jan 2014 18:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260489 - in stable/10/sys: conf dev/spibus X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 18:28:59 -0000 Author: loos Date: Thu Jan 9 18:28:58 2014 New Revision: 260489 URL: http://svnweb.freebsd.org/changeset/base/260489 Log: MFC r257064: Add an OFW SPI compatible bus. Fix the spibus probe to return BUS_PROBE_GENERIC and not BUS_PROBE_SPECIFIC (0) so the OFW SPI bus can attach when enabled. Export the spibus devclass_t and driver_t declarations. Submitted by: ray Approved by: adrian (mentor) Added: stable/10/sys/dev/spibus/ofw_spibus.c - copied unchanged from r257064, head/sys/dev/spibus/ofw_spibus.c Modified: stable/10/sys/conf/files stable/10/sys/dev/spibus/spibus.c stable/10/sys/dev/spibus/spibusvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Jan 9 18:13:25 2014 (r260488) +++ stable/10/sys/conf/files Thu Jan 9 18:28:58 2014 (r260489) @@ -2175,6 +2175,7 @@ dev/sound/midi/mpu_if.m optional sound dev/sound/midi/mpufoi_if.m optional sound dev/sound/midi/sequencer.c optional sound dev/sound/midi/synth_if.m optional sound +dev/spibus/ofw_spibus.c optional fdt spibus dev/spibus/spibus.c optional spibus \ dependency "spibus_if.h" dev/spibus/spibus_if.m optional spibus Copied: stable/10/sys/dev/spibus/ofw_spibus.c (from r257064, head/sys/dev/spibus/ofw_spibus.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/spibus/ofw_spibus.c Thu Jan 9 18:28:58 2014 (r260489, copy of r257064, head/sys/dev/spibus/ofw_spibus.c) @@ -0,0 +1,192 @@ +/*- + * Copyright (c) 2009, Nathan Whitehorn + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Oleksandr Rybalko + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "spibus_if.h" + +struct ofw_spibus_devinfo { + struct spibus_ivar opd_dinfo; + struct ofw_bus_devinfo opd_obdinfo; +}; + +/* Methods */ +static device_probe_t ofw_spibus_probe; +static device_attach_t ofw_spibus_attach; +static device_t ofw_spibus_add_child(device_t dev, u_int order, + const char *name, int unit); +static const struct ofw_bus_devinfo *ofw_spibus_get_devinfo(device_t bus, + device_t dev); + +static int +ofw_spibus_probe(device_t dev) +{ + + if (ofw_bus_get_node(dev) == -1) + return (ENXIO); + device_set_desc(dev, "OFW SPI bus"); + + return (0); +} + +static int +ofw_spibus_attach(device_t dev) +{ + struct spibus_softc *sc = device_get_softc(dev); + struct ofw_spibus_devinfo *dinfo; + phandle_t child; + pcell_t paddr; + device_t childdev; + + sc->dev = dev; + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + + /* + * Attach those children represented in the device tree. + */ + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; + child = OF_peer(child)) { + /* + * Try to get the CS number first from the spi-chipselect + * property, then try the reg property. + */ + if (OF_getencprop(child, "spi-chipselect", &paddr, + sizeof(paddr)) == -1) { + if (OF_getencprop(child, "reg", &paddr, + sizeof(paddr)) == -1) + continue; + } + + /* + * Now set up the SPI and OFW bus layer devinfo and add it + * to the bus. + */ + dinfo = malloc(sizeof(struct ofw_spibus_devinfo), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (dinfo == NULL) + continue; + dinfo->opd_dinfo.cs = paddr; + if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != + 0) { + free(dinfo, M_DEVBUF); + continue; + } + childdev = device_add_child(dev, NULL, -1); + device_set_ivars(childdev, dinfo); + } + + return (bus_generic_attach(dev)); +} + +static device_t +ofw_spibus_add_child(device_t dev, u_int order, const char *name, int unit) +{ + device_t child; + struct ofw_spibus_devinfo *devi; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (child); + devi = malloc(sizeof(struct ofw_spibus_devinfo), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (devi == NULL) { + device_delete_child(dev, child); + return (0); + } + + /* + * NULL all the OFW-related parts of the ivars for non-OFW + * children. + */ + devi->opd_obdinfo.obd_node = -1; + devi->opd_obdinfo.obd_name = NULL; + devi->opd_obdinfo.obd_compat = NULL; + devi->opd_obdinfo.obd_type = NULL; + devi->opd_obdinfo.obd_model = NULL; + + device_set_ivars(child, devi); + + return (child); +} + +static const struct ofw_bus_devinfo * +ofw_spibus_get_devinfo(device_t bus, device_t dev) +{ + struct ofw_spibus_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + return (&dinfo->opd_obdinfo); +} + +static device_method_t ofw_spibus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ofw_spibus_probe), + DEVMETHOD(device_attach, ofw_spibus_attach), + + /* Bus interface */ + DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str), + DEVMETHOD(bus_add_child, ofw_spibus_add_child), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, ofw_spibus_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + DEVMETHOD_END +}; + +static devclass_t ofwspibus_devclass; + +DEFINE_CLASS_1(spibus, ofw_spibus_driver, ofw_spibus_methods, + sizeof(struct spibus_softc), spibus_driver); +DRIVER_MODULE(ofw_spibus, spi, ofw_spibus_driver, ofwspibus_devclass, 0, 0); +MODULE_VERSION(ofw_spibus, 1); +MODULE_DEPEND(ofw_spibus, spibus, 1, 1, 1); Modified: stable/10/sys/dev/spibus/spibus.c ============================================================================== --- stable/10/sys/dev/spibus/spibus.c Thu Jan 9 18:13:25 2014 (r260488) +++ stable/10/sys/dev/spibus/spibus.c Thu Jan 9 18:28:58 2014 (r260489) @@ -23,7 +23,7 @@ static int spibus_probe(device_t dev) { device_set_desc(dev, "spibus bus"); - return (0); + return (BUS_PROBE_GENERIC); } static int @@ -185,7 +185,7 @@ static device_method_t spibus_methods[] DEVMETHOD_END }; -static driver_t spibus_driver = { +driver_t spibus_driver = { "spibus", spibus_methods, sizeof(struct spibus_softc) Modified: stable/10/sys/dev/spibus/spibusvar.h ============================================================================== --- stable/10/sys/dev/spibus/spibusvar.h Thu Jan 9 18:13:25 2014 (r260488) +++ stable/10/sys/dev/spibus/spibusvar.h Thu Jan 9 18:28:58 2014 (r260489) @@ -26,3 +26,6 @@ spibus_get_ ## A(device_t dev, T *t) } SPIBUS_ACCESSOR(cs, CS, uint32_t) + +extern driver_t spibus_driver; +extern devclass_t spibus_devclass; From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 22:40:56 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 07EB87EE; Thu, 9 Jan 2014 22:40:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DC9D61701; Thu, 9 Jan 2014 22:40:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09MetSB073890; Thu, 9 Jan 2014 22:40:55 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09MerwF073876; Thu, 9 Jan 2014 22:40:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201401092240.s09MerwF073876@svn.freebsd.org> From: Dimitry Andric Date: Thu, 9 Jan 2014 22:40:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260495 - in stable: 10/share/mk 10/sys/conf 10/sys/modules/drm2/radeonkms 10/sys/modules/ibcore 10/sys/modules/ipoib 10/sys/modules/mlx4 10/sys/modules/mlx4ib 10/sys/modules/mlxen 10/s... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 22:40:56 -0000 Author: dim Date: Thu Jan 9 22:40:51 2014 New Revision: 260495 URL: http://svnweb.freebsd.org/changeset/base/260495 Log: MFC r260102: Similar to r260020, only use -fms-extensions with gcc, for all other modules which require this flag to compile. Use a GCC_MS_EXTENSIONS variable, defined in kern.pre.mk, which can be used to easily supply the flag (or not), depending on the compiler type. MFC r260322: In addition to r260102, also define GCC_MS_EXTENSIONS in bsd.sys.mk, since kernel module builds do not use kern.pre.mk. Modified: stable/10/share/mk/bsd.sys.mk stable/10/sys/conf/kern.pre.mk stable/10/sys/modules/drm2/radeonkms/Makefile stable/10/sys/modules/ibcore/Makefile stable/10/sys/modules/ipoib/Makefile stable/10/sys/modules/mlx4/Makefile stable/10/sys/modules/mlx4ib/Makefile stable/10/sys/modules/mlxen/Makefile stable/10/sys/modules/mthca/Makefile stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile stable/10/sys/ofed/drivers/net/mlx4/Makefile Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/share/mk/bsd.sys.mk (contents, props changed) stable/9/sys/conf/kern.pre.mk stable/9/sys/modules/mlx4/Makefile stable/9/sys/modules/mlx4ib/Makefile stable/9/sys/modules/mlxen/Makefile stable/9/sys/modules/mthca/Makefile Directory Properties: stable/9/share/mk/ (props changed) stable/9/sys/ (props changed) Modified: stable/10/share/mk/bsd.sys.mk ============================================================================== --- stable/10/share/mk/bsd.sys.mk Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/share/mk/bsd.sys.mk Thu Jan 9 22:40:51 2014 (r260495) @@ -123,6 +123,7 @@ CFLAGS+= -Qunused-arguments CFLAGS+= ${CFLAGS.clang} CXXFLAGS+= ${CXXFLAGS.clang} .else # !CLANG +GCC_MS_EXTENSIONS= -fms-extensions CFLAGS+= ${CFLAGS.gcc} CXXFLAGS+= ${CXXFLAGS.gcc} .endif # CLANG Modified: stable/10/sys/conf/kern.pre.mk ============================================================================== --- stable/10/sys/conf/kern.pre.mk Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/conf/kern.pre.mk Thu Jan 9 22:40:51 2014 (r260495) @@ -99,6 +99,8 @@ ASM_CFLAGS= -x assembler-with-cpp -DLOCO .if ${COMPILER_TYPE} == "clang" CLANG_NO_IAS= -no-integrated-as +.else +GCC_MS_EXTENSIONS= -fms-extensions .endif .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 @@ -157,7 +159,7 @@ NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLA # Infiniband C flags. Correct include paths and omit errors that linux # does not honor. OFEDINCLUDES= -I$S/ofed/include/ -OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} OFEDCFLAGS= ${CFLAGS:N-I*} ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} Modified: stable/10/sys/modules/drm2/radeonkms/Makefile ============================================================================== --- stable/10/sys/modules/drm2/radeonkms/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/drm2/radeonkms/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -103,9 +103,6 @@ SRCS += \ iicbus_if.h \ pci_if.h -CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon -.if ${COMPILER_TYPE} == "gcc" -CFLAGS += -fms-extensions -.endif +CFLAGS += -I${.CURDIR}/../../../dev/drm2/radeon ${GCC_MS_EXTENSIONS} .include Modified: stable/10/sys/modules/ibcore/Makefile ============================================================================== --- stable/10/sys/modules/ibcore/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/ibcore/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -20,7 +20,7 @@ CFLAGS+= -DINET6 -DINET -DOFED .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} CWARNFLAGS.cm.c= -Wno-unused-function CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/10/sys/modules/ipoib/Makefile ============================================================================== --- stable/10/sys/modules/ipoib/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/ipoib/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/modules/mlx4/Makefile ============================================================================== --- stable/10/sys/modules/mlx4/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/mlx4/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -27,7 +27,6 @@ opt_inet6.h: .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions CWARNFLAGS.mcg.c= -Wno-unused CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/10/sys/modules/mlx4ib/Makefile ============================================================================== --- stable/10/sys/modules/mlx4ib/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/mlx4ib/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -31,4 +31,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/modules/mlxen/Makefile ============================================================================== --- stable/10/sys/modules/mlxen/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/mlxen/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -25,4 +25,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/modules/mthca/Makefile ============================================================================== --- stable/10/sys/modules/mthca/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/modules/mthca/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -28,4 +28,4 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} Modified: stable/10/sys/ofed/drivers/net/mlx4/Makefile ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/Makefile Thu Jan 9 22:16:30 2014 (r260494) +++ stable/10/sys/ofed/drivers/net/mlx4/Makefile Thu Jan 9 22:40:51 2014 (r260495) @@ -30,5 +30,5 @@ opt_inet6.h: .include -CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith ${GCC_MS_EXTENSIONS} From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 23:09:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C07A4F7; Thu, 9 Jan 2014 23:09:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B5BC18D5; Thu, 9 Jan 2014 23:09:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09N96vU082982; Thu, 9 Jan 2014 23:09:06 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09N92TW082950; Thu, 9 Jan 2014 23:09:02 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201401092309.s09N92TW082950@svn.freebsd.org> From: Dimitry Andric Date: Thu, 9 Jan 2014 23:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260497 - in stable: 10/lib/libiconv 10/lib/libiconv_modules/BIG5 10/lib/libiconv_modules/EUC 10/lib/libiconv_modules/EUCTW 10/lib/libiconv_modules/GBK2K 10/lib/libiconv_modules/ISO2022... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 23:09:06 -0000 Author: dim Date: Thu Jan 9 23:08:56 2014 New Revision: 260497 URL: http://svnweb.freebsd.org/changeset/base/260497 Log: MFC r260334: Split the last gcc-specific flags off into CFLAGS.gcc. This also removes the need to use -Qunused-arguments for clang throughout the tree. MFC r260369: Apply band-aid for 32-bit compat libs failures after r260334: put back -Qunused-arguments for clang for now, until I can figure out a way to make it unneeded in all scenarios. Sorry about the breakage. Modified: stable/10/lib/libiconv/Makefile stable/10/lib/libiconv_modules/BIG5/Makefile stable/10/lib/libiconv_modules/EUC/Makefile stable/10/lib/libiconv_modules/EUCTW/Makefile stable/10/lib/libiconv_modules/GBK2K/Makefile stable/10/lib/libiconv_modules/ISO2022/Makefile stable/10/lib/libiconv_modules/JOHAB/Makefile stable/10/lib/libiconv_modules/UES/Makefile stable/10/lib/libiconv_modules/UTF1632/Makefile stable/10/lib/libiconv_modules/UTF7/Makefile stable/10/lib/libiconv_modules/iconv_std/Makefile stable/10/lib/libiconv_modules/mapper_parallel/Makefile stable/10/lib/libiconv_modules/mapper_serial/Makefile stable/10/lib/libiconv_modules/mapper_std/Makefile stable/10/lib/libiconv_modules/mapper_zone/Makefile stable/10/sys/boot/i386/boot2/Makefile stable/10/sys/boot/i386/gptboot/Makefile stable/10/sys/boot/i386/gptzfsboot/Makefile stable/10/sys/boot/i386/zfsboot/Makefile stable/10/sys/boot/pc98/boot2/Makefile stable/10/usr.sbin/mfiutil/Makefile Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/lib/libiconv/Makefile stable/9/lib/libiconv_modules/BIG5/Makefile stable/9/lib/libiconv_modules/EUC/Makefile stable/9/lib/libiconv_modules/EUCTW/Makefile stable/9/lib/libiconv_modules/GBK2K/Makefile stable/9/lib/libiconv_modules/ISO2022/Makefile stable/9/lib/libiconv_modules/JOHAB/Makefile stable/9/lib/libiconv_modules/UES/Makefile stable/9/lib/libiconv_modules/UTF1632/Makefile stable/9/lib/libiconv_modules/UTF7/Makefile stable/9/lib/libiconv_modules/iconv_std/Makefile stable/9/lib/libiconv_modules/mapper_parallel/Makefile stable/9/lib/libiconv_modules/mapper_serial/Makefile stable/9/lib/libiconv_modules/mapper_std/Makefile stable/9/lib/libiconv_modules/mapper_zone/Makefile stable/9/sys/boot/i386/boot2/Makefile stable/9/sys/boot/i386/gptboot/Makefile stable/9/sys/boot/i386/gptzfsboot/Makefile stable/9/sys/boot/i386/zfsboot/Makefile stable/9/sys/boot/pc98/boot2/Makefile stable/9/usr.sbin/mfiutil/Makefile Directory Properties: stable/9/lib/libiconv_modules/ (props changed) stable/9/share/mk/ (props changed) stable/9/share/mk/bsd.sys.mk (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/i386/gptboot/ (props changed) stable/9/usr.sbin/mfiutil/ (props changed) Modified: stable/10/lib/libiconv/Makefile ============================================================================== --- stable/10/lib/libiconv/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -19,6 +19,7 @@ SRCS= citrus_bcs.c citrus_bcs_strtol.c c citrus_module.c citrus_none.c citrus_pivot_factory.c \ citrus_prop.c citrus_stdenc.c iconv.c -CFLAGS+= --param max-inline-insns-single=128 -I ${.CURDIR}/../../include -I${.CURDIR}/../libc/include +CFLAGS.gcc+= --param max-inline-insns-single=128 +CFLAGS+= -I ${.CURDIR}/../../include -I${.CURDIR}/../libc/include .include Modified: stable/10/lib/libiconv_modules/BIG5/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/BIG5/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/BIG5/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= BIG5 SRCS+= citrus_big5.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/EUC/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/EUC/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/EUC/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= EUC SRCS+= citrus_euc.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/EUCTW/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/EUCTW/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/EUCTW/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= EUCTW SRCS+= citrus_euctw.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/GBK2K/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/GBK2K/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/GBK2K/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= GBK2K SRCS+= citrus_gbk2k.c -CFLAGS+= --param max-inline-insns-single=16 +CFLAGS.gcc+= --param max-inline-insns-single=16 .include Modified: stable/10/lib/libiconv_modules/ISO2022/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/ISO2022/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/ISO2022/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= ISO2022 SRCS+= citrus_iso2022.c -CFLAGS+= --param max-inline-insns-single=128 +CFLAGS.gcc+= --param max-inline-insns-single=128 .include Modified: stable/10/lib/libiconv_modules/JOHAB/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/JOHAB/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/JOHAB/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= JOHAB SRCS+= citrus_johab.c -CFLAGS+= --param max-inline-insns-single=16 +CFLAGS.gcc+= --param max-inline-insns-single=16 .include Modified: stable/10/lib/libiconv_modules/UES/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/UES/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/UES/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= UES SRCS+= citrus_ues.c -CFLAGS+= --param max-inline-insns-single=64 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: stable/10/lib/libiconv_modules/UTF1632/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/UTF1632/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/UTF1632/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= UTF1632 SRCS+= citrus_utf1632.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/UTF7/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/UTF7/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/UTF7/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= UTF7 SRCS+= citrus_utf7.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/iconv_std/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/iconv_std/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/iconv_std/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= iconv_std SRCS+= citrus_iconv_std.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/mapper_parallel/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/mapper_parallel/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/mapper_parallel/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -4,6 +4,6 @@ SHLIB= mapper_parallel SRCS+= citrus_mapper_serial.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/mapper_serial/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/mapper_serial/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/mapper_serial/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= mapper_serial SRCS+= citrus_mapper_serial.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include Modified: stable/10/lib/libiconv_modules/mapper_std/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/mapper_std/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/mapper_std/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= mapper_std SRCS+= citrus_mapper_std.c -CFLAGS+= --param max-inline-insns-single=8 +CFLAGS.gcc+= --param max-inline-insns-single=8 .include Modified: stable/10/lib/libiconv_modules/mapper_zone/Makefile ============================================================================== --- stable/10/lib/libiconv_modules/mapper_zone/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/lib/libiconv_modules/mapper_zone/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -2,6 +2,6 @@ SHLIB= mapper_zone SRCS+= citrus_mapper_zone.c -CFLAGS+= --param max-inline-insns-single=8 +CFLAGS.gcc+= --param max-inline-insns-single=8 .include Modified: stable/10/sys/boot/i386/boot2/Makefile ============================================================================== --- stable/10/sys/boot/i386/boot2/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/sys/boot/i386/boot2/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -37,12 +37,13 @@ CFLAGS= -Os \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 \ + -Winline \ ${CLANG_OPT_SMALL} CFLAGS.gcc+= -fno-guess-branch-probability \ -fno-unit-at-a-time \ -mno-align-long-strings \ + --param max-inline-insns-single=100 LD_FLAGS=-static -N --gc-sections Modified: stable/10/sys/boot/i386/gptboot/Makefile ============================================================================== --- stable/10/sys/boot/i386/gptboot/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/sys/boot/i386/gptboot/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -35,7 +35,9 @@ CFLAGS= -DBOOTPROG=\"gptboot\" \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 + -Winline + +CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS=-static -N --gc-sections Modified: stable/10/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- stable/10/sys/boot/i386/gptzfsboot/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/sys/boot/i386/gptzfsboot/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -32,7 +32,9 @@ CFLAGS= -DBOOTPROG=\"gptzfsboot\" \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 + -Winline + +CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS=-static -N --gc-sections Modified: stable/10/sys/boot/i386/zfsboot/Makefile ============================================================================== --- stable/10/sys/boot/i386/zfsboot/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/sys/boot/i386/zfsboot/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -29,7 +29,9 @@ CFLAGS= -DBOOTPROG=\"zfsboot\" \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 + -Winline + +CFLAGS.gcc+= --param max-inline-insns-single=100 LD_FLAGS=-static -N --gc-sections Modified: stable/10/sys/boot/pc98/boot2/Makefile ============================================================================== --- stable/10/sys/boot/pc98/boot2/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/sys/boot/pc98/boot2/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -42,7 +42,9 @@ CFLAGS= -Os \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline --param max-inline-insns-single=100 + -Winline + +CFLAGS.gcc+= --param max-inline-insns-single=100 # Set machine type to PC98_SYSTEM_PARAMETER #CFLAGS+= -DSET_MACHINE_TYPE Modified: stable/10/usr.sbin/mfiutil/Makefile ============================================================================== --- stable/10/usr.sbin/mfiutil/Makefile Thu Jan 9 22:41:18 2014 (r260496) +++ stable/10/usr.sbin/mfiutil/Makefile Thu Jan 9 23:08:56 2014 (r260497) @@ -5,7 +5,7 @@ SRCS= mfiutil.c mfi_bbu.c mfi_cmd.c mfi_ mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c MAN8= mfiutil.8 -CFLAGS+= -fno-builtin-strftime +CFLAGS.gcc+= -fno-builtin-strftime DPADD= ${LIBUTIL} LDADD= -lutil From owner-svn-src-stable-10@FreeBSD.ORG Thu Jan 9 23:51:48 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B5A56E1; Thu, 9 Jan 2014 23:51:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6744E1D3C; Thu, 9 Jan 2014 23:51:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09NpmOQ001060; Thu, 9 Jan 2014 23:51:48 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09NpmX8001059; Thu, 9 Jan 2014 23:51:48 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201401092351.s09NpmX8001059@svn.freebsd.org> From: Warren Block Date: Thu, 9 Jan 2014 23:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260498 - stable/10/contrib/diff/man X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 23:51:48 -0000 Author: wblock (doc committer) Date: Thu Jan 9 23:51:47 2014 New Revision: 260498 URL: http://svnweb.freebsd.org/changeset/base/260498 Log: MFC r260358 Fix a cut and paste error. Modified: stable/10/contrib/diff/man/diff3.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/diff/man/diff3.1 ============================================================================== --- stable/10/contrib/diff/man/diff3.1 Thu Jan 9 23:08:56 2014 (r260497) +++ stable/10/contrib/diff/man/diff3.1 Thu Jan 9 23:51:47 2014 (r260498) @@ -73,6 +73,6 @@ and .B diff3 programs are properly installed at your site, the command .IP -.B info diff +.B info diff3 .PP should give you access to the complete manual. From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 07:43:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AC4E1A0; Fri, 10 Jan 2014 07:43:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EF5F0107E; Fri, 10 Jan 2014 07:43:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0A7hfNn080439; Fri, 10 Jan 2014 07:43:41 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0A7hfXQ080431; Fri, 10 Jan 2014 07:43:41 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401100743.s0A7hfXQ080431@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 10 Jan 2014 07:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260502 - in stable/10: sbin/geom/class/mirror sys/geom/mirror X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 07:43:42 -0000 Author: ae Date: Fri Jan 10 07:43:40 2014 New Revision: 260502 URL: http://svnweb.freebsd.org/changeset/base/260502 Log: MFC r258357: Add "resize" verb to gmirror(8) and such functionality to geom_mirror(4). Now it is easy to expand the size of the mirror when all its components are replaced. Also add g_resize method to geom_mirror class. It will write updated metadata to new last sector, when parent provider is resized. Modified: stable/10/sbin/geom/class/mirror/geom_mirror.c stable/10/sbin/geom/class/mirror/gmirror.8 stable/10/sys/geom/mirror/g_mirror.c stable/10/sys/geom/mirror/g_mirror_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/10/sbin/geom/class/mirror/geom_mirror.c Fri Jan 10 02:47:20 2014 (r260501) +++ stable/10/sbin/geom/class/mirror/geom_mirror.c Fri Jan 10 07:43:40 2014 (r260502) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -53,6 +54,7 @@ static void mirror_activate(struct gctl_ static void mirror_clear(struct gctl_req *req); static void mirror_dump(struct gctl_req *req); static void mirror_label(struct gctl_req *req); +static void mirror_resize(struct gctl_req *req, unsigned flags); struct g_command class_commands[] = { { "activate", G_FLAG_VERBOSE, mirror_main, G_NULL_OPTS, @@ -112,6 +114,13 @@ struct g_command class_commands[] = { { "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov ..." }, + { "resize", G_FLAG_VERBOSE, mirror_resize, + { + { 's', "size", "*", G_TYPE_STRING }, + G_OPT_SENTINEL + }, + "[-s size] [-v] name" + }, { "stop", G_FLAG_VERBOSE, NULL, { { 'f', "force", NULL, G_TYPE_BOOL }, @@ -376,3 +385,96 @@ mirror_activate(struct gctl_req *req) printf("Provider %s activated.\n", path); } } + +static struct gclass * +find_class(struct gmesh *mesh, const char *name) +{ + struct gclass *classp; + + LIST_FOREACH(classp, &mesh->lg_class, lg_class) { + if (strcmp(classp->lg_name, name) == 0) + return (classp); + } + return (NULL); +} + +static struct ggeom * +find_geom(struct gclass *classp, const char *name) +{ + struct ggeom *gp; + + LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { + if (strcmp(gp->lg_name, name) == 0) + return (gp); + } + return (NULL); +} + +static void +mirror_resize(struct gctl_req *req, unsigned flags __unused) +{ + struct gmesh mesh; + struct gclass *classp; + struct ggeom *gp; + struct gprovider *pp; + struct gconsumer *cp; + off_t size; + int error, nargs; + const char *name; + char ssize[30]; + + nargs = gctl_get_int(req, "nargs"); + if (nargs < 1) { + gctl_error(req, "Too few arguments."); + return; + } + error = geom_gettree(&mesh); + if (error) + errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); + name = gctl_get_ascii(req, "class"); + if (name == NULL) + abort(); + classp = find_class(&mesh, name); + if (classp == NULL) + errx(EXIT_FAILURE, "Class %s not found.", name); + name = gctl_get_ascii(req, "arg0"); + if (name == NULL) + abort(); + gp = find_geom(classp, name); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", name); + pp = LIST_FIRST(&gp->lg_provider); + if (pp == NULL) + errx(EXIT_FAILURE, "Provider of geom %s not found.", name); + size = pp->lg_mediasize; + name = gctl_get_ascii(req, "size"); + if (name == NULL) + errx(EXIT_FAILURE, "The size is not specified."); + if (*name == '*') { +#define CSZ(c) ((c)->lg_provider->lg_mediasize - \ + (c)->lg_provider->lg_sectorsize) + /* Find the maximum possible size */ + LIST_FOREACH(cp, &gp->lg_consumer, lg_consumer) { + if (CSZ(cp) > size) + size = CSZ(cp); + } + LIST_FOREACH(cp, &gp->lg_consumer, lg_consumer) { + if (CSZ(cp) < size) + size = CSZ(cp); + } +#undef CSZ + if (size == pp->lg_mediasize) + errx(EXIT_FAILURE, + "Cannot expand provider %s\n", + pp->lg_name); + } else { + error = g_parse_lba(name, pp->lg_sectorsize, &size); + if (error) + errc(EXIT_FAILURE, error, "Invalid size param"); + size *= pp->lg_sectorsize; + } + snprintf(ssize, sizeof(ssize), "%ju", (uintmax_t)size); + gctl_change_param(req, "size", -1, ssize); + geom_deletetree(&mesh); + gctl_issue(req); +} Modified: stable/10/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/10/sbin/geom/class/mirror/gmirror.8 Fri Jan 10 02:47:20 2014 (r260501) +++ stable/10/sbin/geom/class/mirror/gmirror.8 Fri Jan 10 07:43:40 2014 (r260502) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 8, 2009 +.Dd November 20, 2013 .Dt GMIRROR 8 .Os .Sh NAME @@ -60,6 +60,11 @@ .Ar name .Ar prov ... .Nm +.Cm resize +.Op Fl v +.Op Fl s Ar size +.Ar name +.Nm .Cm insert .Op Fl hiv .Op Fl p Ar priority @@ -193,6 +198,16 @@ balance algorithm. Rebuild the given mirror components forcibly. If autosynchronization was not turned off for the given device, this command should be unnecessary. +.It Cm resize +Change the size of the given mirror. +.Pp +Additional options include: +.Bl -tag -width ".Fl s Ar size" +.It Fl s Ar size +New size of the mirror is expressed in logical block numbers. +This option can be omitted, then it will be automatically calculated to +maximum available size. +.El .It Cm insert Add the given component(s) to the existing mirror. .Pp Modified: stable/10/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.c Fri Jan 10 02:47:20 2014 (r260501) +++ stable/10/sys/geom/mirror/g_mirror.c Fri Jan 10 07:43:40 2014 (r260502) @@ -87,6 +87,7 @@ static int g_mirror_shutdown = 0; static int g_mirror_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp); static g_taste_t g_mirror_taste; +static g_resize_t g_mirror_resize; static void g_mirror_init(struct g_class *mp); static void g_mirror_fini(struct g_class *mp); @@ -97,7 +98,8 @@ struct g_class g_mirror_class = { .taste = g_mirror_taste, .destroy_geom = g_mirror_destroy_geom, .init = g_mirror_init, - .fini = g_mirror_fini + .fini = g_mirror_fini, + .resize = g_mirror_resize }; @@ -640,9 +642,17 @@ g_mirror_write_metadata(struct g_mirror_ length = cp->provider->sectorsize; offset = cp->provider->mediasize - length; sector = malloc((size_t)length, M_MIRROR, M_WAITOK | M_ZERO); - if (md != NULL) - mirror_metadata_encode(md, sector); - error = g_write_data(cp, offset, sector, length); + if (md != NULL) { + /* + * Handle the case, when the size of parent provider reduced. + */ + if (offset < md->md_mediasize) + error = ENOSPC; + else + mirror_metadata_encode(md, sector); + } + if (error == 0) + error = g_write_data(cp, offset, sector, length); free(sector, M_MIRROR); if (error != 0) { if ((disk->d_flags & G_MIRROR_DISK_FLAG_BROKEN) == 0) { @@ -1323,7 +1333,7 @@ g_mirror_sync_request(struct bio *bp) } G_MIRROR_LOGREQ(3, bp, "Synchronization request finished."); sync = &disk->d_sync; - if (sync->ds_offset == sc->sc_mediasize || + if (sync->ds_offset >= sc->sc_mediasize || sync->ds_consumer == NULL || (sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { /* Don't send more synchronization requests. */ @@ -2717,12 +2727,14 @@ g_mirror_check_metadata(struct g_mirror_ "md_balance", pp->name, sc->sc_name); return (EINVAL); } +#if 0 if (md->md_mediasize != sc->sc_mediasize) { G_MIRROR_DEBUG(1, "Invalid '%s' field on disk %s (device %s), skipping.", "md_mediasize", pp->name, sc->sc_name); return (EINVAL); } +#endif if (sc->sc_mediasize > pp->mediasize) { G_MIRROR_DEBUG(1, "Invalid size of disk %s (device %s), skipping.", pp->name, @@ -3115,6 +3127,22 @@ g_mirror_taste(struct g_class *mp, struc return (gp); } +static void +g_mirror_resize(struct g_consumer *cp) +{ + struct g_mirror_disk *disk; + + g_topology_assert(); + g_trace(G_T_TOPOLOGY, "%s(%s)", __func__, cp->provider->name); + + disk = cp->private; + if (disk == NULL) + return; + g_topology_unlock(); + g_mirror_update_metadata(disk); + g_topology_lock(); +} + static int g_mirror_destroy_geom(struct gctl_req *req __unused, struct g_class *mp __unused, struct g_geom *gp) Modified: stable/10/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror_ctl.c Fri Jan 10 02:47:20 2014 (r260501) +++ stable/10/sys/geom/mirror/g_mirror_ctl.c Fri Jan 10 07:43:40 2014 (r260502) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -617,6 +619,75 @@ g_mirror_ctl_remove(struct gctl_req *req } static void +g_mirror_ctl_resize(struct gctl_req *req, struct g_class *mp) +{ + struct g_mirror_softc *sc; + struct g_mirror_disk *disk; + uint64_t mediasize; + const char *name, *s; + char *x; + int *nargs; + + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No '%s' argument.", "nargs"); + return; + } + if (*nargs != 1) { + gctl_error(req, "Missing device."); + return; + } + name = gctl_get_asciiparam(req, "arg0"); + if (name == NULL) { + gctl_error(req, "No 'arg%u' argument.", 0); + return; + } + s = gctl_get_asciiparam(req, "size"); + if (s == NULL) { + gctl_error(req, "No '%s' argument.", "size"); + return; + } + mediasize = strtouq(s, &x, 0); + if (*x != '\0' || mediasize == 0) { + gctl_error(req, "Invalid '%s' argument.", "size"); + return; + } + sc = g_mirror_find_device(mp, name); + if (sc == NULL) { + gctl_error(req, "No such device: %s.", name); + return; + } + /* Deny shrinking of an opened provider */ + if ((g_debugflags & 16) == 0 && (sc->sc_provider->acr > 0 || + sc->sc_provider->acw > 0 || sc->sc_provider->ace > 0)) { + if (sc->sc_mediasize > mediasize) { + gctl_error(req, "Device %s is busy.", + sc->sc_provider->name); + sx_xunlock(&sc->sc_lock); + return; + } + } + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + if (mediasize > disk->d_consumer->provider->mediasize - + disk->d_consumer->provider->sectorsize) { + gctl_error(req, "Provider %s is too small.", + disk->d_name); + sx_xunlock(&sc->sc_lock); + return; + } + } + /* Update the size. */ + sc->sc_mediasize = mediasize; + LIST_FOREACH(disk, &sc->sc_disks, d_next) { + g_mirror_update_metadata(disk); + } + g_topology_lock(); + g_resize_provider(sc->sc_provider, mediasize); + g_topology_unlock(); + sx_xunlock(&sc->sc_lock); +} + +static void g_mirror_ctl_deactivate(struct gctl_req *req, struct g_class *mp) { struct g_mirror_softc *sc; @@ -793,6 +864,8 @@ g_mirror_config(struct gctl_req *req, st g_mirror_ctl_insert(req, mp); else if (strcmp(verb, "remove") == 0) g_mirror_ctl_remove(req, mp); + else if (strcmp(verb, "resize") == 0) + g_mirror_ctl_resize(req, mp); else if (strcmp(verb, "deactivate") == 0) g_mirror_ctl_deactivate(req, mp); else if (strcmp(verb, "forget") == 0) From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 07:48:37 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C767149E; Fri, 10 Jan 2014 07:48:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B12E510B2; Fri, 10 Jan 2014 07:48:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0A7mbW1081051; Fri, 10 Jan 2014 07:48:37 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0A7ma51081044; Fri, 10 Jan 2014 07:48:36 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401100748.s0A7ma51081044@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 10 Jan 2014 07:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260503 - in stable/10: sbin/geom/class/mirror sys/geom/mirror X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 07:48:38 -0000 Author: ae Date: Fri Jan 10 07:48:36 2014 New Revision: 260503 URL: http://svnweb.freebsd.org/changeset/base/260503 Log: MFC r259634: Prevent users from deactivating the last component of a mirror. MFC r259929: Add an ability to stop gmirror and clear its metadata in one command. This fixes the problem, when gmirror starts again just after stop. The problem occurs when gmirror's component has geom label with equal size. E.g. gpt and gptid have the same size as partition, diskid has the same size as entire disk. When gmirror's geom has been destroyed, glabel creates its providers and this initiate retaste. Now "gmirror destroy" command is available. It destroys geom and also erases gmirror's metadata. PR: 184985 Modified: stable/10/sbin/geom/class/mirror/geom_mirror.c stable/10/sbin/geom/class/mirror/gmirror.8 stable/10/sys/geom/mirror/g_mirror.c stable/10/sys/geom/mirror/g_mirror.h stable/10/sys/geom/mirror/g_mirror_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- stable/10/sbin/geom/class/mirror/geom_mirror.c Fri Jan 10 07:43:40 2014 (r260502) +++ stable/10/sbin/geom/class/mirror/geom_mirror.c Fri Jan 10 07:48:36 2014 (r260503) @@ -82,6 +82,13 @@ struct g_command class_commands[] = { { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov ..." }, + { "destroy", G_FLAG_VERBOSE, NULL, + { + { 'f', "force", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-fv] name ..." + }, { "dump", 0, mirror_main, G_NULL_OPTS, "prov ..." }, Modified: stable/10/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- stable/10/sbin/geom/class/mirror/gmirror.8 Fri Jan 10 07:43:40 2014 (r260502) +++ stable/10/sbin/geom/class/mirror/gmirror.8 Fri Jan 10 07:48:36 2014 (r260503) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2013 +.Dd December 27, 2013 .Dt GMIRROR 8 .Os .Sh NAME @@ -86,6 +86,10 @@ .Ar name .Ar prov ... .Nm +.Cm destroy +.Op Fl fv +.Ar name ... +.Nm .Cm forget .Op Fl v .Ar name ... @@ -227,6 +231,14 @@ Activate the given component(s), which w .It Cm deactivate Mark the given component(s) as inactive, so it will not be automatically connected to the mirror. +.It Cm destroy +Stop the given mirror and clear metadata on all its components. +.Pp +Additional options include: +.Bl -tag -width ".Fl f" +.It Fl f +Stop the given mirror even if it is opened. +.El .It Cm forget Forget about components which are not connected. This command is useful when a disk has failed and cannot be reconnected, preventing the Modified: stable/10/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.c Fri Jan 10 07:43:40 2014 (r260502) +++ stable/10/sys/geom/mirror/g_mirror.c Fri Jan 10 07:48:36 2014 (r260503) @@ -642,7 +642,8 @@ g_mirror_write_metadata(struct g_mirror_ length = cp->provider->sectorsize; offset = cp->provider->mediasize - length; sector = malloc((size_t)length, M_MIRROR, M_WAITOK | M_ZERO); - if (md != NULL) { + if (md != NULL && + (sc->sc_flags & G_MIRROR_DEVICE_FLAG_WIPE) == 0) { /* * Handle the case, when the size of parent provider reduced. */ @@ -749,7 +750,8 @@ g_mirror_update_metadata(struct g_mirror sc = disk->d_softc; sx_assert(&sc->sc_lock, SX_LOCKED); - g_mirror_fill_metadata(sc, disk, &md); + if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_WIPE) == 0) + g_mirror_fill_metadata(sc, disk, &md); error = g_mirror_write_metadata(disk, &md); if (error == 0) { G_MIRROR_DEBUG(2, "Metadata on %s updated.", Modified: stable/10/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.h Fri Jan 10 07:43:40 2014 (r260502) +++ stable/10/sys/geom/mirror/g_mirror.h Fri Jan 10 07:48:36 2014 (r260503) @@ -160,6 +160,7 @@ struct g_mirror_event { #define G_MIRROR_DEVICE_FLAG_WAIT 0x0200000000000000ULL #define G_MIRROR_DEVICE_FLAG_DESTROYING 0x0400000000000000ULL #define G_MIRROR_DEVICE_FLAG_TASTING 0x0800000000000000ULL +#define G_MIRROR_DEVICE_FLAG_WIPE 0x1000000000000000ULL #define G_MIRROR_DEVICE_STATE_STARTING 0 #define G_MIRROR_DEVICE_STATE_RUNNING 1 Modified: stable/10/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror_ctl.c Fri Jan 10 07:43:40 2014 (r260502) +++ stable/10/sys/geom/mirror/g_mirror_ctl.c Fri Jan 10 07:48:36 2014 (r260503) @@ -695,7 +695,7 @@ g_mirror_ctl_deactivate(struct gctl_req const char *name; char param[16]; int *nargs; - u_int i; + u_int i, active; nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { @@ -716,6 +716,7 @@ g_mirror_ctl_deactivate(struct gctl_req gctl_error(req, "No such device: %s.", name); return; } + active = g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE); for (i = 1; i < (u_int)*nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); name = gctl_get_asciiparam(req, param); @@ -728,6 +729,16 @@ g_mirror_ctl_deactivate(struct gctl_req gctl_error(req, "No such provider: %s.", name); continue; } + if (disk->d_state == G_MIRROR_DISK_STATE_ACTIVE) { + if (active > 1) + active--; + else { + gctl_error(req, "%s: Can't deactivate the " + "last ACTIVE component %s.", + sc->sc_geom->name, name); + continue; + } + } disk->d_flags |= G_MIRROR_DISK_FLAG_INACTIVE; disk->d_flags &= ~G_MIRROR_DISK_FLAG_FORCE_SYNC; g_mirror_update_metadata(disk); @@ -786,7 +797,7 @@ g_mirror_ctl_forget(struct gctl_req *req } static void -g_mirror_ctl_stop(struct gctl_req *req, struct g_class *mp) +g_mirror_ctl_stop(struct gctl_req *req, struct g_class *mp, int wipe) { struct g_mirror_softc *sc; int *force, *nargs, error; @@ -827,10 +838,14 @@ g_mirror_ctl_stop(struct gctl_req *req, return; } g_cancel_event(sc); + if (wipe) + sc->sc_flags |= G_MIRROR_DEVICE_FLAG_WIPE; error = g_mirror_destroy(sc, how); if (error != 0) { gctl_error(req, "Cannot destroy device %s (error=%d).", sc->sc_geom->name, error); + if (wipe) + sc->sc_flags &= ~G_MIRROR_DEVICE_FLAG_WIPE; sx_xunlock(&sc->sc_lock); return; } @@ -871,7 +886,9 @@ g_mirror_config(struct gctl_req *req, st else if (strcmp(verb, "forget") == 0) g_mirror_ctl_forget(req, mp); else if (strcmp(verb, "stop") == 0) - g_mirror_ctl_stop(req, mp); + g_mirror_ctl_stop(req, mp, 0); + else if (strcmp(verb, "destroy") == 0) + g_mirror_ctl_stop(req, mp, 1); else gctl_error(req, "Unknown verb."); g_topology_lock(); From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 09:45:29 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98B6DCEE; Fri, 10 Jan 2014 09:45:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 794EB19D2; Fri, 10 Jan 2014 09:45:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0A9jTBZ028501; Fri, 10 Jan 2014 09:45:29 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0A9jSUk028492; Fri, 10 Jan 2014 09:45:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401100945.s0A9jSUk028492@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 10 Jan 2014 09:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260504 - in stable/10/sys: netinet netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 09:45:29 -0000 Author: ae Date: Fri Jan 10 09:45:28 2014 New Revision: 260504 URL: http://svnweb.freebsd.org/changeset/base/260504 Log: MFC r260151 (by adrian): Use an RLOCK here instead of an RWLOCK - matching all the other calls to lla_lookup(). This drastically reduces the very high lock contention when doing parallel TCP throughput tests (> 1024 sockets) with IPv6. MFC r260187: lla_lookup() does modification only when LLE_CREATE is specified. Thus we can use IF_AFDATA_RLOCK() instead of IF_AFDATA_LOCK() when doing lla_lookup() without LLE_CREATE flag. MFC r260217: Add IF_AFDATA_WLOCK_ASSERT() in case lla_lookup() is called with LLE_CREATE flag. Modified: stable/10/sys/netinet/if_ether.c stable/10/sys/netinet/in.c stable/10/sys/netinet6/in6.c stable/10/sys/netinet6/nd6.c stable/10/sys/netinet6/nd6_nbr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/if_ether.c ============================================================================== --- stable/10/sys/netinet/if_ether.c Fri Jan 10 07:48:36 2014 (r260503) +++ stable/10/sys/netinet/if_ether.c Fri Jan 10 09:45:28 2014 (r260504) @@ -153,10 +153,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t addr4.sin_len = sizeof(addr4); addr4.sin_family = AF_INET; addr4.sin_addr.s_addr = addr; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), (struct sockaddr *)&addr4); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); } #endif @@ -805,9 +805,9 @@ reply: struct llentry *lle = NULL; sin.sin_addr = itaddr; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((lle != NULL) && (lle->la_flags & LLE_PUB)) { (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); Modified: stable/10/sys/netinet/in.c ============================================================================== --- stable/10/sys/netinet/in.c Fri Jan 10 07:48:36 2014 (r260503) +++ stable/10/sys/netinet/in.c Fri Jan 10 09:45:28 2014 (r260504) @@ -1435,6 +1435,7 @@ in_lltable_lookup(struct lltable *llt, u #endif if (!(flags & LLE_CREATE)) return (NULL); + IF_AFDATA_WLOCK_ASSERT(ifp); /* * A route that covers the given address must have * been installed 1st because we are doing a resolution, Modified: stable/10/sys/netinet6/in6.c ============================================================================== --- stable/10/sys/netinet6/in6.c Fri Jan 10 07:48:36 2014 (r260503) +++ stable/10/sys/netinet6/in6.c Fri Jan 10 09:45:28 2014 (r260504) @@ -2627,6 +2627,7 @@ in6_lltable_lookup(struct lltable *llt, if (lle == NULL) { if (!(flags & LLE_CREATE)) return (NULL); + IF_AFDATA_WLOCK_ASSERT(ifp); /* * A route that covers the given address must have * been installed 1st because we are doing a resolution, Modified: stable/10/sys/netinet6/nd6.c ============================================================================== --- stable/10/sys/netinet6/nd6.c Fri Jan 10 07:48:36 2014 (r260503) +++ stable/10/sys/netinet6/nd6.c Fri Jan 10 09:45:28 2014 (r260504) @@ -1146,9 +1146,9 @@ nd6_nud_hint(struct rtentry *rt, struct return; ifp = rt->rt_ifp; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(dst6, ND6_EXCLUSIVE, NULL); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) return; @@ -1574,16 +1574,16 @@ nd6_cache_lladdr(struct ifnet *ifp, stru * description on it in NS section (RFC 2461 7.2.3). */ flags = lladdr ? ND6_EXCLUSIVE : 0; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(from, flags, ifp); - + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) { flags |= ND6_EXCLUSIVE; + IF_AFDATA_LOCK(ifp); ln = nd6_lookup(from, flags | ND6_CREATE, ifp); IF_AFDATA_UNLOCK(ifp); is_newentry = 1; } else { - IF_AFDATA_UNLOCK(ifp); /* do nothing if static ndp is set */ if (ln->la_flags & LLE_STATIC) { static_route = 1; @@ -1891,9 +1891,9 @@ nd6_output_lle(struct ifnet *ifp, struct flags = ((m != NULL) || (lle != NULL)) ? LLE_EXCLUSIVE : 0; if (ln == NULL) { retry: - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), Modified: stable/10/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/10/sys/netinet6/nd6_nbr.c Fri Jan 10 07:48:36 2014 (r260503) +++ stable/10/sys/netinet6/nd6_nbr.c Fri Jan 10 09:45:28 2014 (r260504) @@ -736,9 +736,9 @@ nd6_na_input(struct mbuf *m, int off, in * If no neighbor cache entry is found, NA SHOULD silently be * discarded. */ - IF_AFDATA_LOCK(ifp); + IF_AFDATA_RLOCK(ifp); ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp); - IF_AFDATA_UNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) { goto freeit; } From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 16:57:00 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AB75F2C; Fri, 10 Jan 2014 16:57:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E036E1B6C; Fri, 10 Jan 2014 16:56:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0AGux1G093546; Fri, 10 Jan 2014 16:56:59 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0AGuxNV093545; Fri, 10 Jan 2014 16:56:59 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201401101656.s0AGuxNV093545@svn.freebsd.org> From: Alan Somers Date: Fri, 10 Jan 2014 16:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260517 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 16:57:00 -0000 Author: asomers Date: Fri Jan 10 16:56:59 2014 New Revision: 260517 URL: http://svnweb.freebsd.org/changeset/base/260517 Log: MFC 259240 sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c When a da or ada device dissappears, outstanding IOs fail with ENXIO, not EIO. The check for EIO was probably copied from Illumos, where that is indeed the correct errno. Without this change, pulling a busy drive from a zpool would usually turn it into UNAVAIL, even though pulling an idle drive would turn it into REMOVED. With this change, it is REMOVED every time. Also, vdev_geom_io_intr shouldn't do zfs_post_remove, because that results in devd getting two resource.fs.zfs.removed events. The comment said that the event had to be sent directly instead of through the async removal thread because "the DE engine is using this information to discard prevoius I/O errors". However, the fact that vdev_geom_io_intr was never actually sending the events until now, and that vdev_geom_orphan never sent them at all, and that vdev_geom_orphan usually gets called about 2 seconds after the actual removal, means that FreeBSD's userland can cope with a late event just fine. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Jan 10 16:01:44 2014 (r260516) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Jan 10 16:56:59 2014 (r260517) @@ -735,20 +735,12 @@ vdev_geom_io_intr(struct bio *bp) */ vd->vdev_notrim = B_TRUE; } - if (zio->io_error == EIO && !vd->vdev_remove_wanted) { + if (zio->io_error == ENXIO && !vd->vdev_remove_wanted) { /* * If provider's error is set we assume it is being * removed. */ if (bp->bio_to->error != 0) { - /* - * We post the resource as soon as possible, instead of - * when the async removal actually happens, because the - * DE is using this information to discard previous I/O - * errors. - */ - /* XXX: zfs_post_remove() can sleep. */ - zfs_post_remove(zio->io_spa, vd); vd->vdev_remove_wanted = B_TRUE; spa_async_request(zio->io_spa, SPA_ASYNC_REMOVE); } else if (!vd->vdev_delayed_close) { From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 17:31:03 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E24D5CDB; Fri, 10 Jan 2014 17:31:03 +0000 (UTC) Received: from mail-qa0-x231.google.com (mail-qa0-x231.google.com [IPv6:2607:f8b0:400d:c00::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A4161EFF; Fri, 10 Jan 2014 17:31:03 +0000 (UTC) Received: by mail-qa0-f49.google.com with SMTP id w8so2976475qac.36 for ; Fri, 10 Jan 2014 09:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Ehl5DHuFCJDXDHYhPSfY6rZhCmXXvSbnQb2eR1uW5+g=; b=Ul3SEv47fEgN9a75Rqw7+0i4eB+afbXV9E7wl16jAhqEewo6aUurJhXASrz0jjpAYp BZqkGTAeR2CrrQndI2mVAb1GIU/aBCjz5HugPSwaLFjfPIoIOLlIIFNgddK7OVHcyEpQ pJZZ9Qy7qR3bkwJYZBFAlnM9szfUwCC7sMdE0ZUMKRHpYpAfa5SxV6+eL540jmCoSl2m cMFnFi1SwoN3MJAyt03ldwENu0bMjCFBJwcWRrm7tIzCv8OtSondoIc3YW8qi97rKzI9 WMUxOPxfImCS2B/dx98tx2giQWPHUI/QBiZhyNMqwixqrPblW1rqRiYjLDnKGLykYM7d kbGw== MIME-Version: 1.0 X-Received: by 10.49.24.19 with SMTP id q19mr9729420qef.17.1389375061026; Fri, 10 Jan 2014 09:31:01 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Fri, 10 Jan 2014 09:31:00 -0800 (PST) In-Reply-To: <201401100945.s0A9jSUk028492@svn.freebsd.org> References: <201401100945.s0A9jSUk028492@svn.freebsd.org> Date: Fri, 10 Jan 2014 09:31:00 -0800 X-Google-Sender-Auth: qj9FY0e9wjRsMiCEgA57BezYW_s Message-ID: Subject: Re: svn commit: r260504 - in stable/10/sys: netinet netinet6 From: Adrian Chadd To: "Andrey V. Elsukov" Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 17:31:04 -0000 Hah, thanks for beating me to the MFC. :) -a On 10 January 2014 01:45, Andrey V. Elsukov wrote: > Author: ae > Date: Fri Jan 10 09:45:28 2014 > New Revision: 260504 > URL: http://svnweb.freebsd.org/changeset/base/260504 > > Log: > MFC r260151 (by adrian): > Use an RLOCK here instead of an RWLOCK - matching all the other calls > to lla_lookup(). > > This drastically reduces the very high lock contention when doing parallel > TCP throughput tests (> 1024 sockets) with IPv6. > > MFC r260187: > lla_lookup() does modification only when LLE_CREATE is specified. > Thus we can use IF_AFDATA_RLOCK() instead of IF_AFDATA_LOCK() when doing > lla_lookup() without LLE_CREATE flag. > > MFC r260217: > Add IF_AFDATA_WLOCK_ASSERT() in case lla_lookup() is called with > LLE_CREATE flag. > > Modified: > stable/10/sys/netinet/if_ether.c > stable/10/sys/netinet/in.c > stable/10/sys/netinet6/in6.c > stable/10/sys/netinet6/nd6.c > stable/10/sys/netinet6/nd6_nbr.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sys/netinet/if_ether.c > ============================================================================== > --- stable/10/sys/netinet/if_ether.c Fri Jan 10 07:48:36 2014 (r260503) > +++ stable/10/sys/netinet/if_ether.c Fri Jan 10 09:45:28 2014 (r260504) > @@ -153,10 +153,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t > addr4.sin_len = sizeof(addr4); > addr4.sin_family = AF_INET; > addr4.sin_addr.s_addr = addr; > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), > (struct sockaddr *)&addr4); > - IF_AFDATA_UNLOCK(ifp); > + IF_AFDATA_RUNLOCK(ifp); > } > #endif > > @@ -805,9 +805,9 @@ reply: > struct llentry *lle = NULL; > > sin.sin_addr = itaddr; > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin); > - IF_AFDATA_UNLOCK(ifp); > + IF_AFDATA_RUNLOCK(ifp); > > if ((lle != NULL) && (lle->la_flags & LLE_PUB)) { > (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); > > Modified: stable/10/sys/netinet/in.c > ============================================================================== > --- stable/10/sys/netinet/in.c Fri Jan 10 07:48:36 2014 (r260503) > +++ stable/10/sys/netinet/in.c Fri Jan 10 09:45:28 2014 (r260504) > @@ -1435,6 +1435,7 @@ in_lltable_lookup(struct lltable *llt, u > #endif > if (!(flags & LLE_CREATE)) > return (NULL); > + IF_AFDATA_WLOCK_ASSERT(ifp); > /* > * A route that covers the given address must have > * been installed 1st because we are doing a resolution, > > Modified: stable/10/sys/netinet6/in6.c > ============================================================================== > --- stable/10/sys/netinet6/in6.c Fri Jan 10 07:48:36 2014 (r260503) > +++ stable/10/sys/netinet6/in6.c Fri Jan 10 09:45:28 2014 (r260504) > @@ -2627,6 +2627,7 @@ in6_lltable_lookup(struct lltable *llt, > if (lle == NULL) { > if (!(flags & LLE_CREATE)) > return (NULL); > + IF_AFDATA_WLOCK_ASSERT(ifp); > /* > * A route that covers the given address must have > * been installed 1st because we are doing a resolution, > > Modified: stable/10/sys/netinet6/nd6.c > ============================================================================== > --- stable/10/sys/netinet6/nd6.c Fri Jan 10 07:48:36 2014 (r260503) > +++ stable/10/sys/netinet6/nd6.c Fri Jan 10 09:45:28 2014 (r260504) > @@ -1146,9 +1146,9 @@ nd6_nud_hint(struct rtentry *rt, struct > return; > > ifp = rt->rt_ifp; > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > ln = nd6_lookup(dst6, ND6_EXCLUSIVE, NULL); > - IF_AFDATA_UNLOCK(ifp); > + IF_AFDATA_RUNLOCK(ifp); > if (ln == NULL) > return; > > @@ -1574,16 +1574,16 @@ nd6_cache_lladdr(struct ifnet *ifp, stru > * description on it in NS section (RFC 2461 7.2.3). > */ > flags = lladdr ? ND6_EXCLUSIVE : 0; > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > ln = nd6_lookup(from, flags, ifp); > - > + IF_AFDATA_RUNLOCK(ifp); > if (ln == NULL) { > flags |= ND6_EXCLUSIVE; > + IF_AFDATA_LOCK(ifp); > ln = nd6_lookup(from, flags | ND6_CREATE, ifp); > IF_AFDATA_UNLOCK(ifp); > is_newentry = 1; > } else { > - IF_AFDATA_UNLOCK(ifp); > /* do nothing if static ndp is set */ > if (ln->la_flags & LLE_STATIC) { > static_route = 1; > @@ -1891,9 +1891,9 @@ nd6_output_lle(struct ifnet *ifp, struct > flags = ((m != NULL) || (lle != NULL)) ? LLE_EXCLUSIVE : 0; > if (ln == NULL) { > retry: > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); > - IF_AFDATA_UNLOCK(ifp); > + IF_AFDATA_RUNLOCK(ifp); > if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { > /* > * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), > > Modified: stable/10/sys/netinet6/nd6_nbr.c > ============================================================================== > --- stable/10/sys/netinet6/nd6_nbr.c Fri Jan 10 07:48:36 2014 (r260503) > +++ stable/10/sys/netinet6/nd6_nbr.c Fri Jan 10 09:45:28 2014 (r260504) > @@ -736,9 +736,9 @@ nd6_na_input(struct mbuf *m, int off, in > * If no neighbor cache entry is found, NA SHOULD silently be > * discarded. > */ > - IF_AFDATA_LOCK(ifp); > + IF_AFDATA_RLOCK(ifp); > ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp); > - IF_AFDATA_UNLOCK(ifp); > + IF_AFDATA_RUNLOCK(ifp); > if (ln == NULL) { > goto freeit; > } From owner-svn-src-stable-10@FreeBSD.ORG Fri Jan 10 17:56:24 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8C1731F; Fri, 10 Jan 2014 17:56:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9490C10A2; Fri, 10 Jan 2014 17:56:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0AHuO2c017064; Fri, 10 Jan 2014 17:56:24 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0AHuOTm017062; Fri, 10 Jan 2014 17:56:24 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201401101756.s0AHuOTm017062@svn.freebsd.org> From: Alan Somers Date: Fri, 10 Jan 2014 17:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260519 - in stable/10: etc sbin/devd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jan 2014 17:56:24 -0000 Author: asomers Date: Fri Jan 10 17:56:23 2014 New Revision: 260519 URL: http://svnweb.freebsd.org/changeset/base/260519 Log: MFC 259339 sbin/devd/devd.cc Increase the size of devd's client socket's send buffer from the default (8k) to 128k. This prevents clients from getting POLLHUPped during event storms. For example, during zpool creation, the kernel emits a resource.fs.zfs.statechange event for every vdev in the pool. A 128k buffer is large enough to hold the statechange events for a pool with nearly 800 drives. MFC 259362 sbin/devd/devd.cc Promoting the SIGINFO handler's log message from LOG_INFO to LOG_NOTICE, and promoting the "Processing event ..." message from LOG_DEBUG to LOG_INFO. Setting the logfile to LOG_NOTICE with this change will have the same result as setting it to LOG_INFO without this change. Setting it to LOG_INFO with this change will include the useful "Processing event ..." messages that were previously at LOG_DEBUG, without including useless messages like "Pushing table". The intent of this change is that one can log "Processing event ..." without logging "Pushing table" and related messages that are sent for every event. The number of lines actually logged is reduced by about 75% by making this change and setting syslog to LOG_INFO vs setting syslog to LOG_DEBUG. etc/syslog.conf Changing the recommended loglevel to notice instead of info. Modified: stable/10/etc/syslog.conf stable/10/sbin/devd/devd.cc Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/syslog.conf ============================================================================== --- stable/10/etc/syslog.conf Fri Jan 10 17:40:29 2014 (r260518) +++ stable/10/etc/syslog.conf Fri Jan 10 17:56:23 2014 (r260519) @@ -30,7 +30,7 @@ cron.* /var/log/cron # news.notice /var/log/news/news.notice # Uncomment this if you wish to see messages produced by devd # !devd -# *.>=info /var/log/devd.log +# *.>=notice /var/log/devd.log !ppp *.* /var/log/ppp.log !* Modified: stable/10/sbin/devd/devd.cc ============================================================================== --- stable/10/sbin/devd/devd.cc Fri Jan 10 17:40:29 2014 (r260518) +++ stable/10/sbin/devd/devd.cc Fri Jan 10 17:56:23 2014 (r260519) @@ -104,6 +104,19 @@ __FBSDID("$FreeBSD$"); #define CF "/etc/devd.conf" #define SYSCTL "hw.bus.devctl_disable" +/* + * Since the client socket is nonblocking, we must increase its send buffer to + * handle brief event storms. On FreeBSD, AF_UNIX sockets don't have a receive + * buffer, so the client can't increate the buffersize by itself. + * + * For example, when creating a ZFS pool, devd emits one 165 character + * resource.fs.zfs.statechange message for each vdev in the pool. A 64k + * buffer has enough space for almost 400 drives, which would be very large but + * not impossibly large pool. A 128k buffer has enough space for 794 drives, + * which is more than can fit in a rack with modern technology. + */ +#define CLIENT_BUFSIZE 131072 + using namespace std; extern FILE *yyin; @@ -759,7 +772,7 @@ process_event(char *buffer) char *sp; sp = buffer + 1; - devdlog(LOG_DEBUG, "Processing event '%s'\n", buffer); + devdlog(LOG_INFO, "Processing event '%s'\n", buffer); type = *buffer++; cfg.push_var_table(); // No match doesn't have a device, and the format is a little @@ -892,6 +905,7 @@ void new_client(int fd) { int s; + int sndbuf_size; /* * First go reap any zombie clients, then accept the connection, and @@ -901,10 +915,15 @@ new_client(int fd) check_clients(); s = accept(fd, NULL, NULL); if (s != -1) { + sndbuf_size = CLIENT_BUFSIZE; + if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sndbuf_size, + sizeof(sndbuf_size))) + err(1, "setsockopt"); shutdown(s, SHUT_RD); clients.push_back(s); ++num_clients; - } + } else + err(1, "accept"); } static void @@ -970,7 +989,7 @@ event_loop(void) } rv = select(max_fd, &fds, NULL, NULL, &tv); if (got_siginfo) { - devdlog(LOG_INFO, "Events received so far=%u\n", + devdlog(LOG_NOTICE, "Events received so far=%u\n", total_events); got_siginfo = 0; } From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 11 01:44:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11228DB0; Sat, 11 Jan 2014 01:44:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F00FC1370; Sat, 11 Jan 2014 01:44:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0B1iMoH097550; Sat, 11 Jan 2014 01:44:22 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0B1iM0t097549; Sat, 11 Jan 2014 01:44:22 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401110144.s0B1iM0t097549@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sat, 11 Jan 2014 01:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260528 - stable/10/contrib/gcc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jan 2014 01:44:23 -0000 Author: pfg Date: Sat Jan 11 01:44:22 2014 New Revision: 260528 URL: http://svnweb.freebsd.org/changeset/base/260528 Log: MFC r260361: gcc: Fix optimization bug. GCC-PR rtl-optimization/34628 * combine.c (try_combine): Stop and undo after the first combination if an autoincrement side-effect on the first insn has effectively been lost. Modified: stable/10/contrib/gcc/combine.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/gcc/combine.c ============================================================================== --- stable/10/contrib/gcc/combine.c Sat Jan 11 00:00:11 2014 (r260527) +++ stable/10/contrib/gcc/combine.c Sat Jan 11 01:44:22 2014 (r260528) @@ -2370,12 +2370,17 @@ try_combine (rtx i3, rtx i2, rtx i1, int if (i1 && GET_CODE (newpat) != CLOBBER) { - /* Before we can do this substitution, we must redo the test done - above (see detailed comments there) that ensures that I1DEST - isn't mentioned in any SETs in NEWPAT that are field assignments. */ - - if (! combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX, - 0, (rtx*) 0)) + /* Check that an autoincrement side-effect on I1 has not been lost. + This happens if I1DEST is mentioned in I2 and dies there, and + has disappeared from the new pattern. */ + if ((FIND_REG_INC_NOTE (i1, NULL_RTX) != 0 + && !i1_feeds_i3 + && dead_or_set_p (i2, i1dest) + && !reg_overlap_mentioned_p (i1dest, newpat)) + /* Before we can do this substitution, we must redo the test done + above (see detailed comments there) that ensures that I1DEST + isn't mentioned in any SETs in NEWPAT that are field assignments. */ + || !combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX, 0, 0)) { undo_all (); return 0; From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 11 08:21:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 911BD8AF; Sat, 11 Jan 2014 08:21:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7C2F71D21; Sat, 11 Jan 2014 08:21:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0B8LEXH049925; Sat, 11 Jan 2014 08:21:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0B8LEC4049924; Sat, 11 Jan 2014 08:21:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401110821.s0B8LEC4049924@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 11 Jan 2014 08:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260537 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jan 2014 08:21:14 -0000 Author: hselasky Date: Sat Jan 11 08:21:13 2014 New Revision: 260537 URL: http://svnweb.freebsd.org/changeset/base/260537 Log: MFC r260184: Minor correction for the XHCI reset logic. Modified: stable/10/sys/dev/usb/controller/xhci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Sat Jan 11 08:16:31 2014 (r260536) +++ stable/10/sys/dev/usb/controller/xhci.c Sat Jan 11 08:21:13 2014 (r260537) @@ -386,8 +386,8 @@ xhci_start_controller(struct xhci_softc for (i = 0; i != 100; i++) { usb_pause_mtx(NULL, hz / 100); - temp = XREAD4(sc, oper, XHCI_USBCMD) & - (XHCI_CMD_HCRST | XHCI_STS_CNR); + temp = (XREAD4(sc, oper, XHCI_USBCMD) & XHCI_CMD_HCRST) | + (XREAD4(sc, oper, XHCI_USBSTS) & XHCI_STS_CNR); if (!temp) break; } From owner-svn-src-stable-10@FreeBSD.ORG Sat Jan 11 23:10:59 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFD0ED1B; Sat, 11 Jan 2014 23:10:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9B2B71E8F; Sat, 11 Jan 2014 23:10:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0BNAxD4098694; Sat, 11 Jan 2014 23:10:59 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0BNAxpI098693; Sat, 11 Jan 2014 23:10:59 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <201401112310.s0BNAxpI098693@svn.freebsd.org> From: Remko Lodder Date: Sat, 11 Jan 2014 23:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r260558 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jan 2014 23:10:59 -0000 Author: remko Date: Sat Jan 11 23:10:59 2014 New Revision: 260558 URL: http://svnweb.freebsd.org/changeset/base/260558 Log: MFC r260446 virtio-block does not exist, the correct name is virtio-blk. PR: 185573 Submitted by: Allan Jude Facilitated by: Snow B.V. Modified: stable/10/usr.sbin/bhyve/bhyve.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/10/usr.sbin/bhyve/bhyve.8 Sat Jan 11 22:41:10 2014 (r260557) +++ stable/10/usr.sbin/bhyve/bhyve.8 Sat Jan 11 23:10:59 2014 (r260558) @@ -120,7 +120,7 @@ emulation is identical but uses a PCI ve PCI pass-through device. .It Li virtio-net Virtio network interface. -.It Li virtio-block +.It Li virtio-blk Virtio block storage interface. .It Li ahci-cd AHCI controller attached to an ATAPI CD/DVD.