From owner-svn-src-head@FreeBSD.ORG Tue Dec 31 23:59:35 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3623FEB; Tue, 31 Dec 2013 23:59:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 83E2419DC; Tue, 31 Dec 2013 23:59:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBVNxZlb046335; Tue, 31 Dec 2013 23:59:35 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBVNxYle046329; Tue, 31 Dec 2013 23:59:34 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201312312359.rBVNxYle046329@svn.freebsd.org> From: Steve Kargl Date: Tue, 31 Dec 2013 23:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260145 - in head/lib/msun: man src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Dec 2013 23:59:35 -0000 Author: kargl Date: Tue Dec 31 23:59:33 2013 New Revision: 260145 URL: http://svnweb.freebsd.org/changeset/base/260145 Log: * msun/man/cosh.3: * msun/man/sinh.3: * msun/man/tanh.3: . Fix grammar. * msun/src/e_coshl.c: * msun/src/e_sinhl.c: . Fix comment. * msun/src/s_tanhl.c: . Remove unused variables. . Fix location/indentation of comments. . Use comparison involving ints instead of long double. . Re-order polynomial evaluation on ld128 for |x| < 0.25. For now, retain the older order in an "#if 0 ... #else" block. . Use int comparison to short-circuit the |x| < 1.5 condition. Requested by: bde Modified: head/lib/msun/man/cosh.3 head/lib/msun/man/sinh.3 head/lib/msun/man/tanh.3 head/lib/msun/src/e_coshl.c head/lib/msun/src/e_sinhl.c head/lib/msun/src/s_tanhl.c Modified: head/lib/msun/man/cosh.3 ============================================================================== --- head/lib/msun/man/cosh.3 Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/man/cosh.3 Tue Dec 31 23:59:33 2013 (r260145) @@ -50,7 +50,7 @@ The .Fn cosh , .Fn coshf , -and the +and .Fn coshl functions compute the hyperbolic cosine of .Fa x . Modified: head/lib/msun/man/sinh.3 ============================================================================== --- head/lib/msun/man/sinh.3 Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/man/sinh.3 Tue Dec 31 23:59:33 2013 (r260145) @@ -50,7 +50,7 @@ The .Fn sinh , .Fn sinhf , -and the +and .Fn sinhl functions compute the hyperbolic sine of .Fa x . Modified: head/lib/msun/man/tanh.3 ============================================================================== --- head/lib/msun/man/tanh.3 Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/man/tanh.3 Tue Dec 31 23:59:33 2013 (r260145) @@ -50,7 +50,7 @@ The .Fn tanh , .Fn tanhf , -and the +and .Fn tanhl functions compute the hyperbolic tangent of .Fa x . Modified: head/lib/msun/src/e_coshl.c ============================================================================== --- head/lib/msun/src/e_coshl.c Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/src/e_coshl.c Tue Dec 31 23:59:33 2013 (r260145) @@ -78,7 +78,7 @@ C26 = 2.5022374732804632e-27; /* 0x18 #error "Unsupported long double format" #endif /* LDBL_MANT_DIG == 64 */ -/* log(2**16385 - 0.5) rounded towards up: */ +/* log(2**16385 - 0.5) rounded up: */ static const float o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ Modified: head/lib/msun/src/e_sinhl.c ============================================================================== --- head/lib/msun/src/e_sinhl.c Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/src/e_sinhl.c Tue Dec 31 23:59:33 2013 (r260145) @@ -77,7 +77,7 @@ S25 = 6.5067867911512749e-26; /* 0x14 #error "Unsupported long double format" #endif /* LDBL_MANT_DIG == 64 */ -/* log(2**16385 - 0.5) rounded towards up: */ +/* log(2**16385 - 0.5) rounded up: */ static const float o_threshold = 1.13572168e4; /* 0xb174de.0p-10 */ Modified: head/lib/msun/src/s_tanhl.c ============================================================================== --- head/lib/msun/src/s_tanhl.c Tue Dec 31 22:00:25 2013 (r260144) +++ head/lib/msun/src/s_tanhl.c Tue Dec 31 23:59:33 2013 (r260145) @@ -86,9 +86,8 @@ static inline long double divl(long double a, long double b, long double c, long double d, long double e, long double f) { - long double inv, r, w; + long double inv, r; float fr, fw; - uint32_t hx; _2sumF(a, c); b = b + c; @@ -128,12 +127,13 @@ tanhl(long double x) ENTERI(); - if (fabsl(x) < 40) { /* |x|<40 */ + /* |x| < 40 */ + if (ix < 0x4004 || fabsl(x) < 40) { /* |x|<40 */ if (__predict_false(ix Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C2ED8F1; Wed, 1 Jan 2014 00:45:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ABCA51DB4; Wed, 1 Jan 2014 00:45:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s010jVT4066630; Wed, 1 Jan 2014 00:45:31 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s010jTwG066614; Wed, 1 Jan 2014 00:45:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401010045.s010jTwG066614@svn.freebsd.org> From: Xin LI Date: Wed, 1 Jan 2014 00:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260150 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool lib/libprocstat/zfs sys/boot/zfs sys/cddl/boot/zfs sys/cddl/con... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 00:45:31 -0000 Author: delphij Date: Wed Jan 1 00:45:28 2014 New Revision: 260150 URL: http://svnweb.freebsd.org/changeset/base/260150 Log: MFV r259170: 4370 avoid transmitting holes during zfs send 4371 DMU code clean up illumos/illumos-gate@43466aae47bfcd2ad9bf501faec8e75c08095e4f NOTE: Make sure the boot code is updated if a zpool upgrade is done on boot zpool. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/zhack/zhack.c head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 head/lib/libprocstat/zfs/Makefile head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jan 1 00:45:28 2014 (r260150) @@ -764,7 +764,7 @@ dump_dde(const ddt_t *ddt, const ddt_ent if (ddp->ddp_phys_birth == 0) continue; ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk); - sprintf_blkptr(blkbuf, &blk); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &blk); (void) printf("index %llx refcnt %llu %s %s\n", (u_longlong_t)index, (u_longlong_t)ddp->ddp_refcnt, types[p], blkbuf); @@ -1024,31 +1024,39 @@ blkid2offset(const dnode_phys_t *dnp, co } static void -sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp) +snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp) { const dva_t *dva = bp->blk_dva; int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; if (dump_opt['b'] >= 6) { - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, buflen, bp); return; } blkbuf[0] = '\0'; for (int i = 0; i < ndvas; i++) - (void) sprintf(blkbuf + strlen(blkbuf), "%llu:%llx:%llx ", + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), "%llu:%llx:%llx ", (u_longlong_t)DVA_GET_VDEV(&dva[i]), (u_longlong_t)DVA_GET_OFFSET(&dva[i]), (u_longlong_t)DVA_GET_ASIZE(&dva[i])); - (void) sprintf(blkbuf + strlen(blkbuf), - "%llxL/%llxP F=%llu B=%llu/%llu", - (u_longlong_t)BP_GET_LSIZE(bp), - (u_longlong_t)BP_GET_PSIZE(bp), - (u_longlong_t)bp->blk_fill, - (u_longlong_t)bp->blk_birth, - (u_longlong_t)BP_PHYSICAL_BIRTH(bp)); + if (BP_IS_HOLE(bp)) { + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), "B=%llu", + (u_longlong_t)bp->blk_birth); + } else { + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), + "%llxL/%llxP F=%llu B=%llu/%llu", + (u_longlong_t)BP_GET_LSIZE(bp), + (u_longlong_t)BP_GET_PSIZE(bp), + (u_longlong_t)bp->blk_fill, + (u_longlong_t)bp->blk_birth, + (u_longlong_t)BP_PHYSICAL_BIRTH(bp)); + } } static void @@ -1073,7 +1081,7 @@ print_indirect(blkptr_t *bp, const zbook } } - sprintf_blkptr_compact(blkbuf, bp); + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp); (void) printf("%s\n", blkbuf); } @@ -1088,7 +1096,7 @@ visit_indirect(spa_t *spa, const dnode_p print_indirect(bp, zb, dnp); - if (BP_GET_LEVEL(bp) > 0) { + if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) { uint32_t flags = ARC_WAIT; int i; blkptr_t *cbp; @@ -1213,7 +1221,7 @@ dump_dsl_dataset(objset_t *os, uint64_t zdb_nicenum(ds->ds_compressed_bytes, compressed); zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); zdb_nicenum(ds->ds_unique_bytes, unique); - sprintf_blkptr(blkbuf, &ds->ds_bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &ds->ds_bp); (void) printf("\t\tdir_obj = %llu\n", (u_longlong_t)ds->ds_dir_obj); @@ -1258,7 +1266,7 @@ dump_bptree_cb(void *arg, const blkptr_t char blkbuf[BP_SPRINTF_LEN]; if (bp->blk_birth != 0) { - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("\t%s\n", blkbuf); } return (0); @@ -1296,7 +1304,7 @@ dump_bpobj_cb(void *arg, const blkptr_t char blkbuf[BP_SPRINTF_LEN]; ASSERT(bp->blk_birth != 0); - sprintf_blkptr_compact(blkbuf, bp); + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp); (void) printf("\t%s\n", blkbuf); return (0); } @@ -1795,8 +1803,9 @@ dump_dir(objset_t *os) zdb_nicenum(refdbytes, numbuf); if (verbosity >= 4) { - (void) sprintf(blkbuf, ", rootbp "); - (void) sprintf_blkptr(blkbuf + strlen(blkbuf), os->os_rootbp); + (void) snprintf(blkbuf, sizeof (blkbuf), ", rootbp "); + (void) snprintf_blkptr(blkbuf + strlen(blkbuf), + sizeof (blkbuf) - strlen(blkbuf), os->os_rootbp); } else { blkbuf[0] = '\0'; } @@ -1826,7 +1835,7 @@ dump_dir(objset_t *os) if (verbosity < 2) return; - if (os->os_rootbp->blk_birth == 0) + if (BP_IS_HOLE(os->os_rootbp)) return; dump_object(os, 0, verbosity, &print_header); @@ -1867,7 +1876,7 @@ dump_uberblock(uberblock_t *ub, const ch (u_longlong_t)ub->ub_timestamp, asctime(localtime(×tamp))); if (dump_opt['u'] >= 3) { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, &ub->ub_rootbp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } (void) printf(footer ? footer : ""); @@ -2181,7 +2190,7 @@ zdb_blkptr_done(zio_t *zio) zcb->zcb_errors[ioerr]++; if (dump_opt['b'] >= 2) - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); else blkbuf[0] = '\0'; @@ -2204,11 +2213,22 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) { zdb_cb_t *zcb = arg; - char blkbuf[BP_SPRINTF_LEN]; dmu_object_type_t type; boolean_t is_metadata; - if (bp == NULL) + if (dump_opt['b'] >= 5 && bp->blk_birth > 0) { + char blkbuf[BP_SPRINTF_LEN]; + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); + (void) printf("objset %llu object %llu " + "level %lld offset 0x%llx %s\n", + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (longlong_t)zb->zb_level, + (u_longlong_t)blkid2offset(dnp, bp, zb), + blkbuf); + } + + if (BP_IS_HOLE(bp)) return (0); type = BP_GET_TYPE(bp); @@ -2239,17 +2259,6 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] >= 5) { - sprintf_blkptr(blkbuf, bp); - (void) printf("objset %llu object %llu " - "level %lld offset 0x%llx %s\n", - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (longlong_t)zb->zb_level, - (u_longlong_t)blkid2offset(dnp, bp, zb), - blkbuf); - } - if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && gethrtime() > zcb->zcb_lastprint + NANOSEC) { uint64_t now = gethrtime(); @@ -2406,7 +2415,7 @@ count_block_cb(void *arg, const blkptr_t if (dump_opt['b'] >= 5) { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("[%s] %s\n", "deferred free", blkbuf); } @@ -2640,7 +2649,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilo avl_index_t where; zdb_ddt_entry_t *zdde, zdde_search; - if (bp == NULL) + if (BP_IS_HOLE(bp)) return (0); if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) { @@ -2807,7 +2816,7 @@ zdb_print_blkptr(blkptr_t *bp, int flags if (flags & ZDB_FLAG_BSWAP) byteswap_uint64_array((void *)bp, sizeof (blkptr_t)); - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("%s\n", blkbuf); } Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Wed Jan 1 00:45:28 2014 (r260150) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +/* * Print intent log header and statistics. */ @@ -47,7 +51,7 @@ print_log_bp(const blkptr_t *bp, const c { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("%s%s\n", prefix, blkbuf); } @@ -132,6 +136,7 @@ zil_prt_rec_write(zilog_t *zilog, int tx if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { (void) printf("%shas blkptr, %s\n", prefix, + !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); print_log_bp(bp, prefix); @@ -139,8 +144,6 @@ zil_prt_rec_write(zilog_t *zilog, int tx if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - } - if (bp->blk_birth == 0) { bzero(buf, sizeof (buf)); (void) printf("%s\n", prefix); return; @@ -313,7 +316,8 @@ print_log_block(zilog_t *zilog, blkptr_t if (verbose >= 5) { (void) strcpy(blkbuf, ", "); - sprintf_blkptr(blkbuf + strlen(blkbuf), bp); + snprintf_blkptr(blkbuf + strlen(blkbuf), + sizeof (blkbuf) - strlen(blkbuf), bp); } else { blkbuf[0] = '\0'; } @@ -361,7 +365,7 @@ dump_intent_log(zilog_t *zilog) int verbose = MAX(dump_opt['d'], dump_opt['i']); int i; - if (zh->zh_log.blk_birth == 0 || verbose < 1) + if (BP_IS_HOLE(&zh->zh_log) || verbose < 1) return; (void) printf("\n ZIL header: claim_txg %llu, " Modified: head/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jan 1 00:45:28 2014 (r260150) @@ -277,6 +277,9 @@ zhack_do_feature_stat(int argc, char **a dump_obj(os, spa->spa_feat_for_read_obj, "for_read"); dump_obj(os, spa->spa_feat_for_write_obj, "for_write"); dump_obj(os, spa->spa_feat_desc_obj, "descriptions"); + if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { + dump_obj(os, spa->spa_feat_enabled_txg_obj, "enabled_txg"); + } dump_mos(spa); spa_close(spa, FTAG); @@ -313,7 +316,9 @@ zhack_do_feature_enable(int argc, char * feature.fi_uname = "zhack"; feature.fi_mos = B_FALSE; feature.fi_can_readonly = B_FALSE; + feature.fi_activate_on_enable = B_FALSE; feature.fi_depends = nodeps; + feature.fi_feature = SPA_FEATURE_NONE; optind = 1; while ((c = getopt(argc, argv, "rmd:")) != -1) { @@ -371,7 +376,7 @@ feature_incr_sync(void *arg, dmu_tx_t *t zfeature_info_t *feature = arg; uint64_t refcount; - VERIFY0(feature_get_refcount(spa, feature, &refcount)); + VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); feature_sync(spa, feature, refcount + 1, tx); spa_history_log_internal(spa, "zhack feature incr", tx, "name=%s", feature->fi_guid); @@ -384,7 +389,7 @@ feature_decr_sync(void *arg, dmu_tx_t *t zfeature_info_t *feature = arg; uint64_t refcount; - VERIFY0(feature_get_refcount(spa, feature, &refcount)); + VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); feature_sync(spa, feature, refcount - 1, tx); spa_history_log_internal(spa, "zhack feature decr", tx, "name=%s", feature->fi_guid); @@ -411,6 +416,7 @@ zhack_do_feature_ref(int argc, char **ar feature.fi_mos = B_FALSE; feature.fi_desc = NULL; feature.fi_depends = nodeps; + feature.fi_feature = SPA_FEATURE_NONE; optind = 1; while ((c = getopt(argc, argv, "md")) != -1) { @@ -459,8 +465,8 @@ zhack_do_feature_ref(int argc, char **ar if (decr) { uint64_t count; - if (feature_get_refcount(spa, &feature, &count) == 0 && - count != 0) { + if (feature_get_refcount_from_disk(spa, &feature, + &count) == 0 && count != 0) { fatal(spa, FTAG, "feature refcount already 0: %s", feature.fi_guid); } Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jan 1 00:38:22 2014 (r260149) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jan 1 00:45:28 2014 (r260150) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 08, 2013 +.Dd December 31, 2013 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -286,6 +286,76 @@ and will be returned to the .Sy enabled state when all datasets that use this feature are destroyed. +.It Sy enabled_txg +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:enabled_txg" +.It GUID Ta com.delphix:enabled_txg +.It READ\-ONLY COMPATIBLE Ta yes +.It DEPENDENCIES Ta none +.El +.Pp +Once this feature is enabled ZFS records the transaction group number +in which new features are enabled. This has no user-visible impact, +but other features may depend on this feature. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . +.It Sy hole_birth +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:hole_birth" +.It GUID Ta com.delphix:hole_birth +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta enabled_txg +.El +.Pp +This feature improves performance of incremental sends +.Pq Dq zfs send -i +and receives for objects with many holes. +The most common case of +hole-filled objects is zvols. +.Pp +An incremental send stream from snapshot +.Sy A +to snapshot +.Sy B +contains information about every block that changed between +.Sy A +and +.Sy B . +Blocks which did not change between those snapshots can be +identified and omitted from the stream using a piece of metadata called +the 'block birth time', but birth times are not recorded for holes +.Pq blocks filled only with zeroes . +Since holes created after +.Sy A +cannot be +distinguished from holes created before +.Sy A , +information about every +hole in the entire filesystem or zvol is included in the send stream. +.Pp +For workloads where holes are rare this is not a problem. +However, when +incrementally replicating filesystems or zvols with many holes +.Pq for example a zvol formatted with another filesystem +a lot of time will +be spent sending and receiving unnecessary information about holes that +already exist on the receiving side. +.Pp +Once the +.Sy hole_birth +feature has been enabled the block birth times +of all new holes will be recorded. +Incremental sends between snapshots +created after this feature is enabled will use this new metadata to avoid +sending information about holes that already exist on the receiving side. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . .El .Sh SEE ALSO .Xr zpool 8 Modified: head/lib/libprocstat/zfs/Makefile ============================================================================== --- head/lib/libprocstat/zfs/Makefile Wed Jan 1 00:38:22 2014 (r260149) +++ head/lib/libprocstat/zfs/Makefile Wed Jan 1 00:45:28 2014 (r260150) @@ -10,6 +10,7 @@ CFLAGS+= -I${.CURDIR}/../../../sys/cddl/ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/lib/libumem CFLAGS+= -I${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzpool/common +CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/sys Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/boot/zfs/zfsimpl.c Wed Jan 1 00:45:28 2014 (r260150) @@ -53,6 +53,9 @@ static vdev_list_t zfs_vdevs; * List of ZFS features supported for read */ static const char *features_for_read[] = { + "org.illumos:lz4_compress", + "com.delphix:hole_birth", + "com.delphix:extensible_dataset", NULL }; Modified: head/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- head/sys/cddl/boot/zfs/zfsimpl.h Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/boot/zfs/zfsimpl.h Wed Jan 1 00:45:28 2014 (r260150) @@ -222,9 +222,10 @@ typedef struct blkptr { * Macros to get and set fields in a bp or DVA. */ #define DVA_GET_ASIZE(dva) \ - BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) + BF64_GET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, SPA_MINBLOCKSHIFT, 0) #define DVA_SET_ASIZE(dva, x) \ - BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) + BF64_SET_SB((dva)->dva_word[0], 0, SPA_ASIZEBITS, \ + SPA_MINBLOCKSHIFT, 0, x) #define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) #define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) @@ -242,14 +243,14 @@ typedef struct blkptr { #define BP_GET_LSIZE(bp) \ (BP_IS_HOLE(bp) ? 0 : \ - BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) + BF64_GET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1)) #define BP_SET_LSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + BF64_SET_SB((bp)->blk_prop, 0, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) #define BP_GET_PSIZE(bp) \ - BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) + BF64_GET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1) #define BP_SET_PSIZE(bp, x) \ - BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) + BF64_SET_SB((bp)->blk_prop, 16, SPA_LSIZEBITS, SPA_MINBLOCKSHIFT, 1, x) #define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) #define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) @@ -266,7 +267,7 @@ typedef struct blkptr { #define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1) #define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x) -#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) +#define BP_GET_BYTEORDER(bp) BF64_GET((bp)->blk_prop, 63, 1) #define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) #define BP_PHYSICAL_BIRTH(bp) \ @@ -285,11 +286,6 @@ typedef struct blkptr { !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) -#define BP_COUNT_GANG(bp) \ - (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ - DVA_GET_GANG(&(bp)->blk_dva[1]) + \ - DVA_GET_GANG(&(bp)->blk_dva[2])) - #define DVA_EQUAL(dva1, dva2) \ ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ (dva1)->dva_word[0] == (dva2)->dva_word[0]) @@ -313,7 +309,9 @@ typedef struct blkptr { #define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) #define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) -#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) +#define DVA_IS_EMPTY(dva) ((dva)->dva_word[0] == 0ULL && \ + (dva)->dva_word[1] == 0ULL) +#define BP_IS_HOLE(bp) DVA_IS_EMPTY(BP_IDENTITY(bp)) #define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) #define BP_ZERO(bp) \ Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c Wed Jan 1 00:45:28 2014 (r260150) @@ -114,10 +114,21 @@ zfeature_lookup_name(const char *name, s return (ENOENT); } +boolean_t +zfeature_depends_on(spa_feature_t fid, spa_feature_t check) { + zfeature_info_t *feature = &spa_feature_table[fid]; + + for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) { + if (feature->fi_depends[i] == check) + return (B_TRUE); + } + return (B_FALSE); +} + static void zfeature_register(spa_feature_t fid, const char *guid, const char *name, const char *desc, boolean_t readonly, boolean_t mos, - const spa_feature_t *deps) + boolean_t activate_on_enable, const spa_feature_t *deps) { zfeature_info_t *feature = &spa_feature_table[fid]; static spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; @@ -137,6 +148,7 @@ zfeature_register(spa_feature_t fid, con feature->fi_desc = desc; feature->fi_can_readonly = readonly; feature->fi_mos = mos; + feature->fi_activate_on_enable = activate_on_enable; feature->fi_depends = deps; } @@ -145,21 +157,43 @@ zpool_feature_init(void) { zfeature_register(SPA_FEATURE_ASYNC_DESTROY, "com.delphix:async_destroy", "async_destroy", - "Destroy filesystems asynchronously.", B_TRUE, B_FALSE, NULL); + "Destroy filesystems asynchronously.", B_TRUE, B_FALSE, + B_FALSE, NULL); + zfeature_register(SPA_FEATURE_EMPTY_BPOBJ, "com.delphix:empty_bpobj", "empty_bpobj", - "Snapshots use less space.", B_TRUE, B_FALSE, NULL); + "Snapshots use less space.", B_TRUE, B_FALSE, + B_FALSE, NULL); + zfeature_register(SPA_FEATURE_LZ4_COMPRESS, "org.illumos:lz4_compress", "lz4_compress", - "LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL); + "LZ4 compression algorithm support.", B_FALSE, B_FALSE, + B_FALSE, NULL); + zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, "com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump", - "Crash dumps to multiple vdev pools.", B_FALSE, B_FALSE, NULL); + "Crash dumps to multiple vdev pools.", B_FALSE, B_FALSE, + B_FALSE, NULL); + zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM, "com.delphix:spacemap_histogram", "spacemap_histogram", - "Spacemaps maintain space histograms.", B_TRUE, B_FALSE, NULL); + "Spacemaps maintain space histograms.", B_TRUE, B_FALSE, + B_FALSE, NULL); + + zfeature_register(SPA_FEATURE_ENABLED_TXG, + "com.delphix:enabled_txg", "enabled_txg", + "Record txg at which a feature is enabled", B_TRUE, B_FALSE, + B_FALSE, NULL); + + static spa_feature_t hole_birth_deps[] = { SPA_FEATURE_ENABLED_TXG, + SPA_FEATURE_NONE }; + zfeature_register(SPA_FEATURE_HOLE_BIRTH, + "com.delphix:hole_birth", "hole_birth", + "Retain hole birth txg for more precise zfs send", + B_FALSE, B_TRUE, B_TRUE, hole_birth_deps); + zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET, "com.delphix:extensible_dataset", "extensible_dataset", "Enhanced dataset functionality, used by other features.", - B_FALSE, B_FALSE, NULL); + B_FALSE, B_FALSE, B_FALSE, NULL); } Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h Wed Jan 1 00:45:28 2014 (r260150) @@ -44,10 +44,14 @@ typedef enum spa_feature { SPA_FEATURE_LZ4_COMPRESS, SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, SPA_FEATURE_SPACEMAP_HISTOGRAM, + SPA_FEATURE_ENABLED_TXG, + SPA_FEATURE_HOLE_BIRTH, SPA_FEATURE_EXTENSIBLE_DATASET, SPA_FEATURES } spa_feature_t; +#define SPA_FEATURE_DISABLED (-1ULL) + typedef struct zfeature_info { spa_feature_t fi_feature; const char *fi_uname; /* User-facing feature name */ @@ -55,6 +59,8 @@ typedef struct zfeature_info { const char *fi_desc; /* Feature description */ boolean_t fi_can_readonly; /* Can open pool readonly w/o support? */ boolean_t fi_mos; /* Is the feature necessary to read the MOS? */ + /* Activate this feature at the same time it is enabled */ + boolean_t fi_activate_on_enable; /* array of dependencies, terminated by SPA_FEATURE_NONE */ const spa_feature_t *fi_depends; } zfeature_info_t; @@ -69,6 +75,7 @@ extern boolean_t zfeature_is_valid_guid( extern boolean_t zfeature_is_supported(const char *); extern int zfeature_lookup_name(const char *name, spa_feature_t *res); +extern boolean_t zfeature_depends_on(spa_feature_t fid, spa_feature_t check); extern void zpool_feature_init(void); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Jan 1 00:45:28 2014 (r260150) @@ -845,7 +845,7 @@ buf_hash(uint64_t spa, const dva_t *dva, #define BUF_EMPTY(buf) \ ((buf)->b_dva.dva_word[0] == 0 && \ (buf)->b_dva.dva_word[1] == 0 && \ - (buf)->b_birth == 0) + (buf)->b_cksum0 == 0) #define BUF_EQUAL(spa, dva, birth, buf) \ ((buf)->b_dva.dva_word[0] == (dva)->dva_word[0]) && \ @@ -3767,9 +3767,13 @@ arc_write_done(zio_t *zio) ASSERT(hdr->b_acb == NULL); if (zio->io_error == 0) { - hdr->b_dva = *BP_IDENTITY(zio->io_bp); - hdr->b_birth = BP_PHYSICAL_BIRTH(zio->io_bp); - hdr->b_cksum0 = zio->io_bp->blk_cksum.zc_word[0]; + if (BP_IS_HOLE(zio->io_bp)) { + buf_discard_identity(hdr); + } else { + hdr->b_dva = *BP_IDENTITY(zio->io_bp); + hdr->b_birth = BP_PHYSICAL_BIRTH(zio->io_bp); + hdr->b_cksum0 = zio->io_bp->blk_cksum.zc_word[0]; + } } else { ASSERT(BUF_EMPTY(hdr)); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Wed Jan 1 00:45:28 2014 (r260150) @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include @@ -141,7 +141,7 @@ bptree_visit_cb(spa_t *spa, zilog_t *zil int err; struct bptree_args *ba = arg; - if (bp == NULL) + if (BP_IS_HOLE(bp)) return (0); err = ba->ba_func(ba->ba_arg, bp, ba->ba_tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jan 1 00:38:22 2014 (r260149) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Wed Jan 1 00:45:28 2014 (r260150) @@ -455,10 +455,9 @@ dbuf_loan_arcbuf(dmu_buf_impl_t *db) mutex_enter(&db->db_mtx); if (arc_released(db->db_buf) || refcount_count(&db->db_holds) > 1) { int blksz = db->db.db_size; - spa_t *spa; + spa_t *spa = db->db_objset->os_spa; mutex_exit(&db->db_mtx); - DB_GET_SPA(&spa, db); abuf = arc_loan_buf(spa, blksz); bcopy(db->db.db_data, abuf->b_data, blksz); } else { @@ -519,7 +518,6 @@ static void dbuf_read_impl(dmu_buf_impl_t *db, zio_t *zio, uint32_t *flags) { dnode_t *dn; - spa_t *spa; zbookmark_t zb; uint32_t aflags = ARC_NOWAIT; @@ -559,9 +557,9 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t BP_IS_HOLE(db->db_blkptr)))) { arc_buf_contents_t type = DBUF_GET_BUFC_TYPE(db); - dbuf_set_data(db, arc_buf_alloc(dn->dn_objset->os_spa, - db->db.db_size, db, type)); DB_DNODE_EXIT(db); + dbuf_set_data(db, arc_buf_alloc(db->db_objset->os_spa, + db->db.db_size, db, type)); bzero(db->db.db_data, db->db.db_size); db->db_state = DB_CACHED; *flags |= DB_RF_CACHED; @@ -569,7 +567,6 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t return; } - spa = dn->dn_objset->os_spa; DB_DNODE_EXIT(db); db->db_state = DB_READ; @@ -586,7 +583,7 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t dbuf_add_ref(db, NULL); - (void) arc_read(zio, spa, db->db_blkptr, + (void) arc_read(zio, db->db_objset->os_spa, db->db_blkptr, dbuf_read_done, db, ZIO_PRIORITY_SYNC_READ, (*flags & DB_RF_CANFAIL) ? ZIO_FLAG_CANFAIL : ZIO_FLAG_MUSTSUCCEED, &aflags, &zb); @@ -598,8 +595,8 @@ int dbuf_read(dmu_buf_impl_t *db, zio_t *zio, uint32_t flags) { int err = 0; - int havepzio = (zio != NULL); - int prefetch; + boolean_t havepzio = (zio != NULL); + boolean_t prefetch; dnode_t *dn; /* @@ -694,11 +691,10 @@ dbuf_noread(dmu_buf_impl_t *db) cv_wait(&db->db_changed, &db->db_mtx); if (db->db_state == DB_UNCACHED) { arc_buf_contents_t type = DBUF_GET_BUFC_TYPE(db); - spa_t *spa; + spa_t *spa = db->db_objset->os_spa; ASSERT(db->db_buf == NULL); ASSERT(db->db.db_data == NULL); - DB_GET_SPA(&spa, db); dbuf_set_data(db, arc_buf_alloc(spa, db->db.db_size, db, type)); db->db_state = DB_FILL; } else if (db->db_state == DB_NOFILL) { @@ -753,9 +749,8 @@ dbuf_fix_old_data(dmu_buf_impl_t *db, ui } else if (refcount_count(&db->db_holds) > db->db_dirtycnt) { int size = db->db.db_size; arc_buf_contents_t type = DBUF_GET_BUFC_TYPE(db); - spa_t *spa; + spa_t *spa = db->db_objset->os_spa; - DB_GET_SPA(&spa, db); dr->dt.dl.dr_data = arc_buf_alloc(spa, size, db, type); bcopy(db->db.db_data, dr->dt.dl.dr_data->b_data, size); } else { @@ -781,12 +776,9 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) ASSERT(db->db_data_pending != dr); /* free this block */ - if (!BP_IS_HOLE(bp) && !dr->dt.dl.dr_nopwrite) { - spa_t *spa; + if (!BP_IS_HOLE(bp) && !dr->dt.dl.dr_nopwrite) + zio_free(db->db_objset->os_spa, txg, bp); - DB_GET_SPA(&spa, db); - zio_free(spa, txg, bp); - } dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; dr->dt.dl.dr_nopwrite = B_FALSE; @@ -804,9 +796,7 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) /* * Evict (if its unreferenced) or clear (if its referenced) any level-0 * data blocks in the free range, so that any future readers will find - * empty blocks. Also, if we happen across any level-1 dbufs in the - * range that have not already been marked dirty, mark them dirty so - * they stay in memory. + * empty blocks. * * This is a no-op if the dataset is in the middle of an incremental * receive; see comment below for details. @@ -816,14 +806,9 @@ dbuf_free_range(dnode_t *dn, uint64_t st { dmu_buf_impl_t *db, *db_next; uint64_t txg = tx->tx_txg; - int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - uint64_t first_l1 = start >> epbs; - uint64_t last_l1 = end >> epbs; - if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) { + if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) end = dn->dn_maxblkid; - last_l1 = end >> epbs; - } dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); mutex_enter(&dn->dn_dbufs_mtx); @@ -846,23 +831,8 @@ dbuf_free_range(dnode_t *dn, uint64_t st db_next = list_next(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); - if (db->db_level == 1 && - db->db_blkid >= first_l1 && db->db_blkid <= last_l1) { - mutex_enter(&db->db_mtx); - if (db->db_last_dirty && - db->db_last_dirty->dr_txg < txg) { - dbuf_add_ref(db, FTAG); - mutex_exit(&db->db_mtx); - dbuf_will_dirty(db, tx); - dbuf_rele(db, FTAG); - } else { - mutex_exit(&db->db_mtx); - } - } - if (db->db_level != 0) continue; - dprintf_dbuf(db, "found buf %s\n", ""); if (db->db_blkid < start || db->db_blkid > end) continue; @@ -939,24 +909,29 @@ dbuf_block_freeable(dmu_buf_impl_t *db) * We don't need any locking to protect db_blkptr: * If it's syncing, then db_last_dirty will be set * so we'll ignore db_blkptr. + * + * This logic ensures that only block births for + * filled blocks are considered. */ ASSERT(MUTEX_HELD(&db->db_mtx)); - if (db->db_last_dirty) + if (db->db_last_dirty && (db->db_blkptr == NULL || + !BP_IS_HOLE(db->db_blkptr))) { birth_txg = db->db_last_dirty->dr_txg; - else if (db->db_blkptr) + } else if (db->db_blkptr != NULL && !BP_IS_HOLE(db->db_blkptr)) { birth_txg = db->db_blkptr->blk_birth; + } /* - * If we don't exist or are in a snapshot, we can't be freed. + * If this block don't exist or is in a snapshot, it can't be freed. * Don't pass the bp to dsl_dataset_block_freeable() since we * are holding the db_mtx lock and might deadlock if we are * prefetching a dedup-ed block. */ - if (birth_txg) + if (birth_txg != 0) return (ds == NULL || dsl_dataset_block_freeable(ds, NULL, birth_txg)); else - return (FALSE); + return (B_FALSE); } void @@ -976,7 +951,7 @@ dbuf_new_size(dmu_buf_impl_t *db, int si ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock)); /* - * This call to dbuf_will_dirty() with the dn_struct_rwlock held + * This call to dmu_buf_will_dirty() with the dn_struct_rwlock held * is OK, because there can be no other references to the db * when we are changing its size, so no concurrent DB_FILL can * be happening. @@ -985,7 +960,7 @@ dbuf_new_size(dmu_buf_impl_t *db, int si * XXX we should be doing a dbuf_read, checking the return * value and returning that up to our callers */ - dbuf_will_dirty(db, tx); + dmu_buf_will_dirty(&db->db, tx); /* create the data buffer for the new block */ buf = arc_buf_alloc(dn->dn_objset->os_spa, size, db, type); @@ -1015,9 +990,8 @@ dbuf_new_size(dmu_buf_impl_t *db, int si void dbuf_release_bp(dmu_buf_impl_t *db) { - objset_t *os; + objset_t *os = db->db_objset; - DB_GET_OBJSET(&os, db); ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); ASSERT(arc_released(os->os_phys_buf) || list_link_active(&os->os_dsl_dataset->ds_synced_link)); @@ -1391,10 +1365,10 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_ return (B_FALSE); } -#pragma weak dmu_buf_will_dirty = dbuf_will_dirty void -dbuf_will_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx) +dmu_buf_will_dirty(dmu_buf_t *db_fake, dmu_tx_t *tx) { + dmu_buf_impl_t *db = (dmu_buf_impl_t *)db_fake; int rf = DB_RF_MUST_SUCCEED | DB_RF_NOPREFETCH; ASSERT(tx->tx_txg != 0); @@ -1517,7 +1491,7 @@ dbuf_assign_arcbuf(dmu_buf_impl_t *db, a db->db_state = DB_FILL; mutex_exit(&db->db_mtx); (void) dbuf_dirty(db, tx); - dbuf_fill_done(db, tx); + dmu_buf_fill_done(&db->db, tx); } /* @@ -2022,7 +1996,6 @@ dbuf_add_ref(dmu_buf_impl_t *db, void *t * Without that, the dbuf_rele() could lead to a dnode_rele() followed by the * dnode's parent dbuf evicting its dnode handles. */ -#pragma weak dmu_buf_rele = dbuf_rele void dbuf_rele(dmu_buf_impl_t *db, void *tag) { @@ -2030,6 +2003,12 @@ dbuf_rele(dmu_buf_impl_t *db, void *tag) dbuf_rele_and_unlock(db, tag); } +void +dmu_buf_rele(dmu_buf_t *db, void *tag) +{ + dbuf_rele((dmu_buf_impl_t *)db, tag); +} + /* * dbuf_rele() for an already-locked dbuf. This is necessary to allow * db_dirtycnt and db_holds to be updated atomically. @@ -2480,18 +2459,14 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * dnode_diduse_space(dn, delta - zio->io_prev_space_delta); zio->io_prev_space_delta = delta; - if (BP_IS_HOLE(bp)) { - ASSERT(bp->blk_fill == 0); - DB_DNODE_EXIT(db); - return; + if (bp->blk_birth != 0) { + ASSERT((db->db_blkid != DMU_SPILL_BLKID && + BP_GET_TYPE(bp) == dn->dn_type) || + (db->db_blkid == DMU_SPILL_BLKID && + BP_GET_TYPE(bp) == dn->dn_bonustype)); + ASSERT(BP_GET_LEVEL(bp) == db->db_level); } - ASSERT((db->db_blkid != DMU_SPILL_BLKID && - BP_GET_TYPE(bp) == dn->dn_type) || - (db->db_blkid == DMU_SPILL_BLKID && - BP_GET_TYPE(bp) == dn->dn_bonustype)); - ASSERT(BP_GET_LEVEL(bp) == db->db_level); - mutex_enter(&db->db_mtx); #ifdef ZFS_DEBUG @@ -2517,7 +2492,11 @@ dbuf_write_ready(zio_t *zio, arc_buf_t * fill++; } } else { - fill = 1; + if (BP_IS_HOLE(bp)) { + fill = 0; + } else { + fill = 1; + } } } else { blkptr_t *ibp = db->db.db_data; @@ -2572,9 +2551,10 @@ static void dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb) { dmu_buf_impl_t *db = vdb; - blkptr_t *bp = zio->io_bp; blkptr_t *bp_orig = &zio->io_bp_orig; - uint64_t txg = zio->io_txg; + blkptr_t *bp = db->db_blkptr; + objset_t *os = db->db_objset; + dmu_tx_t *tx = os->os_synctx; dbuf_dirty_record_t **drp, *dr; ASSERT0(zio->io_error); @@ -2587,14 +2567,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *b if (zio->io_flags & (ZIO_FLAG_IO_REWRITE | ZIO_FLAG_NOPWRITE)) { ASSERT(BP_EQUAL(bp, bp_orig)); } else { - objset_t *os; - dsl_dataset_t *ds; - dmu_tx_t *tx; - - DB_GET_OBJSET(&os, db); - ds = os->os_dsl_dataset; - tx = os->os_synctx; - + dsl_dataset_t *ds = os->os_dsl_dataset; (void) dsl_dataset_block_kill(ds, bp_orig, tx, B_TRUE); dsl_dataset_block_born(ds, bp, tx); } @@ -2607,7 +2580,6 @@ dbuf_write_done(zio_t *zio, arc_buf_t *b *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 00:56:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7DB5A408; Wed, 1 Jan 2014 00:56: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 6A2641E4B; Wed, 1 Jan 2014 00:56: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 s010uRU6070406; Wed, 1 Jan 2014 00:56:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s010uR70070405; Wed, 1 Jan 2014 00:56:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401010056.s010uR70070405@svn.freebsd.org> From: Adrian Chadd Date: Wed, 1 Jan 2014 00:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260151 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 00:56:27 -0000 Author: adrian Date: Wed Jan 1 00:56:26 2014 New Revision: 260151 URL: http://svnweb.freebsd.org/changeset/base/260151 Log: 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. Tested: * parallel IPv6 TCP bulk data exchange, 8192 sockets MFC after: 1 week Sponsored by: Netflix, Inc. Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Jan 1 00:45:28 2014 (r260150) +++ head/sys/netinet6/nd6.c Wed Jan 1 00:56:26 2014 (r260151) @@ -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(), From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 01:23:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2438FB6; Wed, 1 Jan 2014 01:23: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 DD9E21FFB; Wed, 1 Jan 2014 01:23: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 s011Neu2081941; Wed, 1 Jan 2014 01:23:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s011Nevk081940; Wed, 1 Jan 2014 01:23:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401010123.s011Nevk081940@svn.freebsd.org> From: Xin LI Date: Wed, 1 Jan 2014 01:23:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260156 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 01:23:41 -0000 Author: delphij Date: Wed Jan 1 01:23:40 2014 New Revision: 260156 URL: http://svnweb.freebsd.org/changeset/base/260156 Log: MFV r260152: 4208 Typo in zfs_main.c: "posxiuser" illumos/illumos-gate@f38cb554a534c6df738be3f4d23327e69888e634 Note: this is a stripped down version of Illumos change. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jan 1 01:18:37 2014 (r260155) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jan 1 01:23:40 2014 (r260156) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . @@ -2157,7 +2157,7 @@ static int us_type_bits[] = { USTYPE_SMB_USR, USTYPE_ALL }; -static char *us_type_names[] = { "posixgroup", "posxiuser", "smbgroup", +static char *us_type_names[] = { "posixgroup", "posixuser", "smbgroup", "smbuser", "all" }; typedef struct us_node { From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 01:26:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28C372B8; Wed, 1 Jan 2014 01:26: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 13EF31035; Wed, 1 Jan 2014 01:26: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 s011QdYr082322; Wed, 1 Jan 2014 01:26:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s011QdG1082321; Wed, 1 Jan 2014 01:26:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401010126.s011QdG1082321@svn.freebsd.org> From: Xin LI Date: Wed, 1 Jan 2014 01:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260157 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 01:26:40 -0000 Author: delphij Date: Wed Jan 1 01:26:39 2014 New Revision: 260157 URL: http://svnweb.freebsd.org/changeset/base/260157 Log: MFV r260153: 4121 vdev_label_init should treat request as succeeded when pool is read only Illumos/illumos-gate@973c78e94bf9634782164382c9e291bf81161fa5 MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Jan 1 01:23:40 2014 (r260156) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Wed Jan 1 01:26:39 2014 (r260157) @@ -646,7 +646,7 @@ vdev_label_init(vdev_t *vd, uint64_t crt /* Track the creation time for this vdev */ vd->vdev_crtxg = crtxg; - if (!vd->vdev_ops->vdev_op_leaf) + if (!vd->vdev_ops->vdev_op_leaf || !spa_writeable(spa)) return (0); /* From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 19:38:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B4CA868; Wed, 1 Jan 2014 19:38: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 883C91ECC; Wed, 1 Jan 2014 19:38: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 s01JcF0e098532; Wed, 1 Jan 2014 19:38:15 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01JcFnD098531; Wed, 1 Jan 2014 19:38:15 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201401011938.s01JcFnD098531@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Jan 2014 19:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260160 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 19:38:15 -0000 Author: emaste Date: Wed Jan 1 19:38:15 2014 New Revision: 260160 URL: http://svnweb.freebsd.org/changeset/base/260160 Log: Increase vt(9) max glyph data to 1MB for CJK fonts with many glyphs Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_font.c Modified: head/sys/dev/vt/vt_font.c ============================================================================== --- head/sys/dev/vt/vt_font.c Wed Jan 1 02:49:45 2014 (r260159) +++ head/sys/dev/vt/vt_font.c Wed Jan 1 19:38:15 2014 (r260160) @@ -42,7 +42,7 @@ static MALLOC_DEFINE(M_VTFONT, "vtfont", /* Some limits to prevent abnormal fonts from being loaded. */ #define VTFONT_MAXMAPPINGS 8192 -#define VTFONT_MAXGLYPHSIZE 262144 +#define VTFONT_MAXGLYPHSIZE 1048576 #define VTFONT_MAXDIMENSION 128 static uint16_t From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:03:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21CC28F5; Wed, 1 Jan 2014 20:03: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 0152F1136; Wed, 1 Jan 2014 20:03: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 s01K3npM009765; Wed, 1 Jan 2014 20:03:49 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01K3ngn009757; Wed, 1 Jan 2014 20:03:49 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201401012003.s01K3ngn009757@svn.freebsd.org> From: Zbigniew Bodek Date: Wed, 1 Jan 2014 20:03:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260161 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:03:50 -0000 Author: zbb Date: Wed Jan 1 20:03:48 2014 New Revision: 260161 URL: http://svnweb.freebsd.org/changeset/base/260161 Log: Add polarity and level support to ARM GIC Add suport for setting triggering level and polarity in GIC. New function pointer was added to nexus which corresponds to the function which sets level/sense in the hardware (GIC). Submitted by: Wojciech Macek Obtained from: Semihalf Modified: head/sys/arm/arm/gic.c head/sys/arm/arm/intr.c head/sys/arm/arm/nexus.c head/sys/arm/include/intr.h Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Wed Jan 1 19:38:15 2014 (r260160) +++ head/sys/arm/arm/gic.c Wed Jan 1 20:03:48 2014 (r260161) @@ -83,6 +83,15 @@ __FBSDID("$FreeBSD$"); #define GICC_ABPR 0x001C /* v1 ICCABPR */ #define GICC_IIDR 0x00FC /* v1 ICCIIDR*/ +/* First bit is a polarity bit (0 - low, 1 - high) */ +#define GICD_ICFGR_POL_LOW (0 << 0) +#define GICD_ICFGR_POL_HIGH (1 << 0) +#define GICD_ICFGR_POL_MASK 0x1 +/* Second bit is a trigger bit (0 - level, 1 - edge) */ +#define GICD_ICFGR_TRIG_LVL (0 << 1) +#define GICD_ICFGR_TRIG_EDGE (1 << 1) +#define GICD_ICFGR_TRIG_MASK 0x2 + struct arm_gic_softc { struct resource * gic_res[3]; bus_space_tag_t gic_c_bst; @@ -90,6 +99,9 @@ struct arm_gic_softc { bus_space_handle_t gic_c_bsh; bus_space_handle_t gic_d_bsh; uint8_t ver; + device_t dev; + struct mtx mutex; + uint32_t nirqs; }; static struct resource_spec arm_gic_spec[] = { @@ -109,6 +121,8 @@ static struct arm_gic_softc *arm_gic_sc #define gic_d_write_4(reg, val) \ bus_space_write_4(arm_gic_sc->gic_d_bst, arm_gic_sc->gic_d_bsh, reg, val) +static int gic_config_irq(int irq, enum intr_trigger trig, + enum intr_polarity pol); static void gic_post_filter(void *); static int @@ -157,19 +171,20 @@ arm_gic_attach(device_t dev) struct arm_gic_softc *sc; int i; uint32_t icciidr; - uint32_t nirqs; if (arm_gic_sc) return (ENXIO); sc = device_get_softc(dev); + sc->dev = dev; if (bus_alloc_resources(dev, arm_gic_spec, sc->gic_res)) { device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - arm_post_filter = gic_post_filter; + /* Initialize mutex */ + mtx_init(&sc->mutex, "GIC lock", "", MTX_SPIN); /* Distributor Interface */ sc->gic_d_bst = rman_get_bustag(sc->gic_res[0]); @@ -185,31 +200,35 @@ arm_gic_attach(device_t dev) gic_d_write_4(GICD_CTLR, 0x00); /* Get the number of interrupts */ - nirqs = gic_d_read_4(GICD_TYPER); - nirqs = 32 * ((nirqs & 0x1f) + 1); + sc->nirqs = gic_d_read_4(GICD_TYPER); + sc->nirqs = 32 * ((sc->nirqs & 0x1f) + 1); + + /* Set up function pointers */ + arm_post_filter = gic_post_filter; + arm_config_irq = gic_config_irq; icciidr = gic_c_read_4(GICC_IIDR); - device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x nirqs %u\n", + device_printf(dev,"pn 0x%x, arch 0x%x, rev 0x%x, implementer 0x%x sc->nirqs %u\n", icciidr>>20, (icciidr>>16) & 0xF, (icciidr>>12) & 0xf, - (icciidr & 0xfff), nirqs); + (icciidr & 0xfff), sc->nirqs); /* Set all global interrupts to be level triggered, active low. */ - for (i = 32; i < nirqs; i += 32) { - gic_d_write_4(GICD_ICFGR(i >> 5), 0x00000000); + for (i = 32; i < sc->nirqs; i += 16) { + gic_d_write_4(GICD_ICFGR(i >> 4), 0x00000000); } /* Disable all interrupts. */ - for (i = 32; i < nirqs; i += 32) { + for (i = 32; i < sc->nirqs; i += 32) { gic_d_write_4(GICD_ICENABLER(i >> 5), 0xFFFFFFFF); } - for (i = 0; i < nirqs; i += 4) { + for (i = 0; i < sc->nirqs; i += 4) { gic_d_write_4(GICD_IPRIORITYR(i >> 2), 0); gic_d_write_4(GICD_ITARGETSR(i >> 2), 1 << 0 | 1 << 8 | 1 << 16 | 1 << 24); } /* Set all the interrupts to be in Group 0 (secure) */ - for (i = 0; i < nirqs; i += 32) { + for (i = 0; i < sc->nirqs; i += 32) { gic_d_write_4(GICD_IGROUPR(i >> 5), 0); } @@ -290,6 +309,58 @@ arm_unmask_irq(uintptr_t nb) gic_d_write_4(GICD_ISENABLER(nb >> 5), (1UL << (nb & 0x1F))); } +static int +gic_config_irq(int irq, enum intr_trigger trig, + enum intr_polarity pol) +{ + uint32_t reg; + uint32_t mask; + + /* Function is public-accessible, so validate input arguments */ + if ((irq < 0) || (irq >= arm_gic_sc->nirqs)) + goto invalid_args; + if ((trig != INTR_TRIGGER_EDGE) && (trig != INTR_TRIGGER_LEVEL) && + (trig != INTR_TRIGGER_CONFORM)) + goto invalid_args; + if ((pol != INTR_POLARITY_HIGH) && (pol != INTR_POLARITY_LOW) && + (pol != INTR_POLARITY_CONFORM)) + goto invalid_args; + + mtx_lock_spin(&arm_gic_sc->mutex); + + reg = gic_d_read_4(GICD_ICFGR(irq >> 4)); + mask = (reg >> 2*(irq % 16)) & 0x3; + + if (pol == INTR_POLARITY_LOW) { + mask &= ~GICD_ICFGR_POL_MASK; + mask |= GICD_ICFGR_POL_LOW; + } else if (pol == INTR_POLARITY_HIGH) { + mask &= ~GICD_ICFGR_POL_MASK; + mask |= GICD_ICFGR_POL_HIGH; + } + + if (trig == INTR_TRIGGER_LEVEL) { + mask &= ~GICD_ICFGR_TRIG_MASK; + mask |= GICD_ICFGR_TRIG_LVL; + } else if (trig == INTR_TRIGGER_EDGE) { + mask &= ~GICD_ICFGR_TRIG_MASK; + mask |= GICD_ICFGR_TRIG_EDGE; + } + + /* Set mask */ + reg = reg & ~(0x3 << 2*(irq % 16)); + reg = reg | (mask << 2*(irq % 16)); + gic_d_write_4(GICD_ICFGR(irq >> 4), reg); + + mtx_unlock_spin(&arm_gic_sc->mutex); + + return (0); + +invalid_args: + device_printf(arm_gic_sc->dev, "gic_config_irg, invalid parameters\n"); + return (EINVAL); +} + #ifdef SMP void pic_ipi_send(cpuset_t cpus, u_int ipi) Modified: head/sys/arm/arm/intr.c ============================================================================== --- head/sys/arm/arm/intr.c Wed Jan 1 19:38:15 2014 (r260160) +++ head/sys/arm/arm/intr.c Wed Jan 1 20:03:48 2014 (r260161) @@ -59,6 +59,8 @@ static struct intr_event *intr_events[NI void arm_handler_execute(struct trapframe *, int); void (*arm_post_filter)(void *) = NULL; +int (*arm_config_irq)(int irq, enum intr_trigger trig, + enum intr_polarity pol) = NULL; /* * Pre-format intrnames into an array of fixed-size strings containing spaces. Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Wed Jan 1 19:38:15 2014 (r260160) +++ head/sys/arm/arm/nexus.c Wed Jan 1 20:03:48 2014 (r260161) @@ -85,6 +85,8 @@ static struct resource *nexus_alloc_reso #endif static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); +static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, + enum intr_polarity pol); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -103,6 +105,7 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), #endif DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), @@ -225,6 +228,18 @@ nexus_alloc_resource(device_t bus, devic #endif static int +nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, + enum intr_polarity pol) +{ + int ret = ENODEV; + + if (arm_config_irq) + ret = (*arm_config_irq)(irq, trig, pol); + + return (ret); +} + +static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { Modified: head/sys/arm/include/intr.h ============================================================================== --- head/sys/arm/include/intr.h Wed Jan 1 19:38:15 2014 (r260160) +++ head/sys/arm/include/intr.h Wed Jan 1 20:03:48 2014 (r260161) @@ -68,6 +68,7 @@ #endif #include +#include int arm_get_next_irq(int); void arm_mask_irq(uintptr_t); @@ -77,6 +78,8 @@ void arm_setup_irqhandler(const char *, void *, int, int, void **); int arm_remove_irqhandler(int, void *); extern void (*arm_post_filter)(void *); +extern int (*arm_config_irq)(int irq, enum intr_trigger trig, + enum intr_polarity pol); void gic_init_secondary(void); From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:04:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2A16A43; Wed, 1 Jan 2014 20:04: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 DE7471145; Wed, 1 Jan 2014 20:04: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 s01K4hK6009936; Wed, 1 Jan 2014 20:04:43 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01K4hAb009935; Wed, 1 Jan 2014 20:04:43 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201401012004.s01K4hAb009935@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Jan 2014 20:04:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260162 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:04:44 -0000 Author: emaste Date: Wed Jan 1 20:04:43 2014 New Revision: 260162 URL: http://svnweb.freebsd.org/changeset/base/260162 Log: Remove TNF license clauses 3 and 4, matching upstream Approved by raj@ (Semihalf has a copyright statement in the license block as well). Modified: head/sys/powerpc/powerpc/bus_machdep.c Modified: head/sys/powerpc/powerpc/bus_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/bus_machdep.c Wed Jan 1 20:03:48 2014 (r260161) +++ head/sys/powerpc/powerpc/bus_machdep.c Wed Jan 1 20:04:43 2014 (r260162) @@ -15,13 +15,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:18:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96D87CEE; Wed, 1 Jan 2014 20:18: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 8330B1208; Wed, 1 Jan 2014 20:18: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 s01KI3QY014442; Wed, 1 Jan 2014 20:18:03 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01KI31L014441; Wed, 1 Jan 2014 20:18:03 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201401012018.s01KI31L014441@svn.freebsd.org> From: Zbigniew Bodek Date: Wed, 1 Jan 2014 20:18:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260163 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:18:03 -0000 Author: zbb Date: Wed Jan 1 20:18:03 2014 New Revision: 260163 URL: http://svnweb.freebsd.org/changeset/base/260163 Log: Do not attach to PCI bridges in AHCI driver Some vendors use the same VID:PID combination in AHCI and PCI bridge cards Submitted by: Wojciech Macek Obtained from: Semihalf Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:04:43 2014 (r260162) +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:18:03 2014 (r260163) @@ -375,6 +375,13 @@ ahci_probe(device_t dev) uint32_t devid = pci_get_devid(dev); uint8_t revid = pci_get_revid(dev); + /* + * Ensure it is not a PCI bridge (some vendors use + * the same PID and VID in PCI bridge and AHCI cards). + */ + if (pci_get_class(dev) == PCIC_BRIDGE) + return (ENXIO); + /* Is this a possible AHCI candidate? */ if (pci_get_class(dev) == PCIC_STORAGE && pci_get_subclass(dev) == PCIS_STORAGE_SATA && From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:26:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F0C5FE3; Wed, 1 Jan 2014 20:26:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8B63F1290; Wed, 1 Jan 2014 20:26:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s01KQ8oZ017950; Wed, 1 Jan 2014 20:26:08 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01KQ8KU017949; Wed, 1 Jan 2014 20:26:08 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201401012026.s01KQ8KU017949@svn.freebsd.org> From: Zbigniew Bodek Date: Wed, 1 Jan 2014 20:26:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260165 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:26:08 -0000 Author: zbb Date: Wed Jan 1 20:26:08 2014 New Revision: 260165 URL: http://svnweb.freebsd.org/changeset/base/260165 Log: Use only mapped BIOs on ARM Using unmapped BIOs causes failure inside bus_dmamap_sync, since this function requires valid MVA address, which is not present if mapping is not set up. Submitted by: Wojciech Macek Obtained from: Semihalf Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc if (ch->caps & AHCI_CAP_SPM) cpi->hba_inquiry |= PI_SATAPM; cpi->target_sprt = 0; +#ifdef __arm__ + /* + * Do not use unmapped buffers on ARM. Doing so will cause + * failure inside bus_dmamap_sync due to lack of VA. + */ + cpi->hba_misc = PIM_SEQSCAN; +#else cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; +#endif cpi->hba_eng_cnt = 0; if (ch->caps & AHCI_CAP_SPM) cpi->max_target = 15; From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:32:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98EBB1F0; Wed, 1 Jan 2014 20:32:19 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 15BE21305; Wed, 1 Jan 2014 20:32:18 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s01KWCmu013056; Wed, 1 Jan 2014 22:32:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s01KWCmu013056 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s01KWCgP013055; Wed, 1 Jan 2014 22:32:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Jan 2014 22:32:12 +0200 From: Konstantin Belousov To: Zbigniew Bodek Subject: Re: svn commit: r260165 - head/sys/dev/ahci Message-ID: <20140101203212.GF59496@kib.kiev.ua> References: <201401012026.s01KQ8KU017949@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AOH7EoHA/zJSUDBX" Content-Disposition: inline In-Reply-To: <201401012026.s01KQ8KU017949@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:32:19 -0000 --AOH7EoHA/zJSUDBX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: > Author: zbb > Date: Wed Jan 1 20:26:08 2014 > New Revision: 260165 > URL: http://svnweb.freebsd.org/changeset/base/260165 >=20 > Log: > Use only mapped BIOs on ARM > =20 > Using unmapped BIOs causes failure inside bus_dmamap_sync, since > this function requires valid MVA address, which is not present > if mapping is not set up. > =20 > Submitted by: Wojciech Macek > Obtained from: Semihalf >=20 > Modified: > head/sys/dev/ahci/ahci.c >=20 > Modified: head/sys/dev/ahci/ahci.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) > +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc > if (ch->caps & AHCI_CAP_SPM) > cpi->hba_inquiry |=3D PI_SATAPM; > cpi->target_sprt =3D 0; > +#ifdef __arm__ > + /* > + * Do not use unmapped buffers on ARM. Doing so will cause > + * failure inside bus_dmamap_sync due to lack of VA. > + */ > + cpi->hba_misc =3D PIM_SEQSCAN; > +#else > cpi->hba_misc =3D PIM_SEQSCAN | PIM_UNMAPPED; > +#endif > cpi->hba_eng_cnt =3D 0; > if (ch->caps & AHCI_CAP_SPM) > cpi->max_target =3D 15; I think this is wrong. If bus_dmamap_sync(9) is not functional on arm, then unmapped io should be disabled on arm unconditionally, using unmapped_buf_allowed. Why ahci(4) is special in this regard, leaving other controllers broken for arm ? --AOH7EoHA/zJSUDBX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxHtLAAoJEJDCuSvBvK1Bp8EP/3z2qyRnqlHUrkn/meVxGaov KE6HAh6BDjSGkPICCNEYarl2ZiOUUxplNiTx9M+k+L6dhHJND9SUOFd0t2t8MoET /djiOoJLqmeZ65Rn0kh2ai0s1X9PrAQsf7eKiwPcykqvrfYUnYoQusoiFcYm50yb LEBw20HpuABv63MfNC8zP50uw+aooI3JN3jMQkB+u090ZWQ/lyoeBeWJk49wrKHv nV2di5Bb+wfkmFbc6ISiyWs0NC05v7cGJjsVYT77QVnivVvckERvMVKa8pTu+2QD PgPYNddBF8mj+3oMErGyeBArGCXjsaapFDobPC8IJjdhkKxxXlfqXOohEFjhZdDh 4AFYCOVJU/pyPq4988s2DRjdkf/g6KmwqfwMPzQH+09dT4M4h2a4+iafJ9jdsS+H hzZtDCi+WfOMLGxDpJSvP9S6HUAirDgNU7O9/TX3ATi3SLI2tvtCqx+C9/3uKc8M 9gEHToBmCEy8FZ7euGLTpcLNS3LCNK5ICiaeVBwr3JsjnQouHPR1z4+il31aW2JP UyvFSvwwmcnEfnaSZeytncdT/UH4/CL6A+7ju+wJH1V7ZH2xUfp4Mwa8+Iq6/1ig rEIMzB1l22v//k0VAL1XVQY6HBv02SmWxTRYOIMPmlDk/HT9EW1qjSYQ4PZHZX0z MrNzqF2IKtQCIPTba0ro =Y8m5 -----END PGP SIGNATURE----- --AOH7EoHA/zJSUDBX-- From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 20:35:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8127734A; Wed, 1 Jan 2014 20:35: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 5397A131B; Wed, 1 Jan 2014 20:35:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s01KZdXk021605; Wed, 1 Jan 2014 20:35:39 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01KZdc0021604; Wed, 1 Jan 2014 20:35:39 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201401012035.s01KZdc0021604@svn.freebsd.org> From: Zbigniew Bodek Date: Wed, 1 Jan 2014 20:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260166 - head/sys/arm/versatile X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 20:35:39 -0000 Author: zbb Date: Wed Jan 1 20:35:38 2014 New Revision: 260166 URL: http://svnweb.freebsd.org/changeset/base/260166 Log: Fix race condition in DELAY for SP804 timer. Fix race condition in DELAY function: sc->tc was not initialized yet when time_counter pointer was set, what resulted in NULL pointer dereference. Export sysfreq to dts. Submitted by: Wojciech Macek Obtained from: Semihalf Modified: head/sys/arm/versatile/sp804.c Modified: head/sys/arm/versatile/sp804.c ============================================================================== --- head/sys/arm/versatile/sp804.c Wed Jan 1 20:26:08 2014 (r260165) +++ head/sys/arm/versatile/sp804.c Wed Jan 1 20:35:38 2014 (r260166) @@ -100,6 +100,7 @@ struct sp804_timer_softc { struct timecounter tc; bool et_enabled; struct eventtimer et; + int timer_initialized; }; /* Read/Write macros for Timer used as timecounter */ @@ -198,6 +199,8 @@ sp804_timer_attach(device_t dev) int rid = 0; int i; uint32_t id, reg; + phandle_t node; + pcell_t clock; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) { @@ -215,8 +218,12 @@ sp804_timer_attach(device_t dev) return (ENXIO); } - /* TODO: get frequency from FDT */ sc->sysclk_freq = DEFAULT_FREQUENCY; + /* Get the base clock frequency */ + node = ofw_bus_get_node(dev); + if ((OF_getprop(node, "clock-frequency", &clock, sizeof(clock))) > 0) { + sc->sysclk_freq = fdt32_to_cpu(clock); + } /* Setup and enable the timer */ if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CLK, @@ -234,8 +241,8 @@ sp804_timer_attach(device_t dev) /* * Timer 1, timecounter */ - sc->tc.tc_frequency = DEFAULT_FREQUENCY; - sc->tc.tc_name = "SP804 Timecouter"; + sc->tc.tc_frequency = sc->sysclk_freq; + sc->tc.tc_name = "SP804 Time Counter"; sc->tc.tc_get_timecount = sp804_timer_tc_get_timecount; sc->tc.tc_poll_pps = NULL; sc->tc.tc_counter_mask = ~0u; @@ -283,6 +290,8 @@ sp804_timer_attach(device_t dev) device_printf(dev, "PrimeCell ID: %08x\n", id); + sc->timer_initialized = 1; + return (0); } @@ -309,10 +318,18 @@ DELAY(int usec) uint32_t first, last; device_t timer_dev; struct sp804_timer_softc *sc; + int timer_initialized = 0; timer_dev = devclass_get_device(sp804_timer_devclass, 0); - if (timer_dev == NULL) { + if (timer_dev) { + sc = device_get_softc(timer_dev); + + if (sc) + timer_initialized = sc->timer_initialized; + } + + if (!timer_initialized) { /* * Timer is not initialized yet */ @@ -323,8 +340,6 @@ DELAY(int usec) return; } - sc = device_get_softc(timer_dev); - /* Get the number of times to count */ counts = usec * ((sc->tc.tc_frequency / 1000000) + 1); From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 21:17:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24546BF0; Wed, 1 Jan 2014 21:17: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 0E08215F7; Wed, 1 Jan 2014 21:17: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 s01LHA1x037196; Wed, 1 Jan 2014 21:17:10 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01LH8t2037186; Wed, 1 Jan 2014 21:17:08 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401012117.s01LH8t2037186@svn.freebsd.org> From: Neel Natu Date: Wed, 1 Jan 2014 21:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260167 - in head: sys/amd64/include sys/amd64/vmm/intel usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 21:17:10 -0000 Author: neel Date: Wed Jan 1 21:17:08 2014 New Revision: 260167 URL: http://svnweb.freebsd.org/changeset/base/260167 Log: Restructure the VMX code to enter and exit the guest. In large part this change hides the setjmp/longjmp semantics of VM enter/exit. vmx_enter_guest() is used to enter guest context and vmx_exit_guest() is used to transition back into host context. Fix a longstanding race where a vcpu interrupt notification might be ignored if it happens after vmx_inject_interrupts() but before host interrupts are disabled in vmx_resume/vmx_launch. We now called vmx_inject_interrupts() with host interrupts disabled to prevent this. Suggested by: grehan@ Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/intel/vmx.h head/sys/amd64/vmm/intel/vmx_genassym.c head/sys/amd64/vmm/intel/vmx_support.S head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyvectl/bhyvectl.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Wed Jan 1 20:35:38 2014 (r260166) +++ head/sys/amd64/include/vmm.h Wed Jan 1 21:17:08 2014 (r260167) @@ -303,9 +303,19 @@ struct vm_exit { * exitcode to represent the VM-exit. */ struct { - int error; /* vmx inst error */ + int status; /* vmx inst status */ + /* + * 'exit_reason' and 'exit_qualification' are valid + * only if 'status' is zero. + */ uint32_t exit_reason; uint64_t exit_qualification; + /* + * 'inst_error' and 'inst_type' are valid + * only if 'status' is non-zero. + */ + int inst_type; + int inst_error; } vmx; struct { uint32_t code; /* ecx value */ Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Wed Jan 1 20:35:38 2014 (r260166) +++ head/sys/amd64/vmm/intel/vmx.c Wed Jan 1 21:17:08 2014 (r260167) @@ -288,82 +288,6 @@ exit_reason_to_str(int reason) return (reasonbuf); } } - -#ifdef SETJMP_TRACE -static const char * -vmx_setjmp_rc2str(int rc) -{ - switch (rc) { - case VMX_RETURN_DIRECT: - return "direct"; - case VMX_RETURN_LONGJMP: - return "longjmp"; - case VMX_RETURN_VMRESUME: - return "vmresume"; - case VMX_RETURN_VMLAUNCH: - return "vmlaunch"; - case VMX_RETURN_AST: - return "ast"; - default: - return "unknown"; - } -} - -#define SETJMP_TRACE(vmx, vcpu, vmxctx, regname) \ - VCPU_CTR1((vmx)->vm, (vcpu), "setjmp trace " #regname " 0x%016lx", \ - (vmxctx)->regname) - -static void -vmx_setjmp_trace(struct vmx *vmx, int vcpu, struct vmxctx *vmxctx, int rc) -{ - uint64_t host_rip, host_rsp; - - if (vmxctx != &vmx->ctx[vcpu]) - panic("vmx_setjmp_trace: invalid vmxctx %p; should be %p", - vmxctx, &vmx->ctx[vcpu]); - - VCPU_CTR1((vmx)->vm, (vcpu), "vmxctx = %p", vmxctx); - VCPU_CTR2((vmx)->vm, (vcpu), "setjmp return code %s(%d)", - vmx_setjmp_rc2str(rc), rc); - - host_rip = vmcs_read(VMCS_HOST_RIP); - host_rsp = vmcs_read(VMCS_HOST_RSP); - VCPU_CTR2((vmx)->vm, (vcpu), "vmcs host_rip 0x%016lx, host_rsp %#lx", - host_rip, host_rsp); - - SETJMP_TRACE(vmx, vcpu, vmxctx, host_r15); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_r14); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_r13); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_r12); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_rbp); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_rsp); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_rbx); - SETJMP_TRACE(vmx, vcpu, vmxctx, host_rip); - - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rdi); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rsi); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rdx); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rcx); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r8); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r9); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rax); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rbx); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_rbp); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r10); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r11); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r12); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r13); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r14); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_r15); - SETJMP_TRACE(vmx, vcpu, vmxctx, guest_cr2); -} -#endif -#else -static void __inline -vmx_setjmp_trace(struct vmx *vmx, int vcpu, struct vmxctx *vmxctx, int rc) -{ - return; -} #endif /* KTR */ u_long @@ -827,7 +751,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) } error = vmcs_set_defaults(&vmx->vmcs[i], - (u_long)vmx_longjmp, + (u_long)vmx_exit_guest, (u_long)&vmx->ctx[i], vmx->eptp, pinbased_ctls, @@ -1257,15 +1181,20 @@ static int vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) { int error, handled; - struct vmcs *vmcs; struct vmxctx *vmxctx; uint32_t eax, ecx, edx, idtvec_info, idtvec_err, reason; uint64_t qual, gpa; bool retu; handled = 0; - vmcs = &vmx->vmcs[vcpu]; vmxctx = &vmx->ctx[vcpu]; + + /* Collect some information for VM exit processing */ + vmexit->rip = vmcs_guest_rip(); + vmexit->inst_length = vmexit_instruction_length(); + vmexit->u.vmx.exit_reason = vmcs_exit_reason(); + vmexit->u.vmx.exit_qualification = vmcs_exit_qualification(); + qual = vmexit->u.vmx.exit_qualification; reason = vmexit->u.vmx.exit_reason; vmexit->exitcode = VM_EXITCODE_BOGUS; @@ -1442,7 +1371,7 @@ vmx_exit_process(struct vmx *vmx, int vc * treat it as a generic VMX exit. */ vmexit->exitcode = VM_EXITCODE_VMX; - vmexit->u.vmx.error = 0; + vmexit->u.vmx.status = VM_SUCCESS; } else { /* * The exitcode and collateral have been populated. @@ -1453,11 +1382,53 @@ vmx_exit_process(struct vmx *vmx, int vc return (handled); } +static __inline int +vmx_exit_astpending(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) +{ + + vmexit->rip = vmcs_guest_rip(); + vmexit->inst_length = 0; + vmexit->exitcode = VM_EXITCODE_BOGUS; + vmx_astpending_trace(vmx, vcpu, vmexit->rip); + vmm_stat_incr(vmx->vm, vcpu, VMEXIT_ASTPENDING, 1); + + return (HANDLED); +} + +static __inline int +vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, struct vm_exit *vmexit) +{ + + KASSERT(vmxctx->inst_fail_status != VM_SUCCESS, + ("vmx_exit_inst_error: invalid inst_fail_status %d", + vmxctx->inst_fail_status)); + + vmexit->rip = vmcs_guest_rip(); + vmexit->inst_length = 0; + + vmexit->exitcode = VM_EXITCODE_VMX; + vmexit->u.vmx.status = vmxctx->inst_fail_status; + vmexit->u.vmx.inst_error = vmcs_instruction_error(); + vmexit->u.vmx.exit_reason = ~0; + vmexit->u.vmx.exit_qualification = ~0; + + switch (rc) { + case VMX_VMRESUME_ERROR: + case VMX_VMLAUNCH_ERROR: + case VMX_INVEPT_ERROR: + vmexit->u.vmx.inst_type = rc; + break; + default: + panic("vm_exit_inst_error: vmx_enter_guest returned %d", rc); + } + + return (UNHANDLED); +} + static int -vmx_run(void *arg, int vcpu, register_t rip, pmap_t pmap) +vmx_run(void *arg, int vcpu, register_t startrip, pmap_t pmap) { - int vie, rc, handled, astpending; - uint32_t exit_reason; + int rc, handled, launched; struct vmx *vmx; struct vmxctx *vmxctx; struct vmcs *vmcs; @@ -1467,20 +1438,15 @@ vmx_run(void *arg, int vcpu, register_t vmx = arg; vmcs = &vmx->vmcs[vcpu]; vmxctx = &vmx->ctx[vcpu]; - vmxctx->launched = 0; vlapic = vm_lapic(vmx->vm, vcpu); - - astpending = 0; vmexit = vm_exitinfo(vmx->vm, vcpu); + launched = 0; KASSERT(vmxctx->pmap == pmap, ("pmap %p different than ctx pmap %p", pmap, vmxctx->pmap)); KASSERT(vmxctx->eptp == vmx->eptp, ("eptp %p different than ctx eptp %#lx", eptp, vmxctx->eptp)); - /* - * XXX Can we avoid doing this every time we do a vm run? - */ VMPTRLD(vmcs); /* @@ -1492,76 +1458,48 @@ vmx_run(void *arg, int vcpu, register_t * of a single process we could do this once in vmcs_set_defaults(). */ vmcs_write(VMCS_HOST_CR3, rcr3()); - vmcs_write(VMCS_GUEST_RIP, rip); - vmx_set_pcpu_defaults(vmx, vcpu); + vmcs_write(VMCS_GUEST_RIP, startrip); + vmx_set_pcpu_defaults(vmx, vcpu); do { - vmx_inject_interrupts(vmx, vcpu, vlapic); - vmx_run_trace(vmx, vcpu); - rc = vmx_setjmp(vmxctx); -#ifdef SETJMP_TRACE - vmx_setjmp_trace(vmx, vcpu, vmxctx, rc); -#endif - switch (rc) { - case VMX_RETURN_DIRECT: - if (vmxctx->launched == 0) { - vmxctx->launched = 1; - vmx_launch(vmxctx); - } else - vmx_resume(vmxctx); - panic("vmx_launch/resume should not return"); - break; - case VMX_RETURN_LONGJMP: - break; /* vm exit */ - case VMX_RETURN_AST: - astpending = 1; - break; - case VMX_RETURN_VMRESUME: - vie = vmcs_instruction_error(); - if (vmxctx->launch_error == VM_FAIL_INVALID || - vie != VMRESUME_WITH_NON_LAUNCHED_VMCS) { - printf("vmresume error %d vmcs inst error %d\n", - vmxctx->launch_error, vie); - goto err_exit; - } - vmx_launch(vmxctx); /* try to launch the guest */ - panic("vmx_launch should not return"); + /* + * Interrupts are disabled from this point on until the + * guest starts executing. This is done for the following + * reasons: + * + * If an AST is asserted on this thread after the check below, + * then the IPI_AST notification will not be lost, because it + * will cause a VM exit due to external interrupt as soon as + * the guest state is loaded. + * + * A posted interrupt after 'vmx_inject_interrupts()' will + * not be "lost" because it will be held pending in the host + * APIC because interrupts are disabled. The pending interrupt + * will be recognized as soon as the guest state is loaded. + * + * The same reasoning applies to the IPI generated by + * pmap_invalidate_ept(). + */ + disable_intr(); + if (curthread->td_flags & (TDF_ASTPENDING | TDF_NEEDRESCHED)) { + enable_intr(); + handled = vmx_exit_astpending(vmx, vcpu, vmexit); break; - case VMX_RETURN_VMLAUNCH: - vie = vmcs_instruction_error(); -#if 1 - printf("vmlaunch error %d vmcs inst error %d\n", - vmxctx->launch_error, vie); -#endif - goto err_exit; - case VMX_RETURN_INVEPT: - panic("vm %s:%d invept error %d", - vm_name(vmx->vm), vcpu, vmxctx->launch_error); - default: - panic("vmx_setjmp returned %d", rc); } - - /* enable interrupts */ - enable_intr(); - /* collect some basic information for VM exit processing */ - vmexit->rip = rip = vmcs_guest_rip(); - vmexit->inst_length = vmexit_instruction_length(); - vmexit->u.vmx.exit_reason = exit_reason = vmcs_exit_reason(); - vmexit->u.vmx.exit_qualification = vmcs_exit_qualification(); - - if (astpending) { - handled = 1; - vmexit->inst_length = 0; - vmexit->exitcode = VM_EXITCODE_BOGUS; - vmx_astpending_trace(vmx, vcpu, rip); - vmm_stat_incr(vmx->vm, vcpu, VMEXIT_ASTPENDING, 1); - break; + vmx_inject_interrupts(vmx, vcpu, vlapic); + vmx_run_trace(vmx, vcpu); + rc = vmx_enter_guest(vmxctx, launched); + enable_intr(); + if (rc == VMX_GUEST_VMEXIT) { + launched = 1; + handled = vmx_exit_process(vmx, vcpu, vmexit); + } else { + handled = vmx_exit_inst_error(vmxctx, rc, vmexit); } - handled = vmx_exit_process(vmx, vcpu, vmexit); - vmx_exit_trace(vmx, vcpu, rip, exit_reason, handled); - + vmx_exit_trace(vmx, vcpu, vmexit->rip, + vmexit->u.vmx.exit_reason, handled); } while (handled); /* @@ -1577,26 +1515,11 @@ vmx_run(void *arg, int vcpu, register_t if (!handled) vmm_stat_incr(vmx->vm, vcpu, VMEXIT_USERSPACE, 1); - VCPU_CTR1(vmx->vm, vcpu, "goto userland: exitcode %d",vmexit->exitcode); + VCPU_CTR1(vmx->vm, vcpu, "returning from vmx_run: exitcode %d", + vmexit->exitcode); - /* - * XXX - * We need to do this to ensure that any VMCS state cached by the - * processor is flushed to memory. We need to do this in case the - * VM moves to a different cpu the next time it runs. - * - * Can we avoid doing this? - */ VMCLEAR(vmcs); return (0); - -err_exit: - vmexit->exitcode = VM_EXITCODE_VMX; - vmexit->u.vmx.exit_reason = (uint32_t)-1; - vmexit->u.vmx.exit_qualification = (uint32_t)-1; - vmexit->u.vmx.error = vie; - VMCLEAR(vmcs); - return (ENOEXEC); } static void Modified: head/sys/amd64/vmm/intel/vmx.h ============================================================================== --- head/sys/amd64/vmm/intel/vmx.h Wed Jan 1 20:35:38 2014 (r260166) +++ head/sys/amd64/vmm/intel/vmx.h Wed Jan 1 21:17:08 2014 (r260167) @@ -36,9 +36,6 @@ struct pmap; #define GUEST_MSR_MAX_ENTRIES 64 /* arbitrary */ struct vmxctx { - register_t tmpstk[32]; /* vmx_return() stack */ - register_t tmpstktop; - register_t guest_rdi; /* Guest state */ register_t guest_rsi; register_t guest_rdx; @@ -68,8 +65,7 @@ struct vmxctx { * XXX todo debug registers and fpu state */ - int launched; /* vmcs launch state */ - int launch_error; + int inst_fail_status; long eptgen[MAXCPU]; /* cached pmap->pm_eptgen */ @@ -113,25 +109,12 @@ CTASSERT((offsetof(struct vmx, vmcs) & P CTASSERT((offsetof(struct vmx, msr_bitmap) & PAGE_MASK) == 0); CTASSERT((offsetof(struct vmx, guest_msrs) & 15) == 0); -#define VMX_RETURN_DIRECT 0 -#define VMX_RETURN_LONGJMP 1 -#define VMX_RETURN_VMRESUME 2 -#define VMX_RETURN_VMLAUNCH 3 -#define VMX_RETURN_AST 4 -#define VMX_RETURN_INVEPT 5 -/* - * vmx_setjmp() returns: - * - 0 when it returns directly - * - 1 when it returns from vmx_longjmp - * - 2 when it returns from vmx_resume (which would only be in the error case) - * - 3 when it returns from vmx_launch (which would only be in the error case) - * - 4 when it returns from vmx_resume or vmx_launch because of AST pending - * - 5 when it returns from vmx_launch/vmx_resume because of invept error - */ -int vmx_setjmp(struct vmxctx *ctx); -void vmx_longjmp(void); /* returns via vmx_setjmp */ -void vmx_launch(struct vmxctx *ctx) __dead2; /* may return via vmx_setjmp */ -void vmx_resume(struct vmxctx *ctx) __dead2; /* may return via vmx_setjmp */ +#define VMX_GUEST_VMEXIT 0 +#define VMX_VMRESUME_ERROR 1 +#define VMX_VMLAUNCH_ERROR 2 +#define VMX_INVEPT_ERROR 3 +int vmx_enter_guest(struct vmxctx *ctx, int launched); +void vmx_exit_guest(void); u_long vmx_fix_cr0(u_long cr0); u_long vmx_fix_cr4(u_long cr4); Modified: head/sys/amd64/vmm/intel/vmx_genassym.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_genassym.c Wed Jan 1 20:35:38 2014 (r260166) +++ head/sys/amd64/vmm/intel/vmx_genassym.c Wed Jan 1 21:17:08 2014 (r260167) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -42,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include "vmx_cpufunc.h" #include "vmx.h" -ASSYM(VMXCTX_TMPSTKTOP, offsetof(struct vmxctx, tmpstktop)); ASSYM(VMXCTX_GUEST_RDI, offsetof(struct vmxctx, guest_rdi)); ASSYM(VMXCTX_GUEST_RSI, offsetof(struct vmxctx, guest_rsi)); ASSYM(VMXCTX_GUEST_RDX, offsetof(struct vmxctx, guest_rdx)); @@ -69,27 +67,19 @@ ASSYM(VMXCTX_HOST_RSP, offsetof(struct v ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx)); ASSYM(VMXCTX_HOST_RIP, offsetof(struct vmxctx, host_rip)); -ASSYM(VMXCTX_LAUNCH_ERROR, offsetof(struct vmxctx, launch_error)); +ASSYM(VMXCTX_INST_FAIL_STATUS, offsetof(struct vmxctx, inst_fail_status)); ASSYM(VMXCTX_EPTGEN, offsetof(struct vmxctx, eptgen)); ASSYM(VMXCTX_PMAP, offsetof(struct vmxctx, pmap)); ASSYM(VMXCTX_EPTP, offsetof(struct vmxctx, eptp)); -ASSYM(VM_SUCCESS, VM_SUCCESS); ASSYM(VM_FAIL_INVALID, VM_FAIL_INVALID); ASSYM(VM_FAIL_VALID, VM_FAIL_VALID); +ASSYM(VMX_GUEST_VMEXIT, VMX_GUEST_VMEXIT); +ASSYM(VMX_VMRESUME_ERROR, VMX_VMRESUME_ERROR); +ASSYM(VMX_VMLAUNCH_ERROR, VMX_VMLAUNCH_ERROR); +ASSYM(VMX_INVEPT_ERROR, VMX_INVEPT_ERROR); -ASSYM(VMX_RETURN_DIRECT, VMX_RETURN_DIRECT); -ASSYM(VMX_RETURN_LONGJMP, VMX_RETURN_LONGJMP); -ASSYM(VMX_RETURN_VMRESUME, VMX_RETURN_VMRESUME); -ASSYM(VMX_RETURN_VMLAUNCH, VMX_RETURN_VMLAUNCH); -ASSYM(VMX_RETURN_AST, VMX_RETURN_AST); -ASSYM(VMX_RETURN_INVEPT, VMX_RETURN_INVEPT); - -ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); -ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); -ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); -ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active)); Modified: head/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- head/sys/amd64/vmm/intel/vmx_support.S Wed Jan 1 20:35:38 2014 (r260166) +++ head/sys/amd64/vmm/intel/vmx_support.S Wed Jan 1 21:17:08 2014 (r260167) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 NetApp, Inc. + * Copyright (c) 2013 Neel Natu * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,32 +38,6 @@ #endif /* - * Disable interrupts before updating %rsp in VMX_CHECK_AST or - * VMX_GUEST_RESTORE. - * - * The location that %rsp points to is a 'vmxctx' and not a - * real stack so we don't want an interrupt handler to trash it - */ -#define VMX_DISABLE_INTERRUPTS cli - -/* - * If the thread hosting the vcpu has an ast pending then take care of it - * by returning from vmx_setjmp() with a return value of VMX_RETURN_AST. - * - * Assumes that %rdi holds a pointer to the 'vmxctx' and that interrupts - * are disabled. - */ -#define VMX_CHECK_AST \ - movq PCPU(CURTHREAD),%rax; \ - testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax); \ - je 9f; \ - movq $VMX_RETURN_AST,%rsi; \ - movq %rdi,%rsp; \ - addq $VMXCTX_TMPSTKTOP,%rsp; \ - callq vmx_return; \ -9: - -/* * Assumes that %rdi holds a pointer to the 'vmxctx'. * * On "return" all registers are updated to reflect guest state. The two @@ -93,132 +68,132 @@ movq VMXCTX_GUEST_RDI(%rdi),%rdi; /* restore rdi the last */ /* - * Check for an error after executing a VMX instruction. - * 'errreg' will be zero on success and non-zero otherwise. - * 'ctxreg' points to the 'struct vmxctx' associated with the vcpu. + * Save and restore the host context. + * + * Assumes that %rdi holds a pointer to the 'vmxctx'. */ -#define VM_INSTRUCTION_ERROR(errreg, ctxreg) \ - jnc 1f; \ - movl $VM_FAIL_INVALID,errreg; /* CF is set */ \ - jmp 3f; \ -1: jnz 2f; \ - movl $VM_FAIL_VALID,errreg; /* ZF is set */ \ - jmp 3f; \ -2: movl $VM_SUCCESS,errreg; \ -3: movl errreg,VMXCTX_LAUNCH_ERROR(ctxreg) +#define VMX_HOST_SAVE(tmpreg) \ + movq (%rsp), tmpreg; /* return address */ \ + movq %r15, VMXCTX_HOST_R15(%rdi); \ + movq %r14, VMXCTX_HOST_R14(%rdi); \ + movq %r13, VMXCTX_HOST_R13(%rdi); \ + movq %r12, VMXCTX_HOST_R12(%rdi); \ + movq %rbp, VMXCTX_HOST_RBP(%rdi); \ + movq %rsp, VMXCTX_HOST_RSP(%rdi); \ + movq %rbx, VMXCTX_HOST_RBX(%rdi); \ + movq tmpreg, VMXCTX_HOST_RIP(%rdi) + +#define VMX_HOST_RESTORE(tmpreg) \ + movq VMXCTX_HOST_R15(%rdi), %r15; \ + movq VMXCTX_HOST_R14(%rdi), %r14; \ + movq VMXCTX_HOST_R13(%rdi), %r13; \ + movq VMXCTX_HOST_R12(%rdi), %r12; \ + movq VMXCTX_HOST_RBP(%rdi), %rbp; \ + movq VMXCTX_HOST_RSP(%rdi), %rsp; \ + movq VMXCTX_HOST_RBX(%rdi), %rbx; \ + movq VMXCTX_HOST_RIP(%rdi), tmpreg; \ + movq tmpreg, (%rsp) /* return address */ + +/* + * vmx_enter_guest(struct vmxctx *vmxctx, int launched) + * %rdi: pointer to the 'vmxctx' + * %esi: launch state of the VMCS + * Interrupts must be disabled on entry. + */ +ENTRY(vmx_enter_guest) + /* + * Save host state before doing anything else. + */ + VMX_HOST_SAVE(%r10) -/* - * set or clear the appropriate bit in 'pm_active' - * %rdi = vmxctx - * %rax, %r11 = scratch registers - */ -#define VMX_SET_PM_ACTIVE \ - movq VMXCTX_PMAP(%rdi), %r11; \ - movl PCPU(CPUID), %eax; \ + /* + * Activate guest pmap on this cpu. + */ + movq VMXCTX_PMAP(%rdi), %r11 + movl PCPU(CPUID), %eax LK btsl %eax, PM_ACTIVE(%r11) -#define VMX_CLEAR_PM_ACTIVE \ - movq VMXCTX_PMAP(%rdi), %r11; \ - movl PCPU(CPUID), %eax; \ - LK btrl %eax, PM_ACTIVE(%r11) - -/* - * If 'vmxctx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen' - * then we must invalidate all mappings associated with this eptp. - * - * %rdi = vmxctx - * %rax, %rbx, %r11 = scratch registers - */ -#define VMX_CHECK_EPTGEN \ - movl PCPU(CPUID), %ebx; \ - movq VMXCTX_PMAP(%rdi), %r11; \ - movq PM_EPTGEN(%r11), %rax; \ - cmpq %rax, VMXCTX_EPTGEN(%rdi, %rbx, 8); \ - je 9f; \ - \ - /* Refresh 'vmxctx->eptgen[curcpu]' */ \ - movq %rax, VMXCTX_EPTGEN(%rdi, %rbx, 8); \ - \ - /* Setup the invept descriptor at the top of tmpstk */ \ - mov %rdi, %r11; \ - addq $VMXCTX_TMPSTKTOP, %r11; \ - movq VMXCTX_EPTP(%rdi), %rax; \ - movq %rax, -16(%r11); \ - movq $0x0, -8(%r11); \ - mov $0x1, %eax; /* Single context invalidate */ \ - invept -16(%r11), %rax; \ - \ - /* Check for invept error */ \ - VM_INSTRUCTION_ERROR(%eax, %rdi); \ - testl %eax, %eax; \ - jz 9f; \ - \ - /* Return via vmx_setjmp with retval of VMX_RETURN_INVEPT */ \ - movq $VMX_RETURN_INVEPT, %rsi; \ - movq %rdi,%rsp; \ - addq $VMXCTX_TMPSTKTOP, %rsp; \ - callq vmx_return; \ -9: ; + /* + * If 'vmxctx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen' + * then we must invalidate all mappings associated with this EPTP. + */ + movq PM_EPTGEN(%r11), %r10 + cmpq %r10, VMXCTX_EPTGEN(%rdi, %rax, 8) + je guest_restore + + /* Refresh 'vmxctx->eptgen[curcpu]' */ + movq %r10, VMXCTX_EPTGEN(%rdi, %rax, 8) + + /* Setup the invept descriptor on the host stack */ + mov %rsp, %r11 + movq VMXCTX_EPTP(%rdi), %rax + movq %rax, -16(%r11) + movq $0x0, -8(%r11) + mov $0x1, %eax /* Single context invalidate */ + invept -16(%r11), %rax + jbe invept_error /* Check invept instruction error */ + +guest_restore: + cmpl $0, %esi + je do_launch - .text -/* - * int vmx_setjmp(ctxp) - * %rdi = ctxp - * - * Return value is '0' when it returns directly from here. - * Return value is '1' when it returns after a vm exit through vmx_longjmp. - */ -ENTRY(vmx_setjmp) - movq (%rsp),%rax /* return address */ - movq %r15,VMXCTX_HOST_R15(%rdi) - movq %r14,VMXCTX_HOST_R14(%rdi) - movq %r13,VMXCTX_HOST_R13(%rdi) - movq %r12,VMXCTX_HOST_R12(%rdi) - movq %rbp,VMXCTX_HOST_RBP(%rdi) - movq %rsp,VMXCTX_HOST_RSP(%rdi) - movq %rbx,VMXCTX_HOST_RBX(%rdi) - movq %rax,VMXCTX_HOST_RIP(%rdi) + VMX_GUEST_RESTORE + vmresume + /* + * In the common case 'vmresume' returns back to the host through + * 'vmx_exit_guest' with %rsp pointing to 'vmxctx'. + * + * If there is an error we return VMX_VMRESUME_ERROR to the caller. + */ + movq %rsp, %rdi /* point %rdi back to 'vmxctx' */ + movl $VMX_VMRESUME_ERROR, %eax + jmp decode_inst_error +do_launch: + VMX_GUEST_RESTORE + vmlaunch /* - * XXX save host debug registers + * In the common case 'vmlaunch' returns back to the host through + * 'vmx_exit_guest' with %rsp pointing to 'vmxctx'. + * + * If there is an error we return VMX_VMLAUNCH_ERROR to the caller. */ - movl $VMX_RETURN_DIRECT,%eax - ret -END(vmx_setjmp) + movq %rsp, %rdi /* point %rdi back to 'vmxctx' */ + movl $VMX_VMLAUNCH_ERROR, %eax + jmp decode_inst_error -/* - * void vmx_return(struct vmxctx *ctxp, int retval) - * %rdi = ctxp - * %rsi = retval - * Return to vmm context through vmx_setjmp() with a value of 'retval'. - */ -ENTRY(vmx_return) - /* The pmap is no longer active on the host cpu */ - VMX_CLEAR_PM_ACTIVE - - /* Restore host context. */ - movq VMXCTX_HOST_R15(%rdi),%r15 - movq VMXCTX_HOST_R14(%rdi),%r14 - movq VMXCTX_HOST_R13(%rdi),%r13 - movq VMXCTX_HOST_R12(%rdi),%r12 - movq VMXCTX_HOST_RBP(%rdi),%rbp - movq VMXCTX_HOST_RSP(%rdi),%rsp - movq VMXCTX_HOST_RBX(%rdi),%rbx - movq VMXCTX_HOST_RIP(%rdi),%rax - movq %rax,(%rsp) /* return address */ +invept_error: + movl $VMX_INVEPT_ERROR, %eax + jmp decode_inst_error + +decode_inst_error: + movl $VM_FAIL_VALID, %r11d + jz inst_error + movl $VM_FAIL_INVALID, %r11d +inst_error: + movl %r11d, VMXCTX_INST_FAIL_STATUS(%rdi) + + /* + * The return value is already populated in %eax so we cannot use + * it as a scratch register beyond this point. + */ /* - * XXX restore host debug registers + * Deactivate guest pmap from this cpu. */ - movl %esi,%eax + movq VMXCTX_PMAP(%rdi), %r11 + movl PCPU(CPUID), %r10d + LK btrl %r10d, PM_ACTIVE(%r11) + + VMX_HOST_RESTORE(%r10) ret -END(vmx_return) +END(vmx_execute_guest) /* - * void vmx_longjmp(void) + * void vmx_exit_guest(void) * %rsp points to the struct vmxctx */ -ENTRY(vmx_longjmp) +ENTRY(vmx_exit_guest) /* * Save guest state that is not automatically saved in the vmcs. */ @@ -242,80 +217,20 @@ ENTRY(vmx_longjmp) movq %rdi,VMXCTX_GUEST_CR2(%rsp) movq %rsp,%rdi - movq $VMX_RETURN_LONGJMP,%rsi - - addq $VMXCTX_TMPSTKTOP,%rsp - callq vmx_return -END(vmx_longjmp) - -/* - * void vmx_resume(struct vmxctx *ctxp) - * %rdi = ctxp - * - * Although the return type is a 'void' this function may return indirectly - * through vmx_setjmp() with a return value of 2. - */ -ENTRY(vmx_resume) - VMX_DISABLE_INTERRUPTS - - VMX_CHECK_AST - - VMX_SET_PM_ACTIVE /* This vcpu is now active on the host cpu */ - - VMX_CHECK_EPTGEN /* Check if we have to invalidate TLB */ - - /* - * Restore guest state that is not automatically loaded from the vmcs. - */ - VMX_GUEST_RESTORE - - vmresume - - /* - * Capture the reason why vmresume failed. - */ - VM_INSTRUCTION_ERROR(%eax, %rsp) - - /* Return via vmx_setjmp with return value of VMX_RETURN_VMRESUME */ - movq %rsp,%rdi - movq $VMX_RETURN_VMRESUME,%rsi - - addq $VMXCTX_TMPSTKTOP,%rsp - callq vmx_return -END(vmx_resume) - -/* - * void vmx_launch(struct vmxctx *ctxp) - * %rdi = ctxp - * - * Although the return type is a 'void' this function may return indirectly - * through vmx_setjmp() with a return value of 3. - */ -ENTRY(vmx_launch) - VMX_DISABLE_INTERRUPTS - - VMX_CHECK_AST - - VMX_SET_PM_ACTIVE /* This vcpu is now active on the host cpu */ - - VMX_CHECK_EPTGEN /* Check if we have to invalidate TLB */ /* - * Restore guest state that is not automatically loaded from the vmcs. + * Deactivate guest pmap from this cpu. */ - VMX_GUEST_RESTORE + movq VMXCTX_PMAP(%rdi), %r11 + movl PCPU(CPUID), %r10d + LK btrl %r10d, PM_ACTIVE(%r11) - vmlaunch + VMX_HOST_RESTORE(%r10) /* - * Capture the reason why vmlaunch failed. + * This will return to the caller of 'vmx_enter_guest()' with a return + * value of VMX_GUEST_VMEXIT. */ - VM_INSTRUCTION_ERROR(%eax, %rsp) - - /* Return via vmx_setjmp with return value of VMX_RETURN_VMLAUNCH */ - movq %rsp,%rdi - movq $VMX_RETURN_VMLAUNCH,%rsi - - addq $VMXCTX_TMPSTKTOP,%rsp - callq vmx_return -END(vmx_launch) + movl $VMX_GUEST_VMEXIT, %eax + ret +END(vmx_exit_guest) Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Wed Jan 1 20:35:38 2014 (r260166) +++ head/usr.sbin/bhyve/bhyverun.c Wed Jan 1 21:17:08 2014 (r260167) @@ -388,10 +388,12 @@ vmexit_vmx(struct vmctx *ctx, struct vm_ fprintf(stderr, "\treason\t\tVMX\n"); fprintf(stderr, "\trip\t\t0x%016lx\n", vmexit->rip); fprintf(stderr, "\tinst_length\t%d\n", vmexit->inst_length); - fprintf(stderr, "\terror\t\t%d\n", vmexit->u.vmx.error); + fprintf(stderr, "\tstatus\t\t%d\n", vmexit->u.vmx.status); fprintf(stderr, "\texit_reason\t%u\n", vmexit->u.vmx.exit_reason); fprintf(stderr, "\tqualification\t0x%016lx\n", vmexit->u.vmx.exit_qualification); + fprintf(stderr, "\tinst_type\t\t%d\n", vmexit->u.vmx.inst_type); + fprintf(stderr, "\tinst_error\t\t%d\n", vmexit->u.vmx.inst_error); return (VMEXIT_ABORT); } Modified: head/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- head/usr.sbin/bhyvectl/bhyvectl.c Wed Jan 1 20:35:38 2014 (r260166) +++ head/usr.sbin/bhyvectl/bhyvectl.c Wed Jan 1 21:17:08 2014 (r260167) @@ -273,11 +273,13 @@ dump_vm_run_exitcode(struct vm_exit *vme break; case VM_EXITCODE_VMX: printf("\treason\t\tVMX\n"); - printf("\terror\t\t%d\n", vmexit->u.vmx.error); + printf("\tstatus\t\t%d\n", vmexit->u.vmx.status); printf("\texit_reason\t0x%08x (%u)\n", vmexit->u.vmx.exit_reason, vmexit->u.vmx.exit_reason); printf("\tqualification\t0x%016lx\n", vmexit->u.vmx.exit_qualification); + printf("\tinst_type\t\t%d\n", vmexit->u.vmx.inst_type); + printf("\tinst_error\t\t%d\n", vmexit->u.vmx.inst_error); break; default: printf("*** unknown vm run exitcode %d\n", vmexit->exitcode); From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 21:48:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 470F55FC; Wed, 1 Jan 2014 21:48:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2632117E2; Wed, 1 Jan 2014 21:48:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s01Lm5ZE048303; Wed, 1 Jan 2014 21:48:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01Lm478048296; Wed, 1 Jan 2014 21:48:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401012148.s01Lm478048296@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 1 Jan 2014 21:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260169 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 21:48:05 -0000 Author: glebius Date: Wed Jan 1 21:48:04 2014 New Revision: 260169 URL: http://svnweb.freebsd.org/changeset/base/260169 Log: - Use counter(9) for node stats updated at a high rate. - Use simple ++ for rare events. - Use uma_zone_get_cur() to get knowledge about space left in cache. - Convert many fields of struct ng_netflow_info to 64 bit. Tested by: Viktor Velichkin Sponsored by: Nginx, Inc. Modified: head/sys/netgraph/netflow/netflow.c head/sys/netgraph/netflow/netflow_v9.c head/sys/netgraph/netflow/ng_netflow.c head/sys/netgraph/netflow/ng_netflow.h Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Wed Jan 1 21:25:13 2014 (r260168) +++ head/sys/netgraph/netflow/netflow.c Wed Jan 1 21:48:04 2014 (r260169) @@ -34,16 +34,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" #include +#include +#include #include #include #include #include -#include #include -#include - -#include -#include #include #include @@ -80,8 +77,8 @@ __FBSDID("$FreeBSD$"); /* Macros to shorten logical constructions */ /* XXX: priv must exist in namespace */ -#define INACTIVE(fle) (time_uptime - fle->f.last > priv->info.nfinfo_inact_t) -#define AGED(fle) (time_uptime - fle->f.first > priv->info.nfinfo_act_t) +#define INACTIVE(fle) (time_uptime - fle->f.last > priv->nfinfo_inact_t) +#define AGED(fle) (time_uptime - fle->f.first > priv->nfinfo_act_t) #define ISFREE(fle) (fle->f.packets == 0) /* @@ -149,54 +146,6 @@ ip6_hash(struct flow6_rec *r) } #endif -/* This is callback from uma(9), called on alloc. */ -static int -uma_ctor_flow(void *mem, int size, void *arg, int how) -{ - priv_p priv = (priv_p )arg; - - if (atomic_load_acq_32(&priv->info.nfinfo_used) >= CACHESIZE) - return (ENOMEM); - - atomic_add_32(&priv->info.nfinfo_used, 1); - - return (0); -} - -/* This is callback from uma(9), called on free. */ -static void -uma_dtor_flow(void *mem, int size, void *arg) -{ - priv_p priv = (priv_p )arg; - - atomic_subtract_32(&priv->info.nfinfo_used, 1); -} - -#ifdef INET6 -/* This is callback from uma(9), called on alloc. */ -static int -uma_ctor_flow6(void *mem, int size, void *arg, int how) -{ - priv_p priv = (priv_p )arg; - - if (atomic_load_acq_32(&priv->info.nfinfo_used6) >= CACHESIZE) - return (ENOMEM); - - atomic_add_32(&priv->info.nfinfo_used6, 1); - - return (0); -} - -/* This is callback from uma(9), called on free. */ -static void -uma_dtor_flow6(void *mem, int size, void *arg) -{ - priv_p priv = (priv_p )arg; - - atomic_subtract_32(&priv->info.nfinfo_used6, 1); -} -#endif - /* * Detach export datagram from priv, if there is any. * If there is no, allocate a new one. @@ -267,9 +216,9 @@ expire_flow(priv_p priv, fib_export_p fe if ((priv->export != NULL) && (version == IPVERSION)) { exp.item = get_export_dgram(priv, fe); if (exp.item == NULL) { - atomic_add_32(&priv->info.nfinfo_export_failed, 1); + priv->nfinfo_export_failed++; if (priv->export9 != NULL) - atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + priv->nfinfo_export9_failed++; /* fle definitely contains IPv4 flow. */ uma_zfree_arg(priv->zone, fle, priv); return; @@ -284,7 +233,7 @@ expire_flow(priv_p priv, fib_export_p fe if (priv->export9 != NULL) { exp.item9 = get_export9_dgram(priv, fe, &exp.item9_opt); if (exp.item9 == NULL) { - atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + priv->nfinfo_export9_failed++; if (version == IPVERSION) uma_zfree_arg(priv->zone, fle, priv); #ifdef INET6 @@ -317,8 +266,27 @@ void ng_netflow_copyinfo(priv_p priv, struct ng_netflow_info *i) { - /* XXX: atomic */ - memcpy((void *)i, (void *)&priv->info, sizeof(priv->info)); + i->nfinfo_bytes = counter_u64_fetch(priv->nfinfo_bytes); + i->nfinfo_packets = counter_u64_fetch(priv->nfinfo_packets); + i->nfinfo_bytes6 = counter_u64_fetch(priv->nfinfo_bytes6); + i->nfinfo_packets6 = counter_u64_fetch(priv->nfinfo_packets6); + i->nfinfo_sbytes = counter_u64_fetch(priv->nfinfo_sbytes); + i->nfinfo_spackets = counter_u64_fetch(priv->nfinfo_spackets); + i->nfinfo_sbytes6 = counter_u64_fetch(priv->nfinfo_sbytes6); + i->nfinfo_spackets6 = counter_u64_fetch(priv->nfinfo_spackets6); + i->nfinfo_act_exp = counter_u64_fetch(priv->nfinfo_act_exp); + i->nfinfo_inact_exp = counter_u64_fetch(priv->nfinfo_inact_exp); + + i->nfinfo_used = uma_zone_get_cur(priv->zone); + i->nfinfo_used6 = uma_zone_get_cur(priv->zone6); + + i->nfinfo_alloc_failed = priv->nfinfo_alloc_failed; + i->nfinfo_export_failed = priv->nfinfo_export_failed; + i->nfinfo_export9_failed = priv->nfinfo_export9_failed; + i->nfinfo_realloc_mbuf = priv->nfinfo_realloc_mbuf; + i->nfinfo_alloc_fibs = priv->nfinfo_alloc_fibs; + i->nfinfo_inact_t = priv->nfinfo_inact_t; + i->nfinfo_act_t = priv->nfinfo_act_t; } /* @@ -343,7 +311,7 @@ hash_insert(priv_p priv, struct flow_has fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); if (fle == NULL) { - atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); + priv->nfinfo_alloc_failed++; return (ENOMEM); } @@ -433,7 +401,7 @@ hash6_insert(priv_p priv, struct flow_ha fle6 = uma_zalloc_arg(priv->zone6, priv, M_NOWAIT); if (fle6 == NULL) { - atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); + priv->nfinfo_alloc_failed++; return (ENOMEM); } @@ -526,13 +494,13 @@ ng_netflow_cache_init(priv_p priv) /* Initialize cache UMA zone. */ priv->zone = uma_zcreate("NetFlow IPv4 cache", - sizeof(struct flow_entry), uma_ctor_flow, uma_dtor_flow, NULL, - NULL, UMA_ALIGN_CACHE, 0); + sizeof(struct flow_entry), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(priv->zone, CACHESIZE); #ifdef INET6 priv->zone6 = uma_zcreate("NetFlow IPv6 cache", - sizeof(struct flow6_entry), uma_ctor_flow6, uma_dtor_flow6, NULL, - NULL, UMA_ALIGN_CACHE, 0); + sizeof(struct flow6_entry), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(priv->zone6, CACHESIZE); #endif @@ -558,6 +526,17 @@ ng_netflow_cache_init(priv_p priv) } #endif + priv->nfinfo_bytes = counter_u64_alloc(M_WAITOK); + priv->nfinfo_packets = counter_u64_alloc(M_WAITOK); + priv->nfinfo_bytes6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_packets6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_sbytes = counter_u64_alloc(M_WAITOK); + priv->nfinfo_spackets = counter_u64_alloc(M_WAITOK); + priv->nfinfo_sbytes6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_spackets6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_act_exp = counter_u64_alloc(M_WAITOK); + priv->nfinfo_inact_exp = counter_u64_alloc(M_WAITOK); + ng_netflow_v9_cache_init(priv); CTR0(KTR_NET, "ng_netflow startup()"); } @@ -594,7 +573,7 @@ ng_netflow_fib_init(priv_p priv, int fib /* Increase counter for statistics */ CTR3(KTR_NET, "ng_netflow(): fib %d setup to %p (%p)", fib, fe, priv_to_fib(priv, fib)); - atomic_fetchadd_32(&priv->info.nfinfo_alloc_fibs, 1); + priv->nfinfo_alloc_fibs++; } return (0); @@ -667,6 +646,17 @@ ng_netflow_cache_flush(priv_p priv) free(fe, M_NETGRAPH); } + counter_u64_free(priv->nfinfo_bytes); + counter_u64_free(priv->nfinfo_packets); + counter_u64_free(priv->nfinfo_bytes6); + counter_u64_free(priv->nfinfo_packets6); + counter_u64_free(priv->nfinfo_sbytes); + counter_u64_free(priv->nfinfo_spackets); + counter_u64_free(priv->nfinfo_sbytes6); + counter_u64_free(priv->nfinfo_spackets6); + counter_u64_free(priv->nfinfo_act_exp); + counter_u64_free(priv->nfinfo_inact_exp); + ng_netflow_v9_cache_flush(priv); } @@ -734,9 +724,8 @@ ng_netflow_flow_add(priv_p priv, fib_exp break; } - atomic_fetchadd_32(&priv->info.nfinfo_packets, 1); - /* XXX: atomic */ - priv->info.nfinfo_bytes += plen; + counter_u64_add(priv->nfinfo_packets, 1); + counter_u64_add(priv->nfinfo_bytes, plen); /* Find hash slot. */ hsh = &priv->hash[ip_hash(&r)]; @@ -756,7 +745,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } } @@ -778,7 +767,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } else { /* * It is the newest, move it to the tail, @@ -853,9 +842,8 @@ ng_netflow_flow6_add(priv_p priv, fib_ex r.r_ip_p = upper_proto; r.r_i_ifx = src_if_index; - atomic_fetchadd_32(&priv->info.nfinfo_packets6, 1); - /* XXX: atomic */ - priv->info.nfinfo_bytes6 += plen; + counter_u64_add(priv->nfinfo_packets6, 1); + counter_u64_add(priv->nfinfo_bytes6, plen); /* Find hash slot. */ hsh = &priv->hash6[ip6_hash(&r)]; @@ -878,7 +866,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } } @@ -901,7 +889,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } else { /* * It is the newest, move it to the tail, @@ -1119,12 +1107,12 @@ ng_netflow_expire(void *arg) struct flow_entry *fle, *fle1; struct flow_hash_entry *hsh; priv_p priv = (priv_p )arg; - uint32_t used; - int i; + int used, i; /* * Going through all the cache. */ + used = uma_zone_get_cur(priv->zone); for (hsh = priv->hash, i = 0; i < NBUCKETS; hsh++, i++) { /* * Skip entries, that are already being worked on. @@ -1132,7 +1120,6 @@ ng_netflow_expire(void *arg) if (mtx_trylock(&hsh->mtx) == 0) continue; - used = atomic_load_acq_32(&priv->info.nfinfo_used); TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { /* * Interrupt thread wants this entry! @@ -1154,13 +1141,14 @@ ng_netflow_expire(void *arg) expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_NOFLAGS); used--; - atomic_add_32(&priv->info.nfinfo_inact_exp, 1); + counter_u64_add(priv->nfinfo_inact_exp, 1); } } mtx_unlock(&hsh->mtx); } #ifdef INET6 + used = uma_zone_get_cur(priv->zone6); for (hsh = priv->hash6, i = 0; i < NBUCKETS; hsh++, i++) { struct flow6_entry *fle6; @@ -1170,7 +1158,6 @@ ng_netflow_expire(void *arg) if (mtx_trylock(&hsh->mtx) == 0) continue; - used = atomic_load_acq_32(&priv->info.nfinfo_used6); TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { fle6 = (struct flow6_entry *)fle; /* @@ -1193,7 +1180,7 @@ ng_netflow_expire(void *arg) expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_NOFLAGS); used--; - atomic_add_32(&priv->info.nfinfo_inact_exp, 1); + counter_u64_add(priv->nfinfo_inact_exp, 1); } } mtx_unlock(&hsh->mtx); Modified: head/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- head/sys/netgraph/netflow/netflow_v9.c Wed Jan 1 21:25:13 2014 (r260168) +++ head/sys/netgraph/netflow/netflow_v9.c Wed Jan 1 21:48:04 2014 (r260169) @@ -32,16 +32,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" #include +#include +#include #include #include #include #include -#include #include -#include - -#include -#include #include #include Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Wed Jan 1 21:25:13 2014 (r260168) +++ head/sys/netgraph/netflow/ng_netflow.c Wed Jan 1 21:48:04 2014 (r260169) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -250,8 +251,8 @@ ng_netflow_constructor(node_p node) priv->node = node; /* Initialize timeouts to default values */ - priv->info.nfinfo_inact_t = INACTIVE_TIMEOUT; - priv->info.nfinfo_act_t = ACTIVE_TIMEOUT; + priv->nfinfo_inact_t = INACTIVE_TIMEOUT; + priv->nfinfo_act_t = ACTIVE_TIMEOUT; /* Set default config */ for (i = 0; i < NG_NETFLOW_MAXIFACES; i++) @@ -475,8 +476,8 @@ ng_netflow_rcvmsg (node_p node, item_p i set = (struct ng_netflow_settimeouts *)msg->data; - priv->info.nfinfo_inact_t = set->inactive_timeout; - priv->info.nfinfo_act_t = set->active_timeout; + priv->nfinfo_inact_t = set->inactive_timeout; + priv->nfinfo_act_t = set->active_timeout; break; } @@ -895,7 +896,7 @@ loopend: #endif /* Just in case of real reallocation in M_CHECK() / m_pullup() */ if (m != m_old) { - atomic_fetchadd_32(&priv->info.nfinfo_realloc_mbuf, 1); + priv->nfinfo_realloc_mbuf++; /* Restore ip/ipv6 pointer */ if (ip != NULL) ip = (struct ip *)(mtod(m, caddr_t) + l3_off); @@ -949,13 +950,13 @@ bypass: if (acct == 0) { /* Accounting failure */ if (ip != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets, - 1); - priv->info.nfinfo_sbytes += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets, 1); + counter_u64_add(priv->nfinfo_sbytes, + m->m_pkthdr.len); } else if (ip6 != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets6, - 1); - priv->info.nfinfo_sbytes6 += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets6, 1); + counter_u64_add(priv->nfinfo_sbytes6, + m->m_pkthdr.len); } } Modified: head/sys/netgraph/netflow/ng_netflow.h ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.h Wed Jan 1 21:25:13 2014 (r260168) +++ head/sys/netgraph/netflow/ng_netflow.h Wed Jan 1 21:48:04 2014 (r260169) @@ -33,7 +33,7 @@ #define _NG_NETFLOW_H_ #define NG_NETFLOW_NODE_TYPE "netflow" -#define NGM_NETFLOW_COOKIE 1309868867 +#define NGM_NETFLOW_COOKIE 1365756954 #define NGM_NETFLOW_V9_COOKIE 1349865386 #define NG_NETFLOW_MAXIFACES USHRT_MAX @@ -65,13 +65,15 @@ enum { /* This structure is returned by the NGM_NETFLOW_INFO message */ struct ng_netflow_info { uint64_t nfinfo_bytes; /* accounted IPv4 bytes */ - uint32_t nfinfo_packets; /* accounted IPv4 packets */ + uint64_t nfinfo_packets; /* accounted IPv4 packets */ uint64_t nfinfo_bytes6; /* accounted IPv6 bytes */ - uint32_t nfinfo_packets6; /* accounted IPv6 packets */ + uint64_t nfinfo_packets6; /* accounted IPv6 packets */ uint64_t nfinfo_sbytes; /* skipped IPv4 bytes */ - uint32_t nfinfo_spackets; /* skipped IPv4 packets */ + uint64_t nfinfo_spackets; /* skipped IPv4 packets */ uint64_t nfinfo_sbytes6; /* skipped IPv6 bytes */ - uint32_t nfinfo_spackets6; /* skipped IPv6 packets */ + uint64_t nfinfo_spackets6; /* skipped IPv6 packets */ + uint64_t nfinfo_act_exp; /* active expiries */ + uint64_t nfinfo_inact_exp; /* inactive expiries */ uint32_t nfinfo_used; /* used cache records */ uint32_t nfinfo_used6; /* used IPv6 cache records */ uint32_t nfinfo_alloc_failed; /* failed allocations */ @@ -79,12 +81,35 @@ struct ng_netflow_info { uint32_t nfinfo_export9_failed; /* failed exports */ uint32_t nfinfo_realloc_mbuf; /* reallocated mbufs */ uint32_t nfinfo_alloc_fibs; /* fibs allocated */ - uint32_t nfinfo_act_exp; /* active expiries */ - uint32_t nfinfo_inact_exp; /* inactive expiries */ uint32_t nfinfo_inact_t; /* flow inactive timeout */ uint32_t nfinfo_act_t; /* flow active timeout */ }; +/* Parse the info structure */ +#define NG_NETFLOW_INFO_TYPE { \ + { "IPv4 bytes", &ng_parse_uint64_type },\ + { "IPv4 packets", &ng_parse_uint64_type },\ + { "IPv6 bytes", &ng_parse_uint64_type },\ + { "IPv6 packets", &ng_parse_uint64_type },\ + { "IPv4 skipped bytes", &ng_parse_uint64_type },\ + { "IPv4 skipped packets", &ng_parse_uint64_type },\ + { "IPv6 skipped bytes", &ng_parse_uint64_type },\ + { "IPv6 skipped packets", &ng_parse_uint64_type },\ + { "Active expiries", &ng_parse_uint64_type },\ + { "Inactive expiries", &ng_parse_uint64_type },\ + { "IPv4 records used", &ng_parse_uint32_type },\ + { "IPv6 records used", &ng_parse_uint32_type },\ + { "Failed allocations", &ng_parse_uint32_type },\ + { "V5 failed exports", &ng_parse_uint32_type },\ + { "V9 failed exports", &ng_parse_uint32_type },\ + { "mbuf reallocations", &ng_parse_uint32_type },\ + { "fibs allocated", &ng_parse_uint32_type },\ + { "Inactive timeout", &ng_parse_uint32_type },\ + { "Active timeout", &ng_parse_uint32_type },\ + { NULL } \ +} + + /* This structure is returned by the NGM_NETFLOW_IFINFO message */ struct ng_netflow_ifinfo { uint32_t ifinfo_packets; /* number of packets for this iface */ @@ -282,30 +307,6 @@ struct flow6_entry { }; /* Parsing declarations */ -/* Parse the info structure */ -#define NG_NETFLOW_INFO_TYPE { \ - { "IPv4 bytes", &ng_parse_uint64_type },\ - { "IPv4 packets", &ng_parse_uint32_type },\ - { "IPv6 bytes", &ng_parse_uint64_type },\ - { "IPv6 packets", &ng_parse_uint32_type },\ - { "IPv4 skipped bytes", &ng_parse_uint64_type },\ - { "IPv4 skipped packets", &ng_parse_uint32_type },\ - { "IPv6 skipped bytes", &ng_parse_uint64_type },\ - { "IPv6 skipped packets", &ng_parse_uint32_type },\ - { "IPv4 records used", &ng_parse_uint32_type },\ - { "IPv6 records used", &ng_parse_uint32_type },\ - { "Failed allocations", &ng_parse_uint32_type },\ - { "V5 failed exports", &ng_parse_uint32_type },\ - { "V9 failed exports", &ng_parse_uint32_type },\ - { "mbuf reallocations", &ng_parse_uint32_type },\ - { "fibs allocated", &ng_parse_uint32_type },\ - { "Active expiries", &ng_parse_uint32_type },\ - { "Inactive expiries", &ng_parse_uint32_type },\ - { "Inactive timeout", &ng_parse_uint32_type },\ - { "Active timeout", &ng_parse_uint32_type },\ - { NULL } \ -} - /* Parse the ifinfo structure */ #define NG_NETFLOW_IFINFO_TYPE { \ { "packets", &ng_parse_uint32_type },\ @@ -408,7 +409,6 @@ struct netflow { node_p node; /* link to the node itself */ hook_p export; /* export data goes there */ hook_p export9; /* Netflow V9 export data goes there */ - struct ng_netflow_info info; struct callout exp_callout; /* expiry periodic job */ /* @@ -440,6 +440,25 @@ struct netflow { struct flow_hash_entry *hash6; #endif + /* Statistics. */ + counter_u64_t nfinfo_bytes; /* accounted IPv4 bytes */ + counter_u64_t nfinfo_packets; /* accounted IPv4 packets */ + counter_u64_t nfinfo_bytes6; /* accounted IPv6 bytes */ + counter_u64_t nfinfo_packets6; /* accounted IPv6 packets */ + counter_u64_t nfinfo_sbytes; /* skipped IPv4 bytes */ + counter_u64_t nfinfo_spackets; /* skipped IPv4 packets */ + counter_u64_t nfinfo_sbytes6; /* skipped IPv6 bytes */ + counter_u64_t nfinfo_spackets6; /* skipped IPv6 packets */ + counter_u64_t nfinfo_act_exp; /* active expiries */ + counter_u64_t nfinfo_inact_exp; /* inactive expiries */ + uint32_t nfinfo_alloc_failed; /* failed allocations */ + uint32_t nfinfo_export_failed; /* failed exports */ + uint32_t nfinfo_export9_failed; /* failed exports */ + uint32_t nfinfo_realloc_mbuf; /* reallocated mbufs */ + uint32_t nfinfo_alloc_fibs; /* fibs allocated */ + uint32_t nfinfo_inact_t; /* flow inactive timeout */ + uint32_t nfinfo_act_t; /* flow active timeout */ + /* Multiple FIB support */ fib_export_p *fib_data; /* vector to per-fib data */ uint16_t maxfibs; /* number of allocated fibs */ From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 22:51:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B5143883; Wed, 1 Jan 2014 22:51: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 A16331D13; Wed, 1 Jan 2014 22:51: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 s01MpJmr074444; Wed, 1 Jan 2014 22:51:19 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01MpJFM074443; Wed, 1 Jan 2014 22:51:19 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401012251.s01MpJFM074443@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 1 Jan 2014 22:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260175 - head/sys/ia64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 22:51:19 -0000 Author: marcel Date: Wed Jan 1 22:51:19 2014 New Revision: 260175 URL: http://svnweb.freebsd.org/changeset/base/260175 Log: Implement atomic_swap_. The operation was documented and implemented partially (both from a type and architecture perspective) on 2013-08-21 and got used in ZFS with revision 260150 (zfeature.c) and since ZFS is supported on ia64, the lack of having atomic_swap became problem. Modified: head/sys/ia64/include/atomic.h Modified: head/sys/ia64/include/atomic.h ============================================================================== --- head/sys/ia64/include/atomic.h Wed Jan 1 22:49:37 2014 (r260174) +++ head/sys/ia64/include/atomic.h Wed Jan 1 22:51:19 2014 (r260175) @@ -386,4 +386,32 @@ atomic_fetchadd_long(volatile u_long *p, return (value); } +/* + * atomic_swap_(volatile *p, v); + */ + +static __inline uint32_t +atomic_swap_32(volatile uint32_t *p, uint32_t v) +{ + uint32_t r; + + __asm __volatile ("xchg4 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : + "r"(v), "m"(*p) : "memory"); + return (r); +} + +static __inline uint64_t +atomic_swap_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t r; + + __asm __volatile ("xchg8 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : + "r"(v), "m"(*p) : "memory"); + return (r); +} + +#define atomic_swap_int atomic_swap_32 +#define atomic_swap_long atomic_swap_64 +#define atomic_swap_ptr atomic_swap_64 + #endif /* ! _MACHINE_ATOMIC_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Jan 1 23:13:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3387FB9; Wed, 1 Jan 2014 23:13:53 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id 8304F295A; Wed, 1 Jan 2014 23:13:52 +0000 (UTC) Message-ID: <52C4A118.9020000@FreeBSD.org> Date: Thu, 02 Jan 2014 03:13:28 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r260151 - head/sys/netinet6 References: <201401010056.s010uR70070405@svn.freebsd.org> In-Reply-To: <201401010056.s010uR70070405@svn.freebsd.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 23:13:53 -0000 On 01.01.2014 04:56, Adrian Chadd wrote: > Author: adrian > Date: Wed Jan 1 00:56:26 2014 > New Revision: 260151 > URL: http://svnweb.freebsd.org/changeset/base/260151 > > Log: > 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. This is very hackish and not correct. -- WBR, Andrey V. Elsukov From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 02:20:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09101235; Thu, 2 Jan 2014 02:20: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 E990B1900; Thu, 2 Jan 2014 02:20: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 s022KAsj053327; Thu, 2 Jan 2014 02:20:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s022KAdP053326; Thu, 2 Jan 2014 02:20:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401020220.s022KAdP053326@svn.freebsd.org> From: Warner Losh Date: Thu, 2 Jan 2014 02:20:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260180 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 02:20:11 -0000 Author: imp Date: Thu Jan 2 02:20:10 2014 New Revision: 260180 URL: http://svnweb.freebsd.org/changeset/base/260180 Log: Make the comment match the code. Not sure why we calculate it this weird way, but didn't change that... Modified: head/sys/dev/nand/nandbus.c Modified: head/sys/dev/nand/nandbus.c ============================================================================== --- head/sys/dev/nand/nandbus.c Thu Jan 2 01:51:54 2014 (r260179) +++ head/sys/dev/nand/nandbus.c Thu Jan 2 02:20:10 2014 (r260180) @@ -503,7 +503,7 @@ nandbus_wait_ready(device_t dev, uint8_t struct timeval tv, tv2; tv2.tv_sec = 0; - tv2.tv_usec = 50 * 5000; /* 10ms */ + tv2.tv_usec = 50 * 5000; /* 250ms */ getmicrotime(&tv); timevaladd(&tv, &tv2); From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 02:51:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 83CCAB64; Thu, 2 Jan 2014 02:51:41 +0000 (UTC) Received: from mail-qc0-x235.google.com (mail-qc0-x235.google.com [IPv6:2607:f8b0:400d:c01::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B2431B2D; Thu, 2 Jan 2014 02:51:40 +0000 (UTC) Received: by mail-qc0-f181.google.com with SMTP id e9so12878193qcy.40 for ; Wed, 01 Jan 2014 18:51:40 -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=dfZtTgef+U50okCo0kGOQNNDsNQozcFbXXjtRJJLc70=; b=Gzw7fB7npqcuKOBKTjXs9RDHI9MWPtVYU2dFSF33sfaj82tYxDBatIVq2CEdVLDY6u YG4ZFijTWuvcCRyU2YojdlC5x2EFLhPS8wRmvoXyfNFLv9KQHRu8Af9/fsp99Kd42xjT lEoLWy/L7f2+kQZtIuOau54H9Ko/14GzVjWaWLMihakPcC8+NBAAQCVkWDSslzG4iUmh RJL9CrBwFv44wXLddgYcU2IQeFXAAE2ptglyBe9pmYF9qHmLBgJS1GO4BbxVwEIP/cbd bbiDvKrMF5kaDrfsbTfL8MqpmiL8k8LedlDCNdQ4EONJgkurHc44WGc5zpIMvGk8nz5R dp0g== MIME-Version: 1.0 X-Received: by 10.49.24.140 with SMTP id u12mr86230040qef.78.1388631100276; Wed, 01 Jan 2014 18:51:40 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Wed, 1 Jan 2014 18:51:40 -0800 (PST) Received: by 10.224.52.8 with HTTP; Wed, 1 Jan 2014 18:51:40 -0800 (PST) In-Reply-To: <52C4A118.9020000@FreeBSD.org> References: <201401010056.s010uR70070405@svn.freebsd.org> <52C4A118.9020000@FreeBSD.org> Date: Wed, 1 Jan 2014 18:51:40 -0800 X-Google-Sender-Auth: CPTU9BeuSrF0dXmUrfQp_X8gABk Message-ID: Subject: Re: svn commit: r260151 - head/sys/netinet6 From: Adrian Chadd To: "Andrey V. Elsukov" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 02:51:41 -0000 Why not? Adrian On Jan 1, 2014 6:13 PM, "Andrey V. Elsukov" wrote: > On 01.01.2014 04:56, Adrian Chadd wrote: > > Author: adrian > > Date: Wed Jan 1 00:56:26 2014 > > New Revision: 260151 > > URL: http://svnweb.freebsd.org/changeset/base/260151 > > > > Log: > > 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. > > This is very hackish and not correct. > > -- > WBR, Andrey V. Elsukov > From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 03:24:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1DAD3D6; Thu, 2 Jan 2014 03:24:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BD0801EEC; Thu, 2 Jan 2014 03:24:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s023OikU080529; Thu, 2 Jan 2014 03:24:44 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s023Oi5T080528; Thu, 2 Jan 2014 03:24:44 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401020324.s023Oi5T080528@svn.freebsd.org> From: Xin LI Date: Thu, 2 Jan 2014 03:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260181 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 03:24:44 -0000 Author: delphij Date: Thu Jan 2 03:24:44 2014 New Revision: 260181 URL: http://svnweb.freebsd.org/changeset/base/260181 Log: Fix build on platforms where atomic_swap_64 is not available. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Thu Jan 2 02:20:10 2014 (r260180) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Thu Jan 2 03:24:44 2014 (r260181) @@ -312,8 +312,12 @@ feature_sync(spa_t *spa, zfeature_info_t if (feature->fi_feature != SPA_FEATURE_NONE) { uint64_t *refcount_cache = &spa->spa_feat_refcount_cache[feature->fi_feature]; +#ifdef atomic_swap_64 VERIFY3U(*refcount_cache, ==, atomic_swap_64(refcount_cache, refcount)); +#else + *refcount_cache = refcount; +#endif } if (refcount == 0) From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 05:53:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F12D79A3; Thu, 2 Jan 2014 05:53:53 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id C2795ABB; Thu, 2 Jan 2014 05:53:52 +0000 (UTC) Message-ID: <52C4FED7.6050305@FreeBSD.org> Date: Thu, 02 Jan 2014 09:53:27 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: svn commit: r260151 - head/sys/netinet6 References: <201401010056.s010uR70070405@svn.freebsd.org> <52C4A118.9020000@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 05:53:54 -0000 On 02.01.2014 06:51, Adrian Chadd wrote: > Why not? Hi, Adrian, now, after a deeper look I think it is ok. Sorry. Also there are several places where wlock can be changed to rlock. -- WBR, Andrey V. Elsukov From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 06:42:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BFEF72D9; Thu, 2 Jan 2014 06:42:25 +0000 (UTC) Received: from mail-qe0-x233.google.com (mail-qe0-x233.google.com [IPv6:2607:f8b0:400d:c02::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 486B01A63; Thu, 2 Jan 2014 06:42:25 +0000 (UTC) Received: by mail-qe0-f51.google.com with SMTP id 1so14151770qee.10 for ; Wed, 01 Jan 2014 22:42:23 -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=CALR2YrADp4kGZuubev22mAmb5IIQ/uI7lVUop8JeaM=; b=Pxd1WF43AuoQNiqdIUXSD/HYBed1b4WUo7HD9JhB46wfejC3gUeCrk80iwdeid+ciX wjY2daYeMkOSZdt8bgcxNer/q8h5lFW5/Dqsk2u9pCj4pgqYy1R+AIWJOhVgrKS/VuLc oV9Ynw/KOXSUM5N8FRhloLVoGPBeO8VDbfwUcsePk9oINfZUjBr4XvGMHry+qtzOyz6I hLTPtvLYBXiSKGFyGDvng+TE094JPy9r5iBejWm4ayCP9+7VY5z0rwIxOVJdGL5vTq4O JOmp2cvIx0aQuC2S7eebxFoTNApcoZwNzYTxZcoy1StTWRfO1GCSF1egxV1TNeLqMT/j ZXsA== MIME-Version: 1.0 X-Received: by 10.224.46.8 with SMTP id h8mr135639486qaf.49.1388644943665; Wed, 01 Jan 2014 22:42:23 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Wed, 1 Jan 2014 22:42:23 -0800 (PST) In-Reply-To: <52C4FED7.6050305@FreeBSD.org> References: <201401010056.s010uR70070405@svn.freebsd.org> <52C4A118.9020000@FreeBSD.org> <52C4FED7.6050305@FreeBSD.org> Date: Wed, 1 Jan 2014 22:42:23 -0800 X-Google-Sender-Auth: GuIe1pxYeMnONo58eZ-fUnGAgRY Message-ID: Subject: Re: svn commit: r260151 - head/sys/netinet6 From: Adrian Chadd To: "Andrey V. Elsukov" Content-Type: text/plain; charset=ISO-8859-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 06:42:25 -0000 On 1 January 2014 21:53, Andrey V. Elsukov wrote: > On 02.01.2014 06:51, Adrian Chadd wrote: >> Why not? > > Hi, Adrian, > > now, after a deeper look I think it is ok. Sorry. > Also there are several places where wlock can be changed to rlock. Cool commit away! Thanks! -a From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 07:16:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D722E8AA; Thu, 2 Jan 2014 07:16:36 +0000 (UTC) Received: from mx0.deglitch.com (unknown [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 853671D4F; Thu, 2 Jan 2014 07:16:36 +0000 (UTC) Received: from [192.168.1.12] (unknown [37.113.188.17]) by mx0.deglitch.com (Postfix) with ESMTPSA id 5CADE8FC40; Thu, 2 Jan 2014 11:16:26 +0400 (MSK) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... From: Stanislav Sedov In-Reply-To: <201309050009.r8509vsE061271@svn.freebsd.org> Date: Wed, 1 Jan 2014 23:16:22 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> References: <201309050009.r8509vsE061271@svn.freebsd.org> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 07:16:36 -0000 On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wrote: > This commit also breaks compatibility with some existing Capsicum = system calls, > but I see no other way to do that. This should be fine as Capsicum is = still > experimental and this change is not going to 9.x. Hi! This change also increases the size of kinfo_file structure, which won=92t= allow programs not compiled against HEAD and working with kern.info.filedesc = sysctl to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won=92t run = properly on HEAD, and it also broke valgrind). Is there absolutely no way to avoid = extending the size of this struct? Thanks! > #if defined(__amd64__) || defined(__i386__) > -#define KINFO_FILE_SIZE 1392 > +#define KINFO_FILE_SIZE 1424 > #endif > =20 > struct kinfo_file { > @@ -389,6 +390,7 @@ > 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. */ > /* Truncated before copyout in sysctl */ > char kf_path[PATH_MAX]; /* Path to file, if = any. */ -- ST4096-RIPE From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 07:34:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58047DB8; Thu, 2 Jan 2014 07:34:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F84B1E65; Thu, 2 Jan 2014 07:34: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 s027Ycmm074010; Thu, 2 Jan 2014 07:34:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s027Ybec074003; Thu, 2 Jan 2014 07:34:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401020734.s027Ybec074003@svn.freebsd.org> From: Xin LI Date: Thu, 2 Jan 2014 07:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260183 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common cddl/co... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 07:34:38 -0000 Author: delphij Date: Thu Jan 2 07:34:36 2014 New Revision: 260183 URL: http://svnweb.freebsd.org/changeset/base/260183 Log: MFV r260154 + 260182: 4369 implement zfs bookmarks 4368 zfs send filesystems from readonly pools Illumos/illumos-gate@78f171005391b928aaf1642b3206c534ed644332 MFC after: 2 weeks Added: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c - copied unchanged from r260154, vendor-sys/illumos/dist/uts/common/fs/zfs/dsl_bookmark.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_bookmark.h - copied unchanged from r260154, vendor-sys/illumos/dist/uts/common/fs/zfs/sys/dsl_bookmark.h Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/cddl/contrib/opensolaris/lib/pyzfs/common/allow.py head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/conf/files Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 2 07:34:36 2014 (r260183) @@ -18,7 +18,7 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" Copyright (c) 2013 by Delphix. All rights reserved. .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery @@ -26,10 +26,11 @@ .\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2013, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland +.\" Copyright (c) 2014, Xin LI .\" .\" $FreeBSD$ .\" -.Dd December 24, 2013 +.Dd January 2, 2014 .Dt ZFS 8 .Os .Sh NAME @@ -57,11 +58,16 @@ .Cm destroy .Op Fl dnpRrv .Sm off -.Ar snapshot -.Op % Ns Ar snapname +.Ar filesystem Ns | Ns volume +.Ns @snap +.Op % Ns Ar snap +.Op , Ns Ar snap Op % Ns Ar snap .Op , Ns ... .Sm on .Nm +.Cm destroy +.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark +.Nm .Cm snapshot Ns | Ns Cm snap .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... @@ -168,11 +174,19 @@ .Cm unshare .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm +.Cm bookmark +.Ar snapshot +.Ar bookmark +.Nm .Cm send .Op Fl DnPpRv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm +.Cm send +.Op Fl i Ar snapshot Ns | Ns bookmark +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm .Cm receive Ns | Ns Cm recv .Op Fl vnFu .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot @@ -1654,6 +1668,13 @@ options, as they can destroy large porti behavior for mounted file systems in use. .It Xo .Nm +.Cm destroy +.Ar filesystem Ns | Ns Ar volume Ns # Ns Ar bookmark +.Xc +.Pp +The given bookmark is destroyed. +.It Xo +.Nm .Cm snapshot Ns | Ns Cm snap .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... @@ -1686,14 +1707,24 @@ Roll back the given dataset to a previou back, all data that has changed since the snapshot is discarded, and the dataset reverts to the state at the time of the snapshot. By default, the command refuses to roll back to a snapshot other than the most recent one. In -order to do so, all intermediate snapshots must be destroyed by specifying the +order to do so, all intermediate snapshots and bookmarks must be destroyed +by specifying the .Fl r option. +.Pp +The +.Fl rR +options do not recursively destroy the child snapshots of a +recursive snapshot. +Only direct snapshots of the specified filesystem +are destroyed by either of these options. +To completely roll back a +recursive snapshot, you must rollback the individual child snapshots. .Bl -tag -width indent .It Fl r -Recursively destroy any snapshots more recent than the one specified. +Destroy any snapshots and bookmarks more recent than the one specified. .It Fl R -Recursively destroy any more recent snapshots, as well as any clones of those +Destroy any more recent snapshots and bookmarks, as well as any clones of those snapshots. .It Fl f Used with the @@ -1868,7 +1899,7 @@ syntax. A comma-separated list of types to display, where .Ar type is one of -.Sy filesystem , snapshot , snap, volume , No or Sy all . +.Sy filesystem , snapshot , snap , volume , bookmark , No or Sy all . For example, specifying .Fl t Cm snapshot displays only snapshots. @@ -1965,7 +1996,7 @@ sections. The special value .Cm all can be used to display all properties that apply to the given dataset's type -(filesystem, volume, or snapshot). +(filesystem, volume, snapshot, or bookmark). .Bl -tag -width indent .It Fl r Recursively display properties for any children. @@ -2283,6 +2314,26 @@ file system shared on the system. .El .It Xo .Nm +.Cm bookmark +.Ar snapshot +.Ar bookmark +.Xc +.Pp +Creates a bookmark of the given snapshot. +Bookmarks mark the point in time +when the snapshot was created, and can be used as the incremental source for +a +.Qq Nm Cm send +command. +.Pp +This feature must be enabled to be used. +See +.Xr zpool-features 7 +for details on ZFS feature flags and the +.Sy bookmark +feature. +.It Xo +.Nm .Cm send .Op Fl DnPpRv .Op Fl i Ar snapshot | Fl I Ar snapshot @@ -2301,17 +2352,15 @@ a file or to a different system (for exa By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot -Generate an incremental stream from the -.Fl i Ar snapshot -to the last -.Ar snapshot . -The incremental source (the -.Fl i Ar snapshot ) -can be specified as the last component of the snapshot name (for example, the -part after the -.Sy @ ) , -and it is assumed to be from the same file system as the last -.Ar snapshot . +Generate an incremental stream from the first +.Ar snapshot Pq the incremental source +to the second +.Ar snapshot Pq the incremental target . +The incremental source can be specified as the last component of the +snapshot name +.Pq the Em @ No character and following +and +it is assumed to be from the same file system as the incremental target. .Pp If the destination is a clone, the source may be the origin snapshot, which must be fully specified (for example, @@ -2319,15 +2368,16 @@ must be fully specified (for example, not just .Cm @origin ) . .It Fl I Ar snapshot -Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot -to the last +Generate a stream package that sends all intermediary snapshots from the first +.Ar snapshot +to the second .Ar snapshot . For example, .Ic -I @a fs@d is similar to .Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . -The incremental source snapshot may be specified as with the +The incremental +source may be specified as with the .Fl i option. .It Fl R @@ -2380,6 +2430,35 @@ on future versions of .Tn ZFS . .It Xo .Nm +.Cm send +.Op Fl i Ar snapshot Ns | Ns Ar bookmark +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Xc +.Pp +Generate a send stream, which may be of a filesystem, and may be +incremental from a bookmark. +If the destination is a filesystem or volume, +the pool must be read-only, or the filesystem must not be mounted. +When the +stream generated from a filesystem or volume is received, the default snapshot +name will be +.Pq --head-- . +.Bl -tag -width indent +.It Fl i Ar snapshot Ns | Ns bookmark +Generate an incremental send stream. +The incremental source must be an earlier +snapshot in the destination's history. +It will commonly be an earlier +snapshot in the destination's filesystem, in which case it can be +specified as the last component of the name +.Pq the Em # No or Em @ No character and following . +.Pp +If the incremental target is a clone, the incremental source can +be the origin snapshot, or an earlier snapshot in the origin's filesystem, +or the origin's origin, etc. +.El +.It Xo +.Nm .Cm receive Ns | Ns Cm recv .Op Fl vnFu .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Thu Jan 2 07:34:36 2014 (r260183) @@ -24,6 +24,7 @@ * Copyright (c) 2012 Pawel Jakub Dawidek . * All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ #include @@ -72,7 +73,7 @@ uu_avl_pool_t *avl_pool; * Include snaps if they were requested or if this a zfs list where types * were not specified and the "listsnapshots" property is set on this pool. */ -static int +static boolean_t zfs_include_snapshots(zfs_handle_t *zhp, callback_data_t *cb) { zpool_handle_t *zph; @@ -92,8 +93,9 @@ static int zfs_callback(zfs_handle_t *zhp, void *data) { callback_data_t *cb = data; - int dontclose = 0; - int include_snaps = zfs_include_snapshots(zhp, cb); + boolean_t dontclose = B_FALSE; + boolean_t include_snaps = zfs_include_snapshots(zhp, cb); + boolean_t include_bmarks = (cb->cb_types & ZFS_TYPE_BOOKMARK); if ((zfs_get_type(zhp) & cb->cb_types) || ((zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) && include_snaps)) { @@ -119,7 +121,7 @@ zfs_callback(zfs_handle_t *zhp, void *da } } uu_avl_insert(cb->cb_avl, node, idx); - dontclose = 1; + dontclose = B_TRUE; } else { free(node); } @@ -134,11 +136,14 @@ zfs_callback(zfs_handle_t *zhp, void *da cb->cb_depth++; if (zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) (void) zfs_iter_filesystems(zhp, zfs_callback, data); - if ((zfs_get_type(zhp) != ZFS_TYPE_SNAPSHOT) && include_snaps) { + if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | + ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) (void) zfs_iter_snapshots(zhp, (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, data); - } + if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | + ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) + (void) zfs_iter_bookmarks(zhp, zfs_callback, data); cb->cb_depth--; } Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 2 07:34:36 2014 (r260183) @@ -107,6 +107,7 @@ static int zfs_do_release(int argc, char static int zfs_do_diff(int argc, char **argv); static int zfs_do_jail(int argc, char **argv); static int zfs_do_unjail(int argc, char **argv); +static int zfs_do_bookmark(int argc, char **argv); /* * Enable a reasonable set of defaults for libumem debugging on DEBUG builds. @@ -155,6 +156,7 @@ typedef enum { HELP_HOLDS, HELP_RELEASE, HELP_DIFF, + HELP_BOOKMARK, } zfs_help_t; typedef struct zfs_command { @@ -181,6 +183,7 @@ static zfs_command_t command_table[] = { { "clone", zfs_do_clone, HELP_CLONE }, { "promote", zfs_do_promote, HELP_PROMOTE }, { "rename", zfs_do_rename, HELP_RENAME }, + { "bookmark", zfs_do_bookmark, HELP_BOOKMARK }, { NULL }, { "list", zfs_do_list, HELP_LIST }, { NULL }, @@ -231,11 +234,12 @@ get_usage(zfs_help_t idx) case HELP_DESTROY: return (gettext("\tdestroy [-fnpRrv] \n" "\tdestroy [-dnpRrv] " - "[%][,...]\n")); + "@[%][,...]\n" + "\tdestroy #\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " - "[-o \"all\" | field[,...]] [-t type[,...]] " - "[-s source[,...]]\n" + "[-o \"all\" | field[,...]]\n" + "\t [-t type[,...]] [-s source[,...]]\n" "\t <\"all\" | property[,...]> " "[filesystem|volume|snapshot] ...\n")); case HELP_INHERIT: @@ -264,15 +268,16 @@ get_usage(zfs_help_t idx) case HELP_RENAME: return (gettext("\trename [-f] " "\n" - "\trename [-f] -p " - "\n" + "\trename [-f] -p \n" "\trename -r \n" "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRv] " - "[-i snapshot | -I snapshot] \n")); + return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] " + "\n" + "\tsend [-i snapshot|bookmark] " + "\n")); case HELP_SET: return (gettext("\tset " " ...\n")); @@ -280,7 +285,7 @@ get_usage(zfs_help_t idx) return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: return (gettext("\tsnapshot|snap [-r] [-o property=value] ... " - " ...\n")); + "@ ...\n")); case HELP_UNMOUNT: return (gettext("\tunmount|umount [-f] " "<-a | filesystem|mountpoint>\n")); @@ -309,11 +314,13 @@ get_usage(zfs_help_t idx) "\n")); case HELP_USERSPACE: return (gettext("\tuserspace [-Hinp] [-o field[,...]] " - "[-s field]...\n\t [-S field]... [-t type[,...]] " + "[-s field] ...\n" + "\t [-S field] ... [-t type[,...]] " "\n")); case HELP_GROUPSPACE: return (gettext("\tgroupspace [-Hinp] [-o field[,...]] " - "[-s field]...\n\t [-S field]... [-t type[,...]] " + "[-s field] ...\n" + "\t [-S field] ... [-t type[,...]] " "\n")); case HELP_HOLD: return (gettext("\thold [-r] ...\n")); @@ -324,6 +331,8 @@ get_usage(zfs_help_t idx) case HELP_DIFF: return (gettext("\tdiff [-FHt] " "[snapshot|filesystem]\n")); + case HELP_BOOKMARK: + return (gettext("\tbookmark \n")); } abort(); @@ -926,6 +935,7 @@ typedef struct destroy_cbdata { char *cb_prevsnap; int64_t cb_snapused; char *cb_snapspec; + char *cb_bookmark; } destroy_cbdata_t; /* @@ -1195,7 +1205,7 @@ zfs_do_destroy(int argc, char **argv) int err = 0; int c; zfs_handle_t *zhp = NULL; - char *at; + char *at, *pound; zfs_type_t type = ZFS_TYPE_DATASET; /* check options */ @@ -1247,6 +1257,7 @@ zfs_do_destroy(int argc, char **argv) } at = strchr(argv[0], '@'); + pound = strchr(argv[0], '#'); if (at != NULL) { /* Build the list of snaps to destroy in cb_nvl. */ @@ -1308,6 +1319,46 @@ zfs_do_destroy(int argc, char **argv) if (err != 0) rv = 1; + } else if (pound != NULL) { + int err; + nvlist_t *nvl; + + if (cb.cb_dryrun) { + (void) fprintf(stderr, + "dryrun is not supported with bookmark\n"); + return (-1); + } + + if (cb.cb_defer_destroy) { + (void) fprintf(stderr, + "defer destroy is not supported with bookmark\n"); + return (-1); + } + + if (cb.cb_recurse) { + (void) fprintf(stderr, + "recursive is not supported with bookmark\n"); + return (-1); + } + + if (!zfs_bookmark_exists(argv[0])) { + (void) fprintf(stderr, gettext("bookmark '%s' " + "does not exist.\n"), argv[0]); + return (1); + } + + nvl = fnvlist_alloc(); + fnvlist_add_boolean(nvl, argv[0]); + + err = lzc_destroy_bookmarks(nvl, NULL); + if (err != 0) { + (void) zfs_standard_error(g_zfs, err, + "cannot destroy bookmark"); + } + + nvlist_free(cb.cb_nvl); + + return (err); } else { /* Open the given dataset */ if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) @@ -1670,7 +1721,8 @@ zfs_do_get(int argc, char **argv) flags &= ~ZFS_ITER_PROP_LISTSNAPS; while (*optarg != '\0') { static char *type_subopts[] = { "filesystem", - "volume", "snapshot", "all", NULL }; + "volume", "snapshot", "bookmark", + "all", NULL }; switch (getsubopt(&optarg, type_subopts, &value)) { @@ -1684,7 +1736,11 @@ zfs_do_get(int argc, char **argv) types |= ZFS_TYPE_SNAPSHOT; break; case 3: - types = ZFS_TYPE_DATASET; + types |= ZFS_TYPE_BOOKMARK; + break; + case 4: + types = ZFS_TYPE_DATASET | + ZFS_TYPE_BOOKMARK; break; default: @@ -3029,7 +3085,8 @@ zfs_do_list(int argc, char **argv) flags &= ~ZFS_ITER_PROP_LISTSNAPS; while (*optarg != '\0') { static char *type_subopts[] = { "filesystem", - "volume", "snapshot", "snap", "all", NULL }; + "volume", "snapshot", "snap", "bookmark", + "all", NULL }; switch (getsubopt(&optarg, type_subopts, &value)) { @@ -3044,9 +3101,12 @@ zfs_do_list(int argc, char **argv) types |= ZFS_TYPE_SNAPSHOT; break; case 4: - types = ZFS_TYPE_DATASET; + types |= ZFS_TYPE_BOOKMARK; + break; + case 5: + types = ZFS_TYPE_DATASET | + ZFS_TYPE_BOOKMARK; break; - default: (void) fprintf(stderr, gettext("invalid type '%s'\n"), @@ -3286,9 +3346,29 @@ typedef struct rollback_cbdata { char *cb_target; int cb_error; boolean_t cb_recurse; - boolean_t cb_dependent; } rollback_cbdata_t; +static int +rollback_check_dependent(zfs_handle_t *zhp, void *data) +{ + rollback_cbdata_t *cbp = data; + + if (cbp->cb_first && cbp->cb_recurse) { + (void) fprintf(stderr, gettext("cannot rollback to " + "'%s': clones of previous snapshots exist\n"), + cbp->cb_target); + (void) fprintf(stderr, gettext("use '-R' to " + "force deletion of the following clones and " + "dependents:\n")); + cbp->cb_first = 0; + cbp->cb_error = 1; + } + + (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); + + zfs_close(zhp); + return (0); +} /* * Report any snapshots more recent than the one specified. Used when '-r' is * not specified. We reuse this same callback for the snapshot dependents - if @@ -3305,52 +3385,30 @@ rollback_check(zfs_handle_t *zhp, void * return (0); } - if (!cbp->cb_dependent) { - if (strcmp(zfs_get_name(zhp), cbp->cb_target) != 0 && - zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT && - zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > - cbp->cb_create) { - - if (cbp->cb_first && !cbp->cb_recurse) { - (void) fprintf(stderr, gettext("cannot " - "rollback to '%s': more recent snapshots " - "exist\n"), - cbp->cb_target); - (void) fprintf(stderr, gettext("use '-r' to " - "force deletion of the following " - "snapshots:\n")); - cbp->cb_first = 0; - cbp->cb_error = 1; - } - - if (cbp->cb_recurse) { - cbp->cb_dependent = B_TRUE; - if (zfs_iter_dependents(zhp, B_TRUE, - rollback_check, cbp) != 0) { - zfs_close(zhp); - return (-1); - } - cbp->cb_dependent = B_FALSE; - } else { - (void) fprintf(stderr, "%s\n", - zfs_get_name(zhp)); - } - } - } else { - if (cbp->cb_first && cbp->cb_recurse) { - (void) fprintf(stderr, gettext("cannot rollback to " - "'%s': clones of previous snapshots exist\n"), + if (zfs_prop_get_int(zhp, ZFS_PROP_CREATETXG) > cbp->cb_create) { + if (cbp->cb_first && !cbp->cb_recurse) { + (void) fprintf(stderr, gettext("cannot " + "rollback to '%s': more recent snapshots " + "or bookmarks exist\n"), cbp->cb_target); - (void) fprintf(stderr, gettext("use '-R' to " - "force deletion of the following clones and " - "dependents:\n")); + (void) fprintf(stderr, gettext("use '-r' to " + "force deletion of the following " + "snapshots and bookmarks:\n")); cbp->cb_first = 0; cbp->cb_error = 1; } - (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); + if (cbp->cb_recurse) { + if (zfs_iter_dependents(zhp, B_TRUE, + rollback_check_dependent, cbp) != 0) { + zfs_close(zhp); + return (-1); + } + } else { + (void) fprintf(stderr, "%s\n", + zfs_get_name(zhp)); + } } - zfs_close(zhp); return (0); } @@ -3420,7 +3478,9 @@ zfs_do_rollback(int argc, char **argv) cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); cb.cb_first = B_TRUE; cb.cb_error = 0; - if ((ret = zfs_iter_children(zhp, rollback_check, &cb)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) + goto out; + if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) goto out; if ((ret = cb.cb_error) != 0) @@ -3715,12 +3775,45 @@ zfs_do_send(int argc, char **argv) return (1); } - cp = strchr(argv[0], '@'); - if (cp == NULL) { - (void) fprintf(stderr, - gettext("argument must be a snapshot\n")); - usage(B_FALSE); + /* + * Special case sending a filesystem, or from a bookmark. + */ + if (strchr(argv[0], '@') == NULL || + (fromname && strchr(fromname, '#') != NULL)) { + char frombuf[ZFS_MAXNAMELEN]; + + if (flags.replicate || flags.doall || flags.props || + flags.dedup || flags.dryrun || flags.verbose || + flags.progress) { + (void) fprintf(stderr, + gettext("Error: " + "Unsupported flag with filesystem or bookmark.\n")); + return (1); + } + + zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET); + if (zhp == NULL) + return (1); + + if (fromname != NULL && + (fromname[0] == '#' || fromname[0] == '@')) { + /* + * Incremental source name begins with # or @. + * Default to same fs as target. + */ + (void) strncpy(frombuf, argv[0], sizeof (frombuf)); + cp = strchr(frombuf, '@'); + if (cp != NULL) + *cp = '\0'; + (void) strlcat(frombuf, fromname, sizeof (frombuf)); + fromname = frombuf; + } + err = zfs_send_one(zhp, fromname, STDOUT_FILENO); + zfs_close(zhp); + return (err != 0); } + + cp = strchr(argv[0], '@'); *cp = '\0'; toname = cp + 1; zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); @@ -3876,6 +3969,7 @@ zfs_do_receive(int argc, char **argv) #define ZFS_DELEG_PERM_HOLD "hold" #define ZFS_DELEG_PERM_RELEASE "release" #define ZFS_DELEG_PERM_DIFF "diff" +#define ZFS_DELEG_PERM_BOOKMARK "bookmark" #define ZFS_NUM_DELEG_NOTES ZFS_DELEG_NOTE_NONE @@ -3895,6 +3989,7 @@ static zfs_deleg_perm_tab_t zfs_deleg_pe { ZFS_DELEG_PERM_SEND, ZFS_DELEG_NOTE_SEND }, { ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE }, { ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT }, + { ZFS_DELEG_PERM_BOOKMARK, ZFS_DELEG_NOTE_BOOKMARK }, { ZFS_DELEG_PERM_GROUPQUOTA, ZFS_DELEG_NOTE_GROUPQUOTA }, { ZFS_DELEG_PERM_GROUPUSED, ZFS_DELEG_NOTE_GROUPUSED }, @@ -6666,6 +6761,108 @@ zfs_do_diff(int argc, char **argv) return (err != 0); } +/* + * zfs bookmark + * + * Creates a bookmark with the given name from the given snapshot. + */ +static int +zfs_do_bookmark(int argc, char **argv) +{ + char snapname[ZFS_MAXNAMELEN]; + zfs_handle_t *zhp; + nvlist_t *nvl; + int ret = 0; + int c; + + /* check options */ + while ((c = getopt(argc, argv, "")) != -1) { + switch (c) { + case '?': + (void) fprintf(stderr, + gettext("invalid option '%c'\n"), optopt); + goto usage; + } + } + + argc -= optind; + argv += optind; + + /* check number of arguments */ + if (argc < 1) { + (void) fprintf(stderr, gettext("missing snapshot argument\n")); + goto usage; + } + if (argc < 2) { + (void) fprintf(stderr, gettext("missing bookmark argument\n")); + goto usage; + } + + if (strchr(argv[1], '#') == NULL) { + (void) fprintf(stderr, + gettext("invalid bookmark name '%s' -- " + "must contain a '#'\n"), argv[1]); + goto usage; + } + + if (argv[0][0] == '@') { + /* + * Snapshot name begins with @. + * Default to same fs as bookmark. + */ + (void) strncpy(snapname, argv[1], sizeof (snapname)); + *strchr(snapname, '#') = '\0'; + (void) strlcat(snapname, argv[0], sizeof (snapname)); + } else { + (void) strncpy(snapname, argv[0], sizeof (snapname)); + } + zhp = zfs_open(g_zfs, snapname, ZFS_TYPE_SNAPSHOT); + if (zhp == NULL) + goto usage; + zfs_close(zhp); + + + nvl = fnvlist_alloc(); + fnvlist_add_string(nvl, argv[1], snapname); + ret = lzc_bookmark(nvl, NULL); + fnvlist_free(nvl); + + if (ret != 0) { + const char *err_msg; + char errbuf[1024]; + + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot create bookmark '%s'"), argv[1]); + + switch (ret) { + case EXDEV: + err_msg = "bookmark is in a different pool"; + break; + case EEXIST: + err_msg = "bookmark exists"; + break; + case EINVAL: + err_msg = "invalid argument"; + break; + case ENOTSUP: + err_msg = "bookmark feature not enabled"; + break; + default: + err_msg = "unknown error"; + break; + } + (void) fprintf(stderr, "%s: %s\n", errbuf, + dgettext(TEXT_DOMAIN, err_msg)); + } + + return (ret); + +usage: + usage(B_FALSE); + return (-1); +} + int main(int argc, char **argv) { Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Thu Jan 2 07:34:36 2014 (r260183) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 31, 2013 +.Dd January 2, 2014 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -222,12 +222,16 @@ command. Please note that doing so will immediately activate the .Sy lz4_compress feature on the underlying -pool (even before any data is written). Since this feature is not -read-only compatible, this operation will render the pool unimportable -on systems without support for the +pool +.Pq even before any data is written , +and the feature will not be +deactivated. +Since this feature is not read-only compatible, this +operation will render the pool unimportable on systems without support +for the .Sy lz4_compress -feature. At the -moment, this operation cannot be reversed. Booting off of +feature. +Booting off of .Sy lz4 -compressed root pools is supported. .It Sy multi_vdev_crash_dump @@ -286,6 +290,25 @@ and will be returned to the .Sy enabled state when all datasets that use this feature are destroyed. +.It Sy bookmarks +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:bookmarks" +.It GUID Ta com.delphix:bookmarks +.It READ\-ONLY COMPATIBLE Ta yes +.It DEPENDENCIES Ta extensible_dataset +.El +.Pp +This feature enables use of the +.Nm zfs +.Cm bookmark +subcommand. +.Pp +This feature is +.Sy active +while any bookmarks exist in the pool. +All bookmarks in the pool can be listed by running +.Nm zfs +.Cm list +.Fl t No bookmark Fl r Ar poolname . .It Sy enabled_txg .Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:enabled_txg" .It GUID Ta com.delphix:enabled_txg Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 2 07:34:36 2014 (r260183) @@ -23,7 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. @@ -193,6 +193,7 @@ extern int zpool_log_history(libzfs_hand extern int libzfs_errno(libzfs_handle_t *); extern const char *libzfs_error_action(libzfs_handle_t *); extern const char *libzfs_error_description(libzfs_handle_t *); +extern int zfs_standard_error(libzfs_handle_t *, int, const char *); extern void libzfs_mnttab_init(libzfs_handle_t *); extern void libzfs_mnttab_fini(libzfs_handle_t *); extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t); @@ -537,6 +538,7 @@ extern int zfs_iter_filesystems(zfs_hand extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); +extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); typedef struct get_all_cb { zfs_handle_t **cb_handles; @@ -611,6 +613,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_ extern int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); +extern int zfs_send_one(zfs_handle_t *, const char *, int); extern int zfs_promote(zfs_handle_t *); extern int zfs_hold(zfs_handle_t *, const char *, const char *, @@ -680,6 +683,7 @@ extern zfs_handle_t *zfs_path_to_zhandle extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *, zfs_type_t); extern int zfs_spa_version(zfs_handle_t *, int *); +extern boolean_t zfs_bookmark_exists(const char *path); /* * Mount support functions. Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 2 04:55:23 2014 (r260182) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 2 07:34:36 2014 (r260183) @@ -295,7 +295,7 @@ zpool_handle(zfs_handle_t *zhp) int len; zpool_handle_t *zph; - len = strcspn(zhp->zfs_name, "/@") + 1; + len = strcspn(zhp->zfs_name, "/@#") + 1; pool_name = zfs_alloc(zhp->zfs_hdl, len); (void) strlcpy(pool_name, zhp->zfs_name, len); @@ -579,6 +579,70 @@ zfs_handle_dup(zfs_handle_t *zhp_orig) return (zhp); } +boolean_t +zfs_bookmark_exists(const char *path) +{ + nvlist_t *bmarks; + nvlist_t *props; + char fsname[ZFS_MAXNAMELEN]; + char *bmark_name; + char *pound; + int err; + boolean_t rv; + + + (void) strlcpy(fsname, path, sizeof (fsname)); + pound = strchr(fsname, '#'); + if (pound == NULL) + return (B_FALSE); + + *pound = '\0'; + bmark_name = pound + 1; + props = fnvlist_alloc(); + err = lzc_get_bookmarks(fsname, props, &bmarks); + nvlist_free(props); + if (err != 0) { + nvlist_free(bmarks); + return (B_FALSE); + } + + rv = nvlist_exists(bmarks, bmark_name); + nvlist_free(bmarks); + return (rv); +} + +zfs_handle_t * +make_bookmark_handle(zfs_handle_t *parent, const char *path, + nvlist_t *bmark_props) +{ + zfs_handle_t *zhp = calloc(sizeof (zfs_handle_t), 1); + + if (zhp == NULL) + return (NULL); + + /* Fill in the name. */ + zhp->zfs_hdl = parent->zfs_hdl; + (void) strlcpy(zhp->zfs_name, path, sizeof (zhp->zfs_name)); + + /* Set the property lists. */ + if (nvlist_dup(bmark_props, &zhp->zfs_props, 0) != 0) { + free(zhp); + return (NULL); + } + + /* Set the types. */ + zhp->zfs_head_type = parent->zfs_head_type; + zhp->zfs_type = ZFS_TYPE_BOOKMARK; + + if ((zhp->zpool_hdl = zpool_handle(zhp)) == NULL) { + nvlist_free(zhp->zfs_props); + free(zhp); + return (NULL); + } + + return (zhp); +} + /* * Opens the given snapshot, filesystem, or volume. The 'types' * argument is a mask of acceptable types. The function will print an @@ -2271,6 +2335,9 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop case ZFS_TYPE_SNAPSHOT: str = "snapshot"; break; + case ZFS_TYPE_BOOKMARK: + str = "bookmark"; + break; default: abort(); } @@ -3133,6 +3200,19 @@ zfs_destroy(zfs_handle_t *zhp, boolean_t { zfs_cmd_t zc = { 0 }; + if (zhp->zfs_type == ZFS_TYPE_BOOKMARK) { + nvlist_t *nv = fnvlist_alloc(); + fnvlist_add_boolean(nv, zhp->zfs_name); + int error = lzc_destroy_bookmarks(nv, NULL); + fnvlist_free(nv); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 08:02:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8897B44C; Thu, 2 Jan 2014 08:02:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 748D5100D; Thu, 2 Jan 2014 08:02:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0282w3O084949; Thu, 2 Jan 2014 08:02:58 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0282wZP084948; Thu, 2 Jan 2014 08:02:58 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201401020802.s0282wZP084948@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 2 Jan 2014 08:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260184 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 08:02:58 -0000 Author: hselasky Date: Thu Jan 2 08:02:57 2014 New Revision: 260184 URL: http://svnweb.freebsd.org/changeset/base/260184 Log: Minor correction for the XHCI reset logic. MFC after: 1 week Found by: Horse Ma Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Thu Jan 2 07:34:36 2014 (r260183) +++ head/sys/dev/usb/controller/xhci.c Thu Jan 2 08:02:57 2014 (r260184) @@ -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-head@FreeBSD.ORG Thu Jan 2 08:10:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A6AB703; Thu, 2 Jan 2014 08:10:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5591069; Thu, 2 Jan 2014 08:10:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s028AasW087944; Thu, 2 Jan 2014 08:10:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s028AZBp086769; Thu, 2 Jan 2014 08:10:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401020810.s028AZBp086769@svn.freebsd.org> From: Xin LI Date: Thu, 2 Jan 2014 08:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260185 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 08:10:36 -0000 Author: delphij Date: Thu Jan 2 08:10:35 2014 New Revision: 260185 URL: http://svnweb.freebsd.org/changeset/base/260185 Log: MFV r260155: When we encounter an I/O error on a piece of metadata while deleting a file system or zvol, we don't update the bptree_entry_phys_t's bookmark. This would lead to double free of bp's which will lead to space map corruption. Instead of tolerating and allowing the corruption, panic immediately. See Illumos #4390 for more details. 4391 panic system rather than corrupting pool if we hit bug 4390 Illumos/illumos-gate@8b36997aa24d9817807faa4efa301ac9c07a2b78 MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Thu Jan 2 08:02:57 2014 (r260184) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c Thu Jan 2 08:10:35 2014 (r260185) @@ -180,6 +180,7 @@ bptree_iterate(objset_t *os, uint64_t ob err = 0; for (i = ba.ba_phys->bt_begin; i < ba.ba_phys->bt_end; i++) { bptree_entry_phys_t bte; + int flags = TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST; ASSERT(!free || i == ba.ba_phys->bt_begin); @@ -188,13 +189,13 @@ bptree_iterate(objset_t *os, uint64_t ob if (err != 0) break; + if (zfs_recover) + flags |= TRAVERSE_HARD; err = traverse_dataset_destroyed(os->os_spa, &bte.be_bp, - bte.be_birth_txg, &bte.be_zb, - TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST, + bte.be_birth_txg, &bte.be_zb, flags, bptree_visit_cb, &ba); if (free) { - ASSERT(err == 0 || err == ERESTART); - if (err != 0) { + if (err == ERESTART) { /* save bookmark for future resume */ ASSERT3U(bte.be_zb.zb_objset, ==, ZB_DESTROYED_OBJSET); @@ -202,11 +203,21 @@ bptree_iterate(objset_t *os, uint64_t ob dmu_write(os, obj, i * sizeof (bte), sizeof (bte), &bte, tx); break; - } else { - ba.ba_phys->bt_begin++; - (void) dmu_free_range(os, obj, - i * sizeof (bte), sizeof (bte), tx); } + if (err != 0) { + /* + * We can not properly handle an i/o + * error, because the traversal code + * does not know how to resume from an + * arbitrary bookmark. + */ + zfs_panic_recover("error %u from " + "traverse_dataset_destroyed()", err); + } + + ba.ba_phys->bt_begin++; + (void) dmu_free_range(os, obj, + i * sizeof (bte), sizeof (bte), tx); } } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Thu Jan 2 08:02:57 2014 (r260184) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c Thu Jan 2 08:10:35 2014 (r260185) @@ -383,7 +383,7 @@ traverse_visitbp(traverse_data_t *td, co (void) arc_buf_remove_ref(buf, &buf); post: - if (err == 0 && lasterr == 0 && (td->td_flags & TRAVERSE_POST)) { + if (err == 0 && (td->td_flags & TRAVERSE_POST)) { err = td->td_func(td->td_spa, NULL, bp, zb, dnp, td->td_arg); if (err == ERESTART) pause = B_TRUE; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jan 2 08:02:57 2014 (r260184) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Thu Jan 2 08:10:35 2014 (r260185) @@ -1348,6 +1348,9 @@ dsl_scan_free_should_pause(dsl_scan_t *s { uint64_t elapsed_nanosecs; + if (zfs_recover) + return (B_FALSE); + elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || (NSEC2MSEC(elapsed_nanosecs) > zfs_free_min_time_ms && Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 2 08:02:57 2014 (r260184) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Thu Jan 2 08:10:35 2014 (r260185) @@ -252,6 +252,8 @@ SYSCTL_INT(_debug, OID_AUTO, zfs_flags, * zfs_recover can be set to nonzero to attempt to recover from * otherwise-fatal errors, typically caused by on-disk corruption. When * set, calls to zfs_panic_recover() will turn into warning messages. + * This should only be used as a last resort, as it typically results + * in leaked space, or worse. */ int zfs_recover = 0; SYSCTL_DECL(_vfs_zfs); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h Thu Jan 2 08:02:57 2014 (r260184) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h Thu Jan 2 08:10:35 2014 (r260185) @@ -49,6 +49,7 @@ extern "C" { #endif extern int zfs_flags; +extern int zfs_recover; #define ZFS_DEBUG_DPRINTF (1<<0) #define ZFS_DEBUG_DBUF_VERIFY (1<<1) From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 08:39:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E3C2F54; Thu, 2 Jan 2014 08:39: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 6A05F122D; Thu, 2 Jan 2014 08:39: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 s028dmI8097430; Thu, 2 Jan 2014 08:39:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s028dmXZ097429; Thu, 2 Jan 2014 08:39:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401020839.s028dmXZ097429@svn.freebsd.org> From: Xin LI Date: Thu, 2 Jan 2014 08:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260186 - head/sys/netgraph/netflow X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 08:39:48 -0000 Author: delphij Date: Thu Jan 2 08:39:47 2014 New Revision: 260186 URL: http://svnweb.freebsd.org/changeset/base/260186 Log: Fix !INET6 build for various platforms. Modified: head/sys/netgraph/netflow/netflow.c Modified: head/sys/netgraph/netflow/netflow.c ============================================================================== --- head/sys/netgraph/netflow/netflow.c Thu Jan 2 08:10:35 2014 (r260185) +++ head/sys/netgraph/netflow/netflow.c Thu Jan 2 08:39:47 2014 (r260186) @@ -278,7 +278,9 @@ ng_netflow_copyinfo(priv_p priv, struct i->nfinfo_inact_exp = counter_u64_fetch(priv->nfinfo_inact_exp); i->nfinfo_used = uma_zone_get_cur(priv->zone); +#ifdef INET6 i->nfinfo_used6 = uma_zone_get_cur(priv->zone6); +#endif i->nfinfo_alloc_failed = priv->nfinfo_alloc_failed; i->nfinfo_export_failed = priv->nfinfo_export_failed; From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 08:40:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C63F414F; Thu, 2 Jan 2014 08:40:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A6C5E1237; Thu, 2 Jan 2014 08:40: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 s028ecaL099883; Thu, 2 Jan 2014 08:40:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s028ecBs099879; Thu, 2 Jan 2014 08:40:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401020840.s028ecBs099879@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 2 Jan 2014 08:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260187 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 08:40:38 -0000 Author: ae Date: Thu Jan 2 08:40:37 2014 New Revision: 260187 URL: http://svnweb.freebsd.org/changeset/base/260187 Log: 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. Reviewed by: glebius, adrian MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netinet/if_ether.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Jan 2 08:39:47 2014 (r260186) +++ head/sys/netinet/if_ether.c Thu Jan 2 08:40:37 2014 (r260187) @@ -149,10 +149,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 @@ -801,9 +801,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: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Thu Jan 2 08:39:47 2014 (r260186) +++ head/sys/netinet6/nd6.c Thu Jan 2 08:40:37 2014 (r260187) @@ -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; Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Thu Jan 2 08:39:47 2014 (r260186) +++ head/sys/netinet6/nd6_nbr.c Thu Jan 2 08:40:37 2014 (r260187) @@ -723,9 +723,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-head@FreeBSD.ORG Thu Jan 2 09:38:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FA69C39; Thu, 2 Jan 2014 09:38:32 +0000 (UTC) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 311211607; Thu, 2 Jan 2014 09:38:30 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 938722F3; Thu, 2 Jan 2014 10:25:35 +0100 (CET) Date: Thu, 2 Jan 2014 10:33:23 +0100 From: Pawel Jakub Dawidek To: Stanislav Sedov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102093322.GA1655@garage.freebsd.pl> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> X-OS: FreeBSD 11.0-CURRENT amd64 User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 09:38:32 -0000 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 01, 2014 at 11:16:22PM -0800, Stanislav Sedov wrote: >=20 > On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wrote: >=20 > > This commit also breaks compatibility with some existing Capsicum syst= em calls, > > but I see no other way to do that. This should be fine as Capsicum is = still > > experimental and this change is not going to 9.x. >=20 > Hi! >=20 > This change also increases the size of kinfo_file structure, which won=E2= =80=99t allow > programs not compiled against HEAD and working with kern.info.filedesc sy= sctl > to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won=E2=80=99t run p= roperly on HEAD, > and it also broke valgrind). Is there absolutely no way to avoid extendi= ng the size > of this struct? Well, I made this change to have space for future cap_rights_t expension. I did that change for a major branch, so we don't have to do it in the middle of 10.x or to not block the work until 11.0. Note that the structure changed size not only because of _kf_cap_spare[3] field, but also because cap_rights_t is not uint64_t anymore, it is now struct that contains two uint64_t (1424 - 1392 =3D 4 * 8). I'm afraid it is too late to change it for 10.0 at this point anyway. Not sure if you are aware this was merged to 10, because you write about 10.x jails not working properly on HEAD. 10.x jails will work properly on HEAD. BTW. I'd love if we stop using such structures for a running kernel. We should really move to using libnv to export data like that. > > #if defined(__amd64__) || defined(__i386__) > > -#define KINFO_FILE_SIZE 1392 > > +#define KINFO_FILE_SIZE 1424 > > #endif > > =20 > > struct kinfo_file { > > @@ -389,6 +390,7 @@ > > uint16_t kf_pad1; /* Round to 32 bit alig= nment. */ > > int _kf_ispare0; /* Space for more stuff= =2E */ > > 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= =2E */ > > /* Truncated before copyout in sysctl */ > > char kf_path[PATH_MAX]; /* Path to file, if any= =2E */ --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iEYEARECAAYFAlLFMmIACgkQForvXbEpPzTtdACeMZUQv9g5eQBo74Mna1M2+zE/ tPkAnifvjpugpc18vKWB5CBaUjyHPbwP =7YTS -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 10:18:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C67F36F; Thu, 2 Jan 2014 10:18: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 49166187B; Thu, 2 Jan 2014 10:18: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 s02AIe6K036093; Thu, 2 Jan 2014 10:18:40 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02AIeHg036092; Thu, 2 Jan 2014 10:18:40 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401021018.s02AIeHg036092@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 2 Jan 2014 10:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260188 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 10:18:40 -0000 Author: glebius Date: Thu Jan 2 10:18:39 2014 New Revision: 260188 URL: http://svnweb.freebsd.org/changeset/base/260188 Log: 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 Submitted by: ae Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Jan 2 08:40:37 2014 (r260187) +++ head/sys/netinet/ip_output.c Thu Jan 2 10:18:39 2014 (r260188) @@ -333,6 +333,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-head@FreeBSD.ORG Thu Jan 2 10:29:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C70B7B6; Thu, 2 Jan 2014 10:29:00 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 210CF1926; Thu, 2 Jan 2014 10:28:59 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id 7DC061A3C19; Thu, 2 Jan 2014 02:28:58 -0800 (PST) Message-ID: <52C53F69.3040507@mu.org> Date: Thu, 02 Jan 2014 02:28:57 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek , Stanislav Sedov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> In-Reply-To: <20140102093322.GA1655@garage.freebsd.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 10:29:00 -0000 On 1/2/14 1:33 AM, Pawel Jakub Dawidek wrote: > On Wed, Jan 01, 2014 at 11:16:22PM -0800, Stanislav Sedov wrote: >> On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wrote: >> >>> This commit also breaks compatibility with some existing Capsicum system calls, >>> but I see no other way to do that. This should be fine as Capsicum is still >>> experimental and this change is not going to 9.x. >> Hi! >> >> This change also increases the size of kinfo_file structure, which won’t allow >> programs not compiled against HEAD and working with kern.info.filedesc sysctl >> to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won’t run properly on HEAD, >> and it also broke valgrind). Is there absolutely no way to avoid extending the size >> of this struct? > Well, I made this change to have space for future cap_rights_t > expension. I did that change for a major branch, so we don't have to do > it in the middle of 10.x or to not block the work until 11.0. > > Note that the structure changed size not only because of _kf_cap_spare[3] > field, but also because cap_rights_t is not uint64_t anymore, it is now > struct that contains two uint64_t (1424 - 1392 = 4 * 8). > > I'm afraid it is too late to change it for 10.0 at this point anyway. > Not sure if you are aware this was merged to 10, because you write about > 10.x jails not working properly on HEAD. 10.x jails will work properly > on HEAD. > > BTW. I'd love if we stop using such structures for a running kernel. > We should really move to using libnv to export data like that. Aren't there enough bits in int _kf_ispare[4]; /* Space for more stuff. */ to make this work for the time being until you can provide an alternate way to fetch the cap stuff from the kernel. Afaik you could just remove the "spare" and steal 2 or 4 entries from _kf_ispare until it is sorted. Can you please make use of that and discuss merge to 10 with re@? It really sounds like breaking top/etc under jails is something that should and can be avoided. Thank you, -Alfred > >>> #if defined(__amd64__) || defined(__i386__) >>> -#define KINFO_FILE_SIZE 1392 >>> +#define KINFO_FILE_SIZE 1424 >>> #endif >>> >>> struct kinfo_file { >>> @@ -389,6 +390,7 @@ >>> 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. */ >>> /* Truncated before copyout in sysctl */ >>> char kf_path[PATH_MAX]; /* Path to file, if any. */ -- Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 10:48:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0D57F08; Thu, 2 Jan 2014 10:48:15 +0000 (UTC) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 2F7DC1A8A; Thu, 2 Jan 2014 10:48:14 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 6E0B3317; Thu, 2 Jan 2014 11:41:17 +0100 (CET) Date: Thu, 2 Jan 2014 11:49:04 +0100 From: Pawel Jakub Dawidek To: Alfred Perlstein Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102104904.GB1655@garage.freebsd.pl> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wq9mPyueHGvFACwf" Content-Disposition: inline In-Reply-To: <52C53F69.3040507@mu.org> X-OS: FreeBSD 11.0-CURRENT amd64 User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 10:48:15 -0000 --wq9mPyueHGvFACwf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 02:28:57AM -0800, Alfred Perlstein wrote: > On 1/2/14 1:33 AM, Pawel Jakub Dawidek wrote: > > On Wed, Jan 01, 2014 at 11:16:22PM -0800, Stanislav Sedov wrote: > >> On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wrot= e: > >> > >>> This commit also breaks compatibility with some existing Capsicum s= ystem calls, > >>> but I see no other way to do that. This should be fine as Capsicum = is still > >>> experimental and this change is not going to 9.x. > >> Hi! > >> > >> This change also increases the size of kinfo_file structure, which won= =E2=80=99t allow > >> programs not compiled against HEAD and working with kern.info.filedesc= sysctl > >> to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won=E2=80=99t ru= n properly on HEAD, > >> and it also broke valgrind). Is there absolutely no way to avoid exte= nding the size > >> of this struct? > > Well, I made this change to have space for future cap_rights_t > > expension. I did that change for a major branch, so we don't have to do > > it in the middle of 10.x or to not block the work until 11.0. > > > > Note that the structure changed size not only because of _kf_cap_spare[= 3] > > field, but also because cap_rights_t is not uint64_t anymore, it is now > > struct that contains two uint64_t (1424 - 1392 =3D 4 * 8). > > > > I'm afraid it is too late to change it for 10.0 at this point anyway. > > Not sure if you are aware this was merged to 10, because you write about > > 10.x jails not working properly on HEAD. 10.x jails will work properly > > on HEAD. > > > > BTW. I'd love if we stop using such structures for a running kernel. > > We should really move to using libnv to export data like that. >=20 > Aren't there enough bits in int _kf_ispare[4]; /* Space= =20 > for more stuff. */ > to make this work for the time being until you can provide an alternate= =20 > way to fetch the cap stuff from the kernel. I don't plan to provide alternative way to fetch the cap stuff. Well, I implemented libnv, which can be used to reimplement how we fetch all data like kinfo_file in a ABI friendly way, but I don't plan to modify this specific code myself. > Afaik you could just remove the "spare" and steal 2 or 4 entries from=20 > _kf_ispare until it is sorted. Yes, this would work for current cap_rights_t structure, at least for i386 and amd64, but would only allow to expand the structure by one uint64_t in the future (which might or might not be enough). The cap_rights_t structure is designed to be expanded to 5 uint64_ts without breaking ABI. I don't want to stuck with current cap_rights_t that is designed to expand, but cannot be, because kinfo_file wasn't modified at the start of a major branch. > Can you please make use of that and discuss merge to 10 with re@? I'm Bccing re@, but I'm pretty sure it is too late for such a change, especially that it breaks ABI with all 10-RCs. I'm also not changing my mind. I'd like to structure to stay as-is. > It really sounds like breaking top/etc under jails is something that=20 > should and can be avoided. I agree. Maybe it should be done every 10 major releases (I'm still fine with that rule), but we cannot just stuck with it forever. My suggestions would be: 1. Move to libnv. 2. Detect that the given binary was compiled against some older version of this structure and copy old structure to userland. Not sure if we can do that now or not, but I'd expect we can detect that. > >>> #if defined(__amd64__) || defined(__i386__) > >>> -#define KINFO_FILE_SIZE 1392 > >>> +#define KINFO_FILE_SIZE 1424 > >>> #endif > >>> =20 > >>> struct kinfo_file { > >>> @@ -389,6 +390,7 @@ > >>> uint16_t kf_pad1; /* Round to 32 bit a= lignment. */ > >>> int _kf_ispare0; /* Space for more st= uff. */ > >>> cap_rights_t kf_cap_rights; /* Capability rights= =2E */ > >>> + uint64_t _kf_cap_spare[3]; /* Space for future c= ap_rights_t. */ > >>> int _kf_ispare[4]; /* Space for more st= uff. */ > >>> /* Truncated before copyout in sysctl */ > >>> char kf_path[PATH_MAX]; /* Path to file, if = any. */ --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --wq9mPyueHGvFACwf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iEYEARECAAYFAlLFRCAACgkQForvXbEpPzRe0ACeNn6wS7KBK3ak2nsdfOOdjZl6 IaUAoL2O4AC1s8tQkRi79le8tDXO/AfF =XzHI -----END PGP SIGNATURE----- --wq9mPyueHGvFACwf-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 10:53:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04B09224 for ; Thu, 2 Jan 2014 10:53:33 +0000 (UTC) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8AF761B09 for ; Thu, 2 Jan 2014 10:53:32 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id h10so6162769eak.16 for ; Thu, 02 Jan 2014 02:53:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=og+2hHbsGqUyKlNwXdY0xcSPUecPGxb7loOx8knhMHY=; b=XuIjJjn4VuJ5SP/iBwhDk9KS9+n8m7UnZ6SPsj3Aq0aP4SRXOOvoMMlX8/McpFtccW Hhx3jwKgPUzGTTLoTdNMxA+gplleH54Ic8UME0rtYPGTRn15DT4gpYiAjnCuS2cR8dZ0 PPUx7sQa4AmEVPqFBZqJgZ9D05LnjUTgD3YP9jTTEe7Tn+xqeByA0sJXpf1SLZntojiN Sm7YffI9g4Zr8Ly1nvi0oPaEmYWLRe/ubUdKfLEPc0j2xe61qnDS9W1Ez4brkNAR2VYR C0hek0cdPdepM9dJpIy5qpiH8I2CJHNeub9wsV7ks8tmyk7Q1aPEMm1JZmySBuAhWZJl CGKg== X-Gm-Message-State: ALoCoQlskkWyfYoaT2SuTB1oaXMV+esTXvyveC42ZzaQ12I31+fF9nkQ1RQv3sQhxZurqL+mi4M0 X-Received: by 10.15.82.136 with SMTP id a8mr14846108eez.81.1388659686903; Thu, 02 Jan 2014 02:48:06 -0800 (PST) Received: from [10.0.2.117] ([80.82.22.190]) by mx.google.com with ESMTPSA id o1sm134864567eea.10.2014.01.02.02.48.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 02:48:06 -0800 (PST) Message-ID: <52C543E4.7090805@semihalf.com> Date: Thu, 02 Jan 2014 11:48:04 +0100 From: Zbigniew Bodek Organization: Semihalf User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Konstantin Belousov , Zbigniew Bodek Subject: Re: svn commit: r260165 - head/sys/dev/ahci References: <201401012026.s01KQ8KU017949@svn.freebsd.org> <20140101203212.GF59496@kib.kiev.ua> In-Reply-To: <20140101203212.GF59496@kib.kiev.ua> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 10:53:33 -0000 On 01.01.2014 21:32, Konstantin Belousov wrote: > On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: >> Author: zbb Date: Wed Jan 1 20:26:08 2014 New Revision: 260165 >> URL: http://svnweb.freebsd.org/changeset/base/260165 >> >> Log: Use only mapped BIOs on ARM >> >> Using unmapped BIOs causes failure inside bus_dmamap_sync, since >> this function requires valid MVA address, which is not present >> if mapping is not set up. >> >> Submitted by: Wojciech Macek Obtained from: >> Semihalf >> >> Modified: head/sys/dev/ahci/ahci.c >> >> Modified: head/sys/dev/ahci/ahci.c >> ============================================================================== >> >> >> --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) >> +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) >> @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc >> if (ch->caps & AHCI_CAP_SPM) cpi->hba_inquiry |= PI_SATAPM; >> cpi->target_sprt = 0; +#ifdef __arm__ + /* + * Do not use >> unmapped buffers on ARM. Doing so will cause + * failure >> inside bus_dmamap_sync due to lack of VA. + */ + cpi->hba_misc >> = PIM_SEQSCAN; +#else cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; >> +#endif cpi->hba_eng_cnt = 0; if (ch->caps & AHCI_CAP_SPM) >> cpi->max_target = 15; > > I think this is wrong. If bus_dmamap_sync(9) is not functional on > arm, then unmapped io should be disabled on arm unconditionally, > using unmapped_buf_allowed. Why ahci(4) is special in this > regard, leaving other controllers broken for arm ? > Hello Konstantin. Thanks for pointing that out. You are right, we didn't know about unmapped_buf_allowed flag. bus_dmamap_sync() is functional on ARM however it needs virtual address therefore unmapped_buf_allowed should be set to 0 on ARM (it is set to 1 now). I will revert this commit but we will need some time to test the other solution. Best regards zbb From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 11:01:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 077DB2BF; Thu, 2 Jan 2014 11:01:45 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E13101CA7; Thu, 2 Jan 2014 11:01:44 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id 4749B1A3C1A; Thu, 2 Jan 2014 03:01:44 -0800 (PST) Message-ID: <52C54717.5000608@mu.org> Date: Thu, 02 Jan 2014 03:01:43 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> In-Reply-To: <20140102104904.GB1655@garage.freebsd.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 11:01:45 -0000 On 1/2/14 2:49 AM, Pawel Jakub Dawidek wrote: > On Thu, Jan 02, 2014 at 02:28:57AM -0800, Alfred Perlstein wrote: >> On 1/2/14 1:33 AM, Pawel Jakub Dawidek wrote: >>> On Wed, Jan 01, 2014 at 11:16:22PM -0800, Stanislav Sedov wrote: >>>> On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wrote: >>>> >>>>> This commit also breaks compatibility with some existing Capsicum system calls, >>>>> but I see no other way to do that. This should be fine as Capsicum is still >>>>> experimental and this change is not going to 9.x. >>>> Hi! >>>> >>>> This change also increases the size of kinfo_file structure, which won’t allow >>>> programs not compiled against HEAD and working with kern.info.filedesc sysctl >>>> to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won’t run properly on HEAD, >>>> and it also broke valgrind). Is there absolutely no way to avoid extending the size >>>> of this struct? >>> Well, I made this change to have space for future cap_rights_t >>> expension. I did that change for a major branch, so we don't have to do >>> it in the middle of 10.x or to not block the work until 11.0. >>> >>> Note that the structure changed size not only because of _kf_cap_spare[3] >>> field, but also because cap_rights_t is not uint64_t anymore, it is now >>> struct that contains two uint64_t (1424 - 1392 = 4 * 8). >>> >>> I'm afraid it is too late to change it for 10.0 at this point anyway. >>> Not sure if you are aware this was merged to 10, because you write about >>> 10.x jails not working properly on HEAD. 10.x jails will work properly >>> on HEAD. >>> >>> BTW. I'd love if we stop using such structures for a running kernel. >>> We should really move to using libnv to export data like that. >> Aren't there enough bits in int _kf_ispare[4]; /* Space >> for more stuff. */ >> to make this work for the time being until you can provide an alternate >> way to fetch the cap stuff from the kernel. > I don't plan to provide alternative way to fetch the cap stuff. Well, I > implemented libnv, which can be used to reimplement how we fetch all > data like kinfo_file in a ABI friendly way, but I don't plan to modify > this specific code myself. > >> Afaik you could just remove the "spare" and steal 2 or 4 entries from >> _kf_ispare until it is sorted. > Yes, this would work for current cap_rights_t structure, at least for > i386 and amd64, but would only allow to expand the structure by one > uint64_t in the future (which might or might not be enough). The > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > breaking ABI. I don't want to stuck with current cap_rights_t that is > designed to expand, but cannot be, because kinfo_file wasn't modified at > the start of a major branch. > >> Can you please make use of that and discuss merge to 10 with re@? > I'm Bccing re@, but I'm pretty sure it is too late for such a change, > especially that it breaks ABI with all 10-RCs. I'm also not changing my > mind. I'd like to structure to stay as-is. > >> It really sounds like breaking top/etc under jails is something that >> should and can be avoided. > I agree. Maybe it should be done every 10 major releases (I'm still fine > with that rule), but we cannot just stuck with it forever. > > My suggestions would be: > 1. Move to libnv. > 2. Detect that the given binary was compiled against some older version > of this structure and copy old structure to userland. Not sure if we > can do that now or not, but I'd expect we can detect that. Well I agree strongly with what you are doing except the part where 9.x jails and earlier are broken because of this change. It seems like there is a way out and you agree. Perhaps since the cap fits in the spare area we can make do for the time being? The way to do a major re-org of the kinfo_file/proc/whatever is to either use libnv as you suggest, check the binary version (as you suggest) or to make an entirely new one and make the old one kinfo_file_old and make a new way to fetch the new data as we did with the various syscalls ostatfs, ostat, etc. It still seems like we have a way out that would even give capabilities another "version" (there are enough cells in _kf_ispare for the next version of the capabilities code. -Alfred >>>>> #if defined(__amd64__) || defined(__i386__) >>>>> -#define KINFO_FILE_SIZE 1392 >>>>> +#define KINFO_FILE_SIZE 1424 >>>>> #endif >>>>> >>>>> struct kinfo_file { >>>>> @@ -389,6 +390,7 @@ >>>>> 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. */ >>>>> /* Truncated before copyout in sysctl */ >>>>> char kf_path[PATH_MAX]; /* Path to file, if any. */ -- Alfred Perlstein From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 11:19:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8407191D; Thu, 2 Jan 2014 11:19:33 +0000 (UTC) Received: from vps.rulingia.com (vps.rulingia.com [103.243.244.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1A7B41DBE; Thu, 2 Jan 2014 11:19:32 +0000 (UTC) Received: from server.rulingia.com (c220-239-250-249.belrs5.nsw.optusnet.com.au [220.239.250.249]) by vps.rulingia.com (8.14.7/8.14.7) with ESMTP id s02BJTkT028235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Jan 2014 22:19:30 +1100 (EST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.14.7/8.14.7) with ESMTP id s02BJO1L079825 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Jan 2014 22:19:24 +1100 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.7/8.14.7/Submit) id s02BJOim079824; Thu, 2 Jan 2014 22:19:24 +1100 (EST) (envelope-from peter) Date: Thu, 2 Jan 2014 22:19:24 +1100 From: Peter Jeremy To: Gleb Smirnoff Subject: Re: svn commit: r260188 - head/sys/netinet Message-ID: <20140102111924.GP87348@server.rulingia.com> References: <201401021018.s02AIeHg036092@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7LkOrbQMr4cezO2T" Content-Disposition: inline In-Reply-To: <201401021018.s02AIeHg036092@svn.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 11:19:33 -0000 --7LkOrbQMr4cezO2T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2014-Jan-02 10:18:40 +0000, Gleb Smirnoff wrote: >Log: > 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". > =20 > PR: 185395 > Submitted by: ae Thank you for that. I'd gotten as far as working out that r249894 was the probable cause but not come up with a patch. Given that it breaks IPv4 multicast, I'm surprised no-one else noticed it in the past 8 months. (My excuse is that I only tried to use multicast for the first time yesterday). And, whilst it's _really_ late in the 10.0 release cycle, I'm not sure we want to roll a release with broken multicast. --=20 Peter Jeremy --7LkOrbQMr4cezO2T Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iKYEARECAGYFAlLFSzxfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl bnBncC5maWZ0aGhvcnNlbWFuLm5ldDBCRjc3QTcyNTg5NEVCRTY0RjREN0VFRUZF OEE0N0JGRjAwRkI4ODcACgkQ/opHv/APuIfs6QCeIrIDmO+1PPQT/tFZm+DO02bJ aUgAmwbGulsB4uhpclUpq6dh/s01U8rI =Bobp -----END PGP SIGNATURE----- --7LkOrbQMr4cezO2T-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 11:24:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E46A7C5E; Thu, 2 Jan 2014 11:24: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 D0FF81E48; Thu, 2 Jan 2014 11:24: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 s02BO4PY062114; Thu, 2 Jan 2014 11:24:04 GMT (envelope-from zbb@svn.freebsd.org) Received: (from zbb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02BO4DR062113; Thu, 2 Jan 2014 11:24:04 GMT (envelope-from zbb@svn.freebsd.org) Message-Id: <201401021124.s02BO4DR062113@svn.freebsd.org> From: Zbigniew Bodek Date: Thu, 2 Jan 2014 11:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260189 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 11:24:05 -0000 Author: zbb Date: Thu Jan 2 11:24:04 2014 New Revision: 260189 URL: http://svnweb.freebsd.org/changeset/base/260189 Log: Revert r260165: Proper configuration of unmapped_buf_allowed should be used To avoid failures in bus_dmamap_sync() on ARM unmapped_buf_allowed should be set to 0. Hence, ARM-specific changes in AHCI should not be applied. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Jan 2 10:18:39 2014 (r260188) +++ head/sys/dev/ahci/ahci.c Thu Jan 2 11:24:04 2014 (r260189) @@ -3066,15 +3066,7 @@ ahciaction(struct cam_sim *sim, union cc if (ch->caps & AHCI_CAP_SPM) cpi->hba_inquiry |= PI_SATAPM; cpi->target_sprt = 0; -#ifdef __arm__ - /* - * Do not use unmapped buffers on ARM. Doing so will cause - * failure inside bus_dmamap_sync due to lack of VA. - */ - cpi->hba_misc = PIM_SEQSCAN; -#else cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; -#endif cpi->hba_eng_cnt = 0; if (ch->caps & AHCI_CAP_SPM) cpi->max_target = 15; From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 11:25:29 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 862CFDBB; Thu, 2 Jan 2014 11:25:29 +0000 (UTC) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1D0971E52; Thu, 2 Jan 2014 11:25:28 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id s02BPDUa049445; Thu, 2 Jan 2014 12:25:18 +0100 (CET) (envelope-from andreast@FreeBSD.org) Message-ID: <52C54C99.9030509@FreeBSD.org> Date: Thu, 02 Jan 2014 12:25:13 +0100 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: "Pedro F. Giffuni" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r260073 - in head/contrib/gcc: . cp References: <201312300252.rBU2qhYK098609@svn.freebsd.org> In-Reply-To: <201312300252.rBU2qhYK098609@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 11:25:29 -0000 Hi Pedro, Happy new Year! On 30.12.13 03:52, Pedro F. Giffuni wrote: > Author: pfg > Date: Mon Dec 30 02:52:43 2013 > New Revision: 260073 > URL: http://svnweb.freebsd.org/changeset/base/260073 > > Log: > gcc: small diff reduction wrt gcc43 and Apple GCC. > > Obtained from: gcc 4.3 (rev. 121464, 122528, 124106; GPLv2) > MFC after: 3 weeks > > Modified: > head/contrib/gcc/ChangeLog.gcc43 > head/contrib/gcc/cp/ChangeLog > head/contrib/gcc/cp/g++spec.c > head/contrib/gcc/libgcc2.c > head/contrib/gcc/libgcc2.h > head/contrib/gcc/loop-init.c > head/contrib/gcc/toplev.c > head/contrib/gcc/tree-ssa-address.c May I ask you to revert this commit? It causes an ICE on powerpc(64) and sparc64 while compiling dev/trm/trm.c. Tinderbox also showed this one a few days ago. It should pop up again soon. -- /export/devel/fbsd/src/sys/modules/trm/../../dev/trm/trm.c:3522: internal compiler error: in create_mem_ref, at tree-ssa-address.c:606 Please submit a full bug report, with preprocessed source if appropriate. -- Thank you, Andreas From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 12:21:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1BFEA146; Thu, 2 Jan 2014 12:21:18 +0000 (UTC) Received: from mx0.deglitch.com (backbone.deglitch.com [78.110.53.255]) by mx1.freebsd.org (Postfix) with ESMTP id 5617514EE; Thu, 2 Jan 2014 12:21:15 +0000 (UTC) Received: from [192.168.1.5] (unknown [37.113.188.80]) by mx0.deglitch.com (Postfix) with ESMTPSA id 922798FC40; Thu, 2 Jan 2014 16:21:04 +0400 (MSK) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... From: Stanislav Sedov In-Reply-To: <52C54717.5000608@mu.org> Date: Thu, 2 Jan 2014 04:20:59 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <52C54717.5000608@mu.org> To: Alfred Perlstein X-Mailer: Apple Mail (2.1827) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 12:21:18 -0000 On Jan 2, 2014, at 3:01 AM, Alfred Perlstein wrote: > Well I agree strongly with what you are doing except the part where = 9.x jails and earlier are broken because of this change. >=20 > It seems like there is a way out and you agree. Perhaps since the cap = fits in the spare area we can make do for the time being? >=20 > The way to do a major re-org of the kinfo_file/proc/whatever is to = either use libnv as you suggest, check the binary version (as you = suggest) or to make an entirely new one and make the old one = kinfo_file_old and make a new way to fetch the new data as we did with = the various syscalls ostatfs, ostat, etc. >=20 > It still seems like we have a way out that would even give = capabilities another "version" (there are enough cells in _kf_ispare for = the next version of the capabilities code. I agree that we should move to libnv or maybe even something more = structured (like ASN.1 or protobufs) in the future for such usecases to avoid this situation = altogether. I should have looked into doing that much earlier. :( It=92d be really nice if we can avoid this issue by using the spare = fields at the moment, and switch to a new struct/proper serialization by the time we need to = export more capabilities data from the kernel. We actually did exactly that once between 7.x and = 8.x, that is the reason why there is also kinfo_ofile struct in that file as well. It=92s a pity I have not noticed that before it was merged to 10.x, as = I=92m not sure we can do anything about it at the moment. I agree with Pawel that it is = questionable what will lead to more damage. PS: I should also note that the change does not entirely break programs = that deal with proc/filedesc as most of the fields are at the same position. The ones = that need to obtain the file path of a file descriptor won=92t be able to do so = (think procstat -f, procstat -v, fstat). -- ST4096-RIPE From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 13:13:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E041DCA6; Thu, 2 Jan 2014 13:13:14 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6821218BE; Thu, 2 Jan 2014 13:13:14 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s02DD88B023973; Thu, 2 Jan 2014 15:13:08 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s02DD88B023973 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s02DD80Y023972; Thu, 2 Jan 2014 15:13:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 2 Jan 2014 15:13:08 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102131308.GI59496@kib.kiev.ua> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Tr2u91LvQ9NOAnv9" Content-Disposition: inline In-Reply-To: <20140102104904.GB1655@garage.freebsd.pl> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 13:13:15 -0000 --Tr2u91LvQ9NOAnv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 11:49:04AM +0100, Pawel Jakub Dawidek wrote: > On Thu, Jan 02, 2014 at 02:28:57AM -0800, Alfred Perlstein wrote: > > On 1/2/14 1:33 AM, Pawel Jakub Dawidek wrote: > > > On Wed, Jan 01, 2014 at 11:16:22PM -0800, Stanislav Sedov wrote: > > >> On Sep 4, 2013, at 5:09 PM, Pawel Jakub Dawidek wr= ote: > > >> > > >>> This commit also breaks compatibility with some existing Capsicum= system calls, > > >>> but I see no other way to do that. This should be fine as Capsicu= m is still > > >>> experimental and this change is not going to 9.x. > > >> Hi! > > >> > > >> This change also increases the size of kinfo_file structure, which w= on???t allow > > >> programs not compiled against HEAD and working with kern.info.filede= sc sysctl > > >> to run properly on HEAD (e.g. 8.x, 9.x and 10.x jails won???t run pr= operly on HEAD, > > >> and it also broke valgrind). Is there absolutely no way to avoid ex= tending the size > > >> of this struct? > > > Well, I made this change to have space for future cap_rights_t > > > expension. I did that change for a major branch, so we don't have to = do > > > it in the middle of 10.x or to not block the work until 11.0. > > > > > > Note that the structure changed size not only because of _kf_cap_spar= e[3] > > > field, but also because cap_rights_t is not uint64_t anymore, it is n= ow > > > struct that contains two uint64_t (1424 - 1392 =3D 4 * 8). > > > > > > I'm afraid it is too late to change it for 10.0 at this point anyway. > > > Not sure if you are aware this was merged to 10, because you write ab= out > > > 10.x jails not working properly on HEAD. 10.x jails will work properly > > > on HEAD. > > > > > > BTW. I'd love if we stop using such structures for a running kernel. > > > We should really move to using libnv to export data like that. > >=20 > > Aren't there enough bits in int _kf_ispare[4]; /* Spac= e=20 > > for more stuff. */ > > to make this work for the time being until you can provide an alternate= =20 > > way to fetch the cap stuff from the kernel. >=20 > I don't plan to provide alternative way to fetch the cap stuff. Well, I > implemented libnv, which can be used to reimplement how we fetch all > data like kinfo_file in a ABI friendly way, but I don't plan to modify > this specific code myself. I.e. you break something and decline to fix it, putting the burden on somebody else. >=20 > > Afaik you could just remove the "spare" and steal 2 or 4 entries from= =20 > > _kf_ispare until it is sorted. >=20 > Yes, this would work for current cap_rights_t structure, at least for > i386 and amd64, but would only allow to expand the structure by one > uint64_t in the future (which might or might not be enough). The > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > breaking ABI. I don't want to stuck with current cap_rights_t that is > designed to expand, but cannot be, because kinfo_file wasn't modified at > the start of a major branch. The ABI stability is not limited to the single branch. It must be preserved across whole project lifetime. >=20 > > Can you please make use of that and discuss merge to 10 with re@? >=20 > I'm Bccing re@, but I'm pretty sure it is too late for such a change, > especially that it breaks ABI with all 10-RCs. I'm also not changing my > mind. I'd like to structure to stay as-is. This is just awful breakage of _ABI_. We cannot leave it as is, unless we also claim that project gave up on ABI stability at all. >=20 > > It really sounds like breaking top/etc under jails is something that=20 > > should and can be avoided. >=20 > I agree. Maybe it should be done every 10 major releases (I'm still fine > with that rule), but we cannot just stuck with it forever. >=20 > My suggestions would be: > 1. Move to libnv. > 2. Detect that the given binary was compiled against some older version > of this structure and copy old structure to userland. Not sure if we > can do that now or not, but I'd expect we can detect that. The only way to fix this is either to stop passing caps in kinfo_file, reverting it to the pre-commit state, or follow Alfred suggestion by consuming spares. My own opinion is that the kinfo change must be removed, and the bug is so critical that another RC must be issued. >=20 > > >>> #if defined(__amd64__) || defined(__i386__) > > >>> -#define KINFO_FILE_SIZE 1392 > > >>> +#define KINFO_FILE_SIZE 1424 > > >>> #endif > > >>> =20 > > >>> struct kinfo_file { > > >>> @@ -389,6 +390,7 @@ > > >>> uint16_t kf_pad1; /* Round to 32 bit= alignment. */ > > >>> int _kf_ispare0; /* Space for more = stuff. */ > > >>> cap_rights_t kf_cap_rights; /* Capability righ= ts. */ > > >>> + uint64_t _kf_cap_spare[3]; /* Space for future= cap_rights_t. */ > > >>> int _kf_ispare[4]; /* Space for more = stuff. */ > > >>> /* Truncated before copyout in sysctl */ > > >>> char kf_path[PATH_MAX]; /* Path to file, i= f any. */ >=20 > --=20 > Pawel Jakub Dawidek http://www.wheelsystems.com > FreeBSD committer http://www.FreeBSD.org > Am I Evil? Yes, I Am! http://mobter.com --Tr2u91LvQ9NOAnv9 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxWXjAAoJEJDCuSvBvK1B9ugP/1c0ZNgQRdYy+y+exHeIBrt4 hwn/5fUYYSpSYD1F4pSfOdhOeBjSORDU2cGTS6izTtH6jFTPqKllYoWohNEQNoqV juFGXeZSFSc7OB2wKtK9rV5H0maSFwX/6RAZtJyxxPIxyCYo3JRFnYQAWtEKMDwI ccQzQrngFavBcJvpsifX1H8e4WvhEADkmzkRRs7wJidAIY4xGbp/Xc8Z7pPNFWLO eSDMyqEEKmKTRlaDyxXfnrGU3AgCzKLj41Ag250oGAzRcrzq3SSxgNVsPSLxvmuE YA2P0Px9UIrYfa8EQ7/7ZqNaliGqnKhNFFkZETmR2yBgzavnwfxr6CbdF2p8qiDZ W1E0EnzFOmz+v2/jx3CT370tcQoz84/27oaXxc7R4I0kZten5SyKyrDp9AZSDVHJ 7xYED7Ew0yVSGEojY1W34w51uG0b2nUYupq0mOAs0rLsuLY71nYmz4YSrCdG08GY wfS5rV0eiehv3oF6TRhVQYyUH17B16vJFGHCnf28im+ebyUOBLNgkEYRnPw3YpdH haDstWPtOQv+5wIjk/8WwiufTXeUwSOxC5b9Itv5MYarO2ny8Sm5J21Eaa1KJ4V+ pJi9xMs+fSa71AlqLxae22VUmEV3ciuHYIyYdtY8SbNu3pQ99d0FlVHtVd7g4Fku AgQ9v/cCrjw/+BnnYPa1 =pVrj -----END PGP SIGNATURE----- --Tr2u91LvQ9NOAnv9-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 13:53:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C9DCEEA; Thu, 2 Jan 2014 13:53: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 6D0EA1C86; Thu, 2 Jan 2014 13:53: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 s02DrtZo018834; Thu, 2 Jan 2014 13:53:55 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02Drr2S018826; Thu, 2 Jan 2014 13:53:53 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401021353.s02Drr2S018826@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 2 Jan 2014 13:53:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260194 - in head/contrib/gcc: . cp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 13:53:55 -0000 Author: pfg Date: Thu Jan 2 13:53:53 2014 New Revision: 260194 URL: http://svnweb.freebsd.org/changeset/base/260194 Log: Revert r260073; small diff reduction wrt gcc43 and Apple GCC. Unfortunately this causes ICE on powerpc and sparc64. Reducing these differences against upstream is not important anymore so hopefully I have finished breaking the compiler occasionally. Modified: head/contrib/gcc/ChangeLog.gcc43 head/contrib/gcc/cp/ChangeLog head/contrib/gcc/cp/g++spec.c head/contrib/gcc/libgcc2.c head/contrib/gcc/libgcc2.h head/contrib/gcc/loop-init.c head/contrib/gcc/toplev.c head/contrib/gcc/tree-ssa-address.c Modified: head/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- head/contrib/gcc/ChangeLog.gcc43 Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/ChangeLog.gcc43 Thu Jan 2 13:53:53 2014 (r260194) @@ -156,15 +156,6 @@ * reload1.c (merge_assigned_reloads) : Do not merge a RELOAD_OTHER instruction with a RELOAD_FOR_OPERAND_ADDRESS instruction. -2007-04-24 Richard Henderson (r124106) - - * libgcc2.h (AVOID_FP_TYPE_CONVERSION): Rename from - IS_IBM_EXTENDED. Also define in terms of WIDEST_HARDWARE_FP_SIZE. - * libgcc2.c (__floatdisf): Avoid double-word arithmetic when - looking for non-zero bits shifted out. Avoid a recursive call - when constructing the scalar. - (__floatundisf): Likewise. - 2007-04-16 Lawrence Crowl (r123909) * doc/invoke.texi (Debugging Options): Add documentation for the @@ -257,11 +248,6 @@ * tree-vrp.c (vrp_int_const_binop): Handle PLUS_EXPR and the *_DIV_EXPR codes correctly with overflow infinities. -2007-03-04 Zdenek Dvorak (r122528) - - * tree-ssa-address.c (create_mem_ref): Do not put an expression - containing a cast to the base of TARGET_MEM_REF. - 2007-02-09 Dwarakanath Rajagopal (r121763) * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. @@ -438,11 +424,6 @@ and amdfam10. * doc/extend.texi: Add documentation for SSE4A builtins. -2007-02-01 Zdenek Dvorak (r121464) - - * toplev.c (lang_dependent_init): Call init_set_costs. - * loop-init.c (loop_optimizer_init): Do not call init_set_costs. - 2007-01-24 Jakub Jelinek (r121140) * config/i386/i386.h (x86_cmpxchg16b): Remove const. Modified: head/contrib/gcc/cp/ChangeLog ============================================================================== --- head/contrib/gcc/cp/ChangeLog Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/cp/ChangeLog Thu Jan 2 13:53:53 2014 (r260194) @@ -314,12 +314,6 @@ PR c++/30895 * tree.c (cp_tree_equal): Properly handle COMPLEX_CST trees. -2007-03-02 Geoffrey Keating (r122488) - - * g++spec.c (lang_specific_driver): Add -lstdc++ when compiling - Objective-C++. Don't exit early if -shared-libgcc needs to be - added. - 2007-02-22 Simon Martin PR c++/29475 Modified: head/contrib/gcc/cp/g++spec.c ============================================================================== --- head/contrib/gcc/cp/g++spec.c Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/cp/g++spec.c Thu Jan 2 13:53:53 2014 (r260194) @@ -159,19 +159,11 @@ lang_specific_driver (int *in_argc, cons arg = ""; if (library == 0 && (strcmp (arg, "c++") == 0 - || strcmp (arg, "c++-cpp-output") == 0 - || strcmp (arg, "objective-c++") == 0 - || strcmp (arg, "objective-c++-cpp-output") == 0)) + || strcmp (arg, "c++-cpp-output") == 0)) library = 1; saw_speclang = 1; } - else if (strcmp (argv[i], "-ObjC++") == 0) - { - if (library == 0) - library = 1; - saw_speclang = 1; - } /* Arguments that go directly to the linker might be .o files, or something, and so might cause libstdc++ to be needed. */ else if (strcmp (argv[i], "-Xlinker") == 0) @@ -245,6 +237,13 @@ lang_specific_driver (int *in_argc, cons if (quote) fatal ("argument to '%s' missing\n", quote); + /* If we know we don't have to do anything, bail now. */ + if (! added && library <= 0) + { + free (args); + return; + } + /* There's no point adding -shared-libgcc if we don't have a shared libgcc. */ #ifndef ENABLE_SHARED_LIBGCC Modified: head/contrib/gcc/libgcc2.c ============================================================================== --- head/contrib/gcc/libgcc2.c Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/libgcc2.c Thu Jan 2 13:53:53 2014 (r260194) @@ -1420,7 +1420,11 @@ __floatunditf (UDWtype u) #define F_MODE_OK(SIZE) \ (SIZE < DI_SIZE \ && SIZE > (DI_SIZE - SIZE + FSSIZE) \ - && !AVOID_FP_TYPE_CONVERSION(SIZE)) + /* Don't use IBM Extended Double TFmode for TI->SF calculations. \ + The conversion from long double to float suffers from double \ + rounding, because we convert via double. In any case, the \ + fallback code is faster. */ \ + && !IS_IBM_EXTENDED (SIZE)) #if defined(L_floatdisf) #define FUNC __floatdisf #define FSTYPE SFtype @@ -1511,21 +1515,13 @@ FUNC (DWtype u) hi = u >> shift; /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */ - if ((UWtype)u << (W_TYPE_SIZE - shift)) + if (u & (((DWtype)1 << shift) - 1)) hi |= 1; /* Convert the one word of data, and rescale. */ - FSTYPE f = hi, e; - if (shift == W_TYPE_SIZE) - e = Wtype_MAXp1_F; - /* The following two cases could be merged if we knew that the target - supported a native unsigned->float conversion. More often, we only - have a signed conversion, and have to add extra fixup code. */ - else if (shift == W_TYPE_SIZE - 1) - e = Wtype_MAXp1_F / 2; - else - e = (Wtype)1 << shift; - return f * e; + FSTYPE f = hi; + f *= (UDWtype)1 << shift; + return f; #endif } #endif @@ -1536,7 +1532,11 @@ FUNC (DWtype u) #define F_MODE_OK(SIZE) \ (SIZE < DI_SIZE \ && SIZE > (DI_SIZE - SIZE + FSSIZE) \ - && !AVOID_FP_TYPE_CONVERSION(SIZE)) + /* Don't use IBM Extended Double TFmode for TI->SF calculations. \ + The conversion from long double to float suffers from double \ + rounding, because we convert via double. In any case, the \ + fallback code is faster. */ \ + && !IS_IBM_EXTENDED (SIZE)) #if defined(L_floatundisf) #define FUNC __floatundisf #define FSTYPE SFtype @@ -1620,21 +1620,13 @@ FUNC (UDWtype u) hi = u >> shift; /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */ - if ((UWtype)u << (W_TYPE_SIZE - shift)) + if (u & (((UDWtype)1 << shift) - 1)) hi |= 1; /* Convert the one word of data, and rescale. */ - FSTYPE f = hi, e; - if (shift == W_TYPE_SIZE) - e = Wtype_MAXp1_F; - /* The following two cases could be merged if we knew that the target - supported a native unsigned->float conversion. More often, we only - have a signed conversion, and have to add extra fixup code. */ - else if (shift == W_TYPE_SIZE - 1) - e = Wtype_MAXp1_F / 2; - else - e = (Wtype)1 << shift; - return f * e; + FSTYPE f = hi; + f *= (UDWtype)1 << shift; + return f; #endif } #endif Modified: head/contrib/gcc/libgcc2.h ============================================================================== --- head/contrib/gcc/libgcc2.h Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/libgcc2.h Thu Jan 2 13:53:53 2014 (r260194) @@ -119,16 +119,10 @@ extern short int __get_eh_table_version /* FIXME: This #ifdef probably should be removed, ie. enable the test for mips too. */ -/* Don't use IBM Extended Double TFmode for TI->SF calculations. - The conversion from long double to float suffers from double - rounding, because we convert via double. In other cases, going - through the software fp routines is much slower than the fallback. */ #ifdef __powerpc__ -#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE == 106) -#elif defined(WIDEST_HARDWARE_FP_SIZE) -#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE > WIDEST_HARDWARE_FP_SIZE) +#define IS_IBM_EXTENDED(SIZE) (SIZE == 106) #else -#define AVOID_FP_TYPE_CONVERSION(SIZE) 0 +#define IS_IBM_EXTENDED(SIZE) 0 #endif /* In the first part of this file, we are interfacing to calls generated Modified: head/contrib/gcc/loop-init.c ============================================================================== --- head/contrib/gcc/loop-init.c Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/loop-init.c Thu Jan 2 13:53:53 2014 (r260194) @@ -43,6 +43,13 @@ loop_optimizer_init (unsigned flags) struct loops *loops = XCNEW (struct loops); edge e; edge_iterator ei; + static bool first_time = true; + + if (first_time) + { + first_time = false; + init_set_costs (); + } /* Avoid annoying special cases of edges going to exit block. */ Modified: head/contrib/gcc/toplev.c ============================================================================== --- head/contrib/gcc/toplev.c Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/toplev.c Thu Jan 2 13:53:53 2014 (r260194) @@ -1948,11 +1948,6 @@ lang_dependent_init (const char *name) provide a dummy function context for them. */ init_dummy_function_start (); init_expr_once (); - - /* Although the actions of init_set_costs are language-independent, - it uses optabs, so we cannot call it from backend_init. */ - init_set_costs (); - expand_dummy_function_end (); /* If dbx symbol table desired, initialize writing it and output the Modified: head/contrib/gcc/tree-ssa-address.c ============================================================================== --- head/contrib/gcc/tree-ssa-address.c Thu Jan 2 13:48:54 2014 (r260193) +++ head/contrib/gcc/tree-ssa-address.c Thu Jan 2 13:53:53 2014 (r260194) @@ -569,7 +569,7 @@ create_mem_ref (block_stmt_iterator *bsi struct affine_tree_combination *addr) { tree mem_ref, tmp; - tree atype; + tree addr_type = build_pointer_type (type), atype; struct mem_address parts; addr_to_parts (addr, &parts); @@ -597,23 +597,18 @@ create_mem_ref (block_stmt_iterator *bsi if (parts.symbol) { - tmp = build_addr (parts.symbol, current_function_decl); - gcc_assert (is_gimple_val (tmp)); + tmp = fold_convert (addr_type, + build_addr (parts.symbol, current_function_decl)); /* Add the symbol to base, eventually forcing it to register. */ if (parts.base) { - gcc_assert (TREE_TYPE (parts.base) == sizetype); - if (parts.index) - { - atype = TREE_TYPE (tmp); - parts.base = force_gimple_operand_bsi (bsi, - fold_build2 (PLUS_EXPR, atype, - fold_convert (atype, parts.base), + parts.base = force_gimple_operand_bsi (bsi, + fold_build2 (PLUS_EXPR, addr_type, + fold_convert (addr_type, parts.base), tmp), true, NULL_TREE); - } else { parts.index = parts.base; From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 14:21:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82FB85E1 for ; Thu, 2 Jan 2014 14:21:18 +0000 (UTC) Received: from nm39-vm9.bullet.mail.bf1.yahoo.com (nm39-vm9.bullet.mail.bf1.yahoo.com [72.30.239.153]) by mx1.freebsd.org (Postfix) with SMTP id 0A1821DF2 for ; Thu, 2 Jan 2014 14:21:17 +0000 (UTC) Received: from [98.139.212.150] by nm39.bullet.mail.bf1.yahoo.com with NNFMP; 02 Jan 2014 14:14:28 -0000 Received: from [98.139.211.204] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 02 Jan 2014 14:14:28 -0000 Received: from [127.0.0.1] by smtp213.mail.bf1.yahoo.com with NNFMP; 02 Jan 2014 14:14:28 -0000 X-Yahoo-Newman-Id: 305628.59848.bm@smtp213.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: UcLrGHwVM1nA8kBiZpDbDdWH9v.mEnXLTeO_ws.QNInuE_m PVZZCPDktXOM6YkwD7794LxVvuFVuivMq4t0H06bNgna0D17Ynww.etKYZsi 0HJvNXiq9KGCRyZM0f8Ew7bpXlAD3UiW1.drJ8VSEbEBzW6qofT7jGJRhz7. naGKd6X2lfzfKs_cUZnWmn5uTkz_KhcGXvM0lYVH7rX60Sh99XI3WzshcG34 rFlMeO7xzNaFHzGdDzp6J3TobGdBDaRaOE8DJsdGvmwBCwI_oOuolzphtUA6 Oa3drfBgs6G0P7vp_9zW_xamYWpSDtVzlQw7pVhe897HPKxg_5ZUs3WHSv6o uhf0JZfFtLEvNufgen640DhS0o5_OdGFeXYewSqo1Mnl__pGPeogflsYe.3D HT1QI33zzeWhmYzEu261yDfLqbp6sv.TG4dnMKANwlSqNm0fn1SWLzX_jyfu ZFf8B0zYiDtc04ZEZ4JRAHb_V.0sto95L4NxCP2vVXyPY0n1jZz3iehZuiKI TtFPVoKPJ50Y0BpVUE7KqECw3ce18NqkdZ60ZivMrpGjyipGtKnBl6tObYpb sxV16jac2RQHYkdyCEXHjjNHzjDzkRltI414PmShpBTbvG1J5rhu3gELvbQa AW398QegBeZ0iIWhWUFRMSChw5fQ- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf X-Rocket-Received: from [192.168.0.102] (pfg@190.157.126.109 with plain [98.139.211.125]) by smtp213.mail.bf1.yahoo.com with SMTP; 02 Jan 2014 06:14:28 -0800 PST Message-ID: <52C57442.50306@FreeBSD.org> Date: Thu, 02 Jan 2014 09:14:26 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andreas Tobler , svn-src-head@FreeBSD.org Subject: Re: svn commit: r260073 - in head/contrib/gcc: . cp References: <201312300252.rBU2qhYK098609@svn.freebsd.org> <52C54C99.9030509@FreeBSD.org> In-Reply-To: <52C54C99.9030509@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 14:21:18 -0000 On 02.01.2014 06:25, Andreas Tobler wrote: > Hi Pedro, > > Happy new Year! > > On 30.12.13 03:52, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Mon Dec 30 02:52:43 2013 >> New Revision: 260073 >> URL: http://svnweb.freebsd.org/changeset/base/260073 >> >> Log: >> gcc: small diff reduction wrt gcc43 and Apple GCC. >> >> Obtained from: gcc 4.3 (rev. 121464, 122528, 124106; GPLv2) >> MFC after: 3 weeks >> >> Modified: >> head/contrib/gcc/ChangeLog.gcc43 >> head/contrib/gcc/cp/ChangeLog >> head/contrib/gcc/cp/g++spec.c >> head/contrib/gcc/libgcc2.c >> head/contrib/gcc/libgcc2.h >> head/contrib/gcc/loop-init.c >> head/contrib/gcc/toplev.c >> head/contrib/gcc/tree-ssa-address.c > May I ask you to revert this commit? It causes an ICE on powerpc(64) and > sparc64 while compiling dev/trm/trm.c. Tinderbox also showed this one a > few days ago. It should pop up again soon. > > Done, thank you! FWIW, I have almost finished the patch to add Block support to gcc. I still have to check many things and document the changes but I got to a point where the example in Wikipedia works :). Pedro. From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 18:49:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D46ED68E; Thu, 2 Jan 2014 18:49:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C07D415DF; Thu, 2 Jan 2014 18:49:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02In5R7030973; Thu, 2 Jan 2014 18:49:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02In5Pl030972; Thu, 2 Jan 2014 18:49:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201401021849.s02In5Pl030972@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 Jan 2014 18:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260204 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 18:49:05 -0000 Author: kib Date: Thu Jan 2 18:49:05 2014 New Revision: 260204 URL: http://svnweb.freebsd.org/changeset/base/260204 Log: Assert that accounting for the pmap resident pages does not underflow. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jan 2 18:30:24 2014 (r260203) +++ head/sys/amd64/amd64/pmap.c Thu Jan 2 18:49:05 2014 (r260204) @@ -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-head@FreeBSD.ORG Thu Jan 2 18:50:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 912EC833; Thu, 2 Jan 2014 18:50:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 63C5E15F4; Thu, 2 Jan 2014 18:50:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02Iora6031283; Thu, 2 Jan 2014 18:50:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02IorhY031282; Thu, 2 Jan 2014 18:50:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201401021850.s02IorhY031282@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 Jan 2014 18:50:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260205 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 18:50:53 -0000 Author: kib Date: Thu Jan 2 18:50:52 2014 New Revision: 260205 URL: http://svnweb.freebsd.org/changeset/base/260205 Log: Update the description for pmap_remove_pages() to match the modern times [1]. Assert that the pmap passed to pmap_remove_pages() is only active on current CPU. Submitted by: alc [1] Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jan 2 18:49:05 2014 (r260204) +++ head/sys/amd64/amd64/pmap.c Thu Jan 2 18:50:52 2014 (r260205) @@ -5123,12 +5123,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) @@ -5148,10 +5156,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-head@FreeBSD.ORG Thu Jan 2 19:14:22 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48DD5128; Thu, 2 Jan 2014 19:14:22 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9DA251831; Thu, 2 Jan 2014 19:14:21 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s02JEKVU020732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Jan 2014 11:14:21 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s02JEKn1020731; Thu, 2 Jan 2014 11:14:20 -0800 (PST) (envelope-from jmg) Date: Thu, 2 Jan 2014 11:14:20 -0800 From: John-Mark Gurney To: Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102191420.GB99167@funkthat.com> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140102131308.GI59496@kib.kiev.ua> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 02 Jan 2014 11:14:21 -0800 (PST) Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , svn-src-all@FreeBSD.org, Alfred Perlstein , Stanislav Sedov , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:14:22 -0000 Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0200: > > > Afaik you could just remove the "spare" and steal 2 or 4 entries from > > > _kf_ispare until it is sorted. > > > > Yes, this would work for current cap_rights_t structure, at least for > > i386 and amd64, but would only allow to expand the structure by one > > uint64_t in the future (which might or might not be enough). The > > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > designed to expand, but cannot be, because kinfo_file wasn't modified at > > the start of a major branch. > The ABI stability is not limited to the single branch. It must be > preserved across whole project lifetime. Umm. when did this policy change happen? I thought ABI compatibility was limited to major releases of FreeBSD? How are you suppose to do any work if you can't break ABI ever? I did a quick search for "freebsd policy abi breakage" and found some mailing list posts about this, but no authoritative statement... Of course the problem is that when we move to (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, or introduce tons of compatibility code that will rot... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 19:23:58 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3360168D; Thu, 2 Jan 2014 19:23:58 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 125101956; Thu, 2 Jan 2014 19:23:57 +0000 (UTC) Received: from Alfreds-MacBook-Pro.local (50-204-88-5-static.hfc.comcastbusiness.net [50.204.88.5]) by elvis.mu.org (Postfix) with ESMTPSA id BEADE1A3C1A; Thu, 2 Jan 2014 11:23:55 -0800 (PST) Message-ID: <52C5BCCB.6070702@mu.org> Date: Thu, 02 Jan 2014 11:23:55 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: John-Mark Gurney , Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> In-Reply-To: <20140102191420.GB99167@funkthat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:23:58 -0000 On 1/2/14, 11:14 AM, John-Mark Gurney wrote: > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0200: >>>> Afaik you could just remove the "spare" and steal 2 or 4 entries from >>>> _kf_ispare until it is sorted. >>> Yes, this would work for current cap_rights_t structure, at least for >>> i386 and amd64, but would only allow to expand the structure by one >>> uint64_t in the future (which might or might not be enough). The >>> cap_rights_t structure is designed to be expanded to 5 uint64_ts without >>> breaking ABI. I don't want to stuck with current cap_rights_t that is >>> designed to expand, but cannot be, because kinfo_file wasn't modified at >>> the start of a major branch. >> The ABI stability is not limited to the single branch. It must be >> preserved across whole project lifetime. > Umm. when did this policy change happen? I thought ABI compatibility > was limited to major releases of FreeBSD? How are you suppose to do > any work if you can't break ABI ever? > > I did a quick search for "freebsd policy abi breakage" and found some > mailing list posts about this, but no authoritative statement... > > Of course the problem is that when we move to > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, > or introduce tons of compatibility code that will rot... > I agree, however there is a very easy way to fix it for the time being. Let's not be binary about it "well it's going to have to break, so let's break it!" when such an easy way to not break it exists. It should be "let's see if there's a non-intrusive way of not breaking it" and the answer to that seems to be "yes". -Alfred From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 19:26:20 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0C4F8841; Thu, 2 Jan 2014 19:26:20 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 62D521966; Thu, 2 Jan 2014 19:26:19 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s02JQDMC003304; Thu, 2 Jan 2014 21:26:13 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s02JQDMC003304 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s02JQCZH003303; Thu, 2 Jan 2014 21:26:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 2 Jan 2014 21:26:12 +0200 From: Konstantin Belousov To: John-Mark Gurney Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102192612.GM59496@kib.kiev.ua> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r+soi4lT5gbz/qtX" Content-Disposition: inline In-Reply-To: <20140102191420.GB99167@funkthat.com> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , svn-src-all@FreeBSD.org, Alfred Perlstein , Stanislav Sedov , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:26:20 -0000 --r+soi4lT5gbz/qtX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 11:14:20AM -0800, John-Mark Gurney wrote: > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +020= 0: > > > > Afaik you could just remove the "spare" and steal 2 or 4 entries fr= om=20 > > > > _kf_ispare until it is sorted. > > >=20 > > > Yes, this would work for current cap_rights_t structure, at least for > > > i386 and amd64, but would only allow to expand the structure by one > > > uint64_t in the future (which might or might not be enough). The > > > cap_rights_t structure is designed to be expanded to 5 uint64_ts with= out > > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > > designed to expand, but cannot be, because kinfo_file wasn't modified= at > > > the start of a major branch. > > The ABI stability is not limited to the single branch. It must be > > preserved across whole project lifetime. >=20 > Umm. when did this policy change happen? I thought ABI compatibility > was limited to major releases of FreeBSD? How are you suppose to do > any work if you can't break ABI ever? Policy did not changed. Breaking ABI was never allowed, except for the kernel management interfaces. Later was only accepted due to tight relation of the typical management facilities and internal kernel structures, but this is considered a bug. >=20 > I did a quick search for "freebsd policy abi breakage" and found some > mailing list posts about this, but no authoritative statement... Re tried to write down the policy, last time it was several years ago. The efforts should be revived. >=20 > Of course the problem is that when we move to > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, > or introduce tons of compatibility code that will rot... I do not understand what are you trying to say. --r+soi4lT5gbz/qtX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxb1TAAoJEJDCuSvBvK1B/zQP/iVk7VZOtU9854qp4PlvNB1M 9WjhnhwCjhpfvmZr82Izq3fTbr58vytLcQvZYbY8iwbEr3EJcyF5Z1qNnDqd4cMW Wr0K4nTtfprHl6UFvDqHobTRq4/1/QMSZliavHbOhmIAvFXRsL6NwsiFOoTKtGe7 uTWTRoOB/U0IuCXJ39x18nTVAJ6ChJKOZCirTJ0FGJRg0Okalux2Ynci59Ec/69P hm8m71Lfi9NeLx+7HbQctK9RAA7p0S9D7Z0qHBoncGR17cevf6YrQYZaFvQMLIsx s5UCoVfde0UOqVORDu7qP4fuehp2i82y0+mxmBukTyQZO72Lj84ptosHR+m8jrwk TbO34VMhOTCwnxdBZoY0HO5v8bcTFoH+f/MlaX8QTFP2EdJRgN0+cfmsl2SSvzLB kcEPZXeqDss2SNkwejqhxcUEdz+qrHIeqs9uUeyAzgKkyTpTe+vOkJXp6lWIEUhU 2Vbf7ooBbzWZX78TcOfktej2dKN+pq2FerdO0XrPunA0hS5uoswKZuSssDKC4DY+ DZGdzbeWDvDQUdxAY4s1JtdIWiAGK7u6ma567h2gdb69SiP06I2vEEbZKhP6YEpi sRhC4ynLX9/xrmnDZ7rhFysfr7HtAxcKgL+mIgfnP+XFu1yy7DtMSiHTVjNm7TFA gmvKDsqCnHTvShzW+jOy =CWBK -----END PGP SIGNATURE----- --r+soi4lT5gbz/qtX-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 19:34:23 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2358E1A; Thu, 2 Jan 2014 19:34:23 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 486531A25; Thu, 2 Jan 2014 19:34:23 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s02JYDkQ004439; Thu, 2 Jan 2014 21:34:13 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s02JYDkQ004439 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s02JYDkw004438; Thu, 2 Jan 2014 21:34:13 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 2 Jan 2014 21:34:13 +0200 From: Konstantin Belousov To: Alfred Perlstein Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102193413.GN59496@kib.kiev.ua> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> <52C5BCCB.6070702@mu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4b8dhEGAgskINMcg" Content-Disposition: inline In-Reply-To: <52C5BCCB.6070702@mu.org> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , John-Mark Gurney , Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:34:24 -0000 --4b8dhEGAgskINMcg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 11:23:55AM -0800, Alfred Perlstein wrote: >=20 > On 1/2/14, 11:14 AM, John-Mark Gurney wrote: > > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0= 200: > >>>> Afaik you could just remove the "spare" and steal 2 or 4 entries from > >>>> _kf_ispare until it is sorted. > >>> Yes, this would work for current cap_rights_t structure, at least for > >>> i386 and amd64, but would only allow to expand the structure by one > >>> uint64_t in the future (which might or might not be enough). The > >>> cap_rights_t structure is designed to be expanded to 5 uint64_ts with= out > >>> breaking ABI. I don't want to stuck with current cap_rights_t that is > >>> designed to expand, but cannot be, because kinfo_file wasn't modified= at > >>> the start of a major branch. > >> The ABI stability is not limited to the single branch. It must be > >> preserved across whole project lifetime. > > Umm. when did this policy change happen? I thought ABI compatibility > > was limited to major releases of FreeBSD? How are you suppose to do > > any work if you can't break ABI ever? > > > > I did a quick search for "freebsd policy abi breakage" and found some > > mailing list posts about this, but no authoritative statement... > > > > Of course the problem is that when we move to > > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, > > or introduce tons of compatibility code that will rot... > > > I agree, however there is a very easy way to fix it for the time being. = =20 > Let's not be binary about it "well it's going to have to break, so let's= =20 > break it!" when such an easy way to not break it exists. It should be=20 > "let's see if there's a non-intrusive way of not breaking it" and the=20 > answer to that seems to be "yes". If parts of ABI is broken, then why spend efforts trying to keep other parts stable ? You already have random set of binaries broken, sometimes in subtle way. Then, making other interfaces stable is just a waste. ABI stability is a yes/no proposition, you cannot have it partly done. Personally, I do not want to spend a time on hobbyist system. BTW, to point out obvious thing, Linux has almost perfect ABI stability and forward compatibility. It is pity to see that our people do not understand the importance and benefits of it. --4b8dhEGAgskINMcg Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxb80AAoJEJDCuSvBvK1Bh2sP/2rmw7pQjSNF8Oq/7/XvvKR4 0ilmUMKY4C0CxH9ziF59JePP8ZCLMfX4HFjDp4jKDtSdfpRCmjJuuQ66A10/5udI KDb1Obf6p9tiyqrZphrWpT3On7XCAacaRU9G7evIJdVN0+YVfcrnJDgakNvCr91O bVV3TuyHMvsuPxZy+etoGc99SOVhMveK1O3+lJgMtmKMi6jS0pd1XO5t0G16DL6j nADS+p4i74rXUWp11jr5h29tPjM2Baz0LfjJfbp5JBTOhs6gNwCW6fwpQ4kkskAK CdAt3TsWZbBkPK0zRMninzRp8EvWOUyBMxf52qpxG7DPTHmIfJtm5dhxlo17pgdy Kb7x90lymqhkemRw1M3m1HDDEAzUlevBj9R5QfhR3/YFRFYiQdfyqS4e5KTgLWhq nkCprkV41smLi3CHvZO7A9z/SgTokdV9E76chjvfbITfnpZm5UTehmzYiT2uGknI q3UWKnGqRDf6iiHuvoNl4OKdYhKTqIzksOsf88e7cBszx/v+Xj+oBkZus9teG9H5 bfSvYASOreCf8JBYY0lfXzTQomIza+PNaT6It0pjdBcejwitN0S4LWnnHyzhp6vf W1VyMrH/mHyC/pkOpfA4mvxX33HgMowmT8rH8pJaeeztTeYJ3ArIJIstV/Ix6nY7 Nq1keZvpCm+u5mPrISCe =hhN1 -----END PGP SIGNATURE----- --4b8dhEGAgskINMcg-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 19:45:33 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 656F159D; Thu, 2 Jan 2014 19:45:33 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 48B2A1AFA; Thu, 2 Jan 2014 19:45:32 +0000 (UTC) Received: from Alfreds-MacBook-Pro.local (50-204-88-5-static.hfc.comcastbusiness.net [50.204.88.5]) by elvis.mu.org (Postfix) with ESMTPSA id 2F4D21A3C37; Thu, 2 Jan 2014 11:45:32 -0800 (PST) Message-ID: <52C5C1DB.8030308@mu.org> Date: Thu, 02 Jan 2014 11:45:31 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> <52C5BCCB.6070702@mu.org> <20140102193413.GN59496@kib.kiev.ua> In-Reply-To: <20140102193413.GN59496@kib.kiev.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , John-Mark Gurney , Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:45:33 -0000 On 1/2/14, 11:34 AM, Konstantin Belousov wrote: > On Thu, Jan 02, 2014 at 11:23:55AM -0800, Alfred Perlstein wrote: >> On 1/2/14, 11:14 AM, John-Mark Gurney wrote: >>> Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0200: >>>>>> Afaik you could just remove the "spare" and steal 2 or 4 entries from >>>>>> _kf_ispare until it is sorted. >>>>> Yes, this would work for current cap_rights_t structure, at least for >>>>> i386 and amd64, but would only allow to expand the structure by one >>>>> uint64_t in the future (which might or might not be enough). The >>>>> cap_rights_t structure is designed to be expanded to 5 uint64_ts without >>>>> breaking ABI. I don't want to stuck with current cap_rights_t that is >>>>> designed to expand, but cannot be, because kinfo_file wasn't modified at >>>>> the start of a major branch. >>>> The ABI stability is not limited to the single branch. It must be >>>> preserved across whole project lifetime. >>> Umm. when did this policy change happen? I thought ABI compatibility >>> was limited to major releases of FreeBSD? How are you suppose to do >>> any work if you can't break ABI ever? >>> >>> I did a quick search for "freebsd policy abi breakage" and found some >>> mailing list posts about this, but no authoritative statement... >>> >>> Of course the problem is that when we move to >>> (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, >>> or introduce tons of compatibility code that will rot... >>> >> I agree, however there is a very easy way to fix it for the time being. >> Let's not be binary about it "well it's going to have to break, so let's >> break it!" when such an easy way to not break it exists. It should be >> "let's see if there's a non-intrusive way of not breaking it" and the >> answer to that seems to be "yes". > If parts of ABI is broken, then why spend efforts trying to keep other > parts stable ? You already have random set of binaries broken, sometimes > in subtle way. Then, making other interfaces stable is just a waste. > > ABI stability is a yes/no proposition, you cannot have it partly done. > Personally, I do not want to spend a time on hobbyist system. > > BTW, to point out obvious thing, Linux has almost perfect ABI stability > and forward compatibility. It is pity to see that our people do not > understand the importance and benefits of it. I agree strongly. -Alfred From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 19:59:37 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05E35166; Thu, 2 Jan 2014 19:59:37 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D88C1D1C; Thu, 2 Jan 2014 19:59:36 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s02JxZRj021329 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Jan 2014 11:59:36 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s02JxZg3021328; Thu, 2 Jan 2014 11:59:35 -0800 (PST) (envelope-from jmg) Date: Thu, 2 Jan 2014 11:59:35 -0800 From: John-Mark Gurney To: Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102195935.GC99167@funkthat.com> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> <20140102192612.GM59496@kib.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140102192612.GM59496@kib.kiev.ua> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 02 Jan 2014 11:59:36 -0800 (PST) Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , svn-src-all@FreeBSD.org, Alfred Perlstein , Stanislav Sedov , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 19:59:37 -0000 Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 21:26 +0200: > On Thu, Jan 02, 2014 at 11:14:20AM -0800, John-Mark Gurney wrote: > > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0200: > > > > > Afaik you could just remove the "spare" and steal 2 or 4 entries from > > > > > _kf_ispare until it is sorted. > > > > > > > > Yes, this would work for current cap_rights_t structure, at least for > > > > i386 and amd64, but would only allow to expand the structure by one > > > > uint64_t in the future (which might or might not be enough). The > > > > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > > > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > > > designed to expand, but cannot be, because kinfo_file wasn't modified at > > > > the start of a major branch. > > > The ABI stability is not limited to the single branch. It must be > > > preserved across whole project lifetime. > > > > Umm. when did this policy change happen? I thought ABI compatibility > > was limited to major releases of FreeBSD? How are you suppose to do > > any work if you can't break ABI ever? > Policy did not changed. Breaking ABI was never allowed, except for the > kernel management interfaces. Later was only accepted due to tight > relation of the typical management facilities and internal kernel > structures, but this is considered a bug. Please do no use such absolutes, since the ABI has been allowed to break in the recent past, as I'm looking at a commit in 2005 that broke struct kproc_info size... > > I did a quick search for "freebsd policy abi breakage" and found some > > mailing list posts about this, but no authoritative statement... > Re tried to write down the policy, last time it was several years ago. > The efforts should be revived. > > > > > Of course the problem is that when we move to > > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, > > or introduce tons of compatibility code that will rot... > > I do not understand what are you trying to say. My point is that once we move to the "new ABI", we will either have to accept that we stop maintaining the old interface, or we write and maintain the old interface, but if we do, what's the point of going to the new interface if the old interface "never" breaks? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 20:21:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6521FFE; Thu, 2 Jan 2014 20:21:54 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7DCAE1F1E; Thu, 2 Jan 2014 20:21:54 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 71098B992; Thu, 2 Jan 2014 15:21:53 -0500 (EST) From: John Baldwin To: Zbigniew Bodek Subject: Re: svn commit: r260163 - head/sys/dev/ahci Date: Thu, 2 Jan 2014 13:45:39 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <201401012018.s01KI31L014441@svn.freebsd.org> In-Reply-To: <201401012018.s01KI31L014441@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201401021345.39250.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 02 Jan 2014 15:21:53 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 20:21:54 -0000 On Wednesday, January 01, 2014 3:18:03 pm Zbigniew Bodek wrote: > Author: zbb > Date: Wed Jan 1 20:18:03 2014 > New Revision: 260163 > URL: http://svnweb.freebsd.org/changeset/base/260163 > > Log: > Do not attach to PCI bridges in AHCI driver > > Some vendors use the same VID:PID combination in AHCI and PCI bridge cards Would it be better to require the class to be PCIC_STORAGE instead? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:18:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2625B528; Thu, 2 Jan 2014 21:18:41 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D4EAE1410; Thu, 2 Jan 2014 21:18:40 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E6965B987; Thu, 2 Jan 2014 16:18:39 -0500 (EST) From: John Baldwin To: "John-Mark Gurney" Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Date: Thu, 2 Jan 2014 16:18:22 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <201309050009.r8509vsE061271@svn.freebsd.org> <20140102192612.GM59496@kib.kiev.ua> <20140102195935.GC99167@funkthat.com> In-Reply-To: <20140102195935.GC99167@funkthat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201401021618.23155.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 02 Jan 2014 16:18:40 -0500 (EST) Cc: src-committers@freebsd.org, Pawel Jakub Dawidek , svn-src-all@freebsd.org, Alfred Perlstein , Stanislav Sedov , svn-src-head@freebsd.org, Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:18:41 -0000 On Thursday, January 02, 2014 2:59:35 pm John-Mark Gurney wrote: > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 21:26 +0200: > > On Thu, Jan 02, 2014 at 11:14:20AM -0800, John-Mark Gurney wrote: > > > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 +0200: > > > > > > Afaik you could just remove the "spare" and steal 2 or 4 entries from > > > > > > _kf_ispare until it is sorted. > > > > > > > > > > Yes, this would work for current cap_rights_t structure, at least for > > > > > i386 and amd64, but would only allow to expand the structure by one > > > > > uint64_t in the future (which might or might not be enough). The > > > > > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > > > > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > > > > designed to expand, but cannot be, because kinfo_file wasn't modified at > > > > > the start of a major branch. > > > > The ABI stability is not limited to the single branch. It must be > > > > preserved across whole project lifetime. > > > > > > Umm. when did this policy change happen? I thought ABI compatibility > > > was limited to major releases of FreeBSD? How are you suppose to do > > > any work if you can't break ABI ever? > > Policy did not changed. Breaking ABI was never allowed, except for the > > kernel management interfaces. Later was only accepted due to tight > > relation of the typical management facilities and internal kernel > > structures, but this is considered a bug. > > Please do no use such absolutes, since the ABI has been allowed to break > in the recent past, as I'm looking at a commit in 2005 that broke struct > kproc_info size... > > > > I did a quick search for "freebsd policy abi breakage" and found some > > > mailing list posts about this, but no authoritative statement... > > Re tried to write down the policy, last time it was several years ago. > > The efforts should be revived. > > > > > > > > Of course the problem is that when we move to > > > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, > > > or introduce tons of compatibility code that will rot... > > > > I do not understand what are you trying to say. > > My point is that once we move to the "new ABI", we will either have to > accept that we stop maintaining the old interface, or we write and > maintain the old interface, but if we do, what's the point of going to > the new interface if the old interface "never" breaks? *cough* Ahem. We've changed the ABI of kinfo_file once before already and supported both just fine. Please search for COMPAT_FREEBSD7 in kern_descrip.c. In this case this works because the relevant sysctls use fixed nodes, so you can add a new ABI by moving the names to the new numbers but leaving the old nodes in place for the old ABI. Shouldn't take a huge amount of work for Pawel to bang out appropriate COMPAT_FREEBSD8 | COMPAT_FREEBSD9 diffs for this. OTOH, this breaks the ABI for existing 10.x binaries, so it needs to be done ASAP. I don't know if any ports use these sysctls directly (psutil might). If so a recompile should generally "fix" them to move them to the new ABI once it is in place. (And yes, Pawel, since you are changing kinfo_file, this is your responsibility to fix.) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:27:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DB498C3; Thu, 2 Jan 2014 21:27:06 +0000 (UTC) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id B5ED914D9; Thu, 2 Jan 2014 21:27:04 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id CA17E47A; Thu, 2 Jan 2014 22:20:09 +0100 (CET) Date: Thu, 2 Jan 2014 22:27:58 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102212757.GA1672@garage.freebsd.pl> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZGiS0Q5IWpPtfppv" Content-Disposition: inline In-Reply-To: <20140102131308.GI59496@kib.kiev.ua> X-OS: FreeBSD 11.0-CURRENT amd64 User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:27:06 -0000 --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 03:13:08PM +0200, Konstantin Belousov wrote: > On Thu, Jan 02, 2014 at 11:49:04AM +0100, Pawel Jakub Dawidek wrote: > > I don't plan to provide alternative way to fetch the cap stuff. Well, I > > implemented libnv, which can be used to reimplement how we fetch all > > data like kinfo_file in a ABI friendly way, but I don't plan to modify > > this specific code myself. > I.e. you break something and decline to fix it, putting the burden on > somebody else. That's a bit too far. I wasn't declining fixing a bug I introduced. I was declining implementing an improvement. That's two very different things. Chose your words more carefully and not only this time. > > Yes, this would work for current cap_rights_t structure, at least for > > i386 and amd64, but would only allow to expand the structure by one > > uint64_t in the future (which might or might not be enough). The > > cap_rights_t structure is designed to be expanded to 5 uint64_ts without > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > designed to expand, but cannot be, because kinfo_file wasn't modified at > > the start of a major branch. > The ABI stability is not limited to the single branch. It must be > preserved across whole project lifetime. [...] To address your statement that either entire ABI is stable or not and there is nothing in between. That's of course incorrect. First of all, we, as a project, don't consider all existing interfaces as stable. This would be a suicide. There are plenty of private interfaces we must and we do break from release to release. There was at least one case, AFAIR, where we broke ABI because of a security issue. I also think that breaking ABI on unused interfaces can be fine too. We don't support ABI compatibility with FreeBSD 1, no matter how close we are, and we had this discussion in the past. I'm also in opinion that even if one day we run out of spare fields in kinfo_* structures the FreeBSD project should not be terminated. Ok, let's be more constructive. I can use existing spare ints. This would move the problem into the future and will break ABI for existing 10-RCs. We can also investigate how huge breakage that is. The sysctl interface is not public API, so I don't believe we should be concerned by its direct consumers. We have two public interfaces for this: libutil's kinfo_getfile(3) which has exactly one in-base consumer - libprocstat, so this change breaks procstat(1) and fstat(1). > This is just awful breakage of _ABI_. We cannot leave it as is, > unless we also claim that project gave up on ABI stability at all. [...] > My own opinion is that the kinfo change must be removed, and the bug > is so critical that another RC must be issued. I personally don't consider it so awful and critical as you do, clearly, but I do recognize it as a problem. I'm happy to consume spares, which should fix compatibility with older releases at the cost of breaking compatibility with 10-RCs. At least for i386 and amd64, not sure how using ints for uint64_t will work for other archs. I'll leave it for re@ to decide. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --ZGiS0Q5IWpPtfppv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iEYEARECAAYFAlLF2d0ACgkQForvXbEpPzQ3MACffU+tglMuwUlYYXTCgOY8ZYRy tHoAn1ogw9rJLDgvfNDNJ5fgFqpjWhMZ =5Qhj -----END PGP SIGNATURE----- --ZGiS0Q5IWpPtfppv-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:27:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D28E8B7; Thu, 2 Jan 2014 21:27:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 56B8F14D6; Thu, 2 Jan 2014 21:27:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02LR2eR096866; Thu, 2 Jan 2014 21:27:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02LQxL4096840; Thu, 2 Jan 2014 21:26:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201401022126.s02LQxL4096840@svn.freebsd.org> From: John Baldwin Date: Thu, 2 Jan 2014 21:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260206 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:27:02 -0000 Author: jhb Date: Thu Jan 2 21:26:59 2014 New Revision: 260206 URL: http://svnweb.freebsd.org/changeset/base/260206 Log: Rework the DSDT generation code a bit to generate more accurate info about LPC devices. Among other things, the LPC serial ports now appear as ACPI devices. - Move the info for the top-level PCI bus into the PCI emulation code and add ResourceProducer entries for the memory ranges decoded by the bus for memory BARs. - Add a framework to allow each PCI emulation driver to optionally write an entry into the DSDT under the \_SB_.PCI0 namespace. The LPC driver uses this to write a node for the LPC bus (\_SB_.PCI0.ISA). - Add a linker set to allow any LPC devices to write entries into the DSDT below the LPC node. - Move the existing DSDT block for the RTC to the RTC driver. - Add DSDT nodes for the AT PIC, the 8254 ISA timer, and the LPC UART devices. - Add a "SuperIO" device under the LPC node to claim "system resources" aling with a linker set to allow various drivers to add IO or memory ranges that should be claimed as a system resource. - Add system resource entries for the extended RTC IO range, the registers used for ACPI power management, the ELCR, PCI interrupt routing register, and post data register. - Add various helper routines for generating DSDT entries. Reviewed by: neel (earlier version) Modified: head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/acpi.h head/usr.sbin/bhyve/atpic.c head/usr.sbin/bhyve/elcr.c head/usr.sbin/bhyve/pci_emul.c head/usr.sbin/bhyve/pci_emul.h head/usr.sbin/bhyve/pci_lpc.c head/usr.sbin/bhyve/pci_lpc.h head/usr.sbin/bhyve/pit_8254.c head/usr.sbin/bhyve/pm.c head/usr.sbin/bhyve/post.c head/usr.sbin/bhyve/rtc.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/acpi.c Thu Jan 2 21:26:59 2014 (r260206) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -67,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include "bhyverun.h" #include "acpi.h" +#include "pci_emul.h" /* * Define the base address of the ACPI tables, and the offsets to @@ -98,6 +100,13 @@ static uint32_t hpet_capabilities; static char basl_template[MAXPATHLEN]; static char basl_stemplate[MAXPATHLEN]; +/* + * State for dsdt_line(), dsdt_indent(), and dsdt_unindent(). + */ +static FILE *dsdt_fp; +static int dsdt_indent_level; +static int dsdt_error; + struct basl_fio { int fd; FILE *fp; @@ -606,119 +615,122 @@ err_exit: return (errno); } +/* + * Helper routines for writing to the DSDT from other modules. + */ +void +dsdt_line(const char *fmt, ...) +{ + va_list ap; + int err; + + if (dsdt_error != 0) + return; + + if (strcmp(fmt, "") != 0) { + if (dsdt_indent_level != 0) + EFPRINTF(dsdt_fp, "%*c", dsdt_indent_level * 2, ' '); + va_start(ap, fmt); + if (vfprintf(dsdt_fp, fmt, ap) < 0) + goto err_exit; + va_end(ap); + } + EFPRINTF(dsdt_fp, "\n"); + return; + +err_exit: + dsdt_error = errno; +} + +void +dsdt_indent(int levels) +{ + + dsdt_indent_level += levels; + assert(dsdt_indent_level >= 0); +} + +void +dsdt_unindent(int levels) +{ + + assert(dsdt_indent_level >= levels); + dsdt_indent_level -= levels; +} + +void +dsdt_fixed_ioport(uint16_t iobase, uint16_t length) +{ + + dsdt_line("IO (Decode16,"); + dsdt_line(" 0x%04X, // Range Minimum", iobase); + dsdt_line(" 0x%04X, // Range Maximum", iobase); + dsdt_line(" 0x01, // Alignment"); + dsdt_line(" 0x%02X, // Length", length); + dsdt_line(" )"); +} + +void +dsdt_fixed_irq(uint8_t irq) +{ + + dsdt_line("IRQNoFlags ()"); + dsdt_line(" {%d}", irq); +} + +void +dsdt_fixed_mem32(uint32_t base, uint32_t length) +{ + + dsdt_line("Memory32Fixed (ReadWrite,"); + dsdt_line(" 0x%08X, // Address Base", base); + dsdt_line(" 0x%08X, // Address Length", length); + dsdt_line(" )"); +} + static int basl_fwrite_dsdt(FILE *fp) { int err; err = 0; + dsdt_fp = fp; + dsdt_error = 0; + dsdt_indent_level = 0; + + dsdt_line("/*"); + dsdt_line(" * bhyve DSDT template"); + dsdt_line(" */"); + dsdt_line("DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2," + "\"BHYVE \", \"BVDSDT \", 0x00000001)"); + dsdt_line("{"); + dsdt_line(" Name (_S5, Package (0x02)"); + dsdt_line(" {"); + dsdt_line(" 0x05,"); + dsdt_line(" Zero,"); + dsdt_line(" })"); + + pci_write_dsdt(); + + dsdt_line(""); + dsdt_line(" Scope (_SB.PCI0)"); + dsdt_line(" {"); + dsdt_line(" Device (HPET)"); + dsdt_line(" {"); + dsdt_line(" Name (_HID, EISAID(\"PNP0103\"))"); + dsdt_line(" Name (_UID, 0)"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(4); + dsdt_fixed_mem32(0xFED00000, 0x400); + dsdt_unindent(4); + dsdt_line(" })"); + dsdt_line(" }"); + dsdt_line(" }"); + dsdt_line("}"); - EFPRINTF(fp, "/*\n"); - EFPRINTF(fp, " * bhyve DSDT template\n"); - EFPRINTF(fp, " */\n"); - EFPRINTF(fp, "DefinitionBlock (\"bhyve_dsdt.aml\", \"DSDT\", 2," - "\"BHYVE \", \"BVDSDT \", 0x00000001)\n"); - EFPRINTF(fp, "{\n"); - EFPRINTF(fp, " Name (_S5, Package (0x02)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " 0x05,\n"); - EFPRINTF(fp, " Zero,\n"); - EFPRINTF(fp, " })\n"); - EFPRINTF(fp, " Scope (_SB)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Device (PCI0)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Name (_HID, EisaId (\"PNP0A03\"))\n"); - EFPRINTF(fp, " Name (_ADR, Zero)\n"); - EFPRINTF(fp, " Name (_UID, One)\n"); - EFPRINTF(fp, " Name (_CRS, ResourceTemplate ()\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " WordBusNumber (ResourceProducer, MinFixed," - "MaxFixed, PosDecode,\n"); - EFPRINTF(fp, " 0x0000, // Granularity\n"); - EFPRINTF(fp, " 0x0000, // Range Minimum\n"); - EFPRINTF(fp, " 0x00FF, // Range Maximum\n"); - EFPRINTF(fp, " 0x0000, // Transl Offset\n"); - EFPRINTF(fp, " 0x0100, // Length\n"); - EFPRINTF(fp, " ,, )\n"); - EFPRINTF(fp, " IO (Decode16,\n"); - EFPRINTF(fp, " 0x0CF8, // Range Minimum\n"); - EFPRINTF(fp, " 0x0CF8, // Range Maximum\n"); - EFPRINTF(fp, " 0x01, // Alignment\n"); - EFPRINTF(fp, " 0x08, // Length\n"); - EFPRINTF(fp, " )\n"); - EFPRINTF(fp, " WordIO (ResourceProducer, MinFixed, MaxFixed," - "PosDecode, EntireRange,\n"); - EFPRINTF(fp, " 0x0000, // Granularity\n"); - EFPRINTF(fp, " 0x0000, // Range Minimum\n"); - EFPRINTF(fp, " 0x0CF7, // Range Maximum\n"); - EFPRINTF(fp, " 0x0000, // Transl Offset\n"); - EFPRINTF(fp, " 0x0CF8, // Length\n"); - EFPRINTF(fp, " ,, , TypeStatic)\n"); - EFPRINTF(fp, " WordIO (ResourceProducer, MinFixed, MaxFixed," - "PosDecode, EntireRange,\n"); - EFPRINTF(fp, " 0x0000, // Granularity\n"); - EFPRINTF(fp, " 0x0D00, // Range Minimum\n"); - EFPRINTF(fp, " 0xFFFF, // Range Maximum\n"); - EFPRINTF(fp, " 0x0000, // Transl Offset\n"); - EFPRINTF(fp, " 0xF300, // Length\n"); - EFPRINTF(fp, " ,, , TypeStatic)\n"); - EFPRINTF(fp, " })\n"); - EFPRINTF(fp, " }\n"); - EFPRINTF(fp, " }\n"); - EFPRINTF(fp, "\n"); - EFPRINTF(fp, " Scope (_SB.PCI0)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Device (ISA)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Name (_ADR, 0x00010000)\n"); - EFPRINTF(fp, " OperationRegion (P40C, PCI_Config, 0x60, 0x04)\n"); - EFPRINTF(fp, " }\n"); - - EFPRINTF(fp, " Device (HPET)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Name (_HID, EISAID(\"PNP0103\"))\n"); - EFPRINTF(fp, " Name (_UID, 0)\n"); - EFPRINTF(fp, " Name (_CRS, ResourceTemplate ()\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " DWordMemory (ResourceConsumer, PosDecode, " - "MinFixed, MaxFixed, NonCacheable, ReadWrite,\n"); - EFPRINTF(fp, " 0x00000000,\n"); - EFPRINTF(fp, " 0xFED00000,\n"); - EFPRINTF(fp, " 0xFED003FF,\n"); - EFPRINTF(fp, " 0x00000000,\n"); - EFPRINTF(fp, " 0x00000400\n"); - EFPRINTF(fp, " )\n"); - EFPRINTF(fp, " })\n"); - EFPRINTF(fp, " }\n"); - - EFPRINTF(fp, " }\n"); - EFPRINTF(fp, "\n"); - EFPRINTF(fp, " Scope (_SB.PCI0.ISA)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Device (RTC)\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " Name (_HID, EisaId (\"PNP0B00\"))\n"); - EFPRINTF(fp, " Name (_CRS, ResourceTemplate ()\n"); - EFPRINTF(fp, " {\n"); - EFPRINTF(fp, " IO (Decode16,\n"); - EFPRINTF(fp, " 0x0070, // Range Minimum\n"); - EFPRINTF(fp, " 0x0070, // Range Maximum\n"); - EFPRINTF(fp, " 0x10, // Alignment\n"); - EFPRINTF(fp, " 0x02, // Length\n"); - EFPRINTF(fp, " )\n"); - EFPRINTF(fp, " IRQNoFlags ()\n"); - EFPRINTF(fp, " {8}\n"); - EFPRINTF(fp, " IO (Decode16,\n"); - EFPRINTF(fp, " 0x0072, // Range Minimum\n"); - EFPRINTF(fp, " 0x0072, // Range Maximum\n"); - EFPRINTF(fp, " 0x02, // Alignment\n"); - EFPRINTF(fp, " 0x06, // Length\n"); - EFPRINTF(fp, " )\n"); - EFPRINTF(fp, " })\n"); - EFPRINTF(fp, " }\n"); - EFPRINTF(fp, " }\n"); - EFPRINTF(fp, "}\n"); + if (dsdt_error != 0) + return (dsdt_error); EFFLUSH(fp); Modified: head/usr.sbin/bhyve/acpi.h ============================================================================== --- head/usr.sbin/bhyve/acpi.h Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/acpi.h Thu Jan 2 21:26:59 2014 (r260206) @@ -43,5 +43,11 @@ struct vmctx; int acpi_build(struct vmctx *ctx, int ncpu); +void dsdt_line(const char *fmt, ...); +void dsdt_fixed_ioport(uint16_t iobase, uint16_t length); +void dsdt_fixed_irq(uint8_t irq); +void dsdt_fixed_mem32(uint32_t base, uint32_t length); +void dsdt_indent(int levels); +void dsdt_unindent(int levels); #endif /* _ACPI_H_ */ Modified: head/usr.sbin/bhyve/atpic.c ============================================================================== --- head/usr.sbin/bhyve/atpic.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/atpic.c Thu Jan 2 21:26:59 2014 (r260206) @@ -35,7 +35,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include "acpi.h" #include "inout.h" +#include "pci_lpc.h" #define IO_ICU1 0x20 #define IO_ICU2 0xA0 @@ -65,3 +67,23 @@ INOUT_PORT(atpic, IO_ICU1, IOPORT_F_INOU INOUT_PORT(atpic, IO_ICU1 + ICU_IMR_OFFSET, IOPORT_F_INOUT, atpic_handler); INOUT_PORT(atpic, IO_ICU2, IOPORT_F_INOUT, atpic_handler); INOUT_PORT(atpic, IO_ICU2 + ICU_IMR_OFFSET, IOPORT_F_INOUT, atpic_handler); + +static void +atpic_dsdt(void) +{ + + dsdt_line(""); + dsdt_line("Device (PIC)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0000\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(IO_ICU1, 2); + dsdt_fixed_ioport(IO_ICU2, 2); + dsdt_fixed_irq(2); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); +} +LPC_DSDT(atpic_dsdt); Modified: head/usr.sbin/bhyve/elcr.c ============================================================================== --- head/usr.sbin/bhyve/elcr.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/elcr.c Thu Jan 2 21:26:59 2014 (r260206) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include "inout.h" +#include "pci_lpc.h" /* * EISA interrupt Level Control Register. @@ -63,3 +64,4 @@ elcr_handler(struct vmctx *ctx, int vcpu } INOUT_PORT(elcr, ELCR_PORT + 0, IOPORT_F_INOUT, elcr_handler); INOUT_PORT(elcr, ELCR_PORT + 1, IOPORT_F_INOUT, elcr_handler); +SYSRES_IO(ELCR_PORT, 2); Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pci_emul.c Thu Jan 2 21:26:59 2014 (r260206) @@ -44,11 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include "acpi.h" #include "bhyverun.h" #include "inout.h" #include "legacy_irq.h" #include "mem.h" #include "pci_emul.h" +#include "pci_lpc.h" #define CONF1_ADDR_PORT 0x0cf8 #define CONF1_DATA_PORT 0x0cfc @@ -93,6 +95,7 @@ static uint64_t pci_emul_membase64; static struct pci_devemu *pci_emul_finddev(char *name); static int pci_emul_devices; +static struct mem_range pci_mem_hole; /* * I/O access @@ -997,7 +1000,6 @@ pci_emul_fallback_handler(struct vmctx * int init_pci(struct vmctx *ctx) { - struct mem_range memp; struct pci_devemu *pde; struct slotinfo *si; size_t lowmem; @@ -1035,19 +1037,100 @@ init_pci(struct vmctx *ctx) error = vm_get_memory_seg(ctx, 0, &lowmem, NULL); assert(error == 0); - memset(&memp, 0, sizeof(struct mem_range)); - memp.name = "PCI hole"; - memp.flags = MEM_F_RW; - memp.base = lowmem; - memp.size = (4ULL * 1024 * 1024 * 1024) - lowmem; - memp.handler = pci_emul_fallback_handler; + memset(&pci_mem_hole, 0, sizeof(struct mem_range)); + pci_mem_hole.name = "PCI hole"; + pci_mem_hole.flags = MEM_F_RW; + pci_mem_hole.base = lowmem; + pci_mem_hole.size = (4ULL * 1024 * 1024 * 1024) - lowmem; + pci_mem_hole.handler = pci_emul_fallback_handler; - error = register_mem_fallback(&memp); + error = register_mem_fallback(&pci_mem_hole); assert(error == 0); return (0); } +void +pci_write_dsdt(void) +{ + struct pci_devinst *pi; + int slot, func; + + dsdt_indent(1); + dsdt_line("Scope (_SB)"); + dsdt_line("{"); + dsdt_line(" Device (PCI0)"); + dsdt_line(" {"); + dsdt_line(" Name (_HID, EisaId (\"PNP0A03\"))"); + dsdt_line(" Name (_ADR, Zero)"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_line(" WordBusNumber (ResourceProducer, MinFixed, " + "MaxFixed, PosDecode,"); + dsdt_line(" 0x0000, // Granularity"); + dsdt_line(" 0x0000, // Range Minimum"); + dsdt_line(" 0x00FF, // Range Maximum"); + dsdt_line(" 0x0000, // Translation Offset"); + dsdt_line(" 0x0100, // Length"); + dsdt_line(" ,, )"); + dsdt_indent(3); + dsdt_fixed_ioport(0xCF8, 8); + dsdt_unindent(3); + dsdt_line(" WordIO (ResourceProducer, MinFixed, MaxFixed, " + "PosDecode, EntireRange,"); + dsdt_line(" 0x0000, // Granularity"); + dsdt_line(" 0x0000, // Range Minimum"); + dsdt_line(" 0x0CF7, // Range Maximum"); + dsdt_line(" 0x0000, // Translation Offset"); + dsdt_line(" 0x0CF8, // Length"); + dsdt_line(" ,, , TypeStatic)"); + dsdt_line(" WordIO (ResourceProducer, MinFixed, MaxFixed, " + "PosDecode, EntireRange,"); + dsdt_line(" 0x0000, // Granularity"); + dsdt_line(" 0x0D00, // Range Minimum"); + dsdt_line(" 0xFFFF, // Range Maximum"); + dsdt_line(" 0x0000, // Translation Offset"); + dsdt_line(" 0xF300, // Length"); + dsdt_line(" ,, , TypeStatic)"); + dsdt_line(" DWordMemory (ResourceProducer, PosDecode, " + "MinFixed, MaxFixed, NonCacheable, ReadWrite,"); + dsdt_line(" 0x00000000, // Granularity"); + dsdt_line(" 0x%08lX, // Range Minimum\n", + pci_mem_hole.base); + dsdt_line(" 0x%08X, // Range Maximum\n", + PCI_EMUL_MEMLIMIT32 - 1); + dsdt_line(" 0x00000000, // Translation Offset"); + dsdt_line(" 0x%08lX, // Length\n", + PCI_EMUL_MEMLIMIT32 - pci_mem_hole.base); + dsdt_line(" ,, , AddressRangeMemory, TypeStatic)"); + dsdt_line(" QWordMemory (ResourceProducer, PosDecode, " + "MinFixed, MaxFixed, NonCacheable, ReadWrite,"); + dsdt_line(" 0x0000000000000000, // Granularity"); + dsdt_line(" 0x%016lX, // Range Minimum\n", + PCI_EMUL_MEMBASE64); + dsdt_line(" 0x%016lX, // Range Maximum\n", + PCI_EMUL_MEMLIMIT64 - 1); + dsdt_line(" 0x0000000000000000, // Translation Offset"); + dsdt_line(" 0x%016lX, // Length\n", + PCI_EMUL_MEMLIMIT64 - PCI_EMUL_MEMBASE64); + dsdt_line(" ,, , AddressRangeMemory, TypeStatic)"); + dsdt_line(" })"); + + dsdt_indent(2); + for (slot = 0; slot < MAXSLOTS; slot++) { + for (func = 0; func < MAXFUNCS; func++) { + pi = pci_slotinfo[slot][func].si_devi; + if (pi != NULL && pi->pi_d->pe_write_dsdt != NULL) + pi->pi_d->pe_write_dsdt(pi); + } + } + dsdt_unindent(2); + + dsdt_line(" }"); + dsdt_line("}"); + dsdt_unindent(1); +} + int pci_msi_enabled(struct pci_devinst *pi) { @@ -1433,6 +1516,7 @@ pci_irq_port_handler(struct vmctx *ctx, } INOUT_PORT(pci_irq, 0xC00, IOPORT_F_OUT, pci_irq_port_handler); INOUT_PORT(pci_irq, 0xC01, IOPORT_F_OUT, pci_irq_port_handler); +SYSRES_IO(0xC00, 2); #define PCI_EMUL_TEST #ifdef PCI_EMUL_TEST Modified: head/usr.sbin/bhyve/pci_emul.h ============================================================================== --- head/usr.sbin/bhyve/pci_emul.h Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pci_emul.h Thu Jan 2 21:26:59 2014 (r260206) @@ -51,6 +51,9 @@ struct pci_devemu { int (*pe_init)(struct vmctx *, struct pci_devinst *, char *opts); + /* ACPI DSDT enumeration */ + void (*pe_write_dsdt)(struct pci_devinst *); + /* config space read/write callbacks */ int (*pe_cfgwrite)(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int offset, @@ -213,6 +216,7 @@ int pci_emul_add_msixcap(struct pci_devi int pci_emul_msix_twrite(struct pci_devinst *pi, uint64_t offset, int size, uint64_t value); uint64_t pci_emul_msix_tread(struct pci_devinst *pi, uint64_t offset, int size); +void pci_write_dsdt(void); static __inline void pci_set_cfgdata8(struct pci_devinst *pi, int offset, uint8_t val) Modified: head/usr.sbin/bhyve/pci_lpc.c ============================================================================== --- head/usr.sbin/bhyve/pci_lpc.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pci_lpc.c Thu Jan 2 21:26:59 2014 (r260206) @@ -40,10 +40,15 @@ __FBSDID("$FreeBSD$"); #include +#include "acpi.h" #include "inout.h" #include "pci_emul.h" +#include "pci_lpc.h" #include "uart_emul.h" +SET_DECLARE(lpc_dsdt_set, struct lpc_dsdt); +SET_DECLARE(lpc_sysres_set, struct lpc_sysres); + static struct pci_devinst *lpc_bridge; #define LPC_UART_NUM 2 @@ -52,6 +57,7 @@ static struct lpc_uart_softc { const char *opts; int iobase; int irq; + int enabled; } lpc_uart_softc[LPC_UART_NUM]; static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2" }; @@ -164,12 +170,92 @@ lpc_init(void) error = register_inout(&iop); assert(error == 0); + sc->enabled = 1; } return (0); } static void +pci_lpc_write_dsdt(struct pci_devinst *pi) +{ + struct lpc_dsdt **ldpp, *ldp; + + dsdt_line(""); + dsdt_line("Device (ISA)"); + dsdt_line("{"); + dsdt_line(" Name (_ADR, 0x%04X%04X)", pi->pi_slot, pi->pi_func); + dsdt_line(" OperationRegion (P40C, PCI_Config, 0x60, 0x04)"); + + dsdt_indent(1); + SET_FOREACH(ldpp, lpc_dsdt_set) { + ldp = *ldpp; + ldp->handler(); + } + dsdt_unindent(1); + + dsdt_line("}"); +} + +static void +pci_lpc_sysres_dsdt(void) +{ + struct lpc_sysres **lspp, *lsp; + + dsdt_line(""); + dsdt_line("Device (SIO)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0C02\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + + dsdt_indent(2); + SET_FOREACH(lspp, lpc_sysres_set) { + lsp = *lspp; + switch (lsp->type) { + case LPC_SYSRES_IO: + dsdt_fixed_ioport(lsp->base, lsp->length); + break; + case LPC_SYSRES_MEM: + dsdt_fixed_mem32(lsp->base, lsp->length); + break; + } + } + dsdt_unindent(2); + + dsdt_line(" })"); + dsdt_line("}"); +} +LPC_DSDT(pci_lpc_sysres_dsdt); + +static void +pci_lpc_uart_dsdt(void) +{ + struct lpc_uart_softc *sc; + int unit; + + for (unit = 0; unit < LPC_UART_NUM; unit++) { + sc = &lpc_uart_softc[unit]; + if (!sc->enabled) + continue; + dsdt_line(""); + dsdt_line("Device (%s)", lpc_uart_names[unit]); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0501\"))"); + dsdt_line(" Name (_UID, %d)", unit + 1); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(sc->iobase, UART_IO_BAR_SIZE); + dsdt_fixed_irq(sc->irq); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); + } +} +LPC_DSDT(pci_lpc_uart_dsdt); + +static void pci_lpc_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { @@ -211,6 +297,7 @@ pci_lpc_init(struct vmctx *ctx, struct p struct pci_devemu pci_de_lpc = { .pe_emu = "lpc", .pe_init = pci_lpc_init, + .pe_write_dsdt = pci_lpc_write_dsdt, .pe_barwrite = pci_lpc_write, .pe_barread = pci_lpc_read }; Modified: head/usr.sbin/bhyve/pci_lpc.h ============================================================================== --- head/usr.sbin/bhyve/pci_lpc.h Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pci_lpc.h Thu Jan 2 21:26:59 2014 (r260206) @@ -29,6 +29,42 @@ #ifndef _LPC_H_ #define _LPC_H_ +#include + +typedef void (*lpc_write_dsdt_t)(void); + +struct lpc_dsdt { + lpc_write_dsdt_t handler; +}; + +#define LPC_DSDT(handler) \ + static struct lpc_dsdt __CONCAT(__lpc_dsdt, __LINE__) = { \ + (handler), \ + }; \ + DATA_SET(lpc_dsdt_set, __CONCAT(__lpc_dsdt, __LINE__)) + +enum lpc_sysres_type { + LPC_SYSRES_IO, + LPC_SYSRES_MEM +}; + +struct lpc_sysres { + enum lpc_sysres_type type; + uint32_t base; + uint32_t length; +}; + +#define LPC_SYSRES(type, base, length) \ + static struct lpc_sysres __CONCAT(__lpc_sysres, __LINE__) = { \ + (type), \ + (base), \ + (length) \ + }; \ + DATA_SET(lpc_sysres_set, __CONCAT(__lpc_sysres, __LINE__)) + +#define SYSRES_IO(base, length) LPC_SYSRES(LPC_SYSRES_IO, base, length) +#define SYSRES_MEM(base, length) LPC_SYSRES(LPC_SYSRES_MEM, base, length) + int lpc_device_parse(const char *opt); #endif Modified: head/usr.sbin/bhyve/pit_8254.c ============================================================================== --- head/usr.sbin/bhyve/pit_8254.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pit_8254.c Thu Jan 2 21:26:59 2014 (r260206) @@ -42,9 +42,11 @@ __FBSDID("$FreeBSD$"); #include +#include "acpi.h" #include "bhyverun.h" #include "inout.h" #include "mevent.h" +#include "pci_lpc.h" #include "pit_8254.h" #define TIMER_SEL_MASK 0xc0 @@ -268,3 +270,22 @@ INOUT_PORT(8254, TIMER_MODE, IOPORT_F_OU INOUT_PORT(8254, TIMER_CNTR0, IOPORT_F_INOUT, pit_8254_handler); INOUT_PORT(8254, TIMER_CNTR1, IOPORT_F_INOUT, pit_8254_handler); INOUT_PORT(8254, TIMER_CNTR2, IOPORT_F_INOUT, pit_8254_handler); + +static void +pit_dsdt(void) +{ + + dsdt_line(""); + dsdt_line("Device (TIMR)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0100\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(IO_TIMER1, 4); + dsdt_fixed_irq(0); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); +} +LPC_DSDT(pit_dsdt); Modified: head/usr.sbin/bhyve/pm.c ============================================================================== --- head/usr.sbin/bhyve/pm.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/pm.c Thu Jan 2 21:26:59 2014 (r260206) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "inout.h" #include "mevent.h" +#include "pci_lpc.h" static pthread_mutex_t pm_lock = PTHREAD_MUTEX_INITIALIZER; static struct mevent *power_button; @@ -248,6 +249,7 @@ pm1_control_handler(struct vmctx *ctx, i return (0); } INOUT_PORT(pm1_control, PM1A_CNT_ADDR, IOPORT_F_INOUT, pm1_control_handler); +SYSRES_IO(PM1A_EVT_ADDR, 8); /* * ACPI SMI Command Register @@ -286,3 +288,4 @@ smi_cmd_handler(struct vmctx *ctx, int v return (0); } INOUT_PORT(smi_cmd, SMI_CMD, IOPORT_F_OUT, smi_cmd_handler); +SYSRES_IO(SMI_CMD, 1); Modified: head/usr.sbin/bhyve/post.c ============================================================================== --- head/usr.sbin/bhyve/post.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/post.c Thu Jan 2 21:26:59 2014 (r260206) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include "inout.h" +#include "pci_lpc.h" static int post_data_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, @@ -49,3 +50,4 @@ post_data_handler(struct vmctx *ctx, int } INOUT_PORT(post, 0x84, IOPORT_F_IN, post_data_handler); +SYSRES_IO(0x84, 1); Modified: head/usr.sbin/bhyve/rtc.c ============================================================================== --- head/usr.sbin/bhyve/rtc.c Thu Jan 2 18:50:52 2014 (r260205) +++ head/usr.sbin/bhyve/rtc.c Thu Jan 2 21:26:59 2014 (r260206) @@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include "acpi.h" #include "inout.h" +#include "pci_lpc.h" #include "rtc.h" #define IO_RTC 0x70 @@ -358,3 +360,24 @@ rtc_init(struct vmctx *ctx) INOUT_PORT(rtc, IO_RTC, IOPORT_F_INOUT, rtc_addr_handler); INOUT_PORT(rtc, IO_RTC + 1, IOPORT_F_INOUT, rtc_data_handler); + +static void +rtc_dsdt(void) +{ + + dsdt_line(""); + dsdt_line("Device (RTC)"); + dsdt_line("{"); + dsdt_line(" Name (_HID, EisaId (\"PNP0B00\"))"); + dsdt_line(" Name (_CRS, ResourceTemplate ()"); + dsdt_line(" {"); + dsdt_indent(2); + dsdt_fixed_ioport(IO_RTC, 2); + dsdt_fixed_irq(8); + dsdt_unindent(2); + dsdt_line(" })"); + dsdt_line("}"); +} +LPC_DSDT(rtc_dsdt); + +SYSRES_IO(0x72, 6); From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:27:10 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A2575999; Thu, 2 Jan 2014 21:27:10 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 43C6D14DA; Thu, 2 Jan 2014 21:27:10 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s02LR0SS028992; Thu, 2 Jan 2014 23:27:00 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s02LR0SS028992 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s02LR0pO028991; Thu, 2 Jan 2014 23:27:00 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 2 Jan 2014 23:27:00 +0200 From: Konstantin Belousov To: John-Mark Gurney Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102212700.GO59496@kib.kiev.ua> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> <20140102192612.GM59496@kib.kiev.ua> <20140102195935.GC99167@funkthat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XzkEUK0ZpyGWSJtg" Content-Disposition: inline In-Reply-To: <20140102195935.GC99167@funkthat.com> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , svn-src-all@FreeBSD.org, Alfred Perlstein , Stanislav Sedov , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:27:10 -0000 --XzkEUK0ZpyGWSJtg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 11:59:35AM -0800, John-Mark Gurney wrote: > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 21:26 +020= 0: > > On Thu, Jan 02, 2014 at 11:14:20AM -0800, John-Mark Gurney wrote: > > > Konstantin Belousov wrote this message on Thu, Jan 02, 2014 at 15:13 = +0200: > > > > > > Afaik you could just remove the "spare" and steal 2 or 4 entrie= s from=20 > > > > > > _kf_ispare until it is sorted. > > > > >=20 > > > > > Yes, this would work for current cap_rights_t structure, at least= for > > > > > i386 and amd64, but would only allow to expand the structure by o= ne > > > > > uint64_t in the future (which might or might not be enough). The > > > > > cap_rights_t structure is designed to be expanded to 5 uint64_ts = without > > > > > breaking ABI. I don't want to stuck with current cap_rights_t tha= t is > > > > > designed to expand, but cannot be, because kinfo_file wasn't modi= fied at > > > > > the start of a major branch. > > > > The ABI stability is not limited to the single branch. It must be > > > > preserved across whole project lifetime. > > >=20 > > > Umm. when did this policy change happen? I thought ABI compatibility > > > was limited to major releases of FreeBSD? How are you suppose to do > > > any work if you can't break ABI ever? > > Policy did not changed. Breaking ABI was never allowed, except for the > > kernel management interfaces. Later was only accepted due to tight > > relation of the typical management facilities and internal kernel > > structures, but this is considered a bug. >=20 > Please do no use such absolutes, since the ABI has been allowed to break > in the recent past, as I'm looking at a commit in 2005 that broke struct > kproc_info size... 'Allowed' is wrong term. Correct term is 'bug'. ABI bugs are special because we cannot fix them, due to impact lasting forever in the infected binaries. For kernel panic, you update kernel; for interface breakage, you have no exit strategy, either old or new binaries are broken. >=20 > > > I did a quick search for "freebsd policy abi breakage" and found some > > > mailing list posts about this, but no authoritative statement... > > Re tried to write down the policy, last time it was several years ago. > > The efforts should be revived. > >=20 > > >=20 > > > Of course the problem is that when we move to > > > (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility t= oo, > > > or introduce tons of compatibility code that will rot... > >=20 > > I do not understand what are you trying to say. >=20 > My point is that once we move to the "new ABI", we will either have to > accept that we stop maintaining the old interface, or we write and > maintain the old interface, but if we do, what's the point of going to > the new interface if the old interface "never" breaks? Point of providing the old interface is to allow old binaries to still work, or degrade in controlled and safe way. --XzkEUK0ZpyGWSJtg Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxdmjAAoJEJDCuSvBvK1BfJAP/3M9cXvADEhpMGdVJeNnoyU5 CHhkkLCRl3oVzIGI/3+Ch3m53DUMBEbCzYfygwVBim83Bzgz3HT5r/J9s7iLKAfC 1yyXZNUyWPo2HOYRXepDPgVLgqd3p1fPg59OTGxwqnOX0kYMzfIzjySOpXWj86X6 L/MHY3wHUNk0h5VzrUnGbt6ODL/eda9JDlaYgHUwMgxEBDfhsPnCRhiozXKd1THd GwmZMLTijZVV9UohDb1KVlsS9oBkDYqbNdewLDAALq9PUiNWmDYfbxQOww86nizo FY/4IyOgPbzInf/9aSiDyhgzTjfiXtYGMPuqvlNtBWmy3//4dK7szZ3pdSkzhyw/ FGvQAor+ns3B9TqRjOIHkmkLBVtECbANrYrkyHWmjnIx7J1rvtFqiGGMP8zTn09C XjxKIG+wsBIPwAgip8nNdglnYLEYaHwbF+3ALkY3nCHntlP9TOmwE6yzvEQPX1w+ /IgJ8aYMllJ2p1ssPuZH+ch/6RbmXoDOcE0hs/bM5Wl6gUNLtMNz300Pj5ZRxjfp zcKlXLZdIASp+TyviUjK+xwBLDnECyzmScrT1En3++nPgVIqhoC6wlrLgnf8axrx 4uwnd1eti7TtLfrgVNNm709QbonDC/zfNnjm7XF5lVQGnSDuuwpYfsUJyY3m3B81 mJxSd8U5bAWlV3LcgdoQ =wd9m -----END PGP SIGNATURE----- --XzkEUK0ZpyGWSJtg-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:30:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E88EEC0; Thu, 2 Jan 2014 21:30: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 894931529; Thu, 2 Jan 2014 21:30: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 s02LUxNL099686; Thu, 2 Jan 2014 21:30:59 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02LUxD5099685; Thu, 2 Jan 2014 21:30:59 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201401022130.s02LUxD5099685@svn.freebsd.org> From: "George V. Neville-Neil" Date: Thu, 2 Jan 2014 21:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260207 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:30:59 -0000 Author: gnn Date: Thu Jan 2 21:30:59 2014 New Revision: 260207 URL: http://svnweb.freebsd.org/changeset/base/260207 Log: Convert #defines to enums so that the values are visible in the debugger. Requested by: gibbs MFC after: 2 weeks Modified: head/sys/net/sff8472.h Modified: head/sys/net/sff8472.h ============================================================================== --- head/sys/net/sff8472.h Thu Jan 2 21:26:59 2014 (r260206) +++ head/sys/net/sff8472.h Thu Jan 2 21:30:59 2014 (r260207) @@ -62,104 +62,107 @@ /* Table 3.1 Two-wire interface ID: Data Fields */ -#define SFF_8472_BASE 0xa0 /* Base address for all our queries. */ -#define SFF_8472_ID 0 /* Transceiver Type (Table 3.2) */ -#define SFF_8472_EXT_ID 1 /* Extended transceiver type (Table 3.3) */ -#define SFF_8472_CONNECTOR 2 /* Connector type (Table 3.4) */ -#define SFF_8472_TRANS_START 3 /* Elec or Optical Compatibility +enum { + SFF_8472_BASE = 0xa0, /* Base address for all our queries. */ + SFF_8472_ID = 0, /* Transceiver Type (Table 3.2) */ + SFF_8472_EXT_ID = 1, /* Extended transceiver type (Table 3.3) */ + SFF_8472_CONNECTOR = 2, /* Connector type (Table 3.4) */ + SFF_8472_TRANS_START = 3, /* Elec or Optical Compatibility * (Table 3.5) */ -#define SFF_8472_TRANS_END 10 -#define SFF_8472_ENCODING 11 /* Encoding Code for high speed - * serial encoding algorithm (see - * Table 3.6) */ -#define SFF_8472_BITRATE 12 /* Nominal signaling rate, units - * of 100MBd. (see details for - * rates > 25.0Gb/s) */ -#define SFF_8472_RATEID 13 /* Type of rate select - * functionality (see Table - * 3.6a) */ -#define SFF_8472_LEN_SMF_KM 14 /* Link length supported for single + SFF_8472_TRANS_END = 10, + SFF_8472_ENCODING = 11, /* Encoding Code for high speed + * serial encoding algorithm (see + * Table 3.6) */ + SFF_8472_BITRATE = 12, /* Nominal signaling rate, units + * of 100MBd. (see details for + * rates > 25.0Gb/s) */ + SFF_8472_RATEID = 13, /* Type of rate select + * functionality (see Table + * 3.6a) */ + SFF_8472_LEN_SMF_KM = 14, /* Link length supported for single * mode fiber, units of km */ -#define SFF_8472_LEN_SMF 15 /* Link length supported for single + SFF_8472_LEN_SMF = 15, /* Link length supported for single * mode fiber, units of 100 m */ -#define SFF_8472_LEN_50UM 16 /* Link length supported for 50 um + SFF_8472_LEN_50UM = 16, /* Link length supported for 50 um * OM2 fiber, units of 10 m */ -#define SFF_8472_LEN_625UM 17 /* Link length supported for 62.5 + SFF_8472_LEN_625UM = 17, /* Link length supported for 62.5 * um OM1 fiber, units of 10 m */ -#define SFF_8472_LEN_OM4 18 /* Link length supported for 50um + SFF_8472_LEN_OM4 = 18, /* Link length supported for 50um * OM4 fiber, units of 10m. * Alternatively copper or direct * attach cable, units of m */ -#define SFF_8472_LEN_OM3 19 /* Link length supported for 50 um OM3 fiber, units of 10 m */ -#define SFF_8472_VENDOR_START 20 /* Vendor name [Address A0h, Bytes + SFF_8472_LEN_OM3 = 19, /* Link length supported for 50 um OM3 fiber, units of 10 m */ + SFF_8472_VENDOR_START = 20, /* Vendor name [Address A0h, Bytes * 20-35] */ -#define SFF_8472_VENDOR_END 35 -#define SFF_8472_TRANS 36 /* Transceiver Code for electronic + SFF_8472_VENDOR_END = 35, + SFF_8472_TRANS = 36, /* Transceiver Code for electronic * or optical compatibility (see * Table 3.5) */ -#define SFF_8472_VENDOR_OUI_START 37 /* Vendor OUI SFP vendor IEEE + SFF_8472_VENDOR_OUI_START = 37, /* Vendor OUI SFP vendor IEEE * company ID */ -#define SFF_8472_VENDOR_OUI_END 39 -#define SFF_8472_PN_START 40 /* Vendor PN */ -#define SFF_8472_PN_END 55 -#define SFF_8472_REV_START 56 /* Vendor Revision */ -#define SFF_8472_REV_END 59 -#define SFF_8472_WAVELEN_START 60 /* Wavelength Laser wavelength + SFF_8472_VENDOR_OUI_END = 39, + SFF_8472_PN_START = 40, /* Vendor PN */ + SFF_8472_PN_END = 55, + SFF_8472_REV_START = 56, /* Vendor Revision */ + SFF_8472_REV_END = 59, + SFF_8472_WAVELEN_START = 60, /* Wavelength Laser wavelength * (Passive/Active Cable * Specification Compliance) */ -#define SFF_8472_WAVELEN_END 61 -#define SFF_8472_CC_BASE 63 /* CC_BASE Check code for Base ID + SFF_8472_WAVELEN_END = 61, + SFF_8472_CC_BASE = 63, /* CC_BASE Check code for Base ID * Fields (addresses 0 to 62) */ /* * Extension Fields (optional) check the options before reading other * addresses. */ -#define SFF_8472_OPTIONS_MSB 64 /* Options Indicates which optional + SFF_8472_OPTIONS_MSB = 64, /* Options Indicates which optional * transceiver signals are * implemented */ -#define SFF_8472_OPTIONS_LSB 65 /* (see Table 3.7) */ -#define SFF_8472_BR_MAX 66 /* BR max Upper bit rate margin, + SFF_8472_OPTIONS_LSB = 65, /* (see Table 3.7) */ + SFF_8472_BR_MAX = 66, /* BR max Upper bit rate margin, * units of % (see details for * rates > 25.0Gb/s) */ -#define SFF_8472_BR_MIN 67 /* Lower bit rate margin, units of + SFF_8472_BR_MIN = 67, /* Lower bit rate margin, units of * % (see details for rates > * 25.0Gb/s) */ -#define SFF_8472_SN_START 68 /* Vendor SN [Address A0h, Bytes 68-83] */ -#define SFF_8472_SN_END 83 -#define SFF_8472_DATE_START 84 /* Date code Vendor’s manufacturing + SFF_8472_SN_START = 68, /* Vendor SN [Address A0h, Bytes 68-83] */ + SFF_8472_SN_END = 83, + SFF_8472_DATE_START = 84, /* Date code Vendor’s manufacturing * date code (see Table 3.8) */ -#define SFF_8472_DATE_END 91 -#define SFF_8472_DIAG_TYPE 92 /* Diagnostic Monitoring Type + SFF_8472_DATE_END = 91, + SFF_8472_DIAG_TYPE = 92, /* Diagnostic Monitoring Type * Indicates which type of * diagnostic monitoring is * implemented (if any) in the * transceiver (see Table 3.9) */ -#define SFF_8472_DIAG_IMPL (1 << 6) /* Required to be 1 */ -#define SFF_8472_DIAG_INTERNAL (1 << 5) /* Internal measurements. */ -#define SFF_8472_DIAG_EXTERNAL (1 << 4) /* External measurements. */ -#define SFF_8472_DIAG_POWER (1 << 3) /* Power measurement type */ -#define SFF_8472_DIAG_ADDR_CHG (1 << 2) /* Address change required. - * See SFF-8472 doc. */ -#define SFF_8472_ENHANCED 93 /* Enhanced Options Indicates which + SFF_8472_ENHANCED = 93, /* Enhanced Options Indicates which * optional enhanced features are * implemented (if any) in the * transceiver (see Table 3.10) */ -#define SFF_8472_COMPLIANCE 94 /* SFF-8472 Compliance Indicates + SFF_8472_COMPLIANCE = 94, /* SFF-8472 Compliance Indicates * which revision of SFF-8472 the * transceiver complies with. (see * Table 3.12)*/ -#define SFF_8472_CC_EXT 95 /* Check code for the Extended ID + SFF_8472_CC_EXT = 95, /* Check code for the Extended ID * Fields (addresses 64 to 94) */ -#define SFF_8472_VENDOR_RSRVD_START 96 -#define SFF_8472_VENDOR_RSRVD_END 127 + SFF_8472_VENDOR_RSRVD_START = 96, + SFF_8472_VENDOR_RSRVD_END = 127, -#define SFF_8472_RESERVED_START 128 -#define SFF_8472_RESERVED_END 255 + SFF_8472_RESERVED_START = 128, + SFF_8472_RESERVED_END = 255 +}; + +#define SFF_8472_DIAG_IMPL (1 << 6) /* Required to be 1 */ +#define SFF_8472_DIAG_INTERNAL (1 << 5) /* Internal measurements. */ +#define SFF_8472_DIAG_EXTERNAL (1 << 4) /* External measurements. */ +#define SFF_8472_DIAG_POWER (1 << 3) /* Power measurement type */ +#define SFF_8472_DIAG_ADDR_CHG (1 << 2) /* Address change required. + * See SFF-8472 doc. */ /* * Diagnostics are available at the two wire address 0xa2. All @@ -167,77 +170,78 @@ * see which, if any are supported. */ -#define SFF_8472_DIAG 0xa2 /* Base address for diagnostics. */ +enum {SFF_8472_DIAG = 0xa2}; /* Base address for diagnostics. */ /* * Table 3.15 Alarm and Warning Thresholds All values are 2 bytes * and MUST be read in a single read operation starting at the MSB */ -#define SFF_8472_TEMP_HIGH_ALM 0 /* Temp High Alarm */ -#define SFF_8472_TEMP_LOW_ALM 2 /* Temp Low Alarm */ -#define SFF_8472_TEMP_HIGH_WARN 4 /* Temp High Warning */ -#define SFF_8472_TEMP_LOW_WARN 6 /* Temp Low Warning */ -#define SFF_8472_VOLTAGE_HIGH_ALM 8 /* Voltage High Alarm */ -#define SFF_8472_VOLTAGE_LOW_ALM 10 /* Voltage Low Alarm */ -#define SFF_8472_VOLTAGE_HIGH_WARN 12 /* Voltage High Warning */ -#define SFF_8472_VOLTAGE_LOW_WARN 14 /* Voltage Low Warning */ -#define SFF_8472_BIAS_HIGH_ALM 16 /* Bias High Alarm */ -#define SFF_8472_BIAS_LOW_ALM 18 /* Bias Low Alarm */ -#define SFF_8472_BIAS_HIGH_WARN 20 /* Bias High Warning */ -#define SFF_8472_BIAS_LOW_WARN 22 /* Bias Low Warning */ -#define SFF_8472_TX_POWER_HIGH_ALM 24 /* TX Power High Alarm */ -#define SFF_8472_TX_POWER_LOW_ALM 26 /* TX Power Low Alarm */ -#define SFF_8472_TX_POWER_HIGH_WARN 28 /* TX Power High Warning */ -#define SFF_8472_TX_POWER_LOW_WARN 30 /* TX Power Low Warning */ -#define SFF_8472_RX_POWER_HIGH_ALM 32 /* RX Power High Alarm */ -#define SFF_8472_RX_POWER_LOW_ALM 34 /* RX Power Low Alarm */ -#define SFF_8472_RX_POWER_HIGH_WARN 36 /* RX Power High Warning */ -#define SFF_8472_RX_POWER_LOW_WARN 38 /* RX Power Low Warning */ +enum { + SFF_8472_TEMP_HIGH_ALM = 0, /* Temp High Alarm */ + SFF_8472_TEMP_LOW_ALM = 2, /* Temp Low Alarm */ + SFF_8472_TEMP_HIGH_WARN = 4, /* Temp High Warning */ + SFF_8472_TEMP_LOW_WARN = 6, /* Temp Low Warning */ + SFF_8472_VOLTAGE_HIGH_ALM = 8, /* Voltage High Alarm */ + SFF_8472_VOLTAGE_LOW_ALM = 10, /* Voltage Low Alarm */ + SFF_8472_VOLTAGE_HIGH_WARN = 12, /* Voltage High Warning */ + SFF_8472_VOLTAGE_LOW_WARN = 14, /* Voltage Low Warning */ + SFF_8472_BIAS_HIGH_ALM = 16, /* Bias High Alarm */ + SFF_8472_BIAS_LOW_ALM = 18, /* Bias Low Alarm */ + SFF_8472_BIAS_HIGH_WARN = 20, /* Bias High Warning */ + SFF_8472_BIAS_LOW_WARN = 22, /* Bias Low Warning */ + SFF_8472_TX_POWER_HIGH_ALM = 24, /* TX Power High Alarm */ + SFF_8472_TX_POWER_LOW_ALM = 26, /* TX Power Low Alarm */ + SFF_8472_TX_POWER_HIGH_WARN = 28, /* TX Power High Warning */ + SFF_8472_TX_POWER_LOW_WARN = 30, /* TX Power Low Warning */ + SFF_8472_RX_POWER_HIGH_ALM = 32, /* RX Power High Alarm */ + SFF_8472_RX_POWER_LOW_ALM = 34, /* RX Power Low Alarm */ + SFF_8472_RX_POWER_HIGH_WARN = 36, /* RX Power High Warning */ + SFF_8472_RX_POWER_LOW_WARN = 38, /* RX Power Low Warning */ -#define SFF_8472_RX_POWER4 56 /* Rx_PWR(4) Single precision + SFF_8472_RX_POWER4 = 56, /* Rx_PWR(4) Single precision * floating point calibration data * - Rx optical power. Bit 7 of * byte 56 is MSB. Bit 0 of byte * 59 is LSB. Rx_PWR(4) should be * set to zero for “internally * calibrated” devices. */ -#define SFF_8472_RX_POWER3 60 /* Rx_PWR(3) Single precision + SFF_8472_RX_POWER3 = 60, /* Rx_PWR(3) Single precision * floating point calibration data * - Rx optical power. Bit 7 of * byte 60 is MSB. Bit 0 of byte 63 * is LSB. Rx_PWR(3) should be set * to zero for “internally * calibrated” devices.*/ -#define SFF_8472_RX_POWER2 64 /* Rx_PWR(2) Single precision + SFF_8472_RX_POWER2 = 64, /* Rx_PWR(2) Single precision * floating point calibration data, * Rx optical power. Bit 7 of byte * 64 is MSB, bit 0 of byte 67 is * LSB. Rx_PWR(2) should be set to * zero for “internally calibrated” * devices. */ -#define SFF_8472_RX_POWER1 68 /* Rx_PWR(1) Single precision + SFF_8472_RX_POWER1 = 68, /* Rx_PWR(1) Single precision * floating point calibration data, * Rx optical power. Bit 7 of byte * 68 is MSB, bit 0 of byte 71 is * LSB. Rx_PWR(1) should be set to * 1 for “internally calibrated” * devices. */ -#define SFF_8472_RX_POWER0 72 /* Rx_PWR(0) Single precision + SFF_8472_RX_POWER0 = 72, /* Rx_PWR(0) Single precision * floating point calibration data, * Rx optical power. Bit 7 of byte * 72 is MSB, bit 0 of byte 75 is * LSB. Rx_PWR(0) should be set to * zero for “internally calibrated” * devices. */ -#define SFF_8472_TX_I_SLOPE 76 /* Tx_I(Slope) Fixed decimal + SFF_8472_TX_I_SLOPE = 76, /* Tx_I(Slope) Fixed decimal * (unsigned) calibration data, * laser bias current. Bit 7 of * byte 76 is MSB, bit 0 of byte 77 * is LSB. Tx_I(Slope) should be * set to 1 for “internally * calibrated” devices. */ -#define SFF_8472_TX_I_OFFSET 78 /* Tx_I(Offset) Fixed decimal + SFF_8472_TX_I_OFFSET = 78, /* Tx_I(Offset) Fixed decimal * (signed two’s complement) * calibration data, laser bias * current. Bit 7 of byte 78 is @@ -245,7 +249,7 @@ * LSB. Tx_I(Offset) should be set * to zero for “internally * calibrated” devices. */ -#define SFF_8472_TX_POWER_SLOPE 80 /* Tx_PWR(Slope) Fixed decimal + SFF_8472_TX_POWER_SLOPE = 80, /* Tx_PWR(Slope) Fixed decimal * (unsigned) calibration data, * transmitter coupled output * power. Bit 7 of byte 80 is MSB, @@ -253,22 +257,22 @@ * Tx_PWR(Slope) should be set to 1 * for “internally calibrated” * devices. */ -#define SFF_8472_TX_POWER_OFFSET 82 /* Tx_PWR(Offset) Fixed decimal - * (signed two’s complement) - * calibration data, transmitter - * coupled output power. Bit 7 of - * byte 82 is MSB, bit 0 of byte 83 - * is LSB. Tx_PWR(Offset) should be - * set to zero for “internally - * calibrated” devices. */ -#define SFF_8472_T_SLOPE 84 /* T (Slope) Fixed decimal + SFF_8472_TX_POWER_OFFSET = 82, /* Tx_PWR(Offset) Fixed decimal + * (signed two’s complement) + * calibration data, transmitter + * coupled output power. Bit 7 of + * byte 82 is MSB, bit 0 of byte 83 + * is LSB. Tx_PWR(Offset) should be + * set to zero for “internally + * calibrated” devices. */ + SFF_8472_T_SLOPE = 84, /* T (Slope) Fixed decimal * (unsigned) calibration data, * internal module temperature. Bit * 7 of byte 84 is MSB, bit 0 of * byte 85 is LSB. T(Slope) should * be set to 1 for “internally * calibrated” devices. */ -#define SFF_8472_T_OFFSET 86 /* T (Offset) Fixed decimal (signed + SFF_8472_T_OFFSET = 86, /* T (Offset) Fixed decimal (signed * two’s complement) calibration * data, internal module * temperature. Bit 7 of byte 86 is @@ -276,7 +280,7 @@ * T(Offset) should be set to zero * for “internally calibrated” * devices. */ -#define SFF_8472_V_SLOPE 88 /* V (Slope) Fixed decimal + SFF_8472_V_SLOPE = 88, /* V (Slope) Fixed decimal * (unsigned) calibration data, * internal module supply * voltage. Bit 7 of byte 88 is @@ -284,7 +288,7 @@ * LSB. V(Slope) should be set to 1 * for “internally calibrated” * devices. */ -#define SFF_8472_V_OFFSET 90 /* V (Offset) Fixed decimal (signed + SFF_8472_V_OFFSET = 90, /* V (Offset) Fixed decimal (signed * two’s complement) calibration * data, internal module supply * voltage. Bit 7 of byte 90 is @@ -292,21 +296,21 @@ * LSB. V(Offset) should be set to * zero for “internally calibrated” * devices. */ -#define SFF_8472_CHECKSUM 95 /* Checksum Byte 95 contains the + SFF_8472_CHECKSUM = 95, /* Checksum Byte 95 contains the * low order 8 bits of the sum of * bytes 0 – 94. */ - /* Internal measurements. */ + /* Internal measurements. */ -#define SFF_8472_TEMP 96 /* Internally measured module temperature. */ -#define SFF_8472_VCC 98 /* Internally measured supply + SFF_8472_TEMP = 96, /* Internally measured module temperature. */ + SFF_8472_VCC = 98, /* Internally measured supply * voltage in transceiver. */ -#define SFF_8472_TX_BIAS 100 /* Internally measured TX Bias Current. */ -#define SFF_8472_TX_POWER 102 /* Measured TX output power. */ -#define SFF_8472_RX_POWER 104 /* Measured RX input power. */ - -#define SFF_8472_STATUS 110 /* See below */ + SFF_8472_TX_BIAS = 100, /* Internally measured TX Bias Current. */ + SFF_8472_TX_POWER = 102, /* Measured TX output power. */ + SFF_8472_RX_POWER = 104, /* Measured RX input power. */ + SFF_8472_STATUS = 110 /* See below */ +}; /* Status Bits Described */ /* @@ -372,20 +376,22 @@ #define SFF_8472_STATUS_DATA_READY (1 << 0) /* Table 3.2 Identifier values */ -#define SFF_8472_ID_UNKNOWN 0x0 /* Unknown or unspecified */ -#define SFF_8472_ID_GBIC 0x1 /* GBIC */ -#define SFF_8472_ID_SFF 0x2 /* Module soldered to motherboard (ex: SFF)*/ -#define SFF_8472_ID_SFP 0x3 /* SFP or SFP “Plus” */ -#define SFF_8472_ID_XBI 0x4 /* Reserved for “300 pin XBI” devices */ -#define SFF_8472_ID_XENPAK 0x5 /* Reserved for “Xenpak” devices */ -#define SFF_8472_ID_XFP 0x6 /* Reserved for “XFP” devices */ -#define SFF_8472_ID_XFF 0x7 /* Reserved for “XFF” devices */ -#define SFF_8472_ID_XFPE 0x8 /* Reserved for “XFP-E” devices */ -#define SFF_8472_ID_XPAK 0x9 /* Reserved for “XPak” devices */ -#define SFF_8472_ID_X2 0xA /* Reserved for “X2” devices */ -#define SFF_8472_ID_DWDM_SFP 0xB /* Reserved for “DWDM-SFP” devices */ -#define SFF_8472_ID_QSFP 0xC /* Reserved for “QSFP” devices */ -#define SFF_8472_ID_LAST SFF_8472_ID_QSFP +enum { + SFF_8472_ID_UNKNOWN = 0x0, /* Unknown or unspecified */ + SFF_8472_ID_GBIC = 0x1, /* GBIC */ + SFF_8472_ID_SFF = 0x2, /* Module soldered to motherboard (ex: SFF)*/ + SFF_8472_ID_SFP = 0x3, /* SFP or SFP “Plus” */ + SFF_8472_ID_XBI = 0x4, /* Reserved for “300 pin XBI” devices */ + SFF_8472_ID_XENPAK = 0x5, /* Reserved for “Xenpak” devices */ + SFF_8472_ID_XFP = 0x6, /* Reserved for “XFP” devices */ + SFF_8472_ID_XFF = 0x7, /* Reserved for “XFF” devices */ + SFF_8472_ID_XFPE = 0x8, /* Reserved for “XFP-E” devices */ + SFF_8472_ID_XPAK = 0x9, /* Reserved for “XPak” devices */ + SFF_8472_ID_X2 = 0xA, /* Reserved for “X2” devices */ + SFF_8472_ID_DWDM_SFP = 0xB, /* Reserved for “DWDM-SFP” devices */ + SFF_8472_ID_QSFP = 0xC, /* Reserved for “QSFP” devices */ + SFF_8472_ID_LAST = SFF_8472_ID_QSFP + }; static char *sff_8472_id[SFF_8472_ID_LAST + 1] = {"Unknown", "GBIC", From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 21:45:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33DA7402; Thu, 2 Jan 2014 21:45:36 +0000 (UTC) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id E5EC11672; Thu, 2 Jan 2014 21:45:35 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 1E14D48E; Thu, 2 Jan 2014 22:38:41 +0100 (CET) Date: Thu, 2 Jan 2014 22:46:29 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102214629.GB1672@garage.freebsd.pl> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102212757.GA1672@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PmA2V3Z32TCmWXqI" Content-Disposition: inline In-Reply-To: <20140102212757.GA1672@garage.freebsd.pl> X-OS: FreeBSD 11.0-CURRENT amd64 User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 21:45:36 -0000 --PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 10:27:57PM +0100, Pawel Jakub Dawidek wrote: > I'll leave it for re@ to decide. Proposed patch: http://people.freebsd.org/~pjd/patches/sys_user.h.patch --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://mobter.com --PmA2V3Z32TCmWXqI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iEYEARECAAYFAlLF3jUACgkQForvXbEpPzQ2jwCfVA6cGi9tfxSRInrzgEFzZufo xcsAnRtT08a/mCQuvDsVjwBXa+MIZARb =E7er -----END PGP SIGNATURE----- --PmA2V3Z32TCmWXqI-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 22:12:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53C5ED44; Thu, 2 Jan 2014 22:12:17 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE88718BD; Thu, 2 Jan 2014 22:12:16 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s02MC7YR038202; Fri, 3 Jan 2014 00:12:07 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s02MC7YR038202 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s02MC72G038201; Fri, 3 Jan 2014 00:12:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 3 Jan 2014 00:12:06 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... Message-ID: <20140102221206.GP59496@kib.kiev.ua> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102212757.GA1672@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PMP0sWB+rH9GPACK" Content-Disposition: inline In-Reply-To: <20140102212757.GA1672@garage.freebsd.pl> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 22:12:17 -0000 --PMP0sWB+rH9GPACK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 10:27:58PM +0100, Pawel Jakub Dawidek wrote: > On Thu, Jan 02, 2014 at 03:13:08PM +0200, Konstantin Belousov wrote: > > On Thu, Jan 02, 2014 at 11:49:04AM +0100, Pawel Jakub Dawidek wrote: > > > I don't plan to provide alternative way to fetch the cap stuff. Well,= I > > > implemented libnv, which can be used to reimplement how we fetch all > > > data like kinfo_file in a ABI friendly way, but I don't plan to modify > > > this specific code myself. > > I.e. you break something and decline to fix it, putting the burden on > > somebody else. >=20 > That's a bit too far. I wasn't declining fixing a bug I introduced. > I was declining implementing an improvement. That's two very different > things. Chose your words more carefully and not only this time. I read this as decline to fix the ABI breakage. I am sorry. >=20 > > > Yes, this would work for current cap_rights_t structure, at least for > > > i386 and amd64, but would only allow to expand the structure by one > > > uint64_t in the future (which might or might not be enough). The > > > cap_rights_t structure is designed to be expanded to 5 uint64_ts with= out > > > breaking ABI. I don't want to stuck with current cap_rights_t that is > > > designed to expand, but cannot be, because kinfo_file wasn't modified= at > > > the start of a major branch. > > The ABI stability is not limited to the single branch. It must be > > preserved across whole project lifetime. > [...] >=20 > To address your statement that either entire ABI is stable or not and > there is nothing in between. That's of course incorrect. >=20 > First of all, we, as a project, don't consider all existing interfaces > as stable. This would be a suicide. There are plenty of private > interfaces we must and we do break from release to release. Yes. >=20 > There was at least one case, AFAIR, where we broke ABI because of a > security issue. >=20 > I also think that breaking ABI on unused interfaces can be fine too. Probably yes. >=20 > We don't support ABI compatibility with FreeBSD 1, no matter how close > we are, and we had this discussion in the past. Yes, backward compatibility is a practical feature, and as each practical thing, it has its usefulness limits. But, for active interfaces, it is a binary state, and kinfo_file definitely falls into the active and recent interfaces pool. >=20 > I'm also in opinion that even if one day we run out of spare fields in > kinfo_* structures the FreeBSD project should not be terminated. Sure, we provide the backward compat when we are unable to extend the current interface. This is routinely done with syscalls and sysctls. See kinfo_ofile as the relevant example. John also wrote about this. >=20 > Ok, let's be more constructive. >=20 > I can use existing spare ints. This would move the problem into the > future and will break ABI for existing 10-RCs. >=20 > We can also investigate how huge breakage that is. The sysctl interface > is not public API, so I don't believe we should be concerned by its > direct consumers. We have two public interfaces for this: >=20 > libutil's kinfo_getfile(3) which has exactly one in-base consumer - > libprocstat, so this change breaks procstat(1) and fstat(1). It started from the report of valgrind breakage AFAIR. >=20 > > This is just awful breakage of _ABI_. We cannot leave it as is, > > unless we also claim that project gave up on ABI stability at all. > [...] > > My own opinion is that the kinfo change must be removed, and the bug > > is so critical that another RC must be issued. >=20 > I personally don't consider it so awful and critical as you do, clearly, > but I do recognize it as a problem. I'm happy to consume spares, which > should fix compatibility with older releases at the cost of breaking > compatibility with 10-RCs. At least for i386 and amd64, not sure how > using ints for uint64_t will work for other archs. At the moment, only x86 is considered Tier-1, which we guarantee to have stable ABI. From the inspection of the patch referenced in the followup message, I think that other architectures should be fine too, but I did not verified this. >=20 > I'll leave it for re@ to decide. My opinion is that the patch should go into HEAD with the 3-day MFC track to stable/10. Then, it is up to re to decide indeed, my vote already is to allow this for releng/10.0 and to have RC5, unfortunately. --PMP0sWB+rH9GPACK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxeQ2AAoJEJDCuSvBvK1BQ9UQAJaHp0v/vuB9x7G5FiZQvIAY CJj9aAMgjBWPQJ998o7oP2pq9cek/C0+mmnq+it0KEfISA6nsDC7xyg48IolxeCH 4OxvBbqtRxOHKQT5LWemIqXYOZHbFKABfAi4qzU0ThILA/rFrdxLCCNGB9UDAsmi X8pwAfPnyzvbFVymR2uODbJ/wkHc/nlZfLjUHNdG9JNr6RWzZNM3oV5gEI1NS1AN VyF4eVVfbSpLdEhzXXMzLpoa2gHycqNWeTOUsoAYJEMEIHJsWR0ucsABnwrBaiF6 bmhaRXCnX4iZr50mj8U9vMtbCCPKAygX+cy/d9CoM2LGNzk3zCEpG1wsZ+coJdGb dBju0zRjkqnWXVD0FQc2J4Ft/yT8zLsF/vfaVZz/Nyw0evYfPaD0x4HchWqj/qqm hiRy3fhs74tOLe/JQcFqYrIs2RlAG6CR3R2PlvPxMJoY+oqscvw0+AG4n8Lk1XrW iP8zlSayViVmlMJQNVl6wPpDbxKG9SLbbtSksobDrXZE3ZMZY/umgvykqOD8/l5J awjImsB91EypAWDdhg7viYjwmREkxPPqQR0LUswPm1kG5mhUcDc5vplNW++dGhzH 7H5zaY2D4lLawaJBM8chO5FPYm6VdjGf0UA40cpjF/ihzB4+hZmqW6ZsA76boNpN wjs8OCczIt5dgZzJDtW6 =hT/b -----END PGP SIGNATURE----- --PMP0sWB+rH9GPACK-- From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 23:12:25 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 790439E1; Thu, 2 Jan 2014 23:12:25 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (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 26B401DD4; Thu, 2 Jan 2014 23:12:24 +0000 (UTC) Received: from [192.168.1.73] (254C510A.nat.pool.telekom.hu [37.76.81.10]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.7) with ESMTP id s02NCFvQ019057 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 2 Jan 2014 15:12:18 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <52C5F249.8080802@freebsd.org> Date: Fri, 03 Jan 2014 00:12:09 +0100 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Konstantin Belousov , Alfred Perlstein Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102191420.GB99167@funkthat.com> <52C5BCCB.6070702@mu.org> <20140102193413.GN59496@kib.kiev.ua> In-Reply-To: <20140102193413.GN59496@kib.kiev.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, Pawel Jakub Dawidek , John-Mark Gurney , Stanislav Sedov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 23:12:25 -0000 On 1/2/14, 8:34 PM, Konstantin Belousov wrote: > On Thu, Jan 02, 2014 at 11:23:55AM -0800, Alfred Perlstein wrote: >> >> Of course the problem is that when we move to >> (ASN.1/libnv/ctf/YAML/JSON/XML/etc) we will break ABI compatibility too, >> or introduce tons of compatibility code that will rot... >> >> I agree, however there is a very easy way to fix it for the time being. >> Let's not be binary about it "well it's going to have to break, so let's >> break it!" when such an easy way to not break it exists. It should be >> "let's see if there's a non-intrusive way of not breaking it" and the >> answer to that seems to be "yes". > If parts of ABI is broken, then why spend efforts trying to keep other > parts stable ? You already have random set of binaries broken, sometimes > in subtle way. Then, making other interfaces stable is just a waste. > > ABI stability is a yes/no proposition, you cannot have it partly done. > Personally, I do not want to spend a time on hobbyist system. > > BTW, to point out obvious thing, Linux has almost perfect ABI stability > and forward compatibility. It is pity to see that our people do not > understand the importance and benefits of it. I always assume that there is a subset of programs that will not run in jails of different major releases, and that must be replaced by statically linked versions of the new ones.. these include ifconfig, netstat, ps, top and other similar programs. From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 23:17:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 54C24B4B; Thu, 2 Jan 2014 23:17:07 +0000 (UTC) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (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 1BDAE1DEC; Thu, 2 Jan 2014 23:17:06 +0000 (UTC) Received: from [192.168.1.73] (254C510A.nat.pool.telekom.hu [37.76.81.10]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.7) with ESMTP id s02NH1GE019081 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 2 Jan 2014 15:17:04 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <52C5F367.402@freebsd.org> Date: Fri, 03 Jan 2014 00:16:55 +0100 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek , Konstantin Belousov Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102212757.GA1672@garage.freebsd.pl> In-Reply-To: <20140102212757.GA1672@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Stanislav Sedov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 23:17:07 -0000 On 1/2/14, 10:27 PM, Pawel Jakub Dawidek wrote: > I also think that breaking ABI on unused interfaces can be fine too. > > We don't support ABI compatibility with FreeBSD 1, no matter how close > we are, and we had this discussion in the past. actually, we do.. I have run FreebSD 1 binaries as recently as a year ago. the get a "make world" to work you need a small kernel change. (limit PIDS to < 60000) or it hangs after a few minutes. From owner-svn-src-head@FreeBSD.ORG Thu Jan 2 23:23:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79CACDB3; Thu, 2 Jan 2014 23:23: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 4BC351E62; Thu, 2 Jan 2014 23:23:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02NNY8x041936; Thu, 2 Jan 2014 23:23:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02NNXrd041931; Thu, 2 Jan 2014 23:23:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201401022323.s02NNXrd041931@svn.freebsd.org> From: Adrian Chadd Date: Thu, 2 Jan 2014 23:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260210 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 23:23:34 -0000 Author: adrian Date: Thu Jan 2 23:23:33 2014 New Revision: 260210 URL: http://svnweb.freebsd.org/changeset/base/260210 Log: Add an option to enable or disable the small RX packet copying that is done to improve performance of small frames. When doing RX packing, the RX copying isn't necessarily required. Reviewed by: np Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Jan 2 23:17:48 2014 (r260209) +++ head/sys/dev/cxgbe/adapter.h Thu Jan 2 23:23:33 2014 (r260210) @@ -646,6 +646,8 @@ struct adapter { const char *last_op; const void *last_op_thr; #endif + + int sc_do_rxcopy; }; #define ADAPTER_LOCK(sc) mtx_lock(&(sc)->sc_lock) Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Jan 2 23:17:48 2014 (r260209) +++ head/sys/dev/cxgbe/t4_main.c Thu Jan 2 23:23:33 2014 (r260210) @@ -4239,6 +4239,10 @@ t4_sysctls(struct adapter *sc) oid = device_get_sysctl_tree(sc->dev); c0 = children = SYSCTL_CHILDREN(oid); + sc->sc_do_rxcopy = 1; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "do_rx_copy", CTLFLAG_RW, + &sc->sc_do_rxcopy, 1, "Do RX copy of small frames"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nports", CTLFLAG_RD, NULL, sc->params.nports, "# of ports"); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Jan 2 23:17:48 2014 (r260209) +++ head/sys/dev/cxgbe/t4_sge.c Thu Jan 2 23:23:33 2014 (r260210) @@ -1447,7 +1447,7 @@ get_fl_payload1(struct adapter *sc, stru bus_dmamap_sync(fl->tag[sd->tag_idx], sd->map, BUS_DMASYNC_POSTREAD); - if (len < RX_COPY_THRESHOLD) { + if (sc->sc_do_rxcopy && (len < RX_COPY_THRESHOLD)) { #ifdef T4_PKT_TIMESTAMP /* Leave room for a timestamp */ m0->m_data += 8; @@ -1598,7 +1598,7 @@ get_fl_payload2(struct adapter *sc, stru bus_dmamap_sync(fl->tag[sd->tag_idx], sd->map, BUS_DMASYNC_POSTREAD); - if (len < RX_COPY_THRESHOLD) { + if (sc->sc_do_rxcopy && (len < RX_COPY_THRESHOLD)) { #ifdef T4_PKT_TIMESTAMP /* Leave room for a timestamp */ m0->m_data += 8; From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 00:17:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D786DEDD; Fri, 3 Jan 2014 00:17:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C3CD51226; Fri, 3 Jan 2014 00:17:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s030HqPp062453; Fri, 3 Jan 2014 00:17:52 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s030HqLV062452; Fri, 3 Jan 2014 00:17:52 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401030017.s030HqLV062452@svn.freebsd.org> From: Warner Losh Date: Fri, 3 Jan 2014 00:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260212 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 00:17:52 -0000 Author: imp Date: Fri Jan 3 00:17:52 2014 New Revision: 260212 URL: http://svnweb.freebsd.org/changeset/base/260212 Log: The HOT-E HL201 has 128MB Samsung SLC NAND, ID it properly. Modified: head/sys/dev/nand/nand_id.c Modified: head/sys/dev/nand/nand_id.c ============================================================================== --- head/sys/dev/nand/nand_id.c Thu Jan 2 23:24:50 2014 (r260211) +++ head/sys/dev/nand/nand_id.c Fri Jan 3 00:17:52 2014 (r260212) @@ -41,6 +41,8 @@ struct nand_params nand_ids[] = { 0x200, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_SAMSUNG, 0xda }, "Samsung NAND 256MiB 3,3V 8-bit", 0x100, 0x800, 0x40, 0x40, 0 }, + { { NAND_MAN_SAMSUNG, 0xf1 }, "Samsung NAND 128MiB 3,3V 8-bit", + 0x80, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_HYNIX, 0x76 }, "Hynix NAND 64MiB 3,3V 8-bit", 0x40, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_HYNIX, 0xdc }, "Hynix NAND 512MiB 3,3V 8-bit", From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 00:26:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FD823D7; Fri, 3 Jan 2014 00:26:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5B2E212ED; Fri, 3 Jan 2014 00:26:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s030QvhD066137; Fri, 3 Jan 2014 00:26:57 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s030QvMX066136; Fri, 3 Jan 2014 00:26:57 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401030026.s030QvMX066136@svn.freebsd.org> From: Warner Losh Date: Fri, 3 Jan 2014 00:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260214 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 00:26:57 -0000 Author: imp Date: Fri Jan 3 00:26:56 2014 New Revision: 260214 URL: http://svnweb.freebsd.org/changeset/base/260214 Log: Fill in some more info about the (somewhat old) Samsung parts I have here... Modified: head/sys/dev/nand/nand_id.c Modified: head/sys/dev/nand/nand_id.c ============================================================================== --- head/sys/dev/nand/nand_id.c Fri Jan 3 00:18:38 2014 (r260213) +++ head/sys/dev/nand/nand_id.c Fri Jan 3 00:26:56 2014 (r260214) @@ -33,21 +33,21 @@ __FBSDID("$FreeBSD$"); #include struct nand_params nand_ids[] = { - { { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B", + { { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B NAND 32MiB 1-bit", 0x20, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_SAMSUNG, 0xd3 }, "Samsung NAND 1GiB 3,3V 8-bit", 0x400, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_SAMSUNG, 0xdc }, "Samsung NAND 512MiB 3,3V 8-bit", 0x200, 0x800, 0x40, 0x40, 0 }, - { { NAND_MAN_SAMSUNG, 0xda }, "Samsung NAND 256MiB 3,3V 8-bit", + { { NAND_MAN_SAMSUNG, 0xda }, "Samsung K9F2G08U0A NAND 256MiB 3,3V 8-bit", 0x100, 0x800, 0x40, 0x40, 0 }, - { { NAND_MAN_SAMSUNG, 0xf1 }, "Samsung NAND 128MiB 3,3V 8-bit", + { { NAND_MAN_SAMSUNG, 0xf1 }, "Samsung K9F1G08U0A NAND 128MiB 3,3V 8-bit", 0x80, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_HYNIX, 0x76 }, "Hynix NAND 64MiB 3,3V 8-bit", 0x40, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_HYNIX, 0xdc }, "Hynix NAND 512MiB 3,3V 8-bit", 0x200, 0x800, 0x40, 0x40, 0 }, - { { NAND_MAN_HYNIX, 0x79 }, "NAND 128MB 3,3V 8-bit", + { { NAND_MAN_HYNIX, 0x79 }, "Hynix NAND 128MB 3,3V 8-bit", 0x80, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_STMICRO, 0xf1 }, "STMicro 128MB 3,3V 8-bit", 0x80, 2048, 64, 0x40, 0 }, From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 02:32:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44F08DD1; Fri, 3 Jan 2014 02:32: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 313001B7B; Fri, 3 Jan 2014 02:32: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 s032W6c4017654; Fri, 3 Jan 2014 02:32:06 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s032W5dt017652; Fri, 3 Jan 2014 02:32:05 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401030232.s032W5dt017652@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 3 Jan 2014 02:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260217 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 02:32:06 -0000 Author: ae Date: Fri Jan 3 02:32:05 2014 New Revision: 260217 URL: http://svnweb.freebsd.org/changeset/base/260217 Log: Add IF_AFDATA_WLOCK_ASSERT() in case lla_lookup() is called with LLE_CREATE flag. MFC after: 1 week Modified: head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Jan 3 02:22:45 2014 (r260216) +++ head/sys/netinet/in.c Fri Jan 3 02:32:05 2014 (r260217) @@ -1127,6 +1127,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: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Fri Jan 3 02:22:45 2014 (r260216) +++ head/sys/netinet6/in6.c Fri Jan 3 02:32:05 2014 (r260217) @@ -2332,6 +2332,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, From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 02:40:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5ECF912D; Fri, 3 Jan 2014 02:40:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9261CAE; Fri, 3 Jan 2014 02:40:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s032evr2019444; Fri, 3 Jan 2014 02:40:57 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s032evgZ019443; Fri, 3 Jan 2014 02:40:57 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201401030240.s032evgZ019443@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 3 Jan 2014 02:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260218 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 02:40:57 -0000 Author: ae Date: Fri Jan 3 02:40:56 2014 New Revision: 260218 URL: http://svnweb.freebsd.org/changeset/base/260218 Log: Use pointer to struct sockaddr_in6 in lla_lookup() call. This prevents from triggering KASSERT in in6_lltable_lookup. Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Fri Jan 3 02:32:05 2014 (r260217) +++ head/sys/netinet6/in6_src.c Fri Jan 3 02:40:56 2014 (r260218) @@ -621,7 +621,7 @@ selectroute(struct sockaddr_in6 *dstsock rt = ron->ro_rt; ifp = rt->rt_ifp; IF_AFDATA_RLOCK(ifp); - la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)&sin6_next->sin6_addr); + la = lla_lookup(LLTABLE6(ifp), 0, (struct sockaddr *)sin6_next); IF_AFDATA_RUNLOCK(ifp); if (la != NULL) LLE_RUNLOCK(la); From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 05:55:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECC81D4A; Fri, 3 Jan 2014 05:55:09 +0000 (UTC) Received: from mx0.deglitch.com (unknown [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 9774F1A1D; Fri, 3 Jan 2014 05:55:09 +0000 (UTC) Received: from [192.168.1.61] (unknown [37.113.188.80]) by mx0.deglitch.com (Postfix) with ESMTPSA id A9EB78FC40; Fri, 3 Jan 2014 09:54:59 +0400 (MSK) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: svn commit: r255219 - in head: contrib/tcpdump lib/libc lib/libc/capability lib/libc/include lib/libc/sys lib/libprocstat sbin/dhclient sbin/hastd sys/amd64/linux32 sys/bsm sys/cddl/compat/opensola... From: Stanislav Sedov In-Reply-To: <20140102212757.GA1672@garage.freebsd.pl> Date: Thu, 2 Jan 2014 21:54:56 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <99767738-1AEB-481F-8096-DC3D914F80B0@freebsd.org> References: <201309050009.r8509vsE061271@svn.freebsd.org> <67DFFD7B-01DE-4862-BED3-DD42EB92A8F4@freebsd.org> <20140102093322.GA1655@garage.freebsd.pl> <52C53F69.3040507@mu.org> <20140102104904.GB1655@garage.freebsd.pl> <20140102131308.GI59496@kib.kiev.ua> <20140102212757.GA1672@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1827) Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 05:55:10 -0000 On Jan 2, 2014, at 1:27 PM, Pawel Jakub Dawidek wrote: > I personally don't consider it so awful and critical as you do, = clearly, > but I do recognize it as a problem. I'm happy to consume spares, which > should fix compatibility with older releases at the cost of breaking > compatibility with 10-RCs. At least for i386 and amd64, not sure how > using ints for uint64_t will work for other arches. Personally, I=92d prefer if we use spare fields for now. That will = allow us to maintain ABI stability for the current release, and have enough = time to implement the new, incompatible, interface in addition to the old one in HEAD. The interface is used a lot by 3rd party applications to = obtain the information about open file descriptors (in place of the Linux=92 = /proc interface), and this change will leave 9.x and before binaries broken in a subtle way on 10.x and beyond. Most of the commercial applications = are shipped compiled against 9.x or even 8.x and 7.x, and although the = extent of the damage is unknown, it might turn out to be a problem. To me, it seems that breaking the ABI with 10.x RC is less dangerous. -- ST4096-RIPE From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 06:01:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE83AFBB; Fri, 3 Jan 2014 06:01: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 B843A1A4A; Fri, 3 Jan 2014 06:01: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 s03616re097380; Fri, 3 Jan 2014 06:01:06 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03616sZ097375; Fri, 3 Jan 2014 06:01:06 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201401030601.s03616sZ097375@svn.freebsd.org> From: Kevin Lo Date: Fri, 3 Jan 2014 06:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260219 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 06:01:06 -0000 Author: kevlo Date: Fri Jan 3 06:01:05 2014 New Revision: 260219 URL: http://svnweb.freebsd.org/changeset/base/260219 Log: Add support for the MediaTek/Ralink RT3593 chipset. Committed over the ZyXEL NWD2705 on amd64 with WPA. Modified: head/share/man/man4/run.4 head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runreg.h head/sys/dev/usb/wlan/if_runvar.h Modified: head/share/man/man4/run.4 ============================================================================== --- head/share/man/man4/run.4 Fri Jan 3 02:40:56 2014 (r260218) +++ head/share/man/man4/run.4 Fri Jan 3 06:01:05 2014 (r260219) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2013 +.Dd January 3, 2014 .Dt RUN 4 .Os .Sh NAME @@ -64,8 +64,17 @@ The RT3000U is a single-chip solution ba an RT3020 (1T1R), RT3021 (1T2R) or RT3022 (2T2R) single-band radio transceiver. .Pp -The RT3900E is a single-chip solution based on an RT5390 MAC/BBP and -an RT5370 (1T1R) or RT5372 (2T2R) single-band radio transceiver. +The RT3900E is a single-chip USB 2.0 802.11n solution. +The MAC/Baseband Processor can be an RT3593, RT5390, RT5392 or an RT5592. +The radio can be an RT3053, RT5370, RT5372 or an RT5572. +The RT3053 chip operates in the 2GHz and 5GHz spectra and supports up to +3 transmit paths and 3 receiver paths (3T3R). +The RT5370 chip operates in the 2GHz spectrum and supports 1 transmit path +and 1 receiver path (1T1R). +The RT5372 chip operates in the 2GHz spectrum and supports up to 2 transmit +paths and 2 receiver paths (2T2R). +The RT5572 chip operates in the 2GHz and 5GHz spectra and supports up to +2 transmit paths and 2 receiver paths (2T2R). .Pp These are the modes the .Nm @@ -116,11 +125,13 @@ driver supports the following wireless a .It Airlink101 AWLL6090 .It ASUS USB-N11 .It ASUS USB-N13 ver. A1 +.It ASUS USB-N66 .It ASUS WL-160N .It Belkin F5D8051 ver 3000 .It Belkin F5D8053 .It Belkin F5D8055 .It Belkin F6D4050 ver 1 +.It Belkin F9L1103 .It Buffalo WLI-UC-AG300N .It Buffalo WLI-UC-G300N .It Buffalo WLI-UC-G301N @@ -134,11 +145,13 @@ driver supports the following wireless a .It D-Link DWA-130 rev B1 .It D-Link DWA-140 rev B1, B2, B3, D1 .It D-Link DWA-160 rev B2 +.It D-Link DWA-162 .It DrayTek Vigor N61 .It Edimax EW-7711UAn .It Edimax EW-7711UTn .It Edimax EW-7717Un .It Edimax EW-7718Un +.It Edimax EW-7733UnD .It Gigabyte GN-WB30N .It Gigabyte GN-WB31N .It Gigabyte GN-WB32L @@ -164,6 +177,7 @@ driver supports the following wireless a .It TP-LINK TL-WN727N v3 .It Unex DNUR-81 .It Unex DNUR-82 +.It ZyXEL NWD2705 .It ZyXEL NWD210N .It ZyXEL NWD270N .El @@ -235,4 +249,4 @@ driver was written by The .Nm driver does not support any of the 802.11n capabilities offered by the -RT2800 and RT3000 chipsets. +RT2800, RT3000 and RT3900 chipsets. Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Jan 3 02:40:56 2014 (r260218) +++ head/sys/dev/usb/usbdevs Fri Jan 3 06:01:05 2014 (r260219) @@ -1146,6 +1146,7 @@ product ASUS USBN13 0x1784 USB-N13 product ASUS RT3070_1 0x1790 RT3070 product ASUS USBN10 0x1786 USB-N10 product ASUS RTL8192CU 0x17ab RTL8192CU +product ASUS USBN66 0x17ad USB-N66 product ASUS RTL8192SU 0x1791 RTL8192SU product ASUS A730W 0x4202 ASUS MyPal A730W product ASUS P535 0x420f ASUS P535 PDA @@ -1245,6 +1246,7 @@ product BELKIN F5U409 0x0409 F5U409 Ser product BELKIN F6C550AVR 0x0551 F6C550-AVR UPS product BELKIN F5U120 0x1203 F5U120-PC Hub product BELKIN RTL8188CU 0x1102 RTL8188CU Wireless Adapter +product BELKIN F9L1103 0x1103 F9L1103 Wireless Adapter product BELKIN RTL8192CU 0x2102 RTL8192CU Wireless Adapter product BELKIN F7D2102 0x2103 F7D2102 Wireless Adapter product BELKIN ZD1211B 0x4050 ZD1211B @@ -1558,6 +1560,7 @@ product DLINK RT3072 0x3c0a RT3072 product DLINK DWA140B3 0x3c15 DWA-140 rev B3 product DLINK DWA160B2 0x3c1a DWA-160 rev B2 product DLINK DWA127 0x3c1b DWA-127 Wireless Adapter +product DLINK DWA162 0x3c1f DWA-162 Wireless Adapter product DLINK DWA140D1 0x3c20 DWA-140 rev D1 product DLINK DSB650C 0x4000 10Mbps Ethernet product DLINK DSB650TX1 0x4001 10/100 Ethernet @@ -1619,6 +1622,7 @@ product EDIMAX EW7622UMN 0x7622 EW-7622U product EDIMAX RT2870_1 0x7711 RT2870 product EDIMAX EW7717 0x7717 EW-7717 product EDIMAX EW7718 0x7718 EW-7718 +product EDIMAX EW7733UND 0x7733 EW-7733UnD product EDIMAX EW7811UN 0x7811 EW-7811Un product EDIMAX RTL8192CU 0x7822 RTL8192CU @@ -3608,6 +3612,7 @@ product RALINK RT3071 0x3071 RT3071 product RALINK RT3072 0x3072 RT3072 product RALINK RT3370 0x3370 RT3370 product RALINK RT3572 0x3572 RT3572 +product RALINK RT3573 0x3573 RT3573 product RALINK RT5370 0x5370 RT5370 product RALINK RT5572 0x5572 RT5572 product RALINK RT8070 0x8070 RT8070 @@ -3629,10 +3634,11 @@ product REALTEK RTL8171 0x8171 RTL8171 product REALTEK RTL8172 0x8172 RTL8172 product REALTEK RTL8173 0x8173 RTL8173 product REALTEK RTL8174 0x8174 RTL8174 -product REALTEK RTL8188CE_1 0x817e RTL8188CE -product REALTEK RTL8188CU_0 0x8176 RTL8188CU -product REALTEK RTL8188CU_1 0x817a RTL8188CU -product REALTEK RTL8188CU_2 0x817b RTL8188CU +product REALTEK RTL8188CU_0 0x8176 RTL8188CU +product REALTEK RTL8188EU 0x8179 RTL8188EU +product REALTEK RTL8188CE_1 0x817e RTL8188CE +product REALTEK RTL8188CU_1 0x817a RTL8188CU +product REALTEK RTL8188CU_2 0x817b RTL8188CU product REALTEK RTL8187 0x8187 RTL8187 Wireless Adapter product REALTEK RTL8187B_0 0x8189 RTL8187B Wireless Adapter product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Fri Jan 3 02:40:56 2014 (r260218) +++ head/sys/dev/usb/wlan/if_run.c Fri Jan 3 06:01:05 2014 (r260219) @@ -2,7 +2,7 @@ * Copyright (c) 2008,2010 Damien Bergamini * ported to FreeBSD by Akinori Furukoshi * USB Consulting, Hans Petter Selasky - * Copyright (c) 2013 Kevin Lo + * Copyright (c) 2013-2014 Kevin Lo * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -139,6 +139,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(ASUS, RT2870_5), RUN_DEV(ASUS, USBN13), RUN_DEV(ASUS, RT3070_1), + RUN_DEV(ASUS, USBN66), RUN_DEV(ASUS, USB_N53), RUN_DEV(ASUS2, USBN11), RUN_DEV(AZUREWAVE, RT2870_1), @@ -146,6 +147,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(AZUREWAVE, RT3070_1), RUN_DEV(AZUREWAVE, RT3070_2), RUN_DEV(AZUREWAVE, RT3070_3), + RUN_DEV(BELKIN, F9L1103), RUN_DEV(BELKIN, F5D8053V3), RUN_DEV(BELKIN, F5D8055), RUN_DEV(BELKIN, F5D8055V2), @@ -178,7 +180,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(DLINK, DWA127), RUN_DEV(DLINK, DWA140B3), RUN_DEV(DLINK, DWA160B2), - RUN_DEV(DLINK, DWA140D1), + RUN_DEV(DLINK, DWA162), RUN_DEV(DLINK2, DWA130), RUN_DEV(DLINK2, RT2870_1), RUN_DEV(DLINK2, RT2870_2), @@ -191,6 +193,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(DLINK2, RT3072_1), RUN_DEV(EDIMAX, EW7717), RUN_DEV(EDIMAX, EW7718), + RUN_DEV(EDIMAX, EW7733UND), RUN_DEV(EDIMAX, RT2870_1), RUN_DEV(ENCORE, RT3070_1), RUN_DEV(ENCORE, RT3070_2), @@ -262,6 +265,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(RALINK, RT3072), RUN_DEV(RALINK, RT3370), RUN_DEV(RALINK, RT3572), + RUN_DEV(RALINK, RT3573), RUN_DEV(RALINK, RT5370), RUN_DEV(RALINK, RT5572), RUN_DEV(RALINK, RT8070), @@ -311,6 +315,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(ZINWELL, RT3072_2), RUN_DEV(ZYXEL, RT2870_1), RUN_DEV(ZYXEL, RT2870_2), + RUN_DEV(ZYXEL, NWD2705), RUN_DEV_EJECT(RALINK, RT_STOR), #undef RUN_DEV_EJECT #undef RUN_DEV @@ -354,6 +359,8 @@ static int run_write(struct run_softc *, static int run_write_region_1(struct run_softc *, uint16_t, const uint8_t *, int); static int run_set_region_4(struct run_softc *, uint16_t, uint32_t, int); +static int run_rf3593_efuse_read_1(struct run_softc *, uint16_t, + uint16_t *); static int run_efuse_read(struct run_softc *, uint16_t, uint16_t *, int); static int run_efuse_read_2(struct run_softc *, uint16_t, uint16_t *); static int run_eeprom_read_2(struct run_softc *, uint16_t, uint16_t *); @@ -364,6 +371,8 @@ static int run_bbp_read(struct run_softc static int run_bbp_write(struct run_softc *, uint8_t, uint8_t); static int run_mcu_cmd(struct run_softc *, uint8_t, uint16_t); static const char *run_get_rf(uint16_t); +static void run_rt3593_get_txpower(struct run_softc *); +static void run_get_txpower(struct run_softc *); static int run_read_eeprom(struct run_softc *); static struct ieee80211_node *run_node_alloc(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); @@ -408,6 +417,7 @@ static void run_set_rx_antenna(struct ru static void run_rt2870_set_chan(struct run_softc *, u_int); static void run_rt3070_set_chan(struct run_softc *, u_int); static void run_rt3572_set_chan(struct run_softc *, u_int); +static void run_rt3593_set_chan(struct run_softc *, u_int); static void run_rt5390_set_chan(struct run_softc *, u_int); static void run_rt5592_set_chan(struct run_softc *, u_int); static int run_set_chan(struct run_softc *, struct ieee80211_channel *); @@ -436,10 +446,13 @@ static void run_update_promisc(struct if static void run_rt5390_bbp_init(struct run_softc *); static int run_bbp_init(struct run_softc *); static int run_rt3070_rf_init(struct run_softc *); +static void run_rt3593_rf_init(struct run_softc *); static void run_rt5390_rf_init(struct run_softc *); static int run_rt3070_filter_calib(struct run_softc *, uint8_t, uint8_t, uint8_t *); static void run_rt3070_rf_setup(struct run_softc *); +static void run_rt3593_rf_setup(struct run_softc *); +static void run_rt5390_rf_setup(struct run_softc *); static int run_txrx_enable(struct run_softc *); static void run_adjust_freq_offset(struct run_softc *); static void run_init(void *); @@ -533,6 +546,8 @@ static const struct { RT3070_DEF_RF },rt3572_def_rf[] = { RT3572_DEF_RF +},rt3593_def_rf[] = { + RT3593_DEF_RF },rt5390_def_rf[] = { RT5390_DEF_RF },rt5392_def_rf[] = { @@ -786,7 +801,8 @@ run_attach(device_t self) setbit(&bands, IEEE80211_MODE_11B); setbit(&bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || - sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT5592_RF_5592) + sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || + sc->rf_rev == RT5592_RF_5592) setbit(&bands, IEEE80211_MODE_11A); ieee80211_init_channels(ic, NULL, &bands); @@ -1137,9 +1153,11 @@ run_load_microcode(struct run_softc *sc) } /* write microcode image */ - run_write_region_1(sc, RT2870_FW_BASE, base, 4096); - run_write(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); - run_write(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff); + if (sc->mac_ver != 0x3593) { + run_write_region_1(sc, RT2870_FW_BASE, base, 4096); + run_write(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff); + run_write(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff); + } req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = RT2870_RESET; @@ -1154,15 +1172,16 @@ run_load_microcode(struct run_softc *sc) run_delay(sc, 10); + run_write(sc, RT2860_H2M_BBPAGENT, 0); run_write(sc, RT2860_H2M_MAILBOX, 0); + run_write(sc, RT2860_H2M_INTSRC, 0); if ((error = run_mcu_cmd(sc, RT2860_MCU_CMD_RFRESET, 0)) != 0) goto fail; /* wait until microcontroller is ready */ for (ntries = 0; ntries < 1000; ntries++) { - if ((error = run_read(sc, RT2860_SYS_CTRL, &tmp)) != 0) { + if ((error = run_read(sc, RT2860_SYS_CTRL, &tmp)) != 0) goto fail; - } if (tmp & RT2860_MCU_READY) break; run_delay(sc, 10); @@ -1325,6 +1344,12 @@ run_set_region_4(struct run_softc *sc, u } static int +run_rf3593_efuse_read_1(struct run_softc *sc, uint16_t addr, uint16_t *val) +{ + return (run_efuse_read(sc, addr * 2, val, 1)); +} + +static int run_efuse_read(struct run_softc *sc, uint16_t addr, uint16_t *val, int count) { uint32_t tmp; @@ -1374,7 +1399,6 @@ run_efuse_read(struct run_softc *sc, uin return (0); } - /* Read 16-bit from eFUSE ROM (RT3070 only.) */ static int run_efuse_read_2(struct run_softc *sc, uint16_t addr, uint16_t *val) @@ -1394,7 +1418,7 @@ run_eeprom_read_2(struct run_softc *sc, req.bRequest = RT2870_EEPROM_READ; USETW(req.wValue, 0); USETW(req.wIndex, addr); - USETW(req.wLength, sizeof tmp); + USETW(req.wLength, sizeof(tmp)); error = usbd_do_request(sc->sc_udev, &sc->sc_mtx, &req, &tmp); if (error == 0) @@ -1589,6 +1613,7 @@ run_get_rf(uint16_t rev) case RT3070_RF_3021: return "RT3021"; case RT3070_RF_3022: return "RT3022"; case RT3070_RF_3052: return "RT3052"; + case RT3593_RF_3053: return "RT3053"; case RT5592_RF_5592: return "RT5592"; case RT5390_RF_5370: return "RT5370"; case RT5390_RF_5372: return "RT5372"; @@ -1596,6 +1621,125 @@ run_get_rf(uint16_t rev) return ("unknown"); } +static void +run_rt3593_get_txpower(struct run_softc *sc) +{ + uint16_t addr, val; + int i; + + /* Read power settings for 2GHz channels. */ + for (i = 0; i < 14; i += 2) { + addr = (sc->ntxchains == 3) ? RT3593_EEPROM_PWR2GHZ_BASE1 : + RT2860_EEPROM_PWR2GHZ_BASE1; + run_srom_read(sc, addr + i / 2, &val); + sc->txpow1[i + 0] = (int8_t)(val & 0xff); + sc->txpow1[i + 1] = (int8_t)(val >> 8); + + addr = (sc->ntxchains == 3) ? RT3593_EEPROM_PWR2GHZ_BASE2 : + RT2860_EEPROM_PWR2GHZ_BASE2; + run_srom_read(sc, addr + i / 2, &val); + sc->txpow2[i + 0] = (int8_t)(val & 0xff); + sc->txpow2[i + 1] = (int8_t)(val >> 8); + + if (sc->ntxchains == 3) { + run_srom_read(sc, RT3593_EEPROM_PWR2GHZ_BASE3 + i / 2, + &val); + sc->txpow3[i + 0] = (int8_t)(val & 0xff); + sc->txpow3[i + 1] = (int8_t)(val >> 8); + } + } + /* Fix broken Tx power entries. */ + for (i = 0; i < 14; i++) { + if ((sc->txpow1[i] & 0x1f) > 31) + sc->txpow1[i] = 5; + if ((sc->txpow2[i] & 0x1f) > 31) + sc->txpow2[i] = 5; + if (sc->ntxchains == 3) { + if ((sc->txpow3[i] & 0x1f) > 31) + sc->txpow3[i] = 5; + } + } + /* Read power settings for 5GHz channels. */ + for (i = 0; i < 40; i += 2) { + run_srom_read(sc, RT3593_EEPROM_PWR5GHZ_BASE1 + i / 2, &val); + sc->txpow1[i + 14] = (int8_t)(val & 0xff); + sc->txpow1[i + 15] = (int8_t)(val >> 8); + + run_srom_read(sc, RT3593_EEPROM_PWR5GHZ_BASE2 + i / 2, &val); + sc->txpow2[i + 14] = (int8_t)(val & 0xff); + sc->txpow2[i + 15] = (int8_t)(val >> 8); + + if (sc->ntxchains == 3) { + run_srom_read(sc, RT3593_EEPROM_PWR5GHZ_BASE3 + i / 2, + &val); + sc->txpow3[i + 14] = (int8_t)(val & 0xff); + sc->txpow3[i + 15] = (int8_t)(val >> 8); + } + } +} + +static void +run_get_txpower(struct run_softc *sc) +{ + uint16_t val; + int i; + + /* Read power settings for 2GHz channels. */ + for (i = 0; i < 14; i += 2) { + run_srom_read(sc, RT2860_EEPROM_PWR2GHZ_BASE1 + i / 2, &val); + sc->txpow1[i + 0] = (int8_t)(val & 0xff); + sc->txpow1[i + 1] = (int8_t)(val >> 8); + + if (sc->mac_ver != 0x5390) { + run_srom_read(sc, + RT2860_EEPROM_PWR2GHZ_BASE2 + i / 2, &val); + sc->txpow2[i + 0] = (int8_t)(val & 0xff); + sc->txpow2[i + 1] = (int8_t)(val >> 8); + } + } + /* Fix broken Tx power entries. */ + for (i = 0; i < 14; i++) { + if (sc->mac_ver >= 0x5390) { + if (sc->txpow1[i] < 0 || sc->txpow1[i] > 27) + sc->txpow1[i] = 5; + } else { + if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) + sc->txpow1[i] = 5; + } + if (sc->mac_ver > 0x5390) { + if (sc->txpow2[i] < 0 || sc->txpow2[i] > 27) + sc->txpow2[i] = 5; + } else if (sc->mac_ver < 0x5390) { + if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) + sc->txpow2[i] = 5; + } + DPRINTF("chan %d: power1=%d, power2=%d\n", + rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i]); + } + /* Read power settings for 5GHz channels. */ + for (i = 0; i < 40; i += 2) { + run_srom_read(sc, RT2860_EEPROM_PWR5GHZ_BASE1 + i / 2, &val); + sc->txpow1[i + 14] = (int8_t)(val & 0xff); + sc->txpow1[i + 15] = (int8_t)(val >> 8); + + run_srom_read(sc, RT2860_EEPROM_PWR5GHZ_BASE2 + i / 2, &val); + sc->txpow2[i + 14] = (int8_t)(val & 0xff); + sc->txpow2[i + 15] = (int8_t)(val >> 8); + } + /* Fix broken Tx power entries. */ + for (i = 0; i < 40; i++ ) { + if (sc->mac_ver != 0x5592) { + if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) + sc->txpow1[14 + i] = 5; + if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) + sc->txpow2[14 + i] = 5; + } + DPRINTF("chan %d: power1=%d, power2=%d\n", + rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i], + sc->txpow2[14 + i]); + } +} + static int run_read_eeprom(struct run_softc *sc) { @@ -1609,8 +1753,10 @@ run_read_eeprom(struct run_softc *sc) if (sc->mac_ver >= 0x3070) { run_read(sc, RT3070_EFUSE_CTRL, &tmp); DPRINTF("EFUSE_CTRL=0x%08x\n", tmp); - if (tmp & RT3070_SEL_EFUSE) + if ((tmp & RT3070_SEL_EFUSE) && sc->mac_ver != 0x3593) sc->sc_srom_read = run_efuse_read_2; + else + sc->sc_srom_read = run_rf3593_efuse_read_1; } /* read ROM version */ @@ -1628,7 +1774,7 @@ run_read_eeprom(struct run_softc *sc) sc->sc_bssid[4] = val & 0xff; sc->sc_bssid[5] = val >> 8; - if (sc->mac_ver < 0x5390) { + if (sc->mac_ver < 0x3593) { /* read vender BBP settings */ for (i = 0; i < 10; i++) { run_srom_read(sc, RT2860_EEPROM_BBP_BASE + i, &val); @@ -1651,16 +1797,22 @@ run_read_eeprom(struct run_softc *sc) } /* read RF frequency offset from EEPROM */ - run_srom_read(sc, RT2860_EEPROM_FREQ_LEDS, &val); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS : + RT3593_EEPROM_FREQ, &val); sc->freq = ((val & 0xff) != 0xff) ? val & 0xff : 0; DPRINTF("EEPROM freq offset %d\n", sc->freq & 0xff); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_FREQ_LEDS : + RT3593_EEPROM_FREQ_LEDS, &val); if (val >> 8 != 0xff) { /* read LEDs operating mode */ sc->leds = val >> 8; - run_srom_read(sc, RT2860_EEPROM_LED1, &sc->led[0]); - run_srom_read(sc, RT2860_EEPROM_LED2, &sc->led[1]); - run_srom_read(sc, RT2860_EEPROM_LED3, &sc->led[2]); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED1 : + RT3593_EEPROM_LED1, &sc->led[0]); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED2 : + RT3593_EEPROM_LED2, &sc->led[1]); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LED3 : + RT3593_EEPROM_LED3, &sc->led[2]); } else { /* broken EEPROM, use default settings */ sc->leds = 0x01; @@ -1678,6 +1830,8 @@ run_read_eeprom(struct run_softc *sc) run_srom_read(sc, RT2860_EEPROM_ANTENNA, &val); if (val == 0xffff) { + device_printf(sc->sc_dev, + "invalid EEPROM antenna info, using default\n"); DPRINTF("invalid EEPROM antenna info, using default\n"); if (sc->mac_ver == 0x3572) { /* default to RF3052 2T2R */ @@ -1722,60 +1876,11 @@ run_read_eeprom(struct run_softc *sc) sc->rfswitch = val & 1; } - /* read power settings for 2GHz channels */ - for (i = 0; i < 14; i += 2) { - run_srom_read(sc, RT2860_EEPROM_PWR2GHZ_BASE1 + i / 2, &val); - sc->txpow1[i + 0] = (int8_t)(val & 0xff); - sc->txpow1[i + 1] = (int8_t)(val >> 8); - - if (sc->mac_ver != 0x5390) { - run_srom_read(sc, - RT2860_EEPROM_PWR2GHZ_BASE2 + i / 2, &val); - sc->txpow2[i + 0] = (int8_t)(val & 0xff); - sc->txpow2[i + 1] = (int8_t)(val >> 8); - } - } - /* fix broken Tx power entries */ - for (i = 0; i < 14; i++) { - if (sc->mac_ver >= 0x5390) { - if (sc->txpow1[i] < 0 || sc->txpow1[i] > 27) - sc->txpow1[i] = 5; - } else { - if (sc->txpow1[i] < 0 || sc->txpow1[i] > 31) - sc->txpow1[i] = 5; - } - if (sc->mac_ver > 0x5390) { - if (sc->txpow2[i] < 0 || sc->txpow2[i] > 27) - sc->txpow2[i] = 5; - } else if (sc->mac_ver < 0x5390) { - if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31) - sc->txpow2[i] = 5; - } - DPRINTF("chan %d: power1=%d, power2=%d\n", - rt2860_rf2850[i].chan, sc->txpow1[i], sc->txpow2[i]); - } - /* read power settings for 5GHz channels */ - for (i = 0; i < 40; i += 2) { - run_srom_read(sc, RT2860_EEPROM_PWR5GHZ_BASE1 + i / 2, &val); - sc->txpow1[i + 14] = (int8_t)(val & 0xff); - sc->txpow1[i + 15] = (int8_t)(val >> 8); - - run_srom_read(sc, RT2860_EEPROM_PWR5GHZ_BASE2 + i / 2, &val); - sc->txpow2[i + 14] = (int8_t)(val & 0xff); - sc->txpow2[i + 15] = (int8_t)(val >> 8); - } - /* fix broken Tx power entries */ - for (i = 0; i < 40; i++ ) { - if (sc->mac_ver != 0x5592) { - if (sc->txpow1[14 + i] < -7 || sc->txpow1[14 + i] > 15) - sc->txpow1[14 + i] = 5; - if (sc->txpow2[14 + i] < -7 || sc->txpow2[14 + i] > 15) - sc->txpow2[14 + i] = 5; - } - DPRINTF("chan %d: power1=%d, power2=%d\n", - rt2860_rf2850[14 + i].chan, sc->txpow1[14 + i], - sc->txpow2[14 + i]); - } + /* Read Tx power settings. */ + if (sc->mac_ver == 0x3593) + run_rt3593_get_txpower(sc); + else + run_get_txpower(sc); /* read Tx power compensation for each Tx rate */ run_srom_read(sc, RT2860_EEPROM_DELTAPWR, &val); @@ -1811,27 +1916,38 @@ run_read_eeprom(struct run_softc *sc) sc->txpow40mhz_2ghz[ridx], sc->txpow40mhz_5ghz[ridx]); } - /* read RSSI offsets and LNA gains from EEPROM */ - run_srom_read(sc, RT2860_EEPROM_RSSI1_2GHZ, &val); + /* Read RSSI offsets and LNA gains from EEPROM. */ + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI1_2GHZ : + RT3593_EEPROM_RSSI1_2GHZ, &val); sc->rssi_2ghz[0] = val & 0xff; /* Ant A */ sc->rssi_2ghz[1] = val >> 8; /* Ant B */ - run_srom_read(sc, RT2860_EEPROM_RSSI2_2GHZ, &val); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI2_2GHZ : + RT3593_EEPROM_RSSI2_2GHZ, &val); if (sc->mac_ver >= 0x3070) { - /* - * On RT3070 chips (limited to 2 Rx chains), this ROM - * field contains the Tx mixer gain for the 2GHz band. - */ - if ((val & 0xff) != 0xff) - sc->txmixgain_2ghz = val & 0x7; + if (sc->mac_ver == 0x3593) { + sc->txmixgain_2ghz = 0; + sc->rssi_2ghz[2] = val & 0xff; /* Ant C */ + } else { + /* + * On RT3070 chips (limited to 2 Rx chains), this ROM + * field contains the Tx mixer gain for the 2GHz band. + */ + if ((val & 0xff) != 0xff) + sc->txmixgain_2ghz = val & 0x7; + } DPRINTF("tx mixer gain=%u (2GHz)\n", sc->txmixgain_2ghz); } else sc->rssi_2ghz[2] = val & 0xff; /* Ant C */ + if (sc->mac_ver == 0x3593) + run_srom_read(sc, RT3593_EEPROM_LNA_5GHZ, &val); sc->lna[2] = val >> 8; /* channel group 2 */ - run_srom_read(sc, RT2860_EEPROM_RSSI1_5GHZ, &val); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI1_5GHZ : + RT3593_EEPROM_RSSI1_5GHZ, &val); sc->rssi_5ghz[0] = val & 0xff; /* Ant A */ sc->rssi_5ghz[1] = val >> 8; /* Ant B */ - run_srom_read(sc, RT2860_EEPROM_RSSI2_5GHZ, &val); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_RSSI2_5GHZ : + RT3593_EEPROM_RSSI2_5GHZ, &val); if (sc->mac_ver == 0x3572) { /* * On RT3572 chips (limited to 2 Rx chains), this ROM @@ -1842,9 +1958,14 @@ run_read_eeprom(struct run_softc *sc) DPRINTF("tx mixer gain=%u (5GHz)\n", sc->txmixgain_5ghz); } else sc->rssi_5ghz[2] = val & 0xff; /* Ant C */ + if (sc->mac_ver == 0x3593) { + sc->txmixgain_5ghz = 0; + run_srom_read(sc, RT3593_EEPROM_LNA_5GHZ, &val); + } sc->lna[3] = val >> 8; /* channel group 3 */ - run_srom_read(sc, RT2860_EEPROM_LNA, &val); + run_srom_read(sc, (sc->mac_ver != 0x3593) ? RT2860_EEPROM_LNA : + RT3593_EEPROM_LNA, &val); sc->lna[0] = val & 0xff; /* channel group 0 */ sc->lna[1] = val >> 8; /* channel group 1 */ @@ -2659,9 +2780,11 @@ run_rx_frame(struct run_softc *sc, struc rxwi = mtod(m, struct rt2860_rxwi *); len = le16toh(rxwi->len) & 0xfff; - rxwisize = (sc->mac_ver == 0x5592) ? - sizeof(struct rt2860_rxwi) + sizeof(uint64_t) : - sizeof(struct rt2860_rxwi); + rxwisize = sizeof(struct rt2860_rxwi); + if (sc->mac_ver == 0x5592) + rxwisize += sizeof(uint64_t); + else if (sc->mac_ver == 0x3593) + rxwisize += sizeof(uint32_t); if (__predict_false(len > dmalen)) { m_freem(m); ifp->if_ierrors++; @@ -2772,9 +2895,11 @@ run_bulk_rx_callback(struct usb_xfer *xf uint16_t rxwisize; int xferlen; - rxwisize = (sc->mac_ver == 0x5592) ? - sizeof(struct rt2860_rxwi) + sizeof(uint64_t) : - sizeof(struct rt2860_rxwi); + rxwisize = sizeof(struct rt2860_rxwi); + if (sc->mac_ver == 0x5592) + rxwisize += sizeof(uint64_t); + else if (sc->mac_ver == 0x3593) + rxwisize += sizeof(uint32_t); usbd_xfer_status(xfer, &xferlen, NULL, NULL, NULL); @@ -3816,6 +3941,11 @@ run_select_chan_group(struct run_softc * if (sc->mac_ver < 0x3572) run_bbp_write(sc, 86, 0x00); + if (sc->mac_ver == 0x3593) { + run_bbp_write(sc, 77, 0x98); + run_bbp_write(sc, 83, (group == 0) ? 0x8a : 0x9a); + } + if (group == 0) { if (sc->ext_2ghz_lna) { if (sc->mac_ver >= 0x5390) @@ -3846,7 +3976,8 @@ run_select_chan_group(struct run_softc * } else if (sc->mac_ver >= 0x5390) run_bbp_write(sc, 75, 0x50); else { - run_bbp_write(sc, 82, 0x84); + run_bbp_write(sc, 82, + (sc->mac_ver == 0x3593) ? 0x62 : 0x84); run_bbp_write(sc, 75, 0x50); } } @@ -3872,7 +4003,8 @@ run_select_chan_group(struct run_softc * } else if (sc->mac_ver == 0x3572) run_bbp_write(sc, 82, 0x94); else - run_bbp_write(sc, 82, 0xf2); + run_bbp_write(sc, 82, + (sc->mac_ver == 0x3593) ? 0x82 : 0xf2); if (sc->ext_5ghz_lna) run_bbp_write(sc, 75, 0x46); else @@ -3886,12 +4018,18 @@ run_select_chan_group(struct run_softc * /* enable appropriate Power Amplifiers and Low Noise Amplifiers */ tmp = RT2860_RFTR_EN | RT2860_TRSW_EN | RT2860_LNA_PE0_EN; + if (sc->mac_ver == 0x3593) + tmp |= 1 << 29 | 1 << 28; if (sc->nrxchains > 1) tmp |= RT2860_LNA_PE1_EN; if (group == 0) { /* 2GHz */ tmp |= RT2860_PA_PE_G0_EN; if (sc->ntxchains > 1) tmp |= RT2860_PA_PE_G1_EN; + if (sc->mac_ver == 0x3593) { + if (sc->ntxchains > 2) + tmp |= 1 << 25; + } } else { /* 5GHz */ tmp |= RT2860_PA_PE_A0_EN; if (sc->ntxchains > 1) @@ -3909,6 +4047,15 @@ run_select_chan_group(struct run_softc * run_bbp_write(sc, 196, 0x1a); } + if (sc->mac_ver == 0x3593) { + run_read(sc, RT2860_GPIO_CTRL, &tmp); + tmp &= ~0x01010000; + if (group == 0) + tmp |= 0x00010000; + tmp = (tmp & ~0x00009090) | 0x00000090; + run_write(sc, RT2860_GPIO_CTRL, tmp); + } + /* set initial AGC value */ if (group == 0) { /* 2GHz band */ if (sc->mac_ver >= 0x3070) @@ -3918,7 +4065,7 @@ run_select_chan_group(struct run_softc * } else { /* 5GHz band */ if (sc->mac_ver == 0x5592) agc = 0x24 + sc->lna[group] * 2; - else if (sc->mac_ver == 0x3572) + else if (sc->mac_ver == 0x3572 || sc->mac_ver == 0x3593) agc = 0x22 + (sc->lna[group] * 5) / 3; else agc = 0x32 + (sc->lna[group] * 5) / 3; @@ -4213,6 +4360,166 @@ run_rt3572_set_chan(struct run_softc *sc } static void +run_rt3593_set_chan(struct run_softc *sc, u_int chan) +{ + int8_t txpow1, txpow2, txpow3; + uint8_t h20mhz, rf; + int i; + + /* find the settings for this channel (we know it exists) */ + for (i = 0; rt2860_rf2850[i].chan != chan; i++); + + /* use Tx power values from EEPROM */ + txpow1 = sc->txpow1[i]; + txpow2 = sc->txpow2[i]; + txpow3 = (sc->ntxchains == 3) ? sc->txpow3[i] : 0; + + if (chan <= 14) { + run_bbp_write(sc, 25, sc->bbp25); + run_bbp_write(sc, 26, sc->bbp26); + } else { + /* Enable IQ phase correction. */ + run_bbp_write(sc, 25, 0x09); + run_bbp_write(sc, 26, 0xff); + } + + run_rt3070_rf_write(sc, 8, rt3070_freqs[i].n); + run_rt3070_rf_write(sc, 9, rt3070_freqs[i].k & 0x0f); + run_rt3070_rf_read(sc, 11, &rf); + rf = (rf & ~0x03) | (rt3070_freqs[i].r & 0x03); + run_rt3070_rf_write(sc, 11, rf); + + /* Set pll_idoh. */ + run_rt3070_rf_read(sc, 11, &rf); + rf &= ~0x4c; + rf |= (chan <= 14) ? 0x44 : 0x48; + run_rt3070_rf_write(sc, 11, rf); + + if (chan <= 14) + rf = txpow1 & 0x1f; + else + rf = 0x40 | ((txpow1 & 0x18) << 1) | (txpow1 & 0x07); + run_rt3070_rf_write(sc, 53, rf); + + if (chan <= 14) + rf = txpow2 & 0x1f; + else + rf = 0x40 | ((txpow2 & 0x18) << 1) | (txpow2 & 0x07); + run_rt3070_rf_write(sc, 55, rf); + + if (chan <= 14) + rf = txpow3 & 0x1f; + else + rf = 0x40 | ((txpow3 & 0x18) << 1) | (txpow3 & 0x07); + run_rt3070_rf_write(sc, 54, rf); + + rf = RT3070_RF_BLOCK | RT3070_PLL_PD; + if (sc->ntxchains == 3) + rf |= RT3070_TX0_PD | RT3070_TX1_PD | RT3070_TX2_PD; + else + rf |= RT3070_TX0_PD | RT3070_TX1_PD; + rf |= RT3070_RX0_PD | RT3070_RX1_PD | RT3070_RX2_PD; + run_rt3070_rf_write(sc, 1, rf); + + run_adjust_freq_offset(sc); + + run_rt3070_rf_write(sc, 31, (chan <= 14) ? 0xa0 : 0x80); + + h20mhz = (sc->rf24_20mhz & 0x20) >> 5; + run_rt3070_rf_read(sc, 30, &rf); + rf = (rf & ~0x06) | (h20mhz << 1) | (h20mhz << 2); + run_rt3070_rf_write(sc, 30, rf); + + run_rt3070_rf_read(sc, 36, &rf); + if (chan <= 14) + rf |= 0x80; + else + rf &= ~0x80; + run_rt3070_rf_write(sc, 36, rf); + + /* Set vcolo_bs. */ + run_rt3070_rf_write(sc, 34, (chan <= 14) ? 0x3c : 0x20); + /* Set pfd_delay. */ + run_rt3070_rf_write(sc, 12, (chan <= 14) ? 0x1a : 0x12); + + /* Set vco bias current control. */ + run_rt3070_rf_read(sc, 6, &rf); + rf &= ~0xc0; + if (chan <= 14) + rf |= 0x40; + else if (chan <= 128) + rf |= 0x80; + else + rf |= 0x40; + run_rt3070_rf_write(sc, 6, rf); + + run_rt3070_rf_read(sc, 30, &rf); + rf = (rf & ~0x18) | 0x10; + run_rt3070_rf_write(sc, 30, rf); + + run_rt3070_rf_write(sc, 10, (chan <= 14) ? 0xd3 : 0xd8); + run_rt3070_rf_write(sc, 13, (chan <= 14) ? 0x12 : 0x23); + + run_rt3070_rf_read(sc, 51, &rf); + rf = (rf & ~0x03) | 0x01; + run_rt3070_rf_write(sc, 51, rf); + /* Set tx_mx1_cc. */ + run_rt3070_rf_read(sc, 51, &rf); + rf &= ~0x1c; + rf |= (chan <= 14) ? 0x14 : 0x10; + run_rt3070_rf_write(sc, 51, rf); + /* Set tx_mx1_ic. */ + run_rt3070_rf_read(sc, 51, &rf); + rf &= ~0xe0; + rf |= (chan <= 14) ? 0x60 : 0x40; + run_rt3070_rf_write(sc, 51, rf); + /* Set tx_lo1_ic. */ + run_rt3070_rf_read(sc, 49, &rf); + rf &= ~0x1c; + rf |= (chan <= 14) ? 0x0c : 0x08; + run_rt3070_rf_write(sc, 49, rf); + /* Set tx_lo1_en. */ + run_rt3070_rf_read(sc, 50, &rf); + run_rt3070_rf_write(sc, 50, rf & ~0x20); + /* Set drv_cc. */ + run_rt3070_rf_read(sc, 57, &rf); + rf &= ~0xfc; + rf |= (chan <= 14) ? 0x6c : 0x3c; + run_rt3070_rf_write(sc, 57, rf); + /* Set rx_mix1_ic, rxa_lnactr, lna_vc, lna_inbias_en and lna_en. */ + run_rt3070_rf_write(sc, 44, (chan <= 14) ? 0x93 : 0x9b); + /* Set drv_gnd_a, tx_vga_cc_a and tx_mx2_gain. */ + run_rt3070_rf_write(sc, 52, (chan <= 14) ? 0x45 : 0x05); + /* Enable VCO calibration. */ + run_rt3070_rf_read(sc, 3, &rf); + rf &= ~RT5390_VCOCAL; + rf |= (chan <= 14) ? RT5390_VCOCAL : 0xbe; + run_rt3070_rf_write(sc, 3, rf); + + if (chan <= 14) + rf = 0x23; + else if (chan <= 64) + rf = 0x36; + else if (chan <= 128) + rf = 0x32; + else + rf = 0x30; + run_rt3070_rf_write(sc, 39, rf); + if (chan <= 14) + rf = 0xbb; + else if (chan <= 64) + rf = 0xeb; + else if (chan <= 128) + rf = 0xb3; + else + rf = 0x9b; + run_rt3070_rf_write(sc, 45, rf); + + /* Set FEQ/AEQ control. */ + run_bbp_write(sc, 105, 0x34); +} + +static void run_rt5390_set_chan(struct run_softc *sc, u_int chan) { int8_t txpow1, txpow2; @@ -4500,6 +4807,8 @@ run_set_chan(struct run_softc *sc, struc run_rt5592_set_chan(sc, chan); else if (sc->mac_ver >= 0x5390) run_rt5390_set_chan(sc, chan); + else if (sc->mac_ver == 0x3593) + run_rt3593_set_chan(sc, chan); else if (sc->mac_ver == 0x3572) run_rt3572_set_chan(sc, chan); else if (sc->mac_ver >= 0x3070) @@ -5043,11 +5352,20 @@ run_bbp_init(struct run_softc *sc) } } + if (sc->mac_ver == 0x3593) { + run_bbp_write(sc, 79, 0x13); + run_bbp_write(sc, 80, 0x05); + run_bbp_write(sc, 81, 0x33); + run_bbp_write(sc, 86, 0x46); + run_bbp_write(sc, 137, 0x0f); + } + /* fix BBP84 for RT2860E */ if (sc->mac_ver == 0x2860 && sc->mac_rev != 0x0101) run_bbp_write(sc, 84, 0x19); - if (sc->mac_ver >= 0x3070 && sc->mac_ver != 0x5592) { + if (sc->mac_ver >= 0x3070 && (sc->mac_ver != 0x3593 && + sc->mac_ver != 0x5592)) { run_bbp_write(sc, 79, 0x13); run_bbp_write(sc, 80, 0x05); run_bbp_write(sc, 81, 0x33); @@ -5203,6 +5521,55 @@ run_rt3070_rf_init(struct run_softc *sc) } static void +run_rt3593_rf_init(struct run_softc *sc) +{ + uint32_t tmp; + uint8_t rf; + int i; + + /* Disable the GPIO bits 4 and 7 for LNA PE control. */ + run_read(sc, RT3070_GPIO_SWITCH, &tmp); + tmp &= ~(1 << 4 | 1 << 7); + run_write(sc, RT3070_GPIO_SWITCH, tmp); + + /* Initialize RF registers to default value. */ + for (i = 0; i < nitems(rt3593_def_rf); i++) { + run_rt3070_rf_write(sc, rt3593_def_rf[i].reg, + rt3593_def_rf[i].val); + } + + /* Toggle RF R2 to initiate calibration. */ + run_rt3070_rf_write(sc, 2, RT5390_RESCAL); + + /* Initialize RF frequency offset. */ + run_adjust_freq_offset(sc); + + run_rt3070_rf_read(sc, 18, &rf); + run_rt3070_rf_write(sc, 18, rf | RT3593_AUTOTUNE_BYPASS); + + /* + * Increase voltage from 1.2V to 1.35V, wait for 1 msec to + * decrease voltage back to 1.2V. + */ + run_read(sc, RT3070_LDO_CFG0, &tmp); + tmp = (tmp & ~0x1f000000) | 0x0d000000; + run_write(sc, RT3070_LDO_CFG0, tmp); + run_delay(sc, 1); + tmp = (tmp & ~0x1f000000) | 0x01000000; + run_write(sc, RT3070_LDO_CFG0, tmp); + + sc->rf24_20mhz = 0x1f; + sc->rf24_40mhz = 0x2f; + + /* Save default BBP registers 25 and 26 values. */ + run_bbp_read(sc, 25, &sc->bbp25); + run_bbp_read(sc, 26, &sc->bbp26); + + run_read(sc, RT3070_OPT_14, &tmp); + run_write(sc, RT3070_OPT_14, tmp | 1); +} + +static void run_rt5390_rf_init(struct run_softc *sc) { uint32_t tmp; @@ -5337,49 +5704,7 @@ run_rt3070_rf_setup(struct run_softc *sc uint8_t bbp, rf; int i; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 06:02:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55C501BA; Fri, 3 Jan 2014 06:02:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 284911AA7; Fri, 3 Jan 2014 06:02:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03629qN098188; Fri, 3 Jan 2014 06:02:09 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03629S1098187; Fri, 3 Jan 2014 06:02:09 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201401030602.s03629S1098187@svn.freebsd.org> From: Kevin Lo Date: Fri, 3 Jan 2014 06:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260220 - head/etc/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 06:02:09 -0000 Author: kevlo Date: Fri Jan 3 06:02:08 2014 New Revision: 260220 URL: http://svnweb.freebsd.org/changeset/base/260220 Log: Regen. Modified: head/etc/devd/usb.conf Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Fri Jan 3 06:01:05 2014 (r260219) +++ head/etc/devd/usb.conf Fri Jan 3 06:02:08 2014 (r260220) @@ -721,6 +721,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x050d"; + match "product" "0x1103"; + action "kldload -n if_run"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x050d"; match "product" "0x1203"; action "kldload -n ubsa"; }; @@ -1064,6 +1072,14 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x0586"; + match "product" "0x3421"; + action "kldload -n if_run"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x058f"; match "product" "0x9720"; action "kldload -n uplcom"; @@ -2313,6 +2329,14 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x0b05"; + match "product" "0x17ad"; + action "kldload -n if_run"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; + match "vendor" "0x0b05"; match "product" "(0x17b5|0x17cb)"; action "kldload -n ng_ubt"; }; @@ -3825,7 +3849,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x148f"; - match "product" "(0x2770|0x2870|0x3070|0x3071|0x3072|0x3370|0x3572|0x5370|0x5572|0x8070)"; + match "product" "(0x2770|0x2870|0x2878|0x3070|0x3071|0x3072|0x3370|0x3572|0x3573|0x5370|0x5572|0x8070)"; action "kldload -n if_run"; }; @@ -4625,7 +4649,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x2001"; - match "product" "(0x3c09|0x3c0a|0x3c15|0x3c1a|0x3c1b|0x3c20)"; + match "product" "(0x3c09|0x3c0a|0x3c15|0x3c1a|0x3c1b|0x3c1f)"; action "kldload -n if_run"; }; @@ -5057,7 +5081,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x7392"; - match "product" "(0x7711|0x7717|0x7718)"; + match "product" "(0x7711|0x7717|0x7718|0x7733)"; action "kldload -n if_run"; }; @@ -5341,5 +5365,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2577 USB entries processed +# 2583 USB entries processed From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 09:07:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A325B84F; Fri, 3 Jan 2014 09:07: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 8E27E186A; Fri, 3 Jan 2014 09:07: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 s03973Kw068339; Fri, 3 Jan 2014 09:07:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s039736o068338; Fri, 3 Jan 2014 09:07:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401030907.s039736o068338@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 3 Jan 2014 09:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260222 - head/lib/libnv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 09:07:03 -0000 Author: pjd Date: Fri Jan 3 09:07:03 2014 New Revision: 260222 URL: http://svnweb.freebsd.org/changeset/base/260222 Log: MFp4 @1189711: Fix resource leaks on nvlist_destroy(). Reported by: Mariusz Zaborski MFC after: 3 days Modified: head/lib/libnv/nvlist.c Modified: head/lib/libnv/nvlist.c ============================================================================== --- head/lib/libnv/nvlist.c Fri Jan 3 08:31:42 2014 (r260221) +++ head/lib/libnv/nvlist.c Fri Jan 3 09:07:03 2014 (r260222) @@ -125,8 +125,10 @@ nvlist_destroy(nvlist_t *nvl) NVLIST_ASSERT(nvl); - while ((nvp = nvlist_first_nvpair(nvl)) != NULL) + while ((nvp = nvlist_first_nvpair(nvl)) != NULL) { nvlist_remove_nvpair(nvl, nvp); + nvpair_free(nvp); + } nvl->nvl_magic = 0; free(nvl); From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 09:10:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAEC4A33; Fri, 3 Jan 2014 09:10:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D7A721882; Fri, 3 Jan 2014 09:10: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 s039A427068871; Fri, 3 Jan 2014 09:10:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s039A4hq068870; Fri, 3 Jan 2014 09:10:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401030910.s039A4hq068870@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 3 Jan 2014 09:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260223 - head/lib/libcasper X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 09:10:05 -0000 Author: pjd Date: Fri Jan 3 09:10:04 2014 New Revision: 260223 URL: http://svnweb.freebsd.org/changeset/base/260223 Log: MFp4 @1189741: - Add missing nvlist_destroy(). - Don't override nvlout. Submitted by: Mariusz Zaborski MFC after: 3 days Modified: head/lib/libcasper/libcasper.c Modified: head/lib/libcasper/libcasper.c ============================================================================== --- head/lib/libcasper/libcasper.c Fri Jan 3 09:07:03 2014 (r260222) +++ head/lib/libcasper/libcasper.c Fri Jan 3 09:10:04 2014 (r260223) @@ -348,7 +348,6 @@ service_message(struct service *service, error = 0; } } else { - nvlout = nvlist_create(0); error = service->s_command(cmd, service_connection_get_limits(sconn), nvlin, nvlout); } @@ -362,8 +361,9 @@ service_message(struct service *service, if (cap_send_nvlist(service_connection_get_chan(sconn), nvlout) == -1) { pjdlog_errno(LOG_ERR, "Unable to send message to client"); service_connection_remove(service, sconn); - return; } + + nvlist_destroy(nvlout); } static int From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 10:32:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE664BBB; Fri, 3 Jan 2014 10:32:40 +0000 (UTC) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [IPv6:2a00:1450:400c:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EEE031F2D; Fri, 3 Jan 2014 10:32:39 +0000 (UTC) Received: by mail-we0-f175.google.com with SMTP id t60so13466389wes.34 for ; Fri, 03 Jan 2014 02:32:37 -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=WJkY2u9ztN7uzs5wp8YevRYMq1I9Q9G4lfxyFsqV6aY=; b=RhG3RCJb+gZOGwQ78pe1M5HC2NANEmlU+JIOzuuGDdos24CsSDFr8z/eOGHU3sMZaO jBAgmqKV8KdWIjw88UBG/pjdCb4izDb1neqldNDfjmyeuTUkxOH/INb83rkCcICMie02 RvNTqIUw7ajGePqqT8gQcXiG51R6MPzPo/jAAs1fx7m73AkToolHFcrrXO20YjtN+4yq Axqfu+wgWM8n85GMOYvGOxp8BFYrYkqjS1TCpp2QaRZJSjtUHqWO6mkwQfsbOkmqSM++ Cg9hCSKubTxl6YkWBYx0QBcU0vjFgFjT1s8jeiICfjqYjtXASbQXM2gVp6hAF59cspYQ B41A== MIME-Version: 1.0 X-Received: by 10.194.60.73 with SMTP id f9mr1426380wjr.65.1388745157931; Fri, 03 Jan 2014 02:32:37 -0800 (PST) Sender: zbodek@gmail.com Received: by 10.217.112.65 with HTTP; Fri, 3 Jan 2014 02:32:37 -0800 (PST) In-Reply-To: <201401021345.39250.jhb@freebsd.org> References: <201401012018.s01KI31L014441@svn.freebsd.org> <201401021345.39250.jhb@freebsd.org> Date: Fri, 3 Jan 2014 11:32:37 +0100 X-Google-Sender-Auth: ZkqkOzKL6XemjCYa766zFehg0x4 Message-ID: Subject: Re: svn commit: r260163 - head/sys/dev/ahci From: Zbigniew Bodek To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 10:32:40 -0000 2014/1/2 John Baldwin : > On Wednesday, January 01, 2014 3:18:03 pm Zbigniew Bodek wrote: >> Author: zbb >> Date: Wed Jan 1 20:18:03 2014 >> New Revision: 260163 >> URL: http://svnweb.freebsd.org/changeset/base/260163 >> >> Log: >> Do not attach to PCI bridges in AHCI driver >> >> Some vendors use the same VID:PID combination in AHCI and PCI bridge cards > > Would it be better to require the class to be PCIC_STORAGE instead? > > -- > John Baldwin Hello John. As you can see this is required indirectly when "checking for possible AHCI candidate" but in the loop below the device can still be probed. I will need to contact the person from "Submitted by" to ensure whether adding AHCI_Q_NOFORCE quirk is not going to solve this issue instead. Best regards zbb From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 11:03:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C0DB636; Fri, 3 Jan 2014 11:03: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 E1A6311A1; Fri, 3 Jan 2014 11:03: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 s03B3CKR013124; Fri, 3 Jan 2014 11:03:12 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03B3CAf013123; Fri, 3 Jan 2014 11:03:12 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401031103.s03B3CAf013123@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 3 Jan 2014 11:03:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260224 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 11:03:13 -0000 Author: glebius Date: Fri Jan 3 11:03:12 2014 New Revision: 260224 URL: http://svnweb.freebsd.org/changeset/base/260224 Log: Make failure of ifpromisc() a non-fatal error. This makes it possible to run carp(4) on vtnet(4). Sponsored by: Nginx, Inc. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Jan 3 09:10:04 2014 (r260223) +++ head/sys/netinet/ip_carp.c Fri Jan 3 11:03:12 2014 (r260224) @@ -145,6 +145,8 @@ struct carp_if { #endif struct ifnet *cif_ifp; struct mtx cif_mtx; + uint32_t cif_flags; +#define CIF_PROMISC 0x00000001 }; #define CARP_INET 0 @@ -1483,11 +1485,8 @@ carp_alloc(struct ifnet *ifp) struct carp_softc *sc; struct carp_if *cif; - if ((cif = ifp->if_carp) == NULL) { + if ((cif = ifp->if_carp) == NULL) cif = carp_alloc_if(ifp); - if (cif == NULL) - return (NULL); - } sc = malloc(sizeof(*sc), M_CARP, M_WAITOK|M_ZERO); @@ -1572,11 +1571,15 @@ static struct carp_if* carp_alloc_if(struct ifnet *ifp) { struct carp_if *cif; + int error; cif = malloc(sizeof(*cif), M_CARP, M_WAITOK|M_ZERO); - if (ifpromisc(ifp, 1) != 0) - goto cleanup; + if ((error = ifpromisc(ifp, 1)) != 0) + printf("%s: ifpromisc(%s) failed: %d\n", + __func__, ifp->if_xname, error); + else + cif->cif_flags |= CIF_PROMISC; CIF_LOCK_INIT(cif); cif->cif_ifp = ifp; @@ -1588,11 +1591,6 @@ carp_alloc_if(struct ifnet *ifp) IF_ADDR_WUNLOCK(ifp); return (cif); - -cleanup: - free(cif, M_CARP); - - return (NULL); } static void @@ -1610,7 +1608,8 @@ carp_free_if(struct carp_if *cif) CIF_LOCK_DESTROY(cif); - ifpromisc(ifp, 0); + if (cif->cif_flags & CIF_PROMISC) + ifpromisc(ifp, 0); if_rele(ifp); free(cif, M_CARP); @@ -1683,11 +1682,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd } if (sc == NULL) { sc = carp_alloc(ifp); - if (sc == NULL) { - error = EINVAL; /* XXX: ifpromisc failed */ - break; - } - CARP_LOCK(sc); sc->sc_vhid = carpr.carpr_vhid; LLADDR(&sc->sc_addr)[0] = 0; From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 12:06:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34391328; Fri, 3 Jan 2014 12:06: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 1FFE51604; Fri, 3 Jan 2014 12:06: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 s03C6si7036174; Fri, 3 Jan 2014 12:06:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03C6sxo036173; Fri, 3 Jan 2014 12:06:54 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201401031206.s03C6sxo036173@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 3 Jan 2014 12:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260225 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 12:06:55 -0000 Author: glebius Date: Fri Jan 3 12:06:54 2014 New Revision: 260225 URL: http://svnweb.freebsd.org/changeset/base/260225 Log: Fix circular math macro. Submitted by: Lutz Donnerhacke via Dmitry Luhtionov German lesson at: http://lutz.donnerhacke.de/Blog/Der-Fluch-der-Stabilitaet PR: 146082 Modified: head/sys/netgraph/ng_l2tp.c Modified: head/sys/netgraph/ng_l2tp.c ============================================================================== --- head/sys/netgraph/ng_l2tp.c Fri Jan 3 11:03:12 2014 (r260224) +++ head/sys/netgraph/ng_l2tp.c Fri Jan 3 12:06:54 2014 (r260225) @@ -98,7 +98,7 @@ static MALLOC_DEFINE(M_NETGRAPH_L2TP, "n #define L2TP_ENABLE_DSEQ 1 /* enable data seq # */ /* Compare sequence numbers using circular math */ -#define L2TP_SEQ_DIFF(x, y) ((int)((int16_t)(x) - (int16_t)(y))) +#define L2TP_SEQ_DIFF(x, y) ((int16_t)((x) - (y))) #define SESSHASHSIZE 0x0020 #define SESSHASH(x) (((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1)) From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 14:33:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0C115502; Fri, 3 Jan 2014 14:33:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E03E11228; Fri, 3 Jan 2014 14:33:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03EXPBB092102; Fri, 3 Jan 2014 14:33:25 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03EXPJ5092101; Fri, 3 Jan 2014 14:33:25 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401031433.s03EXPJ5092101@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 3 Jan 2014 14:33:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260228 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 14:33:26 -0000 Author: melifaro Date: Fri Jan 3 14:33:25 2014 New Revision: 260228 URL: http://svnweb.freebsd.org/changeset/base/260228 Log: Remove useless register variable modifiers. Do some more style(9). MFC after: 2 weeks Modified: head/sys/net/radix.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Fri Jan 3 14:30:24 2014 (r260227) +++ head/sys/net/radix.c Fri Jan 3 14:33:25 2014 (r260228) @@ -148,12 +148,10 @@ static int rn_satisfies_leaf(char *trial * Search a node in the tree matching the key. */ static struct radix_node * -rn_search(v_arg, head) - void *v_arg; - struct radix_node *head; +rn_search(void *v_arg, struct radix_node *head) { - register struct radix_node *x; - register caddr_t v; + struct radix_node *x; + caddr_t v; for (x = head, v = v_arg; x->rn_bit >= 0;) { if (x->rn_bmask & v[x->rn_offset]) @@ -169,12 +167,10 @@ rn_search(v_arg, head) * XXX note this function is used only once. */ static struct radix_node * -rn_search_m(v_arg, head, m_arg) - struct radix_node *head; - void *v_arg, *m_arg; +rn_search_m(void *v_arg, struct radix_node *head, void *m_arg) { - register struct radix_node *x; - register caddr_t v = v_arg, m = m_arg; + struct radix_node *x; + caddr_t v = v_arg, m = m_arg; for (x = head; x->rn_bit >= 0;) { if ((x->rn_bmask & m[x->rn_offset]) && @@ -183,15 +179,14 @@ rn_search_m(v_arg, head, m_arg) else x = x->rn_left; } - return x; + return (x); } int -rn_refines(m_arg, n_arg) - void *m_arg, *n_arg; +rn_refines(void *m_arg, void *n_arg) { - register caddr_t m = m_arg, n = n_arg; - register caddr_t lim, lim2 = lim = n + LEN(n); + caddr_t m = m_arg, n = n_arg; + caddr_t lim, lim2 = lim = n + LEN(n); int longer = LEN(n++) - LEN(m++); int masks_are_equal = 1; @@ -199,26 +194,24 @@ rn_refines(m_arg, n_arg) lim -= longer; while (n < lim) { if (*n & ~(*m)) - return 0; + return (0); if (*n++ != *m++) masks_are_equal = 0; } while (n < lim2) if (*n++) - return 0; + return (0); if (masks_are_equal && (longer < 0)) for (lim2 = m - longer; m < lim2; ) if (*m++) - return 1; + return (1); return (!masks_are_equal); } struct radix_node * -rn_lookup(v_arg, m_arg, head) - void *v_arg, *m_arg; - struct radix_node_head *head; +rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) { - register struct radix_node *x; + struct radix_node *x; caddr_t netmask = 0; if (m_arg) { @@ -233,16 +226,13 @@ rn_lookup(v_arg, m_arg, head) while (x && x->rn_mask != netmask) x = x->rn_dupedkey; } - return x; + return (x); } static int -rn_satisfies_leaf(trial, leaf, skip) - char *trial; - register struct radix_node *leaf; - int skip; +rn_satisfies_leaf(char *trial, struct radix_node *leaf, int skip) { - register char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; + char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; char *cplim; int length = min(LEN(cp), LEN(cp2)); @@ -253,22 +243,20 @@ rn_satisfies_leaf(trial, leaf, skip) cplim = cp + length; cp3 += skip; cp2 += skip; for (cp += skip; cp < cplim; cp++, cp2++, cp3++) if ((*cp ^ *cp2) & *cp3) - return 0; - return 1; + return (0); + return (1); } struct radix_node * -rn_match(v_arg, head) - void *v_arg; - struct radix_node_head *head; +rn_match(void *v_arg, struct radix_node_head *head) { caddr_t v = v_arg; - register struct radix_node *t = head->rnh_treetop, *x; - register caddr_t cp = v, cp2; + struct radix_node *t = head->rnh_treetop, *x; + caddr_t cp = v, cp2; caddr_t cplim; struct radix_node *saved_t, *top = t; int off = t->rn_offset, vlen = LEN(cp), matched_off; - register int test, b, rn_bit; + int test, b, rn_bit; /* * Open code rn_search(v, top) to avoid overhead of extra @@ -306,7 +294,7 @@ rn_match(v_arg, head) */ if (t->rn_flags & RNF_ROOT) t = t->rn_dupedkey; - return t; + return (t); on1: test = (*cp ^ *cp2) & 0xff; /* find first bit that differs */ for (b = 7; (test >>= 1) > 0;) @@ -327,13 +315,13 @@ on1: */ if (t->rn_flags & RNF_NORMAL) { if (rn_bit <= t->rn_bit) - return t; + return (t); } else if (rn_satisfies_leaf(v, t, matched_off)) - return t; + return (t); t = saved_t; /* start searching up the tree */ do { - register struct radix_mask *m; + struct radix_mask *m; t = t->rn_parent; m = t->rn_mklist; /* @@ -352,12 +340,12 @@ on1: while (x && x->rn_mask != m->rm_mask) x = x->rn_dupedkey; if (x && rn_satisfies_leaf(v, x, off)) - return x; + return (x); } m = m->rm_mklist; } } while (t != top); - return 0; + return (0); } #ifdef RN_DEBUG @@ -379,12 +367,9 @@ int rn_debug = 1; */ static struct radix_node * -rn_newpair(v, b, nodes) - void *v; - int b; - struct radix_node nodes[2]; +rn_newpair(void *v, int b, struct radix_node nodes[2]) { - register struct radix_node *tt = nodes, *t = tt + 1; + struct radix_node *tt = nodes, *t = tt + 1; t->rn_bit = b; t->rn_bmask = 0x80 >> (b & 7); t->rn_left = tt; @@ -408,44 +393,39 @@ rn_newpair(v, b, nodes) tt->rn_ybro = rn_clist; rn_clist = tt; #endif - return t; + return (t); } static struct radix_node * -rn_insert(v_arg, head, dupentry, nodes) - void *v_arg; - struct radix_node_head *head; - int *dupentry; - struct radix_node nodes[2]; +rn_insert(void *v_arg, struct radix_node_head *head, int *dupentry, + struct radix_node nodes[2]) { caddr_t v = v_arg; struct radix_node *top = head->rnh_treetop; int head_off = top->rn_offset, vlen = LEN(v); - register struct radix_node *t = rn_search(v_arg, top); - register caddr_t cp = v + head_off; - register int b; - struct radix_node *tt; + struct radix_node *t = rn_search(v_arg, top); + caddr_t cp = v + head_off; + int b; + struct radix_node *p, *tt, *x; /* * Find first bit at which v and t->rn_key differ */ - { - register caddr_t cp2 = t->rn_key + head_off; - register int cmp_res; + caddr_t cp2 = t->rn_key + head_off; + int cmp_res; caddr_t cplim = v + vlen; while (cp < cplim) if (*cp2++ != *cp++) goto on1; *dupentry = 1; - return t; + return (t); on1: *dupentry = 0; cmp_res = (cp[-1] ^ cp2[-1]) & 0xff; for (b = (cp - v) << 3; cmp_res; b--) cmp_res >>= 1; - } - { - register struct radix_node *p, *x = top; + + x = top; cp = v; do { p = x; @@ -477,7 +457,6 @@ on1: if (rn_debug) log(LOG_DEBUG, "rn_insert: Coming Out:\n"), traverse(p); #endif - } return (tt); } @@ -554,29 +533,26 @@ rn_addmask(void *n_arg, struct radix_nod } static int /* XXX: arbitrary ordering for non-contiguous masks */ -rn_lexobetter(m_arg, n_arg) - void *m_arg, *n_arg; +rn_lexobetter(void *m_arg, void *n_arg) { - register u_char *mp = m_arg, *np = n_arg, *lim; + u_char *mp = m_arg, *np = n_arg, *lim; if (LEN(mp) > LEN(np)) - return 1; /* not really, but need to check longer one first */ + return (1); /* not really, but need to check longer one first */ if (LEN(mp) == LEN(np)) for (lim = mp + LEN(mp); mp < lim;) if (*mp++ > *np++) - return 1; - return 0; + return (1); + return (0); } static struct radix_mask * -rn_new_radix_mask(tt, next) - register struct radix_node *tt; - register struct radix_mask *next; +rn_new_radix_mask(struct radix_node *tt, struct radix_mask *next) { - register struct radix_mask *m; + struct radix_mask *m; R_Malloc(m, struct radix_mask *, sizeof (struct radix_mask)); - if (m == 0) { + if (m == NULL) { log(LOG_ERR, "Failed to allocate route mask\n"); return (0); } @@ -589,17 +565,15 @@ rn_new_radix_mask(tt, next) m->rm_mask = tt->rn_mask; m->rm_mklist = next; tt->rn_mklist = m; - return m; + return (m); } struct radix_node * -rn_addroute(v_arg, n_arg, head, treenodes) - void *v_arg, *n_arg; - struct radix_node_head *head; - struct radix_node treenodes[2]; +rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, + struct radix_node treenodes[2]) { caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg; - register struct radix_node *t, *x = 0, *tt; + struct radix_node *t, *x = 0, *tt; struct radix_node *saved_tt, *top = head->rnh_treetop; short b = 0, b_leaf = 0; int keyduplicated; @@ -727,7 +701,7 @@ rn_addroute(v_arg, n_arg, head, treenode on2: /* Add new route to highest possible ancestor's list */ if ((netmask == 0) || (b > t->rn_bit )) - return tt; /* can't lift at all */ + return (tt); /* can't lift at all */ b_leaf = tt->rn_bit; do { x = t; @@ -751,29 +725,27 @@ on2: log(LOG_ERR, "Non-unique normal route, mask not entered\n"); #endif - return tt; + return (tt); } } else mmask = m->rm_mask; if (mmask == netmask) { m->rm_refs++; tt->rn_mklist = m; - return tt; + return (tt); } if (rn_refines(netmask, mmask) || rn_lexobetter(netmask, mmask)) break; } *mp = rn_new_radix_mask(tt, *mp); - return tt; + return (tt); } struct radix_node * -rn_delete(v_arg, netmask_arg, head) - void *v_arg, *netmask_arg; - struct radix_node_head *head; +rn_delete(void *v_arg, void *netmask_arg, struct radix_node_head *head) { - register struct radix_node *t, *p, *x, *tt; + struct radix_node *t, *p, *x, *tt; struct radix_mask *m, *saved_m, **mp; struct radix_node *dupedkey, *saved_tt, *top; caddr_t v, netmask; @@ -807,7 +779,7 @@ rn_delete(v_arg, netmask_arg, head) if (tt->rn_flags & RNF_NORMAL) { if (m->rm_leaf != tt || m->rm_refs > 0) { log(LOG_ERR, "rn_delete: inconsistent annotation\n"); - return 0; /* dangling ref could cause disaster */ + return (0); /* dangling ref could cause disaster */ } } else { if (m->rm_mask != tt->rn_mask) { @@ -959,17 +931,14 @@ out: * exit. */ static int -rn_walktree_from(h, a, m, f, w) - struct radix_node_head *h; - void *a, *m; - walktree_f_t *f; - void *w; +rn_walktree_from(struct radix_node_head *h, void *a, void *m, + walktree_f_t *f, void *w) { int error; struct radix_node *base, *next; u_char *xa = (u_char *)a; u_char *xm = (u_char *)m; - register struct radix_node *rn, *last = 0 /* shut up gcc */; + struct radix_node *rn, *last = NULL; /* shut up gcc */ int stopping = 0; int lastb; @@ -1062,18 +1031,15 @@ rn_walktree_from(h, a, m, f, w) } } - return 0; + return (0); } static int -rn_walktree(h, f, w) - struct radix_node_head *h; - walktree_f_t *f; - void *w; +rn_walktree(struct radix_node_head *h, walktree_f_t *f, void *w) { int error; struct radix_node *base, *next; - register struct radix_node *rn = h->rnh_treetop; + struct radix_node *rn = h->rnh_treetop; /* * This gets complicated because we may delete the node * while applying the function f to it, so we need to calculate @@ -1118,8 +1084,8 @@ rn_walktree(h, f, w) static int rn_inithead_internal(void **head, int off) { - register struct radix_node_head *rnh; - register struct radix_node *t, *tt, *ttt; + struct radix_node_head *rnh; + struct radix_node *t, *tt, *ttt; if (*head) return (1); R_Zalloc(rnh, struct radix_node_head *, sizeof (*rnh)); From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 15:10:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17E7EF8A; Fri, 3 Jan 2014 15:10:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 032DD150C; Fri, 3 Jan 2014 15:10:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03FA1oi004632; Fri, 3 Jan 2014 15:10:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03FA0IV004549; Fri, 3 Jan 2014 15:10:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401031510.s03FA0IV004549@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Jan 2014 15:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260229 - in head/sys: fs/nfs fs/nfsserver rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 15:10:02 -0000 Author: mav Date: Fri Jan 3 15:09:59 2014 New Revision: 260229 URL: http://svnweb.freebsd.org/changeset/base/260229 Log: Rework NFS Duplicate Request Cache cleanup logic. - Introduce additional hash to group requests by hash of sockref. This allows to process TCP acknowledgements without looping though all the cache, and as result allows to do it every time. - Indroduce additional callbacks to notify application layer about sockets disconnection. Without this last few requests processed just before socket disconnection never processed their ACKs and stuck in cache for many hours. - Implement transport-specific method for tracking reply acknowledgements. New implementation does not cross multiple stack layers to get the data and does not have race conditions that previously made some requests stuck in cache. This could be done more efficiently at sockbuf layer, but that would broke some KBIs, while I don't know other consumers for it aside NFS. - Instead of traversing all DRC twice per request, run cleaning only once per request, and except in some conditions traverse only single hash slot at a time. Together this limits NFS DRC growth only to situations of real connectivity problems. If network is working well, and so all replies are acknowledged, cache remains almost empty even after hours of heavy load. Without this change on the same test cache was growing to many thousand requests even with perfectly working local network. As another result this reduces CPU time spent on the DRC handling during SPEC NFS benchmark from about 10% to 0.5%. Sponsored by: iXsystems, Inc. Modified: head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsrvcache.h head/sys/fs/nfsserver/nfs_nfsdcache.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdsubs.c head/sys/rpc/svc.c head/sys/rpc/svc.h head/sys/rpc/svc_dg.c head/sys/rpc/svc_vc.c Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfs/nfs_var.h Fri Jan 3 15:09:59 2014 (r260229) @@ -218,14 +218,14 @@ void nfsrvd_dorpc(struct nfsrv_descript /* nfs_nfsdcache.c */ void nfsrvd_initcache(void); -int nfsrvd_getcache(struct nfsrv_descript *, struct socket *); -struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *, - struct socket *); -void nfsrvd_sentcache(struct nfsrvcache *, struct socket *, int); +int nfsrvd_getcache(struct nfsrv_descript *); +struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *); +void nfsrvd_sentcache(struct nfsrvcache *, uint32_t); void nfsrvd_cleancache(void); void nfsrvd_refcache(struct nfsrvcache *); void nfsrvd_derefcache(struct nfsrvcache *); void nfsrvd_delcache(struct nfsrvcache *); +void nfsrc_trimcache(uint64_t, uint32_t, int); /* nfs_commonsubs.c */ void newnfs_init(void); @@ -327,9 +327,6 @@ int nfsd_checkrootexp(struct nfsrv_descr void nfscl_retopts(struct nfsmount *, char *, size_t); /* nfs_commonport.c */ -int nfsrv_checksockseqnum(struct socket *, tcp_seq); -int nfsrv_getsockseqnum(struct socket *, tcp_seq *); -int nfsrv_getsocksndseq(struct socket *, tcp_seq *, tcp_seq *); int nfsrv_lookupfilename(struct nameidata *, char *, NFSPROC_T *); void nfsrv_object_create(vnode_t, NFSPROC_T *); int nfsrv_mallocmget_limit(void); Modified: head/sys/fs/nfs/nfsrvcache.h ============================================================================== --- head/sys/fs/nfs/nfsrvcache.h Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfs/nfsrvcache.h Fri Jan 3 15:09:59 2014 (r260229) @@ -46,6 +46,7 @@ /* Cache table entry. */ struct nfsrvcache { LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */ + LIST_ENTRY(nfsrvcache) rc_ahash; /* ACK hash chain */ TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */ u_int32_t rc_xid; /* rpc id number */ time_t rc_timestamp; /* Time done */ @@ -64,6 +65,7 @@ struct nfsrvcache { int16_t refcnt; u_int16_t cksum; time_t cachetime; + int acked; } ot; } rc_un2; u_int16_t rc_proc; /* rpc proc number */ @@ -81,6 +83,13 @@ struct nfsrvcache { #define rc_reqlen rc_un2.ot.len #define rc_cksum rc_un2.ot.cksum #define rc_cachetime rc_un2.ot.cachetime +#define rc_acked rc_un2.ot.acked + +/* TCP ACK values */ +#define RC_NO_SEQ 0 +#define RC_NO_ACK 1 +#define RC_ACK 2 +#define RC_NACK 3 /* Return values */ #define RC_DROPIT 0 @@ -95,7 +104,6 @@ struct nfsrvcache { #define RC_UDP 0x0010 #define RC_INETIPV6 0x0020 #define RC_INPROG 0x0040 -#define RC_TCPSEQ 0x0080 #define RC_NFSV2 0x0100 #define RC_NFSV3 0x0200 #define RC_NFSV4 0x0400 Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdcache.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfsserver/nfs_nfsdcache.c Fri Jan 3 15:09:59 2014 (r260229) @@ -162,6 +162,7 @@ __FBSDID("$FreeBSD$"); extern struct nfsstats newnfsstats; extern struct mtx nfsrc_udpmtx; extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; +extern struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE]; int nfsrc_floodlevel = NFSRVCACHE_FLOODLEVEL, nfsrc_tcpsavedreplies = 0; #endif /* !APPLEKEXT */ @@ -238,6 +239,7 @@ static int newnfsv2_procid[NFS_V3NPROCS] (&nfsrvudphashtbl[nfsrc_hash(xid)]) #define NFSRCHASH(xid) \ (&nfsrchash_table[nfsrc_hash(xid)].tbl) +#define NFSRCAHASH(xid) (&nfsrcahash_table[nfsrc_hash(xid)]) #define TRUE 1 #define FALSE 0 #define NFSRVCACHE_CHECKLEN 100 @@ -281,9 +283,6 @@ static void nfsrc_lock(struct nfsrvcache static void nfsrc_unlock(struct nfsrvcache *rp); static void nfsrc_wanted(struct nfsrvcache *rp); static void nfsrc_freecache(struct nfsrvcache *rp); -static void nfsrc_trimcache(u_int64_t, struct socket *); -static int nfsrc_activesocket(struct nfsrvcache *rp, u_int64_t, - struct socket *); static int nfsrc_getlenandcksum(mbuf_t m1, u_int16_t *cksum); static void nfsrc_marksametcpconn(u_int64_t); @@ -314,6 +313,7 @@ nfsrvd_initcache(void) for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { LIST_INIT(&nfsrvudphashtbl[i]); LIST_INIT(&nfsrchash_table[i].tbl); + LIST_INIT(&nfsrcahash_table[i].tbl); } TAILQ_INIT(&nfsrvudplru); nfsrc_tcpsavedreplies = 0; @@ -325,10 +325,9 @@ nfsrvd_initcache(void) /* * Get a cache entry for this request. Basically just malloc a new one * and then call nfsrc_getudp() or nfsrc_gettcp() to do the rest. - * Call nfsrc_trimcache() to clean up the cache before returning. */ APPLESTATIC int -nfsrvd_getcache(struct nfsrv_descript *nd, struct socket *so) +nfsrvd_getcache(struct nfsrv_descript *nd) { struct nfsrvcache *newrp; int ret; @@ -356,7 +355,6 @@ nfsrvd_getcache(struct nfsrv_descript *n } else { ret = nfsrc_gettcp(nd, newrp); } - nfsrc_trimcache(nd->nd_sockref, so); NFSEXITCODE2(0, nd); return (ret); } @@ -456,7 +454,7 @@ out: * Update a request cache entry after the rpc has been done */ APPLESTATIC struct nfsrvcache * -nfsrvd_updatecache(struct nfsrv_descript *nd, struct socket *so) +nfsrvd_updatecache(struct nfsrv_descript *nd) { struct nfsrvcache *rp; struct nfsrvcache *retrp = NULL; @@ -549,7 +547,6 @@ nfsrvd_updatecache(struct nfsrv_descript } out: - nfsrc_trimcache(nd->nd_sockref, so); NFSEXITCODE2(0, nd); return (retrp); } @@ -575,30 +572,22 @@ nfsrvd_delcache(struct nfsrvcache *rp) /* * Called after nfsrvd_updatecache() once the reply is sent, to update - * the entry for nfsrc_activesocket() and unlock it. The argument is + * the entry's sequence number and unlock it. The argument is * the pointer returned by nfsrvd_updatecache(). */ APPLESTATIC void -nfsrvd_sentcache(struct nfsrvcache *rp, struct socket *so, int err) +nfsrvd_sentcache(struct nfsrvcache *rp, uint32_t seq) { - tcp_seq tmp_seq; - struct mtx *mutex; + struct nfsrchash_bucket *hbp; - mutex = nfsrc_cachemutex(rp); - if (!(rp->rc_flag & RC_LOCKED)) - panic("nfsrvd_sentcache not locked"); - if (!err) { - if ((so->so_proto->pr_domain->dom_family != AF_INET && - so->so_proto->pr_domain->dom_family != AF_INET6) || - so->so_proto->pr_protocol != IPPROTO_TCP) - panic("nfs sent cache"); - if (nfsrv_getsockseqnum(so, &tmp_seq)) { - mtx_lock(mutex); - rp->rc_tcpseq = tmp_seq; - rp->rc_flag |= RC_TCPSEQ; - mtx_unlock(mutex); - } - } + KASSERT(rp->rc_flag & RC_LOCKED, ("nfsrvd_sentcache not locked")); + hbp = NFSRCAHASH(rp->rc_sockref); + mtx_lock(&hbp->mtx); + rp->rc_tcpseq = seq; + if (rp->rc_acked != RC_NO_ACK) + LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash); + rp->rc_acked = RC_NO_ACK; + mtx_unlock(&hbp->mtx); nfsrc_unlock(rp); } @@ -790,11 +779,18 @@ nfsrc_wanted(struct nfsrvcache *rp) static void nfsrc_freecache(struct nfsrvcache *rp) { + struct nfsrchash_bucket *hbp; LIST_REMOVE(rp, rc_hash); if (rp->rc_flag & RC_UDP) { TAILQ_REMOVE(&nfsrvudplru, rp, rc_lru); nfsrc_udpcachesize--; + } else if (rp->rc_acked != RC_NO_SEQ) { + hbp = NFSRCAHASH(rp->rc_sockref); + mtx_lock(&hbp->mtx); + if (rp->rc_acked == RC_NO_ACK) + LIST_REMOVE(rp, rc_ahash); + mtx_unlock(&hbp->mtx); } nfsrc_wanted(rp); if (rp->rc_flag & RC_REPMBUF) { @@ -836,14 +832,32 @@ nfsrvd_cleancache(void) /* * The basic rule is to get rid of entries that are expired. */ -static void -nfsrc_trimcache(u_int64_t sockref, struct socket *so) +void +nfsrc_trimcache(u_int64_t sockref, uint32_t snd_una, int final) { + struct nfsrchash_bucket *hbp; struct nfsrvcache *rp, *nextrp; - int i, j, k, tto, time_histo[HISTSIZE]; + int force, lastslot, i, j, k, tto, time_histo[HISTSIZE]; time_t thisstamp; static time_t udp_lasttrim = 0, tcp_lasttrim = 0; - static int onethread = 0; + static int onethread = 0, oneslot = 0; + + if (sockref != 0) { + hbp = NFSRCAHASH(sockref); + mtx_lock(&hbp->mtx); + LIST_FOREACH_SAFE(rp, &hbp->tbl, rc_ahash, nextrp) { + if (sockref == rp->rc_sockref) { + if (SEQ_GEQ(snd_una, rp->rc_tcpseq)) { + rp->rc_acked = RC_ACK; + LIST_REMOVE(rp, rc_ahash); + } else if (final) { + rp->rc_acked = RC_NACK; + LIST_REMOVE(rp, rc_ahash); + } + } + } + mtx_unlock(&hbp->mtx); + } if (atomic_cmpset_acq_int(&onethread, 0, 1) == 0) return; @@ -864,13 +878,28 @@ nfsrc_trimcache(u_int64_t sockref, struc } if (NFSD_MONOSEC != tcp_lasttrim || nfsrc_tcpsavedreplies >= nfsrc_tcphighwater) { - for (i = 0; i < HISTSIZE; i++) - time_histo[i] = 0; + force = nfsrc_tcphighwater / 4; + if (force > 0 && + nfsrc_tcpsavedreplies + force >= nfsrc_tcphighwater) { + for (i = 0; i < HISTSIZE; i++) + time_histo[i] = 0; + i = 0; + lastslot = NFSRVCACHE_HASHSIZE; + } else { + force = 0; + if (NFSD_MONOSEC != tcp_lasttrim) { + i = 0; + lastslot = NFSRVCACHE_HASHSIZE - 1; + } else { + lastslot = i = oneslot; + if (++oneslot >= NFSRVCACHE_HASHSIZE) + oneslot = 0; + } + } tto = nfsrc_tcptimeout; - for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { + tcp_lasttrim = NFSD_MONOSEC; + for (; i <= lastslot; i++) { mtx_lock(&nfsrchash_table[i].mtx); - if (i == 0) - tcp_lasttrim = NFSD_MONOSEC; LIST_FOREACH_SAFE(rp, &nfsrchash_table[i].tbl, rc_hash, nextrp) { if (!(rp->rc_flag & @@ -878,12 +907,12 @@ nfsrc_trimcache(u_int64_t sockref, struc && rp->rc_refcnt == 0) { if ((rp->rc_flag & RC_REFCNT) || tcp_lasttrim > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, so)) { + rp->rc_acked == RC_ACK) { nfsrc_freecache(rp); continue; } - if (nfsrc_tcphighwater == 0) + if (force == 0) continue; /* * The timestamps range from roughly the @@ -903,8 +932,7 @@ nfsrc_trimcache(u_int64_t sockref, struc } mtx_unlock(&nfsrchash_table[i].mtx); } - j = nfsrc_tcphighwater / 5; /* 20% of it */ - if (j > 0 && (nfsrc_tcpsavedreplies + j) > nfsrc_tcphighwater) { + if (force) { /* * Trim some more with a smaller timeout of as little * as 20% of nfsrc_tcptimeout to try and get below @@ -913,7 +941,7 @@ nfsrc_trimcache(u_int64_t sockref, struc k = 0; for (i = 0; i < (HISTSIZE - 2); i++) { k += time_histo[i]; - if (k > j) + if (k > force) break; } k = tto * (i + 1) / HISTSIZE; @@ -929,8 +957,7 @@ nfsrc_trimcache(u_int64_t sockref, struc && rp->rc_refcnt == 0 && ((rp->rc_flag & RC_REFCNT) || thisstamp > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, - so))) + rp->rc_acked == RC_ACK)) nfsrc_freecache(rp); } mtx_unlock(&nfsrchash_table[i].mtx); @@ -975,28 +1002,6 @@ nfsrvd_derefcache(struct nfsrvcache *rp) } /* - * Check to see if the socket is active. - * Return 1 if the reply has been received/acknowledged by the client, - * 0 otherwise. - * XXX - Uses tcp internals. - */ -static int -nfsrc_activesocket(struct nfsrvcache *rp, u_int64_t cur_sockref, - struct socket *cur_so) -{ - int ret = 0; - - if (!(rp->rc_flag & RC_TCPSEQ)) - return (ret); - /* - * If the sockref is the same, it is the same TCP connection. - */ - if (cur_sockref == rp->rc_sockref) - ret = nfsrv_checksockseqnum(cur_so, rp->rc_tcpseq); - return (ret); -} - -/* * Calculate the length of the mbuf list and a checksum on the first up to * NFSRVCACHE_CHECKLEN bytes. */ Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Fri Jan 3 15:09:59 2014 (r260229) @@ -97,8 +97,8 @@ static int nfs_maxvers = NFS_VER4; SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, &nfs_maxvers, 0, "The highest version of NFS handled by the server"); -static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, - u_int64_t, struct nfsrvcache **); +static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt, + struct nfsrvcache **); extern u_long sb_max_adj; extern int newnfs_numnfsd; @@ -251,8 +251,7 @@ nfssvc_program(struct svc_req *rqst, SVC } } - cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, - xprt->xp_sockref, &rp); + cacherep = nfs_proc(&nd, rqst->rq_xid, xprt, &rp); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsd_suspend_lock); NFSUNLOCKV4ROOTMUTEX(); @@ -287,8 +286,10 @@ nfssvc_program(struct svc_req *rqst, SVC } else if (!svc_sendreply_mbuf(rqst, nd.nd_mreq)) { svcerr_systemerr(rqst); } - if (rp != NULL) - nfsrvd_sentcache(rp, xprt->xp_socket, 0); + if (rp != NULL) { + if (rqst->rq_reply_seq != 0 || SVC_ACK(xprt, NULL)) + nfsrvd_sentcache(rp, rqst->rq_reply_seq); + } svc_freereq(rqst); out: @@ -300,11 +301,12 @@ out: * Return the appropriate cache response. */ static int -nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, struct socket *so, - u_int64_t sockref, struct nfsrvcache **rpp) +nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVCXPRT *xprt, + struct nfsrvcache **rpp) { struct thread *td = curthread; int cacherep = RC_DOIT, isdgram; + uint32_t ack; *rpp = NULL; if (nd->nd_nam2 == NULL) { @@ -336,8 +338,11 @@ nfs_proc(struct nfsrv_descript *nd, u_in nd->nd_flag |= ND_SAMETCPCONN; nd->nd_retxid = xid; nd->nd_tcpconntime = NFSD_MONOSEC; - nd->nd_sockref = sockref; - cacherep = nfsrvd_getcache(nd, so); + nd->nd_sockref = xprt->xp_sockref; + cacherep = nfsrvd_getcache(nd); + ack = 0; + SVC_ACK(xprt, &ack); + nfsrc_trimcache(xprt->xp_sockref, ack, 0); } /* @@ -352,13 +357,23 @@ nfs_proc(struct nfsrv_descript *nd, u_in cacherep = RC_DROPIT; else cacherep = RC_REPLY; - *rpp = nfsrvd_updatecache(nd, so); + *rpp = nfsrvd_updatecache(nd); } NFSEXITCODE2(0, nd); return (cacherep); } +static void +nfssvc_loss(SVCXPRT *xprt) +{ + uint32_t ack; + + ack = 0; + SVC_ACK(xprt, &ack); + nfsrc_trimcache(xprt->xp_sockref, ack, 1); +} + /* * Adds a socket to the list for servicing by nfsds. */ @@ -399,6 +414,8 @@ nfsrvd_addsock(struct file *fp) if (nfs_maxvers >= NFS_VER4) svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); + if (so->so_type == SOCK_STREAM) + svc_loss_reg(xprt, nfssvc_loss); SVC_RELEASE(xprt); } Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Jan 3 15:09:59 2014 (r260229) @@ -61,6 +61,7 @@ extern struct nfsv4lock nfsd_suspend_loc struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; +struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE]; struct mtx nfsrc_udpmtx; struct mtx nfs_v4root_mutex; struct nfsrvfh nfs_rootfh, nfs_pubfh; @@ -2881,40 +2882,6 @@ out: } /* - * Get the tcp socket sequence numbers we need. - * (Maybe this should be moved to the tcp sources?) - */ -int -nfsrv_getsocksndseq(struct socket *so, tcp_seq *maxp, tcp_seq *unap) -{ - struct inpcb *inp; - struct tcpcb *tp; - int error = 0; - - inp = sotoinpcb(so); - KASSERT(inp != NULL, ("nfsrv_getsocksndseq: inp == NULL")); - INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { - INP_RUNLOCK(inp); - error = EPIPE; - goto out; - } - tp = intotcpcb(inp); - if (tp->t_state != TCPS_ESTABLISHED) { - INP_RUNLOCK(inp); - error = EPIPE; - goto out; - } - *maxp = tp->snd_max; - *unap = tp->snd_una; - INP_RUNLOCK(inp); - -out: - NFSEXITCODE(error); - return (error); -} - -/* * This function needs to test to see if the system is near its limit * for memory allocation via malloc() or mget() and return True iff * either of these resources are near their limit. @@ -3340,6 +3307,11 @@ nfsd_modevent(module_t mod, int type, vo i); mtx_init(&nfsrchash_table[i].mtx, nfsrchash_table[i].lock_name, NULL, MTX_DEF); + snprintf(nfsrcahash_table[i].lock_name, + sizeof(nfsrcahash_table[i].lock_name), "nfsrc_tcpa%d", + i); + mtx_init(&nfsrcahash_table[i].mtx, + nfsrcahash_table[i].lock_name, NULL, MTX_DEF); } mtx_init(&nfsrc_udpmtx, "nfs_udpcache_mutex", NULL, MTX_DEF); mtx_init(&nfs_v4root_mutex, "nfs_v4root_mutex", NULL, MTX_DEF); @@ -3385,8 +3357,10 @@ nfsd_modevent(module_t mod, int type, vo svcpool_destroy(nfsrvd_pool); /* and get rid of the locks */ - for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { mtx_destroy(&nfsrchash_table[i].mtx); + mtx_destroy(&nfsrcahash_table[i].mtx); + } mtx_destroy(&nfsrc_udpmtx); mtx_destroy(&nfs_v4root_mutex); mtx_destroy(&nfsv4root_mnt.mnt_mtx); Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsubs.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/fs/nfsserver/nfs_nfsdsubs.c Fri Jan 3 15:09:59 2014 (r260229) @@ -1987,47 +1987,6 @@ nfsmout: return (error); } -/* - * Check the tcp socket sequence number has been acknowledged. - */ -int -nfsrv_checksockseqnum(struct socket *so, tcp_seq tcpseqval) -{ - tcp_seq maxseq, unaseq; - int error, ret; - - error = nfsrv_getsocksndseq(so, &maxseq, &unaseq); - if (error) - return (0); - ret = SEQ_GEQ(unaseq, tcpseqval); - return (ret); -} - -/* - * Get the tcp sequence number to be acknowledged. - */ -int -nfsrv_getsockseqnum(struct socket *so, tcp_seq *tcpseqp) -{ - tcp_seq maxseq, unaseq; - u_int sbcc; - int error; - - sbcc = so->so_snd.sb_cc; - error = nfsrv_getsocksndseq(so, &maxseq, &unaseq); - if (error) - return (0); - /* - * Set the seq# to a value that will - * be at least the end of the reply. - * When this sequence# is acknowledged - * by the client, the client has received - * the reply. - */ - *tcpseqp = sbcc + maxseq; - return (1); -} - void nfsd_init(void) { Modified: head/sys/rpc/svc.c ============================================================================== --- head/sys/rpc/svc.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/rpc/svc.c Fri Jan 3 15:09:59 2014 (r260229) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -93,6 +94,7 @@ svcpool_create(const char *name, struct TAILQ_INIT(&pool->sp_xlist); TAILQ_INIT(&pool->sp_active); TAILQ_INIT(&pool->sp_callouts); + TAILQ_INIT(&pool->sp_lcallouts); LIST_INIT(&pool->sp_threads); LIST_INIT(&pool->sp_idlethreads); pool->sp_minthreads = 1; @@ -158,6 +160,7 @@ svcpool_destroy(SVCPOOL *pool) { SVCXPRT *xprt, *nxprt; struct svc_callout *s; + struct svc_loss_callout *sl; struct svcxprt_list cleanup; TAILQ_INIT(&cleanup); @@ -169,12 +172,16 @@ svcpool_destroy(SVCPOOL *pool) TAILQ_INSERT_TAIL(&cleanup, xprt, xp_link); } - while (TAILQ_FIRST(&pool->sp_callouts)) { - s = TAILQ_FIRST(&pool->sp_callouts); + while ((s = TAILQ_FIRST(&pool->sp_callouts)) != NULL) { mtx_unlock(&pool->sp_lock); svc_unreg(pool, s->sc_prog, s->sc_vers); mtx_lock(&pool->sp_lock); } + while ((sl = TAILQ_FIRST(&pool->sp_lcallouts)) != NULL) { + mtx_unlock(&pool->sp_lock); + svc_loss_unreg(pool, sl->slc_dispatch); + mtx_lock(&pool->sp_lock); + } mtx_unlock(&pool->sp_lock); TAILQ_FOREACH_SAFE(xprt, &cleanup, xp_link, nxprt) { @@ -511,6 +518,55 @@ svc_unreg(SVCPOOL *pool, const rpcprog_t mtx_unlock(&pool->sp_lock); } +/* + * Add a service connection loss program to the callout list. + * The dispatch routine will be called when some port in ths pool die. + */ +bool_t +svc_loss_reg(SVCXPRT *xprt, void (*dispatch)(SVCXPRT *)) +{ + SVCPOOL *pool = xprt->xp_pool; + struct svc_loss_callout *s; + + mtx_lock(&pool->sp_lock); + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) { + if (s->slc_dispatch == dispatch) + break; + } + if (s != NULL) { + mtx_unlock(&pool->sp_lock); + return (TRUE); + } + s = malloc(sizeof (struct svc_callout), M_RPC, M_NOWAIT); + if (s == NULL) { + mtx_unlock(&pool->sp_lock); + return (FALSE); + } + s->slc_dispatch = dispatch; + TAILQ_INSERT_TAIL(&pool->sp_lcallouts, s, slc_link); + mtx_unlock(&pool->sp_lock); + return (TRUE); +} + +/* + * Remove a service connection loss program from the callout list. + */ +void +svc_loss_unreg(SVCPOOL *pool, void (*dispatch)(SVCXPRT *)) +{ + struct svc_loss_callout *s; + + mtx_lock(&pool->sp_lock); + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) { + if (s->slc_dispatch == dispatch) { + TAILQ_REMOVE(&pool->sp_lcallouts, s, slc_link); + free(s, M_RPC); + break; + } + } + mtx_unlock(&pool->sp_lock); +} + /* ********************** CALLOUT list related stuff ************* */ /* @@ -554,7 +610,7 @@ svc_sendreply_common(struct svc_req *rqs if (!SVCAUTH_WRAP(&rqstp->rq_auth, &body)) return (FALSE); - ok = SVC_REPLY(xprt, rply, rqstp->rq_addr, body); + ok = SVC_REPLY(xprt, rply, rqstp->rq_addr, body, &rqstp->rq_reply_seq); if (rqstp->rq_addr) { free(rqstp->rq_addr, M_SONAME); rqstp->rq_addr = NULL; @@ -803,6 +859,7 @@ svc_getreq(SVCXPRT *xprt, struct svc_req struct svc_req *r; struct rpc_msg msg; struct mbuf *args; + struct svc_loss_callout *s; enum xprt_stat stat; /* now receive msgs from xprtprt (support batch calls) */ @@ -831,7 +888,7 @@ svc_getreq(SVCXPRT *xprt, struct svc_req break; case RS_DONE: SVC_REPLY(xprt, &repmsg, r->rq_addr, - repbody); + repbody, &r->rq_reply_seq); if (r->rq_addr) { free(r->rq_addr, M_SONAME); r->rq_addr = NULL; @@ -881,6 +938,8 @@ call_done: r = NULL; } if ((stat = SVC_STAT(xprt)) == XPRT_DIED) { + TAILQ_FOREACH(s, &pool->sp_lcallouts, slc_link) + (*s->slc_dispatch)(xprt); xprt_unregister(xprt); } Modified: head/sys/rpc/svc.h ============================================================================== --- head/sys/rpc/svc.h Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/rpc/svc.h Fri Jan 3 15:09:59 2014 (r260229) @@ -103,9 +103,11 @@ struct xp_ops { struct sockaddr **, struct mbuf **); /* get transport status */ enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *); + /* get transport acknowledge sequence */ + bool_t (*xp_ack)(struct __rpc_svcxprt *, uint32_t *); /* send reply */ bool_t (*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); /* destroy this struct */ void (*xp_destroy)(struct __rpc_svcxprt *); /* catch-all function */ @@ -166,6 +168,8 @@ typedef struct __rpc_svcxprt { time_t xp_lastactive; /* time of last RPC */ u_int64_t xp_sockref; /* set by nfsv4 to identify socket */ int xp_upcallset; /* socket upcall is set up */ + uint32_t xp_snd_cnt; /* # of bytes sent to socket */ + struct sx xp_snd_lock; /* protects xp_snd_cnt & sb_cc */ #else int xp_fd; u_short xp_port; /* associated port number */ @@ -230,6 +234,17 @@ struct svc_callout { }; TAILQ_HEAD(svc_callout_list, svc_callout); +/* + * The services connection loss list + * The dispatch routine takes request structs and runs the + * apropriate procedure. + */ +struct svc_loss_callout { + TAILQ_ENTRY(svc_loss_callout) slc_link; + void (*slc_dispatch)(SVCXPRT *); +}; +TAILQ_HEAD(svc_loss_callout_list, svc_loss_callout); + struct __rpc_svcthread; /* @@ -253,6 +268,7 @@ struct svc_req { void *rq_p1; /* application workspace */ int rq_p2; /* application workspace */ uint64_t rq_p3; /* application workspace */ + uint32_t rq_reply_seq; /* reply socket sequence # */ char rq_credarea[3*MAX_AUTH_BYTES]; }; STAILQ_HEAD(svc_reqlist, svc_req); @@ -318,6 +334,7 @@ typedef struct __rpc_svcpool { struct svcxprt_list sp_xlist; /* all transports in the pool */ struct svcxprt_list sp_active; /* transports needing service */ struct svc_callout_list sp_callouts; /* (prog,vers)->dispatch list */ + struct svc_loss_callout_list sp_lcallouts; /* loss->dispatch list */ struct svcthread_list sp_threads; /* service threads */ struct svcthread_list sp_idlethreads; /* idle service threads */ int sp_minthreads; /* minimum service thread count */ @@ -393,8 +410,12 @@ struct svc_req { #define SVC_STAT(xprt) \ (*(xprt)->xp_ops->xp_stat)(xprt) -#define SVC_REPLY(xprt, msg, addr, m) \ - (*(xprt)->xp_ops->xp_reply) ((xprt), (msg), (addr), (m)) +#define SVC_ACK(xprt, ack) \ + ((xprt)->xp_ops->xp_stat == NULL ? FALSE : \ + ((ack) == NULL ? TRUE : (*(xprt)->xp_ops->xp_ack)((xprt), (ack)))) + +#define SVC_REPLY(xprt, msg, addr, m, seq) \ + (*(xprt)->xp_ops->xp_reply) ((xprt), (msg), (addr), (m), (seq)) #define SVC_DESTROY(xprt) \ (*(xprt)->xp_ops->xp_destroy)(xprt) @@ -496,6 +517,30 @@ extern void svc_unreg(const rpcprog_t, c __END_DECLS /* + * Service connection loss registration + * + * svc_loss_reg(xprt, dispatch) + * const SVCXPRT *xprt; + * const void (*dispatch)(); + */ + +__BEGIN_DECLS +extern bool_t svc_loss_reg(SVCXPRT *, void (*)(SVCXPRT *)); +__END_DECLS + +/* + * Service connection loss un-registration + * + * svc_loss_unreg(xprt, dispatch) + * const SVCXPRT *xprt; + * const void (*dispatch)(); + */ + +__BEGIN_DECLS +extern void svc_loss_unreg(SVCPOOL *, void (*)(SVCXPRT *)); +__END_DECLS + +/* * Transport registration. * * xprt_register(xprt) Modified: head/sys/rpc/svc_dg.c ============================================================================== --- head/sys/rpc/svc_dg.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/rpc/svc_dg.c Fri Jan 3 15:09:59 2014 (r260229) @@ -66,7 +66,7 @@ static enum xprt_stat svc_dg_stat(SVCXPR static bool_t svc_dg_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_dg_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); static void svc_dg_destroy(SVCXPRT *); static bool_t svc_dg_control(SVCXPRT *, const u_int, void *); static int svc_dg_soupcall(struct socket *so, void *arg, int waitflag); @@ -230,7 +230,7 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms static bool_t svc_dg_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { XDR xdrs; struct mbuf *mrep; Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Fri Jan 3 14:33:25 2014 (r260228) +++ head/sys/rpc/svc_vc.c Fri Jan 3 15:09:59 2014 (r260229) @@ -76,10 +76,11 @@ static void svc_vc_rendezvous_destroy(SV static bool_t svc_vc_null(void); static void svc_vc_destroy(SVCXPRT *); static enum xprt_stat svc_vc_stat(SVCXPRT *); +static bool_t svc_vc_ack(SVCXPRT *, uint32_t *); static bool_t svc_vc_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_vc_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *seq); static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in); static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq, void *in); @@ -88,7 +89,7 @@ static enum xprt_stat svc_vc_backchannel static bool_t svc_vc_backchannel_recv(SVCXPRT *, struct rpc_msg *, struct sockaddr **, struct mbuf **); static bool_t svc_vc_backchannel_reply(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *); + struct sockaddr *, struct mbuf *, uint32_t *); static bool_t svc_vc_backchannel_control(SVCXPRT *xprt, const u_int rq, void *in); static SVCXPRT *svc_vc_create_conn(SVCPOOL *pool, struct socket *so, @@ -100,7 +101,7 @@ static struct xp_ops svc_vc_rendezvous_o .xp_recv = svc_vc_rendezvous_recv, .xp_stat = svc_vc_rendezvous_stat, .xp_reply = (bool_t (*)(SVCXPRT *, struct rpc_msg *, - struct sockaddr *, struct mbuf *))svc_vc_null, + struct sockaddr *, struct mbuf *, uint32_t *))svc_vc_null, .xp_destroy = svc_vc_rendezvous_destroy, .xp_control = svc_vc_rendezvous_control }; @@ -108,6 +109,7 @@ static struct xp_ops svc_vc_rendezvous_o static struct xp_ops svc_vc_ops = { .xp_recv = svc_vc_recv, .xp_stat = svc_vc_stat, + .xp_ack = svc_vc_ack, .xp_reply = svc_vc_reply, .xp_destroy = svc_vc_destroy, .xp_control = svc_vc_control @@ -159,6 +161,7 @@ svc_vc_create(SVCPOOL *pool, struct sock xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); + sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = NULL; @@ -184,8 +187,11 @@ svc_vc_create(SVCPOOL *pool, struct sock return (xprt); cleanup_svc_vc_create: - if (xprt) + if (xprt) { + sx_destroy(&xprt->xp_snd_lock); + sx_destroy(&xprt->xp_lock); svc_xprt_free(xprt); + } return (NULL); } @@ -231,6 +237,7 @@ svc_vc_create_conn(SVCPOOL *pool, struct xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); + sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = cd; @@ -270,7 +277,9 @@ svc_vc_create_conn(SVCPOOL *pool, struct return (xprt); cleanup_svc_vc_create: if (xprt) { - mem_free(xprt, sizeof(*xprt)); + sx_destroy(&xprt->xp_snd_lock); + sx_destroy(&xprt->xp_lock); + svc_xprt_free(xprt); } if (cd) mem_free(cd, sizeof(*cd)); @@ -291,6 +300,7 @@ svc_vc_create_backchannel(SVCPOOL *pool) xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); + sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = NULL; xprt->xp_p1 = cd; @@ -451,7 +461,6 @@ svc_vc_destroy_common(SVCXPRT *xprt) } SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv); - sx_destroy(&xprt->xp_lock); if (xprt->xp_socket) (void)soclose(xprt->xp_socket); @@ -537,6 +546,16 @@ svc_vc_stat(SVCXPRT *xprt) return (XPRT_IDLE); } +static bool_t +svc_vc_ack(SVCXPRT *xprt, uint32_t *ack) +{ + + sx_slock(&xprt->xp_snd_lock); + *ack = xprt->xp_snd_cnt - xprt->xp_socket->so_snd.sb_cc; + sx_sunlock(&xprt->xp_snd_lock); + return (TRUE); +} + static enum xprt_stat svc_vc_backchannel_stat(SVCXPRT *xprt) { @@ -785,12 +804,12 @@ svc_vc_backchannel_recv(SVCXPRT *xprt, s static bool_t svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { XDR xdrs; struct mbuf *mrep; bool_t stat = TRUE; - int error; + int error, len; /* * Leave space for record mark. @@ -817,14 +836,19 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m * Prepend a record marker containing the reply length. */ M_PREPEND(mrep, sizeof(uint32_t), M_WAITOK); + len = mrep->m_pkthdr.len; *mtod(mrep, uint32_t *) = - htonl(0x80000000 | (mrep->m_pkthdr.len - - sizeof(uint32_t))); + htonl(0x80000000 | (len - sizeof(uint32_t))); + sx_xlock(&xprt->xp_snd_lock); error = sosend(xprt->xp_socket, NULL, NULL, mrep, NULL, 0, curthread); if (!error) { + xprt->xp_snd_cnt += len; + if (seq) + *seq = xprt->xp_snd_cnt; stat = TRUE; } + sx_xunlock(&xprt->xp_snd_lock); } else { m_freem(mrep); } @@ -837,7 +861,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m static bool_t svc_vc_backchannel_reply(SVCXPRT *xprt, struct rpc_msg *msg, - struct sockaddr *addr, struct mbuf *m) + struct sockaddr *addr, struct mbuf *m, uint32_t *seq) { struct ct_data *ct; XDR xdrs; From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 16:34:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2098AC3F; Fri, 3 Jan 2014 16:34: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 0CE951CC1; Fri, 3 Jan 2014 16:34: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 s03GYG2e040704; Fri, 3 Jan 2014 16:34:16 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03GYGu1040703; Fri, 3 Jan 2014 16:34:16 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201401031634.s03GYGu1040703@svn.freebsd.org> From: Mateusz Guzik Date: Fri, 3 Jan 2014 16:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260232 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 16:34:17 -0000 Author: mjg Date: Fri Jan 3 16:34:16 2014 New Revision: 260232 URL: http://svnweb.freebsd.org/changeset/base/260232 Log: 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. MFC after: 3 days Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jan 3 15:55:20 2014 (r260231) +++ head/sys/kern/kern_descrip.c Fri Jan 3 16:34:16 2014 (r260232) @@ -1481,18 +1481,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-head@FreeBSD.ORG Fri Jan 3 16:36:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C658E2A; Fri, 3 Jan 2014 16:36: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 58C901CFF; Fri, 3 Jan 2014 16:36: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 s03GauW1041017; Fri, 3 Jan 2014 16:36:56 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03GauoU041016; Fri, 3 Jan 2014 16:36:56 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201401031636.s03GauoU041016@svn.freebsd.org> From: Mateusz Guzik Date: Fri, 3 Jan 2014 16:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260233 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 16:36:56 -0000 Author: mjg Date: Fri Jan 3 16:36:55 2014 New Revision: 260233 URL: http://svnweb.freebsd.org/changeset/base/260233 Log: Plug a memory leak in dup2 when both old and new fd have ioctl caps. Reviewed by: pjd MFC after: 3 days Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jan 3 16:34:16 2014 (r260232) +++ head/sys/kern/kern_descrip.c Fri Jan 3 16:36:55 2014 (r260233) @@ -878,6 +878,7 @@ do_dup(struct thread *td, int flags, int /* * Duplicate the source descriptor. */ + filecaps_free(&newfde->fde_caps); *newfde = *oldfde; filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); if ((flags & DUP_CLOEXEC) != 0) From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 16:49:23 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1442449C; Fri, 3 Jan 2014 16:49:23 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D92601DF4; Fri, 3 Jan 2014 16:49:22 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Vz7vv-000EEW-Pt; Fri, 03 Jan 2014 16:49:16 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s03GnC0v024082; Fri, 3 Jan 2014 09:49:12 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+dLp8pL+a/+RbvGe/Xl5S/ Subject: Re: svn commit: r260165 - head/sys/dev/ahci From: Ian Lepore To: Konstantin Belousov In-Reply-To: <20140101203212.GF59496@kib.kiev.ua> References: <201401012026.s01KQ8KU017949@svn.freebsd.org> <20140101203212.GF59496@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" Date: Fri, 03 Jan 2014 09:49:12 -0700 Message-ID: <1388767752.1158.264.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Zbigniew Bodek , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 16:49:23 -0000 On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote: > On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: > > Author: zbb > > Date: Wed Jan 1 20:26:08 2014 > > New Revision: 260165 > > URL: http://svnweb.freebsd.org/changeset/base/260165 > > > > Log: > > Use only mapped BIOs on ARM > > > > Using unmapped BIOs causes failure inside bus_dmamap_sync, since > > this function requires valid MVA address, which is not present > > if mapping is not set up. > > > > Submitted by: Wojciech Macek > > Obtained from: Semihalf > > > > Modified: > > head/sys/dev/ahci/ahci.c > > > > Modified: head/sys/dev/ahci/ahci.c > > ============================================================================== > > --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) > > +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc > > if (ch->caps & AHCI_CAP_SPM) > > cpi->hba_inquiry |= PI_SATAPM; > > cpi->target_sprt = 0; > > +#ifdef __arm__ > > + /* > > + * Do not use unmapped buffers on ARM. Doing so will cause > > + * failure inside bus_dmamap_sync due to lack of VA. > > + */ > > + cpi->hba_misc = PIM_SEQSCAN; > > +#else > > cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; > > +#endif > > cpi->hba_eng_cnt = 0; > > if (ch->caps & AHCI_CAP_SPM) > > cpi->max_target = 15; > > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm, > then unmapped io should be disabled on arm unconditionally, using > unmapped_buf_allowed. Why ahci(4) is special in this regard, leaving > other controllers broken for arm ? I think this entire concept is wrong, and the fix should be in armv6 busdma or pmap code. An unmapped page is, by definition, not cached. The only way data becomes cached is because flags in a mapping indicated the memory is cacheable. If we have data from unmapped pages in the cache, that's a bug in the armv6 pmap implementation, I think. -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 18:08:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7FBDCFC; Fri, 3 Jan 2014 18:08:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B3E691445; Fri, 3 Jan 2014 18:08:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03I8Vsh075323; Fri, 3 Jan 2014 18:08:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03I8V5a075322; Fri, 3 Jan 2014 18:08:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401031808.s03I8V5a075322@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Jan 2014 18:08:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260234 - head/sys/cddl/compat/opensolaris/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 18:08:31 -0000 Author: mav Date: Fri Jan 3 18:08:31 2014 New Revision: 260234 URL: http://svnweb.freebsd.org/changeset/base/260234 Log: Remove extra conversion to nanoseconds from ddi_get_lbolt64(). As result this uses one multiplication and shifts instead of one division and two multiplications. Modified: head/sys/cddl/compat/opensolaris/sys/time.h Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Fri Jan 3 16:36:55 2014 (r260233) +++ head/sys/cddl/compat/opensolaris/sys/time.h Fri Jan 3 18:08:31 2014 (r260234) @@ -70,12 +70,13 @@ gethrtime(void) { #define gethrtime_waitfree() gethrtime() extern int nsec_per_tick; /* nanoseconds per clock tick */ +extern int hz; /* clock ticks per second */ static __inline int64_t ddi_get_lbolt64(void) { - return (gethrtime() / nsec_per_tick); + return (((getsbinuptime() >> 16) * hz) >> 16); } static __inline clock_t From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 18:22:07 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D9C2411; Fri, 3 Jan 2014 18:22:07 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 94CA715CC; Fri, 3 Jan 2014 18:22:05 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s03ILxq6092682; Fri, 3 Jan 2014 20:21:59 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s03ILxq6092682 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s03ILxTB092681; Fri, 3 Jan 2014 20:21:59 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 3 Jan 2014 20:21:59 +0200 From: Konstantin Belousov To: Ian Lepore Subject: Re: svn commit: r260165 - head/sys/dev/ahci Message-ID: <20140103182159.GR59496@kib.kiev.ua> References: <201401012026.s01KQ8KU017949@svn.freebsd.org> <20140101203212.GF59496@kib.kiev.ua> <1388767752.1158.264.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Gx6yhVhPSPzNJpj4" Content-Disposition: inline In-Reply-To: <1388767752.1158.264.camel@revolution.hippie.lan> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Zbigniew Bodek , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 18:22:07 -0000 --Gx6yhVhPSPzNJpj4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote: > On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote: > > On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: > > > Author: zbb > > > Date: Wed Jan 1 20:26:08 2014 > > > New Revision: 260165 > > > URL: http://svnweb.freebsd.org/changeset/base/260165 > > >=20 > > > Log: > > > Use only mapped BIOs on ARM > > > =20 > > > Using unmapped BIOs causes failure inside bus_dmamap_sync, since > > > this function requires valid MVA address, which is not present > > > if mapping is not set up. > > > =20 > > > Submitted by: Wojciech Macek > > > Obtained from: Semihalf > > >=20 > > > Modified: > > > head/sys/dev/ahci/ahci.c > > >=20 > > > Modified: head/sys/dev/ahci/ahci.c > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) > > > +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) > > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc > > > if (ch->caps & AHCI_CAP_SPM) > > > cpi->hba_inquiry |=3D PI_SATAPM; > > > cpi->target_sprt =3D 0; > > > +#ifdef __arm__ > > > + /* > > > + * Do not use unmapped buffers on ARM. Doing so will cause > > > + * failure inside bus_dmamap_sync due to lack of VA. > > > + */ > > > + cpi->hba_misc =3D PIM_SEQSCAN; > > > +#else > > > cpi->hba_misc =3D PIM_SEQSCAN | PIM_UNMAPPED; > > > +#endif > > > cpi->hba_eng_cnt =3D 0; > > > if (ch->caps & AHCI_CAP_SPM) > > > cpi->max_target =3D 15; > >=20 > > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm, > > then unmapped io should be disabled on arm unconditionally, using > > unmapped_buf_allowed. Why ahci(4) is special in this regard, leaving > > other controllers broken for arm ? >=20 > I think this entire concept is wrong, and the fix should be in armv6 > busdma or pmap code. An unmapped page is, by definition, not cached. > The only way data becomes cached is because flags in a mapping indicated > the memory is cacheable. If we have data from unmapped pages in the > cache, that's a bug in the armv6 pmap implementation, I think. I agree with the statement that the fix must be in busdma MD code, possibly with some cooperation with pmap code. On the other hand, I do not understand later claims. BIO unmapped attribute only means that bio does not carry a pointer to (some) mapping of the bio_ma pages. In other words, unmapped BIO does not imply globally unmapped page, and CPU cache might contain the lines =66rom the BIO pages. --Gx6yhVhPSPzNJpj4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxv/GAAoJEJDCuSvBvK1B/5IP/iFASxDOpbhjCFFO21MHpQQb vlYSX7I0bBE1uxIXu4HuHg9ZH9jFSn0qhvF72Nk7gy+AriN82IxWwzFSV+G7G7ia gWwnAeeKTaoQPvpAZRRbF0GaVVN1npoBDi8f8YVn2yhI2dxGTsb5CyVyUH5vFKUq BBZ201MrUjzc+9N9ziR7etQHCkph5W4Fs5itA+It5sSWv/+K052GHjHemzodglN8 LOXVVZqw78o+0Iig2g157EUmfrfnwOMIvwVqeNAIvu4bISF+zCO24GMRqy+w2oFd lIm3mdOhBhgGJiFt+mtq/8GdQaiYIiExsztgFJrViK8VuYEU8q0tkYw+zr7NnEu9 aD3gJmVeL5boz6k4cLJJWBFJCCsHuArf9yk1jwdusP4v8A+TW6qeIgNWU2JcfAYh PA1KBqt9MTPkOaRmwNKyaeVtxSpujdgR+kEAi1rWiubzPVf6zbHGEnmWzI30t+uN r5Ce0wgkpawOl4AA01T6T4iqkO1OEHlmJTveGrcBVwnCse7VPkJoQaD6G8nTyz55 LcOqukYuniHNWDs2gAnbMSwjZ3tEL3RJ1/4XjW//15gzAGqs05xCpElL7ceSKlBM 9gt9EHfiO9Q5oDICkHE3CitJPTS12OUa11vqd4sF/gmdso8p1BpbD+nmjImYEwv8 +pJ7GFTDB3HM4UfY6QWz =2PKw -----END PGP SIGNATURE----- --Gx6yhVhPSPzNJpj4-- From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 18:36:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94019B5E; Fri, 3 Jan 2014 18:36: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 80F1116C5; Fri, 3 Jan 2014 18:36: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 s03IaJTO086913; Fri, 3 Jan 2014 18:36:19 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03IaJAl086912; Fri, 3 Jan 2014 18:36:19 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401031836.s03IaJAl086912@svn.freebsd.org> From: Ian Lepore Date: Fri, 3 Jan 2014 18:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260235 - head/sys/boot/fdt/dts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 18:36:19 -0000 Author: ian Date: Fri Jan 3 18:36:19 2014 New Revision: 260235 URL: http://svnweb.freebsd.org/changeset/base/260235 Log: Update the dockstar DTS to reflect just NAND flash (no SPI NOR flash, and the LED specification was just misplaced). The rather odd memory mappings that were in place used an undocumented attribute value (0x0f) that caused problems with the system. Submitted by: Markus Pfeiffer Modified: head/sys/boot/fdt/dts/dockstar.dts Modified: head/sys/boot/fdt/dts/dockstar.dts ============================================================================== --- head/sys/boot/fdt/dts/dockstar.dts Fri Jan 3 18:08:31 2014 (r260234) +++ head/sys/boot/fdt/dts/dockstar.dts Fri Jan 3 18:36:19 2014 (r260235) @@ -76,44 +76,17 @@ #size-cells = <1>; compatible = "mrvl,lbc"; - /* This reflects CPU decode windows setup. */ - ranges = <0x0 0x0f 0xf9300000 0x00100000 - 0x1 0x1e 0xfa000000 0x00100000 - 0x2 0x1d 0xfa100000 0x02000000 - 0x3 0x1b 0xfc100000 0x00000400>; + /* This reflects CPU decode windows setup for NAND access. */ + ranges = <0x0 0x2f 0xf9300000 0x00100000>; - nor@0,0 { + nand@0,0 { #address-cells = <1>; #size-cells = <1>; - compatible = "cfi-flash"; + compatible = "mrvl,nfc"; reg = <0x0 0x0 0x00100000>; bank-width = <2>; device-width = <1>; }; - - led@1,0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "led"; - reg = <0x1 0x0 0x00100000>; - }; - - nor@2,0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "cfi-flash"; - reg = <0x2 0x0 0x02000000>; - bank-width = <2>; - device-width = <1>; - }; - - nand@3,0 { - #address-cells = <1>; - #size-cells = <1>; - reg = <0x3 0x0 0x00100000>; - bank-width = <2>; - device-width = <1>; - }; }; SOC: soc88f6281@f1000000 { From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 18:44:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0C4AF71; Fri, 3 Jan 2014 18:44: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 ABDBF177B; Fri, 3 Jan 2014 18:44: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 s03IibqV090408; Fri, 3 Jan 2014 18:44:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03Iibbt090407; Fri, 3 Jan 2014 18:44:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401031844.s03Iibbt090407@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Jan 2014 18:44:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260236 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 18:44:37 -0000 Author: mav Date: Fri Jan 3 18:44:37 2014 New Revision: 260236 URL: http://svnweb.freebsd.org/changeset/base/260236 Log: In dmu_zfetch_stream_reclaim() replace division with multiplication and move it out of the loop and lock. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Jan 3 18:36:19 2014 (r260235) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c Fri Jan 3 18:44:37 2014 (r260236) @@ -604,14 +604,16 @@ static zstream_t * dmu_zfetch_stream_reclaim(zfetch_t *zf) { zstream_t *zs; + clock_t ticks; + ticks = zfetch_min_sec_reap * hz; if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER)) return (0); for (zs = list_head(&zf->zf_stream); zs; zs = list_next(&zf->zf_stream, zs)) { - if (((ddi_get_lbolt() - zs->zst_last)/hz) > zfetch_min_sec_reap) + if (ddi_get_lbolt() - zs->zst_last > ticks) break; } From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 19:08:06 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 076C888D; Fri, 3 Jan 2014 19:08:06 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B75D81911; Fri, 3 Jan 2014 19:08:05 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VzA6G-000Nxg-AJ; Fri, 03 Jan 2014 19:08:04 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s03J827o024187; Fri, 3 Jan 2014 12:08:02 -0700 (MST) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX194WhJ86nXf5axXf0yowGib Subject: Re: svn commit: r260165 - head/sys/dev/ahci From: Ian Lepore To: Konstantin Belousov In-Reply-To: <20140103182159.GR59496@kib.kiev.ua> References: <201401012026.s01KQ8KU017949@svn.freebsd.org> <20140101203212.GF59496@kib.kiev.ua> <1388767752.1158.264.camel@revolution.hippie.lan> <20140103182159.GR59496@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" Date: Fri, 03 Jan 2014 12:08:01 -0700 Message-ID: <1388776081.1158.297.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Zbigniew Bodek , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 19:08:06 -0000 On Fri, 2014-01-03 at 20:21 +0200, Konstantin Belousov wrote: > On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote: > > On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote: > > > On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: > > > > Author: zbb > > > > Date: Wed Jan 1 20:26:08 2014 > > > > New Revision: 260165 > > > > URL: http://svnweb.freebsd.org/changeset/base/260165 > > > > > > > > Log: > > > > Use only mapped BIOs on ARM > > > > > > > > Using unmapped BIOs causes failure inside bus_dmamap_sync, since > > > > this function requires valid MVA address, which is not present > > > > if mapping is not set up. > > > > > > > > Submitted by: Wojciech Macek > > > > Obtained from: Semihalf > > > > > > > > Modified: > > > > head/sys/dev/ahci/ahci.c > > > > > > > > Modified: head/sys/dev/ahci/ahci.c > > > > ============================================================================== > > > > --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) > > > > +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) > > > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc > > > > if (ch->caps & AHCI_CAP_SPM) > > > > cpi->hba_inquiry |= PI_SATAPM; > > > > cpi->target_sprt = 0; > > > > +#ifdef __arm__ > > > > + /* > > > > + * Do not use unmapped buffers on ARM. Doing so will cause > > > > + * failure inside bus_dmamap_sync due to lack of VA. > > > > + */ > > > > + cpi->hba_misc = PIM_SEQSCAN; > > > > +#else > > > > cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; > > > > +#endif > > > > cpi->hba_eng_cnt = 0; > > > > if (ch->caps & AHCI_CAP_SPM) > > > > cpi->max_target = 15; > > > > > > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm, > > > then unmapped io should be disabled on arm unconditionally, using > > > unmapped_buf_allowed. Why ahci(4) is special in this regard, leaving > > > other controllers broken for arm ? > > > > I think this entire concept is wrong, and the fix should be in armv6 > > busdma or pmap code. An unmapped page is, by definition, not cached. > > The only way data becomes cached is because flags in a mapping indicated > > the memory is cacheable. If we have data from unmapped pages in the > > cache, that's a bug in the armv6 pmap implementation, I think. > > I agree with the statement that the fix must be in busdma MD code, > possibly with some cooperation with pmap code. On the other hand, I do > not understand later claims. > > BIO unmapped attribute only means that bio does not carry a pointer to > (some) mapping of the bio_ma pages. In other words, unmapped BIO does > not imply globally unmapped page, and CPU cache might contain the lines > from the BIO pages. Oh, I didn't realize that. I thought with unmapped IO it was implicit that there were no mappings of the page in the kernel or any userland vmspace. If the page can be mapped, that does indeed imply that unmapped IO needs to be globally disabled for ARM -- the hardware performs cache maintenance by virtual address. Hmm, or we could plumb up some new interface between arm busdma and pmap implementations, so that busdma can get any virtual addresses associated with the page and do the cache flushes. It looks like pmap has the required info in the pv_table, easily accessible by physical address. I wonder if any benefits from unmapped IO will get lost in the extra work required at the busdma level? -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 19:25:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 410F82C1; Fri, 3 Jan 2014 19:25:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2D4681B0F; Fri, 3 Jan 2014 19:25:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03JPr7h006184; Fri, 3 Jan 2014 19:25:53 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03JPrQ3006183; Fri, 3 Jan 2014 19:25:53 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401031925.s03JPrQ3006183@svn.freebsd.org> From: Neel Natu Date: Fri, 3 Jan 2014 19:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260237 - head/sys/amd64/vmm/io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 19:25:53 -0000 Author: neel Date: Fri Jan 3 19:25:52 2014 New Revision: 260237 URL: http://svnweb.freebsd.org/changeset/base/260237 Log: Fix a bug in the HPET emulation where a timer interrupt could be lost when the guest disables the HPET. The HPET timer interrupt is triggered from the callout handler associated with the timer. It is possible for the callout handler to be delayed before it gets a chance to execute. If the guest disables the HPET during this window then the handler never gets a chance to execute and the timer interrupt is lost. This is now fixed by injecting a timer interrupt into the guest if the callout time is detected to be in the past when the HPET is disabled. Modified: head/sys/amd64/vmm/io/vhpet.c Modified: head/sys/amd64/vmm/io/vhpet.c ============================================================================== --- head/sys/amd64/vmm/io/vhpet.c Fri Jan 3 18:44:37 2014 (r260236) +++ head/sys/amd64/vmm/io/vhpet.c Fri Jan 3 19:25:52 2014 (r260237) @@ -77,8 +77,8 @@ struct vhpet { uint64_t config; /* Configuration */ uint64_t isr; /* Interrupt Status */ - uint32_t counter; /* HPET Counter */ - sbintime_t counter_sbt; + uint32_t countbase; /* HPET counter base value */ + sbintime_t countbase_sbt; /* uptime corresponding to base value */ struct { uint64_t cap_config; /* Configuration */ @@ -86,6 +86,7 @@ struct vhpet { uint32_t compval; /* Comparator */ uint32_t comprate; struct callout callout; + sbintime_t callout_sbt; /* time when counter==compval */ struct vhpet_callout_arg arg; } timer[VHPET_NUM_TIMERS]; }; @@ -93,6 +94,9 @@ struct vhpet { #define VHPET_LOCK(vhp) mtx_lock(&((vhp)->mtx)) #define VHPET_UNLOCK(vhp) mtx_unlock(&((vhp)->mtx)) +static void vhpet_start_timer(struct vhpet *vhpet, int n, uint32_t counter, + sbintime_t now); + static uint64_t vhpet_capabilities(void) { @@ -164,30 +168,28 @@ vhpet_timer_ioapic_pin(struct vhpet *vhp } static uint32_t -vhpet_counter(struct vhpet *vhpet, bool latch) +vhpet_counter(struct vhpet *vhpet, sbintime_t *nowptr) { uint32_t val; - sbintime_t cur_sbt, delta_sbt; + sbintime_t now, delta; - val = vhpet->counter; + val = vhpet->countbase; if (vhpet_counter_enabled(vhpet)) { - cur_sbt = sbinuptime(); - delta_sbt = cur_sbt - vhpet->counter_sbt; - KASSERT(delta_sbt >= 0, - ("vhpet counter went backwards: %#lx to %#lx", - vhpet->counter_sbt, cur_sbt)); - val += delta_sbt / vhpet->freq_sbt; - + now = sbinuptime(); + delta = now - vhpet->countbase_sbt; + KASSERT(delta >= 0, ("vhpet_counter: uptime went backwards: " + "%#lx to %#lx", vhpet->countbase_sbt, now)); + val += delta / vhpet->freq_sbt; + if (nowptr != NULL) + *nowptr = now; + } else { /* - * Keep track of the last value of the main counter that - * was read by the guest. + * The sbinuptime corresponding to the 'countbase' is + * meaningless when the counter is disabled. Make sure + * that the the caller doesn't want to use it. */ - if (latch) { - vhpet->counter = val; - vhpet->counter_sbt = cur_sbt; - } + KASSERT(nowptr == NULL, ("vhpet_counter: nowptr must be NULL")); } - return (val); } @@ -305,7 +307,7 @@ vhpet_handler(void *a) { int n; uint32_t counter; - sbintime_t sbt; + sbintime_t now; struct vhpet *vhpet; struct callout *callout; struct vhpet_callout_arg *arg; @@ -330,14 +332,8 @@ vhpet_handler(void *a) if (!vhpet_counter_enabled(vhpet)) panic("vhpet(%p) callout with counter disabled", vhpet); - counter = vhpet_counter(vhpet, false); - - /* Update the accumulator for periodic timers */ - if (vhpet->timer[n].comprate != 0) - vhpet_adjust_compval(vhpet, n, counter); - - sbt = (vhpet->timer[n].compval - counter) * vhpet->freq_sbt; - callout_reset_sbt(callout, sbt, 0, vhpet_handler, arg, 0); + counter = vhpet_counter(vhpet, &now); + vhpet_start_timer(vhpet, n, counter, now); vhpet_timer_interrupt(vhpet, n); done: VHPET_UNLOCK(vhpet); @@ -345,45 +341,47 @@ done: } static void -vhpet_stop_timer(struct vhpet *vhpet, int n) +vhpet_stop_timer(struct vhpet *vhpet, int n, sbintime_t now) { + VM_CTR1(vhpet->vm, "hpet t%d stopped", n); callout_stop(&vhpet->timer[n].callout); - vhpet_timer_clear_isr(vhpet, n); + + /* + * If the callout was scheduled to expire in the past but hasn't + * had a chance to execute yet then trigger the timer interrupt + * here. Failing to do so will result in a missed timer interrupt + * in the guest. This is especially bad in one-shot mode because + * the next interrupt has to wait for the counter to wrap around. + */ + if (vhpet->timer[n].callout_sbt < now) { + VM_CTR1(vhpet->vm, "hpet t%d interrupt triggered after " + "stopping timer", n); + vhpet_timer_interrupt(vhpet, n); + } } static void -vhpet_start_timer(struct vhpet *vhpet, int n) +vhpet_start_timer(struct vhpet *vhpet, int n, uint32_t counter, sbintime_t now) { - uint32_t counter, delta, delta2; - sbintime_t sbt; - - counter = vhpet_counter(vhpet, false); + sbintime_t delta, precision; if (vhpet->timer[n].comprate != 0) vhpet_adjust_compval(vhpet, n, counter); - - delta = vhpet->timer[n].compval - counter; - - /* - * In one-shot mode the guest will typically read the main counter - * before programming the comparator. We can use this heuristic to - * figure out whether the expiration time is in the past. If this - * is the case we schedule the callout to fire immediately. - */ - if (!vhpet_periodic_timer(vhpet, n)) { - delta2 = vhpet->timer[n].compval - vhpet->counter; - if (delta > delta2) { - VM_CTR3(vhpet->vm, "hpet t%d comparator value is in " - "the past: %u/%u/%u", counter, - vhpet->timer[n].compval, vhpet->counter); - delta = 0; - } + else { + /* + * In one-shot mode it is the guest's responsibility to make + * sure that the comparator value is not in the "past". The + * hardware doesn't have any belt-and-suspenders to deal with + * this so we don't either. + */ } - sbt = delta * vhpet->freq_sbt; - callout_reset_sbt(&vhpet->timer[n].callout, sbt, 0, vhpet_handler, - &vhpet->timer[n].arg, 0); + delta = (vhpet->timer[n].compval - counter) * vhpet->freq_sbt; + precision = delta >> tc_precexp; + vhpet->timer[n].callout_sbt = now + delta; + callout_reset_sbt(&vhpet->timer[n].callout, vhpet->timer[n].callout_sbt, + precision, vhpet_handler, &vhpet->timer[n].arg, C_ABSOLUTE); } static void @@ -391,18 +389,25 @@ vhpet_start_counting(struct vhpet *vhpet { int i; - vhpet->counter_sbt = sbinuptime(); - for (i = 0; i < VHPET_NUM_TIMERS; i++) - vhpet_start_timer(vhpet, i); + vhpet->countbase_sbt = sbinuptime(); + for (i = 0; i < VHPET_NUM_TIMERS; i++) { + /* + * Restart the timers based on the value of the main counter + * when it stopped counting. + */ + vhpet_start_timer(vhpet, i, vhpet->countbase, + vhpet->countbase_sbt); + } } static void -vhpet_stop_counting(struct vhpet *vhpet) +vhpet_stop_counting(struct vhpet *vhpet, uint32_t counter, sbintime_t now) { int i; + vhpet->countbase = counter; for (i = 0; i < VHPET_NUM_TIMERS; i++) - vhpet_stop_timer(vhpet, i); + vhpet_stop_timer(vhpet, i, now); } static __inline void @@ -496,7 +501,8 @@ vhpet_mmio_write(void *vm, int vcpuid, u { struct vhpet *vhpet; uint64_t data, mask, oldval, val64; - uint32_t isr_clear_mask, old_compval, old_comprate; + uint32_t isr_clear_mask, old_compval, old_comprate, counter; + sbintime_t now, *nowptr; int i, offset; vhpet = vm_hpet(vm); @@ -532,6 +538,14 @@ vhpet_mmio_write(void *vm, int vcpuid, u } if (offset == HPET_CONFIG || offset == HPET_CONFIG + 4) { + /* + * Get the most recent value of the counter before updating + * the 'config' register. If the HPET is going to be disabled + * then we need to update 'countbase' with the value right + * before it is disabled. + */ + nowptr = vhpet_counter_enabled(vhpet) ? &now : NULL; + counter = vhpet_counter(vhpet, nowptr); oldval = vhpet->config; update_register(&vhpet->config, data, mask); if ((oldval ^ vhpet->config) & HPET_CNF_ENABLE) { @@ -539,7 +553,7 @@ vhpet_mmio_write(void *vm, int vcpuid, u vhpet_start_counting(vhpet); VM_CTR0(vhpet->vm, "hpet enabled"); } else { - vhpet_stop_counting(vhpet); + vhpet_stop_counting(vhpet, counter, now); VM_CTR0(vhpet->vm, "hpet disabled"); } } @@ -559,9 +573,9 @@ vhpet_mmio_write(void *vm, int vcpuid, u if (offset == HPET_MAIN_COUNTER || offset == HPET_MAIN_COUNTER + 4) { /* Zero-extend the counter to 64-bits before updating it */ - val64 = vhpet->counter; + val64 = vhpet_counter(vhpet, NULL); update_register(&val64, data, mask); - vhpet->counter = val64; + vhpet->countbase = val64; if (vhpet_counter_enabled(vhpet)) vhpet_start_counting(vhpet); goto done; @@ -604,8 +618,11 @@ vhpet_mmio_write(void *vm, int vcpuid, u if (vhpet->timer[i].compval != old_compval || vhpet->timer[i].comprate != old_comprate) { - if (vhpet_counter_enabled(vhpet)) - vhpet_start_timer(vhpet, i); + if (vhpet_counter_enabled(vhpet)) { + counter = vhpet_counter(vhpet, &now); + vhpet_start_timer(vhpet, i, counter, + now); + } } break; } @@ -666,7 +683,7 @@ vhpet_mmio_read(void *vm, int vcpuid, ui } if (offset == HPET_MAIN_COUNTER || offset == HPET_MAIN_COUNTER + 4) { - data = vhpet_counter(vhpet, true); + data = vhpet_counter(vhpet, NULL); goto done; } From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 19:29:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2140B5ED; Fri, 3 Jan 2014 19:29: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 0D7A71B3A; Fri, 3 Jan 2014 19:29:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03JTXH3006642; Fri, 3 Jan 2014 19:29:33 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03JTXE0006641; Fri, 3 Jan 2014 19:29:33 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201401031929.s03JTXE0006641@svn.freebsd.org> From: Neel Natu Date: Fri, 3 Jan 2014 19:29:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260238 - head/sys/amd64/vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 19:29:34 -0000 Author: neel Date: Fri Jan 3 19:29:33 2014 New Revision: 260238 URL: http://svnweb.freebsd.org/changeset/base/260238 Log: Use the same label name for ENTRY() and END() macros for 'vmx_enter_guest'. Pointed out by: rmh@ Modified: head/sys/amd64/vmm/intel/vmx_support.S Modified: head/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- head/sys/amd64/vmm/intel/vmx_support.S Fri Jan 3 19:25:52 2014 (r260237) +++ head/sys/amd64/vmm/intel/vmx_support.S Fri Jan 3 19:29:33 2014 (r260238) @@ -187,7 +187,7 @@ inst_error: VMX_HOST_RESTORE(%r10) ret -END(vmx_execute_guest) +END(vmx_enter_guest) /* * void vmx_exit_guest(void) From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 19:31:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A9D78B1; Fri, 3 Jan 2014 19:31: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 783D21CBC; Fri, 3 Jan 2014 19:31: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 s03JVfXw009610; Fri, 3 Jan 2014 19:31:41 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03JVf6W009609; Fri, 3 Jan 2014 19:31:41 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201401031931.s03JVf6W009609@svn.freebsd.org> From: Peter Grehan Date: Fri, 3 Jan 2014 19:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260239 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 19:31:41 -0000 Author: grehan Date: Fri Jan 3 19:31:40 2014 New Revision: 260239 URL: http://svnweb.freebsd.org/changeset/base/260239 Log: Cosmetic change - switch over to vertical SRCS to make it easier to keep files in alpha order. Reviewed by: neel Modified: head/usr.sbin/bhyve/Makefile Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Fri Jan 3 19:29:33 2014 (r260238) +++ head/usr.sbin/bhyve/Makefile Fri Jan 3 19:31:40 2014 (r260239) @@ -7,11 +7,37 @@ PROG= bhyve DEBUG_FLAGS= -g -O0 MAN= bhyve.8 -SRCS= acpi.c atpic.c bhyverun.c block_if.c consport.c dbgport.c elcr.c -SRCS+= inout.c legacy_irq.c mem.c mevent.c mptbl.c pci_ahci.c -SRCS+= pci_emul.c pci_hostbridge.c pci_lpc.c pci_passthru.c pci_virtio_block.c -SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c pm.c pmtmr.c post.c rtc.c -SRCS+= uart_emul.c virtio.c xmsr.c spinup_ap.c + +SRCS= \ + acpi.c \ + atpic.c \ + bhyverun.c \ + block_if.c \ + consport.c \ + dbgport.c \ + elcr.c \ + inout.c \ + legacy_irq.c \ + mem.c \ + mevent.c \ + mptbl.c \ + pci_ahci.c \ + pci_emul.c \ + pci_hostbridge.c \ + pci_lpc.c \ + pci_passthru.c \ + pci_virtio_block.c \ + pci_virtio_net.c \ + pci_uart.c \ + pit_8254.c \ + pm.c \ + pmtmr.c \ + post.c \ + rtc.c \ + uart_emul.c \ + virtio.c \ + xmsr.c \ + spinup_ap.c .PATH: ${.CURDIR}/../../sys/amd64/vmm SRCS+= vmm_instruction_emul.c From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 20:08:27 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26A75493; Fri, 3 Jan 2014 20:08:27 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 988F41F19; Fri, 3 Jan 2014 20:08:26 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s03K8KsM015201; Fri, 3 Jan 2014 22:08:20 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s03K8KsM015201 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s03K8K22015200; Fri, 3 Jan 2014 22:08:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 3 Jan 2014 22:08:20 +0200 From: Konstantin Belousov To: Ian Lepore Subject: Re: svn commit: r260165 - head/sys/dev/ahci Message-ID: <20140103200820.GS59496@kib.kiev.ua> References: <201401012026.s01KQ8KU017949@svn.freebsd.org> <20140101203212.GF59496@kib.kiev.ua> <1388767752.1158.264.camel@revolution.hippie.lan> <20140103182159.GR59496@kib.kiev.ua> <1388776081.1158.297.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ynvR7B6cELHUi2U/" Content-Disposition: inline In-Reply-To: <1388776081.1158.297.camel@revolution.hippie.lan> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Zbigniew Bodek , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 20:08:27 -0000 --ynvR7B6cELHUi2U/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 03, 2014 at 12:08:01PM -0700, Ian Lepore wrote: > On Fri, 2014-01-03 at 20:21 +0200, Konstantin Belousov wrote: > > On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote: > > > On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote: > > > > On Wed, Jan 01, 2014 at 08:26:08PM +0000, Zbigniew Bodek wrote: > > > > > Author: zbb > > > > > Date: Wed Jan 1 20:26:08 2014 > > > > > New Revision: 260165 > > > > > URL: http://svnweb.freebsd.org/changeset/base/260165 > > > > >=20 > > > > > Log: > > > > > Use only mapped BIOs on ARM > > > > > =20 > > > > > Using unmapped BIOs causes failure inside bus_dmamap_sync, since > > > > > this function requires valid MVA address, which is not present > > > > > if mapping is not set up. > > > > > =20 > > > > > Submitted by: Wojciech Macek > > > > > Obtained from: Semihalf > > > > >=20 > > > > > Modified: > > > > > head/sys/dev/ahci/ahci.c > > > > >=20 > > > > > Modified: head/sys/dev/ahci/ahci.c > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D > > > > > --- head/sys/dev/ahci/ahci.c Wed Jan 1 20:22:29 2014 (r260164) > > > > > +++ head/sys/dev/ahci/ahci.c Wed Jan 1 20:26:08 2014 (r260165) > > > > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc > > > > > if (ch->caps & AHCI_CAP_SPM) > > > > > cpi->hba_inquiry |=3D PI_SATAPM; > > > > > cpi->target_sprt =3D 0; > > > > > +#ifdef __arm__ > > > > > + /* > > > > > + * Do not use unmapped buffers on ARM. Doing so will cause > > > > > + * failure inside bus_dmamap_sync due to lack of VA. > > > > > + */ > > > > > + cpi->hba_misc =3D PIM_SEQSCAN; > > > > > +#else > > > > > cpi->hba_misc =3D PIM_SEQSCAN | PIM_UNMAPPED; > > > > > +#endif > > > > > cpi->hba_eng_cnt =3D 0; > > > > > if (ch->caps & AHCI_CAP_SPM) > > > > > cpi->max_target =3D 15; > > > >=20 > > > > I think this is wrong. If bus_dmamap_sync(9) is not functional on a= rm, > > > > then unmapped io should be disabled on arm unconditionally, using > > > > unmapped_buf_allowed. Why ahci(4) is special in this regard, leavi= ng > > > > other controllers broken for arm ? > > >=20 > > > I think this entire concept is wrong, and the fix should be in armv6 > > > busdma or pmap code. An unmapped page is, by definition, not cached. > > > The only way data becomes cached is because flags in a mapping indica= ted > > > the memory is cacheable. If we have data from unmapped pages in the > > > cache, that's a bug in the armv6 pmap implementation, I think. > >=20 > > I agree with the statement that the fix must be in busdma MD code, > > possibly with some cooperation with pmap code. On the other hand, I do > > not understand later claims. > >=20 > > BIO unmapped attribute only means that bio does not carry a pointer to > > (some) mapping of the bio_ma pages. In other words, unmapped BIO does > > not imply globally unmapped page, and CPU cache might contain the lines > > from the BIO pages. >=20 > Oh, I didn't realize that. I thought with unmapped IO it was implicit > that there were no mappings of the page in the kernel or any userland > vmspace. If the page can be mapped, that does indeed imply that > unmapped IO needs to be globally disabled for ARM -- the hardware > performs cache maintenance by virtual address. >=20 > Hmm, or we could plumb up some new interface between arm busdma and pmap > implementations, so that busdma can get any virtual addresses associated > with the page and do the cache flushes. It looks like pmap has the > required info in the pv_table, easily accessible by physical address. I > wonder if any benefits from unmapped IO will get lost in the extra work > required at the busdma level? Yes, I started mumbling about MI busdma code and pmap helper from the very beginning. The benefits can be only measured, it is impossible to speculate about it. Still, the normal reads for non-mmaped pages should pass the buffer pages which are not mapped anywhere, and unmaped code would be still a win. For arm, since we do not support SMP AFAIK, mapping and unmapping buffer pages is not as costly as for the large SMP machines. Keeping the feature working would be benefitial in future. --ynvR7B6cELHUi2U/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSxxizAAoJEJDCuSvBvK1B3awP/1v154QQym9Fq+EednF0MBVp fOmdXgRfzF3X8OQyAsBompWlPk/yeeohVZRlyYThnqqPPP5AFIwB4PERwVdrH+OX 7WA+e7SZ8z70u9Vx6khGq/RQfxocgSX7T5KcxKRDM98SDcmo8ku45edbEEOXXTjE 1Adp0MdURQs9rWQ6cNOv/vUl4Fd9KtCVCZQkQZ73DgeIc856u7wBeyE9OMPKE7rr 54TkC1cymPoGUYvr19p8Lck/RNJmtbVTkcY19ZjYu1qvZ3Buolzf4DNg8Ig3yM0C ssSkMcywV2oCTEDR0S1hdfbpjtUdCZMfDBvS7aldg32l0vNLCZytODTWFAU8NzSL Hx6t0+GVW9Gqs3ZF+7moY3nIe7fmSR4QYL1auEO0nkUb8JHtt9qEhXJhvziqex7D y4Pry3hqh3egHt9tUN8cqeUV4trBx7ZcIM6xhsR8pusf+872Bk2bU0bYaPmWauSn FE+EqfhEZaMtVcitdFeKIAknNb9WMbLoRNPoAVJ64p2ptawsdec08Cg5+9gXCINy 38GD+Z0ePndzVFizHq/vgiGIkilIjEbs8LMe7sH1XUjR5SOJ9HsBXH0HpFctJkd3 72DRqJd0GwwiHV+WEcxf3pOlgys2nS17sL/rJavJY4/6zJKw0XVNpL2IPR75MOQ9 Vc2jlZu+k8TPVVAKvzER =yeWf -----END PGP SIGNATURE----- --ynvR7B6cELHUi2U/-- From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 20:45:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E4CEEFE; Fri, 3 Jan 2014 20:45:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1A83B11A6; Fri, 3 Jan 2014 20:45:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03Kju0w037788; Fri, 3 Jan 2014 20:45:56 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03KjuZv037787; Fri, 3 Jan 2014 20:45:56 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201401032045.s03KjuZv037787@svn.freebsd.org> From: Sean Bruno Date: Fri, 3 Jan 2014 20:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260243 - head/sys/dev/aacraid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 20:45:57 -0000 Author: sbruno Date: Fri Jan 3 20:45:56 2014 New Revision: 260243 URL: http://svnweb.freebsd.org/changeset/base/260243 Log: Wrap this debug statement in debug defines. Else, this driver will refuse to load. MFC after: 2 weeks Sponsored by: Yahoo! Inc. Modified: head/sys/dev/aacraid/aacraid.c Modified: head/sys/dev/aacraid/aacraid.c ============================================================================== --- head/sys/dev/aacraid/aacraid.c Fri Jan 3 20:27:15 2014 (r260242) +++ head/sys/dev/aacraid/aacraid.c Fri Jan 3 20:45:56 2014 (r260243) @@ -1728,7 +1728,9 @@ aac_check_firmware(struct aac_softc *sc) device_printf(sc->aac_dev, "Enable 64-bit array\n"); } +#ifdef AACRAID_DEBUG aacraid_get_fw_debug_buffer(sc); +#endif return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 21:10:59 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 470B45E2; Fri, 3 Jan 2014 21:10:59 +0000 (UTC) Received: from mrout2-b.corp.bf1.yahoo.com (mrout2-b.corp.bf1.yahoo.com [98.139.253.105]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 017AA12F5; Fri, 3 Jan 2014 21:10:58 +0000 (UTC) Received: from [127.0.0.1] (rideseveral.corp.yahoo.com [10.73.160.231]) by mrout2-b.corp.bf1.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id s03L0Lov007453; Fri, 3 Jan 2014 13:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1388782822; bh=zwtc+bf3uNOVL/8ZmCaxRnCWDq+xvTLYl3thNROvYf8=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=WOep+/I7thYeYIHUKnvCvF8MdCwOSts2zj1FSHwMnGfoSUEGw93135M8Iy7Ly0BcL RjF+qp7SSwcS+ca3tNFSqag3VcBKyxKJ24U/+fyQP6ejgveRhIg4Raf6ni/qoB7cRO R0Vgv7wY9AZZkMoYDZjPVRfltT5XPVe6zLpJZV1E= Subject: Re: svn commit: r260243 - head/sys/dev/aacraid From: Sean Bruno To: Sean Bruno In-Reply-To: <201401032045.s03KjuZv037787@svn.freebsd.org> References: <201401032045.s03KjuZv037787@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 03 Jan 2014 13:00:20 -0800 Message-ID: <1388782820.12893.6.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Milter-Version: master.31+4-gbc07cd5+ X-CLX-ID: 782821010 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 21:10:59 -0000 On Fri, 2014-01-03 at 20:45 +0000, Sean Bruno wrote: > Author: sbruno > Date: Fri Jan 3 20:45:56 2014 > New Revision: 260243 > URL: http://svnweb.freebsd.org/changeset/base/260243 > > Log: > Wrap this debug statement in debug defines. Else, this driver > will refuse to load. should have read "will refuse to load as a module" link_elf_obj: symbol aacraid_get_fw_debug_buffer undefined linker_load_file: Unsupported file type sean > > MFC after: 2 weeks > Sponsored by: Yahoo! Inc. > > Modified: > head/sys/dev/aacraid/aacraid.c > > Modified: head/sys/dev/aacraid/aacraid.c > ============================================================================== > --- head/sys/dev/aacraid/aacraid.c Fri Jan 3 20:27:15 2014 (r260242) > +++ head/sys/dev/aacraid/aacraid.c Fri Jan 3 20:45:56 2014 (r260243) > @@ -1728,7 +1728,9 @@ aac_check_firmware(struct aac_softc *sc) > device_printf(sc->aac_dev, "Enable 64-bit array\n"); > } > > +#ifdef AACRAID_DEBUG > aacraid_get_fw_debug_buffer(sc); > +#endif > return (0); > } > From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 21:38:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3D139A3; Fri, 3 Jan 2014 21:38: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 BFB9D14C9; Fri, 3 Jan 2014 21:38: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 s03LcXAT057358; Fri, 3 Jan 2014 21:38:33 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03LcX8x057357; Fri, 3 Jan 2014 21:38:33 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401032138.s03LcX8x057357@svn.freebsd.org> From: Ian Lepore Date: Fri, 3 Jan 2014 21:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260245 - head/sys/arm/ti/am335x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 21:38:33 -0000 Author: ian Date: Fri Jan 3 21:38:33 2014 New Revision: 260245 URL: http://svnweb.freebsd.org/changeset/base/260245 Log: Fix a typo that caused a loop to run beyond the end of the array it was searching. If you didn't configure a timer capture pin you'd get a data abort as it wandered into the weeds, now you get a nice warning message about your config, as originally intended. Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_dmtimer.c Fri Jan 3 20:47:51 2014 (r260244) +++ head/sys/arm/ti/am335x/am335x_dmtimer.c Fri Jan 3 21:38:33 2014 (r260245) @@ -372,7 +372,7 @@ am335x_dmtimer_pps_init(device_t dev, st * yet from ti_scm.h. */ timer_num = 0; - for (i = 0; nitems(padinfo) && timer_num == 0; ++i) { + for (i = 0; i < nitems(padinfo) && timer_num == 0; ++i) { if (ti_scm_padconf_get(padinfo[i].ballname, &padmux, &padstate) == 0) { if (strcasecmp(padinfo[i].muxname, padmux) == 0 && From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 22:56:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B22C9551; Fri, 3 Jan 2014 22:56: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 9E40F198A; Fri, 3 Jan 2014 22:56:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03MuNd9087496; Fri, 3 Jan 2014 22:56:23 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03MuND3087495; Fri, 3 Jan 2014 22:56:23 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201401032256.s03MuND3087495@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Jan 2014 22:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260246 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 22:56:23 -0000 Author: jilles Date: Fri Jan 3 22:56:23 2014 New Revision: 260246 URL: http://svnweb.freebsd.org/changeset/base/260246 Log: sh(1): Discourage use of -e. Also, do not say that ! before a pipeline is an operator, because it is syntactically a keyword. Modified: head/bin/sh/sh.1 Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Fri Jan 3 21:38:33 2014 (r260245) +++ head/bin/sh/sh.1 Fri Jan 3 22:56:23 2014 (r260246) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd November 1, 2013 +.Dd January 3, 2014 .Dt SH 1 .Os .Sh NAME @@ -235,10 +235,16 @@ or .Dq Li || operator; or if the command is a pipeline preceded by the .Ic !\& -operator. +keyword. If a shell function is executed and its exit status is explicitly tested, all commands of the function are considered to be tested as well. +.Pp +It is recommended to check for failures explicitly +instead of relying on +.Fl e +because it tends to behave in unexpected ways, +particularly in larger scripts. .It Fl f Li noglob Disable pathname expansion. .It Fl h Li trackall From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 23:11:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29F499F8; Fri, 3 Jan 2014 23:11: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 152251AAF; Fri, 3 Jan 2014 23:11: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 s03NBQqR095058; Fri, 3 Jan 2014 23:11:26 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03NBQNI095057; Fri, 3 Jan 2014 23:11:26 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401032311.s03NBQNI095057@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 3 Jan 2014 23:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260247 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 23:11:27 -0000 Author: melifaro Date: Fri Jan 3 23:11:26 2014 New Revision: 260247 URL: http://svnweb.freebsd.org/changeset/base/260247 Log: Use rnh_matchaddr instead of rnh_lookup for longest-prefix match. rnh_lookup is effectively the same as rnh_matchaddr if called with empy network mask. MFC after: 2 weeks Modified: head/sys/netpfil/ipfw/ip_fw_table.c Modified: head/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c Fri Jan 3 22:56:23 2014 (r260246) +++ head/sys/netpfil/ipfw/ip_fw_table.c Fri Jan 3 23:11:26 2014 (r260247) @@ -542,7 +542,7 @@ ipfw_lookup_table(struct ip_fw_chain *ch return (0); KEY_LEN(sa) = KEY_LEN_INET; sa.sin_addr.s_addr = addr; - ent = (struct table_entry *)(rnh->rnh_lookup(&sa, NULL, rnh)); + ent = (struct table_entry *)(rnh->rnh_matchaddr(&sa, rnh)); if (ent != NULL) { *val = ent->value; return (1); @@ -568,7 +568,7 @@ ipfw_lookup_table_extended(struct ip_fw_ case IPFW_TABLE_CIDR: KEY_LEN(sa6) = KEY_LEN_INET6; memcpy(&sa6.sin6_addr, paddr, sizeof(struct in6_addr)); - xent = (struct table_xentry *)(rnh->rnh_lookup(&sa6, NULL, rnh)); + xent = (struct table_xentry *)(rnh->rnh_matchaddr(&sa6, rnh)); break; case IPFW_TABLE_INTERFACE: @@ -576,7 +576,7 @@ ipfw_lookup_table_extended(struct ip_fw_ strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1; /* Assume direct match */ /* FIXME: Add interface pattern matching */ - xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, rnh)); + xent = (struct table_xentry *)(rnh->rnh_matchaddr(&iface, rnh)); break; default: From owner-svn-src-head@FreeBSD.ORG Fri Jan 3 23:35:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C4481DD; Fri, 3 Jan 2014 23:35:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2F6CE1CEF; Fri, 3 Jan 2014 23:35:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s03NZ29B003288; Fri, 3 Jan 2014 23:35:02 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s03NZ2Ql003287; Fri, 3 Jan 2014 23:35:02 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201401032335.s03NZ2Ql003287@svn.freebsd.org> From: Peter Wemm Date: Fri, 3 Jan 2014 23:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260248 - head/share/i18n/esdb/UTF X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 23:35:02 -0000 Author: peter Date: Fri Jan 3 23:35:01 2014 New Revision: 260248 URL: http://svnweb.freebsd.org/changeset/base/260248 Log: Revert r258254: Alias WCHAR_T to UCS-4-INTERNAL. Modified: head/share/i18n/esdb/UTF/UTF.alias Modified: head/share/i18n/esdb/UTF/UTF.alias ============================================================================== --- head/share/i18n/esdb/UTF/UTF.alias Fri Jan 3 23:11:26 2014 (r260247) +++ head/share/i18n/esdb/UTF/UTF.alias Fri Jan 3 23:35:01 2014 (r260248) @@ -28,7 +28,6 @@ 16LE utf16le 32-INTERNAL ucs-4-internal -32-INTERNAL wchar_t 32-SWAPPED ucs-4-swapped From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 01:08:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 005ECDA4; Sat, 4 Jan 2014 01:08: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 C11E4124C; Sat, 4 Jan 2014 01:08: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 s0418Aib040177; Sat, 4 Jan 2014 01:08:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0418A5j040175; Sat, 4 Jan 2014 01:08:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401040108.s0418A5j040175@svn.freebsd.org> From: Xin LI Date: Sat, 4 Jan 2014 01:08:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260250 - head/usr.sbin/rpc.lockd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 01:08:11 -0000 Author: delphij Date: Sat Jan 4 01:08:10 2014 New Revision: 260250 URL: http://svnweb.freebsd.org/changeset/base/260250 Log: Use prototype. Modified: head/usr.sbin/rpc.lockd/kern.c head/usr.sbin/rpc.lockd/lock_proc.c Modified: head/usr.sbin/rpc.lockd/kern.c ============================================================================== --- head/usr.sbin/rpc.lockd/kern.c Fri Jan 3 23:36:03 2014 (r260249) +++ head/usr.sbin/rpc.lockd/kern.c Sat Jan 4 01:08:10 2014 (r260250) @@ -97,8 +97,7 @@ nfslockdans(int vers, struct lockd_ans * #define d_args (debug_level > 2) static const char * -from_addr(saddr) - struct sockaddr *saddr; +from_addr(struct sockaddr *saddr) { static char inet_buf[INET6_ADDRSTRLEN]; @@ -231,9 +230,7 @@ err: } void -set_auth(cl, xucred) - CLIENT *cl; - struct xucred *xucred; +set_auth(CLIENT *cl, struct xucred *xucred) { int ngroups; Modified: head/usr.sbin/rpc.lockd/lock_proc.c ============================================================================== --- head/usr.sbin/rpc.lockd/lock_proc.c Fri Jan 3 23:36:03 2014 (r260249) +++ head/usr.sbin/rpc.lockd/lock_proc.c Sat Jan 4 01:08:10 2014 (r260250) @@ -76,9 +76,7 @@ static int addrcmp(struct sockaddr *, st * passed in as part of the called procedure specification */ static void -log_from_addr(fun_name, req) - const char *fun_name; - struct svc_req *req; +log_from_addr(const char *fun_name, struct svc_req *req) { struct sockaddr *addr; char hostname_buf[NI_MAXHOST]; @@ -99,8 +97,7 @@ log_from_addr(fun_name, req) * a debug subsystem. */ static void -log_netobj(obj) - netobj *obj; +log_netobj(netobj *obj) { char objvalbuffer[(sizeof(char)*2)*MAX_NETOBJ_SZ+2]; char objascbuffer[sizeof(char)*MAX_NETOBJ_SZ+1]; @@ -161,9 +158,7 @@ static rpcvers_t clnt_cache_vers[CLIENT_ static int clnt_cache_next_to_use = 0; static int -addrcmp(sa1, sa2) - struct sockaddr *sa1; - struct sockaddr *sa2; +addrcmp(struct sockaddr *sa1, struct sockaddr *sa2) { int len; void *p1, *p2; @@ -190,9 +185,7 @@ addrcmp(sa1, sa2) } CLIENT * -get_client(host_addr, vers) - struct sockaddr *host_addr; - rpcvers_t vers; +get_client(struct sockaddr *host_addr, rpcvers_t vers) { CLIENT *client; struct timeval retry_time, time_now; @@ -327,10 +320,7 @@ get_client(host_addr, vers) * without expecting a result */ void -transmit_result(opcode, result, addr) - int opcode; - nlm_res *result; - struct sockaddr *addr; +transmit_result(int opcode, nlm_res *result, struct sockaddr *addr) { static char dummy; CLIENT *cli; @@ -358,10 +348,7 @@ transmit_result(opcode, result, addr) * without expecting a result */ void -transmit4_result(opcode, result, addr) - int opcode; - nlm4_res *result; - struct sockaddr *addr; +transmit4_result(int opcode, nlm4_res *result, struct sockaddr *addr) { static char dummy; CLIENT *cli; @@ -385,11 +372,8 @@ transmit4_result(opcode, result, addr) /* * converts a struct nlm_lock to struct nlm4_lock */ -static void nlmtonlm4(struct nlm_lock *, struct nlm4_lock *); static void -nlmtonlm4(arg, arg4) - struct nlm_lock *arg; - struct nlm4_lock *arg4; +nlmtonlm4(struct nlm_lock *arg, struct nlm4_lock *arg4) { arg4->caller_name = arg->caller_name; arg4->fh = arg->fh; @@ -432,9 +416,7 @@ nlmtonlm4(arg, arg4) * Notes: */ nlm_testres * -nlm_test_1_svc(arg, rqstp) - nlm_testargs *arg; - struct svc_req *rqstp; +nlm_test_1_svc(nlm_testargs *arg, struct svc_req *rqstp) { static nlm_testres res; struct nlm4_lock arg4; @@ -466,9 +448,7 @@ nlm_test_1_svc(arg, rqstp) } void * -nlm_test_msg_1_svc(arg, rqstp) - nlm_testargs *arg; - struct svc_req *rqstp; +nlm_test_msg_1_svc(nlm_testargs *arg, struct svc_req *rqstp) { nlm_testres res; static char dummy; @@ -523,9 +503,7 @@ nlm_test_msg_1_svc(arg, rqstp) * Notes: *** grace period support missing */ nlm_res * -nlm_lock_1_svc(arg, rqstp) - nlm_lockargs *arg; - struct svc_req *rqstp; +nlm_lock_1_svc(nlm_lockargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lockargs arg4; @@ -547,9 +525,7 @@ nlm_lock_1_svc(arg, rqstp) } void * -nlm_lock_msg_1_svc(arg, rqstp) - nlm_lockargs *arg; - struct svc_req *rqstp; +nlm_lock_msg_1_svc(nlm_lockargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lockargs arg4; @@ -578,9 +554,7 @@ nlm_lock_msg_1_svc(arg, rqstp) * Notes: */ nlm_res * -nlm_cancel_1_svc(arg, rqstp) - nlm_cancargs *arg; - struct svc_req *rqstp; +nlm_cancel_1_svc(nlm_cancargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lock arg4; @@ -602,9 +576,7 @@ nlm_cancel_1_svc(arg, rqstp) } void * -nlm_cancel_msg_1_svc(arg, rqstp) - nlm_cancargs *arg; - struct svc_req *rqstp; +nlm_cancel_msg_1_svc(nlm_cancargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lock arg4; @@ -633,9 +605,7 @@ nlm_cancel_msg_1_svc(arg, rqstp) * re-try an unlock that has already succeeded. */ nlm_res * -nlm_unlock_1_svc(arg, rqstp) - nlm_unlockargs *arg; - struct svc_req *rqstp; +nlm_unlock_1_svc(nlm_unlockargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lock arg4; @@ -652,9 +622,7 @@ nlm_unlock_1_svc(arg, rqstp) } void * -nlm_unlock_msg_1_svc(arg, rqstp) - nlm_unlockargs *arg; - struct svc_req *rqstp; +nlm_unlock_msg_1_svc(nlm_unlockargs *arg, struct svc_req *rqstp) { static nlm_res res; struct nlm4_lock arg4; @@ -690,9 +658,7 @@ nlm_unlock_msg_1_svc(arg, rqstp) * Notes: */ nlm_res * -nlm_granted_1_svc(arg, rqstp) - nlm_testargs *arg; - struct svc_req *rqstp; +nlm_granted_1_svc(nlm_testargs *arg, struct svc_req *rqstp) { static nlm_res res; @@ -710,9 +676,7 @@ nlm_granted_1_svc(arg, rqstp) } void * -nlm_granted_msg_1_svc(arg, rqstp) - nlm_testargs *arg; - struct svc_req *rqstp; +nlm_granted_msg_1_svc(nlm_testargs *arg, struct svc_req *rqstp) { static nlm_res res; @@ -734,9 +698,7 @@ nlm_granted_msg_1_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_test_res_1_svc(arg, rqstp) - nlm_testres *arg; - struct svc_req *rqstp; +nlm_test_res_1_svc(nlm_testres *arg, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm_test_res", rqstp); @@ -751,9 +713,7 @@ nlm_test_res_1_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_lock_res_1_svc(arg, rqstp) - nlm_res *arg; - struct svc_req *rqstp; +nlm_lock_res_1_svc(nlm_res *arg, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm_lock_res", rqstp); @@ -769,9 +729,7 @@ nlm_lock_res_1_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_cancel_res_1_svc(arg, rqstp) - nlm_res *arg __unused; - struct svc_req *rqstp; +nlm_cancel_res_1_svc(nlm_res *arg __unused, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm_cancel_res", rqstp); @@ -784,9 +742,7 @@ nlm_cancel_res_1_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_unlock_res_1_svc(arg, rqstp) - nlm_res *arg; - struct svc_req *rqstp; +nlm_unlock_res_1_svc(nlm_res *arg, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm_unlock_res", rqstp); @@ -802,9 +758,7 @@ nlm_unlock_res_1_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_granted_res_1_svc(arg, rqstp) - nlm_res *arg __unused; - struct svc_req *rqstp; +nlm_granted_res_1_svc(nlm_res *arg __unused, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm_granted_res", rqstp); @@ -827,9 +781,7 @@ nlm_granted_res_1_svc(arg, rqstp) * to retry if required. */ nlm_shareres * -nlm_share_3_svc(arg, rqstp) - nlm_shareargs *arg; - struct svc_req *rqstp; +nlm_share_3_svc(nlm_shareargs *arg, struct svc_req *rqstp) { static nlm_shareres res; @@ -849,9 +801,7 @@ nlm_share_3_svc(arg, rqstp) * Notes: */ nlm_shareres * -nlm_unshare_3_svc(arg, rqstp) - nlm_shareargs *arg; - struct svc_req *rqstp; +nlm_unshare_3_svc(nlm_shareargs *arg, struct svc_req *rqstp) { static nlm_shareres res; @@ -875,9 +825,7 @@ nlm_unshare_3_svc(arg, rqstp) * respond to the statd protocol. */ nlm_res * -nlm_nm_lock_3_svc(arg, rqstp) - nlm_lockargs *arg; - struct svc_req *rqstp; +nlm_nm_lock_3_svc(nlm_lockargs *arg, struct svc_req *rqstp) { static nlm_res res; @@ -901,9 +849,7 @@ nlm_nm_lock_3_svc(arg, rqstp) * using monitored locks. */ void * -nlm_free_all_3_svc(arg, rqstp) - nlm_notify *arg __unused; - struct svc_req *rqstp; +nlm_free_all_3_svc(nlm_notify *arg __unused, struct svc_req *rqstp) { static char dummy; @@ -920,9 +866,7 @@ nlm_free_all_3_svc(arg, rqstp) * Notes: */ nlm4_testres * -nlm4_test_4_svc(arg, rqstp) - nlm4_testargs *arg; - struct svc_req *rqstp; +nlm4_test_4_svc(nlm4_testargs *arg, struct svc_req *rqstp) { static nlm4_testres res; struct nlm4_holder *holder; @@ -968,9 +912,7 @@ nlm4_test_4_svc(arg, rqstp) } void * -nlm4_test_msg_4_svc(arg, rqstp) - nlm4_testargs *arg; - struct svc_req *rqstp; +nlm4_test_msg_4_svc(nlm4_testargs *arg, struct svc_req *rqstp) { nlm4_testres res; static char dummy; @@ -1020,9 +962,7 @@ nlm4_test_msg_4_svc(arg, rqstp) * Notes: *** grace period support missing */ nlm4_res * -nlm4_lock_4_svc(arg, rqstp) - nlm4_lockargs *arg; - struct svc_req *rqstp; +nlm4_lock_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1056,9 +996,7 @@ nlm4_lock_4_svc(arg, rqstp) } void * -nlm4_lock_msg_4_svc(arg, rqstp) - nlm4_lockargs *arg; - struct svc_req *rqstp; +nlm4_lock_msg_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1079,9 +1017,7 @@ nlm4_lock_msg_4_svc(arg, rqstp) * Notes: */ nlm4_res * -nlm4_cancel_4_svc(arg, rqstp) - nlm4_cancargs *arg; - struct svc_req *rqstp; +nlm4_cancel_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1100,9 +1036,7 @@ nlm4_cancel_4_svc(arg, rqstp) } void * -nlm4_cancel_msg_4_svc(arg, rqstp) - nlm4_cancargs *arg; - struct svc_req *rqstp; +nlm4_cancel_msg_4_svc(nlm4_cancargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1128,9 +1062,7 @@ nlm4_cancel_msg_4_svc(arg, rqstp) * re-try an unlock that has already succeeded. */ nlm4_res * -nlm4_unlock_4_svc(arg, rqstp) - nlm4_unlockargs *arg; - struct svc_req *rqstp; +nlm4_unlock_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1144,9 +1076,7 @@ nlm4_unlock_4_svc(arg, rqstp) } void * -nlm4_unlock_msg_4_svc(arg, rqstp) - nlm4_unlockargs *arg; - struct svc_req *rqstp; +nlm4_unlock_msg_4_svc(nlm4_unlockargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1179,9 +1109,7 @@ nlm4_unlock_msg_4_svc(arg, rqstp) * Notes: */ nlm4_res * -nlm4_granted_4_svc(arg, rqstp) - nlm4_testargs *arg; - struct svc_req *rqstp; +nlm4_granted_4_svc(nlm4_testargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1199,9 +1127,7 @@ nlm4_granted_4_svc(arg, rqstp) } void * -nlm4_granted_msg_4_svc(arg, rqstp) - nlm4_testargs *arg; - struct svc_req *rqstp; +nlm4_granted_msg_4_svc(nlm4_testargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1222,9 +1148,7 @@ nlm4_granted_msg_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm4_test_res_4_svc(arg, rqstp) - nlm4_testres *arg; - struct svc_req *rqstp; +nlm4_test_res_4_svc(nlm4_testres *arg, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm4_test_res", rqstp); @@ -1241,9 +1165,7 @@ nlm4_test_res_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm4_lock_res_4_svc(arg, rqstp) - nlm4_res *arg; - struct svc_req *rqstp; +nlm4_lock_res_4_svc(nlm4_res *arg, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm4_lock_res", rqstp); @@ -1259,9 +1181,7 @@ nlm4_lock_res_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm4_cancel_res_4_svc(arg, rqstp) - nlm4_res *arg __unused; - struct svc_req *rqstp; +nlm4_cancel_res_4_svc(nlm4_res *arg __unused, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm4_cancel_res", rqstp); @@ -1274,9 +1194,7 @@ nlm4_cancel_res_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm4_unlock_res_4_svc(arg, rqstp) - nlm4_res *arg __unused; - struct svc_req *rqstp; +nlm4_unlock_res_4_svc(nlm4_res *arg __unused, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm4_unlock_res", rqstp); @@ -1289,9 +1207,7 @@ nlm4_unlock_res_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm4_granted_res_4_svc(arg, rqstp) - nlm4_res *arg __unused; - struct svc_req *rqstp; +nlm4_granted_res_4_svc(nlm4_res *arg __unused, struct svc_req *rqstp) { if (debug_level) log_from_addr("nlm4_granted_res", rqstp); @@ -1314,9 +1230,7 @@ nlm4_granted_res_4_svc(arg, rqstp) * to retry if required. */ nlm4_shareres * -nlm4_share_4_svc(arg, rqstp) - nlm4_shareargs *arg; - struct svc_req *rqstp; +nlm4_share_4_svc(nlm4_shareargs *arg, struct svc_req *rqstp) { static nlm4_shareres res; @@ -1336,9 +1250,7 @@ nlm4_share_4_svc(arg, rqstp) * Notes: */ nlm4_shareres * -nlm4_unshare_4_svc(arg, rqstp) - nlm4_shareargs *arg; - struct svc_req *rqstp; +nlm4_unshare_4_svc(nlm4_shareargs *arg, struct svc_req *rqstp) { static nlm4_shareres res; @@ -1362,9 +1274,7 @@ nlm4_unshare_4_svc(arg, rqstp) * respond to the statd protocol. */ nlm4_res * -nlm4_nm_lock_4_svc(arg, rqstp) - nlm4_lockargs *arg; - struct svc_req *rqstp; +nlm4_nm_lock_4_svc(nlm4_lockargs *arg, struct svc_req *rqstp) { static nlm4_res res; @@ -1388,9 +1298,7 @@ nlm4_nm_lock_4_svc(arg, rqstp) * using monitored locks. */ void * -nlm4_free_all_4_svc(arg, rqstp) - struct nlm4_notify *arg __unused; - struct svc_req *rqstp; +nlm4_free_all_4_svc(struct nlm4_notify *arg __unused, struct svc_req *rqstp) { static char dummy; @@ -1405,9 +1313,7 @@ nlm4_free_all_4_svc(arg, rqstp) * Returns: Nothing */ void * -nlm_sm_notify_0_svc(arg, rqstp) - struct nlm_sm_status *arg; - struct svc_req *rqstp __unused; +nlm_sm_notify_0_svc(struct nlm_sm_status *arg, struct svc_req *rqstp __unused) { static char dummy; notify(arg->mon_name, arg->state); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 01:12:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DE70F3A; Sat, 4 Jan 2014 01:12: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 0A4D112C3; Sat, 4 Jan 2014 01:12: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 s041CSDW043443; Sat, 4 Jan 2014 01:12:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s041CSXo043442; Sat, 4 Jan 2014 01:12:28 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201401040112.s041CSXo043442@svn.freebsd.org> From: Xin LI Date: Sat, 4 Jan 2014 01:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260251 - head/usr.sbin/rpc.lockd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 01:12:29 -0000 Author: delphij Date: Sat Jan 4 01:12:28 2014 New Revision: 260251 URL: http://svnweb.freebsd.org/changeset/base/260251 Log: Make a copy instead using constant string directly when assigning to char *. While I'm there also remove a few prototypes that are unused. Modified: head/usr.sbin/rpc.lockd/lockd.c Modified: head/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- head/usr.sbin/rpc.lockd/lockd.c Sat Jan 4 01:08:10 2014 (r260250) +++ head/usr.sbin/rpc.lockd/lockd.c Sat Jan 4 01:12:28 2014 (r260251) @@ -101,10 +101,6 @@ static void complete_service(struct netc static void clearout_service(void); void lookup_addresses(struct netconfig *nconf); void init_nsm(void); -void nlm_prog_0(struct svc_req *, SVCXPRT *); -void nlm_prog_1(struct svc_req *, SVCXPRT *); -void nlm_prog_3(struct svc_req *, SVCXPRT *); -void nlm_prog_4(struct svc_req *, SVCXPRT *); void out_of_mem(void); void usage(void); @@ -228,7 +224,7 @@ main(int argc, char **argv) if (hosts == NULL) out_of_mem(); - hosts[0] = "*"; + hosts[0] = strdup("*"); nhosts = 1; } else { hosts_bak = hosts; @@ -244,7 +240,7 @@ main(int argc, char **argv) hosts = hosts_bak; nhosts += 2; - hosts[nhosts - 2] = "::1"; + hosts[nhosts - 2] = strdup("::1"); } else { hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); if (hosts_bak == NULL) { @@ -258,7 +254,7 @@ main(int argc, char **argv) hosts = hosts_bak; } } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = strdup("127.0.0.1"); } if (kernel_lockd) { From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 09:25:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5CE514B9; Sat, 4 Jan 2014 09:25: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 3B75D11DC; Sat, 4 Jan 2014 09:25: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 s049PTbE033787; Sat, 4 Jan 2014 09:25:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s049PSHA033780; Sat, 4 Jan 2014 09:25:28 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401040925.s049PSHA033780@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 4 Jan 2014 09:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260253 - head/tools/regression/capsicum/libcapsicum X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 09:25:29 -0000 Author: pjd Date: Sat Jan 4 09:25:27 2014 New Revision: 260253 URL: http://svnweb.freebsd.org/changeset/base/260253 Log: MFp4 @1189766: - Compile the tests with .t suffix, so prove can use them directly. - The CHECKX() macro should increment ntest just like the CHECK() macro. - For consistency remove # from the pwd.t output. Submitted by: Mariusz Zaborski Modified: head/tools/regression/capsicum/libcapsicum/Makefile head/tools/regression/capsicum/libcapsicum/dns.c head/tools/regression/capsicum/libcapsicum/grp.c head/tools/regression/capsicum/libcapsicum/pwd.c head/tools/regression/capsicum/libcapsicum/sysctl.c Modified: head/tools/regression/capsicum/libcapsicum/Makefile ============================================================================== --- head/tools/regression/capsicum/libcapsicum/Makefile Sat Jan 4 04:48:58 2014 (r260252) +++ head/tools/regression/capsicum/libcapsicum/Makefile Sat Jan 4 09:25:27 2014 (r260253) @@ -15,12 +15,14 @@ CFLAGS+= -Wold-style-definition -Wno-poi CFLAGS+= -I${.CURDIR}/../../../../lib/libcapsicum CFLAGS+= -ggdb -all: ${SERVICES} +SERVTEST= ${SERVICES:=.t} + +all: ${SERVTEST} .for SERVICE in ${SERVICES} -${SERVICE}: ${SERVICE}.c - ${CC} ${CFLAGS} ${@}.c -o $@ -lcapsicum -lnv +${SERVICE}.t: ${SERVICE}.c + ${CC} ${CFLAGS} ${@:.t=.c} -o $@ -lcapsicum -lnv .endfor @@ -28,4 +30,4 @@ test: all @prove -r ${.CURDIR} clean: - rm -f ${SERVICES} + rm -f ${SERVTEST} Modified: head/tools/regression/capsicum/libcapsicum/dns.c ============================================================================== --- head/tools/regression/capsicum/libcapsicum/dns.c Sat Jan 4 04:48:58 2014 (r260252) +++ head/tools/regression/capsicum/libcapsicum/dns.c Sat Jan 4 09:25:27 2014 (r260253) @@ -64,6 +64,7 @@ static int ntest = 1; printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + ntest++; \ } while (0) #define GETHOSTBYNAME 0x01 @@ -223,7 +224,7 @@ main(void) const char *types[2]; int families[2]; - printf("1..89\n"); + printf("1..91\n"); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/tools/regression/capsicum/libcapsicum/grp.c ============================================================================== --- head/tools/regression/capsicum/libcapsicum/grp.c Sat Jan 4 04:48:58 2014 (r260252) +++ head/tools/regression/capsicum/libcapsicum/grp.c Sat Jan 4 09:25:27 2014 (r260253) @@ -61,6 +61,7 @@ static int ntest = 1; printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + ntest++; \ } while (0) #define GID_WHEEL 0 @@ -1522,7 +1523,7 @@ main(void) { cap_channel_t *capcas, *capgrp; - printf("1..197\n"); + printf("1..199\n"); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/tools/regression/capsicum/libcapsicum/pwd.c ============================================================================== --- head/tools/regression/capsicum/libcapsicum/pwd.c Sat Jan 4 04:48:58 2014 (r260252) +++ head/tools/regression/capsicum/libcapsicum/pwd.c Sat Jan 4 09:25:27 2014 (r260253) @@ -49,18 +49,19 @@ static int ntest = 1; #define CHECK(expr) do { \ if ((expr)) \ - printf("ok # %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ else \ - printf("not ok # %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ ntest++; \ } while (0) #define CHECKX(expr) do { \ if ((expr)) { \ - printf("ok # %d %s:%u\n", ntest, __FILE__, __LINE__); \ + printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ } else { \ - printf("not ok # %d %s:%u\n", ntest, __FILE__, __LINE__);\ + printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\ exit(1); \ } \ + ntest++; \ } while (0) #define UID_ROOT 0 @@ -1508,7 +1509,7 @@ main(void) { cap_channel_t *capcas, *cappwd; - printf("1..186\n"); + printf("1..188\n"); capcas = cap_init(); CHECKX(capcas != NULL); Modified: head/tools/regression/capsicum/libcapsicum/sysctl.c ============================================================================== --- head/tools/regression/capsicum/libcapsicum/sysctl.c Sat Jan 4 04:48:58 2014 (r260252) +++ head/tools/regression/capsicum/libcapsicum/sysctl.c Sat Jan 4 09:25:27 2014 (r260253) @@ -73,6 +73,7 @@ static int ntest = 1; printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \ exit(1); \ } \ + ntest++; \ } while (0) #define SYSCTL0_READ0 0x0001 @@ -1470,7 +1471,7 @@ main(void) int scvalue0, scvalue1; size_t scsize; - printf("1..250\n"); + printf("1..256\n"); scsize = sizeof(scvalue0); CHECKX(sysctlbyname(SYSCTL0_NAME, &scvalue0, &scsize, NULL, 0) == 0); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 09:27:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A2A161A; Sat, 4 Jan 2014 09:27: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 05FB511F2; Sat, 4 Jan 2014 09:27: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 s049RnmL034051; Sat, 4 Jan 2014 09:27:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s049RnUw034050; Sat, 4 Jan 2014 09:27:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401040927.s049RnUw034050@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 4 Jan 2014 09:27:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260254 - head/sbin/geom/class/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 09:27:50 -0000 Author: pjd Date: Sat Jan 4 09:27:49 2014 New Revision: 260254 URL: http://svnweb.freebsd.org/changeset/base/260254 Log: Don't allow to create GELI providers with a sector size, which is no a power of 2. Noticed by: rwatson MFC after: 3 days Modified: head/sbin/geom/class/eli/geom_eli.c Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Sat Jan 4 09:25:27 2014 (r260253) +++ head/sbin/geom/class/eli/geom_eli.c Sat Jan 4 09:27:49 2014 (r260254) @@ -789,7 +789,7 @@ eli_init(struct gctl_req *req) if (val == 0) md.md_sectorsize = secsize; else { - if (val < 0 || (val % secsize) != 0) { + if (val < 0 || (val % secsize) != 0 || !powerof2(val)) { gctl_error(req, "Invalid sector size."); return; } From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 09:57:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3900ECCA; Sat, 4 Jan 2014 09:57: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 24E701392; Sat, 4 Jan 2014 09:57: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 s049vO1D045252; Sat, 4 Jan 2014 09:57:24 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s049vNri045251; Sat, 4 Jan 2014 09:57:23 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201401040957.s049vNri045251@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 4 Jan 2014 09:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260255 - head/usr.bin/iscsictl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 09:57:24 -0000 Author: trasz Date: Sat Jan 4 09:57:23 2014 New Revision: 260255 URL: http://svnweb.freebsd.org/changeset/base/260255 Log: Properly document -u and -s. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/iscsictl.8 Modified: head/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- head/usr.bin/iscsictl/iscsictl.8 Sat Jan 4 09:27:49 2014 (r260254) +++ head/usr.bin/iscsictl/iscsictl.8 Sat Jan 4 09:57:23 2014 (r260255) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2013 +.Dd January 4, 2014 .Dt ISCSICTL 8 .Os .Sh NAME @@ -88,8 +88,12 @@ and the temporary discovery sesion will The "nickname" of session defined in the configuration file. .It Fl p Target portal - host name or address - for statically defined targets. +.It Fl s +CHAP secret. .It Fl t Target name. +.It Fl u +CHAP login. .It Fl v Verbose mode. .El From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 10:19:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 196591CF; Sat, 4 Jan 2014 10:19: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 04B6814FB; Sat, 4 Jan 2014 10:19: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 s04AJLPK053721; Sat, 4 Jan 2014 10:19:21 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04AJL7K053720; Sat, 4 Jan 2014 10:19:21 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201401041019.s04AJL7K053720@svn.freebsd.org> From: Ruslan Bukin Date: Sat, 4 Jan 2014 10:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260256 - head/sys/dev/ffec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 10:19:22 -0000 Author: br Date: Sat Jan 4 10:19:21 2014 New Revision: 260256 URL: http://svnweb.freebsd.org/changeset/base/260256 Log: ENET on Vybrid Family SoC don't advertise its media capabilities themselves properly, so force auto-negotiation. Tested on mvf600. Reviewed by: ian Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Jan 4 09:57:23 2014 (r260255) +++ head/sys/dev/ffec/if_ffec.c Sat Jan 4 10:19:21 2014 (r260256) @@ -96,6 +96,7 @@ enum { FECTYPE_GENERIC, FECTYPE_IMX53, FECTYPE_IMX6, + FECTYPE_MVF, }; /* @@ -112,8 +113,8 @@ static struct ofw_compat_data compat_dat {"fsl,imx51-fec", FECTYPE_GENERIC}, {"fsl,imx53-fec", FECTYPE_IMX53}, {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, - {"fsl,mvf600-fec", FECTYPE_GENERIC}, - {"fsl,vf-fec", FECTYPE_GENERIC}, + {"fsl,mvf600-fec", FECTYPE_MVF}, + {"fsl,mvf-fec", FECTYPE_MVF}, {NULL, FECTYPE_NONE}, }; @@ -1686,7 +1687,8 @@ ffec_attach(device_t dev) /* Attach the mii driver. */ error = mii_attach(dev, &sc->miibus, ifp, ffec_media_change, - ffec_media_status, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + ffec_media_status, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + (sc->fectype & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); if (error != 0) { device_printf(dev, "PHY attach failed\n"); goto out; From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 11:40:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 638BDCD9; Sat, 4 Jan 2014 11:40: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 380A019EC; Sat, 4 Jan 2014 11:40: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 s04Be0Zo083445; Sat, 4 Jan 2014 11:40:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Be08B083443; Sat, 4 Jan 2014 11:40:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201401041140.s04Be08B083443@svn.freebsd.org> From: Michael Tuexen Date: Sat, 4 Jan 2014 11:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260257 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 11:40:00 -0000 Author: tuexen Date: Sat Jan 4 11:39:59 2014 New Revision: 260257 URL: http://svnweb.freebsd.org/changeset/base/260257 Log: 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. MFC after: 3 days Modified: head/lib/libc/net/sctp_sys_calls.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Sat Jan 4 10:19:21 2014 (r260256) +++ head/lib/libc/net/sctp_sys_calls.c Sat Jan 4 11:39:59 2014 (r260257) @@ -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-head@FreeBSD.ORG Sat Jan 4 15:51:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C271330; Sat, 4 Jan 2014 15:51: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 487BE1AB7; Sat, 4 Jan 2014 15:51: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 s04FpWhj080147; Sat, 4 Jan 2014 15:51:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04FpVUn080145; Sat, 4 Jan 2014 15:51:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201401041551.s04FpVUn080145@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Jan 2014 15:51:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260258 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 15:51:32 -0000 Author: mav Date: Sat Jan 4 15:51:31 2014 New Revision: 260258 URL: http://svnweb.freebsd.org/changeset/base/260258 Log: Replace locks added in r260229 to protect sequence counters with atomics. New algorithm does not create additional lock congestion, while some races it includes should not be a problem. Those races may keep requests in DRC cache for some more time by returning ACK position smaller then actual, but it still should be able to drop thems when proper ACK finally read. Races of the original algorithm based on TCP seq number were worse because they happened when reply sequence number were recorded. After that even correctly read ACKs could not clean DRC sometimes. Modified: head/sys/rpc/svc.h head/sys/rpc/svc_vc.c Modified: head/sys/rpc/svc.h ============================================================================== --- head/sys/rpc/svc.h Sat Jan 4 11:39:59 2014 (r260257) +++ head/sys/rpc/svc.h Sat Jan 4 15:51:31 2014 (r260258) @@ -168,8 +168,8 @@ typedef struct __rpc_svcxprt { time_t xp_lastactive; /* time of last RPC */ u_int64_t xp_sockref; /* set by nfsv4 to identify socket */ int xp_upcallset; /* socket upcall is set up */ - uint32_t xp_snd_cnt; /* # of bytes sent to socket */ - struct sx xp_snd_lock; /* protects xp_snd_cnt & sb_cc */ + uint32_t xp_snd_cnt; /* # of bytes to send to socket */ + uint32_t xp_snt_cnt; /* # of bytes sent to socket */ #else int xp_fd; u_short xp_port; /* associated port number */ @@ -327,7 +327,7 @@ enum svcpool_state { typedef SVCTHREAD *pool_assign_fn(SVCTHREAD *, struct svc_req *); typedef void pool_done_fn(SVCTHREAD *, struct svc_req *); typedef struct __rpc_svcpool { - struct mtx sp_lock; /* protect the transport lists */ + struct mtx_padalign sp_lock; /* protect the transport lists */ const char *sp_name; /* pool name (e.g. "nfsd", "NLM" */ enum svcpool_state sp_state; /* current pool state */ struct proc *sp_proc; /* process which is in svc_run */ Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Sat Jan 4 11:39:59 2014 (r260257) +++ head/sys/rpc/svc_vc.c Sat Jan 4 15:51:31 2014 (r260258) @@ -161,7 +161,6 @@ svc_vc_create(SVCPOOL *pool, struct sock xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); - sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = NULL; @@ -188,7 +187,6 @@ svc_vc_create(SVCPOOL *pool, struct sock return (xprt); cleanup_svc_vc_create: if (xprt) { - sx_destroy(&xprt->xp_snd_lock); sx_destroy(&xprt->xp_lock); svc_xprt_free(xprt); } @@ -237,7 +235,6 @@ svc_vc_create_conn(SVCPOOL *pool, struct xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); - sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = so; xprt->xp_p1 = cd; @@ -277,7 +274,6 @@ svc_vc_create_conn(SVCPOOL *pool, struct return (xprt); cleanup_svc_vc_create: if (xprt) { - sx_destroy(&xprt->xp_snd_lock); sx_destroy(&xprt->xp_lock); svc_xprt_free(xprt); } @@ -300,7 +296,6 @@ svc_vc_create_backchannel(SVCPOOL *pool) xprt = svc_xprt_alloc(); sx_init(&xprt->xp_lock, "xprt->xp_lock"); - sx_init(&xprt->xp_snd_lock, "xprt->xp_snd_lock"); xprt->xp_pool = pool; xprt->xp_socket = NULL; xprt->xp_p1 = cd; @@ -550,9 +545,8 @@ static bool_t svc_vc_ack(SVCXPRT *xprt, uint32_t *ack) { - sx_slock(&xprt->xp_snd_lock); - *ack = xprt->xp_snd_cnt - xprt->xp_socket->so_snd.sb_cc; - sx_sunlock(&xprt->xp_snd_lock); + *ack = atomic_load_acq_32(&xprt->xp_snt_cnt); + *ack -= xprt->xp_socket->so_snd.sb_cc; return (TRUE); } @@ -839,16 +833,16 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m len = mrep->m_pkthdr.len; *mtod(mrep, uint32_t *) = htonl(0x80000000 | (len - sizeof(uint32_t))); - sx_xlock(&xprt->xp_snd_lock); + atomic_add_acq_32(&xprt->xp_snd_cnt, len); error = sosend(xprt->xp_socket, NULL, NULL, mrep, NULL, 0, curthread); if (!error) { - xprt->xp_snd_cnt += len; + atomic_add_rel_32(&xprt->xp_snt_cnt, len); if (seq) *seq = xprt->xp_snd_cnt; stat = TRUE; - } - sx_xunlock(&xprt->xp_snd_lock); + } else + atomic_subtract_32(&xprt->xp_snd_cnt, len); } else { m_freem(mrep); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 15:51:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1C0346B; Sat, 4 Jan 2014 15:51:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BDF191ABD; Sat, 4 Jan 2014 15:51:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04FpqK0080220; Sat, 4 Jan 2014 15:51:52 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Fpqqq080219; Sat, 4 Jan 2014 15:51:52 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201401041551.s04Fpqqq080219@svn.freebsd.org> From: Kevin Lo Date: Sat, 4 Jan 2014 15:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260259 - head/usr.bin/whois X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 15:51:52 -0000 Author: kevlo Date: Sat Jan 4 15:51:52 2014 New Revision: 260259 URL: http://svnweb.freebsd.org/changeset/base/260259 Log: The whois() function is called in a loop so make sure we close the socket to the whois server before returning. Obtained from: OpenBSD Modified: head/usr.bin/whois/whois.c Modified: head/usr.bin/whois/whois.c ============================================================================== --- head/usr.bin/whois/whois.c Sat Jan 4 15:51:31 2014 (r260258) +++ head/usr.bin/whois/whois.c Sat Jan 4 15:51:52 2014 (r260259) @@ -275,7 +275,7 @@ s_asprintf(char **ret, const char *forma static void whois(const char *query, const char *hostname, int flags) { - FILE *sfi, *sfo; + FILE *fp; struct addrinfo *hostres, *res; char *buf, *host, *nhost, *p; int i, s; @@ -295,20 +295,19 @@ whois(const char *query, const char *hos if (res == NULL) err(EX_OSERR, "connect()"); - sfi = fdopen(s, "r"); - sfo = fdopen(s, "w"); - if (sfi == NULL || sfo == NULL) + fp = fdopen(s, "r+"); + if (fp == NULL) err(EX_OSERR, "fdopen()"); if (strcmp(hostname, GERMNICHOST) == 0) { - fprintf(sfo, "-T dn,ace -C US-ASCII %s\r\n", query); + fprintf(fp, "-T dn,ace -C US-ASCII %s\r\n", query); } else if (strcmp(hostname, "dk" QNICHOST_TAIL) == 0) { - fprintf(sfo, "--show-handles %s\r\n", query); + fprintf(fp, "--show-handles %s\r\n", query); } else { - fprintf(sfo, "%s\r\n", query); + fprintf(fp, "%s\r\n", query); } - fflush(sfo); + fflush(fp); nhost = NULL; - while ((buf = fgetln(sfi, &len)) != NULL) { + while ((buf = fgetln(fp, &len)) != NULL) { while (len > 0 && isspace((unsigned char)buf[len - 1])) buf[--len] = '\0'; printf("%.*s\n", (int)len, buf); @@ -350,6 +349,7 @@ whois(const char *query, const char *hos } } } + fclose(fp); if (nhost != NULL) { whois(query, nhost, 0); free(nhost); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 16:41:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08C8B113; Sat, 4 Jan 2014 16:41:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E054C1EA3; Sat, 4 Jan 2014 16:41: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 s04GfhRK099328; Sat, 4 Jan 2014 16:41:43 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04GfhfQ099327; Sat, 4 Jan 2014 16:41:43 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201401041641.s04GfhfQ099327@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 4 Jan 2014 16:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260260 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 16:41:44 -0000 Author: gavin Date: Sat Jan 4 16:41:43 2014 New Revision: 260260 URL: http://svnweb.freebsd.org/changeset/base/260260 Log: Remove what appears to be a stray debugging printf. MFC after: 1 week Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 15:51:52 2014 (r260259) +++ head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 16:41:43 2014 (r260260) @@ -111,7 +111,6 @@ echo "network={ priority=5 }" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf elif echo $ENCRYPTION | grep -q WEP; then - echo FOO exec 3>&1 WEPKEY=`dialog --insecure --backtitle "FreeBSD Installer" \ --title "WEP Setup" --mixedform "" 0 0 0 \ From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 16:44:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D39D305; Sat, 4 Jan 2014 16:44: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 696671EBC; Sat, 4 Jan 2014 16:44: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 s04Gi6qd099668; Sat, 4 Jan 2014 16:44:06 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Gi67i099667; Sat, 4 Jan 2014 16:44:06 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201401041644.s04Gi67i099667@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 4 Jan 2014 16:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260261 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 16:44:06 -0000 Author: gavin Date: Sat Jan 4 16:44:05 2014 New Revision: 260261 URL: http://svnweb.freebsd.org/changeset/base/260261 Log: Lower the priority of the "connect to any open wireless network" network description, so guaranteeing that any other defined network will be tried first. MFC after: 1 week Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 16:41:43 2014 (r260260) +++ head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 16:44:05 2014 (r260261) @@ -135,7 +135,7 @@ fi # Connect to any open networks policy echo "network={ - priority=5 + priority=0 key_mgmt=NONE }" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 17:09:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 301F266E; Sat, 4 Jan 2014 17:09: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 1BFC21022; Sat, 4 Jan 2014 17:09: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 s04H9fB9008105; Sat, 4 Jan 2014 17:09:41 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04H9fhh008104; Sat, 4 Jan 2014 17:09:41 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201401041709.s04H9fhh008104@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 4 Jan 2014 17:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260262 - head/usr.sbin/bsdinstall/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 17:09:42 -0000 Author: gavin Date: Sat Jan 4 17:09:41 2014 New Revision: 260262 URL: http://svnweb.freebsd.org/changeset/base/260262 Log: Allow bsdinstall to use WPA-Enterprise networks when installing. This only allows basic username/password config, and does not provide the ability to set any of the other WPA options. Regardless, this is generally sufficient to associate. Perhaps in the future this could allow full configuring (e.g. being able to set "anonymous identity", and perhaps some of the more obscure WPA options), though perhaps that will better belong in bsdconfig when that grows wlan config ability. MFC after: 1 week Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig Modified: head/usr.sbin/bsdinstall/scripts/wlanconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 16:44:05 2014 (r260261) +++ head/usr.sbin/bsdinstall/scripts/wlanconfig Sat Jan 4 17:09:41 2014 (r260262) @@ -110,6 +110,29 @@ echo "network={ psk=\"$PASS\" priority=5 }" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf +elif echo $ENCRYPTION | grep -q EAP; then + exec 3>&1 + USERPASS=`dialog --insecure --backtitle "FreeBSD Installer" \ + --title "WPA-Enterprise Setup" --mixedform "" 0 0 0 \ + "SSID" 1 0 "$NETWORK" 1 12 0 0 2 \ + "Username" 2 0 "" 2 12 25 63 0 \ + "Password" 3 0 "" 3 12 25 63 1 \ + 2>&1 1>&3` \ + || exec $0 $@ + exec 3>&- +echo "network={ + ssid=\"$NETWORK\" + key_mgmt=WPA-EAP" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf +echo "$USERPASS" | awk ' +{ + if (NR == 1) { + printf " identity=\"%s\"\n", $1; + } else if (NR == 2) { + printf " password=\"%s\"\n", $1; + } +}' >> $BSDINSTALL_TMPETC/wpa_supplicant.conf +echo " priority=5 +}" >> $BSDINSTALL_TMPETC/wpa_supplicant.conf elif echo $ENCRYPTION | grep -q WEP; then exec 3>&1 WEPKEY=`dialog --insecure --backtitle "FreeBSD Installer" \ From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 17:52:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96048BAB; Sat, 4 Jan 2014 17:52: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 81C1E134E; Sat, 4 Jan 2014 17:52: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 s04HqhU4026319; Sat, 4 Jan 2014 17:52:43 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04HqhiF026318; Sat, 4 Jan 2014 17:52:43 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201401041752.s04HqhiF026318@svn.freebsd.org> From: Steven Hartland Date: Sat, 4 Jan 2014 17:52:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260267 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 17:52:43 -0000 Author: smh Date: Sat Jan 4 17:52:43 2014 New Revision: 260267 URL: http://svnweb.freebsd.org/changeset/base/260267 Log: Correct short delete issue in SCSI UNMAP support Correct missing \n's in xpt_print's Correct incorrect count being passed to short delete xpt_print MFC after: 1 week Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sat Jan 4 17:36:13 2014 (r260266) +++ head/sys/cam/scsi/scsi_da.c Sat Jan 4 17:52:43 2014 (r260267) @@ -211,7 +211,7 @@ struct da_softc { int delete_running; int delete_available; /* Delete methods possibly available */ uint32_t unmap_max_ranges; - uint32_t unmap_max_lba; + uint32_t unmap_max_lba; /* Max LBAs in a single range */ uint64_t ws_max_blks; da_delete_methods delete_method; da_delete_func_t *delete_func; @@ -1246,7 +1246,7 @@ daopen(struct disk *dp) error = cam_periph_sleep(periph, &softc->disk->d_mediasize, PRIBIO, "dareprobe", 0); if (error != 0) - xpt_print(periph->path, "unable to retrieve capacity data"); + xpt_print(periph->path, "unable to retrieve capacity data\n"); if (periph->flags & CAM_PERIPH_INVALID) error = ENXIO; @@ -2525,7 +2525,6 @@ da_delete_unmap(struct cam_periph *perip struct bio *bp1; uint8_t *buf = softc->unmap_buf; uint64_t lba, lastlba = (uint64_t)-1; - uint64_t totalcount = 0; uint64_t count; uint32_t lastcount = 0, c; uint32_t off, ranges = 0; @@ -2559,35 +2558,34 @@ da_delete_unmap(struct cam_periph *perip scsi_ulto4b(lastcount, &buf[off + 8]); count -= c; lba +=c; - totalcount += c; } while (count > 0) { - c = min(count, softc->unmap_max_lba); - if (totalcount + c > softc->unmap_max_lba || - ranges >= softc->unmap_max_ranges) { + if (ranges > softc->unmap_max_ranges) { xpt_print(periph->path, - "%s issuing short delete %ld > %ld" - "|| %d >= %d", + "%s issuing short delete %d > %d\n", da_delete_method_desc[softc->delete_method], - totalcount + c, softc->unmap_max_lba, ranges, softc->unmap_max_ranges); break; } + c = min(count, softc->unmap_max_lba); off = (ranges * UNMAP_RANGE_SIZE) + UNMAP_HEAD_SIZE; scsi_u64to8b(lba, &buf[off + 0]); scsi_ulto4b(c, &buf[off + 8]); lba += c; - totalcount += c; ranges++; count -= c; lastcount = c; } lastlba = lba; bp1 = bioq_first(&softc->delete_queue); + /* + * Assume no range extension on the next loop iteration to + * avoid issuing a short delete. + */ if (bp1 == NULL || ranges >= softc->unmap_max_ranges || - totalcount + bp1->bio_bcount / - softc->params.secsize > softc->unmap_max_lba) + bp1->bio_bcount / softc->params.secsize > + softc->unmap_max_lba * (softc->unmap_max_ranges - ranges)) break; } while (1); scsi_ulto2b(ranges * 16 + 6, &buf[0]); @@ -2658,7 +2656,7 @@ da_delete_trim(struct cam_periph *periph lastcount = c; if (count != 0 && ranges == softc->trim_max_ranges) { xpt_print(periph->path, - "%s issuing short delete %ld > %ld", + "%s issuing short delete %ld > %ld\n", da_delete_method_desc[softc->delete_method], requestcount, (softc->trim_max_ranges - ranges) * @@ -2690,7 +2688,7 @@ da_delete_trim(struct cam_periph *periph /* * We calculate ws_max_blks here based off d_delmaxsize instead * of using softc->ws_max_blks as it is absolute max for the - * device not the protocol max which may well be lower + * device not the protocol max which may well be lower. */ static void da_delete_ws(struct cam_periph *periph, union ccb *ccb, struct bio *bp) @@ -2713,11 +2711,11 @@ da_delete_ws(struct cam_periph *periph, bioq_insert_tail(&softc->delete_run_queue, bp1); count += bp1->bio_bcount / softc->params.secsize; if (count > ws_max_blks) { - count = min(count, ws_max_blks); xpt_print(periph->path, - "%s issuing short delete %ld > %ld", + "%s issuing short delete %ld > %ld\n", da_delete_method_desc[softc->delete_method], count, ws_max_blks); + count = min(count, ws_max_blks); break; } bp1 = bioq_first(&softc->delete_queue); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 20:59:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A911921; Sat, 4 Jan 2014 20:59: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 2C60A10D3; Sat, 4 Jan 2014 20:59: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 s04Kx4Ae097425; Sat, 4 Jan 2014 20:59:04 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Kx3H2097424; Sat, 4 Jan 2014 20:59:04 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201401042059.s04Kx3H2097424@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Jan 2014 20:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260281 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 20:59:04 -0000 Author: nwhitehorn Date: Sat Jan 4 20:59:03 2014 New Revision: 260281 URL: http://svnweb.freebsd.org/changeset/base/260281 Log: Implement OFW_BUS_MAP_INTR() in terms of the FDT PIC table, which will become an ARM-specific quirk. Modified: head/sys/arm/arm/nexus.c Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Sat Jan 4 19:51:57 2014 (r260280) +++ head/sys/arm/arm/nexus.c Sat Jan 4 20:59:03 2014 (r260281) @@ -64,7 +64,9 @@ __FBSDID("$FreeBSD$"); #ifdef FDT #include +#include #include +#include "ofw_bus_if.h" #else static MALLOC_DEFINE(M_NEXUSDEV, "nexusdev", "Nexus device"); @@ -94,6 +96,11 @@ static int nexus_setup_intr(device_t dev int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +#ifdef FDT +static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, + int irq); +#endif + static device_method_t nexus_methods[] = { #ifndef FDT /* Device interface */ @@ -109,6 +116,9 @@ static device_method_t nexus_methods[] = DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), +#ifdef FDT + DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), +#endif { 0, 0 } }; @@ -300,3 +310,33 @@ nexus_deactivate_resource(device_t bus, return (rman_deactivate_resource(res)); } +#ifdef FDT +static int +nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int irq) +{ + pcell_t intr[2]; + fdt_pic_decode_t intr_decode; + phandle_t intr_offset; + int i, rv, interrupt, trig, pol; + + intr_offset = OF_xref_phandle(iparent); + intr[0] = cpu_to_fdt32(irq); + + for (i = 0; fdt_pic_table[i] != NULL; i++) { + intr_decode = fdt_pic_table[i]; + rv = intr_decode(intr_offset, intr, &interrupt, &trig, &pol); + + if (rv == 0) { + /* This was recognized as our PIC and decoded. */ + interrupt = FDT_MAP_IRQ(intr_parent, interrupt); + return (interrupt); + } + } + + /* Not in table, so guess */ + interrupt = FDT_MAP_IRQ(intr_parent, fdt32_to_cpu(*intr)); + + return (interrupt); +} +#endif + From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 21:14:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B8D8B98; Sat, 4 Jan 2014 21:14: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 4BB8911C8; Sat, 4 Jan 2014 21:14:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04LEY1P005065; Sat, 4 Jan 2014 21:14:34 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04LEX3c005060; Sat, 4 Jan 2014 21:14:33 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201401042114.s04LEX3c005060@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Jan 2014 21:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260282 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 21:14:34 -0000 Author: nwhitehorn Date: Sat Jan 4 21:14:33 2014 New Revision: 260282 URL: http://svnweb.freebsd.org/changeset/base/260282 Log: Reimplement fdt_intr_to_rl() in terms of OFW_BUS_MAP_INTR() and OFW_BUS_CONFIG_INTR(). This function is only used by simplebus, so will likely be moved there in the future. Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sat Jan 4 20:59:03 2014 (r260281) +++ head/sys/dev/fdt/fdt_common.c Sat Jan 4 21:14:33 2014 (r260282) @@ -474,104 +474,32 @@ out: } int -fdt_intr_decode(phandle_t intr_parent, pcell_t *intr, int *interrupt, - int *trig, int *pol) -{ - fdt_pic_decode_t intr_decode; - phandle_t intr_offset; - int i, rv; - - intr_offset = OF_xref_phandle(intr_parent); - - for (i = 0; fdt_pic_table[i] != NULL; i++) { - - /* XXX check if pic_handle has interrupt-controller prop? */ - - intr_decode = fdt_pic_table[i]; - rv = intr_decode(intr_offset, intr, interrupt, trig, pol); - - if (rv == 0) { - /* This was recognized as our PIC and decoded. */ - *interrupt = FDT_MAP_IRQ(intr_parent, *interrupt); - return (0); - } - } - - /* Not in table, so guess */ - *interrupt = FDT_MAP_IRQ(intr_parent, fdt32_to_cpu(*intr)); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); -} - -int -fdt_intr_to_rl(phandle_t node, struct resource_list *rl, +fdt_intr_to_rl(device_t dev, phandle_t node, struct resource_list *rl, struct fdt_sense_level *intr_sl) { - phandle_t intr_par; - phandle_t iph; - pcell_t *intr; - pcell_t intr_cells; - int interrupt, trig, pol; - int i, intr_num, rv; - - if (OF_getproplen(node, "interrupts") <= 0) - /* Node does not have 'interrupts' property. */ - return (0); - - /* - * Find #interrupt-cells of the interrupt domain. - */ - if (OF_getencprop(node, "interrupt-parent", &iph, sizeof(iph)) <= 0) { - debugf("no intr-parent phandle\n"); - intr_par = OF_parent(node); - } else { - intr_par = OF_xref_phandle(iph); - } - - if (OF_getprop(intr_par, "#interrupt-cells", &intr_cells, - sizeof(intr_cells)) <= 0) { - debugf("no intr-cells defined, defaulting to 1\n"); - intr_cells = 1; - } - else - intr_cells = fdt32_to_cpu(intr_cells); - - intr_num = OF_getprop_alloc(node, "interrupts", - intr_cells * sizeof(pcell_t), (void **)&intr); - if (intr_num <= 0 || intr_num > DI_MAX_INTR_NUM) - return (ERANGE); - - rv = 0; - for (i = 0; i < intr_num; i++) { - - interrupt = -1; - trig = pol = 0; - - if (fdt_intr_decode(iph, &intr[i * intr_cells], - &interrupt, &trig, &pol) != 0) { - rv = ENXIO; - goto out; + phandle_t iparent; + uint32_t *intr, icells; + int nintr, i, k; + + nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + (void **)&intr); + if (nintr > 0) { + iparent = 0; + OF_searchencprop(node, "interrupt-parent", &iparent, + sizeof(iparent)); + OF_searchencprop(OF_xref_phandle(iparent), "#interrupt-cells", + &icells, sizeof(icells)); + for (i = 0, k = 0; i < nintr; i += icells, k++) { + intr[i] = ofw_bus_map_intr(dev, iparent, intr[i]); + resource_list_add(rl, SYS_RES_IRQ, k, intr[i], intr[i], + 1); + if (icells > 1) + ofw_bus_config_intr(dev, intr[i], intr[i+1]); } - - if (interrupt < 0) { - rv = ERANGE; - goto out; - } - - debugf("decoded intr = %d, trig = %d, pol = %d\n", interrupt, - trig, pol); - - intr_sl[i].trig = trig; - intr_sl[i].pol = pol; - - resource_list_add(rl, SYS_RES_IRQ, i, interrupt, interrupt, 1); + free(intr, M_OFWPROP); } -out: - free(intr, M_OFWPROP); - return (rv); + return (0); } int Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Sat Jan 4 20:59:03 2014 (r260281) +++ head/sys/dev/fdt/fdt_common.h Sat Jan 4 21:14:33 2014 (r260282) @@ -94,8 +94,7 @@ int fdt_get_phyaddr(phandle_t, device_t, int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); int fdt_regsize(phandle_t, u_long *, u_long *); -int fdt_intr_decode(phandle_t, pcell_t *, int *, int *, int *); -int fdt_intr_to_rl(phandle_t, struct resource_list *, struct fdt_sense_level *); +int fdt_intr_to_rl(device_t, phandle_t, struct resource_list *, struct fdt_sense_level *); int fdt_is_compatible(phandle_t, const char *); int fdt_is_compatible_strict(phandle_t, const char *); int fdt_is_enabled(phandle_t); Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Sat Jan 4 20:59:03 2014 (r260281) +++ head/sys/dev/fdt/simplebus.c Sat Jan 4 21:14:33 2014 (r260282) @@ -196,7 +196,7 @@ simplebus_attach(device_t dev) continue; } - if (fdt_intr_to_rl(dt_child, &di->di_res, di->di_intr_sl)) { + if (fdt_intr_to_rl(dev, dt_child, &di->di_res, di->di_intr_sl)) { device_printf(dev, "%s: could not process " "'interrupts' property\n", di->di_ofw.obd_name); resource_list_free(&di->di_res); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 21:18:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9DA2FCF3; Sat, 4 Jan 2014 21:18: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 70C1911DB; Sat, 4 Jan 2014 21:18:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04LINcA005544; Sat, 4 Jan 2014 21:18:23 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04LINGv005543; Sat, 4 Jan 2014 21:18:23 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401042118.s04LINGv005543@svn.freebsd.org> From: Ian Lepore Date: Sat, 4 Jan 2014 21:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260283 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 21:18:23 -0000 Author: ian Date: Sat Jan 4 21:18:22 2014 New Revision: 260283 URL: http://svnweb.freebsd.org/changeset/base/260283 Log: Use bus_space_map() rather than pmap_mapdev() in nexus_activate_resource(), when running on FDT systems. Unmap memory in nexus_deactivate_resource(). Also, call rman_activate_resource() before mapping device memory, and only do the mapping if it returns success. Reviewed by: nwhitehorn Modified: head/sys/arm/arm/nexus.c Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Sat Jan 4 21:14:33 2014 (r260282) +++ head/sys/arm/arm/nexus.c Sat Jan 4 21:18:22 2014 (r260283) @@ -278,36 +278,63 @@ static int nexus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + int err; + bus_addr_t paddr; + bus_size_t psize; + bus_space_handle_t vaddr; + + if ((err = rman_activate_resource(r)) != 0) + return (err); + /* * If this is a memory resource, map it into the kernel. */ if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - caddr_t vaddr = 0; - u_int32_t paddr; - u_int32_t psize; - u_int32_t poffs; - - paddr = rman_get_start(r); - psize = rman_get_size(r); - poffs = paddr - trunc_page(paddr); - vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs; - rman_set_virtual(r, vaddr); + paddr = (bus_addr_t)rman_get_start(r); + psize = (bus_size_t)rman_get_size(r); #ifdef FDT + err = bus_space_map(fdtbus_bs_tag, paddr, psize, 0, &vaddr); + if (err != 0) { + rman_deactivate_resource(r); + return (err); + } rman_set_bustag(r, fdtbus_bs_tag); #else + vaddr = (bus_space_handle_t)pmap_mapdev((vm_offset_t)paddr, + (vm_size_t)psize); + if (vaddr == 0) { + rman_deactivate_resource(r); + return (ENOMEM); + } rman_set_bustag(r, (void *)1); #endif - rman_set_bushandle(r, (bus_space_handle_t) vaddr); + rman_set_virtual(r, (void *)vaddr); + rman_set_bushandle(r, vaddr); } - return (rman_activate_resource(r)); + return (0); } static int nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) + struct resource *r) { + bus_size_t psize; + bus_space_handle_t vaddr; + + psize = (bus_size_t)rman_get_size(r); + vaddr = rman_get_bushandle(r); + + if (vaddr != 0) { +#ifdef FDT + bus_space_unmap(fdtbus_bs_tag, vaddr, psize); +#else + pmap_unmapdev((vm_offset_t)vaddr, (vm_size_t)psize); +#endif + rman_set_virtual(r, NULL); + rman_set_bushandle(r, 0); + } - return (rman_deactivate_resource(res)); + return (rman_deactivate_resource(r)); } #ifdef FDT From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 21:19:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AF9F25B; Sat, 4 Jan 2014 21:19: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 657D811ED; Sat, 4 Jan 2014 21:19:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04LJL6m005758; Sat, 4 Jan 2014 21:19:21 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04LJKWG005744; Sat, 4 Jan 2014 21:19:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201401042119.s04LJKWG005744@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 4 Jan 2014 21:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260285 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 21:19:21 -0000 Author: nwhitehorn Date: Sat Jan 4 21:19:20 2014 New Revision: 260285 URL: http://svnweb.freebsd.org/changeset/base/260285 Log: Remove fdt_pic_table code from MIPS, PowerPC, and x86, as it is no longer used by anything. The equivalent functionality is provided by the PIC drivers themselves on PowerPC and this is a no-op on MIPS and x86. Modified: head/sys/dev/fdt/fdt_mips.c head/sys/dev/fdt/fdt_powerpc.c head/sys/dev/fdt/fdt_x86.c Modified: head/sys/dev/fdt/fdt_mips.c ============================================================================== --- head/sys/dev/fdt/fdt_mips.c Sat Jan 4 21:18:54 2014 (r260284) +++ head/sys/dev/fdt/fdt_mips.c Sat Jan 4 21:19:20 2014 (r260285) @@ -49,45 +49,3 @@ struct fdt_fixup_entry fdt_fixup_table[] { NULL, NULL } }; -/* - * For PIC-free boards, provide a PIC decoder to be used with mips4k CP0 - * interrupt control directly. - */ -static int -fdt_pic_decode_mips4k_cp0(phandle_t node, pcell_t *intr, int *interrupt, - int *trig, int *pol) -{ - - if (!fdt_is_compatible(node, "mips,mips4k")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); -} - -/* - * CHERI PIC decoder. - */ -static int -fdt_pic_decode_beri(phandle_t node, pcell_t *intr, int *interrupt, - int *trig, int *pol) -{ - - if (!fdt_is_compatible(node, "sri-cambridge,beri-pic")) - return (ENXIO); - - *interrupt = fdt32_to_cpu(intr[0]); - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_pic_decode_mips4k_cp0, - &fdt_pic_decode_beri, - NULL -}; Modified: head/sys/dev/fdt/fdt_powerpc.c ============================================================================== --- head/sys/dev/fdt/fdt_powerpc.c Sat Jan 4 21:18:54 2014 (r260284) +++ head/sys/dev/fdt/fdt_powerpc.c Sat Jan 4 21:19:20 2014 (r260285) @@ -81,89 +81,3 @@ struct fdt_fixup_entry fdt_fixup_table[] { NULL, NULL } }; -static int -fdt_pic_decode_iic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, - int *pol) -{ - if (!fdt_is_compatible(node, "chrp,iic")) - return (ENXIO); - - *interrupt = intr[0]; - - switch (intr[1]) { - case 0: - /* Active L level */ - *trig = INTR_TRIGGER_LEVEL; - *pol = INTR_POLARITY_LOW; - break; - case 1: - /* Active H level */ - *trig = INTR_TRIGGER_LEVEL; - *pol = INTR_POLARITY_HIGH; - break; - case 2: - /* H to L edge */ - *trig = INTR_TRIGGER_EDGE; - *pol = INTR_POLARITY_LOW; - break; - case 3: - /* L to H edge */ - *trig = INTR_TRIGGER_EDGE; - *pol = INTR_POLARITY_HIGH; - break; - default: - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - } - return (0); -} - -static int -fdt_pic_decode_openpic(phandle_t node, pcell_t *intr, int *interrupt, - int *trig, int *pol) -{ - - if (!fdt_is_compatible(node, "chrp,open-pic") && - !fdt_is_type(node, "open-pic")) - return (ENXIO); - - /* - * XXX The interrupt number read out from the MPC85XX device tree is - * already offset by 16 to reflect the 'internal' IRQ range shift on - * the OpenPIC. - */ - *interrupt = intr[0]; - - switch (intr[1]) { - case 0: - /* L to H edge */ - *trig = INTR_TRIGGER_EDGE; - *pol = INTR_POLARITY_HIGH; - break; - case 1: - /* Active L level */ - *trig = INTR_TRIGGER_LEVEL; - *pol = INTR_POLARITY_LOW; - break; - case 2: - /* Active H level */ - *trig = INTR_TRIGGER_LEVEL; - *pol = INTR_POLARITY_HIGH; - break; - case 3: - /* H to L edge */ - *trig = INTR_TRIGGER_EDGE; - *pol = INTR_POLARITY_LOW; - break; - default: - *trig = INTR_TRIGGER_CONFORM; - *pol = INTR_POLARITY_CONFORM; - } - return (0); -} - -fdt_pic_decode_t fdt_pic_table[] = { - &fdt_pic_decode_iic, - &fdt_pic_decode_openpic, - NULL -}; Modified: head/sys/dev/fdt/fdt_x86.c ============================================================================== --- head/sys/dev/fdt/fdt_x86.c Sat Jan 4 21:18:54 2014 (r260284) +++ head/sys/dev/fdt/fdt_x86.c Sat Jan 4 21:19:20 2014 (r260285) @@ -46,6 +46,3 @@ struct fdt_fixup_entry fdt_fixup_table[] { NULL, NULL } }; -fdt_pic_decode_t fdt_pic_table[] = { - NULL -}; From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 21:38:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB23DFB8; Sat, 4 Jan 2014 21:38: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 B7AAB131F; Sat, 4 Jan 2014 21:38: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 s04LcfbY013505; Sat, 4 Jan 2014 21:38:41 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Lcfh2013504; Sat, 4 Jan 2014 21:38:41 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401042138.s04Lcfh2013504@svn.freebsd.org> From: Ian Lepore Date: Sat, 4 Jan 2014 21:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260288 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 21:38:41 -0000 Author: ian Date: Sat Jan 4 21:38:41 2014 New Revision: 260288 URL: http://svnweb.freebsd.org/changeset/base/260288 Log: In pmap_mapdev(), first check whether a static mapping exists, and if so use it rather than allocating kva space and making another mapping. In pmap_unmapdev(), don't unmap/free if the mapping is static. Modified: head/sys/arm/arm/devmap.c Modified: head/sys/arm/arm/devmap.c ============================================================================== --- head/sys/arm/arm/devmap.c Sat Jan 4 21:32:53 2014 (r260287) +++ head/sys/arm/arm/devmap.c Sat Jan 4 21:38:41 2014 (r260288) @@ -207,13 +207,23 @@ arm_devmap_vtop(void * vpva, vm_size_t s /* * Map a set of physical memory pages into the kernel virtual address space. - * Return a pointer to where it is mapped. This routine is intended to be used - * for mapping device memory, NOT real memory. + * Return a pointer to where it is mapped. + * + * This uses a pre-established static mapping if one exists for the requested + * range, otherwise it allocates kva space and maps the physical pages into it. + * + * This routine is intended to be used for mapping device memory, NOT real + * memory; the mapping type is inherently PTE_DEVICE in pmap_kenter_device(). */ void * pmap_mapdev(vm_offset_t pa, vm_size_t size) { vm_offset_t va, tmpva, offset; + void * rva; + + /* First look in the static mapping table. */ + if ((rva = arm_devmap_ptov(pa, size)) != NULL) + return (rva); offset = pa & PAGE_MASK; pa = trunc_page(pa); @@ -240,8 +250,13 @@ void pmap_unmapdev(vm_offset_t va, vm_size_t size) { vm_offset_t tmpva, offset; - vm_size_t origsize = size; - + vm_size_t origsize; + + /* Nothing to do if we find the mapping in the static table. */ + if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) + return; + + origsize = size; offset = va & PAGE_MASK; va = trunc_page(va); size = round_page(size + offset); From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 21:55:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A7DD80F; Sat, 4 Jan 2014 21:55: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 86C25149F; Sat, 4 Jan 2014 21:55: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 s04Lt6q6020535; Sat, 4 Jan 2014 21:55:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04Lt6HY020533; Sat, 4 Jan 2014 21:55:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201401042155.s04Lt6HY020533@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 4 Jan 2014 21:55:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260290 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 21:55:06 -0000 Author: pjd Date: Sat Jan 4 21:55:06 2014 New Revision: 260290 URL: http://svnweb.freebsd.org/changeset/base/260290 Log: 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 MFC after: 3 days Modified: head/sys/sys/user.h Modified: head/sys/sys/user.h ============================================================================== --- head/sys/sys/user.h Sat Jan 4 21:45:52 2014 (r260289) +++ head/sys/sys/user.h Sat Jan 4 21:55:06 2014 (r260290) @@ -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-head@FreeBSD.ORG Sat Jan 4 22:09:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2898E70; Sat, 4 Jan 2014 22:09:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4E96153A; Sat, 4 Jan 2014 22:09:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04M9rWd025349; Sat, 4 Jan 2014 22:09:53 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04M9rJs025348; Sat, 4 Jan 2014 22:09:53 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401042209.s04M9rJs025348@svn.freebsd.org> From: Ian Lepore Date: Sat, 4 Jan 2014 22:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260292 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 22:09:54 -0000 Author: ian Date: Sat Jan 4 22:09:53 2014 New Revision: 260292 URL: http://svnweb.freebsd.org/changeset/base/260292 Log: Convert static device mapping to use the new arm_devmap_add_entry(), and add static mappings that cover most of the on-chip peripherals with 1MB section mappings. This adds about 220MB or so available kva space by not using a hard-coded 0xF0000000 as the mapping address. Modified: head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sat Jan 4 22:00:07 2014 (r260291) +++ head/sys/arm/ti/ti_machdep.c Sat Jan 4 22:09:53 2014 (r260292) @@ -54,23 +54,18 @@ __FBSDID("$FreeBSD$"); #include -/* Start of address space used for bootstrap map */ -#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 - -void (*ti_cpu_reset)(void); +void (*ti_cpu_reset)(void) = NULL; vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START); + return (arm_devmap_lastaddr()); } void initarm_early_init(void) { - - ti_cpu_reset = NULL; } void @@ -83,38 +78,27 @@ initarm_late_init(void) { } -#define FDT_DEVMAP_MAX (2) // FIXME -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - - /* - * Construct pmap_devmap[] with DT-derived config data. + * Construct static devmap entries to map out the most frequently used + * peripherals using 1mb section mappings. */ int initarm_devmap_init(void) { - int i = 0; #if defined(SOC_OMAP4) - fdt_devmap[i].pd_va = 0xF8000000; - fdt_devmap[i].pd_pa = 0x48000000; - fdt_devmap[i].pd_size = 0x1000000; - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_DEVICE; - i++; + arm_devmap_add_entry(0x48000000, 0x01000000); // 16mb L4_PER devices + arm_devmap_add_entry(0x4A000000, 0x01000000); // 16mb L4_CFG devices #elif defined(SOC_TI_AM335X) - fdt_devmap[i].pd_va = 0xF4C00000; - fdt_devmap[i].pd_pa = 0x44C00000; /* L4_WKUP */ - fdt_devmap[i].pd_size = 0x400000; /* 4 MB */ - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_DEVICE; - i++; + arm_devmap_add_entry(0x44C00000, 0x00400000); // 4mb L4_WKUP devices + arm_devmap_add_entry(0x47400000, 0x00100000); // 1mb USB + arm_devmap_add_entry(0x47800000, 0x00100000); // 1mb mmchs2 + arm_devmap_add_entry(0x48000000, 0x01000000); // 16mb L4_PER devices + arm_devmap_add_entry(0x49000000, 0x00100000); // 1mb edma3 + arm_devmap_add_entry(0x49800000, 0x00300000); // 3mb edma3 + arm_devmap_add_entry(0x4A000000, 0x01000000); // 16mb L4_FAST devices #else #error "Unknown SoC" #endif - - arm_devmap_register_table(&fdt_devmap[0]); return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 22:15:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A1FE4C6; Sat, 4 Jan 2014 22:15:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 269C915E3; Sat, 4 Jan 2014 22:15: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 s04MF0ro028786; Sat, 4 Jan 2014 22:15:00 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04MExBK028778; Sat, 4 Jan 2014 22:14:59 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401042214.s04MExBK028778@svn.freebsd.org> From: Ian Lepore Date: Sat, 4 Jan 2014 22:14:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260294 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 22:15:00 -0000 Author: ian Date: Sat Jan 4 22:14:59 2014 New Revision: 260294 URL: http://svnweb.freebsd.org/changeset/base/260294 Log: Doh! Use C comments, not C++. Modified: head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sat Jan 4 22:13:16 2014 (r260293) +++ head/sys/arm/ti/ti_machdep.c Sat Jan 4 22:14:59 2014 (r260294) @@ -86,16 +86,16 @@ int initarm_devmap_init(void) { #if defined(SOC_OMAP4) - arm_devmap_add_entry(0x48000000, 0x01000000); // 16mb L4_PER devices - arm_devmap_add_entry(0x4A000000, 0x01000000); // 16mb L4_CFG devices + arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ + arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_CFG devices */ #elif defined(SOC_TI_AM335X) - arm_devmap_add_entry(0x44C00000, 0x00400000); // 4mb L4_WKUP devices - arm_devmap_add_entry(0x47400000, 0x00100000); // 1mb USB - arm_devmap_add_entry(0x47800000, 0x00100000); // 1mb mmchs2 - arm_devmap_add_entry(0x48000000, 0x01000000); // 16mb L4_PER devices - arm_devmap_add_entry(0x49000000, 0x00100000); // 1mb edma3 - arm_devmap_add_entry(0x49800000, 0x00300000); // 3mb edma3 - arm_devmap_add_entry(0x4A000000, 0x01000000); // 16mb L4_FAST devices + arm_devmap_add_entry(0x44C00000, 0x00400000); /* 4mb L4_WKUP devices*/ + arm_devmap_add_entry(0x47400000, 0x00100000); /* 1mb USB */ + arm_devmap_add_entry(0x47800000, 0x00100000); /* 1mb mmchs2 */ + arm_devmap_add_entry(0x48000000, 0x01000000); /*16mb L4_PER devices */ + arm_devmap_add_entry(0x49000000, 0x00100000); /* 1mb edma3 */ + arm_devmap_add_entry(0x49800000, 0x00300000); /* 3mb edma3 */ + arm_devmap_add_entry(0x4A000000, 0x01000000); /*16mb L4_FAST devices*/ #else #error "Unknown SoC" #endif From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 22:25:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 369D79DB; Sat, 4 Jan 2014 22:25:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 21A3D16A3; Sat, 4 Jan 2014 22:25:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04MPRCB032561; Sat, 4 Jan 2014 22:25:28 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04MPRtX032553; Sat, 4 Jan 2014 22:25:27 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201401042225.s04MPRtX032553@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 4 Jan 2014 22:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260295 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 22:25:28 -0000 Author: melifaro Date: Sat Jan 4 22:25:26 2014 New Revision: 260295 URL: http://svnweb.freebsd.org/changeset/base/260295 Log: Change semantics for rnh_lookup() function: now it performs exact match search, regardless of netmask existance. This simplifies most of rnh_lookup() consumers. Fix panic triggered by deleting non-existent host route. PR: kern/185092 Submitted by: Nikolay Denev MFC after: 1 month Modified: head/sys/net/radix.c head/sys/net/radix.h head/sys/net/radix_mpath.c head/sys/net/route.c head/sys/net/rtsock.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Sat Jan 4 22:14:59 2014 (r260294) +++ head/sys/net/radix.c Sat Jan 4 22:25:26 2014 (r260295) @@ -208,24 +208,50 @@ rn_refines(void *m_arg, void *n_arg) return (!masks_are_equal); } +/* + * Search for exact match in given @head. + * Assume host bits are cleared in @v_arg if @m_arg is not NULL + * Note that prefixes with /32 or /128 masks are treated differently + * from host routes. + */ struct radix_node * rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) { struct radix_node *x; - caddr_t netmask = 0; + caddr_t netmask; - if (m_arg) { + if (m_arg != NULL) { + /* + * Most common case: search exact prefix/mask + */ x = rn_addmask(m_arg, head->rnh_masks, 1, head->rnh_treetop->rn_offset); - if (x == 0) - return (0); + if (x == NULL) + return (NULL); netmask = x->rn_key; - } - x = rn_match(v_arg, head); - if (x && netmask) { - while (x && x->rn_mask != netmask) + + x = rn_match(v_arg, head); + + while (x != NULL && x->rn_mask != netmask) x = x->rn_dupedkey; + + return (x); } + + /* + * Search for host address. + */ + if ((x = rn_match(v_arg, head)) == NULL) + return (NULL); + + /* Check if found key is the same */ + if (LEN(x->rn_key) != LEN(v_arg) || bcmp(x->rn_key, v_arg, LEN(v_arg))) + return (NULL); + + /* Check if this is not host route */ + if (x->rn_mask != NULL) + return (NULL); + return (x); } @@ -247,6 +273,9 @@ rn_satisfies_leaf(char *trial, struct ra return (1); } +/* + * Search for longest-prefix match in given @head + */ struct radix_node * rn_match(void *v_arg, struct radix_node_head *head) { Modified: head/sys/net/radix.h ============================================================================== --- head/sys/net/radix.h Sat Jan 4 22:14:59 2014 (r260294) +++ head/sys/net/radix.h Sat Jan 4 22:25:26 2014 (r260295) @@ -112,9 +112,9 @@ struct radix_node_head { struct radix_node_head *head, struct radix_node nodes[]); struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ (void *v, void *mask, struct radix_node_head *head); - struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ + struct radix_node *(*rnh_matchaddr) /* longest match for sockaddr */ (void *v, struct radix_node_head *head); - struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ + struct radix_node *(*rnh_lookup) /*exact match for sockaddr*/ (void *v, void *mask, struct radix_node_head *head); int (*rnh_walktree) /* traverse tree */ (struct radix_node_head *head, walktree_f_t *f, void *w); Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Sat Jan 4 22:14:59 2014 (r260294) +++ head/sys/net/radix_mpath.c Sat Jan 4 22:25:26 2014 (r260295) @@ -151,6 +151,7 @@ rt_mpath_deldup(struct rtentry *headrt, /* * check if we have the same key/mask/gateway on the table already. + * Assume @rt rt_key host bits are cleared according to @netmask */ int rt_mpath_conflict(struct radix_node_head *rnh, struct rtentry *rt, @@ -158,76 +159,13 @@ rt_mpath_conflict(struct radix_node_head { struct radix_node *rn, *rn1; struct rtentry *rt1; - char *p, *q, *eq; - int same, l, skip; rn = (struct radix_node *)rt; rn1 = rnh->rnh_lookup(rt_key(rt), netmask, rnh); if (!rn1 || rn1->rn_flags & RNF_ROOT) - return 0; - - /* - * unlike other functions we have in this file, we have to check - * all key/mask/gateway as rnh_lookup can match less specific entry. - */ - rt1 = (struct rtentry *)rn1; - - /* compare key. */ - if (rt_key(rt1)->sa_len != rt_key(rt)->sa_len || - bcmp(rt_key(rt1), rt_key(rt), rt_key(rt1)->sa_len)) - goto different; - - /* key was the same. compare netmask. hairy... */ - if (rt_mask(rt1) && netmask) { - skip = rnh->rnh_treetop->rn_offset; - if (rt_mask(rt1)->sa_len > netmask->sa_len) { - /* - * as rt_mask(rt1) is made optimal by radix.c, - * there must be some 1-bits on rt_mask(rt1) - * after netmask->sa_len. therefore, in - * this case, the entries are different. - */ - if (rt_mask(rt1)->sa_len > skip) - goto different; - else { - /* no bits to compare, i.e. same*/ - goto maskmatched; - } - } - - l = rt_mask(rt1)->sa_len; - if (skip > l) { - /* no bits to compare, i.e. same */ - goto maskmatched; - } - p = (char *)rt_mask(rt1); - q = (char *)netmask; - if (bcmp(p + skip, q + skip, l - skip)) - goto different; - /* - * need to go through all the bit, as netmask is not - * optimal and can contain trailing 0s - */ - eq = (char *)netmask + netmask->sa_len; - q += l; - same = 1; - while (eq > q) - if (*q++) { - same = 0; - break; - } - if (!same) - goto different; - } else if (!rt_mask(rt1) && !netmask) - ; /* no mask to compare, i.e. same */ - else { - /* one has mask and the other does not, different */ - goto different; - } - -maskmatched: + return (0); - /* key/mask were the same. compare gateway for all multipaths */ + /* key/mask are the same. compare gateway for all multipaths */ do { rt1 = (struct rtentry *)rn1; @@ -248,11 +186,10 @@ maskmatched: } /* all key/mask/gateway are the same. conflicting entry. */ - return EEXIST; + return (EEXIST); } while ((rn1 = rn_mpath_next(rn1)) != NULL); -different: - return 0; + return (0); } void Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Jan 4 22:14:59 2014 (r260294) +++ head/sys/net/route.c Sat Jan 4 22:25:26 2014 (r260295) @@ -930,6 +930,57 @@ bad: return (error); } +#if 0 +int p_sockaddr(char *buf, int buflen, struct sockaddr *s); +int rt_print(char *buf, int buflen, struct rtentry *rt); + +int +p_sockaddr(char *buf, int buflen, struct sockaddr *s) +{ + void *paddr = NULL; + + switch (s->sa_family) { + case AF_INET: + paddr = &((struct sockaddr_in *)s)->sin_addr; + break; + case AF_INET6: + paddr = &((struct sockaddr_in6 *)s)->sin6_addr; + break; + } + + if (paddr == NULL) + return (0); + + if (inet_ntop(s->sa_family, paddr, buf, buflen) == NULL) + return (0); + + return (strlen(buf)); +} + +int +rt_print(char *buf, int buflen, struct rtentry *rt) +{ + struct sockaddr *addr, *mask; + int i = 0; + + addr = rt_key(rt); + mask = rt_mask(rt); + + i = p_sockaddr(buf, buflen, addr); + if (!(rt->rt_flags & RTF_HOST)) { + buf[i++] = '/'; + i += p_sockaddr(buf + i, buflen - i, mask); + } + + if (rt->rt_flags & RTF_GATEWAY) { + buf[i++] = '>'; + i += p_sockaddr(buf + i, buflen - i, rt->rt_gateway); + } + + return (i); +} +#endif + #ifdef RADIX_MPATH static int rn_mpath_update(int req, struct rt_addrinfo *info, @@ -943,10 +994,11 @@ rn_mpath_update(int req, struct rt_addri register struct radix_node *rn; int error = 0; - rn = rnh->rnh_matchaddr(dst, rnh); + rn = rnh->rnh_lookup(dst, netmask, rnh); if (rn == NULL) return (ESRCH); rto = rt = RNTORT(rn); + rt = rt_mpath_matchgate(rt, gateway); if (rt == NULL) return (ESRCH); @@ -1521,8 +1573,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int rn = rnh->rnh_lookup(dst, netmask, rnh); error = (rn == NULL || (rn->rn_flags & RNF_ROOT) || - RNTORT(rn)->rt_ifa != ifa || - !sa_equal((struct sockaddr *)rn->rn_key, dst)); + RNTORT(rn)->rt_ifa != ifa); RADIX_NODE_HEAD_RUNLOCK(rnh); if (error) { /* this is only an error if bad on ALL tables */ Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Jan 4 22:14:59 2014 (r260294) +++ head/sys/net/rtsock.c Sat Jan 4 22:25:26 2014 (r260295) @@ -727,10 +727,24 @@ route_output(struct mbuf *m, struct sock info.rti_info[RTAX_DST]->sa_family); if (rnh == NULL) senderr(EAFNOSUPPORT); + RADIX_NODE_HEAD_RLOCK(rnh); - rt = (struct rtentry *) rnh->rnh_lookup(info.rti_info[RTAX_DST], - info.rti_info[RTAX_NETMASK], rnh); - if (rt == NULL) { /* XXX looks bogus */ + + if (info.rti_info[RTAX_NETMASK] == NULL && + rtm->rtm_type == RTM_GET) { + /* + * Provide logest prefix match for + * address lookup (no mask). + * 'route -n get addr' + */ + rt = (struct rtentry *) rnh->rnh_matchaddr( + info.rti_info[RTAX_DST], rnh); + } else + rt = (struct rtentry *) rnh->rnh_lookup( + info.rti_info[RTAX_DST], + info.rti_info[RTAX_NETMASK], rnh); + + if (rt == NULL) { RADIX_NODE_HEAD_RUNLOCK(rnh); senderr(ESRCH); } @@ -787,25 +801,6 @@ route_output(struct mbuf *m, struct sock RT_ADDREF(rt); RADIX_NODE_HEAD_RUNLOCK(rnh); - /* - * Fix for PR: 82974 - * - * RTM_CHANGE/LOCK need a perfect match, rn_lookup() - * returns a perfect match in case a netmask is - * specified. For host routes only a longest prefix - * match is returned so it is necessary to compare the - * existence of the netmask. If both have a netmask - * rnh_lookup() did a perfect match and if none of them - * have a netmask both are host routes which is also a - * perfect match. - */ - - if (rtm->rtm_type != RTM_GET && - (!rt_mask(rt) != !info.rti_info[RTAX_NETMASK])) { - RT_UNLOCK(rt); - senderr(ESRCH); - } - switch(rtm->rtm_type) { case RTM_GET: From owner-svn-src-head@FreeBSD.ORG Sat Jan 4 22:30:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20207C48; Sat, 4 Jan 2014 22:30: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 0CAB016C5; Sat, 4 Jan 2014 22:30: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 s04MUIuX033169; Sat, 4 Jan 2014 22:30:18 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04MUInw033168; Sat, 4 Jan 2014 22:30:18 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201401042230.s04MUInw033168@svn.freebsd.org> From: Warner Losh Date: Sat, 4 Jan 2014 22:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260296 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 22:30:19 -0000 Author: imp Date: Sat Jan 4 22:30:18 2014 New Revision: 260296 URL: http://svnweb.freebsd.org/changeset/base/260296 Log: More NAND IDs of some really old Samsung parts, also list the part number that we're matching... Modified: head/sys/dev/nand/nand_id.c Modified: head/sys/dev/nand/nand_id.c ============================================================================== --- head/sys/dev/nand/nand_id.c Sat Jan 4 22:25:26 2014 (r260295) +++ head/sys/dev/nand/nand_id.c Sat Jan 4 22:30:18 2014 (r260296) @@ -33,16 +33,16 @@ __FBSDID("$FreeBSD$"); #include struct nand_params nand_ids[] = { - { { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B NAND 32MiB 1-bit", + { { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B NAND 32MiB 8-bit", 0x20, 0x200, 0x10, 0x20, 0 }, - { { NAND_MAN_SAMSUNG, 0xd3 }, "Samsung NAND 1GiB 3,3V 8-bit", - 0x400, 0x800, 0x40, 0x40, 0 }, - { { NAND_MAN_SAMSUNG, 0xdc }, "Samsung NAND 512MiB 3,3V 8-bit", - 0x200, 0x800, 0x40, 0x40, 0 }, - { { NAND_MAN_SAMSUNG, 0xda }, "Samsung K9F2G08U0A NAND 256MiB 3,3V 8-bit", - 0x100, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_SAMSUNG, 0xf1 }, "Samsung K9F1G08U0A NAND 128MiB 3,3V 8-bit", 0x80, 0x800, 0x40, 0x40, 0 }, + { { NAND_MAN_SAMSUNG, 0xda }, "Samsung K9F2G08U0A NAND 256MiB 3,3V 8-bit", + 0x100, 0x800, 0x40, 0x40, 0 }, + { { NAND_MAN_SAMSUNG, 0xdc }, "Samsung NAND 512MiB 3,3V 8-bit", + 0x200, 0x800, 0x40, 0x40, 0 }, + { { NAND_MAN_SAMSUNG, 0xd3 }, "Samsung NAND 1GiB 3,3V 8-bit", + 0x400, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_HYNIX, 0x76 }, "Hynix NAND 64MiB 3,3V 8-bit", 0x40, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_HYNIX, 0xdc }, "Hynix NAND 512MiB 3,3V 8-bit",