From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 05:13:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D1502A5 for ; Sun, 25 Nov 2012 05:13:30 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 798D68FC16 for ; Sun, 25 Nov 2012 05:13:28 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so9693412lah.13 for ; Sat, 24 Nov 2012 21:13:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:openpgp :content-type:content-transfer-encoding:x-gm-message-state; bh=Zj8Wd0LXkNNA4ro54XWMIxChI5KonKAWC47YM5bn4Bc=; b=f2oXP8H9MuBz7LSDV3fmCeEhZx0Coqf1g4MEIhPi3RehAoHIT/2Gsu/ZMBIS9WR4kY 3DYgakdLoLlfHxeJVwR4hdEENa85Jr4TlTHC1CTso47MnCjKmgx1+26suTVKbvRsSx4T tD20EGeoRX/ksypfScklzmLJ3TSQ1PLqJSB+iOHSPCVVvu3/WfCSf/GSuTYQzFxFES23 J8xp8lbgRUNqvmv7VK9GzTDh4jbZd4bxY6X8sdvWxIwHITazDI0I2iE4BBZSEE3k1+ll Ak4TRe43suCpsE1y6b/pEx4Z/xYq8wZxEh/7dAIBS1kMd0be9bGK8juq/PxCRHVZ+jdk Q5yQ== Received: by 10.112.48.40 with SMTP id i8mr3533254lbn.97.1353820407954; Sat, 24 Nov 2012 21:13:27 -0800 (PST) Received: from [192.168.1.2] ([89.169.163.3]) by mx.google.com with ESMTPS id sj3sm3915623lab.2.2012.11.24.21.13.27 (version=SSLv3 cipher=OTHER); Sat, 24 Nov 2012 21:13:27 -0800 (PST) Message-ID: <50B1A8F8.9090302@freebsd.org> Date: Sun, 25 Nov 2012 09:13:28 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: svn commit: r243474 - head/usr.bin/cut References: <201211240415.qAO4FPaG062952@svn.freebsd.org> <50B07EB6.3010503@freebsd.org> <50B0D5B3.9000802@FreeBSD.org> <50B0DF04.5060001@freebsd.org> In-Reply-To: <50B0DF04.5060001@freebsd.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQljIMjxQOqYsgMtY06lW/cm0uR8s28Xn7watu6s5c1RVGcVkx2Wk9gXJ3RZBGWiU/47/sze Cc: Andrew Turner , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 05:13:30 -0000 On 24.11.2012 18:51, Andrey Chernov wrote: > On 24.11.2012 18:12, Dimitry Andric wrote: >>>> -is_delim(int ch) >>>> +is_delim(wchar_t ch) >>>> { >>>> if (wflag) { >>>> if (ch == ' ' || ch == '\t') >>>> >>> >>> I can't look at the whole code at this moment, but taking standalone >>> this is incorrect comparison for wchar_t. Should be L' ' and L'\t' >>> instead. >> >> The compiler just promotes the space and tab to wchar_t, this is only >> needed for the sake of consistency (and/or style). There is no binary >> change if you add the L prefixes. :) > > In general case byte order of type promotion is not necessary equal to > byte order of L'x' literals. > Forget to note that this point "The compiler just promotes the space and tab to wchar_t" is wrong. Since there are no direct (wchar_t) cast, compiler promotes both to the nearby integer type. From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 09:06:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DBB9582C; Sun, 25 Nov 2012 09:06:32 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD6648FC08; Sun, 25 Nov 2012 09:06:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAP96WNb030300; Sun, 25 Nov 2012 09:06:32 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAP96W4D030291; Sun, 25 Nov 2012 09:06:32 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211250906.qAP96W4D030291@svn.freebsd.org> From: Martin Matuska Date: Sun, 25 Nov 2012 09:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243503 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 09:06:33 -0000 Author: mm Date: Sun Nov 25 09:06:32 2012 New Revision: 243503 URL: http://svnweb.freebsd.org/changeset/base/243503 Log: MFV r242735: Illumos 13879:4eac7a87eff2: 3329 spa_sync() spends 10-20% of its time in spa_free_sync_cb() 3330 space_seg_t should have its own kmem_cache 3331 deferred frees should happen after sync_pass 1 3335 make SYNC_PASS_* constants tunable New loader-only tunables: vfs.zfs.sync_pass_deferred_free vfs.zfs.sync_pass_dont_compress vfs.zfs.sync_pass_rewrite References: https://www.illumos.org/issues/3329 https://www.illumos.org/issues/3330 https://www.illumos.org/issues/3331 https://www.illumos.org/issues/3335 MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.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/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Nov 25 09:06:32 2012 (r243503) @@ -881,8 +881,9 @@ metaslab_activate(metaslab_t *msp, uint6 if ((msp->ms_weight & METASLAB_ACTIVE_MASK) == 0) { space_map_load_wait(sm); if (!sm->sm_loaded) { - int error = space_map_load(sm, sm_ops, SM_FREE, - &msp->ms_smo, + space_map_obj_t *smo = &msp->ms_smo; + + int error = space_map_load(sm, sm_ops, SM_FREE, smo, spa_meta_objset(msp->ms_group->mg_vd->vdev_spa)); if (error) { metaslab_group_sort(msp->ms_group, msp, 0); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Nov 25 09:06:32 2012 (r243503) @@ -139,6 +139,7 @@ boolean_t zio_taskq_sysdc = B_TRUE; /* u uint_t zio_taskq_basedc = 80; /* base duty cycle */ boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */ +extern int zfs_sync_pass_deferred_free; /* * This (illegal) pool name is used when temporarily importing a spa_t in order @@ -6302,7 +6303,7 @@ spa_sync(spa_t *spa, uint64_t txg) spa_errlog_sync(spa, txg); dsl_pool_sync(dp, txg); - if (pass <= SYNC_PASS_DEFERRED_FREE) { + if (pass < zfs_sync_pass_deferred_free) { zio_t *zio = zio_root(spa, NULL, NULL, 0); bplist_iterate(free_bpl, spa_free_sync_cb, zio, tx); 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 Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Nov 25 09:06:32 2012 (r243503) @@ -1619,6 +1619,7 @@ spa_init(int mode) #endif /* illumos */ refcount_sysinit(); unique_init(); + space_map_init(); zio_init(); dmu_init(); zil_init(); @@ -1641,6 +1642,7 @@ spa_fini(void) zil_fini(); dmu_fini(); zio_fini(); + space_map_fini(); unique_fini(); refcount_fini(); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Sun Nov 25 09:06:32 2012 (r243503) @@ -39,6 +39,23 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, space_map &space_map_last_hope, 0, "If kernel panic in space_map code on pool import, import the pool in readonly mode and backup all your data before trying this option."); +static kmem_cache_t *space_seg_cache; + +void +space_map_init(void) +{ + ASSERT(space_seg_cache == NULL); + space_seg_cache = kmem_cache_create("space_seg_cache", + sizeof (space_seg_t), 0, NULL, NULL, NULL, NULL, NULL, 0); +} + +void +space_map_fini(void) +{ + kmem_cache_destroy(space_seg_cache); + space_seg_cache = NULL; +} + /* * Space map routines. * NOTE: caller is responsible for all locking. @@ -148,7 +165,7 @@ again: avl_remove(sm->sm_pp_root, ss_after); } ss_after->ss_start = ss_before->ss_start; - kmem_free(ss_before, sizeof (*ss_before)); + kmem_cache_free(space_seg_cache, ss_before); ss = ss_after; } else if (merge_before) { ss_before->ss_end = end; @@ -161,7 +178,7 @@ again: avl_remove(sm->sm_pp_root, ss_after); ss = ss_after; } else { - ss = kmem_alloc(sizeof (*ss), KM_SLEEP); + ss = kmem_cache_alloc(space_seg_cache, KM_SLEEP); ss->ss_start = start; ss->ss_end = end; avl_insert(&sm->sm_root, ss, where); @@ -207,7 +224,7 @@ space_map_remove(space_map_t *sm, uint64 avl_remove(sm->sm_pp_root, ss); if (left_over && right_over) { - newseg = kmem_alloc(sizeof (*newseg), KM_SLEEP); + newseg = kmem_cache_alloc(space_seg_cache, KM_SLEEP); newseg->ss_start = end; newseg->ss_end = ss->ss_end; ss->ss_end = start; @@ -220,7 +237,7 @@ space_map_remove(space_map_t *sm, uint64 ss->ss_start = end; } else { avl_remove(&sm->sm_root, ss); - kmem_free(ss, sizeof (*ss)); + kmem_cache_free(space_seg_cache, ss); ss = NULL; } @@ -260,7 +277,7 @@ space_map_vacate(space_map_t *sm, space_ while ((ss = avl_destroy_nodes(&sm->sm_root, &cookie)) != NULL) { if (func != NULL) func(mdest, ss->ss_start, ss->ss_end - ss->ss_start); - kmem_free(ss, sizeof (*ss)); + kmem_cache_free(space_seg_cache, ss); } sm->sm_space = 0; } @@ -432,7 +449,7 @@ space_map_sync(space_map_t *sm, uint8_t spa_t *spa = dmu_objset_spa(os); void *cookie = NULL; space_seg_t *ss; - uint64_t bufsize, start, size, run_len; + uint64_t bufsize, start, size, run_len, delta, sm_space; uint64_t *entry, *entry_map, *entry_map_end; ASSERT(MUTEX_HELD(sm->sm_lock)); @@ -461,11 +478,13 @@ space_map_sync(space_map_t *sm, uint8_t SM_DEBUG_SYNCPASS_ENCODE(spa_sync_pass(spa)) | SM_DEBUG_TXG_ENCODE(dmu_tx_get_txg(tx)); + delta = 0; + sm_space = sm->sm_space; while ((ss = avl_destroy_nodes(&sm->sm_root, &cookie)) != NULL) { size = ss->ss_end - ss->ss_start; start = (ss->ss_start - sm->sm_start) >> sm->sm_shift; - sm->sm_space -= size; + delta += size; size >>= sm->sm_shift; while (size) { @@ -487,7 +506,7 @@ space_map_sync(space_map_t *sm, uint8_t start += run_len; size -= run_len; } - kmem_free(ss, sizeof (*ss)); + kmem_cache_free(space_seg_cache, ss); } if (entry != entry_map) { @@ -499,8 +518,15 @@ space_map_sync(space_map_t *sm, uint8_t smo->smo_objsize += size; } + /* + * Ensure that the space_map's accounting wasn't changed + * while we were in the middle of writing it out. + */ + VERIFY3U(sm->sm_space, ==, sm_space); + zio_buf_free(entry_map, bufsize); + sm->sm_space -= delta; VERIFY0(sm->sm_space); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h Sun Nov 25 09:06:32 2012 (r243503) @@ -21,7 +21,10 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright (c) 2011 by Delphix. All rights reserved. + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_METASLAB_IMPL_H Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h Sun Nov 25 09:06:32 2012 (r243503) @@ -489,14 +489,6 @@ extern int spa_scan_stop(spa_t *spa); extern void spa_sync(spa_t *spa, uint64_t txg); /* only for DMU use */ extern void spa_sync_allpools(void); -/* - * DEFERRED_FREE must be large enough that regular blocks are not - * deferred. XXX so can't we change it back to 1? - */ -#define SYNC_PASS_DEFERRED_FREE 2 /* defer frees after this pass */ -#define SYNC_PASS_DONT_COMPRESS 4 /* don't compress after this pass */ -#define SYNC_PASS_REWRITE 1 /* rewrite new bps after this pass */ - /* spa namespace global mutex */ extern kmutex_t spa_namespace_lock; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Sun Nov 25 09:06:32 2012 (r243503) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #ifndef _SYS_SPACE_MAP_H #define _SYS_SPACE_MAP_H @@ -136,6 +140,8 @@ struct space_map_ops { typedef void space_map_func_t(space_map_t *sm, uint64_t start, uint64_t size); +extern void space_map_init(void); +extern void space_map_fini(void); extern void space_map_create(space_map_t *sm, uint64_t start, uint64_t size, uint8_t shift, kmutex_t *lp); extern void space_map_destroy(space_map_t *sm); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sun Nov 25 09:06:32 2012 (r243503) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #ifndef _ZIO_IMPL_H #define _ZIO_IMPL_H @@ -143,6 +147,7 @@ enum zio_stage { #define ZIO_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ ZIO_STAGE_FREE_BP_INIT | \ + ZIO_STAGE_ISSUE_ASYNC | \ ZIO_STAGE_DVA_FREE | \ ZIO_STAGE_VDEV_IO_START | \ ZIO_STAGE_VDEV_IO_ASSESS) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Nov 24 13:23:15 2012 (r243502) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Nov 25 09:06:32 2012 (r243503) @@ -107,6 +107,31 @@ extern vmem_t *zio_alloc_arena; extern int zfs_mg_alloc_failures; /* + * The following actions directly effect the spa's sync-to-convergence logic. + * The values below define the sync pass when we start performing the action. + * Care should be taken when changing these values as they directly impact + * spa_sync() performance. Tuning these values may introduce subtle performance + * pathologies and should only be done in the context of performance analysis. + * These tunables will eventually be removed and replaced with #defines once + * enough analysis has been done to determine optimal values. + * + * The 'zfs_sync_pass_deferred_free' pass must be greater than 1 to ensure that + * regular blocks are not deferred. + */ +int zfs_sync_pass_deferred_free = 2; /* defer frees starting in this pass */ +TUNABLE_INT("vfs.zfs.sync_pass_deferred_free", &zfs_sync_pass_deferred_free); +SYSCTL_INT(_vfs_zfs, OID_AUTO, sync_pass_deferred_free, CTLFLAG_RDTUN, + &zfs_sync_pass_deferred_free, 0, "defer frees starting in this pass"); +int zfs_sync_pass_dont_compress = 5; /* don't compress starting in this pass */ +TUNABLE_INT("vfs.zfs.sync_pass_dont_compress", &zfs_sync_pass_dont_compress); +SYSCTL_INT(_vfs_zfs, OID_AUTO, sync_pass_dont_compress, CTLFLAG_RDTUN, + &zfs_sync_pass_dont_compress, 0, "don't compress starting in this pass"); +int zfs_sync_pass_rewrite = 2; /* rewrite new bps starting in this pass */ +TUNABLE_INT("vfs.zfs.sync_pass_rewrite", &zfs_sync_pass_rewrite); +SYSCTL_INT(_vfs_zfs, OID_AUTO, sync_pass_rewrite, CTLFLAG_RDTUN, + &zfs_sync_pass_rewrite, 0, "rewrite new bps starting in this pass"); + +/* * An allocating zio is one that either currently has the DVA allocate * stage set or will have it later in its lifetime. */ @@ -742,7 +767,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui ASSERT(!BP_IS_HOLE(bp)); ASSERT(spa_syncing_txg(spa) == txg); - ASSERT(spa_sync_pass(spa) <= SYNC_PASS_DEFERRED_FREE); + ASSERT(spa_sync_pass(spa) < zfs_sync_pass_deferred_free); zio = zio_create(pio, spa, txg, bp, NULL, size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_FREE, flags, @@ -1051,7 +1076,7 @@ zio_write_bp_init(zio_t *zio) ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); ASSERT(!BP_GET_DEDUP(bp)); - if (pass > SYNC_PASS_DONT_COMPRESS) + if (pass >= zfs_sync_pass_dont_compress) compress = ZIO_COMPRESS_OFF; /* Make sure someone doesn't change their mind on overwrites */ @@ -1080,7 +1105,7 @@ zio_write_bp_init(zio_t *zio) * There should only be a handful of blocks after pass 1 in any case. */ if (bp->blk_birth == zio->io_txg && BP_GET_PSIZE(bp) == psize && - pass > SYNC_PASS_REWRITE) { + pass >= zfs_sync_pass_rewrite) { ASSERT(psize != 0); enum zio_stage gang_stages = zio->io_pipeline & ZIO_GANG_STAGES; zio->io_pipeline = ZIO_REWRITE_PIPELINE | gang_stages; From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 10:37:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B53E437; Sun, 25 Nov 2012 10:37:11 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5D68C8FC12; Sun, 25 Nov 2012 10:37:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPAbBKA042287; Sun, 25 Nov 2012 10:37:11 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPAbBc6042285; Sun, 25 Nov 2012 10:37:11 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201211251037.qAPAbBc6042285@svn.freebsd.org> From: Devin Teske Date: Sun, 25 Nov 2012 10:37:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243504 - in head/usr.sbin/bsdconfig/networking: include share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 10:37:11 -0000 Author: dteske Date: Sun Nov 25 10:37:10 2012 New Revision: 243504 URL: http://svnweb.freebsd.org/changeset/base/243504 Log: Split IP address validation routines and improve error detection for dotted- quad notation in IPv6 addresses. Approved by: adrian (co-mentor) (implicit) Modified: head/usr.sbin/bsdconfig/networking/include/messages.subr head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Modified: head/usr.sbin/bsdconfig/networking/include/messages.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/include/messages.subr Sun Nov 25 09:06:32 2012 (r243503) +++ head/usr.sbin/bsdconfig/networking/include/messages.subr Sun Nov 25 10:37:10 2012 (r243504) @@ -55,10 +55,10 @@ msg_hostname_label_is_null="ERROR! One o msg_hostname_label_starts_or_ends_with_hyphen="ERROR! One or more individual labels within the hostname\n(separated by dots) starts or ends with a hyphen (hyphens\nare allowed, but a label cannot begin or end with a hyphen).\n\nInvalid Hostname: %s" msg_internal_error_nsindex_value="FATAL! dialog_input_nameserver_edit_awk: variable\nnsindex must be a whole positive integer greater-\nthan or equal-to zero.\n\nInvalid nsindex: %s" msg_ipaddr4="ipaddr" -msg_ipv4_addr_octet_contains_invalid_chars="ERROR! One or more individual octets within the IP address\n(separated by dots) contains one or more invalid characters.\nOctets must contain only the characters 0-9.\n\nInvalid IP Address: %s" -msg_ipv4_addr_octet_exceeds_max_value="ERROR! One or more individual octets within the IP address\n(separated by dots) exceeds the maximum of 255.\n\nInvalid IP Address: %s" -msg_ipv4_addr_octet_is_null="ERROR! One or more individual octets within the IP address\n(separated by dots) are null and/or missing.\n\nInvalid IP Address: %s" -msg_ipv4_addr_octet_missing_or_extra="ERROR! The IP address entered has either too few (less than\nfour) or too many (more than four) octets, separated by dots.\n\nInvalid IP Address: %s" +msg_ipv4_addr_octet_contains_invalid_chars="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) contains one or more invalid characters.\nOctets must contain only the characters 0-9.\n\nInvalid IP Address: %s" +msg_ipv4_addr_octet_exceeds_max_value="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) exceeds the maximum of 255.\n\nInvalid IP Address: %s" +msg_ipv4_addr_octet_is_null="ERROR! One or more individual octets within the IPv4 address\n(separated by dots) are null and/or missing.\n\nInvalid IP Address: %s" +msg_ipv4_addr_octet_missing_or_extra="ERROR! The IPv4 address entered has either too few (less than\nfour) or too many (more than four) octets, separated by dots.\n\nInvalid IP Address: %s" msg_ipv6_addr_segment_contains_invalid_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) contains one or more invalid characters.\nSegments must contain only combinations of the characters 0-9,\nA-F, or a-f.\n\nInvalid IPv6 Address: %s" msg_ipv6_addr_segment_contains_too_many_chars="ERROR! One or more individual segments within the IP address\n(separated by colons) exceeds the length of 4 hex-digits.\n\nInvalid IPv6 Address: %s" msg_ipv6_addr_too_few_or_extra_segments="ERROR! The IP address entered has either too few (less than 3), too\nmany (more than 8), or not enough segments, separated by colons.\n\nInvalid IPv6 Address: %s" Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Sun Nov 25 09:06:32 2012 (r243503) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Sun Nov 25 10:37:10 2012 (r243504) @@ -60,7 +60,7 @@ f_ifconfig_inet() ' } -# f_dialog_validate_ipaddr $ipaddr +# f_validate_ipaddr $ipaddr # # Returns zero if the given argument (an IP address) is of the proper format. # @@ -73,10 +73,7 @@ f_ifconfig_inet() # maximum of 255 (or 2^8, being an octet comprised of 8 bits). # 4 The IP address has either too few or too many octets. # -# If the IP address is determined to be invalid, the appropriate error will be -# displayed using the f_dialog_msgbox function. -# -f_dialog_validate_ipaddr() +f_validate_ipaddr() { local ip="$1" @@ -106,12 +103,19 @@ f_dialog_validate_ipaddr() [ $noctets -eq 4 ] || exit 4 ) +} +# f_dialog_iperror $error $ipaddr +# +# Display a msgbox with the appropriate error message for an error returned by +# f_validate_ipaddr above. +# +f_dialog_iperror() +{ + local error="$1" ip="$2" - # - # Produce an appropriate error message if necessary. - # - local retval=$? - case $retval in + [ ${error:-0} -ne 0 ] || return $SUCCESS + + case "$error" in 1) f_dialog_msgbox "$( printf \ "$msg_ipv4_addr_octet_contains_invalid_chars" "$ip" )";; 2) f_dialog_msgbox "$( printf \ @@ -121,34 +125,57 @@ f_dialog_validate_ipaddr() 4) f_dialog_msgbox "$( printf \ "$msg_ipv4_addr_octet_missing_or_extra" "$ip" )";; esac +} + +# f_dialog_validate_ipaddr $ipaddr +# +# Returns zero if the given argument (an IP address) is of the proper format. +# +# If the IP address is determined to be invalid, the appropriate error will be +# displayed using the f_dialog_iperror function above. +# +f_dialog_validate_ipaddr() +{ + local ip="$1" + + f_validate_ipaddr "$ip" + local retval=$? + + # Produce an appropriate error message if necessary. + [ $retval -eq $SUCCESS ] || f_dialog_iperror $retval "$ip" return $retval } -# f_dialog_validate_ipaddr6 $ipv6_addr +# f_validate_ipaddr6 $ipv6_addr # # Returns zero if the given argument (an IPv6 address) is of the proper format. # # The return status for invalid IP address is one of: # 1 One or more individual segments within the IP address # (separated by colons) contains one or more invalid characters. -# 2 More than two segments within the IP address are null or the -# the second null segment is not at the end of the address. -# 3 One or more individual segments within the IP address exceeds -# the word length of 32-bits (segments are always hexadecimal). -# 4 The IP address has either too few or too many segments. -# 5 The IPv4 address at the end of the IPv6 address is invalid. +# Segments must contain only combinations of the characters 0-9, +# A-F, or a-f. +# 2 Too many/incorrect null segments. A single null segment is +# allowed within the IP address (separated by colons) but not +# allowed at the beginning or end (unless a double-null segment; +# i.e., "::*" or "*::"). +# 3 One or more individual segments within the IP address +# (separated by colons) exceeds the length of 4 hex-digits. +# 4 The IP address entered has either too few (less than 3), too +# many (more than 8), or not enough segments, separated by +# colons. +# 5* The IPv4 address at the end of the IPv6 address is invalid. +# * When there is an error with the dotted-quad IPv4 address at the +# end of the IPv6 address, the return value of 5 is OR'd with a +# bit-shifted (<< 4) return of f_validate_ipaddr. # -# If the IP address is determined to be invalid, the appropriate error will be -# displayed using the f_dialog_msgbox function. -# -f_dialog_validate_ipaddr6() +f_validate_ipaddr6() { local ip="$1" ( # Operate within a sub-shell to protect the parent environment - oldIFS="$IFS" IFS=":" # Split on `colon' set -- $ip: @@ -216,9 +243,8 @@ f_dialog_validate_ipaddr6() contains_ipv4_segment=1 # Validate the IPv4 address - IFS="$oldIFS" - f_dialog_validate_ipaddr "$segment" || exit 5 - IFS=":" + f_validate_ipaddr "$segment" || + exit $(( 5 | $? << 4 )) ;; *) # Segment characters are all valid but too many @@ -254,12 +280,20 @@ f_dialog_validate_ipaddr6() exit $SUCCESS ) +} - # - # Produce an appropriate error message if necessary. - # - local retval=$? - case $retval in +# f_dialog_ip6error $error $ipv6_addr +# +# Display a msgbox with the appropriate error message for an error returned by +# f_validate_ipaddr6 above. +# +f_dialog_ip6error() +{ + local error="$1" ip="$2" + + [ ${error:-0} -ne 0 ] || return $SUCCESS + + case "$error" in 1) f_dialog_msgbox "$( printf \ "$msg_ipv6_addr_segment_contains_invalid_chars" "$ip" )";; 2) f_dialog_msgbox "$( printf \ @@ -268,10 +302,30 @@ f_dialog_validate_ipaddr6() "$msg_ipv6_addr_segment_contains_too_many_chars" "$ip" )";; 4) f_dialog_msgbox "$( printf \ "$msg_ipv6_addr_too_few_or_extra_segments" "$ip" )";; - 5) : IPv4 at the end of IPv6 address is invalid ;; - # Don't display an error because f_dialog_validate_ipaddr - # already displayed one for the particular issue encountered. + *) + if [ $(( $error & 0xF )) -eq 5 ]; then + # IPv4 at the end of IPv6 address is invalid + f_dialog_iperror $(( $error >> 4 )) "$ip" + fi esac +} + +# f_dialog_validate_ipaddr6 $ipv6_addr +# +# Returns zero if the given argument (an IPv6 address) is of the proper format. +# +# If the IP address is determined to be invalid, the appropriate error will be +# displayed using the f_dialog_ip6error function above. +# +f_dialog_validate_ipaddr6() +{ + local ip="$1" + + f_validate_ipaddr6 "$ip" + local retval=$? + + # Produce an appropriate error message if necessary. + [ $retval -eq $SUCCESS ] || f_dialog_ip6error $retval "$ip" return $retval } From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 10:53:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AAE277BC; Sun, 25 Nov 2012 10:53:42 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8E3D08FC13; Sun, 25 Nov 2012 10:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPArgN2044397; Sun, 25 Nov 2012 10:53:42 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPArgOZ044395; Sun, 25 Nov 2012 10:53:42 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211251053.qAPArgOZ044395@svn.freebsd.org> From: Martin Matuska Date: Sun, 25 Nov 2012 10:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243505 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 10:53:42 -0000 Author: mm Date: Sun Nov 25 10:53:42 2012 New Revision: 243505 URL: http://svnweb.freebsd.org/changeset/base/243505 Log: MFV r243012: Illumos 13886:e3261d03efbf 3349 zpool upgrade -V bumps the on disk version number, but leaves the in core version References: https://www.illumos.org/issues/3349 MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Nov 25 10:37:10 2012 (r243504) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Nov 25 10:53:42 2012 (r243505) @@ -330,6 +330,7 @@ ztest_func_t ztest_vdev_add_remove; ztest_func_t ztest_vdev_aux_add_remove; ztest_func_t ztest_split_pool; ztest_func_t ztest_reguid; +ztest_func_t ztest_spa_upgrade; uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */ uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */ @@ -363,6 +364,7 @@ ztest_info_t ztest_info[] = { { ztest_reguid, 1, &zopt_sometimes }, { ztest_spa_rename, 1, &zopt_rarely }, { ztest_scrub, 1, &zopt_rarely }, + { ztest_spa_upgrade, 1, &zopt_rarely }, { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, { ztest_vdev_attach_detach, 1, &zopt_rarely }, { ztest_vdev_LUN_growth, 1, &zopt_rarely }, @@ -797,7 +799,7 @@ ztest_get_ashift(void) } static nvlist_t * -make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift) +make_vdev_file(char *path, char *aux, char *pool, size_t size, uint64_t ashift) { char pathbuf[MAXPATHLEN]; uint64_t vdev; @@ -813,12 +815,13 @@ make_vdev_file(char *path, char *aux, si vdev = ztest_shared->zs_vdev_aux; (void) snprintf(path, sizeof (pathbuf), ztest_aux_template, ztest_opts.zo_dir, - ztest_opts.zo_pool, aux, vdev); + pool == NULL ? ztest_opts.zo_pool : pool, + aux, vdev); } else { vdev = ztest_shared->zs_vdev_next_leaf++; (void) snprintf(path, sizeof (pathbuf), ztest_dev_template, ztest_opts.zo_dir, - ztest_opts.zo_pool, vdev); + pool == NULL ? ztest_opts.zo_pool : pool, vdev); } } @@ -840,17 +843,18 @@ make_vdev_file(char *path, char *aux, si } static nvlist_t * -make_vdev_raidz(char *path, char *aux, size_t size, uint64_t ashift, int r) +make_vdev_raidz(char *path, char *aux, char *pool, size_t size, + uint64_t ashift, int r) { nvlist_t *raidz, **child; int c; if (r < 2) - return (make_vdev_file(path, aux, size, ashift)); + return (make_vdev_file(path, aux, pool, size, ashift)); child = umem_alloc(r * sizeof (nvlist_t *), UMEM_NOFAIL); for (c = 0; c < r; c++) - child[c] = make_vdev_file(path, aux, size, ashift); + child[c] = make_vdev_file(path, aux, pool, size, ashift); VERIFY(nvlist_alloc(&raidz, NV_UNIQUE_NAME, 0) == 0); VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, @@ -869,19 +873,19 @@ make_vdev_raidz(char *path, char *aux, s } static nvlist_t * -make_vdev_mirror(char *path, char *aux, size_t size, uint64_t ashift, - int r, int m) +make_vdev_mirror(char *path, char *aux, char *pool, size_t size, + uint64_t ashift, int r, int m) { nvlist_t *mirror, **child; int c; if (m < 1) - return (make_vdev_raidz(path, aux, size, ashift, r)); + return (make_vdev_raidz(path, aux, pool, size, ashift, r)); child = umem_alloc(m * sizeof (nvlist_t *), UMEM_NOFAIL); for (c = 0; c < m; c++) - child[c] = make_vdev_raidz(path, aux, size, ashift, r); + child[c] = make_vdev_raidz(path, aux, pool, size, ashift, r); VERIFY(nvlist_alloc(&mirror, NV_UNIQUE_NAME, 0) == 0); VERIFY(nvlist_add_string(mirror, ZPOOL_CONFIG_TYPE, @@ -898,8 +902,8 @@ make_vdev_mirror(char *path, char *aux, } static nvlist_t * -make_vdev_root(char *path, char *aux, size_t size, uint64_t ashift, - int log, int r, int m, int t) +make_vdev_root(char *path, char *aux, char *pool, size_t size, uint64_t ashift, + int log, int r, int m, int t) { nvlist_t *root, **child; int c; @@ -909,7 +913,8 @@ make_vdev_root(char *path, char *aux, si child = umem_alloc(t * sizeof (nvlist_t *), UMEM_NOFAIL); for (c = 0; c < t; c++) { - child[c] = make_vdev_mirror(path, aux, size, ashift, r, m); + child[c] = make_vdev_mirror(path, aux, pool, size, ashift, + r, m); VERIFY(nvlist_add_uint64(child[c], ZPOOL_CONFIG_IS_LOG, log) == 0); } @@ -927,6 +932,27 @@ make_vdev_root(char *path, char *aux, si return (root); } +/* + * Find a random spa version. Returns back a random spa version in the + * range [initial_version, SPA_VERSION_FEATURES]. + */ +static uint64_t +ztest_random_spa_version(uint64_t initial_version) +{ + uint64_t version = initial_version; + + if (version <= SPA_VERSION_BEFORE_FEATURES) { + version = version + + ztest_random(SPA_VERSION_BEFORE_FEATURES - version + 1); + } + + if (version > SPA_VERSION_BEFORE_FEATURES) + version = SPA_VERSION_FEATURES; + + ASSERT(SPA_VERSION_IS_SUPPORTED(version)); + return (version); +} + static int ztest_random_blocksize(void) { @@ -2269,7 +2295,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, /* * Attempt to create using a bad file. */ - nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); + nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1); VERIFY3U(ENOENT, ==, spa_create("ztest_bad_file", nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); @@ -2277,7 +2303,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, /* * Attempt to create using a bad mirror. */ - nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 2, 1); + nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 2, 1); VERIFY3U(ENOENT, ==, spa_create("ztest_bad_mirror", nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); @@ -2287,7 +2313,7 @@ ztest_spa_create_destroy(ztest_ds_t *zd, * what's in the nvroot; we should fail with EEXIST. */ (void) rw_rdlock(&ztest_name_lock); - nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); + nvroot = make_vdev_root("/dev/bogus", NULL, NULL, 0, 0, 0, 0, 0, 1); VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); @@ -2297,6 +2323,78 @@ ztest_spa_create_destroy(ztest_ds_t *zd, (void) rw_unlock(&ztest_name_lock); } +/* ARGSUSED */ +void +ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id) +{ + spa_t *spa; + uint64_t initial_version = SPA_VERSION_INITIAL; + uint64_t version, newversion; + nvlist_t *nvroot, *props; + char *name; + + VERIFY0(mutex_lock(&ztest_vdev_lock)); + name = kmem_asprintf("%s_upgrade", ztest_opts.zo_pool); + + /* + * Clean up from previous runs. + */ + (void) spa_destroy(name); + + nvroot = make_vdev_root(NULL, NULL, name, ztest_opts.zo_vdev_size, 0, + 0, ztest_opts.zo_raidz, ztest_opts.zo_mirrors, 1); + + /* + * If we're configuring a RAIDZ device then make sure that the + * the initial version is capable of supporting that feature. + */ + switch (ztest_opts.zo_raidz_parity) { + case 0: + case 1: + initial_version = SPA_VERSION_INITIAL; + break; + case 2: + initial_version = SPA_VERSION_RAIDZ2; + break; + case 3: + initial_version = SPA_VERSION_RAIDZ3; + break; + } + + /* + * Create a pool with a spa version that can be upgraded. Pick + * a value between initial_version and SPA_VERSION_BEFORE_FEATURES. + */ + do { + version = ztest_random_spa_version(initial_version); + } while (version > SPA_VERSION_BEFORE_FEATURES); + + props = fnvlist_alloc(); + fnvlist_add_uint64(props, + zpool_prop_to_name(ZPOOL_PROP_VERSION), version); + VERIFY0(spa_create(name, nvroot, props, NULL, NULL)); + fnvlist_free(nvroot); + fnvlist_free(props); + + VERIFY0(spa_open(name, &spa, FTAG)); + VERIFY3U(spa_version(spa), ==, version); + newversion = ztest_random_spa_version(version + 1); + + if (ztest_opts.zo_verbose >= 4) { + (void) printf("upgrading spa version from %llu to %llu\n", + (u_longlong_t)version, (u_longlong_t)newversion); + } + + spa_upgrade(spa, newversion); + VERIFY3U(spa_version(spa), >, version); + VERIFY3U(spa_version(spa), ==, fnvlist_lookup_uint64(spa->spa_config, + zpool_prop_to_name(ZPOOL_PROP_VERSION))); + spa_close(spa, FTAG); + + strfree(name); + VERIFY0(mutex_unlock(&ztest_vdev_lock)); +} + static vdev_t * vdev_lookup_by_path(vdev_t *vd, const char *path) { @@ -2386,7 +2484,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui /* * Make 1/4 of the devices be log devices. */ - nvroot = make_vdev_root(NULL, NULL, + nvroot = make_vdev_root(NULL, NULL, NULL, ztest_opts.zo_vdev_size, 0, ztest_random(4) == 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1); @@ -2463,7 +2561,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd /* * Add a new device. */ - nvlist_t *nvroot = make_vdev_root(NULL, aux, + nvlist_t *nvroot = make_vdev_root(NULL, aux, NULL, (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); error = spa_vdev_add(spa, nvroot); if (error != 0) @@ -2732,7 +2830,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, /* * Build the nvlist describing newpath. */ - root = make_vdev_root(newpath, NULL, newvd == NULL ? newsize : 0, + root = make_vdev_root(newpath, NULL, NULL, newvd == NULL ? newsize : 0, ashift, 0, 0, 0, 1); error = spa_vdev_attach(spa, oldguid, root, replacing); @@ -4900,7 +4998,7 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id if (error != 0) return; - if (ztest_opts.zo_verbose >= 3) { + if (ztest_opts.zo_verbose >= 4) { (void) printf("Changed guid old %llu -> %llu\n", (u_longlong_t)orig, (u_longlong_t)spa_guid(spa)); } @@ -5647,7 +5745,7 @@ ztest_init(ztest_shared_t *zs) ztest_shared->zs_vdev_next_leaf = 0; zs->zs_splits = 0; zs->zs_mirrors = ztest_opts.zo_mirrors; - nvroot = make_vdev_root(NULL, NULL, ztest_opts.zo_vdev_size, 0, + nvroot = make_vdev_root(NULL, NULL, NULL, ztest_opts.zo_vdev_size, 0, 0, ztest_opts.zo_raidz, zs->zs_mirrors, 1); props = make_random_props(); for (int i = 0; i < SPA_FEATURES; i++) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Nov 25 10:37:10 2012 (r243504) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Nov 25 10:53:42 2012 (r243505) @@ -5985,6 +5985,14 @@ spa_sync_config_object(spa_t *spa, dmu_t config = spa_config_generate(spa, spa->spa_root_vdev, dmu_tx_get_txg(tx), B_FALSE); + /* + * If we're upgrading the spa version then make sure that + * the config object gets updated with the correct version. + */ + if (spa->spa_ubsync.ub_version < spa->spa_uberblock.ub_version) + fnvlist_add_uint64(config, ZPOOL_CONFIG_VERSION, + spa->spa_uberblock.ub_version); + spa_config_exit(spa, SCL_STATE, FTAG); if (spa->spa_config_syncing) From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 11:26:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF678E9; Sun, 25 Nov 2012 11:26:36 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B47B58FC08; Sun, 25 Nov 2012 11:26:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPBQaEP049347; Sun, 25 Nov 2012 11:26:36 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPBQa3f049346; Sun, 25 Nov 2012 11:26:36 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211251126.qAPBQa3f049346@svn.freebsd.org> From: Martin Matuska Date: Sun, 25 Nov 2012 11:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243506 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 11:26:36 -0000 Author: mm Date: Sun Nov 25 11:26:36 2012 New Revision: 243506 URL: http://svnweb.freebsd.org/changeset/base/243506 Log: zfs sha256 checksum is missing in zfs.8 manpage MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Nov 25 10:53:42 2012 (r243505) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Nov 25 11:26:36 2012 (r243506) @@ -830,7 +830,7 @@ command or unmounted by the command. .Pp This property is not inherited. -.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4 +.It Sy checksum Ns = Ns Cm on | off | fletcher2 | fletcher4 | sha256 Controls the checksum used to verify data integrity. The default value is .Cm on , which automatically selects an appropriate algorithm (currently, From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 14:22:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6F43A79E; Sun, 25 Nov 2012 14:22:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 54F208FC13; Sun, 25 Nov 2012 14:22:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPEM8lV074657; Sun, 25 Nov 2012 14:22:08 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPEM8BV074656; Sun, 25 Nov 2012 14:22:08 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251422.qAPEM8BV074656@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 14:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243515 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 14:22:09 -0000 Author: avg Date: Sun Nov 25 14:22:08 2012 New Revision: 243515 URL: http://svnweb.freebsd.org/changeset/base/243515 Log: remove stop_scheduler_on_panic knob There has not been any complaints about the default behavior, so there is no need to keep a knob that enables the worse alternative. Now that the hard-stopping of other CPUs is the only behavior, the panic_cpu spinlock-like logic can be dropped, because only a single CPU is supposed to win stop_cpus_hard(other_cpus) race and proceed past that call. MFC after: 1 month Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sun Nov 25 12:38:12 2012 (r243514) +++ head/sys/kern/kern_shutdown.c Sun Nov 25 14:22:08 2012 (r243515) @@ -121,11 +121,6 @@ SYSCTL_INT(_kern, OID_AUTO, sync_on_pani &sync_on_panic, 0, "Do a sync before rebooting from a panic"); TUNABLE_INT("kern.sync_on_panic", &sync_on_panic); -static int stop_scheduler_on_panic = 1; -SYSCTL_INT(_kern, OID_AUTO, stop_scheduler_on_panic, CTLFLAG_RW | CTLFLAG_TUN, - &stop_scheduler_on_panic, 0, "stop scheduler upon entering panic"); -TUNABLE_INT("kern.stop_scheduler_on_panic", &stop_scheduler_on_panic); - static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); @@ -552,7 +547,6 @@ void panic(const char *fmt, ...) { #ifdef SMP - static volatile u_int panic_cpu = NOCPU; cpuset_t other_cpus; #endif struct thread *td = curthread; @@ -560,39 +554,27 @@ panic(const char *fmt, ...) va_list ap; static char buf[256]; - if (stop_scheduler_on_panic) - spinlock_enter(); - else - critical_enter(); + spinlock_enter(); #ifdef SMP /* - * We don't want multiple CPU's to panic at the same time, so we - * use panic_cpu as a simple spinlock. We have to keep checking - * panic_cpu if we are spinning in case the panic on the first - * CPU is canceled. + * stop_cpus_hard(other_cpus) should prevent multiple CPUs from + * concurrently entering panic. Only the winner will proceed + * further. */ - if (panic_cpu != PCPU_GET(cpuid)) - while (atomic_cmpset_int(&panic_cpu, NOCPU, - PCPU_GET(cpuid)) == 0) - while (panic_cpu != NOCPU) - ; /* nothing */ - - if (stop_scheduler_on_panic) { - if (panicstr == NULL && !kdb_active) { - other_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &other_cpus); - stop_cpus_hard(other_cpus); - } - - /* - * We set stop_scheduler here and not in the block above, - * because we want to ensure that if panic has been called and - * stop_scheduler_on_panic is true, then stop_scheduler will - * always be set. Even if panic has been entered from kdb. - */ - td->td_stopsched = 1; + if (panicstr == NULL && !kdb_active) { + other_cpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + stop_cpus_hard(other_cpus); } + + /* + * We set stop_scheduler here and not in the block above, + * because we want to ensure that if panic has been called and + * stop_scheduler_on_panic is true, then stop_scheduler will + * always be set. Even if panic has been entered from kdb. + */ + td->td_stopsched = 1; #endif bootopt = RB_AUTOBOOT; @@ -632,8 +614,6 @@ panic(const char *fmt, ...) /* thread_unlock(td); */ if (!sync_on_panic) bootopt |= RB_NOSYNC; - if (!stop_scheduler_on_panic) - critical_exit(); kern_reboot(bootopt); } From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 14:25:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D26209C2; Sun, 25 Nov 2012 14:25:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B94E48FC12; Sun, 25 Nov 2012 14:25:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPEP8W8075065; Sun, 25 Nov 2012 14:25:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPEP8vg075063; Sun, 25 Nov 2012 14:25:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201211251425.qAPEP8vg075063@svn.freebsd.org> From: Michael Tuexen Date: Sun, 25 Nov 2012 14:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243516 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 14:25:08 -0000 Author: tuexen Date: Sun Nov 25 14:25:08 2012 New Revision: 243516 URL: http://svnweb.freebsd.org/changeset/base/243516 Log: Remove unused function. MFC after: 1 week Modified: head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_peeloff.h Modified: head/sys/netinet/sctp_peeloff.c ============================================================================== --- head/sys/netinet/sctp_peeloff.c Sun Nov 25 14:22:08 2012 (r243515) +++ head/sys/netinet/sctp_peeloff.c Sun Nov 25 14:25:08 2012 (r243516) @@ -151,103 +151,3 @@ sctp_do_peeloff(struct socket *head, str return (0); } - - -struct socket * -sctp_get_peeloff(struct socket *head, sctp_assoc_t assoc_id, int *error) -{ - struct socket *newso; - struct sctp_inpcb *inp, *n_inp; - struct sctp_tcb *stcb; - - SCTPDBG(SCTP_DEBUG_PEEL1, "SCTP peel-off called\n"); - inp = (struct sctp_inpcb *)head->so_pcb; - if (inp == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); - *error = EFAULT; - return (NULL); - } - stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); - if (stcb == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); - *error = ENOTCONN; - return (NULL); - } - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - CURVNET_SET(head->so_vnet); - newso = sonewconn(head, SS_ISCONNECTED - ); - CURVNET_RESTORE(); - if (newso == NULL) { - SCTPDBG(SCTP_DEBUG_PEEL1, "sctp_peeloff:sonewconn failed\n"); - SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOMEM); - *error = ENOMEM; - atomic_subtract_int(&stcb->asoc.refcnt, 1); - return (NULL); - - } - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - n_inp = (struct sctp_inpcb *)newso->so_pcb; - SOCK_LOCK(head); - n_inp->sctp_flags = (SCTP_PCB_FLAGS_UDPTYPE | - SCTP_PCB_FLAGS_CONNECTED | - SCTP_PCB_FLAGS_IN_TCPPOOL | /* Turn on Blocking IO */ - (SCTP_PCB_COPY_FLAGS & inp->sctp_flags)); - n_inp->sctp_features = inp->sctp_features; - n_inp->sctp_frag_point = inp->sctp_frag_point; - n_inp->sctp_cmt_on_off = inp->sctp_cmt_on_off; - n_inp->sctp_ecn_enable = inp->sctp_ecn_enable; - n_inp->partial_delivery_point = inp->partial_delivery_point; - n_inp->sctp_context = inp->sctp_context; - n_inp->local_strreset_support = inp->local_strreset_support; - n_inp->inp_starting_point_for_iterator = NULL; - - /* copy in the authentication parameters from the original endpoint */ - if (n_inp->sctp_ep.local_hmacs) - sctp_free_hmaclist(n_inp->sctp_ep.local_hmacs); - n_inp->sctp_ep.local_hmacs = - sctp_copy_hmaclist(inp->sctp_ep.local_hmacs); - if (n_inp->sctp_ep.local_auth_chunks) - sctp_free_chunklist(n_inp->sctp_ep.local_auth_chunks); - n_inp->sctp_ep.local_auth_chunks = - sctp_copy_chunklist(inp->sctp_ep.local_auth_chunks); - (void)sctp_copy_skeylist(&inp->sctp_ep.shared_keys, - &n_inp->sctp_ep.shared_keys); - - n_inp->sctp_socket = newso; - if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE)) { - sctp_feature_off(n_inp, SCTP_PCB_FLAGS_AUTOCLOSE); - n_inp->sctp_ep.auto_close_time = 0; - sctp_timer_stop(SCTP_TIMER_TYPE_AUTOCLOSE, n_inp, stcb, NULL, - SCTP_FROM_SCTP_PEELOFF + SCTP_LOC_1); - } - /* Turn off any non-blocking semantic. */ - SCTP_CLEAR_SO_NBIO(newso); - newso->so_state |= SS_ISCONNECTED; - /* We remove it right away */ - -#ifdef SCTP_LOCK_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) { - sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK); - } -#endif - TAILQ_REMOVE(&head->so_comp, newso, so_list); - head->so_qlen--; - SOCK_UNLOCK(head); - /* - * Now we must move it from one hash table to another and get the - * stcb in the right place. - */ - sctp_move_pcb_and_assoc(inp, n_inp, stcb); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - /* - * And now the final hack. We move data in the pending side i.e. - * head to the new socket buffer. Let the GRUBBING begin :-0 - */ - sctp_pull_off_control_to_new_inp(inp, n_inp, stcb, SBL_WAIT); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - return (newso); -} Modified: head/sys/netinet/sctp_peeloff.h ============================================================================== --- head/sys/netinet/sctp_peeloff.h Sun Nov 25 14:22:08 2012 (r243515) +++ head/sys/netinet/sctp_peeloff.h Sun Nov 25 14:25:08 2012 (r243516) @@ -35,18 +35,9 @@ __FBSDID("$FreeBSD$"); #ifndef _NETINET_SCTP_PEELOFF_H_ #define _NETINET_SCTP_PEELOFF_H_ - - - - #if defined(_KERNEL) - int sctp_can_peel_off(struct socket *, sctp_assoc_t); int sctp_do_peeloff(struct socket *, struct socket *, sctp_assoc_t); -struct socket *sctp_get_peeloff(struct socket *, sctp_assoc_t, int *); - - #endif /* _KERNEL */ - -#endif +#endif /* _NETINET_SCTP_PEELOFF_H_ */ From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 14:53:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A21B22F; Sun, 25 Nov 2012 14:53:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0F4F18FC08; Sun, 25 Nov 2012 14:53:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPErQYq078440; Sun, 25 Nov 2012 14:53:26 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPErQ4S078439; Sun, 25 Nov 2012 14:53:26 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251453.qAPErQ4S078439@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 14:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243517 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 14:53:27 -0000 Author: avg Date: Sun Nov 25 14:53:26 2012 New Revision: 243517 URL: http://svnweb.freebsd.org/changeset/base/243517 Log: zfs_getpages: optimize for large block sizes MFC after: 6 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 14:25:08 2012 (r243516) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 14:53:26 2012 (r243517) @@ -5556,34 +5556,61 @@ zfs_getpages(struct vnode *vp, vm_page_t znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; objset_t *os = zp->z_zfsvfs->z_os; - vm_page_t mreq; + vm_page_t mfirst, mlast, mreq; vm_object_t object; caddr_t va; struct sf_buf *sf; + off_t startoff, endoff; int i, error; - int pcount, size; + vm_pindex_t reqstart, reqend; + int pcount, lsize, reqsize, size; ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); - pcount = round_page(count) / PAGE_SIZE; + pcount = OFF_TO_IDX(round_page(count)); mreq = m[reqpage]; object = mreq->object; error = 0; KASSERT(vp->v_object == object, ("mismatching object")); + if (pcount > 1 && zp->z_blksz > PAGESIZE) { + startoff = rounddown(IDX_TO_OFF(mreq->pindex), zp->z_blksz); + reqstart = OFF_TO_IDX(round_page(startoff)); + if (reqstart < m[0]->pindex) + reqstart = 0; + else + reqstart = reqstart - m[0]->pindex; + endoff = roundup(IDX_TO_OFF(mreq->pindex) + PAGE_SIZE, + zp->z_blksz); + reqend = OFF_TO_IDX(trunc_page(endoff)) - 1; + if (reqend > m[pcount - 1]->pindex) + reqend = m[pcount - 1]->pindex; + reqsize = reqend - m[reqstart]->pindex + 1; + KASSERT(reqstart <= reqpage && reqpage < reqstart + reqsize, + ("reqpage beyond [reqstart, reqstart + reqsize[ bounds")); + } else { + reqstart = reqpage; + reqsize = 1; + } + mfirst = m[reqstart]; + mlast = m[reqstart + reqsize - 1]; + VM_OBJECT_LOCK(object); - for (i = 0; i < pcount; i++) { - if (i != reqpage) { - vm_page_lock(m[i]); - vm_page_free(m[i]); - vm_page_unlock(m[i]); - } + for (i = 0; i < reqstart; i++) { + vm_page_lock(m[i]); + vm_page_free(m[i]); + vm_page_unlock(m[i]); + } + for (i = reqstart + reqsize; i < pcount; i++) { + vm_page_lock(m[i]); + vm_page_free(m[i]); + vm_page_unlock(m[i]); } - if (mreq->valid) { + if (mreq->valid && reqsize == 1) { if (mreq->valid != VM_PAGE_BITS_ALL) vm_page_zero_invalid(mreq, TRUE); VM_OBJECT_UNLOCK(object); @@ -5592,30 +5619,66 @@ zfs_getpages(struct vnode *vp, vm_page_t } PCPU_INC(cnt.v_vnodein); - PCPU_INC(cnt.v_vnodepgsin); + PCPU_ADD(cnt.v_vnodepgsin, reqsize); if (IDX_TO_OFF(mreq->pindex) >= object->un_pager.vnp.vnp_size) { + for (i = reqstart; i < reqstart + reqsize; i++) { + if (i != reqpage) { + vm_page_lock(m[i]); + vm_page_free(m[i]); + vm_page_unlock(m[i]); + } + } VM_OBJECT_UNLOCK(object); ZFS_EXIT(zfsvfs); return (VM_PAGER_BAD); } - size = PAGE_SIZE; - if (IDX_TO_OFF(mreq->pindex) + size > object->un_pager.vnp.vnp_size) - size = object->un_pager.vnp.vnp_size - IDX_TO_OFF(mreq->pindex); + lsize = PAGE_SIZE; + if (IDX_TO_OFF(mlast->pindex) + lsize > object->un_pager.vnp.vnp_size) + lsize = object->un_pager.vnp.vnp_size - IDX_TO_OFF(mlast->pindex); VM_OBJECT_UNLOCK(object); - va = zfs_map_page(mreq, &sf); - error = dmu_read(os, zp->z_id, IDX_TO_OFF(mreq->pindex), - size, va, DMU_READ_PREFETCH); - if (size != PAGE_SIZE) - bzero(va + size, PAGE_SIZE - size); - zfs_unmap_page(sf); + + for (i = reqstart; i < reqstart + reqsize; i++) { + size = PAGE_SIZE; + if (i == (reqstart + reqsize - 1)) + size = lsize; + va = zfs_map_page(m[i], &sf); + error = dmu_read(os, zp->z_id, IDX_TO_OFF(m[i]->pindex), + size, va, DMU_READ_PREFETCH); + if (size != PAGE_SIZE) + bzero(va + size, PAGE_SIZE - size); + zfs_unmap_page(sf); + if (error != 0) + break; + } + VM_OBJECT_LOCK(object); - if (!error) - mreq->valid = VM_PAGE_BITS_ALL; - KASSERT(mreq->dirty == 0, ("zfs_getpages: page %p is dirty", mreq)); + for (i = reqstart; i < reqstart + reqsize; i++) { + m[i]->valid = VM_PAGE_BITS_ALL; + KASSERT(m[i]->dirty == 0, ("zfs_getpages: page %p is dirty", m[i])); + if (i != reqpage) { + if (!error) { + if (m[i]->oflags & VPO_WANTED) { + vm_page_lock(m[i]); + vm_page_activate(m[i]); + vm_page_unlock(m[i]); + } else { + vm_page_lock(m[i]); + vm_page_deactivate(m[i]); + vm_page_unlock(m[i]); + } + vm_page_wakeup(m[i]); + } else { + vm_page_lock(m[i]); + vm_page_free(m[i]); + vm_page_unlock(m[i]); + } + } + + } VM_OBJECT_UNLOCK(object); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 15:01:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0360543A; Sun, 25 Nov 2012 15:01:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D881C8FC12; Sun, 25 Nov 2012 15:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPF1C8r079556; Sun, 25 Nov 2012 15:01:12 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPF1CKS079555; Sun, 25 Nov 2012 15:01:12 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251501.qAPF1CKS079555@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 15:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243518 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 15:01:13 -0000 Author: avg Date: Sun Nov 25 15:01:12 2012 New Revision: 243518 URL: http://svnweb.freebsd.org/changeset/base/243518 Log: add zfs_bmap to aid vnode_pager_haspage ... otherwise zfs_getpages would mostly be called with one page at a time. It is expected that ZFS VOP_BMAP is only called from vnode_pager_haspage. Since ZFS files can have variable block sizes and also because we don't really know if any given blocks are consecutive, we can not really report any additional blocks behind or ahead of a given block. Since physical block numbers do not make sense for ZFS, we do not do any real translation and thus pass back blk = lblk. The net effect is that vnode_pager_haspage knows that the block exists and that the pages backed by the block can be accessed. vnode_pager_haspage may be wrong about the exact count of the pages backed by the block, because of a variable block size, which vnode_pager_haspage doesn't really know - it only knows max block size in a filesystem. So pages from multiple blocks can be passed to zfs_getpages, but that is expected and correctly handled. vnode_pager should not call zfs_bmap for any other reason, because ZFS implements VOP_PUTPAGES and thus vnode_pager_generic_getpages is not used. vfs_cluster code vfs_bio code should not be called for ZFS, because ZFS does not use buffer cache layer. Also, ZFS does not use vn_bmap_seekhole, it has its prviate mechanism for working with holes. The above list should cover all the current calls to VOP_BMAP. Reviewed by: kib MFC after: 6 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 14:53:26 2012 (r243517) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 15:01:12 2012 (r243518) @@ -5702,6 +5702,30 @@ zfs_freebsd_getpages(ap) } static int +zfs_freebsd_bmap(ap) + struct vop_bmap_args /* { + struct vnode *a_vp; + daddr_t a_bn; + struct bufobj **a_bop; + daddr_t *a_bnp; + int *a_runp; + int *a_runb; + } */ *ap; +{ + + if (ap->a_bop != NULL) + *ap->a_bop = &ap->a_vp->v_bufobj; + if (ap->a_bnp != NULL) + *ap->a_bnp = ap->a_bn; + if (ap->a_runp != NULL) + *ap->a_runp = 0; + if (ap->a_runb != NULL) + *ap->a_runb = 0; + + return (0); +} + +static int zfs_freebsd_open(ap) struct vop_open_args /* { struct vnode *a_vp; @@ -6806,7 +6830,7 @@ struct vop_vector zfs_vnodeops = { .vop_remove = zfs_freebsd_remove, .vop_rename = zfs_freebsd_rename, .vop_pathconf = zfs_freebsd_pathconf, - .vop_bmap = VOP_EOPNOTSUPP, + .vop_bmap = zfs_freebsd_bmap, .vop_fid = zfs_freebsd_fid, .vop_getextattr = zfs_getextattr, .vop_deleteextattr = zfs_deleteextattr, From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 15:07:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36B997CF; Sun, 25 Nov 2012 15:07:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BAF08FC15; Sun, 25 Nov 2012 15:07:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPF7RlJ080538; Sun, 25 Nov 2012 15:07:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPF7RLa080537; Sun, 25 Nov 2012 15:07:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251507.qAPF7RLa080537@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 15:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243519 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 15:07:28 -0000 Author: avg Date: Sun Nov 25 15:07:27 2012 New Revision: 243519 URL: http://svnweb.freebsd.org/changeset/base/243519 Log: zfs_fhtovp: there is no reason to amend lock flags with LK_RETRY here MFC after: 12 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Nov 25 15:01:12 2012 (r243518) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Nov 25 15:07:27 2012 (r243519) @@ -2123,7 +2123,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int VN_HOLD(*vpp); } ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags | LK_RETRY); + err = zfs_vnode_lock(*vpp, flags); if (err != 0) *vpp = NULL; return (err); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 15:33:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C22C2B7A; Sun, 25 Nov 2012 15:33:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9DED08FC0C; Sun, 25 Nov 2012 15:33:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPFXQtc083872; Sun, 25 Nov 2012 15:33:26 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPFXQgi083867; Sun, 25 Nov 2012 15:33:26 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251533.qAPFXQgi083867@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 15:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243520 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 15:33:27 -0000 Author: avg Date: Sun Nov 25 15:33:26 2012 New Revision: 243520 URL: http://svnweb.freebsd.org/changeset/base/243520 Log: zfs: overhaul zfs-vfs glue for vnode life-cycle management * There is no need for the delayed destruction of znodes via taskqueue, now that we do not need to fear recursion from getnewvnode into zfs_inactive and zfs_freebsd_reclaim, thus making znode/vnode state machine a bit simpler. * More complete porting of zfs_inactive from Solaris VFS model to FreeBSD vop_inactive and vop_reclaim model. All destructive actions are done in zfs_freebsd_reclaim. This allows to simplify zfs_zget logic. * Allow zfs_zget to return a doomed vnode if the current thread already has an exclusive lock on the vnode. * Clean up Solaris-isms like bailing out of reclaim/inactive on certain values of v_usecount (aka v_count) or directly messing with this counter. * Do not clear z_vnode while znode is still accessible. z_vnode should be cleared only after zfs_znode_dmu_fini. Otherwise zfs_zget may get an effectively half-deconstructed znode. This allows to simplify zfs_zget logic further. The above changes fix at least two known/reported problems: o An indefinite wait in the following code path: vgone -> VOP_RECLAIM -> zfs_freebsd_reclaim -> vnode_destroy_vobject -> put_pages -> zfs_write -> zil_commit -> zfs_zget This happened because vgone marks a vnode as VI_DOOMED before calling VOP_RECLAIM, but zfs_zget would not return a doomed vnode under any circumstances. The fix in this change is not complete as it won't fix a deadlock between two threads doing VOP_RECLAIM where one thread is in zil_commit trying to zfs_zget a znode/vnode being reclaimed by the other thread, which would be blocked trying to enter zil_commit. This type of deadlock has not been reported as of now. o An indefinite wait in the unmount path caused by a znode "falling through the cracks" in inactive+reclaim. This would happen if the znode is unlinked while its vnode is still active. To Do: pass locking flags parameter to zfs_zget, so that the zfs-vfs glue code doesn't have to re-lock a vnode but could ask for proper locking from the very start. This would also allow for the higher level code to obtain a doomed vnode when it is expected/requested. Or to avoid blocking when it is not allowed (see zil_commit example above). ffs_vgetf seems like a good source of inspiration. Tested by: Willem Jan Withagen MFC after: 6 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sun Nov 25 15:07:27 2012 (r243519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Sun Nov 25 15:33:26 2012 (r243520) @@ -207,8 +207,6 @@ typedef struct znode { list_node_t z_link_node; /* all znodes in fs link */ sa_handle_t *z_sa_hdl; /* handle to sa data */ boolean_t z_is_sa; /* are we native sa? */ - /* FreeBSD-specific field. */ - struct task z_task; } znode_t; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Nov 25 15:07:27 2012 (r243519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sun Nov 25 15:33:26 2012 (r243520) @@ -1847,18 +1847,6 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea zfsvfs->z_unmounted = B_TRUE; rrw_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); - -#ifdef __FreeBSD__ - /* - * Some znodes might not be fully reclaimed, wait for them. - */ - mutex_enter(&zfsvfs->z_znodes_lock); - while (list_head(&zfsvfs->z_all_znodes) != NULL) { - msleep(zfsvfs, &zfsvfs->z_znodes_lock, 0, - "zteardown", 0); - } - mutex_exit(&zfsvfs->z_znodes_lock); -#endif } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 15:07:27 2012 (r243519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 15:33:26 2012 (r243520) @@ -4566,14 +4566,22 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - VI_LOCK(vp); - ASSERT(vp->v_count <= 1); - vp->v_count = 0; - VI_UNLOCK(vp); + rw_exit(&zfsvfs->z_teardown_inactive_lock); vrecycle(vp); + return; + } + + mutex_enter(&zp->z_lock); + if (zp->z_unlinked) { + /* + * Fast path to recycle a vnode of a removed file. + */ + mutex_exit(&zp->z_lock); rw_exit(&zfsvfs->z_teardown_inactive_lock); + vrecycle(vp); return; } + mutex_exit(&zp->z_lock); if (zp->z_atime_dirty && zp->z_unlinked == 0) { dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os); @@ -4592,8 +4600,6 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca dmu_tx_commit(tx); } } - - zfs_zinactive(zp); rw_exit(&zfsvfs->z_teardown_inactive_lock); } @@ -6196,28 +6202,6 @@ zfs_freebsd_inactive(ap) return (0); } -static void -zfs_reclaim_complete(void *arg, int pending) -{ - znode_t *zp = arg; - zfsvfs_t *zfsvfs = zp->z_zfsvfs; - - rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER); - if (zp->z_sa_hdl != NULL) { - ZFS_OBJ_HOLD_ENTER(zfsvfs, zp->z_id); - zfs_znode_dmu_fini(zp); - ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); - } - zfs_znode_free(zp); - rw_exit(&zfsvfs->z_teardown_inactive_lock); - /* - * If the file system is being unmounted, there is a process waiting - * for us, wake it up. - */ - if (zfsvfs->z_unmounted) - wakeup_one(zfsvfs); -} - static int zfs_freebsd_reclaim(ap) struct vop_reclaim_args /* { @@ -6228,53 +6212,26 @@ zfs_freebsd_reclaim(ap) vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; - boolean_t rlocked; - - rlocked = rw_tryenter(&zfsvfs->z_teardown_inactive_lock, RW_READER); + int refcnt; ASSERT(zp != NULL); - /* - * Destroy the vm object and flush associated pages. - */ + /* Destroy the vm object and flush associated pages. */ vnode_destroy_vobject(vp); - mutex_enter(&zp->z_lock); - zp->z_vnode = NULL; - mutex_exit(&zp->z_lock); - - if (zp->z_unlinked) { - ; /* Do nothing. */ - } else if (!rlocked) { - TASK_INIT(&zp->z_task, 0, zfs_reclaim_complete, zp); - taskqueue_enqueue(taskqueue_thread, &zp->z_task); - } else if (zp->z_sa_hdl == NULL) { + /* + * z_teardown_inactive_lock protects from a race with + * zfs_znode_dmu_fini in zfsvfs_teardown during + * force unmount. + */ + rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_READER); + if (zp->z_sa_hdl == NULL) zfs_znode_free(zp); - } else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ { - int locked; + else + zfs_zinactive(zp); + rw_exit(&zfsvfs->z_teardown_inactive_lock); - locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 : - ZFS_OBJ_HOLD_TRYENTER(zfsvfs, zp->z_id); - if (locked == 0) { - /* - * Lock can't be obtained due to deadlock possibility, - * so defer znode destruction. - */ - TASK_INIT(&zp->z_task, 0, zfs_reclaim_complete, zp); - taskqueue_enqueue(taskqueue_thread, &zp->z_task); - } else { - zfs_znode_dmu_fini(zp); - if (locked == 1) - ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); - zfs_znode_free(zp); - } - } - VI_LOCK(vp); vp->v_data = NULL; - ASSERT(vp->v_holdcnt >= 1); - VI_UNLOCK(vp); - if (rlocked) - rw_exit(&zfsvfs->z_teardown_inactive_lock); return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Nov 25 15:07:27 2012 (r243519) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Sun Nov 25 15:33:26 2012 (r243520) @@ -1147,14 +1147,16 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_ dmu_object_info_t doi; dmu_buf_t *db; znode_t *zp; - int err; + vnode_t *vp; sa_handle_t *hdl; - int first = 1; - - *zpp = NULL; + struct thread *td; + int locked; + int err; + td = curthread; getnewvnode_reserve(1); again: + *zpp = NULL; ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num); err = sa_buf_hold(zfsvfs->z_os, obj_num, NULL, &db); @@ -1193,48 +1195,38 @@ again: if (zp->z_unlinked) { err = ENOENT; } else { - vnode_t *vp; - int dying = 0; - vp = ZTOV(zp); - if (vp == NULL) - dying = 1; - else { - VN_HOLD(vp); - if ((vp->v_iflag & VI_DOOMED) != 0) { - dying = 1; - /* - * Don't VN_RELE() vnode here, because - * it can call vn_lock() which creates - * LOR between vnode lock and znode - * lock. We will VN_RELE() the vnode - * after droping znode lock. - */ - } - } - if (dying) { - if (first) { - ZFS_LOG(1, "dying znode detected (zp=%p)", zp); - first = 0; - } - /* - * znode is dying so we can't reuse it, we must - * wait until destruction is completed. - */ - sa_buf_rele(db, NULL); - mutex_exit(&zp->z_lock); - ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); - if (vp != NULL) - VN_RELE(vp); - tsleep(zp, 0, "zcollide", 1); - goto again; - } *zpp = zp; err = 0; } sa_buf_rele(db, NULL); + + /* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */ + if (err == 0) + VN_HOLD(vp); + mutex_exit(&zp->z_lock); ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); + + if (err == 0) { + locked = VOP_ISLOCKED(vp); + VI_LOCK(vp); + if ((vp->v_iflag & VI_DOOMED) != 0 && + locked != LK_EXCLUSIVE) { + /* + * The vnode is doomed and this thread doesn't + * hold the exclusive lock on it, so the vnode + * must be being reclaimed by another thread. + * Otherwise the doomed vnode is being reclaimed + * by this thread and zfs_zget is called from + * ZIL internals. + */ + VI_UNLOCK(vp); + VN_RELE(vp); + goto again; + } + VI_UNLOCK(vp); + } getnewvnode_drop_reserve(); return (err); } @@ -1400,7 +1392,6 @@ zfs_znode_delete(znode_t *zp, dmu_tx_t * void zfs_zinactive(znode_t *zp) { - vnode_t *vp = ZTOV(zp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; uint64_t z_id = zp->z_id; @@ -1412,19 +1403,6 @@ zfs_zinactive(znode_t *zp) ZFS_OBJ_HOLD_ENTER(zfsvfs, z_id); mutex_enter(&zp->z_lock); - VI_LOCK(vp); - if (vp->v_count > 0) { - /* - * If the hold count is greater than zero, somebody has - * obtained a new reference on this znode while we were - * processing it here, so we are done. - */ - VI_UNLOCK(vp); - mutex_exit(&zp->z_lock); - ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - return; - } - VI_UNLOCK(vp); /* * If this was the last reference to a file with no links, @@ -1433,14 +1411,14 @@ zfs_zinactive(znode_t *zp) if (zp->z_unlinked) { mutex_exit(&zp->z_lock); ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); - ASSERT(vp->v_count == 0); - vrecycle(vp); zfs_rmnode(zp); return; } mutex_exit(&zp->z_lock); + zfs_znode_dmu_fini(zp); ZFS_OBJ_HOLD_EXIT(zfsvfs, z_id); + zfs_znode_free(zp); } void @@ -1448,8 +1426,8 @@ zfs_znode_free(znode_t *zp) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; - ASSERT(ZTOV(zp) == NULL); ASSERT(zp->z_sa_hdl == NULL); + zp->z_vnode = NULL; mutex_enter(&zfsvfs->z_znodes_lock); POINTER_INVALIDATE(&zp->z_zfsvfs); list_remove(&zfsvfs->z_all_znodes, zp); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 15:46:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97318EB6; Sun, 25 Nov 2012 15:46:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7CA218FC0C; Sun, 25 Nov 2012 15:46:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPFkTmc085485; Sun, 25 Nov 2012 15:46:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPFkTaT085484; Sun, 25 Nov 2012 15:46:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201211251546.qAPFkTaT085484@svn.freebsd.org> From: Andriy Gapon Date: Sun, 25 Nov 2012 15:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243521 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 15:46:29 -0000 Author: avg Date: Sun Nov 25 15:46:29 2012 New Revision: 243521 URL: http://svnweb.freebsd.org/changeset/base/243521 Log: zfs_freebsd_reclaim: remove a stray variable ... which leaked from a subsequent local change. Unfortunately I noticed that only after commit. MFC after: 5 weeks X-MFC with: r243520 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 15:33:26 2012 (r243520) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 15:46:29 2012 (r243521) @@ -6212,7 +6212,6 @@ zfs_freebsd_reclaim(ap) vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; - int refcnt; ASSERT(zp != NULL); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 16:19:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1A7967A5; Sun, 25 Nov 2012 16:19:13 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D733A8FC14; Sun, 25 Nov 2012 16:19:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPGJC7O090015; Sun, 25 Nov 2012 16:19:12 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPGJCXn090012; Sun, 25 Nov 2012 16:19:12 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201211251619.qAPGJCXn090012@svn.freebsd.org> From: Tim Kientzle Date: Sun, 25 Nov 2012 16:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243523 - in head/sys/arm: arm broadcom/bcm2835 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 16:19:13 -0000 Author: kientzle Date: Sun Nov 25 16:19:12 2012 New Revision: 243523 URL: http://svnweb.freebsd.org/changeset/base/243523 Log: Fix spelling. Modified: head/sys/arm/arm/mpcore_timer.c head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c head/sys/arm/ti/am335x/am335x_dmtimer.c Modified: head/sys/arm/arm/mpcore_timer.c ============================================================================== --- head/sys/arm/arm/mpcore_timer.c Sun Nov 25 15:58:35 2012 (r243522) +++ head/sys/arm/arm/mpcore_timer.c Sun Nov 25 16:19:12 2012 (r243523) @@ -128,7 +128,7 @@ static struct arm_tmr_softc *arm_tmr_sc static timecounter_get_t arm_tmr_get_timecount; static struct timecounter arm_tmr_timecount = { - .tc_name = "ARM MPCore Timecouter", + .tc_name = "ARM MPCore Timecounter", .tc_get_timecount = arm_tmr_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = ~0u, Modified: head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Sun Nov 25 15:58:35 2012 (r243522) +++ head/sys/arm/broadcom/bcm2835/bcm2835_systimer.c Sun Nov 25 16:19:12 2012 (r243523) @@ -102,7 +102,7 @@ static struct bcm_systimer_softc *bcm_sy static unsigned bcm_systimer_tc_get_timecount(struct timecounter *); static struct timecounter bcm_systimer_tc = { - .tc_name = "BCM2835 Timecouter", + .tc_name = "BCM2835 Timecounter", .tc_get_timecount = bcm_systimer_tc_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = ~0u, Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_dmtimer.c Sun Nov 25 15:58:35 2012 (r243522) +++ head/sys/arm/ti/am335x/am335x_dmtimer.c Sun Nov 25 16:19:12 2012 (r243523) @@ -128,7 +128,7 @@ static struct am335x_dmtimer *am335x_dmt static unsigned am335x_dmtimer_tc_get_timecount(struct timecounter *); static struct timecounter am335x_dmtimer_tc = { - .tc_name = "AM335x Timecouter", + .tc_name = "AM335x Timecounter", .tc_get_timecount = am335x_dmtimer_tc_get_timecount, .tc_poll_pps = NULL, .tc_counter_mask = ~0u, From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 16:22:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5504AB30; Sun, 25 Nov 2012 16:22:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id C96F18FC1B; Sun, 25 Nov 2012 16:22:00 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qAPGLq5R004822; Sun, 25 Nov 2012 18:21:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qAPGLq5R004822 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qAPGLqq4004821; Sun, 25 Nov 2012 18:21:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 25 Nov 2012 18:21:52 +0200 From: Konstantin Belousov To: Pawel Jakub Dawidek Subject: Re: svn commit: r243142 - in head/sys: fs/nfsclient kern sys Message-ID: <20121125162152.GA3013@kib.kiev.ua> References: <201211160825.qAG8P6v6047507@svn.freebsd.org> <20121124222408.GH1460@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KsGdsel6WgEHnImy" Content-Disposition: inline In-Reply-To: <20121124222408.GH1460@garage.freebsd.pl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 16:22:01 -0000 --KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 24, 2012 at 11:24:08PM +0100, Pawel Jakub Dawidek wrote: > On Fri, Nov 16, 2012 at 08:25:06AM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Fri Nov 16 08:25:06 2012 > > New Revision: 243142 > > URL: http://svnweb.freebsd.org/changeset/base/243142 > >=20 > > Log: > > In pget(9), if PGET_NOTWEXIT flag is not specified, also search the > > zombie list for the pid. This allows several kern.proc sysctls to > > report useful information for zombies. > > =20 > > Hold the allproc_lock around all searches instead of relocking it. > > Remove private pfind_locked() from the new nfs client code. > > =20 > > Requested and reviewed by: pjd > > Tested by: pho > > MFC after: 3 weeks > [...] > > @@ -364,12 +374,16 @@ pget(pid_t pid, int flags, struct proc * > > struct proc *p; > > int error; > > =20 > > + sx_slock(&allproc_lock); > > if (pid <=3D PID_MAX) > > - p =3D pfind(pid); > > + p =3D pfind_locked(pid); > > else if ((flags & PGET_NOTID) =3D=3D 0) > > - p =3D pfind_tid(pid); > > + p =3D pfind_tid_locked(pid); > > else > > p =3D NULL; > > + if (p =3D=3D NULL && (flags & PGET_NOTWEXIT) =3D=3D 0) > > + p =3D zpfind_locked(pid); > > + sx_sunlock(&allproc_lock); > > if (p =3D=3D NULL) > > return (ESRCH); >=20 > I think we should move zpfind_locked() under 'pid <=3D PID_MAX': >=20 > sx_slock(&allproc_lock); > if (pid <=3D PID_MAX) { > p =3D pfind_locked(pid); > if (p =3D=3D NULL && (flags & PGET_NOTWEXIT) =3D=3D 0) > p =3D zpfind_locked(pid); > } else if ((flags & PGET_NOTID) =3D=3D 0) { > p =3D pfind_tid_locked(pid); > } else { > p =3D NULL; > } > sx_sunlock(&allproc_lock); > if (p =3D=3D NULL) > return (ESRCH); >=20 Yes, I agree. Please remove {} for one-line blocks. --KsGdsel6WgEHnImy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCyRZ8ACgkQC3+MBN1Mb4jMWwCgsHJftyDD4T0q64Nfbrrnb4O7 KGIAoNJv5o1cUOxuReUv82kme48ikmZQ =sWF0 -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 16:32:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD93E79; Sun, 25 Nov 2012 16:32:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8E0DD8FC17; Sun, 25 Nov 2012 16:32:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPGW86N091593; Sun, 25 Nov 2012 16:32:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPGW8wd091581; Sun, 25 Nov 2012 16:32:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211251632.qAPGW8wd091581@svn.freebsd.org> From: Martin Matuska Date: Sun, 25 Nov 2012 16:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243524 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 16:32:08 -0000 Author: mm Date: Sun Nov 25 16:32:07 2012 New Revision: 243524 URL: http://svnweb.freebsd.org/changeset/base/243524 Log: MFV r243013 and r243267: Import the zio nop-write improvement from Illumos. To reduce I/O, nop-write omits overwriting data if the checksum (cryptographically secure) of new data matches the checksum of existing data. It also saves space if snapshots are in use. It currently works only on datasets with enabled compression, disabled deduplication and sha256 checksums. IllumOS 13887:196932ec9e6a and 13888:7204b3392a58 3236 zio nop-write References: https://www.illumos.org/issues/3236 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.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/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.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/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Nov 25 16:32:07 2012 (r243524) @@ -204,6 +204,7 @@ enum ztest_io_type { ZTEST_IO_WRITE_ZEROES, ZTEST_IO_TRUNCATE, ZTEST_IO_SETATTR, + ZTEST_IO_REWRITE, ZTEST_IO_TYPES }; @@ -1867,6 +1868,12 @@ ztest_get_data(void *arg, lr_write_t *lr DMU_READ_NO_PREFETCH); if (error == 0) { + blkptr_t *obp = dmu_buf_get_blkptr(db); + if (obp) { + ASSERT(BP_IS_HOLE(bp)); + *bp = *obp; + } + zgd->zgd_db = db; zgd->zgd_bp = bp; @@ -2012,6 +2019,9 @@ ztest_remove(ztest_ds_t *zd, ztest_od_t continue; } + /* + * No object was found. + */ if (od->od_object == 0) continue; @@ -2127,6 +2137,7 @@ ztest_prealloc(ztest_ds_t *zd, uint64_t static void ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset) { + int err; ztest_block_tag_t wbt; dmu_object_info_t doi; enum ztest_io_type io_type; @@ -2179,6 +2190,25 @@ ztest_io(ztest_ds_t *zd, uint64_t object case ZTEST_IO_SETATTR: (void) ztest_setattr(zd, object); break; + + case ZTEST_IO_REWRITE: + (void) rw_rdlock(&ztest_name_lock); + err = ztest_dsl_prop_set_uint64(zd->zd_name, + ZFS_PROP_CHECKSUM, spa_dedup_checksum(ztest_spa), + B_FALSE); + VERIFY(err == 0 || err == ENOSPC); + err = ztest_dsl_prop_set_uint64(zd->zd_name, + ZFS_PROP_COMPRESSION, + ztest_random_dsl_prop(ZFS_PROP_COMPRESSION), + B_FALSE); + VERIFY(err == 0 || err == ENOSPC); + (void) rw_unlock(&ztest_name_lock); + + VERIFY0(dmu_read(zd->zd_os, object, offset, blocksize, data, + DMU_READ_NO_PREFETCH)); + + (void) ztest_write(zd, object, offset, blocksize, data); + break; } (void) rw_unlock(&zd->zd_zilog_lock); @@ -2266,7 +2296,12 @@ ztest_zil_remount(ztest_ds_t *zd, uint64 { objset_t *os = zd->zd_os; - VERIFY(mutex_lock(&zd->zd_dirobj_lock) == 0); + /* + * We grab the zd_dirobj_lock to ensure that no other thread is + * updating the zil (i.e. adding in-memory log records) and the + * zd_zilog_lock to block any I/O. + */ + VERIFY0(mutex_lock(&zd->zd_dirobj_lock)); (void) rw_wrlock(&zd->zd_zilog_lock); /* zfsvfs_teardown() */ @@ -4925,8 +4960,8 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_ */ for (int i = 0; i < copies; i++) { uint64_t offset = i * blocksize; - VERIFY(dmu_buf_hold(os, object, offset, FTAG, &db, - DMU_READ_NO_PREFETCH) == 0); + VERIFY0(dmu_buf_hold(os, object, offset, FTAG, &db, + DMU_READ_NO_PREFETCH)); ASSERT(db->db_offset == offset); ASSERT(db->db_size == blocksize); ASSERT(ztest_pattern_match(db->db_data, db->db_size, pattern) || @@ -4942,8 +4977,8 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_ /* * Find out what block we got. */ - VERIFY(dmu_buf_hold(os, object, 0, FTAG, &db, - DMU_READ_NO_PREFETCH) == 0); + VERIFY0(dmu_buf_hold(os, object, 0, FTAG, &db, + DMU_READ_NO_PREFETCH)); blk = *((dmu_buf_impl_t *)db)->db_blkptr; dmu_buf_rele(db, FTAG); @@ -5621,6 +5656,8 @@ ztest_freeze(void) kernel_init(FREAD | FWRITE); VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG)); VERIFY3U(0, ==, ztest_dataset_open(0)); + spa->spa_debug = B_TRUE; + ztest_spa = spa; /* * Force the first log block to be transactionally allocated. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sun Nov 25 16:32:07 2012 (r243524) @@ -3688,6 +3688,12 @@ arc_write_done(zio_t *zio) arc_hdr_destroy(exists); exists = buf_hash_insert(hdr, &hash_lock); ASSERT3P(exists, ==, NULL); + } else if (zio->io_flags & ZIO_FLAG_NOPWRITE) { + /* nopwrite */ + ASSERT(zio->io_prop.zp_nopwrite); + if (!BP_EQUAL(&zio->io_bp_orig, zio->io_bp)) + panic("bad nopwrite, hdr=%p exists=%p", + (void *)hdr, (void *)exists); } else { /* Dedup */ ASSERT(hdr->b_datacnt == 1); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sun Nov 25 16:32:07 2012 (r243524) @@ -768,13 +768,15 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) ASSERT(db->db_data_pending != dr); /* free this block */ - if (!BP_IS_HOLE(bp)) { + if (!BP_IS_HOLE(bp) && !dr->dt.dl.dr_nopwrite) { spa_t *spa; 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; + /* * Release the already-written buffer, so we leave it in * a consistent dirty state. Note that all callers are @@ -2189,6 +2191,13 @@ dmu_buf_freeable(dmu_buf_t *dbuf) return (res); } +blkptr_t * +dmu_buf_get_blkptr(dmu_buf_t *db) +{ + dmu_buf_impl_t *dbi = (dmu_buf_impl_t *)db; + return (dbi->db_blkptr); +} + static void dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db) { @@ -2531,7 +2540,11 @@ dbuf_write_done(zio_t *zio, arc_buf_t *b ASSERT0(zio->io_error); ASSERT(db->db_blkptr == bp); - if (zio->io_flags & ZIO_FLAG_IO_REWRITE) { + /* + * For nopwrites and rewrites we ensure that the bp matches our + * original and bypass all the accounting. + */ + if (zio->io_flags & (ZIO_FLAG_IO_REWRITE | ZIO_FLAG_NOPWRITE)) { ASSERT(BP_EQUAL(bp, bp_orig)); } else { objset_t *os; @@ -2722,7 +2735,7 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ mutex_enter(&db->db_mtx); dr->dt.dl.dr_override_state = DR_NOT_OVERRIDDEN; zio_write_override(dr->dr_zio, &dr->dt.dl.dr_overridden_by, - dr->dt.dl.dr_copies); + dr->dt.dl.dr_copies, dr->dt.dl.dr_nopwrite); mutex_exit(&db->db_mtx); } else if (db->db_state == DB_NOFILL) { ASSERT(zp.zp_checksum == ZIO_CHECKSUM_OFF); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sun Nov 25 16:32:07 2012 (r243524) @@ -40,11 +40,17 @@ #include #include #include +#include #include #ifdef _KERNEL #include #endif +/* + * Enable/disable nopwrite feature. + */ +int zfs_nopwrite_enabled = 1; + const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, "unallocated" }, { DMU_BSWAP_ZAP, TRUE, "object directory" }, @@ -1287,6 +1293,16 @@ dmu_sync_done(zio_t *zio, arc_buf_t *buf mutex_enter(&db->db_mtx); ASSERT(dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC); if (zio->io_error == 0) { + dr->dt.dl.dr_nopwrite = !!(zio->io_flags & ZIO_FLAG_NOPWRITE); + if (dr->dt.dl.dr_nopwrite) { + blkptr_t *bp = zio->io_bp; + blkptr_t *bp_orig = &zio->io_bp_orig; + uint8_t chksum = BP_GET_CHECKSUM(bp_orig); + + ASSERT(BP_EQUAL(bp, bp_orig)); + ASSERT(zio->io_prop.zp_compress != ZIO_COMPRESS_OFF); + ASSERT(zio_checksum_table[chksum].ci_dedup); + } dr->dt.dl.dr_overridden_by = *zio->io_bp; dr->dt.dl.dr_override_state = DR_OVERRIDDEN; dr->dt.dl.dr_copies = zio->io_prop.zp_copies; @@ -1308,11 +1324,22 @@ dmu_sync_late_arrival_done(zio_t *zio) { blkptr_t *bp = zio->io_bp; dmu_sync_arg_t *dsa = zio->io_private; + blkptr_t *bp_orig = &zio->io_bp_orig; if (zio->io_error == 0 && !BP_IS_HOLE(bp)) { - ASSERT(zio->io_bp->blk_birth == zio->io_txg); - ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa)); - zio_free(zio->io_spa, zio->io_txg, zio->io_bp); + /* + * If we didn't allocate a new block (i.e. ZIO_FLAG_NOPWRITE) + * then there is nothing to do here. Otherwise, free the + * newly allocated block in this txg. + */ + if (zio->io_flags & ZIO_FLAG_NOPWRITE) { + ASSERT(BP_EQUAL(bp, bp_orig)); + } else { + ASSERT(BP_IS_HOLE(bp_orig) || !BP_EQUAL(bp, bp_orig)); + ASSERT(zio->io_bp->blk_birth == zio->io_txg); + ASSERT(zio->io_txg > spa_syncing_txg(zio->io_spa)); + zio_free(zio->io_spa, zio->io_txg, zio->io_bp); + } } dmu_tx_commit(dsa->dsa_tx); @@ -1357,7 +1384,7 @@ dmu_sync_late_arrival(zio_t *pio, objset * * Return values: * - * EEXIST: this txg has already been synced, so there's nothing to to. + * EEXIST: this txg has already been synced, so there's nothing to do. * The caller should not log the write. * * ENOENT: the block was dbuf_free_range()'d, so there's nothing to do. @@ -1389,7 +1416,6 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s dnode_t *dn; ASSERT(pio != NULL); - ASSERT(BP_IS_HOLE(bp)); ASSERT(txg != 0); SET_BOOKMARK(&zb, ds->ds_object, @@ -1444,6 +1470,23 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s return (ENOENT); } + ASSERT(dr->dr_next == NULL || dr->dr_next->dr_txg < txg); + + /* + * Assume the on-disk data is X, the current syncing data is Y, + * and the current in-memory data is Z (currently in dmu_sync). + * X and Z are identical but Y is has been modified. Normally, + * when X and Z are the same we will perform a nopwrite but if Y + * is different we must disable nopwrite since the resulting write + * of Y to disk can free the block containing X. If we allowed a + * nopwrite to occur the block pointing to Z would reference a freed + * block. Since this is a rare case we simplify this by disabling + * nopwrite if the current dmu_sync-ing dbuf has been modified in + * a previous transaction. + */ + if (dr->dr_next) + zp.zp_nopwrite = B_FALSE; + ASSERT(dr->dr_txg == txg); if (dr->dt.dl.dr_override_state == DR_IN_DMU_SYNC || dr->dt.dl.dr_override_state == DR_OVERRIDDEN) { @@ -1532,15 +1575,27 @@ dmu_write_policy(objset_t *os, dnode_t * enum zio_checksum checksum = os->os_checksum; enum zio_compress compress = os->os_compress; enum zio_checksum dedup_checksum = os->os_dedup_checksum; - boolean_t dedup; + boolean_t dedup = B_FALSE; + boolean_t nopwrite = B_FALSE; boolean_t dedup_verify = os->os_dedup_verify; int copies = os->os_copies; /* - * Determine checksum setting. + * We maintain different write policies for each of the following + * types of data: + * 1. metadata + * 2. preallocated blocks (i.e. level-0 blocks of a dump device) + * 3. all other level 0 blocks */ if (ismd) { /* + * XXX -- we should design a compression algorithm + * that specializes in arrays of bps. + */ + compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY : + ZIO_COMPRESS_LZJB; + + /* * Metadata always gets checksummed. If the data * checksum is multi-bit correctable, and it's not a * ZBT-style checksum, then it's suitable for metadata @@ -1550,45 +1605,47 @@ dmu_write_policy(objset_t *os, dnode_t * if (zio_checksum_table[checksum].ci_correctable < 1 || zio_checksum_table[checksum].ci_eck) checksum = ZIO_CHECKSUM_FLETCHER_4; - } else { - checksum = zio_checksum_select(dn->dn_checksum, checksum); - } + } else if (wp & WP_NOFILL) { + ASSERT(level == 0); - /* - * Determine compression setting. - */ - if (ismd) { /* - * XXX -- we should design a compression algorithm - * that specializes in arrays of bps. + * If we're writing preallocated blocks, we aren't actually + * writing them so don't set any policy properties. These + * blocks are currently only used by an external subsystem + * outside of zfs (i.e. dump) and not written by the zio + * pipeline. */ - compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY : - ZIO_COMPRESS_LZJB; + compress = ZIO_COMPRESS_OFF; + checksum = ZIO_CHECKSUM_OFF; } else { compress = zio_compress_select(dn->dn_compress, compress); - } - /* - * Determine dedup setting. If we are in dmu_sync(), we won't - * actually dedup now because that's all done in syncing context; - * but we do want to use the dedup checkum. If the checksum is not - * strong enough to ensure unique signatures, force dedup_verify. - */ - dedup = (!ismd && dedup_checksum != ZIO_CHECKSUM_OFF); - if (dedup) { - checksum = dedup_checksum; - if (!zio_checksum_table[checksum].ci_dedup) - dedup_verify = 1; - } + checksum = (dedup_checksum == ZIO_CHECKSUM_OFF) ? + zio_checksum_select(dn->dn_checksum, checksum) : + dedup_checksum; - if (wp & WP_DMU_SYNC) - dedup = 0; + /* + * Determine dedup setting. If we are in dmu_sync(), + * we won't actually dedup now because that's all + * done in syncing context; but we do want to use the + * dedup checkum. If the checksum is not strong + * enough to ensure unique signatures, force + * dedup_verify. + */ + if (dedup_checksum != ZIO_CHECKSUM_OFF) { + dedup = (wp & WP_DMU_SYNC) ? B_FALSE : B_TRUE; + if (!zio_checksum_table[checksum].ci_dedup) + dedup_verify = B_TRUE; + } - if (wp & WP_NOFILL) { - ASSERT(!ismd && level == 0); - checksum = ZIO_CHECKSUM_OFF; - compress = ZIO_COMPRESS_OFF; - dedup = B_FALSE; + /* + * Enable nopwrite if we have a cryptographically secure + * checksum that has no known collisions (i.e. SHA-256) + * and compression is enabled. We don't enable nopwrite if + * dedup is enabled as the two features are mutually exclusive. + */ + nopwrite = (!dedup && zio_checksum_table[checksum].ci_dedup && + compress != ZIO_COMPRESS_OFF && zfs_nopwrite_enabled); } zp->zp_checksum = checksum; @@ -1598,6 +1655,7 @@ dmu_write_policy(objset_t *os, dnode_t * zp->zp_copies = MIN(copies + ismd, spa_max_replication(os->os_spa)); zp->zp_dedup = dedup; zp->zp_dedup_verify = dedup && dedup_verify; + zp->zp_nopwrite = nopwrite; } int Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Sun Nov 25 16:32:07 2012 (r243524) @@ -440,7 +440,6 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t t * clean up our in-memory structures accumulated while syncing: * * - move dead blocks from the pending deadlist to the on-disk deadlist - * - clean up zil records * - release hold from dsl_dataset_dirty() */ while (ds = list_remove_head(&synced_datasets)) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Sun Nov 25 16:32:07 2012 (r243524) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_DBUF_H @@ -130,6 +131,7 @@ typedef struct dbuf_dirty_record { blkptr_t dr_overridden_by; override_states_t dr_override_state; uint8_t dr_copies; + boolean_t dr_nopwrite; } dl; } dt; } dbuf_dirty_record_t; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Sun Nov 25 16:32:07 2012 (r243524) @@ -505,6 +505,11 @@ void dmu_evict_user(objset_t *os, dmu_bu void *dmu_buf_get_user(dmu_buf_t *db); /* + * Returns the blkptr associated with this dbuf, or NULL if not set. + */ +struct blkptr *dmu_buf_get_blkptr(dmu_buf_t *db); + +/* * Indicate that you are going to modify the buffer's data (db_data). * * The transaction (tx) must be assigned to a txg (ie. you've called Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sun Nov 25 16:32:07 2012 (r243524) @@ -188,7 +188,9 @@ enum zio_flag { ZIO_FLAG_RAW = 1 << 21, ZIO_FLAG_GANG_CHILD = 1 << 22, ZIO_FLAG_DDT_CHILD = 1 << 23, - ZIO_FLAG_GODFATHER = 1 << 24 + ZIO_FLAG_GODFATHER = 1 << 24, + ZIO_FLAG_NOPWRITE = 1 << 25, + ZIO_FLAG_REEXECUTED = 1 << 26, }; #define ZIO_FLAG_MUSTSUCCEED 0 @@ -287,8 +289,9 @@ typedef struct zio_prop { dmu_object_type_t zp_type; uint8_t zp_level; uint8_t zp_copies; - uint8_t zp_dedup; - uint8_t zp_dedup_verify; + boolean_t zp_dedup; + boolean_t zp_dedup_verify; + boolean_t zp_nopwrite; } zio_prop_t; typedef struct zio_cksum_report zio_cksum_report_t; @@ -491,7 +494,8 @@ extern zio_t *zio_rewrite(zio_t *pio, sp void *data, uint64_t size, zio_done_func_t *done, void *priv, int priority, enum zio_flag flags, zbookmark_t *zb); -extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies); +extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies, + boolean_t nopwrite); extern void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Sun Nov 25 16:32:07 2012 (r243524) @@ -38,6 +38,70 @@ extern "C" { #endif /* + * XXX -- Describe ZFS I/O pipleine here. Fill in as needed. + * + * The ZFS I/O pipeline is comprised of various stages which are defined + * in the zio_stage enum below. The individual stages are used to construct + * these basic I/O operations: Read, Write, Free, Claim, and Ioctl. + * + * I/O operations: (XXX - provide detail for each of the operations) + * + * Read: + * Write: + * Free: + * Claim: + * Ioctl: + * + * Although the most common pipeline are used by the basic I/O operations + * above, there are some helper pipelines (one could consider them + * sub-pipelines) which are used internally by the ZIO module and are + * explained below: + * + * Interlock Pipeline: + * The interlock pipeline is the most basic pipeline and is used by all + * of the I/O operations. The interlock pipeline does not perform any I/O + * and is used to coordinate the dependencies between I/Os that are being + * issued (i.e. the parent/child relationship). + * + * Vdev child Pipeline: + * The vdev child pipeline is responsible for performing the physical I/O. + * It is in this pipeline where the I/O are queued and possibly cached. + * + * In addition to performing I/O, the pipeline is also responsible for + * data transformations. The transformations performed are based on the + * specific properties that user may have selected and modify the + * behavior of the pipeline. Examples of supported transformations are + * compression, dedup, and nop writes. Transformations will either modify + * the data or the pipeline. This list below further describes each of + * the supported transformations: + * + * Compression: + * ZFS supports three different flavors of compression -- gzip, lzjb, and + * zle. Compression occurs as part of the write pipeline and is performed + * in the ZIO_STAGE_WRITE_BP_INIT stage. + * + * Dedup: + * Dedup reads are handled by the ZIO_STAGE_DDT_READ_START and + * ZIO_STAGE_DDT_READ_DONE stages. These stages are added to an existing + * read pipeline if the dedup bit is set on the block pointer. + * Writing a dedup block is performed by the ZIO_STAGE_DDT_WRITE stage + * and added to a write pipeline if a user has enabled dedup on that + * particular dataset. + * + * NOP Write: + * The NOP write feature is performed by the ZIO_STAGE_NOP_WRITE stage + * and is added to an existing write pipeline if a crypographically + * secure checksum (i.e. SHA256) is enabled and compression is turned on. + * The NOP write stage will compare the checksums of the current data + * on-disk (level-0 blocks only) and the data that is currently being written. + * If the checksum values are identical then the pipeline is converted to + * an interlock pipeline skipping block allocation and bypassing the + * physical I/O. The nop write feature can handle writes in either + * syncing or open context (i.e. zil writes) and as a result is mutually + * exclusive with dedup. + */ + +/* * zio pipeline stage definitions */ enum zio_stage { @@ -50,27 +114,29 @@ enum zio_stage { ZIO_STAGE_CHECKSUM_GENERATE = 1 << 5, /* -W--- */ - ZIO_STAGE_DDT_READ_START = 1 << 6, /* R---- */ - ZIO_STAGE_DDT_READ_DONE = 1 << 7, /* R---- */ - ZIO_STAGE_DDT_WRITE = 1 << 8, /* -W--- */ - ZIO_STAGE_DDT_FREE = 1 << 9, /* --F-- */ + ZIO_STAGE_NOP_WRITE = 1 << 6, /* -W--- */ + + ZIO_STAGE_DDT_READ_START = 1 << 7, /* R---- */ + ZIO_STAGE_DDT_READ_DONE = 1 << 8, /* R---- */ + ZIO_STAGE_DDT_WRITE = 1 << 9, /* -W--- */ + ZIO_STAGE_DDT_FREE = 1 << 10, /* --F-- */ - ZIO_STAGE_GANG_ASSEMBLE = 1 << 10, /* RWFC- */ - ZIO_STAGE_GANG_ISSUE = 1 << 11, /* RWFC- */ + ZIO_STAGE_GANG_ASSEMBLE = 1 << 11, /* RWFC- */ + ZIO_STAGE_GANG_ISSUE = 1 << 12, /* RWFC- */ - ZIO_STAGE_DVA_ALLOCATE = 1 << 12, /* -W--- */ - ZIO_STAGE_DVA_FREE = 1 << 13, /* --F-- */ - ZIO_STAGE_DVA_CLAIM = 1 << 14, /* ---C- */ + ZIO_STAGE_DVA_ALLOCATE = 1 << 13, /* -W--- */ + ZIO_STAGE_DVA_FREE = 1 << 14, /* --F-- */ + ZIO_STAGE_DVA_CLAIM = 1 << 15, /* ---C- */ - ZIO_STAGE_READY = 1 << 15, /* RWFCI */ + ZIO_STAGE_READY = 1 << 16, /* RWFCI */ - ZIO_STAGE_VDEV_IO_START = 1 << 16, /* RWF-I */ - ZIO_STAGE_VDEV_IO_DONE = 1 << 17, /* RWF-- */ - ZIO_STAGE_VDEV_IO_ASSESS = 1 << 18, /* RWF-I */ + ZIO_STAGE_VDEV_IO_START = 1 << 17, /* RWF-I */ + ZIO_STAGE_VDEV_IO_DONE = 1 << 18, /* RWF-- */ + ZIO_STAGE_VDEV_IO_ASSESS = 1 << 19, /* RWF-I */ - ZIO_STAGE_CHECKSUM_VERIFY = 1 << 19, /* R---- */ + ZIO_STAGE_CHECKSUM_VERIFY = 1 << 20, /* R---- */ - ZIO_STAGE_DONE = 1 << 20 /* RWFCI */ + ZIO_STAGE_DONE = 1 << 21 /* RWFCI */ }; #define ZIO_INTERLOCK_STAGES \ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 25 16:32:07 2012 (r243524) @@ -1203,6 +1203,12 @@ zfs_get_data(void *arg, lr_write_t *lr, DMU_READ_NO_PREFETCH); if (error == 0) { + blkptr_t *obp = dmu_buf_get_blkptr(db); + if (obp) { + ASSERT(BP_IS_HOLE(bp)); + *bp = *obp; + } + zgd->zgd_db = db; zgd->zgd_bp = bp; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sun Nov 25 16:32:07 2012 (r243524) @@ -709,9 +709,7 @@ zio_write(zio_t *pio, spa_t *spa, uint64 DMU_OT_IS_VALID(zp->zp_type) && zp->zp_level < 32 && zp->zp_copies > 0 && - zp->zp_copies <= spa_max_replication(spa) && - zp->zp_dedup <= 1 && - zp->zp_dedup_verify <= 1); + zp->zp_copies <= spa_max_replication(spa)); zio = zio_create(pio, spa, txg, bp, data, size, done, private, ZIO_TYPE_WRITE, priority, flags, NULL, 0, zb, @@ -739,13 +737,20 @@ zio_rewrite(zio_t *pio, spa_t *spa, uint } void -zio_write_override(zio_t *zio, blkptr_t *bp, int copies) +zio_write_override(zio_t *zio, blkptr_t *bp, int copies, boolean_t nopwrite) { ASSERT(zio->io_type == ZIO_TYPE_WRITE); ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); ASSERT(zio->io_stage == ZIO_STAGE_OPEN); ASSERT(zio->io_txg == spa_syncing_txg(zio->io_spa)); + /* + * We must reset the io_prop to match the values that existed + * when the bp was first written by dmu_sync() keeping in mind + * that nopwrite and dedup are mutually exclusive. + */ + zio->io_prop.zp_dedup = nopwrite ? B_FALSE : zio->io_prop.zp_dedup; + zio->io_prop.zp_nopwrite = nopwrite; zio->io_prop.zp_copies = copies; zio->io_bp_override = bp; } @@ -1045,6 +1050,19 @@ zio_write_bp_init(zio_t *zio) *bp = *zio->io_bp_override; zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; + /* + * If we've been overridden and nopwrite is set then + * set the flag accordingly to indicate that a nopwrite + * has already occurred. + */ + if (!BP_IS_HOLE(bp) && zp->zp_nopwrite) { + ASSERT(!zp->zp_dedup); + zio->io_flags |= ZIO_FLAG_NOPWRITE; + return (ZIO_PIPELINE_CONTINUE); + } + + ASSERT(!zp->zp_nopwrite); + if (BP_IS_HOLE(bp) || !zp->zp_dedup) return (ZIO_PIPELINE_CONTINUE); @@ -1132,6 +1150,11 @@ zio_write_bp_init(zio_t *zio) ASSERT(!(zio->io_flags & ZIO_FLAG_IO_REWRITE)); zio->io_pipeline = ZIO_DDT_WRITE_PIPELINE; } + if (zp->zp_nopwrite) { + ASSERT(zio->io_child_type == ZIO_CHILD_LOGICAL); + ASSERT(!(zio->io_flags & ZIO_FLAG_IO_REWRITE)); + zio->io_pipeline |= ZIO_STAGE_NOP_WRITE; + } } return (ZIO_PIPELINE_CONTINUE); @@ -1353,6 +1376,7 @@ zio_reexecute(zio_t *pio) pio->io_stage = pio->io_orig_stage; pio->io_pipeline = pio->io_orig_pipeline; pio->io_reexecute = 0; + pio->io_flags |= ZIO_FLAG_REEXECUTED; pio->io_error = 0; for (int w = 0; w < ZIO_WAIT_TYPES; w++) pio->io_state[w] = 0; @@ -1829,8 +1853,9 @@ zio_write_gang_block(zio_t *pio) zp.zp_type = DMU_OT_NONE; zp.zp_level = 0; zp.zp_copies = gio->io_prop.zp_copies; - zp.zp_dedup = 0; - zp.zp_dedup_verify = 0; + zp.zp_dedup = B_FALSE; + zp.zp_dedup_verify = B_FALSE; + zp.zp_nopwrite = B_FALSE; zio_nowait(zio_write(zio, spa, txg, &gbh->zg_blkptr[g], (char *)pio->io_data + (pio->io_size - resid), lsize, &zp, @@ -1850,6 +1875,62 @@ zio_write_gang_block(zio_t *pio) } /* + * The zio_nop_write stage in the pipeline determines if allocating + * a new bp is necessary. By leveraging a cryptographically secure checksum, + * such as SHA256, we can compare the checksums of the new data and the old + * to determine if allocating a new block is required. The nopwrite + * feature can handle writes in either syncing or open context (i.e. zil + * writes) and as a result is mutually exclusive with dedup. + */ +static int +zio_nop_write(zio_t *zio) +{ + blkptr_t *bp = zio->io_bp; + blkptr_t *bp_orig = &zio->io_bp_orig; + zio_prop_t *zp = &zio->io_prop; + + ASSERT(BP_GET_LEVEL(bp) == 0); + ASSERT(!(zio->io_flags & ZIO_FLAG_IO_REWRITE)); + ASSERT(zp->zp_nopwrite); + ASSERT(!zp->zp_dedup); + ASSERT(zio->io_bp_override == NULL); + ASSERT(IO_IS_ALLOCATING(zio)); + + /* + * Check to see if the original bp and the new bp have matching + * characteristics (i.e. same checksum, compression algorithms, etc). + * If they don't then just continue with the pipeline which will + * allocate a new bp. + */ + if (BP_IS_HOLE(bp_orig) || + !zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_dedup || + BP_GET_CHECKSUM(bp) != BP_GET_CHECKSUM(bp_orig) || + BP_GET_COMPRESS(bp) != BP_GET_COMPRESS(bp_orig) || + BP_GET_DEDUP(bp) != BP_GET_DEDUP(bp_orig) || + zp->zp_copies != BP_GET_NDVAS(bp_orig)) + return (ZIO_PIPELINE_CONTINUE); + + /* + * If the checksums match then reset the pipeline so that we + * avoid allocating a new bp and issuing any I/O. + */ + if (ZIO_CHECKSUM_EQUAL(bp->blk_cksum, bp_orig->blk_cksum)) { + ASSERT(zio_checksum_table[zp->zp_checksum].ci_dedup); + ASSERT3U(BP_GET_PSIZE(bp), ==, BP_GET_PSIZE(bp_orig)); + ASSERT3U(BP_GET_LSIZE(bp), ==, BP_GET_LSIZE(bp_orig)); + ASSERT(zp->zp_compress != ZIO_COMPRESS_OFF); + ASSERT(bcmp(&bp->blk_prop, &bp_orig->blk_prop, + sizeof (uint64_t)) == 0); + + *bp = *bp_orig; + zio->io_pipeline = ZIO_INTERLOCK_PIPELINE; + zio->io_flags |= ZIO_FLAG_NOPWRITE; + } + + return (ZIO_PIPELINE_CONTINUE); +} + +/* * ========================================================================== * Dedup * ========================================================================== @@ -2121,7 +2202,7 @@ zio_ddt_write(zio_t *zio) zio->io_stage = ZIO_STAGE_OPEN; BP_ZERO(bp); } else { - zp->zp_dedup = 0; + zp->zp_dedup = B_FALSE; } zio->io_pipeline = ZIO_WRITE_PIPELINE; ddt_exit(ddt); @@ -2778,7 +2859,8 @@ zio_ready(zio_t *zio) if (zio->io_ready) { ASSERT(IO_IS_ALLOCATING(zio)); - ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp)); + ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp) || + (zio->io_flags & ZIO_FLAG_NOPWRITE)); ASSERT(zio->io_children[ZIO_CHILD_GANG][ZIO_WAIT_READY] == 0); zio->io_ready(zio); @@ -2860,6 +2942,8 @@ zio_done(zio_t *zio) ASSERT(BP_COUNT_GANG(bp) == 0 || (BP_COUNT_GANG(bp) == BP_GET_NDVAS(bp))); } + if (zio->io_flags & ZIO_FLAG_NOPWRITE) + VERIFY(BP_EQUAL(bp, &zio->io_bp_orig)); } /* @@ -2969,7 +3053,7 @@ zio_done(zio_t *zio) if ((zio->io_error || zio->io_reexecute) && IO_IS_ALLOCATING(zio) && zio->io_gang_leader == zio && - !(zio->io_flags & ZIO_FLAG_IO_REWRITE)) + !(zio->io_flags & (ZIO_FLAG_IO_REWRITE | ZIO_FLAG_NOPWRITE))) zio_dva_unallocate(zio, zio->io_gang_tree, bp); zio_gang_tree_free(&zio->io_gang_tree); @@ -3113,6 +3197,7 @@ static zio_pipe_stage_t *zio_pipeline[] zio_issue_async, zio_write_bp_init, zio_checksum_generate, + zio_nop_write, zio_ddt_read_start, zio_ddt_read_done, zio_ddt_write, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Nov 25 16:19:12 2012 (r243523) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Nov 25 16:32:07 2012 (r243524) @@ -78,6 +78,7 @@ #include #include #include +#include #include #include "zfs_namecheck.h" @@ -1051,6 +1052,12 @@ zvol_get_data(void *arg, lr_write_t *lr, error = dmu_buf_hold(os, object, offset, zgd, &db, DMU_READ_NO_PREFETCH); if (error == 0) { + blkptr_t *obp = dmu_buf_get_blkptr(db); + if (obp) { + ASSERT(BP_IS_HOLE(bp)); + *bp = *obp; + } + zgd->zgd_db = db; zgd->zgd_bp = bp; From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 16:38:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E47EA28A; Sun, 25 Nov 2012 16:38:20 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id A015C8FC12; Sun, 25 Nov 2012 16:38:20 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 8F6F7CB0; Sun, 25 Nov 2012 17:36:30 +0100 (CET) Date: Sun, 25 Nov 2012 17:39:24 +0100 From: Pawel Jakub Dawidek To: Martin Matuska Subject: Re: svn commit: r243524 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys Message-ID: <20121125163924.GM1460@garage.freebsd.pl> References: <201211251632.qAPGW8wd091581@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="q8dntDJTu318bll0" Content-Disposition: inline In-Reply-To: <201211251632.qAPGW8wd091581@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 16:38:21 -0000 --q8dntDJTu318bll0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 25, 2012 at 04:32:08PM +0000, Martin Matuska wrote: > Author: mm > Date: Sun Nov 25 16:32:07 2012 > New Revision: 243524 > URL: http://svnweb.freebsd.org/changeset/base/243524 >=20 > Log: > MFV r243013 and r243267: > =20 > Import the zio nop-write improvement from Illumos. To reduce I/O, > nop-write omits overwriting data if the checksum (cryptographically > secure) of new data matches the checksum of existing data. > It also saves space if snapshots are in use. > =20 > It currently works only on datasets with enabled compression, disabled > deduplication and sha256 checksums. > =20 > IllumOS 13887:196932ec9e6a and 13888:7204b3392a58 > 3236 zio nop-write This is a nice change, although I don't understand why it depends on compression being turned on. It won't save any space. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --q8dntDJTu318bll0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCySbwACgkQForvXbEpPzTDXACg5iK922TMvB73fZJlZRjU1rOD tewAmgPjLCQacxqbnHko4RdbbSpVVDsH =9MAh -----END PGP SIGNATURE----- --q8dntDJTu318bll0-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 16:54:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C15F265C; Sun, 25 Nov 2012 16:54:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A3FDE8FC0C; Sun, 25 Nov 2012 16:54:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPGsh6e094408; Sun, 25 Nov 2012 16:54:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPGshis094407; Sun, 25 Nov 2012 16:54:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211251654.qAPGshis094407@svn.freebsd.org> From: Martin Matuska Date: Sun, 25 Nov 2012 16:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243525 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 16:54:43 -0000 Author: mm Date: Sun Nov 25 16:54:43 2012 New Revision: 243525 URL: http://svnweb.freebsd.org/changeset/base/243525 Log: Add loader(8) tunable to enable/disable nopwrite functionality: vfs.zfs.nopwrite_enabled MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sun Nov 25 16:32:07 2012 (r243524) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sun Nov 25 16:54:43 2012 (r243525) @@ -50,6 +50,10 @@ * Enable/disable nopwrite feature. */ int zfs_nopwrite_enabled = 1; +SYSCTL_DECL(_vfs_zfs); +TUNABLE_INT("vfs.zfs.nopwrite_enabled", &zfs_nopwrite_enabled); +SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFLAG_RDTUN, + &zfs_nopwrite_enabled, 0, "Enable nopwrite feature"); const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = { { DMU_BSWAP_UINT8, TRUE, "unallocated" }, @@ -1562,7 +1566,6 @@ dmu_object_set_compress(objset_t *os, ui int zfs_mdcomp_disable = 0; TUNABLE_INT("vfs.zfs.mdcomp_disable", &zfs_mdcomp_disable); -SYSCTL_DECL(_vfs_zfs); SYSCTL_INT(_vfs_zfs, OID_AUTO, mdcomp_disable, CTLFLAG_RW, &zfs_mdcomp_disable, 0, "Disable metadata compression"); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 18:22:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55208D69; Sun, 25 Nov 2012 18:22:54 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3ABCD8FC0C; Sun, 25 Nov 2012 18:22:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPIMs6U006903; Sun, 25 Nov 2012 18:22:54 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPIMsiJ006902; Sun, 25 Nov 2012 18:22:54 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201211251822.qAPIMsiJ006902@svn.freebsd.org> From: Tim Kientzle Date: Sun, 25 Nov 2012 18:22:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243526 - head/sys/boot/uboot/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 18:22:54 -0000 Author: kientzle Date: Sun Nov 25 18:22:53 2012 New Revision: 243526 URL: http://svnweb.freebsd.org/changeset/base/243526 Log: Print kernel args when booting the kernel. Modified: head/sys/boot/uboot/lib/elf_freebsd.c Modified: head/sys/boot/uboot/lib/elf_freebsd.c ============================================================================== --- head/sys/boot/uboot/lib/elf_freebsd.c Sun Nov 25 16:54:43 2012 (r243525) +++ head/sys/boot/uboot/lib/elf_freebsd.c Sun Nov 25 18:22:53 2012 (r243526) @@ -82,6 +82,7 @@ __elfN(uboot_exec)(struct preloaded_file entry = uboot_vm_translate(e->e_entry); printf("Kernel entry at 0x%x...\n", (unsigned)entry); + printf("Kernel args: %s\n", fp->f_args); dev_cleanup(); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 19:28:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F39AAA52; Sun, 25 Nov 2012 19:28:58 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id B1DB88FC08; Sun, 25 Nov 2012 19:28:57 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 16B74CEE; Sun, 25 Nov 2012 20:27:09 +0100 (CET) Date: Sun, 25 Nov 2012 20:30:08 +0100 From: Pawel Jakub Dawidek To: Konstantin Belousov Subject: Re: svn commit: r243142 - in head/sys: fs/nfsclient kern sys Message-ID: <20121125193008.GN1460@garage.freebsd.pl> References: <201211160825.qAG8P6v6047507@svn.freebsd.org> <20121124222408.GH1460@garage.freebsd.pl> <20121125162152.GA3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="i6vqABX3nJKXLk01" Content-Disposition: inline In-Reply-To: <20121125162152.GA3013@kib.kiev.ua> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 19:28:59 -0000 --i6vqABX3nJKXLk01 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 25, 2012 at 06:21:52PM +0200, Konstantin Belousov wrote: > On Sat, Nov 24, 2012 at 11:24:08PM +0100, Pawel Jakub Dawidek wrote: > > I think we should move zpfind_locked() under 'pid <=3D PID_MAX': > >=20 > > sx_slock(&allproc_lock); > > if (pid <=3D PID_MAX) { > > p =3D pfind_locked(pid); > > if (p =3D=3D NULL && (flags & PGET_NOTWEXIT) =3D=3D 0) > > p =3D zpfind_locked(pid); > > } else if ((flags & PGET_NOTID) =3D=3D 0) { > > p =3D pfind_tid_locked(pid); > > } else { > > p =3D NULL; > > } > > sx_sunlock(&allproc_lock); > > if (p =3D=3D NULL) > > return (ESRCH); > >=20 >=20 > Yes, I agree. Please remove {} for one-line blocks. If I need braces in one place, I put them into all the places so that all the elses are aligned. style(9) does allow that. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --i6vqABX3nJKXLk01 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCyccAACgkQForvXbEpPzT3VgCggvcjjInHNPsmtHKUO+FJxA5m LdkAoMzIIgZvEQpRuD/JIs4wW/jBweUr =h3x4 -----END PGP SIGNATURE----- --i6vqABX3nJKXLk01-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 19:31:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9C0EDD2; Sun, 25 Nov 2012 19:31:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CD8148FC08; Sun, 25 Nov 2012 19:31:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPJVgaA015467; Sun, 25 Nov 2012 19:31:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPJVgSA015466; Sun, 25 Nov 2012 19:31:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211251931.qAPJVgSA015466@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 25 Nov 2012 19:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243528 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 19:31:43 -0000 Author: pjd Date: Sun Nov 25 19:31:42 2012 New Revision: 243528 URL: http://svnweb.freebsd.org/changeset/base/243528 Log: Look for zombie process only if we were given process id. Reviewed by: kib MFC after: 2 weeks X-MFC-after-or-with: 243142 Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Nov 25 19:10:53 2012 (r243527) +++ head/sys/kern/kern_proc.c Sun Nov 25 19:31:42 2012 (r243528) @@ -375,14 +375,15 @@ pget(pid_t pid, int flags, struct proc * int error; sx_slock(&allproc_lock); - if (pid <= PID_MAX) + if (pid <= PID_MAX) { p = pfind_locked(pid); - else if ((flags & PGET_NOTID) == 0) + if (p == NULL && (flags & PGET_NOTWEXIT) == 0) + p = zpfind_locked(pid); + } else if ((flags & PGET_NOTID) == 0) { p = pfind_tid_locked(pid); - else + } else { p = NULL; - if (p == NULL && (flags & PGET_NOTWEXIT) == 0) - p = zpfind_locked(pid); + } sx_sunlock(&allproc_lock); if (p == NULL) return (ESRCH); From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 19:42:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBDC9152; Sun, 25 Nov 2012 19:42:36 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 818018FC08; Sun, 25 Nov 2012 19:42:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPJgaiC016685; Sun, 25 Nov 2012 19:42:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPJgaC7016684; Sun, 25 Nov 2012 19:42:36 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201211251942.qAPJgaC7016684@svn.freebsd.org> From: Alan Cox Date: Sun, 25 Nov 2012 19:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243529 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 19:42:37 -0000 Author: alc Date: Sun Nov 25 19:42:36 2012 New Revision: 243529 URL: http://svnweb.freebsd.org/changeset/base/243529 Log: Make a few small changes to vm_map_pmap_enter(): Add detail to the comment describing this function. In particular, describe what MAP_PREFAULT_PARTIAL does. Eliminate the abrupt change in behavior when the specified address range grows from MAX_INIT_PT pages to MAX_INIT_PT plus one pages. Instead of doing nothing, i.e., preloading no mappings whatsoever, map any resident pages that fall within the start of the specified address range, i.e., [addr, addr + ulmin(size, ptoa(MAX_INIT_PT))). Long ago, the vm object's list of resident pages was not ordered, so this function had to choose between probing the global hash table of all resident pages and iterating over the vm object's unordered list of resident pages. Now, the list is ordered, so there is no reason for MAP_PREFAULT_PARTIAL to be concerned with the vm object's count of resident changes. MFC after: 14 days Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Nov 25 19:31:42 2012 (r243528) +++ head/sys/vm/vm_map.c Sun Nov 25 19:42:36 2012 (r243529) @@ -1793,10 +1793,14 @@ vm_map_submap( /* * vm_map_pmap_enter: * - * Preload read-only mappings for the given object's resident pages into - * the given map. This eliminates the soft faults on process startup and - * immediately after an mmap(2). Because these are speculative mappings, - * cached pages are not reactivated and mapped. + * Preload read-only mappings for the specified object's resident pages + * into the target map. If "flags" is MAP_PREFAULT_PARTIAL, then only + * the resident pages within the address range [addr, addr + ulmin(size, + * ptoa(MAX_INIT_PT))) are mapped. Otherwise, all resident pages within + * the specified address range are mapped. This eliminates many soft + * faults on process startup and immediately after an mmap(2). Because + * these are speculative mappings, cached pages are not reactivated and + * mapped. */ void vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot, @@ -1815,11 +1819,8 @@ vm_map_pmap_enter(vm_map_t map, vm_offse } psize = atop(size); - - if ((flags & MAP_PREFAULT_PARTIAL) && psize > MAX_INIT_PT && - object->resident_page_count > MAX_INIT_PT) - goto unlock_return; - + if (psize > MAX_INIT_PT && (flags & MAP_PREFAULT_PARTIAL) != 0) + psize = MAX_INIT_PT; if (psize + pindex > object->size) { if (object->size < pindex) goto unlock_return; From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 20:06:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3163B77D; Sun, 25 Nov 2012 20:06:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 162018FC16; Sun, 25 Nov 2012 20:06:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPK626w019725; Sun, 25 Nov 2012 20:06:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPK62QZ019724; Sun, 25 Nov 2012 20:06:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201211252006.qAPK62QZ019724@svn.freebsd.org> From: Alexander Motin Date: Sun, 25 Nov 2012 20:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243530 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 20:06:02 -0000 Author: mav Date: Sun Nov 25 20:06:01 2012 New Revision: 243530 URL: http://svnweb.freebsd.org/changeset/base/243530 Log: On multiple requests, compact HDA driver verbose output by hiding CODEC's detailed information under the sound debug. To make it easier accessible, export that information through the set of sysctls like dev.hdaa.X.nidY. Also tune some output to make it both more compact and informative. Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Sun Nov 25 19:42:36 2012 (r243529) +++ head/sys/dev/sound/pci/hda/hdaa.c Sun Nov 25 20:06:01 2012 (r243530) @@ -978,6 +978,253 @@ hdaa_local_patch_pin(struct hdaa_widget w->wclass.pin.newconf = w->wclass.pin.config = config; } +static void +hdaa_dump_audio_formats_sb(struct sbuf *sb, uint32_t fcap, uint32_t pcmcap) +{ + uint32_t cap; + + cap = fcap; + if (cap != 0) { + sbuf_printf(sb, " Stream cap: 0x%08x", cap); + if (HDA_PARAM_SUPP_STREAM_FORMATS_AC3(cap)) + sbuf_printf(sb, " AC3"); + if (HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(cap)) + sbuf_printf(sb, " FLOAT32"); + if (HDA_PARAM_SUPP_STREAM_FORMATS_PCM(cap)) + sbuf_printf(sb, " PCM"); + sbuf_printf(sb, "\n"); + } + cap = pcmcap; + if (cap != 0) { + sbuf_printf(sb, " PCM cap: 0x%08x", cap); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(cap)) + sbuf_printf(sb, " 8"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(cap)) + sbuf_printf(sb, " 16"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(cap)) + sbuf_printf(sb, " 20"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(cap)) + sbuf_printf(sb, " 24"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(cap)) + sbuf_printf(sb, " 32"); + sbuf_printf(sb, " bits,"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ(cap)) + sbuf_printf(sb, " 8"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ(cap)) + sbuf_printf(sb, " 11"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ(cap)) + sbuf_printf(sb, " 16"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ(cap)) + sbuf_printf(sb, " 22"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ(cap)) + sbuf_printf(sb, " 32"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ(cap)) + sbuf_printf(sb, " 44"); + sbuf_printf(sb, " 48"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ(cap)) + sbuf_printf(sb, " 88"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ(cap)) + sbuf_printf(sb, " 96"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ(cap)) + sbuf_printf(sb, " 176"); + if (HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ(cap)) + sbuf_printf(sb, " 192"); + sbuf_printf(sb, " KHz\n"); + } +} + +static void +hdaa_dump_pin_sb(struct sbuf *sb, struct hdaa_widget *w) +{ + uint32_t pincap, conf; + + pincap = w->wclass.pin.cap; + + sbuf_printf(sb, " Pin cap: 0x%08x", pincap); + if (HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(pincap)) + sbuf_printf(sb, " ISC"); + if (HDA_PARAM_PIN_CAP_TRIGGER_REQD(pincap)) + sbuf_printf(sb, " TRQD"); + if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(pincap)) + sbuf_printf(sb, " PDC"); + if (HDA_PARAM_PIN_CAP_HEADPHONE_CAP(pincap)) + sbuf_printf(sb, " HP"); + if (HDA_PARAM_PIN_CAP_OUTPUT_CAP(pincap)) + sbuf_printf(sb, " OUT"); + if (HDA_PARAM_PIN_CAP_INPUT_CAP(pincap)) + sbuf_printf(sb, " IN"); + if (HDA_PARAM_PIN_CAP_BALANCED_IO_PINS(pincap)) + sbuf_printf(sb, " BAL"); + if (HDA_PARAM_PIN_CAP_HDMI(pincap)) + sbuf_printf(sb, " HDMI"); + if (HDA_PARAM_PIN_CAP_VREF_CTRL(pincap)) { + sbuf_printf(sb, " VREF["); + if (HDA_PARAM_PIN_CAP_VREF_CTRL_50(pincap)) + sbuf_printf(sb, " 50"); + if (HDA_PARAM_PIN_CAP_VREF_CTRL_80(pincap)) + sbuf_printf(sb, " 80"); + if (HDA_PARAM_PIN_CAP_VREF_CTRL_100(pincap)) + sbuf_printf(sb, " 100"); + if (HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND(pincap)) + sbuf_printf(sb, " GROUND"); + if (HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ(pincap)) + sbuf_printf(sb, " HIZ"); + sbuf_printf(sb, " ]"); + } + if (HDA_PARAM_PIN_CAP_EAPD_CAP(pincap)) + sbuf_printf(sb, " EAPD"); + if (HDA_PARAM_PIN_CAP_DP(pincap)) + sbuf_printf(sb, " DP"); + if (HDA_PARAM_PIN_CAP_HBR(pincap)) + sbuf_printf(sb, " HBR"); + sbuf_printf(sb, "\n"); + conf = w->wclass.pin.config; + sbuf_printf(sb, " Pin config: 0x%08x", conf); + sbuf_printf(sb, " as=%d seq=%d " + "device=%s conn=%s ctype=%s loc=%s color=%s misc=%d\n", + HDA_CONFIG_DEFAULTCONF_ASSOCIATION(conf), + HDA_CONFIG_DEFAULTCONF_SEQUENCE(conf), + HDA_DEVS[HDA_CONFIG_DEFAULTCONF_DEVICE(conf)], + HDA_CONNS[HDA_CONFIG_DEFAULTCONF_CONNECTIVITY(conf)], + HDA_CONNECTORS[HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE(conf)], + HDA_LOCS[HDA_CONFIG_DEFAULTCONF_LOCATION(conf)], + HDA_COLORS[HDA_CONFIG_DEFAULTCONF_COLOR(conf)], + HDA_CONFIG_DEFAULTCONF_MISC(conf)); + sbuf_printf(sb, " Pin control: 0x%08x", w->wclass.pin.ctrl); + if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE) + sbuf_printf(sb, " HP"); + if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE) + sbuf_printf(sb, " IN"); + if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE) + sbuf_printf(sb, " OUT"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { + if ((w->wclass.pin.ctrl & + HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) == 0x03) + sbuf_printf(sb, " HBR"); + else if ((w->wclass.pin.ctrl & + HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) != 0) + sbuf_printf(sb, " EPTs"); + } else { + if ((w->wclass.pin.ctrl & + HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) != 0) + sbuf_printf(sb, " VREFs"); + } + sbuf_printf(sb, "\n"); +} + +static void +hdaa_dump_amp_sb(struct sbuf *sb, uint32_t cap, char *banner) +{ + int offset, size, step; + + offset = HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap); + size = HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap); + step = HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap); + sbuf_printf(sb, " %s amp: 0x%08x " + "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n", + banner, cap, + HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(cap), + step, size, offset, + ((0 - offset) * (size + 1)) / 4, + ((step - offset) * (size + 1)) / 4); +} + + +static int +hdaa_sysctl_caps(SYSCTL_HANDLER_ARGS) +{ + struct hdaa_devinfo *devinfo; + struct hdaa_widget *w, *cw; + struct sbuf sb; + char buf[64]; + int error, j; + + w = (struct hdaa_widget *)oidp->oid_arg1; + devinfo = w->devinfo; + sbuf_new_for_sysctl(&sb, NULL, 256, req); + + sbuf_printf(&sb, "%s%s\n", w->name, + (w->enable == 0) ? " [DISABLED]" : ""); + sbuf_printf(&sb, " Widget cap: 0x%08x", + w->param.widget_cap); + if (w->param.widget_cap & 0x0ee1) { + if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap)) + sbuf_printf(&sb, " LRSWAP"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap)) + sbuf_printf(&sb, " PWR"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) + sbuf_printf(&sb, " DIGITAL"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) + sbuf_printf(&sb, " UNSOL"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(w->param.widget_cap)) + sbuf_printf(&sb, " PROC"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) + sbuf_printf(&sb, " STRIPE(x%d)", + 1 << (fls(w->wclass.conv.stripecap) - 1)); + j = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap); + if (j == 1) + sbuf_printf(&sb, " STEREO"); + else if (j > 1) + sbuf_printf(&sb, " %dCH", j + 1); + } + sbuf_printf(&sb, "\n"); + if (w->bindas != -1) { + sbuf_printf(&sb, " Association: %d (0x%04x)\n", + w->bindas, w->bindseqmask); + } + if (w->ossmask != 0 || w->ossdev >= 0) { + sbuf_printf(&sb, " OSS: %s", + hdaa_audio_ctl_ossmixer_mask2allname(w->ossmask, buf, sizeof(buf))); + if (w->ossdev >= 0) + sbuf_printf(&sb, " (%s)", ossnames[w->ossdev]); + sbuf_printf(&sb, "\n"); + } + if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || + w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { + hdaa_dump_audio_formats_sb(&sb, + w->param.supp_stream_formats, + w->param.supp_pcm_size_rate); + } else if (w->type == + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || w->waspin) + hdaa_dump_pin_sb(&sb, w); + if (w->param.eapdbtl != HDA_INVALID) { + sbuf_printf(&sb, " EAPD: 0x%08x%s%s%s\n", + w->param.eapdbtl, + (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP) ? + " LRSWAP" : "", + (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD) ? + " EAPD" : "", + (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_BTL) ? + " BTL" : ""); + } + if (HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(w->param.widget_cap) && + w->param.outamp_cap != 0) + hdaa_dump_amp_sb(&sb, w->param.outamp_cap, "Output"); + if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) && + w->param.inamp_cap != 0) + hdaa_dump_amp_sb(&sb, w->param.inamp_cap, " Input"); + if (w->nconns > 0) + sbuf_printf(&sb, " Connections: %d\n", w->nconns); + for (j = 0; j < w->nconns; j++) { + cw = hdaa_widget_get(devinfo, w->conns[j]); + sbuf_printf(&sb, " + %s<- nid=%d [%s]", + (w->connsenable[j] == 0)?"[DISABLED] ":"", + w->conns[j], (cw == NULL) ? "GHOST!" : cw->name); + if (cw == NULL) + sbuf_printf(&sb, " [UNKNOWN]"); + else if (cw->enable == 0) + sbuf_printf(&sb, " [DISABLED]"); + if (w->nconns > 1 && w->selconn == j && w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) + sbuf_printf(&sb, " (selected)"); + sbuf_printf(&sb, "\n"); + } + sbuf_trim(&sb); + error = sbuf_finish(&sb); + sbuf_delete(&sb); + return (error); +} + static int hdaa_sysctl_config(SYSCTL_HANDLER_ARGS) { @@ -1301,8 +1548,16 @@ hdaa_widget_parse(struct hdaa_widget *w) w->param.eapdbtl |= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD; } else w->param.eapdbtl = HDA_INVALID; + } + w->unsol = -1; - hdaa_unlock(w->devinfo); + hdaa_unlock(w->devinfo); + snprintf(buf, sizeof(buf), "nid%d", w->nid); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + w, sizeof(w), hdaa_sysctl_caps, "A", "Node capabilities"); + if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { snprintf(buf, sizeof(buf), "nid%d_config", w->nid); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, @@ -1315,9 +1570,8 @@ hdaa_widget_parse(struct hdaa_widget *w) buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, &w->wclass.pin.original, sizeof(&w->wclass.pin.original), hdaa_sysctl_config, "A", "Original pin configuration"); - hdaa_lock(w->devinfo); } - w->unsol = -1; + hdaa_lock(w->devinfo); } static void @@ -5327,7 +5581,6 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * continue; if (printed == 0) { - device_printf(pdevinfo->dev, "\n"); if (banner != NULL) { device_printf(pdevinfo->dev, "%s", banner); } else { @@ -5342,7 +5595,6 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * pdevinfo->maxamp[j] / 4); } else printf("\n"); - device_printf(pdevinfo->dev, " |\n"); printed = 1; } device_printf(pdevinfo->dev, " +- ctl %2d (nid %3d %s", i, @@ -5362,6 +5614,8 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * printf("%s\n", ctl->mute?"mute":""); } } + if (printed) + device_printf(pdevinfo->dev, "\n"); } static void @@ -5371,8 +5625,7 @@ hdaa_dump_audio_formats(device_t dev, ui cap = fcap; if (cap != 0) { - device_printf(dev, " Stream cap: 0x%08x\n", cap); - device_printf(dev, " "); + device_printf(dev, " Stream cap: 0x%08x", cap); if (HDA_PARAM_SUPP_STREAM_FORMATS_AC3(cap)) printf(" AC3"); if (HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(cap)) @@ -5383,8 +5636,7 @@ hdaa_dump_audio_formats(device_t dev, ui } cap = pcmcap; if (cap != 0) { - device_printf(dev, " PCM cap: 0x%08x\n", cap); - device_printf(dev, " "); + device_printf(dev, " PCM cap: 0x%08x", cap); if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(cap)) printf(" 8"); if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(cap)) @@ -5428,8 +5680,7 @@ hdaa_dump_pin(struct hdaa_widget *w) pincap = w->wclass.pin.cap; - device_printf(w->devinfo->dev, " Pin cap: 0x%08x\n", pincap); - device_printf(w->devinfo->dev, " "); + device_printf(w->devinfo->dev, " Pin cap: 0x%08x", pincap); if (HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(pincap)) printf(" ISC"); if (HDA_PARAM_PIN_CAP_TRIGGER_REQD(pincap)) @@ -5530,13 +5781,18 @@ hdaa_dump_pin_configs(struct hdaa_devinf static void hdaa_dump_amp(device_t dev, uint32_t cap, char *banner) { - device_printf(dev, " %s amp: 0x%08x\n", banner, cap); - device_printf(dev, " " - "mute=%d step=%d size=%d offset=%d\n", + int offset, size, step; + + offset = HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap); + size = HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap); + step = HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap); + device_printf(dev, " %s amp: 0x%08x " + "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n", + banner, cap, HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(cap), - HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap), - HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap), - HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap)); + step, size, offset, + ((0 - offset) * (size + 1)) / 4, + ((step - offset) * (size + 1)) / 4); } static void @@ -5547,15 +5803,12 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev int i, j; device_printf(devinfo->dev, "\n"); - device_printf(devinfo->dev, "Default Parameter\n"); - device_printf(devinfo->dev, "-----------------\n"); + device_printf(devinfo->dev, "Default parameters:\n"); hdaa_dump_audio_formats(devinfo->dev, devinfo->supp_stream_formats, devinfo->supp_pcm_size_rate); - device_printf(devinfo->dev, " IN amp: 0x%08x\n", - devinfo->inamp_cap); - device_printf(devinfo->dev, " OUT amp: 0x%08x\n", - devinfo->outamp_cap); + hdaa_dump_amp(devinfo->dev, devinfo->inamp_cap, " Input"); + hdaa_dump_amp(devinfo->dev, devinfo->outamp_cap, "Output"); for (i = devinfo->startnode; i < devinfo->endnode; i++) { w = hdaa_widget_get(devinfo, i); if (w == NULL) { @@ -5566,10 +5819,9 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev device_printf(devinfo->dev, " nid: %d%s\n", w->nid, (w->enable == 0) ? " [DISABLED]" : ""); device_printf(devinfo->dev, " Name: %s\n", w->name); - device_printf(devinfo->dev, " Widget cap: 0x%08x\n", + device_printf(devinfo->dev, " Widget cap: 0x%08x", w->param.widget_cap); if (w->param.widget_cap & 0x0ee1) { - device_printf(devinfo->dev, " "); if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap)) printf(" LRSWAP"); if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap)) @@ -5588,10 +5840,10 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev printf(" STEREO"); else if (j > 1) printf(" %dCH", j + 1); - printf("\n"); } + printf("\n"); if (w->bindas != -1) { - device_printf(devinfo->dev, " Association: %d (0x%08x)\n", + device_printf(devinfo->dev, " Association: %d (0x%04x)\n", w->bindas, w->bindseqmask); } if (w->ossmask != 0 || w->ossdev >= 0) { @@ -5618,10 +5870,8 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) && w->param.inamp_cap != 0) hdaa_dump_amp(devinfo->dev, w->param.inamp_cap, " Input"); - if (w->nconns > 0) { - device_printf(devinfo->dev, " connections: %d\n", w->nconns); - device_printf(devinfo->dev, " |\n"); - } + if (w->nconns > 0) + device_printf(devinfo->dev, " Connections: %d\n", w->nconns); for (j = 0; j < w->nconns; j++) { cw = hdaa_widget_get(devinfo, w->conns[j]); device_printf(devinfo->dev, " + %s<- nid=%d [%s]", @@ -5646,7 +5896,7 @@ hdaa_dump_dst_nid(struct hdaa_pcm_devinf struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w, *cw; char buf[64]; - int i, printed = 0; + int i; if (depth > HDA_PARSE_MAXDEPTH) return; @@ -5682,10 +5932,6 @@ hdaa_dump_dst_nid(struct hdaa_pcm_devinf cw = hdaa_widget_get(devinfo, w->conns[i]); if (cw == NULL || cw->enable == 0 || cw->bindas == -1) continue; - if (printed == 0) { - device_printf(pdevinfo->dev, "%*s |\n", 4 + (depth) * 7, ""); - printed = 1; - } hdaa_dump_dst_nid(pdevinfo, w->conns[i], depth + 1); } @@ -5697,11 +5943,26 @@ hdaa_dump_dac(struct hdaa_pcm_devinfo *p struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_audio_as *as; struct hdaa_widget *w; - int i, printed = 0; + nid_t *nids; + int chid, i; if (pdevinfo->playas < 0) return; + device_printf(pdevinfo->dev, "Playback:\n"); + + chid = devinfo->as[pdevinfo->playas].chans[0]; + hdaa_dump_audio_formats(pdevinfo->dev, + devinfo->chans[chid].supp_stream_formats, + devinfo->chans[chid].supp_pcm_size_rate); + for (i = 0; i < devinfo->as[pdevinfo->playas].num_chans; i++) { + chid = devinfo->as[pdevinfo->playas].chans[i]; + device_printf(pdevinfo->dev, " DAC:"); + for (nids = devinfo->chans[chid].io; *nids != -1; nids++) + printf(" %d", *nids); + printf("\n"); + } + as = &devinfo->as[pdevinfo->playas]; for (i = 0; i < 16; i++) { if (as->pins[i] <= 0) @@ -5709,14 +5970,10 @@ hdaa_dump_dac(struct hdaa_pcm_devinfo *p w = hdaa_widget_get(devinfo, as->pins[i]); if (w == NULL || w->enable == 0) continue; - if (printed == 0) { - printed = 1; - device_printf(pdevinfo->dev, "\n"); - device_printf(pdevinfo->dev, "Playback:\n"); - } device_printf(pdevinfo->dev, "\n"); hdaa_dump_dst_nid(pdevinfo, as->pins[i], 0); } + device_printf(pdevinfo->dev, "\n"); } static void @@ -5724,12 +5981,26 @@ hdaa_dump_adc(struct hdaa_pcm_devinfo *p { struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_widget *w; - int i; - int printed = 0; + nid_t *nids; + int chid, i; if (pdevinfo->recas < 0) return; + device_printf(pdevinfo->dev, "Record:\n"); + + chid = devinfo->as[pdevinfo->recas].chans[0]; + hdaa_dump_audio_formats(pdevinfo->dev, + devinfo->chans[chid].supp_stream_formats, + devinfo->chans[chid].supp_pcm_size_rate); + for (i = 0; i < devinfo->as[pdevinfo->recas].num_chans; i++) { + chid = devinfo->as[pdevinfo->recas].chans[i]; + device_printf(pdevinfo->dev, " ADC:"); + for (nids = devinfo->chans[chid].io; *nids != -1; nids++) + printf(" %d", *nids); + printf("\n"); + } + for (i = devinfo->startnode; i < devinfo->endnode; i++) { w = hdaa_widget_get(devinfo, i); if (w == NULL || w->enable == 0) @@ -5738,14 +6009,10 @@ hdaa_dump_adc(struct hdaa_pcm_devinfo *p continue; if (w->bindas != pdevinfo->recas) continue; - if (printed == 0) { - printed = 1; - device_printf(pdevinfo->dev, "\n"); - device_printf(pdevinfo->dev, "Record:\n"); - } device_printf(pdevinfo->dev, "\n"); hdaa_dump_dst_nid(pdevinfo, i, 0); } + device_printf(pdevinfo->dev, "\n"); } static void @@ -5766,53 +6033,13 @@ hdaa_dump_mix(struct hdaa_pcm_devinfo *p continue; if (printed == 0) { printed = 1; - device_printf(pdevinfo->dev, "\n"); device_printf(pdevinfo->dev, "Input Mix:\n"); } device_printf(pdevinfo->dev, "\n"); hdaa_dump_dst_nid(pdevinfo, i, 0); } -} - -static void -hdaa_dump_pcmchannels(struct hdaa_pcm_devinfo *pdevinfo) -{ - struct hdaa_devinfo *devinfo = pdevinfo->devinfo; - nid_t *nids; - int chid, i; - - if (pdevinfo->playas >= 0) { - device_printf(pdevinfo->dev, "\n"); - device_printf(pdevinfo->dev, "Playback:\n"); - device_printf(pdevinfo->dev, "\n"); - chid = devinfo->as[pdevinfo->playas].chans[0]; - hdaa_dump_audio_formats(pdevinfo->dev, - devinfo->chans[chid].supp_stream_formats, - devinfo->chans[chid].supp_pcm_size_rate); - for (i = 0; i < devinfo->as[pdevinfo->playas].num_chans; i++) { - chid = devinfo->as[pdevinfo->playas].chans[i]; - device_printf(pdevinfo->dev, " DAC:"); - for (nids = devinfo->chans[chid].io; *nids != -1; nids++) - printf(" %d", *nids); - printf("\n"); - } - } - if (pdevinfo->recas >= 0) { - device_printf(pdevinfo->dev, "\n"); - device_printf(pdevinfo->dev, "Record:\n"); + if (printed) device_printf(pdevinfo->dev, "\n"); - chid = devinfo->as[pdevinfo->recas].chans[0]; - hdaa_dump_audio_formats(pdevinfo->dev, - devinfo->chans[chid].supp_stream_formats, - devinfo->chans[chid].supp_pcm_size_rate); - for (i = 0; i < devinfo->as[pdevinfo->recas].num_chans; i++) { - chid = devinfo->as[pdevinfo->recas].chans[i]; - device_printf(pdevinfo->dev, " DAC:"); - for (nids = devinfo->chans[chid].io; *nids != -1; nids++) - printf(" %d", *nids); - printf("\n"); - } - } } static void @@ -5991,19 +6218,19 @@ hdaa_configure(device_t dev) } printf("\n"); } + ); + HDA_BOOTHVERBOSE( device_printf(dev, "\n"); - device_printf(dev, "+-------------------+\n"); - device_printf(dev, "| DUMPING HDA NODES |\n"); - device_printf(dev, "+-------------------+\n"); + device_printf(dev, "+-----------+\n"); + device_printf(dev, "| HDA NODES |\n"); + device_printf(dev, "+-----------+\n"); hdaa_dump_nodes(devinfo); - ); - HDA_BOOTHVERBOSE( device_printf(dev, "\n"); - device_printf(dev, "+------------------------+\n"); - device_printf(dev, "| DUMPING HDA AMPLIFIERS |\n"); - device_printf(dev, "+------------------------+\n"); + device_printf(dev, "+----------------+\n"); + device_printf(dev, "| HDA AMPLIFIERS |\n"); + device_printf(dev, "+----------------+\n"); device_printf(dev, "\n"); i = 0; while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) { @@ -6024,9 +6251,6 @@ hdaa_configure(device_t dev) (ctl->enable == 0) ? " [DISABLED]" : ((ctl->ossmask == 0) ? " [UNUSED]" : "")); } - ); - - HDA_BOOTVERBOSE( device_printf(dev, "\n"); ); } @@ -6790,21 +7014,9 @@ hdaa_pcm_attach(device_t dev) HDA_BUFSZ_MIN, HDA_BUFSZ_DEFAULT, HDA_BUFSZ_MAX); HDA_BOOTVERBOSE( - device_printf(dev, "+--------------------------------------+\n"); - device_printf(dev, "| DUMPING PCM Playback/Record Channels |\n"); - device_printf(dev, "+--------------------------------------+\n"); - hdaa_dump_pcmchannels(pdevinfo); - device_printf(dev, "\n"); - device_printf(dev, "+-------------------------------+\n"); - device_printf(dev, "| DUMPING Playback/Record Paths |\n"); - device_printf(dev, "+-------------------------------+\n"); hdaa_dump_dac(pdevinfo); hdaa_dump_adc(pdevinfo); hdaa_dump_mix(pdevinfo); - device_printf(dev, "\n"); - device_printf(dev, "+-------------------------+\n"); - device_printf(dev, "| DUMPING Volume Controls |\n"); - device_printf(dev, "+-------------------------+\n"); hdaa_dump_ctls(pdevinfo, "Master Volume", SOUND_MASK_VOLUME); hdaa_dump_ctls(pdevinfo, "PCM Volume", SOUND_MASK_PCM); hdaa_dump_ctls(pdevinfo, "CD Volume", SOUND_MASK_CD); @@ -6816,7 +7028,6 @@ hdaa_pcm_attach(device_t dev) hdaa_dump_ctls(pdevinfo, "Input Mix Level", SOUND_MASK_IMIX); hdaa_dump_ctls(pdevinfo, "Input Monitoring Level", SOUND_MASK_IGAIN); hdaa_dump_ctls(pdevinfo, NULL, 0); - device_printf(dev, "\n"); ); if (resource_int_value(device_get_name(dev), From owner-svn-src-head@FreeBSD.ORG Sun Nov 25 21:32:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1BBCD50; Sun, 25 Nov 2012 21:32:13 +0000 (UTC) (envelope-from bar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A76108FC16; Sun, 25 Nov 2012 21:32:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAPLWDdA031087; Sun, 25 Nov 2012 21:32:13 GMT (envelope-from bar@svn.freebsd.org) Received: (from bar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAPLWDEi031086; Sun, 25 Nov 2012 21:32:13 GMT (envelope-from bar@svn.freebsd.org) Message-Id: <201211252132.qAPLWDEi031086@svn.freebsd.org> From: Barbara Guida Date: Sun, 25 Nov 2012 21:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243531 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 21:32:13 -0000 Author: bar (ports committer) Date: Sun Nov 25 21:32:13 2012 New Revision: 243531 URL: http://svnweb.freebsd.org/changeset/base/243531 Log: Add my mentor relationships to committers-ports.dot Approved by: flo (mentor) Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sun Nov 25 20:06:01 2012 (r243530) +++ head/share/misc/committers-ports.dot Sun Nov 25 21:32:13 2012 (r243531) @@ -58,6 +58,7 @@ avilla [label="Alberto Villa\navilla@Fre avl [label="Alexander Logvinov\navl@FreeBSD.org\n2009/05/27"] az [label="Andrej Zverev\naz@FreeBSD.org\n2005/10/03"] bapt [label="Baptiste Daroussin\nbapt@FreeBSD.org\n2010/07/27"] +bar [label="Barbara Guida\nbar@FreeBSD.org\n2012/11/25"] bdrewery [label="Bryan Drewery\nbdrewery@FreeBSD.org\n2012/07/31"] beat [label="Beat Gaetzi\nbeat@FreeBSD.org\n2009/01/28"] beech [label="Beech Rintoul\nbeech@FreeBSD.org\n2007/05/30"] @@ -297,6 +298,7 @@ fjoe -> flo fjoe -> krion fjoe -> osa +flo -> bar flo -> jase flz -> garga @@ -437,6 +439,7 @@ philip -> koitsu rafan -> chinsan +rene -> bar rene -> crees rene -> jgh rene -> olivierd From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 00:06:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F4B0BF7; Mon, 26 Nov 2012 00:06:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 254518FC13; Mon, 26 Nov 2012 00:06:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ06uvA052749; Mon, 26 Nov 2012 00:06:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ06tfm052747; Mon, 26 Nov 2012 00:06:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211260006.qAQ06tfm052747@svn.freebsd.org> From: Adrian Chadd Date: Mon, 26 Nov 2012 00:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243532 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 00:06:56 -0000 Author: adrian Date: Mon Nov 26 00:06:55 2012 New Revision: 243532 URL: http://svnweb.freebsd.org/changeset/base/243532 Log: Add a primitive to check if a lock is not owned. Modified: head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Nov 25 21:32:13 2012 (r243531) +++ head/sys/net80211/ieee80211_freebsd.h Mon Nov 26 00:06:55 2012 (r243532) @@ -53,6 +53,8 @@ typedef struct { #define IEEE80211_UNLOCK(_ic) mtx_unlock(IEEE80211_LOCK_OBJ(_ic)) #define IEEE80211_LOCK_ASSERT(_ic) \ mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) +#define IEEE80211_UNLOCK_ASSERT(_ic) \ + mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) /* * Node locking definitions. From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 01:54:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDDA2A01; Mon, 26 Nov 2012 01:54:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF41D8FC14; Mon, 26 Nov 2012 01:54:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ1s063066932; Mon, 26 Nov 2012 01:54:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ1s0r7066931; Mon, 26 Nov 2012 01:54:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201211260154.qAQ1s0r7066931@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Nov 2012 01:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243533 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 01:54:01 -0000 Author: mav Date: Mon Nov 26 01:54:00 2012 New Revision: 243533 URL: http://svnweb.freebsd.org/changeset/base/243533 Log: Remove extra sbuf_trim() copy/pasted into r243530. Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Mon Nov 26 00:06:55 2012 (r243532) +++ head/sys/dev/sound/pci/hda/hdaa.c Mon Nov 26 01:54:00 2012 (r243533) @@ -1219,7 +1219,6 @@ hdaa_sysctl_caps(SYSCTL_HANDLER_ARGS) sbuf_printf(&sb, " (selected)"); sbuf_printf(&sb, "\n"); } - sbuf_trim(&sb); error = sbuf_finish(&sb); sbuf_delete(&sb); return (error); From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 02:04:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DE387F17; Mon, 26 Nov 2012 02:04:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C340F8FC0C; Mon, 26 Nov 2012 02:04:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ24BWZ068680; Mon, 26 Nov 2012 02:04:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ24B88068679; Mon, 26 Nov 2012 02:04:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201211260204.qAQ24B88068679@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Nov 2012 02:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243535 - head/sys/dev/sound/pci/hda X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 02:04:12 -0000 Author: mav Date: Mon Nov 26 02:04:11 2012 New Revision: 243535 URL: http://svnweb.freebsd.org/changeset/base/243535 Log: Fix uninitialized variable reported by gcc, but not clang. Modified: head/sys/dev/sound/pci/hda/hdaa.c Modified: head/sys/dev/sound/pci/hda/hdaa.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdaa.c Mon Nov 26 01:57:22 2012 (r243534) +++ head/sys/dev/sound/pci/hda/hdaa.c Mon Nov 26 02:04:11 2012 (r243535) @@ -5552,7 +5552,7 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo * struct hdaa_devinfo *devinfo = pdevinfo->devinfo; struct hdaa_audio_ctl *ctl; char buf[64]; - int i, j, printed; + int i, j, printed = 0; if (flag == 0) { flag = ~(SOUND_MASK_VOLUME | SOUND_MASK_PCM | From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 04:29:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D5F588D; Mon, 26 Nov 2012 04:29:48 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1273D8FC15; Mon, 26 Nov 2012 04:29:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ4TlpY093988; Mon, 26 Nov 2012 04:29:47 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ4Tlqw093986; Mon, 26 Nov 2012 04:29:47 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201211260429.qAQ4Tlqw093986@svn.freebsd.org> From: Davide Italiano Date: Mon, 26 Nov 2012 04:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243548 - head/sys/fs/smbfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 04:29:48 -0000 Author: davide Date: Mon Nov 26 04:29:47 2012 New Revision: 243548 URL: http://svnweb.freebsd.org/changeset/base/243548 Log: - smbfs_rename() might return an error value without correctly upgrading the vnode use count, and this might cause the kernel to panic if compiled with WITNESS enable. - Be sure to put the '\0' terminator to the rpath string. Sponsored by: iXsystems inc. Modified: head/sys/fs/smbfs/smbfs_node.c head/sys/fs/smbfs/smbfs_vnops.c Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Mon Nov 26 04:26:27 2012 (r243547) +++ head/sys/fs/smbfs/smbfs_node.c Mon Nov 26 04:29:47 2012 (r243548) @@ -187,6 +187,7 @@ smbfs_node_alloc(struct mount *mp, struc bcopy(name, p, nmlen); p += nmlen; } + *p = '\0'; MPASS(p == rpath + rplen); lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); /* Vnode initialization */ Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Mon Nov 26 04:26:27 2012 (r243547) +++ head/sys/fs/smbfs/smbfs_vnops.c Mon Nov 26 04:29:47 2012 (r243548) @@ -583,12 +583,12 @@ smbfs_rename(ap) /* Check for cross-device rename */ if ((fvp->v_mount != tdvp->v_mount) || (tvp && (fvp->v_mount != tvp->v_mount))) { - return EXDEV; + error = EXDEV; goto out; } if (tvp && vrefcnt(tvp) > 1) { - return EBUSY; + error = EBUSY; goto out; } flags = 0x10; /* verify all writes */ From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 05:11:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 309053EA; Mon, 26 Nov 2012 05:11:04 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 090BA8FC14; Mon, 26 Nov 2012 05:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ5B3Km002299; Mon, 26 Nov 2012 05:11:03 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ5B3Dm002296; Mon, 26 Nov 2012 05:11:03 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211260511.qAQ5B3Dm002296@svn.freebsd.org> From: Eitan Adler Date: Mon, 26 Nov 2012 05:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243553 - in head/usr.sbin/pkg_install: add lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 05:11:04 -0000 Author: eadler Date: Mon Nov 26 05:11:03 2012 New Revision: 243553 URL: http://svnweb.freebsd.org/changeset/base/243553 Log: Use modern license instead of being consistent with the other pkg_ tools Use a more informative message Fix some style(9) nits. Bump version number In pkg_add only warn users after the chroot is performed. Submitted by: gavin, jilles Reviewed by: beat, bapt Approved by: cperciva MFC after: 1 month Modified: head/usr.sbin/pkg_install/add/main.c head/usr.sbin/pkg_install/lib/lib.h head/usr.sbin/pkg_install/lib/pkgng.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/add/main.c Mon Nov 26 05:11:03 2012 (r243553) @@ -136,7 +136,6 @@ main(int argc, char **argv) static char temppackageroot[MAXPATHLEN]; static char pkgaddpath[MAXPATHLEN]; - warnpkgng(); if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) PkgAddCmd = realpath(argv[0], pkgaddpath); else @@ -295,6 +294,7 @@ main(int argc, char **argv) if (chroot(".")) errx(1, "chroot to %s failed", Chroot); } + warnpkgng(); /* Make sure the sub-execs we invoke get found */ setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin", Modified: head/usr.sbin/pkg_install/lib/lib.h ============================================================================== --- head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 05:11:03 2012 (r243553) @@ -99,7 +99,7 @@ * Version of the package tools - increase whenever you make a change * in the code that is not cosmetic only. */ -#define PKG_INSTALL_VERSION 20120918 +#define PKG_INSTALL_VERSION 20121024 #define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf" #define main(argc, argv) real_main(argc, argv) Modified: head/usr.sbin/pkg_install/lib/pkgng.c ============================================================================== --- head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 04:40:26 2012 (r243552) +++ head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 05:11:03 2012 (r243553) @@ -1,6 +1,6 @@ -/* - * FreeBSD install - a package for the installation and maintenance - * of non-core utilities. +/*- + * Copyright (c) 2012 Eitan Adler + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,19 +11,33 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * Eitan Adler - * - * detect pkgng's existence and warn + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * + * $FreeBSD$ */ #include -__FBSDID("$FreeBSD$"); #include "lib.h" #include -void warnpkgng(void) { +static const char message[] = "You appear to be using the newer pkg(1) tool on \ +this system for package management, rather than the legacy package \ +management tools (pkg_*). The legacy tools should no longer be used on \ +this system."; + +void warnpkgng(void) +{ char pkgngpath[MAXPATHLEN]; char *pkgngdir; @@ -34,5 +48,5 @@ void warnpkgng(void) { strcat(pkgngpath, "/local.sqlite"); if (access(pkgngpath, F_OK) == 0) - warnx("Don't use the pkg_ tools if you are using pkgng"); + warnx(message); } From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 05:11:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5CCA3EE; Mon, 26 Nov 2012 05:11:07 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CBD898FC12; Mon, 26 Nov 2012 05:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ5B7Ch002354; Mon, 26 Nov 2012 05:11:07 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ5B7DQ002346; Mon, 26 Nov 2012 05:11:07 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> From: Eitan Adler Date: Mon, 26 Nov 2012 05:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 05:11:08 -0000 Author: eadler Date: Mon Nov 26 05:11:07 2012 New Revision: 243554 URL: http://svnweb.freebsd.org/changeset/base/243554 Log: Provide an option to users to shoot themselves in the foot. Reviewed by: bapt Approved by: cperciva MFC after: 1 month Modified: head/usr.sbin/pkg_install/add/pkg_add.1 head/usr.sbin/pkg_install/create/pkg_create.1 head/usr.sbin/pkg_install/delete/pkg_delete.1 head/usr.sbin/pkg_install/info/pkg_info.1 head/usr.sbin/pkg_install/lib/lib.h head/usr.sbin/pkg_install/lib/pkgng.c head/usr.sbin/pkg_install/updating/pkg_updating.1 head/usr.sbin/pkg_install/version/pkg_version.1 Modified: head/usr.sbin/pkg_install/add/pkg_add.1 ============================================================================== --- head/usr.sbin/pkg_install/add/pkg_add.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/add/pkg_add.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -15,7 +15,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 4, 2009 +.Dd November 9, 2012 .Dt PKG_ADD 1 .Os .Sh NAME @@ -578,6 +578,10 @@ and are not suitable for creating the staging area. .It Pa /var/db/pkg Default location of the installed package database. +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. .El .Sh SEE ALSO .Xr pkg_create 1 , Modified: head/usr.sbin/pkg_install/create/pkg_create.1 ============================================================================== --- head/usr.sbin/pkg_install/create/pkg_create.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/create/pkg_create.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -23,7 +23,7 @@ .\" [jkh] Took John's changes back and made some additional extensions for .\" better integration with FreeBSD's new ports collection. .\" -.Dd Oct 12, 2010 +.Dd November 9, 2012 .Dt PKG_CREATE 1 .Os .Sh NAME @@ -635,6 +635,10 @@ does not exist. The last choice if .Pa /tmp is unsuitable. +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. .El .Sh SEE ALSO .Xr pkg_add 1 , Modified: head/usr.sbin/pkg_install/delete/pkg_delete.1 ============================================================================== --- head/usr.sbin/pkg_install/delete/pkg_delete.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/delete/pkg_delete.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -17,7 +17,7 @@ .\" @(#)pkg_delete.1 .\" $FreeBSD$ .\" -.Dd May 30, 2008 +.Dd November 9, 2012 .Dt PKG_DELETE 1 .Os .Sh NAME @@ -276,6 +276,10 @@ specifies an alternative location for th .Bl -tag -width /var/db/pkg -compact .It Pa /var/db/pkg Default location of the installed package database. +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. .El .Sh SEE ALSO .Xr pkg_add 1 , Modified: head/usr.sbin/pkg_install/info/pkg_info.1 ============================================================================== --- head/usr.sbin/pkg_install/info/pkg_info.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/info/pkg_info.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -17,7 +17,7 @@ .\" @(#)pkg_info.1 .\" $FreeBSD$ .\" -.Dd May 30, 2008 +.Dd November 9, 2012 .Dt PKG_INFO 1 .Os .Sh NAME @@ -258,6 +258,10 @@ Specifies an alternative package locatio found. .It Ev PKGDIR Specifies an alternative location to save downloaded packages to. +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. .El .Sh FILES .Bl -tag -width ".Pa /var/db/pkg" -compact @@ -277,6 +281,10 @@ The last choice if is unsuitable. .It Pa /var/db/pkg Default location of the installed package database. +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. .El .Sh SEE ALSO .Xr pkg_add 1 , Modified: head/usr.sbin/pkg_install/lib/lib.h ============================================================================== --- head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/lib/lib.h Mon Nov 26 05:11:07 2012 (r243554) @@ -99,7 +99,7 @@ * Version of the package tools - increase whenever you make a change * in the code that is not cosmetic only. */ -#define PKG_INSTALL_VERSION 20121024 +#define PKG_INSTALL_VERSION 20121109 #define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf" #define main(argc, argv) real_main(argc, argv) Modified: head/usr.sbin/pkg_install/lib/pkgng.c ============================================================================== --- head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/lib/pkgng.c Mon Nov 26 05:11:07 2012 (r243554) @@ -40,7 +40,11 @@ void warnpkgng(void) { char pkgngpath[MAXPATHLEN]; char *pkgngdir; + char *dontwarn; + dontwarn = getenv("PKG_OLD_NOWARN"); + if (dontwarn != NULL) + return; pkgngdir = getenv("PKG_DBDIR"); if (pkgngdir == NULL) pkgngdir = "/var/db/pkg"; Modified: head/usr.sbin/pkg_install/updating/pkg_updating.1 ============================================================================== --- head/usr.sbin/pkg_install/updating/pkg_updating.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/updating/pkg_updating.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -10,7 +10,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2008 +.Dd November 9, 2012 .Dt PKG_UPDATING 1 .Os .Sh NAME @@ -77,6 +77,13 @@ installed ports: Fetch UPDATING file from ftp mirror and show all entries of all installed ports: .Dl % pkg_updating -f ftp://ftp.freebsd.org/pub/FreeBSD/ports/packages/UPDATING +.Sh ENVRIOMENT +.Bl -tag -width indent +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. +.El .Sh SEE ALSO .Xr pkg_add 1 , .Xr pkg_create 1 , Modified: head/usr.sbin/pkg_install/version/pkg_version.1 ============================================================================== --- head/usr.sbin/pkg_install/version/pkg_version.1 Mon Nov 26 05:11:03 2012 (r243553) +++ head/usr.sbin/pkg_install/version/pkg_version.1 Mon Nov 26 05:11:07 2012 (r243554) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2008 +.Dd November 9, 2012 .Dt PKG_VERSION 1 .Os .Sh NAME @@ -233,6 +233,13 @@ The following command compares two packa The .Fl c option has been deprecated and is no longer supported. +.Sh ENVRIOMENT +.Bl -tag -width indent +.It Ev PKG_OLD_NOWARN +If set +.Nm +will not warn about its use in the presence of pkgng databases. +.El .Sh SEE ALSO .Xr fetch 1 , .Xr pkg_add 1 , From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 08:50:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1226A722; Mon, 26 Nov 2012 08:50:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EC7BC8FC13; Mon, 26 Nov 2012 08:50:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQ8o06o042208; Mon, 26 Nov 2012 08:50:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQ8o05Z042207; Mon, 26 Nov 2012 08:50:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201211260850.qAQ8o05Z042207@svn.freebsd.org> From: Michael Tuexen Date: Mon, 26 Nov 2012 08:50:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243558 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 08:50:01 -0000 Author: tuexen Date: Mon Nov 26 08:50:00 2012 New Revision: 243558 URL: http://svnweb.freebsd.org/changeset/base/243558 Log: Allow shutdown() to be used on fds returned from sctp_peeloff(). MFC after: 3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Mon Nov 26 05:13:57 2012 (r243557) +++ head/sys/netinet/sctp_usrreq.c Mon Nov 26 08:50:00 2012 (r243558) @@ -971,7 +971,8 @@ sctp_shutdown(struct socket *so) } SCTP_INP_RLOCK(inp); /* For UDP model this is a invalid call */ - if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) { + if (!((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { /* Restore the flags that the soshutdown took away. */ SOCKBUF_LOCK(&so->so_rcv); so->so_rcv.sb_state &= ~SBS_CANTRCVMORE; From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 10:27:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E4C2825; Mon, 26 Nov 2012 10:27:41 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smarthost1.greenhost.nl (smarthost1.greenhost.nl [195.190.28.78]) by mx1.freebsd.org (Postfix) with ESMTP id 2907B8FC13; Mon, 26 Nov 2012 10:27:40 +0000 (UTC) Received: from smtp.greenhost.nl ([213.108.104.138]) by smarthost1.greenhost.nl with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Tcvfu-0006OW-W0; Mon, 26 Nov 2012 11:12:27 +0100 Received: from [81.21.138.17] (helo=ronaldradial.versatec.local) by smtp.greenhost.nl with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Tcvfu-0003kq-L8; Mon, 26 Nov 2012 11:12:26 +0100 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: "Martin Matuska" , "Pawel Jakub Dawidek" Subject: Re: svn commit: r243524 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys References: <201211251632.qAPGW8wd091581@svn.freebsd.org> <20121125163924.GM1460@garage.freebsd.pl> Date: Mon, 26 Nov 2012 11:12:26 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: In-Reply-To: <20121125163924.GM1460@garage.freebsd.pl> User-Agent: Opera Mail/12.11 (Win32) X-Virus-Scanned: by clamav at smarthost1.samage.net X-Spam-Level: / X-Spam-Score: -0.0 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.1 X-Scan-Signature: 919fae14bc17c74543a025539baad412 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 10:27:41 -0000 On Sun, 25 Nov 2012 17:39:24 +0100, Pawel Jakub Dawidek wrote: > On Sun, Nov 25, 2012 at 04:32:08PM +0000, Martin Matuska wrote: >> Author: mm >> Date: Sun Nov 25 16:32:07 2012 >> New Revision: 243524 >> URL: http://svnweb.freebsd.org/changeset/base/243524 >> >> Log: >> MFV r243013 and r243267: >> >> Import the zio nop-write improvement from Illumos. To reduce I/O, >> nop-write omits overwriting data if the checksum (cryptographically >> secure) of new data matches the checksum of existing data. >> It also saves space if snapshots are in use. >> >> It currently works only on datasets with enabled compression, disabled >> deduplication and sha256 checksums. >> >> IllumOS 13887:196932ec9e6a and 13888:7204b3392a58 >> 3236 zio nop-write > > This is a nice change, although I don't understand why it depends on > compression being turned on. It won't save any space. > This question is also discussed here. http://comments.gmane.org/gmane.os.illumos.zfs/200 From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 12:24:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F08ADA29; Mon, 26 Nov 2012 12:24:39 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D32848FC08; Mon, 26 Nov 2012 12:24:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQCOdxR082857; Mon, 26 Nov 2012 12:24:39 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQCOd0a082854; Mon, 26 Nov 2012 12:24:39 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211261224.qAQCOd0a082854@svn.freebsd.org> From: Martin Matuska Date: Mon, 26 Nov 2012 12:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243560 - in head: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 12:24:40 -0000 Author: mm Date: Mon Nov 26 12:24:39 2012 New Revision: 243560 URL: http://svnweb.freebsd.org/changeset/base/243560 Log: MFV r243395: Introduce a new dataset aclmode setting "restricted" to protect ACL's being destroyed or corrupted by a drive-by chmod. illumos-gate 13889:a67716f16746 3254 add support in zfs for aclmode=restricted References: https://www.illumos.org/issues/3254 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: head/cddl/contrib/opensolaris/ (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 Mon Nov 26 09:03:21 2012 (r243559) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Nov 26 12:24:39 2012 (r243560) @@ -760,7 +760,7 @@ If no inheritable .Tn ACE Ns s exist that affect the mode, then the mode is set in accordance to the requested mode from the application. -.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough +.It Sy aclmode Ns = Ns Cm discard | groupmask | passthrough | restricted Controls how an .Tn ACL is modified during @@ -790,6 +790,32 @@ indicates that no changes are made to th other than creating or updating the necessary .Tn ACL entries to represent the new mode of the file or directory. +An +.Sy aclmode +property of +.Cm restricted +will cause the +.Xr chmod 2 +operation to return an error when used on any file or directory which has +a non-trivial +.Tn ACL +whose entries can not be represented by a mode. +.Xr chmod 2 +is required to change the set user ID, set group ID, or sticky bits on a file +or directory, as they do not have equivalent +.Tn ACL +entries. +In order to use +.Xr chmod 2 +on a file or directory with a non-trivial +.Tn ACL +when +.Sy aclmode +is set to +.Cm restricted , +you must first remove all +.Tn ACL +entries which do not represent the current mode. .It Sy atime Ns = Ns Cm on | off Controls whether the access time for files is updated when they are read. Turning this property off avoids producing write traffic when reading files and Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Mon Nov 26 09:03:21 2012 (r243559) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Mon Nov 26 12:24:39 2012 (r243560) @@ -109,6 +109,7 @@ zfs_prop_init(void) { "discard", ZFS_ACL_DISCARD }, { "groupmask", ZFS_ACL_GROUPMASK }, { "passthrough", ZFS_ACL_PASSTHROUGH }, + { "restricted", ZFS_ACL_RESTRICTED }, { NULL } }; @@ -217,7 +218,8 @@ zfs_prop_init(void) "hidden | visible", "SNAPDIR", snapdir_table); zprop_register_index(ZFS_PROP_ACLMODE, "aclmode", ZFS_ACL_DISCARD, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, - "discard | groupmask | passthrough", "ACLMODE", acl_mode_table); + "discard | groupmask | passthrough | restricted", "ACLMODE", + acl_mode_table); zprop_register_index(ZFS_PROP_ACLINHERIT, "aclinherit", ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "discard | noallow | restricted | passthrough | passthrough-x", Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Nov 26 09:03:21 2012 (r243559) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Nov 26 12:24:39 2012 (r243560) @@ -3257,6 +3257,12 @@ top: uint64_t acl_obj; new_mode = (pmode & S_IFMT) | (vap->va_mode & ~S_IFMT); + if (zp->z_zfsvfs->z_acl_mode == ZFS_ACL_RESTRICTED && + !(zp->z_pflags & ZFS_ACL_TRIVIAL)) { + err = EPERM; + goto out; + } + if (err = zfs_acl_chmod_setattr(zp, &aclp, new_mode)) goto out; From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 13:16:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC63083F; Mon, 26 Nov 2012 13:16:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 926988FC08; Mon, 26 Nov 2012 13:16:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQDGtdw092897; Mon, 26 Nov 2012 13:16:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQDGtte092895; Mon, 26 Nov 2012 13:16:55 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201211261316.qAQDGtte092895@svn.freebsd.org> From: Martin Matuska Date: Mon, 26 Nov 2012 13:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243561 - in head/cddl/contrib/opensolaris/cmd: zfs zpool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 13:16:55 -0000 Author: mm Date: Mon Nov 26 13:16:55 2012 New Revision: 243561 URL: http://svnweb.freebsd.org/changeset/base/243561 Log: Update manpage dates in zfs.8 and zpool.8 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Nov 26 12:24:39 2012 (r243560) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Nov 26 13:16:55 2012 (r243561) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2012 +.Dd November 26, 2012 .Dt ZFS 8 .Os .Sh NAME Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Nov 26 12:24:39 2012 (r243560) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Nov 26 13:16:55 2012 (r243561) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2011 +.Dd November 15, 2012 .Dt ZPOOL 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 16:43:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A52FC07; Mon, 26 Nov 2012 16:43:33 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 401848FC15; Mon, 26 Nov 2012 16:43:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQGhXPG031696; Mon, 26 Nov 2012 16:43:33 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQGhXnV031694; Mon, 26 Nov 2012 16:43:33 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201211261643.qAQGhXnV031694@svn.freebsd.org> From: Michael Tuexen Date: Mon, 26 Nov 2012 16:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243564 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 16:43:33 -0000 Author: tuexen Date: Mon Nov 26 16:43:32 2012 New Revision: 243564 URL: http://svnweb.freebsd.org/changeset/base/243564 Log: Find the endpoint for an incoming packet also if the endpoint comes from sctp_peeloff(). MFC after: 3 days Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Mon Nov 26 16:19:27 2012 (r243563) +++ head/sys/netinet/sctp_pcb.c Mon Nov 26 16:43:32 2012 (r243564) @@ -1226,7 +1226,8 @@ sctp_findassociation_ep_addr(struct sctp SCTP_TCB_UNLOCK(locked_tcb); } SCTP_INP_INFO_RLOCK(); - if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { /*- * Now either this guy is our listener or it's the * connector. If it is the one that issued the connect, then From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 16:44:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A295BD78; Mon, 26 Nov 2012 16:44:03 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 882898FC12; Mon, 26 Nov 2012 16:44:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQGi3rm031815; Mon, 26 Nov 2012 16:44:03 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQGi306031813; Mon, 26 Nov 2012 16:44:03 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201211261644.qAQGi306031813@svn.freebsd.org> From: Michael Tuexen Date: Mon, 26 Nov 2012 16:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243565 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 16:44:03 -0000 Author: tuexen Date: Mon Nov 26 16:44:03 2012 New Revision: 243565 URL: http://svnweb.freebsd.org/changeset/base/243565 Log: Add support for sctp_peeloff() also in the front states of the association. MFC after: 3 days Modified: head/sys/netinet/sctp_peeloff.c Modified: head/sys/netinet/sctp_peeloff.c ============================================================================== --- head/sys/netinet/sctp_peeloff.c Mon Nov 26 16:43:32 2012 (r243564) +++ head/sys/netinet/sctp_peeloff.c Mon Nov 26 16:44:03 2012 (r243565) @@ -74,9 +74,7 @@ sctp_can_peel_off(struct socket *head, s } state = SCTP_GET_STATE((&stcb->asoc)); if ((state == SCTP_STATE_EMPTY) || - (state == SCTP_STATE_INUSE) || - (state == SCTP_STATE_COOKIE_WAIT) || - (state == SCTP_STATE_COOKIE_ECHOED)) { + (state == SCTP_STATE_INUSE)) { SCTP_TCB_UNLOCK(stcb); SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); @@ -105,9 +103,7 @@ sctp_do_peeloff(struct socket *head, str } state = SCTP_GET_STATE((&stcb->asoc)); if ((state == SCTP_STATE_EMPTY) || - (state == SCTP_STATE_INUSE) || - (state == SCTP_STATE_COOKIE_WAIT) || - (state == SCTP_STATE_COOKIE_ECHOED)) { + (state == SCTP_STATE_INUSE)) { SCTP_TCB_UNLOCK(stcb); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, ENOTCONN); return (ENOTCONN); From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 19:42:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7263678C; Mon, 26 Nov 2012 19:42:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5618B8FC08; Mon, 26 Nov 2012 19:42:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQJgdrX059274; Mon, 26 Nov 2012 19:42:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQJgdVQ059273; Mon, 26 Nov 2012 19:42:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201211261942.qAQJgdVQ059273@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 26 Nov 2012 19:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243568 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 19:42:39 -0000 Author: glebius Date: Mon Nov 26 19:42:38 2012 New Revision: 243568 URL: http://svnweb.freebsd.org/changeset/base/243568 Log: Fix typo in weekly line which made it to rotated after reaching > 1 Kb. PR: conf/173857 Submitted by: Matt Smith Modified: head/etc/newsyslog.conf Modified: head/etc/newsyslog.conf ============================================================================== --- head/etc/newsyslog.conf Mon Nov 26 18:11:41 2012 (r243567) +++ head/etc/newsyslog.conf Mon Nov 26 19:42:38 2012 (r243568) @@ -35,5 +35,5 @@ /var/log/security 600 10 100 * JC /var/log/sendmail.st 640 10 * 168 B /var/log/utx.log 644 3 * @01T05 B -/var/log/weekly.log 640 5 1 $W6D0 JN +/var/log/weekly.log 640 5 * $W6D0 JN /var/log/xferlog 600 7 100 * JC From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 19:45:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A9AFE995; Mon, 26 Nov 2012 19:45:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F55C8FC19; Mon, 26 Nov 2012 19:45:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQJj14j059729; Mon, 26 Nov 2012 19:45:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQJj1Cw059728; Mon, 26 Nov 2012 19:45:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201211261945.qAQJj1Cw059728@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 26 Nov 2012 19:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243569 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 19:45:01 -0000 Author: glebius Date: Mon Nov 26 19:45:01 2012 New Revision: 243569 URL: http://svnweb.freebsd.org/changeset/base/243569 Log: Re-initialize eh pointer after m_adj() Submitted by: Kohji Okuno Reviewed by: yongari Modified: head/sys/net/if_ethersubr.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Mon Nov 26 19:42:38 2012 (r243568) +++ head/sys/net/if_ethersubr.c Mon Nov 26 19:45:01 2012 (r243569) @@ -578,6 +578,7 @@ ether_input_internal(struct ifnet *ifp, bcopy((char *)evl, (char *)evl + ETHER_VLAN_ENCAP_LEN, ETHER_HDR_LEN - ETHER_TYPE_LEN); m_adj(m, ETHER_VLAN_ENCAP_LEN); + eh = mtod(m, struct ether_header *); } M_SETFIB(m, ifp->if_fib); From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 20:03:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F4AC146; Mon, 26 Nov 2012 20:03:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 191F88FC16; Mon, 26 Nov 2012 20:03:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQK3vQr063355; Mon, 26 Nov 2012 20:03:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQK3vsU063354; Mon, 26 Nov 2012 20:03:57 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201211262003.qAQK3vsU063354@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 26 Nov 2012 20:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243570 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 20:03:58 -0000 Author: glebius Date: Mon Nov 26 20:03:57 2012 New Revision: 243570 URL: http://svnweb.freebsd.org/changeset/base/243570 Log: drbr_enqueue() awlays consumes mbuf, no matter did it fail or not. The mbuf pointer is no longer valid, so can't be reused after. Fix igb_mq_start() where mbuf pointer was used after drbr_enqueue(). This eventually leads us to all invocations of igb_mq_start_locked() called with third argument as NULL. This allows us to simplify this function. Submitted by: Karim Fodil-Lemelin Reviewed by: jfv Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Nov 26 19:45:01 2012 (r243569) +++ head/sys/dev/e1000/if_igb.c Mon Nov 26 20:03:57 2012 (r243570) @@ -181,8 +181,7 @@ static int igb_suspend(device_t); static int igb_resume(device_t); #if __FreeBSD_version >= 800000 static int igb_mq_start(struct ifnet *, struct mbuf *); -static int igb_mq_start_locked(struct ifnet *, - struct tx_ring *, struct mbuf *); +static int igb_mq_start_locked(struct ifnet *, struct tx_ring *); static void igb_qflush(struct ifnet *); static void igb_deferred_mq_start(void *, int); #else @@ -845,7 +844,7 @@ igb_resume(device_t dev) /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); @@ -961,15 +960,14 @@ igb_mq_start(struct ifnet *ifp, struct m que = &adapter->queues[i]; if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && IGB_TX_TRYLOCK(txr)) { - struct mbuf *pm = NULL; /* ** Try to queue first to avoid ** out-of-order delivery, but ** settle for it if that fails */ - if (m && drbr_enqueue(ifp, txr->br, m)) - pm = m; - err = igb_mq_start_locked(ifp, txr, pm); + if (m) + drbr_enqueue(ifp, txr->br, m); + err = igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } else { err = drbr_enqueue(ifp, txr->br, m); @@ -980,7 +978,7 @@ igb_mq_start(struct ifnet *ifp, struct m } static int -igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) +igb_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr) { struct adapter *adapter = txr->adapter; struct mbuf *next; @@ -990,24 +988,13 @@ igb_mq_start_locked(struct ifnet *ifp, s if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || (txr->queue_status & IGB_QUEUE_DEPLETED) || - adapter->link_active == 0) { - if (m != NULL) - err = drbr_enqueue(ifp, txr->br, m); + adapter->link_active == 0) return (err); - } enq = 0; - if (m == NULL) { - next = drbr_dequeue(ifp, txr->br); - } else if (drbr_needs_enqueue(ifp, txr->br)) { - if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) - return (err); - next = drbr_dequeue(ifp, txr->br); - } else - next = m; /* Process the queue */ - while (next != NULL) { + while ((next = drbr_dequeue(ifp, txr->br)) != NULL) { if ((err = igb_xmit(txr, &next)) != 0) { if (next != NULL) err = drbr_enqueue(ifp, txr->br, next); @@ -1020,7 +1007,6 @@ igb_mq_start_locked(struct ifnet *ifp, s ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - next = drbr_dequeue(ifp, txr->br); } if (enq > 0) { /* Set the watchdog */ @@ -1046,7 +1032,7 @@ igb_deferred_mq_start(void *arg, int pen IGB_TX_LOCK(txr); if (!drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); IGB_TX_UNLOCK(txr); } @@ -1398,7 +1384,7 @@ igb_handle_que(void *context, int pendin /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); @@ -1449,7 +1435,7 @@ igb_handle_link_locked(struct adapter *a /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); @@ -1549,7 +1535,7 @@ igb_poll(struct ifnet *ifp, enum poll_cm } while (loop-- && more); #if __FreeBSD_version >= 800000 if (!drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); @@ -1586,7 +1572,7 @@ igb_msix_que(void *arg) /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); + igb_mq_start_locked(ifp, txr); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 20:07:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C2D03B6; Mon, 26 Nov 2012 20:07:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41BBA8FC15; Mon, 26 Nov 2012 20:07:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQK7B5c064110; Mon, 26 Nov 2012 20:07:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQK7Bop064109; Mon, 26 Nov 2012 20:07:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201211262007.qAQK7Bop064109@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Nov 2012 20:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243571 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 20:07:11 -0000 Author: mav Date: Mon Nov 26 20:07:10 2012 New Revision: 243571 URL: http://svnweb.freebsd.org/changeset/base/243571 Log: Fix problem with the Samsung 840 PRO series SSD detection. The device reports support for SATA Asynchronous Notification in its IDENTIFY data, but returns error on attempt to enable that feature. Make SATA XPT of CAM only report these errors, but not fail the device. MFC after: 1 week Modified: head/sys/cam/ata/ata_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Mon Nov 26 20:03:57 2012 (r243570) +++ head/sys/cam/ata/ata_xpt.c Mon Nov 26 20:07:10 2012 (r243571) @@ -751,6 +751,14 @@ probedone(struct cam_periph *periph, uni goto noerror; /* + * Some Samsung SSDs report supported Asynchronous Notification, + * but return ABORT on attempt to enable it. + */ + } else if (softc->action == PROBE_SETAN && + status == CAM_ATA_STATUS_ERROR) { + goto noerror; + + /* * SES and SAF-TE SEPs have different IDENTIFY commands, * but SATA specification doesn't tell how to identify them. * Until better way found, just try another if first fail. From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 21:32:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE81EE39; Mon, 26 Nov 2012 21:32:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CAB578FC14; Mon, 26 Nov 2012 21:32:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQLWVhl080045; Mon, 26 Nov 2012 21:32:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQLWVlS080042; Mon, 26 Nov 2012 21:32:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201211262132.qAQLWVlS080042@svn.freebsd.org> From: Dimitry Andric Date: Mon, 26 Nov 2012 21:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243572 - head/contrib/libc++/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 21:32:32 -0000 Author: dim Date: Mon Nov 26 21:32:31 2012 New Revision: 243572 URL: http://svnweb.freebsd.org/changeset/base/243572 Log: Pull in r168610 from upstream libc++: When using libc++ headers on FreeBSD, in combination with -std=c++98, -ansi or -std=c++03, the long long type is not supported. So in this case, several functions and types, like lldiv_t, strtoll(), are not declared. This should make it possible to use the libc++ headers in c++98 mode. Note: libc++ is originally designed as a c++0x or higher library, so you should still take care when using it with c++98 or c++03. Noted by: Yamaya Takashi MFC after: 1 week Modified: head/contrib/libc++/include/__config head/contrib/libc++/include/cstdlib head/contrib/libc++/include/cwchar Modified: head/contrib/libc++/include/__config ============================================================================== --- head/contrib/libc++/include/__config Mon Nov 26 20:07:10 2012 (r243571) +++ head/contrib/libc++/include/__config Mon Nov 26 21:32:31 2012 (r243572) @@ -51,6 +51,9 @@ # define _LIBCPP_LITTLE_ENDIAN 0 # define _LIBCPP_BIG_ENDIAN 1 # endif // _BYTE_ORDER == _LITTLE_ENDIAN +# ifndef __LONG_LONG_SUPPORTED +# define _LIBCPP_HAS_NO_LONG_LONG +# endif // __LONG_LONG_SUPPORTED #endif // __FreeBSD__ #ifdef _WIN32 Modified: head/contrib/libc++/include/cstdlib ============================================================================== --- head/contrib/libc++/include/cstdlib Mon Nov 26 20:07:10 2012 (r243571) +++ head/contrib/libc++/include/cstdlib Mon Nov 26 21:32:31 2012 (r243572) @@ -97,18 +97,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t; using ::div_t; using ::ldiv_t; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv_t; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::atof; using ::atoi; using ::atol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::atoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtod; using ::strtof; using ::strtold; using ::strtol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::strtoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::strtoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::rand; using ::srand; using ::calloc; @@ -125,10 +133,14 @@ using ::bsearch; using ::qsort; using ::abs; using ::labs; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::llabs; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::div; using ::ldiv; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::lldiv; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::mblen; using ::mbtowc; using ::wctomb; @@ -145,10 +157,14 @@ using ::aligned_alloc; // MSVC already has the correct prototype in #ifdef __cplusplus #if !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} +#endif // _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} +#ifndef _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} +#endif // _LIBCPP_HAS_NO_LONG_LONG #endif // _MSC_VER _LIBCPP_END_NAMESPACE_STD Modified: head/contrib/libc++/include/cwchar ============================================================================== --- head/contrib/libc++/include/cwchar Mon Nov 26 20:07:10 2012 (r243571) +++ head/contrib/libc++/include/cwchar Mon Nov 26 21:32:31 2012 (r243572) @@ -151,9 +151,13 @@ using ::wcstof; using ::wcstold; #endif // _MSC_VER using ::wcstol; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoll; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcstoul; +#ifndef _LIBCPP_HAS_NO_LONG_LONG using ::wcstoull; +#endif // _LIBCPP_HAS_NO_LONG_LONG using ::wcscpy; using ::wcsncpy; using ::wcscat; From owner-svn-src-head@FreeBSD.ORG Mon Nov 26 23:30:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66A35D4B; Mon, 26 Nov 2012 23:30:48 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7F38FC12; Mon, 26 Nov 2012 23:30:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAQNUmDO004131; Mon, 26 Nov 2012 23:30:48 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAQNUmba004129; Mon, 26 Nov 2012 23:30:48 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211262330.qAQNUmba004129@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 26 Nov 2012 23:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243575 - head/sys/arm/at91 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 23:30:48 -0000 Author: marcel Date: Mon Nov 26 23:30:47 2012 New Revision: 243575 URL: http://svnweb.freebsd.org/changeset/base/243575 Log: Unbreak building a kernel with EHCI: there's no ehci_atmelarm.c. Modified: head/sys/arm/at91/files.at91 Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Mon Nov 26 23:23:36 2012 (r243574) +++ head/sys/arm/at91/files.at91 Mon Nov 26 23:30:47 2012 (r243575) @@ -55,4 +55,3 @@ arm/at91/board_tsc4370.c optional at91_b dev/usb/controller/at91dci.c optional at91_dci dev/usb/controller/at91dci_atmelarm.c optional at91_dci dev/usb/controller/ohci_atmelarm.c optional ohci -dev/usb/controller/ehci_atmelarm.c optional ehci From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 00:02:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0B346E6; Tue, 27 Nov 2012 00:02:39 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 9C8438FC08; Tue, 27 Nov 2012 00:02:39 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qAR02cfU096495; Mon, 26 Nov 2012 17:02:38 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) 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 qAR02ZtU037804; Mon, 26 Nov 2012 17:02:35 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: svn commit: r243575 - head/sys/arm/at91 From: Ian Lepore To: Marcel Moolenaar In-Reply-To: <201211262330.qAQNUmba004129@svn.freebsd.org> References: <201211262330.qAQNUmba004129@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Mon, 26 Nov 2012 17:02:35 -0700 Message-ID: <1353974555.69940.128.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 00:02:39 -0000 On Mon, 2012-11-26 at 23:30 +0000, Marcel Moolenaar wrote: > Author: marcel > Date: Mon Nov 26 23:30:47 2012 > New Revision: 243575 > URL: http://svnweb.freebsd.org/changeset/base/243575 > > Log: > Unbreak building a kernel with EHCI: there's no ehci_atmelarm.c. > > Modified: > head/sys/arm/at91/files.at91 > > Modified: head/sys/arm/at91/files.at91 > ============================================================================== > --- head/sys/arm/at91/files.at91 Mon Nov 26 23:23:36 2012 (r243574) > +++ head/sys/arm/at91/files.at91 Mon Nov 26 23:30:47 2012 (r243575) > @@ -55,4 +55,3 @@ arm/at91/board_tsc4370.c optional at91_b > dev/usb/controller/at91dci.c optional at91_dci > dev/usb/controller/at91dci_atmelarm.c optional at91_dci > dev/usb/controller/ohci_atmelarm.c optional ohci > -dev/usb/controller/ehci_atmelarm.c optional ehci FWIW, I do have a working ehci_atmelarm.c if anybody needs it. It's not quite ready to commit, because it relies on some other at91 changes that are also not quite ready to commit, but with a bit of manual fussing it can be made to work if you've got a need for it. -- Ian From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 00:41:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C10DE33; Tue, 27 Nov 2012 00:41:40 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 155358FC08; Tue, 27 Nov 2012 00:41:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR0fdSp022867; Tue, 27 Nov 2012 00:41:39 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR0fdvE022866; Tue, 27 Nov 2012 00:41:39 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211270041.qAR0fdvE022866@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 27 Nov 2012 00:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243576 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 00:41:40 -0000 Author: marcel Date: Tue Nov 27 00:41:39 2012 New Revision: 243576 URL: http://svnweb.freebsd.org/changeset/base/243576 Log: Don't define intr_disable and intr_restore as macros. The macros interfere with structure fields of the same name in drivers, like the intr_disable function pointer in struct cphy_ops in cxgb(4). Instead define intr_disable and intr_restore as inline functions. With intr_disable() an inline function, the I32_bit and F32_bit macros now need to be visible in MI code and given the rather poor names, this is not at all good. Define ARM_CPSR_F32 and ARM_CPSR_I32 and use that instead of F32_bit and I32_bit (resp) for now. Modified: head/sys/arm/include/cpufunc.h Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Mon Nov 26 23:30:47 2012 (r243575) +++ head/sys/arm/include/cpufunc.h Tue Nov 27 00:41:39 2012 (r243576) @@ -681,20 +681,36 @@ __set_cpsr_c(u_int bic, u_int eor) return ret; } +#define ARM_CPSR_F32 (1 << 6) /* FIQ disable */ +#define ARM_CPSR_I32 (1 << 7) /* IRQ disable */ + #define disable_interrupts(mask) \ - (__set_cpsr_c((mask) & (I32_bit | F32_bit), \ - (mask) & (I32_bit | F32_bit))) + (__set_cpsr_c((mask) & (ARM_CPSR_I32 | ARM_CPSR_F32), \ + (mask) & (ARM_CPSR_I32 | ARM_CPSR_F32))) #define enable_interrupts(mask) \ - (__set_cpsr_c((mask) & (I32_bit | F32_bit), 0)) + (__set_cpsr_c((mask) & (ARM_CPSR_I32 | ARM_CPSR_F32), 0)) #define restore_interrupts(old_cpsr) \ - (__set_cpsr_c((I32_bit | F32_bit), (old_cpsr) & (I32_bit | F32_bit))) + (__set_cpsr_c((ARM_CPSR_I32 | ARM_CPSR_F32), \ + (old_cpsr) & (ARM_CPSR_I32 | ARM_CPSR_F32))) + +static __inline register_t +intr_disable(void) +{ + register_t s; + + s = disable_interrupts(ARM_CPSR_I32 | ARM_CPSR_F32); + return (s); +} + +static __inline void +intr_restore(register_t s) +{ + + restore_interrupts(s); +} -#define intr_disable() \ - disable_interrupts(I32_bit | F32_bit) -#define intr_restore(s) \ - restore_interrupts(s) /* Functions to manipulate the CPSR. */ u_int SetCPSR(u_int bic, u_int eor); u_int GetCPSR(void); From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 01:05:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6446351; Tue, 27 Nov 2012 01:05:07 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A99C48FC13; Tue, 27 Nov 2012 01:05:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR157KO028882; Tue, 27 Nov 2012 01:05:07 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR157iu028881; Tue, 27 Nov 2012 01:05:07 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211270105.qAR157iu028881@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 27 Nov 2012 01:05:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243578 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 01:05:07 -0000 Author: marcel Date: Tue Nov 27 01:05:07 2012 New Revision: 243578 URL: http://svnweb.freebsd.org/changeset/base/243578 Log: Remove print_kernel_section_addr(). All statements in that function expand to uncompilable code when the kernel configuration contains "options DEBUG", such as it is for LINT. The toolchain is often a better approach to figure this out, as it doesn't require one to boot the kernel. Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Nov 27 00:42:30 2012 (r243577) +++ head/sys/arm/arm/machdep.c Tue Nov 27 01:05:07 2012 (r243578) @@ -1038,18 +1038,6 @@ print_kenv(void) } static void -print_kernel_section_addr(void) -{ - - debugf("kernel image addresses:\n"); - debugf(" kernbase = 0x%08x\n", (uint32_t)kernbase); - debugf(" _etext (sdata) = 0x%08x\n", (uint32_t)_etext); - debugf(" _edata = 0x%08x\n", (uint32_t)_edata); - debugf(" __bss_start = 0x%08x\n", (uint32_t)__bss_start); - debugf(" _end = 0x%08x\n", (uint32_t)_end); -} - -static void physmap_init(struct mem_region *availmem_regions, int availmem_regions_sz) { int i, j, cnt; @@ -1344,7 +1332,6 @@ initarm(struct arm_boot_params *abp) debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); debugf(" boothowto = 0x%08x\n", boothowto); debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); - print_kernel_section_addr(); print_kenv(); env = getenv("kernelname"); From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 01:08:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9D134E9; Tue, 27 Nov 2012 01:08:05 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C86548FC08; Tue, 27 Nov 2012 01:08:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR185JT029539; Tue, 27 Nov 2012 01:08:05 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR185pF029538; Tue, 27 Nov 2012 01:08:05 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211270108.qAR185pF029538@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 27 Nov 2012 01:08:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243579 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 01:08:06 -0000 Author: marcel Date: Tue Nov 27 01:08:05 2012 New Revision: 243579 URL: http://svnweb.freebsd.org/changeset/base/243579 Log: Don't include arm/xscale/i8134x/i81342reg.h when we're compiling LINT. The definitions in i81342reg.h clash with those in i80321reg.h. Modified: head/sys/arm/arm/cpufunc.c Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Tue Nov 27 01:05:07 2012 (r243578) +++ head/sys/arm/arm/cpufunc.c Tue Nov 27 01:08:05 2012 (r243579) @@ -74,7 +74,13 @@ __FBSDID("$FreeBSD$"); #include #endif -#if defined(CPU_XSCALE_81342) +/* + * Some definitions in i81342reg.h clash with i80321reg.h. + * This only happens for the LINT kernel. As it happens, + * we don't need anything from i81342reg.h that we already + * got from somewhere else during a LINT compile. + */ +#if defined(CPU_XSCALE_81342) && !defined(COMPILING_LINT) #include #endif From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 01:10:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 18C75675; Tue, 27 Nov 2012 01:10:59 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F083B8FC15; Tue, 27 Nov 2012 01:10:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR1Aw9G030133; Tue, 27 Nov 2012 01:10:58 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR1Aw7B030132; Tue, 27 Nov 2012 01:10:58 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211270110.qAR1Aw7B030132@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 27 Nov 2012 01:10:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243580 - head/sys/arm/mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 01:10:59 -0000 Author: marcel Date: Tue Nov 27 01:10:58 2012 New Revision: 243580 URL: http://svnweb.freebsd.org/changeset/base/243580 Log: Allow building LINT by defining both SAMPLE_AT_RESET on the one hand and SAMPLE_AT_RESET_{LO|HI} on the other. It doesn't matter which values they take, as long as they are defined. Modified: head/sys/arm/mv/mvreg.h Modified: head/sys/arm/mv/mvreg.h ============================================================================== --- head/sys/arm/mv/mvreg.h Tue Nov 27 01:08:05 2012 (r243579) +++ head/sys/arm/mv/mvreg.h Tue Nov 27 01:10:58 2012 (r243580) @@ -336,14 +336,15 @@ #define SAMPLE_AT_RESET 0x10 #elif defined(SOC_MV_KIRKWOOD) #define SAMPLE_AT_RESET 0x30 -#elif defined(SOC_MV_DISCOVERY) +#elif defined(SOC_MV_FREY) +#define SAMPLE_AT_RESET 0x100 +#endif +#if defined(SOC_MV_DISCOVERY) #define SAMPLE_AT_RESET_LO 0x30 #define SAMPLE_AT_RESET_HI 0x34 #elif defined(SOC_MV_DOVE) #define SAMPLE_AT_RESET_LO 0x14 #define SAMPLE_AT_RESET_HI 0x18 -#elif defined(SOC_MV_FREY) -#define SAMPLE_AT_RESET 0x100 #elif defined(SOC_MV_ARMADAXP) #define SAMPLE_AT_RESET_LO 0x30 #define SAMPLE_AT_RESET_HI 0x34 From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 01:17:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 990D2844; Tue, 27 Nov 2012 01:17:50 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7B8DA8FC13; Tue, 27 Nov 2012 01:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR1HoX9031357; Tue, 27 Nov 2012 01:17:50 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR1HoAh031355; Tue, 27 Nov 2012 01:17:50 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211270117.qAR1HoAh031355@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 27 Nov 2012 01:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243581 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 01:17:50 -0000 Author: marcel Date: Tue Nov 27 01:17:50 2012 New Revision: 243581 URL: http://svnweb.freebsd.org/changeset/base/243581 Log: Add NOTES and Makefile in order to generate LINT. NOTES contains pretty much all the union of all the kernel configuration files, including all the CPU types, Marvell SOC types and at91 board types. Any device not supported (read: does not compile) has been removed, which is a fairly small set actually. As such, LINT gives us very good coverage without having to build a zillion kernels. Added: head/sys/arm/conf/Makefile (contents, props changed) head/sys/arm/conf/NOTES (contents, props changed) Added: head/sys/arm/conf/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/Makefile Tue Nov 27 01:17:50 2012 (r243581) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +TARGET=arm + +.include "${.CURDIR}/../../conf/makeLINT.mk" Added: head/sys/arm/conf/NOTES ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/NOTES Tue Nov 27 01:17:50 2012 (r243581) @@ -0,0 +1,90 @@ +# $FreeBSD$ + +machine arm + +cpu CPU_ARM9 +cpu CPU_ARM9E +cpu CPU_FA526 +cpu CPU_SA1100 +cpu CPU_SA1110 +cpu CPU_XSCALE_80219 +cpu CPU_XSCALE_80321 +cpu CPU_XSCALE_81342 +cpu CPU_XSCALE_IXP425 +cpu CPU_XSCALE_IXP435 +cpu CPU_XSCALE_PXA2X0 + +files "../at91/files.at91" +files "../econa/files.econa" +files "../mv/files.mv" +files "../mv/discovery/files.db78xxx" +files "../mv/kirkwood/files.kirkwood" +files "../mv/kirkwood/files.sheevaplug" +files "../mv/orion/files.db88f5xxx" +files "../mv/orion/files.ts7800" +files "../s3c2xx0/files.s3c2xx0" +files "../sa11x0/files.sa11x0" +files "../xscale/i80321/files.ep80219" +files "../xscale/i80321/files.i80219" +files "../xscale/i80321/files.i80321" +files "../xscale/i80321/files.iq31244" +files "../xscale/i8134x/files.crb" +files "../xscale/i8134x/files.i81342" +files "../xscale/ixp425/files.avila" +files "../xscale/ixp425/files.ixp425" +files "../xscale/pxa/files.pxa" + +options PHYSADDR=0x00000000 +options KERNPHYSADDR=0x00000000 +options KERNVIRTADDR=0xc0000000 + +makeoptions LDFLAGS="-zmuldefs" +makeoptions KERNPHYSADDR=0x00000000 +makeoptions KERNVIRTADDR=0xc0000000 + +options FDT + +options SOC_MV_DISCOVERY +options SOC_MV_KIRKWOOD +options SOC_MV_ORION + +device pci + +device at91_board_bwct +device at91_board_ethernut5 +device at91_board_hl200 +device at91_board_hl201 +device at91_board_kb920x +device at91_board_qila9g20 +device at91_board_sam9260ek +device at91_board_sam9g20ek +device at91_board_sam9x25ek +device at91_board_tsc4370 +device at91rm9200 +device board_ln2410sbc + +nooptions SMP +nooptions MAXCPU + +nooptions COMPAT_FREEBSD4 + +nodevice fdc +nodevice sym +nodevice ukbd + +nodevice sc +nodevice blank_saver +nodevice daemon_saver +nodevice dragon_saver +nodevice fade_saver +nodevice fire_saver +nodevice green_saver +nodevice logo_saver +nodevice rain_saver +nodevice snake_saver +nodevice star_saver +nodevice warp_saver + +nodevice pcii +nodevice snd_cmi +nodevice tnt4882 From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:03:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B2B55DF; Tue, 27 Nov 2012 02:03:42 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4005E8FC1F; Tue, 27 Nov 2012 02:03:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR23gU7042072; Tue, 27 Nov 2012 02:03:42 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR23gBR042071; Tue, 27 Nov 2012 02:03:42 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201211270203.qAR23gBR042071@svn.freebsd.org> From: Juli Mallett Date: Tue, 27 Nov 2012 02:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243587 - head/sys/contrib/octeon-sdk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:03:42 -0000 Author: jmallett Date: Tue Nov 27 02:03:41 2012 New Revision: 243587 URL: http://svnweb.freebsd.org/changeset/base/243587 Log: Allow this file to build on FreeBSD. Modified: head/sys/contrib/octeon-sdk/cvmx-dma-engine.c Modified: head/sys/contrib/octeon-sdk/cvmx-dma-engine.c ============================================================================== --- head/sys/contrib/octeon-sdk/cvmx-dma-engine.c Tue Nov 27 01:59:51 2012 (r243586) +++ head/sys/contrib/octeon-sdk/cvmx-dma-engine.c Tue Nov 27 02:03:41 2012 (r243587) @@ -65,8 +65,10 @@ #include #include #else +#if !defined(__FreeBSD__) || !defined(_KERNEL) #include "executive-config.h" #include "cvmx-config.h" +#endif #include "cvmx.h" #include "cvmx-cmd-queue.h" #include "cvmx-dma-engine.h" From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:18:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC563BB4; Tue, 27 Nov 2012 02:18:41 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 762648FC14; Tue, 27 Nov 2012 02:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2Ifj0045670; Tue, 27 Nov 2012 02:18:41 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2IfNF045669; Tue, 27 Nov 2012 02:18:41 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270218.qAR2IfNF045669@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243588 - head/sys/dev/ath/ath_hal/ar5212 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:18:41 -0000 Author: adrian Date: Tue Nov 27 02:18:41 2012 New Revision: 243588 URL: http://svnweb.freebsd.org/changeset/base/243588 Log: When programming the beacon timer configuration, be very explicit about what the maximum legal values are. The current beacon timer configuration from TDMA wraps things at HAL_BEACON_PERIOD-1 TU. For the 11a chips this is fine, but for the 11n chips it's not enough resolution. Since the 11a chips have a limit on what's "valid", just enforce this so when I do write larger values in, they get suitably wrapped before programming. Tested: * AR5413, TDMA slave Todo: * Run it for a (lot) longer on a clear channel, ensure that no strange slippages occur. * Re-validate this on STA configurations, just to be sure. Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Tue Nov 27 02:03:41 2012 (r243587) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Tue Nov 27 02:18:41 2012 (r243588) @@ -46,10 +46,19 @@ ar5212SetBeaconTimers(struct ath_hal *ah { struct ath_hal_5212 *ahp = AH5212(ah); - OS_REG_WRITE(ah, AR_TIMER0, bt->bt_nexttbtt); - OS_REG_WRITE(ah, AR_TIMER1, bt->bt_nextdba); - OS_REG_WRITE(ah, AR_TIMER2, bt->bt_nextswba); - OS_REG_WRITE(ah, AR_TIMER3, bt->bt_nextatim); + /* + * Limit the timers to their specific resolutions: + * + * + Timer 0 - 0..15 0xffff TU + * + Timer 1 - 0..18 0x7ffff TU/8 + * + Timer 2 - 0..24 0x1ffffff TU/8 + * + Timer 3 - 0..15 0xffff TU + */ + OS_REG_WRITE(ah, AR_TIMER0, bt->bt_nexttbtt & 0xffff); + OS_REG_WRITE(ah, AR_TIMER1, bt->bt_nextdba & 0x7ffff); + OS_REG_WRITE(ah, AR_TIMER2, bt->bt_nextswba & 0x1ffffff); + /* XXX force nextatim to be non-zero? */ + OS_REG_WRITE(ah, AR_TIMER3, bt->bt_nextatim & 0xffff); /* * Set the Beacon register after setting all timers. */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:19:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2A74D34; Tue, 27 Nov 2012 02:19:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B7A998FC12; Tue, 27 Nov 2012 02:19:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2JZV0045894; Tue, 27 Nov 2012 02:19:35 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2JZO6045893; Tue, 27 Nov 2012 02:19:35 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270219.qAR2JZO6045893@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:19:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243589 - head/sys/dev/ath/ath_hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:19:35 -0000 Author: adrian Date: Tue Nov 27 02:19:35 2012 New Revision: 243589 URL: http://svnweb.freebsd.org/changeset/base/243589 Log: Add a note about the magic values here; don't change them. Modified: head/sys/dev/ath/ath_hal/ah.h Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue Nov 27 02:18:41 2012 (r243588) +++ head/sys/dev/ath/ath_hal/ah.h Tue Nov 27 02:19:35 2012 (r243589) @@ -777,6 +777,11 @@ typedef struct { uint32_t bs_nexttbtt; /* next beacon in TU */ uint32_t bs_nextdtim; /* next DTIM in TU */ uint32_t bs_intval; /* beacon interval+flags */ +/* + * HAL_BEACON_PERIOD, HAL_BEACON_ENA and HAL_BEACON_RESET_TSF + * are all 1:1 correspondances with the pre-11n chip AR_BEACON + * register. + */ #define HAL_BEACON_PERIOD 0x0000ffff /* beacon interval period */ #define HAL_BEACON_PERIOD_TU8 0x0007ffff /* beacon interval, tu/8 */ #define HAL_BEACON_ENA 0x00800000 /* beacon xmit enable */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:23:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3A64FC6; Tue, 27 Nov 2012 02:23:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BEC918FC08; Tue, 27 Nov 2012 02:23:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2NjDs046879; Tue, 27 Nov 2012 02:23:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2Nj3B046878; Tue, 27 Nov 2012 02:23:45 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270223.qAR2Nj3B046878@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243590 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:23:46 -0000 Author: adrian Date: Tue Nov 27 02:23:45 2012 New Revision: 243590 URL: http://svnweb.freebsd.org/changeset/base/243590 Log: Fix the TDMA nexttbtt programming for 802.11n chips. The existing logic wrapped programming nexttbtt at 65535 TU. This is not good enough for the 11n chips, whose nexttbtt register (GENERIC_TIMER_0) has an initial value from 0..2^31-1 TSF. So converting the TU to TSF had the counter wrap at (65535 << 10) TSF. Once this wrap occured, the nexttbtt value was very very low, much lower than the current TSF value. At this point, the nexttbtt timer would constantly fire, leading to the TX queue being constantly gated open.. and when this occured, the sender was not correctly transmitting in its slot but just able to continuously transmit. The master would then delay transmitting its beacon until after the air became free (which I guess would be after the burst interval, before the next burst interval would quickly follow) and that big delta in master beacon TX would start causing big swings in the slot timing adjustment. With this change, the nexttbtt value is allowed to go all the way up to the maximum value permissable by the 32 bit representation. I haven't yet tested it to that point; I really should. The AR5212 HAL now filters out values above 65535 TU for the beacon configuration (and the relevant legal values for SWBA, DBA and NEXTATIM) and the AR5416 HAL just dutifully programs in what it should. With this, TDMA is now useful on the 802.11n chips. Tested: * AR5416, AR9280 TDMA slave * AR5413 TDMA slave Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 02:19:35 2012 (r243589) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 02:23:45 2012 (r243590) @@ -281,7 +281,7 @@ ath_tdma_update(struct ieee80211_node *n struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_hal *ah = sc->sc_ah; const HAL_RATE_TABLE *rt = sc->sc_currates; - u_int64_t tsf, rstamp, nextslot, nexttbtt; + u_int64_t tsf, rstamp, nextslot, nexttbtt, nexttbtt_full; u_int32_t txtime, nextslottu; int32_t tudelta, tsfdelta; const struct ath_rx_status *rs; @@ -326,7 +326,11 @@ ath_tdma_update(struct ieee80211_node *n rt->info[rix].shortPreamble); /* NB: << 9 is to cvt to TU and /2 */ nextslot = (rstamp - txtime) + (sc->sc_tdmabintval << 9); - nextslottu = TSF_TO_TU(nextslot>>32, nextslot) & HAL_BEACON_PERIOD; + /* + * For 802.11n chips: nextslottu needs to be the full TSF space, + * not just 0..65535 TU. + */ + nextslottu = TSF_TO_TU(nextslot>>32, nextslot); /* * Retrieve the hardware NextTBTT in usecs @@ -350,7 +354,16 @@ ath_tdma_update(struct ieee80211_node *n * value, tsfdelta ends up becoming very negative and all * of the adjustments get very messed up. */ - nexttbtt = ath_hal_getnexttbtt(ah) % (TU_TO_TSF(HAL_BEACON_PERIOD + 1)); + + /* + * We need to track the full nexttbtt rather than having it + * truncated at HAL_BEACON_PERIOD, as programming the + * nexttbtt (and related) registers for the 11n chips is + * actually going to take the full 32 bit space, rather than + * just 0..65535 TU. + */ + nexttbtt_full = ath_hal_getnexttbtt(ah); + nexttbtt = nexttbtt_full % (TU_TO_TSF(HAL_BEACON_PERIOD + 1)); tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, @@ -371,7 +384,7 @@ ath_tdma_update(struct ieee80211_node *n TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0); TDMA_SAMPLE(sc->sc_avgtsfdeltam, 0); } - tudelta = nextslottu - TSF_TO_TU(nexttbtt >> 32, nexttbtt); + tudelta = nextslottu - TSF_TO_TU(nexttbtt_full >> 32, nexttbtt_full); /* * Copy sender's timetstamp into tdma ie so they can From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:24:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 708331AE; Tue, 27 Nov 2012 02:24:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3BEAF8FC15; Tue, 27 Nov 2012 02:24:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2O6SD047002; Tue, 27 Nov 2012 02:24:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2O6gN047001; Tue, 27 Nov 2012 02:24:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270224.qAR2O6gN047001@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243591 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:24:06 -0000 Author: adrian Date: Tue Nov 27 02:24:05 2012 New Revision: 243591 URL: http://svnweb.freebsd.org/changeset/base/243591 Log: Add in specific TDMA logging types. Modified: head/sys/dev/ath/if_ath_alq.h Modified: head/sys/dev/ath/if_ath_alq.h ============================================================================== --- head/sys/dev/ath/if_ath_alq.h Tue Nov 27 02:23:45 2012 (r243590) +++ head/sys/dev/ath/if_ath_alq.h Tue Nov 27 02:24:05 2012 (r243591) @@ -43,6 +43,55 @@ struct if_ath_alq_init_state { #define ATH_ALQ_EDMA_RXSTATUS 3 #define ATH_ALQ_EDMA_TXDESC 4 +#define ATH_ALQ_TDMA_BEACON_STATE 5 +struct if_ath_alq_tdma_beacon_state { + uint64_t rx_tsf; /* RX TSF of beacon frame */ + uint64_t beacon_tsf; /* TSF inside beacon frame */ + uint64_t tsf64; + uint64_t nextslot_tsf; + uint32_t nextslot_tu; + uint32_t txtime; +}; + +#define ATH_ALQ_TDMA_TIMER_CONFIG 6 +struct if_ath_alq_tdma_timer_config { + uint32_t tdma_slot; + uint32_t tdma_slotlen; + uint32_t tdma_slotcnt; + uint32_t tdma_bintval; + uint32_t tdma_guard; + uint32_t tdma_scbintval; + uint32_t tdma_dbaprep; +}; + +#define ATH_ALQ_TDMA_SLOT_CALC 7 +struct if_ath_alq_tdma_slot_calc { + uint64_t nexttbtt; + uint64_t next_slot; + int32_t tsfdelta; + int32_t avg_plus; + int32_t avg_minus; +}; + +#define ATH_ALQ_TDMA_TSF_ADJUST 8 +struct if_ath_alq_tdma_tsf_adjust { + uint64_t tsf64_old; + uint64_t tsf64_new; + int32_t tsfdelta; +}; + +#define ATH_ALQ_TDMA_TIMER_SET 9 +struct if_ath_alq_tdma_timer_set { + uint32_t bt_intval; + uint32_t bt_nexttbtt; + uint32_t bt_nextdba; + uint32_t bt_nextswba; + uint32_t bt_nextatim; + uint32_t bt_flags; + uint32_t sc_tdmadbaprep; + uint32_t sc_tdmaswbaprep; +}; + /* * These will always be logged, regardless. */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:27:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 40B29341; Tue, 27 Nov 2012 02:27:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 22D4A8FC13; Tue, 27 Nov 2012 02:27:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2RVQv047760; Tue, 27 Nov 2012 02:27:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2RUEB047759; Tue, 27 Nov 2012 02:27:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270227.qAR2RUEB047759@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243592 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:27:31 -0000 Author: adrian Date: Tue Nov 27 02:27:30 2012 New Revision: 243592 URL: http://svnweb.freebsd.org/changeset/base/243592 Log: Improve the TDMA debugging: * add some further debugging prints, which are quite nice to have * add in ALQ hooks (optional!) to allow for the TDMA information to be logged in-line with the TX and RX descriptor information. Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 02:24:05 2012 (r243591) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 02:27:30 2012 (r243592) @@ -115,6 +115,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef ATH_DEBUG_ALQ +#include +#endif + #ifdef IEEE80211_SUPPORT_TDMA #include @@ -138,6 +142,43 @@ ath_tdma_settimers(struct ath_softc *sc, bt.bt_nextatim = nexttbtt+1; /* Enables TBTT, DBA, SWBA timers by default */ bt.bt_flags = 0; +#if 0 + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "%s: intval=%d (0x%08x) nexttbtt=%u (0x%08x), nextdba=%u (0x%08x), nextswba=%u (0x%08x),nextatim=%u (0x%08x)\n", + __func__, + bt.bt_intval, + bt.bt_intval, + bt.bt_nexttbtt, + bt.bt_nexttbtt, + bt.bt_nextdba, + bt.bt_nextdba, + bt.bt_nextswba, + bt.bt_nextswba, + bt.bt_nextatim, + bt.bt_nextatim); +#endif + + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_SET)) { + struct if_ath_alq_tdma_timer_set t; + t.bt_intval = htobe32(bt.bt_intval); + t.bt_nexttbtt = htobe32(bt.bt_nexttbtt); + t.bt_nextdba = htobe32(bt.bt_nextdba); + t.bt_nextswba = htobe32(bt.bt_nextswba); + t.bt_nextatim = htobe32(bt.bt_nextatim); + t.bt_flags = htobe32(bt.bt_flags); + t.sc_tdmadbaprep = htobe32(sc->sc_tdmadbaprep); + t.sc_tdmaswbaprep = htobe32(sc->sc_tdmaswbaprep); + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_SET, + sizeof(t), (char *) &t); + } + + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "%s: nexttbtt=%u (0x%08x), nexttbtt tsf=%lld (0x%08llx)\n", + __func__, + bt.bt_nexttbtt, + bt.bt_nexttbtt, + (long long) ( ((u_int64_t) (bt.bt_nexttbtt)) << 10), + (long long) ( ((u_int64_t) (bt.bt_nexttbtt)) << 10)); ath_hal_beaconsettimers(ah, &bt); } @@ -258,6 +299,23 @@ ath_tdma_config(struct ath_softc *sc, st tdma->tdma_slot, tdma->tdma_slotlen, tdma->tdma_slotcnt, tdma->tdma_bintval, sc->sc_tdmaguard, sc->sc_tdmabintval, sc->sc_tdmadbaprep); + +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_CONFIG)) { + struct if_ath_alq_tdma_timer_config t; + + t.tdma_slot = htobe32(tdma->tdma_slot); + t.tdma_slotlen = htobe32(tdma->tdma_slotlen); + t.tdma_slotcnt = htobe32(tdma->tdma_slotcnt); + t.tdma_bintval = htobe32(tdma->tdma_bintval); + t.tdma_guard = htobe32(sc->sc_tdmaguard); + t.tdma_scbintval = htobe32(sc->sc_tdmabintval); + t.tdma_dbaprep = htobe32(sc->sc_tdmadbaprep); + + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_CONFIG, + sizeof(t), (char *) &t); + } +#endif /* ATH_DEBUG_ALQ */ } /* @@ -326,11 +384,33 @@ ath_tdma_update(struct ieee80211_node *n rt->info[rix].shortPreamble); /* NB: << 9 is to cvt to TU and /2 */ nextslot = (rstamp - txtime) + (sc->sc_tdmabintval << 9); + /* * For 802.11n chips: nextslottu needs to be the full TSF space, * not just 0..65535 TU. */ nextslottu = TSF_TO_TU(nextslot>>32, nextslot); + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "rs->rstamp %llu rstamp %llu tsf %llu txtime %d, nextslot %llu, nextslottu %d, nextslottume %d\n", + (unsigned long long) rs->rs_tstamp, rstamp, tsf, txtime, nextslot, nextslottu, TSF_TO_TU(nextslot >> 32, nextslot)); + DPRINTF(sc, ATH_DEBUG_TDMA, + " beacon tstamp: %llu (0x%016llx)\n", + le64toh(ni->ni_tstamp.tsf), + le64toh(ni->ni_tstamp.tsf)); + +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE)) { + struct if_ath_alq_tdma_beacon_state t; + t.rx_tsf = htobe64(rstamp); + t.beacon_tsf = htobe64(le64toh(ni->ni_tstamp.tsf)); + t.tsf64 = htobe64(tsf); + t.nextslot_tsf = htobe64(nextslot); + t.nextslot_tu = htobe32(nextslottu); + t.txtime = htobe32(txtime); + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE, + sizeof(t), (char *) &t); + } +#endif /* * Retrieve the hardware NextTBTT in usecs @@ -354,7 +434,7 @@ ath_tdma_update(struct ieee80211_node *n * value, tsfdelta ends up becoming very negative and all * of the adjustments get very messed up. */ - + /* * We need to track the full nexttbtt rather than having it * truncated at HAL_BEACON_PERIOD, as programming the @@ -367,9 +447,27 @@ ath_tdma_update(struct ieee80211_node *n tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, - "tsfdelta %d avg +%d/-%d\n", tsfdelta, + "nexttbtt %llu (0x%08llx) tsfdelta %d avg +%d/-%d\n", + nexttbtt, + (long long) nexttbtt, + tsfdelta, TDMA_AVG(sc->sc_avgtsfdeltap), TDMA_AVG(sc->sc_avgtsfdeltam)); +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) { + struct if_ath_alq_tdma_slot_calc t; + + t.nexttbtt = htobe64(nexttbtt_full); + t.next_slot = htobe64(nextslot); + t.tsfdelta = htobe32(tsfdelta); + t.avg_plus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltap)); + t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam)); + + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC, + sizeof(t), (char *) &t); + } +#endif + if (tsfdelta < 0) { TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0); TDMA_SAMPLE(sc->sc_avgtsfdeltam, -tsfdelta); @@ -415,6 +513,11 @@ ath_tdma_update(struct ieee80211_node *n * This basically filters out jumps due to missed beacons. */ if (tudelta != 0 && (tudelta > 0 || -tudelta < sc->sc_tdmabintval)) { + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "%s: calling ath_tdma_settimers; nextslottu=%d, bintval=%d\n", + __func__, + nextslottu, + sc->sc_tdmabintval); ath_tdma_settimers(sc, nextslottu, sc->sc_tdmabintval); sc->sc_stats.ast_tdma_timers++; } @@ -424,6 +527,24 @@ ath_tdma_update(struct ieee80211_node *n /* XXX should just teach ath_hal_adjusttsf() to do this */ tsf = ath_hal_gettsf64(ah); ath_hal_settsf64(ah, tsf + tsfdelta); + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "%s: calling ath_hal_adjusttsf: TSF=%llu, tsfdelta=%d\n", + __func__, + tsf_1, + tsfdelta); + +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, + ATH_ALQ_TDMA_TSF_ADJUST)) { + struct if_ath_alq_tdma_tsf_adjust t; + + t.tsfdelta = htobe32(tsfdelta); + t.tsf64_old = htobe64(tsf_1); + t.tsf64_new = htobe64(tsf_1 + tsfdelta); + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TSF_ADJUST, + sizeof(t), (char *) &t); + } +#endif /* ATH_DEBUG_ALQ */ sc->sc_stats.ast_tdma_tsf++; } ath_tdma_beacon_send(sc, vap); /* prepare response */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 02:28:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1652A4C8; Tue, 27 Nov 2012 02:28:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED68F8FC16; Tue, 27 Nov 2012 02:28:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR2SgQ2048045; Tue, 27 Nov 2012 02:28:42 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR2SgGL048044; Tue, 27 Nov 2012 02:28:42 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270228.qAR2SgGL048044@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 02:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243593 - head/tools/tools/ath/athalq X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 02:28:43 -0000 Author: adrian Date: Tue Nov 27 02:28:42 2012 New Revision: 243593 URL: http://svnweb.freebsd.org/changeset/base/243593 Log: Add in a totally hacked up copy of the AR5416 descriptor decoding stuff, as well as TDMA related things. I used this to debug TDMA related issues in -HEAD. Added: head/tools/tools/ath/athalq/ar5416_ds_tdma.c (contents, props changed) Added: head/tools/tools/ath/athalq/ar5416_ds_tdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athalq/ar5416_ds_tdma.c Tue Nov 27 02:28:42 2012 (r243593) @@ -0,0 +1,470 @@ +/* + * Copyright (c) 2012 Adrian Chadd + * All Rights Reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "ar5416_ds.h" + +#define MS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) +#define MF(_v, _f) ( !! ((_v) & (_f))) + +static void +ar5416_decode_txstatus(struct if_ath_alq_payload *a) +{ + struct ar5416_desc txs; + static uint64_t tx_tsf = 0; + + /* XXX assumes txs is smaller than PAYLOAD_LEN! */ + memcpy(&txs, &a->payload, sizeof(struct ar5416_desc)); + + if (MF(txs.u.tx.status[9], AR_TxDone) == 0) + return; + + printf("[%u] [%llu] TXSTATUS: TxDone=%d, TS=0x%08x (delta %d)\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + MF(txs.u.tx.status[9], AR_TxDone), + txs.u.tx.status[2], + txs.u.tx.status[2] - tx_tsf); + + tx_tsf = txs.u.tx.status[2]; + +#if 0 + /* ds_txstatus0 */ + printf(" RX RSSI 0 [%d %d %d]\n", + MS(txs.u.tx.status[0], AR_TxRSSIAnt00), + MS(txs.u.tx.status[0], AR_TxRSSIAnt01), + MS(txs.u.tx.status[0], AR_TxRSSIAnt02)); + printf(" BA Valid=%d\n", + MF(txs.u.tx.status[0], AR_TxBaStatus)); + + /* ds_txstatus1 */ + printf(" Frmok=%d, xretries=%d, fifounderrun=%d, filt=%d\n", + MF(txs.u.tx.status[1], AR_FrmXmitOK), + MF(txs.u.tx.status[1], AR_ExcessiveRetries), + MF(txs.u.tx.status[1], AR_FIFOUnderrun), + MF(txs.u.tx.status[1], AR_Filtered)); + printf(" DelimUnderrun=%d, DataUnderun=%d, DescCfgErr=%d," + " TxTimerExceeded=%d\n", + MF(txs.u.tx.status[1], AR_TxDelimUnderrun), + MF(txs.u.tx.status[1], AR_TxDataUnderrun), + MF(txs.u.tx.status[1], AR_DescCfgErr), + MF(txs.u.tx.status[1], AR_TxTimerExpired)); + + printf(" RTScnt=%d, FailCnt=%d, VRetryCnt=%d\n", + MS(txs.u.tx.status[1], AR_RTSFailCnt), + MS(txs.u.tx.status[1], AR_DataFailCnt), + MS(txs.u.tx.status[1], AR_VirtRetryCnt)); + + /* ds_txstatus2 */ + printf(" TxTimestamp=0x%08x\n", txs.u.tx.status[2]); + + /* ds_txstatus3 */ + /* ds_txstatus4 */ + printf(" BALow=0x%08x\n", txs.u.tx.status[3]); + printf(" BAHigh=0x%08x\n", txs.u.tx.status[4]); + + /* ds_txstatus5 */ + printf(" RX RSSI 1 [%d %d %d] Comb=%d\n", + MS(txs.u.tx.status[5], AR_TxRSSIAnt10), + MS(txs.u.tx.status[5], AR_TxRSSIAnt11), + MS(txs.u.tx.status[5], AR_TxRSSIAnt12), + MS(txs.u.tx.status[5], AR_TxRSSICombined)); + + /* ds_txstatus6 */ + /* ds_txstatus7 */ + /* ds_txstatus8 */ + printf(" TxEVM[0]=0x%08x, TxEVM[1]=0x%08x, TxEVM[2]=0x%08x\n", + txs.u.tx.status[6], + txs.u.tx.status[7], + txs.u.tx.status[8]); + + /* ds_txstatus9 */ + printf(" TxDone=%d, SeqNum=0x%04x, TxOpExceeded=%d, FinalTsIdx=%d\n", + MF(txs.u.tx.status[9], AR_TxDone), + MS(txs.u.tx.status[9], AR_SeqNum), + MF(txs.u.tx.status[9], AR_TxOpExceeded), + MS(txs.u.tx.status[9], AR_FinalTxIdx)); + printf(" PowerMgmt=%d, TxTid=%d\n", + MF(txs.u.tx.status[9], AR_PowerMgmt), + MS(txs.u.tx.status[9], AR_TxTid)); + + printf("\n ------\n"); +#endif +} + +static void +ar5416_decode_txdesc(struct if_ath_alq_payload *a) +{ + struct ar5416_desc txc; + + /* XXX assumes txs is smaller than PAYLOAD_LEN! */ + memcpy(&txc, &a->payload, sizeof(struct ar5416_desc)); + + printf("[%u] [%llu] TXD\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid)); + +#if 0 + printf(" link=0x%08x, data=0x%08x\n", + txc.ds_link, + txc.ds_data); + + /* ds_ctl0 */ + printf(" Frame Len=%d, VMF=%d\n", + txc.ds_ctl0 & AR_FrameLen, + MF(txc.ds_ctl0, AR_VirtMoreFrag)); + printf(" TX power0=%d, RtsEna=%d, Veol=%d, ClrDstMask=%d\n", + MS(txc.ds_ctl0, AR_XmitPower), + MF(txc.ds_ctl0, AR_RTSEnable), + MF(txc.ds_ctl0, AR_VEOL), + MF(txc.ds_ctl0, AR_ClrDestMask)); + printf(" TxIntrReq=%d, DestIdxValid=%d, CtsEnable=%d\n", + MF(txc.ds_ctl0, AR_TxIntrReq), + MF(txc.ds_ctl0, AR_DestIdxValid), + MF(txc.ds_ctl0, AR_CTSEnable)); + + /* ds_ctl1 */ + printf(" BufLen=%d, TxMore=%d, DestIdx=%d," + " FrType=0x%x\n", + txc.ds_ctl1 & AR_BufLen, + MF(txc.ds_ctl1, AR_TxMore), + MS(txc.ds_ctl1, AR_DestIdx), + MS(txc.ds_ctl1, AR_FrameType)); + printf(" NoAck=%d, InsertTs=%d, CorruptFcs=%d, ExtOnly=%d," + " ExtAndCtl=%d\n", + MF(txc.ds_ctl1, AR_NoAck), + MF(txc.ds_ctl1, AR_InsertTS), + MF(txc.ds_ctl1, AR_CorruptFCS), + MF(txc.ds_ctl1, AR_ExtOnly), + MF(txc.ds_ctl1, AR_ExtAndCtl)); + printf(" MoreAggr=%d, IsAggr=%d, MoreRifs=%d\n", + MF(txc.ds_ctl1, AR_MoreAggr), + MF(txc.ds_ctl1, AR_IsAggr), + MF(txc.ds_ctl1, AR_MoreRifs)); + + /* ds_ctl2 */ + printf(" DurUpEna=%d, Burstdur=0x%04x\n", + MF(txc.ds_ctl2, AR_DurUpdateEn), + MS(txc.ds_ctl2, AR_BurstDur)); + printf(" Try0=%d, Try1=%d, Try2=%d, Try3=%d\n", + MS(txc.ds_ctl2, AR_XmitDataTries0), + MS(txc.ds_ctl2, AR_XmitDataTries1), + MS(txc.ds_ctl2, AR_XmitDataTries2), + MS(txc.ds_ctl2, AR_XmitDataTries3)); + + /* ds_ctl3 */ + printf(" rate0=0x%02x, rate1=0x%02x, rate2=0x%02x, rate3=0x%02x\n", + MS(txc.ds_ctl3, AR_XmitRate0), + MS(txc.ds_ctl3, AR_XmitRate1), + MS(txc.ds_ctl3, AR_XmitRate2), + MS(txc.ds_ctl3, AR_XmitRate3)); + + /* ds_ctl4 */ + printf(" try 0: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl4, AR_PacketDur0), + MF(txc.ds_ctl4, AR_RTSCTSQual0)); + printf(" try 1: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl4, AR_PacketDur1), + MF(txc.ds_ctl4, AR_RTSCTSQual1)); + + /* ds_ctl5 */ + printf(" try 2: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl5, AR_PacketDur2), + MF(txc.ds_ctl5, AR_RTSCTSQual2)); + printf(" try 3: PktDur=%d, RTS/CTS ena=%d\n", + MS(txc.ds_ctl5, AR_PacketDur3), + MF(txc.ds_ctl5, AR_RTSCTSQual3)); + + /* ds_ctl6 */ + printf(" AggrLen=%d, PadDelim=%d, EncrType=%d\n", + MS(txc.ds_ctl6, AR_AggrLen), + MS(txc.ds_ctl6, AR_PadDelim), + MS(txc.ds_ctl6, AR_EncrType)); + + /* ds_ctl7 */ + printf(" try 0: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl7, AR_ChainSel0), + MF(txc.ds_ctl7, AR_GI0), + MF(txc.ds_ctl7, AR_2040_0), + MF(txc.ds_ctl7, AR_STBC0)); + printf(" try 1: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl7, AR_ChainSel1), + MF(txc.ds_ctl7, AR_GI1), + MF(txc.ds_ctl7, AR_2040_1), + MF(txc.ds_ctl7, AR_STBC1)); + printf(" try 2: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl7, AR_ChainSel2), + MF(txc.ds_ctl7, AR_GI2), + MF(txc.ds_ctl7, AR_2040_2), + MF(txc.ds_ctl7, AR_STBC2)); + printf(" try 3: chainMask=0x%x, GI=%d, 2040=%d, STBC=%d\n", + MS(txc.ds_ctl7, AR_ChainSel3), + MF(txc.ds_ctl7, AR_GI3), + MF(txc.ds_ctl7, AR_2040_3), + MF(txc.ds_ctl7, AR_STBC3)); + + /* ds_ctl8 */ + printf(" try 0: ant=0x%08x\n", txc.ds_ctl8 & AR_AntCtl0); + + /* ds_ctl9 */ + printf(" try 1: TxPower=%d, ant=0x%08x\n", + MS(txc.ds_ctl9, AR_XmitPower1), + txc.ds_ctl9 & AR_AntCtl1); + + /* ds_ctl10 */ + printf(" try 2: TxPower=%d, ant=0x%08x\n", + MS(txc.ds_ctl10, AR_XmitPower2), + txc.ds_ctl10 & AR_AntCtl2); + + /* ds_ctl11 */ + printf(" try 3: TxPower=%d, ant=0x%08x\n", + MS(txc.ds_ctl11, AR_XmitPower3), + txc.ds_ctl11 & AR_AntCtl3); + + printf("\n ------ \n"); +#endif +} + +static void +ar5416_decode_rxstatus(struct if_ath_alq_payload *a) +{ + struct ar5416_desc rxs; + static uint64_t rx_tsf = 0; + + /* XXX assumes rxs is smaller than PAYLOAD_LEN! */ + memcpy(&rxs, &a->payload, sizeof(struct ar5416_desc)); + + if (MF(rxs.ds_rxstatus8, AR_RxDone) == 0) + return; + + printf("[%u] [%llu] RXSTATUS: RxDone=%d, TS=0x%08x (delta %d)\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + MF(rxs.ds_rxstatus8, AR_RxDone), + rxs.ds_rxstatus2, + rxs.ds_rxstatus2 - rx_tsf); + + rx_tsf = rxs.ds_rxstatus2; + +#if 0 + printf(" link=0x%08x, data=0x%08x, ctl0=0x%08x, ctl2=0x%08x\n", + rxs.ds_link, + rxs.ds_data, + rxs.ds_ctl0, + rxs.ds_ctl1); + + /* status0 */ + /* + * XXX TODO: For AR9285, the chain 1 and chain 2 RSSI values + * acutally contain the RX mixer configuration + */ + printf(" RSSICtl[0]=%d, RSSICtl[1]=%d, RSSICtl[2]=%d\n", + MS(rxs.ds_rxstatus0, AR_RxRSSIAnt00), + MS(rxs.ds_rxstatus0, AR_RxRSSIAnt01), + MS(rxs.ds_rxstatus0, AR_RxRSSIAnt02)); + + /* status1 */ + printf(" DataLen=%d, RxMore=%d, NumDelim=%d\n", + rxs.ds_rxstatus1 & AR_DataLen, + MF(rxs.ds_rxstatus1, AR_RxMore), + MS(rxs.ds_rxstatus1, AR_NumDelim)); + + /* status2 */ + printf(" RxTimestamp=0x%08x\n", rxs.ds_rxstatus2); + + /* status3 - RxRate however is for Owl 2.0 */ + printf(" GI=%d, 2040=%d, RxRate=0x%02x, DupFrame=%d, RxAnt=0x%08x\n", + MF(rxs.ds_rxstatus3, AR_GI), + MF(rxs.ds_rxstatus3, AR_2040), + MS(rxs.ds_rxstatus0, AR_RxRate), + MF(rxs.ds_rxstatus3, AR_DupFrame), + MS(rxs.ds_rxstatus3, AR_RxAntenna)); + + /* status4 */ + printf(" RSSIExt[0]=%d, RSSIExt[1]=%d, RSSIExt[2]=%d, RSSIComb=%d\n", + MS(rxs.ds_rxstatus4, AR_RxRSSIAnt10), + MS(rxs.ds_rxstatus4, AR_RxRSSIAnt11), + MS(rxs.ds_rxstatus4, AR_RxRSSIAnt12), + MS(rxs.ds_rxstatus4, AR_RxRSSICombined)); + + /* status5 */ + /* status6 */ + /* status7 */ + printf(" RxEvm0=0x%08x, RxEvm1=0x%08x, RxEvm2=0x%08x\n", + rxs.ds_rxstatus5, + rxs.ds_rxstatus6, + rxs.ds_rxstatus7); + + /* status8 */ + printf(" RxDone=%d, RxFrameOk=%d, CrcErr=%d, DecryptCrcErr=%d\n", + MF(rxs.ds_rxstatus8, AR_RxDone), + MF(rxs.ds_rxstatus8, AR_RxFrameOK), + MF(rxs.ds_rxstatus8, AR_CRCErr), + MF(rxs.ds_rxstatus8, AR_DecryptCRCErr)); + printf(" PhyErr=%d, MichaelErr=%d, PreDelimCRCErr=%d, KeyIdxValid=%d\n", + MF(rxs.ds_rxstatus8, AR_PHYErr), + MF(rxs.ds_rxstatus8, AR_MichaelErr), + MF(rxs.ds_rxstatus8, AR_PreDelimCRCErr), + MF(rxs.ds_rxstatus8, AR_RxKeyIdxValid)); + + /* If PHY error, print that out. Otherwise, the key index */ + if (MF(rxs.ds_rxstatus8, AR_PHYErr)) + printf(" PhyErrCode=0x%02x\n", + MS(rxs.ds_rxstatus8, AR_PHYErrCode)); + else + printf(" KeyIdx=0x%02x\n", + MS(rxs.ds_rxstatus8, AR_KeyIdx)); + + printf(" RxMoreAggr=%d, RxAggr=%d, PostDelimCRCErr=%d, HiRxChain=%d\n", + MF(rxs.ds_rxstatus8, AR_RxMoreAggr), + MF(rxs.ds_rxstatus8, AR_RxAggr), + MF(rxs.ds_rxstatus8, AR_PostDelimCRCErr), + MF(rxs.ds_rxstatus8, AR_HiRxChain)); + printf(" KeyMiss=%d\n", + MF(rxs.ds_rxstatus8, AR_KeyMiss)); + + printf("\n ------\n"); +#endif +} + +static void +ath_tdma_beacon_state(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_beacon_state t; + static uint64_t last_beacon_tx = 0; + + memcpy(&t, &a->payload, sizeof(t)); + + printf("[%u] [%llu] BEACON: RX TSF=%llu Beacon TSF=%llu (%d)\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.rx_tsf), + (unsigned long long) be64toh(t.beacon_tsf), + be64toh(t.beacon_tsf) - last_beacon_tx); + + last_beacon_tx = be64toh(t.beacon_tsf); +} + +static void +ath_tdma_timer_config(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_timer_config t; + + memcpy(&t, &a->payload, sizeof(t)); +} + +static void +ath_tdma_slot_calc(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_slot_calc t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u] [%llu] SLOTCALC: NEXTTBTT=%llu nextslot=%llu tsfdelta=%d avg (%d/%d)\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.nexttbtt), + (unsigned long long) be64toh(t.next_slot), + (int) be32toh(t.tsfdelta), + (int) be32toh(t.avg_plus), + (int) be32toh(t.avg_minus)); +} + +static void +ath_tdma_tsf_adjust(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_tsf_adjust t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u] [%llu] TSFADJUST: TSF64 was %llu, adj=%d, now %llu\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned long long) be64toh(t.tsf64_old), + (int) be32toh(t.tsfdelta), + (unsigned long long) be64toh(t.tsf64_new)); +} + +static void +ath_tdma_timer_set(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tdma_timer_set t; + + memcpy(&t, &a->payload, sizeof(t)); + printf("[%u] [%llu] TIMERSET: bt_intval=%d nexttbtt=%d nextdba=%d nextswba=%d nextatim=%d flags=0x%x tdmadbaprep=%d tdmaswbaprep=%d\n", + (unsigned int) be32toh(a->hdr.tstamp), + (unsigned long long) be64toh(a->hdr.threadid), + be32toh(t.bt_intval), + be32toh(t.bt_nexttbtt), + be32toh(t.bt_nextdba), + be32toh(t.bt_nextswba), + be32toh(t.bt_nextatim), + be32toh(t.bt_flags), + be32toh(t.sc_tdmadbaprep), + be32toh(t.sc_tdmaswbaprep)); +} + +void +ar5416_alq_payload(struct if_ath_alq_payload *a) +{ + + switch (be16toh(a->hdr.op)) { + case ATH_ALQ_EDMA_TXSTATUS: /* TXSTATUS */ + ar5416_decode_txstatus(a); + break; + case ATH_ALQ_EDMA_RXSTATUS: /* RXSTATUS */ + ar5416_decode_rxstatus(a); + break; + case ATH_ALQ_EDMA_TXDESC: /* TXDESC */ + ar5416_decode_txdesc(a); + break; + case ATH_ALQ_TDMA_BEACON_STATE: + ath_tdma_beacon_state(a); + break; + case ATH_ALQ_TDMA_TIMER_CONFIG: + ath_tdma_timer_config(a); + break; + case ATH_ALQ_TDMA_SLOT_CALC: + ath_tdma_slot_calc(a); + break; + case ATH_ALQ_TDMA_TSF_ADJUST: + ath_tdma_tsf_adjust(a); + break; + case ATH_ALQ_TDMA_TIMER_SET: + ath_tdma_timer_set(a); + break; + default: + printf("[%d] [%lld] op: %d; len %d\n", + be32toh(a->hdr.tstamp), + be64toh(a->hdr.threadid), + be16toh(a->hdr.op), be16toh(a->hdr.len)); + } +} From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 03:04:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 540E3CF1; Tue, 27 Nov 2012 03:04:25 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 39A768FC08; Tue, 27 Nov 2012 03:04:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR34PtI056692; Tue, 27 Nov 2012 03:04:25 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR34PfD056691; Tue, 27 Nov 2012 03:04:25 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201211270304.qAR34PfD056691@svn.freebsd.org> From: Alfred Perlstein Date: Tue, 27 Nov 2012 03:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243594 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 03:04:25 -0000 Author: alfred Date: Tue Nov 27 03:04:24 2012 New Revision: 243594 URL: http://svnweb.freebsd.org/changeset/base/243594 Log: Auto size the tcbhashsize structure based on max sockets. While here, also make the code that enforces power-of-two more forgiving, instead of just resetting to 512, graciously round-down to the next lower power of two. Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Tue Nov 27 02:28:42 2012 (r243593) +++ head/sys/netinet/tcp_subr.c Tue Nov 27 03:04:24 2012 (r243594) @@ -235,7 +235,7 @@ static char * tcp_log_addr(struct in_con * variable net.inet.tcp.tcbhashsize */ #ifndef TCBHASHSIZE -#define TCBHASHSIZE 512 +#define TCBHASHSIZE 0 #endif /* @@ -282,11 +282,35 @@ tcp_inpcb_init(void *mem, int size, int return (0); } +/* + * Take a value and get the next power of 2 that doesn't overflow. + * Used to size the tcp_inpcb hash buckets. + */ +static int +maketcp_hashsize(int size) +{ + int hashsize; + + /* + * auto tune. + * get the next power of 2 higher than maxsockets. + */ + hashsize = 1 << fls(size); + /* catch overflow, and just go one power of 2 smaller */ + if (hashsize < size) { + hashsize = 1 << (fls(size) - 1); + } + return (hashsize); +} + void tcp_init(void) { + const char *tcbhash_tuneable; int hashsize; + tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; + if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, &V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) printf("%s: WARNING: unable to register helper hook\n", __func__); @@ -295,10 +319,43 @@ tcp_init(void) printf("%s: WARNING: unable to register helper hook\n", __func__); hashsize = TCBHASHSIZE; - TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &hashsize); + TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); + if (hashsize == 0) { + /* + * Auto tune the hash size based on maxsockets. + * A perfect hash would have a 1:1 mapping + * (hashsize = maxsockets) however it's been + * suggested that O(2) average is better. + */ + hashsize = maketcp_hashsize(maxsockets / 4); + /* + * Our historical default is 512, + * do not autotune lower than this. + */ + if (hashsize < 512) + hashsize = 512; + if (bootverbose) + printf("%s: %s auto tuned to %d\n", __func__, + tcbhash_tuneable, hashsize); + } + /* + * We require a hashsize to be a power of two. + * Previously if it was not a power of two we would just reset it + * back to 512, which could be a nasty surprise if you did not notice + * the error message. + * Instead what we do is clip it to the closest power of two lower + * than the specified hash value. + */ if (!powerof2(hashsize)) { - printf("WARNING: TCB hash size not a power of 2\n"); - hashsize = 512; /* safe default */ + int oldhashsize = hashsize; + + hashsize = maketcp_hashsize(hashsize); + /* prevent absurdly low value */ + if (hashsize < 16) + hashsize = 16; + printf("%s: WARNING: TCB hash size not a power of 2, " + "clipped from %d to %d.\n", __func__, oldhashsize, + hashsize); } in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, hashsize, hashsize, "tcp_inpcb", tcp_inpcb_init, NULL, UMA_ZONE_NOFREE, From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 05:52:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0684EB9; Tue, 27 Nov 2012 05:52:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD0B48FC08; Tue, 27 Nov 2012 05:52:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR5q8FX090942; Tue, 27 Nov 2012 05:52:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR5q8jt090941; Tue, 27 Nov 2012 05:52:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270552.qAR5q8jt090941@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 05:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243597 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 05:52:09 -0000 Author: adrian Date: Tue Nov 27 05:52:08 2012 New Revision: 243597 URL: http://svnweb.freebsd.org/changeset/base/243597 Log: Fix build Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 05:48:36 2012 (r243596) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 05:52:08 2012 (r243597) @@ -158,6 +158,7 @@ ath_tdma_settimers(struct ath_softc *sc, bt.bt_nextatim); #endif +#ifdef ATH_DEBUG_ALQ if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_SET)) { struct if_ath_alq_tdma_timer_set t; t.bt_intval = htobe32(bt.bt_intval); @@ -171,6 +172,7 @@ ath_tdma_settimers(struct ath_softc *sc, if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TIMER_SET, sizeof(t), (char *) &t); } +#endif DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, "%s: nexttbtt=%u (0x%08x), nexttbtt tsf=%lld (0x%08llx)\n", From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 06:08:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0F11A8AD; Tue, 27 Nov 2012 06:07:58 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF8358FC0C; Tue, 27 Nov 2012 06:07:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR67wKt094154; Tue, 27 Nov 2012 06:07:58 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR67w6O094153; Tue, 27 Nov 2012 06:07:58 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201211270607.qAR67w6O094153@svn.freebsd.org> From: David Xu Date: Tue, 27 Nov 2012 06:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243599 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 06:08:00 -0000 Author: davidxu Date: Tue Nov 27 06:07:58 2012 New Revision: 243599 URL: http://svnweb.freebsd.org/changeset/base/243599 Log: Take first active vnode correctly. Reviewed by: kib MFC after: 3 days Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Nov 27 06:01:02 2012 (r243598) +++ head/sys/kern/vfs_subr.c Tue Nov 27 06:07:58 2012 (r243599) @@ -4755,7 +4755,7 @@ __mnt_vnode_first_active(struct vnode ** MNT_REF(mp); (*mvp)->v_type = VMARKER; - vp = TAILQ_NEXT(*mvp, v_actfreelist); + vp = TAILQ_FIRST(&mp->mnt_activevnodelist); while (vp != NULL) { VI_LOCK(vp); if (vp->v_mount == mp && vp->v_type != VMARKER && From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 06:35:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E779CDE3; Tue, 27 Nov 2012 06:35:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C35EC8FC14; Tue, 27 Nov 2012 06:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR6ZQLA099492; Tue, 27 Nov 2012 06:35:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR6ZQPE099491; Tue, 27 Nov 2012 06:35:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201211270635.qAR6ZQPE099491@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 27 Nov 2012 06:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243601 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 06:35:27 -0000 Author: glebius Date: Tue Nov 27 06:35:26 2012 New Revision: 243601 URL: http://svnweb.freebsd.org/changeset/base/243601 Log: Better safe than sorry: reinitialize eh after ng_ether(4) and if_bridge(4) processing, since mbuf may be modified there. Submitted by: youngari Modified: head/sys/net/if_ethersubr.c Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Tue Nov 27 06:20:40 2012 (r243600) +++ head/sys/net/if_ethersubr.c Tue Nov 27 06:35:26 2012 (r243601) @@ -593,6 +593,7 @@ ether_input_internal(struct ifnet *ifp, CURVNET_RESTORE(); return; } + eh = mtod(m, struct ether_header *); } /* @@ -607,6 +608,7 @@ ether_input_internal(struct ifnet *ifp, CURVNET_RESTORE(); return; } + eh = mtod(m, struct ether_header *); } #if defined(INET) || defined(INET6) From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 06:39:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58AD493; Tue, 27 Nov 2012 06:39:33 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4548FC08; Tue, 27 Nov 2012 06:39:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR6dXG4000342; Tue, 27 Nov 2012 06:39:33 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR6dXMD000341; Tue, 27 Nov 2012 06:39:33 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211270639.qAR6dXMD000341@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 27 Nov 2012 06:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243602 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 06:39:33 -0000 Author: gonzo Date: Tue Nov 27 06:39:32 2012 New Revision: 243602 URL: http://svnweb.freebsd.org/changeset/base/243602 Log: Do not enable data cache until later in kernel init. Stale bits in cache might cause erroneus behavior on early stage. Submitted by: Ian Lepore Tested on: Atmel, Marvell, and Eyxnos Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Tue Nov 27 06:35:26 2012 (r243601) +++ head/sys/arm/arm/locore.S Tue Nov 27 06:39:32 2012 (r243602) @@ -181,7 +181,7 @@ Lunmapped: #if defined(CPU_ARM11) || defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) orr r0, r0, #CPU_CONTROL_V6_EXTPAGE #endif - orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE) + orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) mcr p15, 0, r0, c1, c0, 0 nop nop From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 06:42:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A5EA3FD; Tue, 27 Nov 2012 06:42:45 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6188FC15; Tue, 27 Nov 2012 06:42:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR6gjkH001057; Tue, 27 Nov 2012 06:42:45 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR6gjSn001056; Tue, 27 Nov 2012 06:42:45 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211270642.qAR6gjSn001056@svn.freebsd.org> From: Navdeep Parhar Date: Tue, 27 Nov 2012 06:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243603 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 06:42:45 -0000 Author: np Date: Tue Nov 27 06:42:44 2012 New Revision: 243603 URL: http://svnweb.freebsd.org/changeset/base/243603 Log: Make sure that tcp_timer_activate() correctly sees TCP_OFFLOAD (or not). Modified: head/sys/netinet/tcp_timer.c Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Tue Nov 27 06:39:32 2012 (r243602) +++ head/sys/netinet/tcp_timer.c Tue Nov 27 06:42:44 2012 (r243603) @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_inet6.h" #include "opt_tcpdebug.h" From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 08:40:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A90ACDE; Tue, 27 Nov 2012 08:40:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 60B1C8FC0C; Tue, 27 Nov 2012 08:40:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAR8ensr022856; Tue, 27 Nov 2012 08:40:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAR8enm5022855; Tue, 27 Nov 2012 08:40:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211270840.qAR8enm5022855@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 08:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243606 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 08:40:49 -0000 Author: adrian Date: Tue Nov 27 08:40:48 2012 New Revision: 243606 URL: http://svnweb.freebsd.org/changeset/base/243606 Log: Correct some debugging output. Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 08:32:12 2012 (r243605) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 08:40:48 2012 (r243606) @@ -532,7 +532,7 @@ ath_tdma_update(struct ieee80211_node *n DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, "%s: calling ath_hal_adjusttsf: TSF=%llu, tsfdelta=%d\n", __func__, - tsf_1, + tsf, tsfdelta); #ifdef ATH_DEBUG_ALQ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 09:59:16 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E637B152; Tue, 27 Nov 2012 09:59:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB228FC13; Tue, 27 Nov 2012 09:59:15 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA10777; Tue, 27 Nov 2012 11:59:07 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TdHwZ-000NPL-Iv; Tue, 27 Nov 2012 11:59:07 +0200 Message-ID: <50B48EE9.1090506@FreeBSD.org> Date: Tue, 27 Nov 2012 11:59:05 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: David Xu Subject: Re: svn commit: r243599 - head/sys/kern References: <201211270607.qAR67w6O094153@svn.freebsd.org> In-Reply-To: <201211270607.qAR67w6O094153@svn.freebsd.org> X-Enigmail-Version: 1.4.6 Mail-Followup-To: David Xu , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org, Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 09:59:17 -0000 on 27/11/2012 08:07 David Xu said the following: > Author: davidxu > Date: Tue Nov 27 06:07:58 2012 > New Revision: 243599 > URL: http://svnweb.freebsd.org/changeset/base/243599 > > Log: > Take first active vnode correctly. > > Reviewed by: kib > MFC after: 3 days > > Modified: > head/sys/kern/vfs_subr.c > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Tue Nov 27 06:01:02 2012 (r243598) > +++ head/sys/kern/vfs_subr.c Tue Nov 27 06:07:58 2012 (r243599) > @@ -4755,7 +4755,7 @@ __mnt_vnode_first_active(struct vnode ** > MNT_REF(mp); > (*mvp)->v_type = VMARKER; > > - vp = TAILQ_NEXT(*mvp, v_actfreelist); > + vp = TAILQ_FIRST(&mp->mnt_activevnodelist); > while (vp != NULL) { > VI_LOCK(vp); > if (vp->v_mount == mp && vp->v_type != VMARKER && > Oh, wow, did this even work before? Did it always just return NULL and no active list iteration happened? -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:11:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8627AA4D; Tue, 27 Nov 2012 10:11:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6BED48FC0C; Tue, 27 Nov 2012 10:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARABso0039677; Tue, 27 Nov 2012 10:11:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARABsUZ039675; Tue, 27 Nov 2012 10:11:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271011.qARABsUZ039675@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243607 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:11:54 -0000 Author: pjd Date: Tue Nov 27 10:11:54 2012 New Revision: 243607 URL: http://svnweb.freebsd.org/changeset/base/243607 Log: Style fixes (mostly whitespaces). Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 08:40:48 2012 (r243606) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:11:54 2012 (r243607) @@ -128,8 +128,8 @@ struct filterops sig_filtops = { }; static int kern_logsigexit = 1; -SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, - &kern_logsigexit, 0, +SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, + &kern_logsigexit, 0, "Log processes quitting on abnormal signals to syslog(3)"); static int kern_forcesigexit = 1; @@ -171,7 +171,7 @@ SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDE (cr1)->cr_uid == (cr2)->cr_uid) static int sugid_coredump; -SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, +SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); static int do_coredump = 1; @@ -284,9 +284,9 @@ sigqueue_init(sigqueue_t *list, struct p /* * Get a signal's ksiginfo. * Return: - * 0 - signal not found + * 0 - signal not found * others - signal number - */ + */ static int sigqueue_get(sigqueue_t *sq, int signo, ksiginfo_t *si) { @@ -357,7 +357,7 @@ sigqueue_add(sigqueue_t *sq, int signo, int ret = 0; KASSERT(sq->sq_flags & SQ_INIT, ("sigqueue not inited")); - + if (signo == SIGKILL || signo == SIGSTOP || si == NULL) { SIGADDSET(sq->sq_kill, signo); goto out_set_bit; @@ -377,7 +377,7 @@ sigqueue_add(sigqueue_t *sq, int signo, SIGADDSET(sq->sq_kill, signo); goto out_set_bit; } - + if (p != NULL && p->p_pendingcnt >= max_pending_per_proc) { signal_overflow++; ret = EAGAIN; @@ -406,7 +406,7 @@ sigqueue_add(sigqueue_t *sq, int signo, if (ret != 0) return (ret); - + out_set_bit: SIGADDSET(sq->sq_signals, signo); return (ret); @@ -1158,7 +1158,7 @@ sys_sigwaitinfo(struct thread *td, struc if (uap->info) error = copyout(&ksi.ksi_info, uap->info, sizeof(siginfo_t)); - + if (error == 0) td->td_retval[0] = ksi.ksi_signo; return (error); @@ -1184,7 +1184,7 @@ kern_sigtimedwait(struct thread *td, sig if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; getnanouptime(&rts); - ets = rts; + ets = rts; timespecadd(&ets, timeout); } } @@ -1201,7 +1201,7 @@ kern_sigtimedwait(struct thread *td, sig mtx_unlock(&ps->ps_mtx); if (sig != 0 && SIGISMEMBER(waitset, sig)) { if (sigqueue_get(&td->td_sigqueue, sig, ksi) != 0 || - sigqueue_get(&p->p_sigqueue, sig, ksi) != 0) { + sigqueue_get(&p->p_sigqueue, sig, ksi) != 0) { error = 0; break; } @@ -1257,7 +1257,7 @@ kern_sigtimedwait(struct thread *td, sig if (error == 0) { SDT_PROBE(proc, kernel, , signal_clear, sig, ksi, 0, 0, 0); - + if (ksi->ksi_code == SI_TIMER) itimer_accept(p, ksi->ksi_timerid, ksi); @@ -1407,7 +1407,7 @@ osigsetmask(td, uap) /* * Suspend calling thread until signal, providing mask to be set in the - * meantime. + * meantime. */ #ifndef _SYS_SYSPROTO_H_ struct sigsuspend_args { @@ -1643,7 +1643,7 @@ killpg1(struct thread *td, int sig, int } sx_sunlock(&proctree_lock); LIST_FOREACH(p, &pgrp->pg_members, p_pglist) { - PROC_LOCK(p); + PROC_LOCK(p); if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || p->p_state == PRS_NEW) { PROC_UNLOCK(p); @@ -1881,7 +1881,7 @@ trapsignal(struct thread *td, ksiginfo_t ktrpsig(sig, ps->ps_sigact[_SIG_IDX(sig)], &td->td_sigmask, code); #endif - (*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], + (*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], ksi, &td->td_sigmask); mask = ps->ps_catchmask[_SIG_IDX(sig)]; if (!SIGISMEMBER(ps->ps_signodefer, sig)) @@ -1958,7 +1958,7 @@ sigtd(struct proc *p, int sig, int prop) * regardless of the signal action (eg, blocked or ignored). * * Other ignored signals are discarded immediately. - * + * * NB: This function may be entered from the debugger via the "kill" DDB * command. There is little that can be done to mitigate the possibly messy * side effects of this unwise possibility. @@ -2593,14 +2593,15 @@ issignal(struct thread *td, int stop_all * If parent wants us to take the signal, * then it will leave it in p->p_xstat; * otherwise we just look for signals again. - */ + */ if (newsig == 0) continue; sig = newsig; /* * Put the new signal into td_sigqueue. If the - * signal is being masked, look for other signals. + * signal is being masked, look for other + * signals. */ sigqueue_add(queue, sig, NULL); if (SIGISMEMBER(td->td_sigmask, sig)) @@ -2660,7 +2661,7 @@ issignal(struct thread *td, int stop_all */ if (prop & SA_STOP) { if (p->p_flag & (P_TRACED|P_WEXIT) || - (p->p_pgrp->pg_jobc == 0 && + (p->p_pgrp->pg_jobc == 0 && prop & SA_TTYSTOP)) break; /* == ignore */ @@ -2706,7 +2707,7 @@ issignal(struct thread *td, int stop_all */ return (sig); } - sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ + sigqueue_delete(&td->td_sigqueue, sig); /* take the signal! */ sigqueue_delete(&p->p_sigqueue, sig); } /* NOTREACHED */ @@ -2732,7 +2733,7 @@ thread_stopped(struct proc *p) PROC_SLOCK(p); } } - + /* * Take the action for the specified signal * from the current set of pending signals. @@ -2997,7 +2998,7 @@ sysctl_debug_num_cores_check (SYSCTL_HAN num_cores = new_val; return (0); } -SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, +SYSCTL_PROC(_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(int), sysctl_debug_num_cores_check, "I", ""); #if defined(COMPRESS_USER_CORES) @@ -3009,8 +3010,8 @@ int compress_user_cores_gzlevel = -1; /* SYSCTL_INT(_kern, OID_AUTO, compress_user_cores_gzlevel, CTLFLAG_RW, &compress_user_cores_gzlevel, -1, "user core gz compression level"); -#define GZ_SUFFIX ".gz" -#define GZ_SUFFIX_LEN 3 +#define GZ_SUFFIX ".gz" +#define GZ_SUFFIX_LEN 3 #endif static char corefilename[MAXPATHLEN] = {"%N.core"}; @@ -3038,7 +3039,7 @@ expand_name(const char *name, uid_t uid, size_t i; int indexpos; char *hostname; - + hostname = NULL; format = corefilename; temp = malloc(MAXPATHLEN, M_TEMP, M_NOWAIT | M_ZERO); @@ -3086,7 +3087,7 @@ expand_name(const char *name, uid_t uid, sbuf_printf(&sb, "%u", uid); break; default: - log(LOG_ERR, + log(LOG_ERR, "Unknown format character %c in " "corename `%s'\n", format[i], format); } @@ -3127,12 +3128,11 @@ nomem: for (n = 0; n < num_cores; n++) { temp[indexpos] = '0' + n; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, - temp, td); + temp, td); error = vn_open(&nd, &flags, cmode, NULL); if (error) { - if (error == EEXIST) { + if (error == EEXIST) continue; - } log(LOG_ERR, "pid %d (%s), uid (%u): Path `%s' failed " "on initial open test, error = %d\n", @@ -3199,7 +3199,8 @@ coredump(struct thread *td) #endif return (EINVAL); } - if (((sugid_coredump == 0) && p->p_flag & P_SUGID) || do_coredump == 0) { + if (((sugid_coredump == 0) && p->p_flag & P_SUGID) || + do_coredump == 0) { PROC_UNLOCK(p); #ifdef AUDIT audit_proc_coredump(td, name, EFAULT); @@ -3207,7 +3208,7 @@ coredump(struct thread *td) free(name, M_TEMP); return (EFAULT); } - + /* * Note that the bulk of limit checking is done after * the corefile is created. The exception is if the limit @@ -3280,9 +3281,12 @@ restart: p->p_acflag |= ACORE; PROC_UNLOCK(p); - error = p->p_sysent->sv_coredump ? - p->p_sysent->sv_coredump(td, vp, limit, compress ? IMGACT_CORE_COMPRESS : 0) : - ENOSYS; + if (p->p_sysent->sv_coredump != NULL) { + error = p->p_sysent->sv_coredump(td, vp, limit, + compress ? IMGACT_CORE_COMPRESS : 0); + } else { + error = ENOSYS; + } if (locked) { lf.l_type = F_UNLCK; @@ -3389,7 +3393,7 @@ filt_sigdetach(struct knote *kn) } /* - * signal knotes are shared with proc knotes, so we apply a mask to + * signal knotes are shared with proc knotes, so we apply a mask to * the hint in order to differentiate them from process hints. This * could be avoided by using a signal-specific knote list, but probably * isn't worth the trouble. From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:15:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C78BAC0B; Tue, 27 Nov 2012 10:15:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ACB2C8FC13; Tue, 27 Nov 2012 10:15:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAFwIO040469; Tue, 27 Nov 2012 10:15:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAFwr1040468; Tue, 27 Nov 2012 10:15:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271015.qARAFwr1040468@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243608 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:15:58 -0000 Author: pjd Date: Tue Nov 27 10:15:58 2012 New Revision: 243608 URL: http://svnweb.freebsd.org/changeset/base/243608 Log: More style fixes. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 10:11:54 2012 (r243607) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:15:58 2012 (r243608) @@ -2838,10 +2838,10 @@ killproc(p, why) { PROC_LOCK_ASSERT(p, MA_OWNED); - CTR3(KTR_PROC, "killproc: proc %p (pid %d, %s)", - p, p->p_pid, p->p_comm); - log(LOG_ERR, "pid %d (%s), uid %d, was killed: %s\n", p->p_pid, p->p_comm, - p->p_ucred ? p->p_ucred->cr_uid : -1, why); + CTR3(KTR_PROC, "killproc: proc %p (pid %d, %s)", p, p->p_pid, + p->p_comm); + log(LOG_ERR, "pid %d (%s), uid %d, was killed: %s\n", p->p_pid, + p->p_comm, p->p_ucred ? p->p_ucred->cr_uid : -1, why); p->p_flag |= P_WKILLED; kern_psignal(p, SIGKILL); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:16:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C028ED88; Tue, 27 Nov 2012 10:16:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A4F628FC12; Tue, 27 Nov 2012 10:16:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAGm6Y040648; Tue, 27 Nov 2012 10:16:48 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAGmT5040647; Tue, 27 Nov 2012 10:16:48 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271016.qARAGmT5040647@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243609 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:16:48 -0000 Author: pjd Date: Tue Nov 27 10:16:48 2012 New Revision: 243609 URL: http://svnweb.freebsd.org/changeset/base/243609 Log: Allow to modify kern.sugid_coredump and kern.corefile from loader.conf. Obtained from: WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 10:15:58 2012 (r243608) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:16:48 2012 (r243609) @@ -171,6 +171,7 @@ SYSINIT(signal, SI_SUB_P1003_1B, SI_ORDE (cr1)->cr_uid == (cr2)->cr_uid) static int sugid_coredump; +TUNABLE_INT("kern.sugid_coredump", &sugid_coredump); SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); @@ -3015,6 +3016,7 @@ SYSCTL_INT(_kern, OID_AUTO, compress_use #endif static char corefilename[MAXPATHLEN] = {"%N.core"}; +TUNABLE_STR("kern.corefile", corefilename, sizeof(corefilename)); SYSCTL_STRING(_kern, OID_AUTO, corefile, CTLFLAG_RW, corefilename, sizeof(corefilename), "process corefile name format string"); From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:22:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98268F60; Tue, 27 Nov 2012 10:22:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5FBCD8FC08; Tue, 27 Nov 2012 10:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAMfFO041663; Tue, 27 Nov 2012 10:22:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAMfUi041661; Tue, 27 Nov 2012 10:22:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271022.qARAMfUi041661@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243610 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:22:41 -0000 Author: pjd Date: Tue Nov 27 10:22:40 2012 New Revision: 243610 URL: http://svnweb.freebsd.org/changeset/base/243610 Log: Allow to use kill(2) in capability mode, but process can send a signal only to himself. For example abort(3) at first tries to do kill(getpid(), SIGABRT) which was failing in capability mode, so the code was failing back to exit(1). Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks Modified: head/sys/kern/capabilities.conf head/sys/kern/kern_sig.c Modified: head/sys/kern/capabilities.conf ============================================================================== --- head/sys/kern/capabilities.conf Tue Nov 27 10:16:48 2012 (r243609) +++ head/sys/kern/capabilities.conf Tue Nov 27 10:22:40 2012 (r243610) @@ -337,6 +337,11 @@ issetugid kevent ## +## Allow kill(2), as we allow the process to send signals only to himself. +## +kill + +## ## Allow message queue operations on file descriptors, subject to capability ## rights. ## Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 10:16:48 2012 (r243609) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:22:40 2012 (r243610) @@ -1679,6 +1679,14 @@ sys_kill(struct thread *td, struct kill_ struct proc *p; int error; + /* + * A process in capability mode can send signals only to himself. + * The main rationale behind this is that abort(3) is implemented as + * kill(getpid(), SIGABRT). + */ + if (IN_CAPABILITY_MODE(td) && uap->pid != td->td_proc->p_pid) + return (ECAPMODE); + AUDIT_ARG_SIGNUM(uap->signum); AUDIT_ARG_PID(uap->pid); if ((u_int)uap->signum > _SIG_MAXSIG) From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:25:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 576F4165; Tue, 27 Nov 2012 10:25:04 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3C76B8FC13; Tue, 27 Nov 2012 10:25:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAP4kr042117; Tue, 27 Nov 2012 10:25:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAP4Z3042116; Tue, 27 Nov 2012 10:25:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271025.qARAP4Z3042116@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243611 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:25:04 -0000 Author: pjd Date: Tue Nov 27 10:25:03 2012 New Revision: 243611 URL: http://svnweb.freebsd.org/changeset/base/243611 Log: Regenerate after r243610. Modified: head/sys/kern/init_sysent.c Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Tue Nov 27 10:22:40 2012 (r243610) +++ head/sys/kern/init_sysent.c Tue Nov 27 10:25:03 2012 (r243611) @@ -71,7 +71,7 @@ struct sysent sysent[] = { { AS(chflags_args), (sy_call_t *)sys_chflags, AUE_CHFLAGS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 34 = chflags */ { AS(fchflags_args), (sy_call_t *)sys_fchflags, AUE_FCHFLAGS, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = fchflags */ { 0, (sy_call_t *)sys_sync, AUE_SYNC, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = sync */ - { AS(kill_args), (sy_call_t *)sys_kill, AUE_KILL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 37 = kill */ + { AS(kill_args), (sy_call_t *)sys_kill, AUE_KILL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = kill */ { compat(AS(ostat_args),stat), AUE_STAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 38 = old stat */ { 0, (sy_call_t *)sys_getppid, AUE_GETPPID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = getppid */ { compat(AS(olstat_args),lstat), AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 40 = old lstat */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:32:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A207E4D9; Tue, 27 Nov 2012 10:32:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 894E18FC12; Tue, 27 Nov 2012 10:32:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAWZvB043510; Tue, 27 Nov 2012 10:32:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAWZDR043506; Tue, 27 Nov 2012 10:32:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271032.qARAWZDR043506@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243612 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:32:35 -0000 Author: pjd Date: Tue Nov 27 10:32:35 2012 New Revision: 243612 URL: http://svnweb.freebsd.org/changeset/base/243612 Log: - Add NOCAPCHECK flag to namei that allows lookup to work even if the process is in capability mode. - Add VN_OPEN_NOCAPCHECK flag for vn_open_cred() to will ne converted into NOCAPCHECK namei flag. This functionality will be used to enable core dumps for sandboxed processes. Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks Modified: head/sys/kern/vfs_lookup.c head/sys/kern/vfs_vnops.c head/sys/sys/namei.h head/sys/sys/vnode.h Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Tue Nov 27 10:25:03 2012 (r243611) +++ head/sys/kern/vfs_lookup.c Tue Nov 27 10:32:35 2012 (r243612) @@ -183,7 +183,7 @@ namei(struct nameidata *ndp) * not an absolute path, and not containing '..' components) to * a real file descriptor, not the pseudo-descriptor AT_FDCWD. */ - if (IN_CAPABILITY_MODE(td)) { + if (IN_CAPABILITY_MODE(td) && (cnp->cn_flags & NOCAPCHECK) == 0) { ndp->ni_strictrelative = 1; if (ndp->ni_dirfd == AT_FDCWD) { #ifdef KTRACE Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Nov 27 10:25:03 2012 (r243611) +++ head/sys/kern/vfs_vnops.c Tue Nov 27 10:32:35 2012 (r243612) @@ -135,6 +135,8 @@ restart: ndp->ni_cnd.cn_flags |= FOLLOW; if (!(vn_open_flags & VN_OPEN_NOAUDIT)) ndp->ni_cnd.cn_flags |= AUDITVNODE1; + if (vn_open_flags & VN_OPEN_NOCAPCHECK) + ndp->ni_cnd.cn_flags |= NOCAPCHECK; bwillwrite(); if ((error = namei(ndp)) != 0) return (error); @@ -188,6 +190,8 @@ restart: ndp->ni_cnd.cn_flags |= LOCKSHARED; if (!(vn_open_flags & VN_OPEN_NOAUDIT)) ndp->ni_cnd.cn_flags |= AUDITVNODE1; + if (vn_open_flags & VN_OPEN_NOCAPCHECK) + ndp->ni_cnd.cn_flags |= NOCAPCHECK; if ((error = namei(ndp)) != 0) return (error); vp = ndp->ni_vp; Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Tue Nov 27 10:25:03 2012 (r243611) +++ head/sys/sys/namei.h Tue Nov 27 10:32:35 2012 (r243612) @@ -147,7 +147,8 @@ struct nameidata { #define AUDITVNODE1 0x04000000 /* audit the looked up vnode information */ #define AUDITVNODE2 0x08000000 /* audit the looked up vnode information */ #define TRAILINGSLASH 0x10000000 /* path ended in a slash */ -#define PARAMASK 0x1ffffe00 /* mask of parameter descriptors */ +#define NOCAPCHECK 0x20000000 /* do not perform capability checks */ +#define PARAMASK 0x3ffffe00 /* mask of parameter descriptors */ /* * Initialization of a nameidata structure. Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Nov 27 10:25:03 2012 (r243611) +++ head/sys/sys/vnode.h Tue Nov 27 10:32:35 2012 (r243612) @@ -565,6 +565,7 @@ vn_canvmio(struct vnode *vp) /* vn_open_flags */ #define VN_OPEN_NOAUDIT 0x00000001 +#define VN_OPEN_NOCAPCHECK 0x00000002 /* * Public vnode manipulation functions. From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 10:38:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6DCF692; Tue, 27 Nov 2012 10:38:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 731648FC08; Tue, 27 Nov 2012 10:38:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARAcBEd044426; Tue, 27 Nov 2012 10:38:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARAcBeX044425; Tue, 27 Nov 2012 10:38:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271038.qARAcBeX044425@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 10:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243613 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 10:38:11 -0000 Author: pjd Date: Tue Nov 27 10:38:11 2012 New Revision: 243613 URL: http://svnweb.freebsd.org/changeset/base/243613 Log: Add kern.capmode_coredump sysctl/tunable to allow processes in capability mode to dump core. Reviewed by: rwatson Obtained from: WHEEL Systems MFC after: 2 weeks Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Nov 27 10:32:35 2012 (r243612) +++ head/sys/kern/kern_sig.c Tue Nov 27 10:38:11 2012 (r243613) @@ -175,6 +175,11 @@ TUNABLE_INT("kern.sugid_coredump", &sugi SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); +static int capmode_coredump; +TUNABLE_INT("kern.capmode_coredump", &capmode_coredump); +SYSCTL_INT(_kern, OID_AUTO, capmode_coredump, CTLFLAG_RW, + &capmode_coredump, 0, "Allow processes in capability mode to dump core"); + static int do_coredump = 1; SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, &do_coredump, 0, "Enable/Disable coredumps"); @@ -3134,12 +3139,17 @@ nomem: int error, n; int flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; int cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; + int oflags = 0; + + if (capmode_coredump) + oflags = VN_OPEN_NOCAPCHECK; for (n = 0; n < num_cores; n++) { temp[indexpos] = '0' + n; NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, temp, td); - error = vn_open(&nd, &flags, cmode, NULL); + error = vn_open_cred(&nd, &flags, cmode, oflags, + td->td_ucred, NULL); if (error) { if (error == EEXIST) continue; @@ -3241,7 +3251,8 @@ coredump(struct thread *td) restart: NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); flags = O_CREAT | FWRITE | O_NOFOLLOW; - error = vn_open_cred(&nd, &flags, S_IRUSR | S_IWUSR, VN_OPEN_NOAUDIT, + error = vn_open_cred(&nd, &flags, S_IRUSR | S_IWUSR, + VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0), cred, NULL); if (error) { #ifdef AUDIT From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 11:30:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB6FB5E9; Tue, 27 Nov 2012 11:30:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 94D458FC08; Tue, 27 Nov 2012 11:30:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARBUdsf054210; Tue, 27 Nov 2012 11:30:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARBUdGm054209; Tue, 27 Nov 2012 11:30:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211271130.qARBUdGm054209@svn.freebsd.org> From: Adrian Chadd Date: Tue, 27 Nov 2012 11:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243614 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 11:30:40 -0000 Author: adrian Date: Tue Nov 27 11:30:39 2012 New Revision: 243614 URL: http://svnweb.freebsd.org/changeset/base/243614 Log: * Fix another culprit of my "committed from the wrong directory" nonsense; now this works for non-debug and debug builds. * Add a comment reminding me (or someone) to audit all of the relevant math to ensure there's no weird wrapping issues still lurking about. But yes, this does seem to be mostly working. Pointy-hat-to: adrian, yet again Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 10:38:11 2012 (r243613) +++ head/sys/dev/ath/if_ath_tdma.c Tue Nov 27 11:30:39 2012 (r243614) @@ -328,6 +328,16 @@ ath_tdma_config(struct ath_softc *sc, st * beacon timers so we follow their schedule. Note that * by using the rx timestamp we implicitly include the * propagation delay in our schedule. + * + * XXX TODO: since the changes for the AR5416 and later chips + * involved changing the TSF/TU calculations, we need to make + * sure that various calculations wrap consistently. + * + * A lot of the problems stemmed from the calculations wrapping + * at 65,535 TU. Since a lot of the math is still being done in + * TU, please audit it to ensure that when the TU values programmed + * into the timers wrap at (2^31)-1 TSF, all the various terms + * wrap consistently. */ void ath_tdma_update(struct ieee80211_node *ni, @@ -541,8 +551,8 @@ ath_tdma_update(struct ieee80211_node *n struct if_ath_alq_tdma_tsf_adjust t; t.tsfdelta = htobe32(tsfdelta); - t.tsf64_old = htobe64(tsf_1); - t.tsf64_new = htobe64(tsf_1 + tsfdelta); + t.tsf64_old = htobe64(tsf); + t.tsf64_new = htobe64(tsf + tsfdelta); if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_TSF_ADJUST, sizeof(t), (char *) &t); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 12:23:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 826DC3EE; Tue, 27 Nov 2012 12:23:57 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 67F6A8FC08; Tue, 27 Nov 2012 12:23:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARCNvLR063756; Tue, 27 Nov 2012 12:23:57 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARCNvcf063755; Tue, 27 Nov 2012 12:23:57 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201211271223.qARCNvcf063755@svn.freebsd.org> From: David Xu Date: Tue, 27 Nov 2012 12:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243615 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 12:23:57 -0000 Author: davidxu Date: Tue Nov 27 12:23:57 2012 New Revision: 243615 URL: http://svnweb.freebsd.org/changeset/base/243615 Log: Pass allocated unit number to make_dev, otherwise kernel panics later while cloning second tap. Reviewed by: kevlo,ed Modified: head/sys/net/if_tap.c Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Tue Nov 27 11:30:39 2012 (r243614) +++ head/sys/net/if_tap.c Tue Nov 27 12:23:57 2012 (r243615) @@ -186,7 +186,7 @@ tap_clone_create(struct if_clone *ifc, i /* Find any existing device, or allocate new unit number. */ i = clone_create(&tapclones, &tap_cdevsw, &unit, &dev, 0); if (i) { - dev = make_dev(&tap_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + dev = make_dev(&tap_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, "%s%d", tapname, unit); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 13:52:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1039BCF6; Tue, 27 Nov 2012 13:52:47 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id ECD318FC16; Tue, 27 Nov 2012 13:52:45 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so11869778lah.13 for ; Tue, 27 Nov 2012 05:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ctU8CmS6/WFrX5ze21tYFV8bk0yeLBnh7QGmNSgAKXA=; b=MOyNimEdqVsgfSvPd2gF/GAbdE6zUbFQuxOlJoWUbYroteSvBeyPFKtpsc8SUNMR8a Sj9mYSSMv+HH5+Cz/OO5dbQzKdGJxvxp9aeEKAM4tAUpgh17esOJLRQ40PKEj305ilw4 OMEoWwi+wku8Wx5kSankUu4zfSjZ7oQBlBKZ3kRlZKQ1lPPWPXwwSib1X1Z4Klg/iP5O O5FlhtbIKEVqH4QSV0ECsY9sE2xzQIVSCxqpiUuROUEaFoRC/7sof6ddPlKGeo6jzz7S uB6rCuwL1g2NIrcHpN/YQ6uckmVuZpEZD7vfaLHlKFx6vnRYrtgWnIJeDvsbEATw5ohw 2AKQ== MIME-Version: 1.0 Received: by 10.152.162.1 with SMTP id xw1mr14830537lab.3.1354024364928; Tue, 27 Nov 2012 05:52:44 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.134.5 with HTTP; Tue, 27 Nov 2012 05:52:44 -0800 (PST) In-Reply-To: <201211270607.qAR67w6O094153@svn.freebsd.org> References: <201211270607.qAR67w6O094153@svn.freebsd.org> Date: Tue, 27 Nov 2012 13:52:44 +0000 X-Google-Sender-Auth: EaD7uY28DWicFYm97kElno4zcTg Message-ID: Subject: Re: svn commit: r243599 - head/sys/kern From: Attilio Rao To: David Xu Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 13:52:47 -0000 On Tue, Nov 27, 2012 at 6:07 AM, David Xu wrote: > Author: davidxu > Date: Tue Nov 27 06:07:58 2012 > New Revision: 243599 > URL: http://svnweb.freebsd.org/changeset/base/243599 > > Log: > Take first active vnode correctly. Thanks. I had send the exact same report to Kirk and Jeff one week ago, and I was still waiting for responses. Please note that vfs_msync() was completely broken because of this change (as not happening at all). I think that vinactive() and umount were enough to make the issue not really visible. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 14:35:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C954E9ED; Tue, 27 Nov 2012 14:35:27 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from mail-da0-f54.google.com (mail-da0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7BF588FC13; Tue, 27 Nov 2012 14:35:27 +0000 (UTC) Received: by mail-da0-f54.google.com with SMTP id n2so3538173dad.13 for ; Tue, 27 Nov 2012 06:35:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=hPxZAq2FzERI584lVf7p9WLEjzKy/5u2n/O7uolhcGY=; b=09RUAbNGiclj8gvnfCzyI9woVXPnragsIZsoBprljaQlkSLwh5NU0xdFIMb5/yzr3N 2m/ouybLCicoM3KzhF3KdG3j9j/elYhBcXRtrtMVu6RCCMvws0ipxvSCRAmmdUkxZska 01n0Cz27x2ZEfoyjKyTYjByZkpUahuKD23eScsFQuB8SWMddnsbw/168LcrpTHSkaDWS aU1J8AkricKucNfZGEk9+8IviuBywRYxKu5VmhLHQpZFYaKWQ0/q7o6NSK3kaBK1KYNC 3ex3dk3m/kVvd+1M/e6yGQMd4tQ6nfWYe0NeQjQgKppurh5JvazWqVmk8ZkktuD6l67c CqgQ== Received: by 10.68.136.9 with SMTP id pw9mr48363795pbb.155.1354026927067; Tue, 27 Nov 2012 06:35:27 -0800 (PST) Received: from xp5k.my.domain ([115.192.135.126]) by mx.google.com with ESMTPS id qj6sm10714698pbb.69.2012.11.27.06.35.20 (version=SSLv3 cipher=OTHER); Tue, 27 Nov 2012 06:35:25 -0800 (PST) Message-ID: <50B4CFA5.7040200@gmail.com> Date: Tue, 27 Nov 2012 22:35:17 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: attilio@FreeBSD.org Subject: Re: svn commit: r243599 - head/sys/kern References: <201211270607.qAR67w6O094153@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: davidxu@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 14:35:27 -0000 On 2012/11/27 21:52, Attilio Rao wrote: > On Tue, Nov 27, 2012 at 6:07 AM, David Xu wrote: >> Author: davidxu >> Date: Tue Nov 27 06:07:58 2012 >> New Revision: 243599 >> URL: http://svnweb.freebsd.org/changeset/base/243599 >> >> Log: >> Take first active vnode correctly. > Thanks. > I had send the exact same report to Kirk and Jeff one week ago, and I > was still waiting for responses. > > Please note that vfs_msync() was completely broken because of this > change (as not happening at all). > I think that vinactive() and umount were enough to make the issue not > really visible. Yes, I think so, except quota data ? > Attilio > > From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 14:50:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 338F678; Tue, 27 Nov 2012 14:50:52 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id F23108FC08; Tue, 27 Nov 2012 14:50:50 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so9357100lbb.13 for ; Tue, 27 Nov 2012 06:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=P/SCCXFUAWfAY70xVUBSl/+hyWkppnYlEW3RmJixOMQ=; b=XmxYlWXZNr64oRU+zHtbUjOqUjed/0PcStCdJEIBpXtzT88Lpo+3bWICb4WRSwJyQ1 rENpnCSmJc0MJMJLzpPNBGG+S3cFqVu+71XCzxZXBkJmwP68NQZVRPwkby1+ILkj+2zB L870G8L+l8VEDEc5ocCTuymMGZLJj0HmU9oW63pB5wolBKdsS3oZAhjF8ra7H4ictUzd UAdPjd8e1ONF31eeJK9lwg6+WuS1Wb5ReFkQVuJyk1K/Q+hHYwN2JNkx3OEjZxB/jRxq LIyRZjLMV/MZhqV2xFADkfIZfUbGjtrrAjCWEqIRYN3krrHnq7rWb47bsJ0SR+0z7q3c XKZA== MIME-Version: 1.0 Received: by 10.152.129.197 with SMTP id ny5mr14902859lab.43.1354027849656; Tue, 27 Nov 2012 06:50:49 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.134.5 with HTTP; Tue, 27 Nov 2012 06:50:49 -0800 (PST) In-Reply-To: <50B4CFA5.7040200@gmail.com> References: <201211270607.qAR67w6O094153@svn.freebsd.org> <50B4CFA5.7040200@gmail.com> Date: Tue, 27 Nov 2012 14:50:49 +0000 X-Google-Sender-Auth: 05aVGLVjmzvJWg7cdKwAXNfuidg Message-ID: Subject: Re: svn commit: r243599 - head/sys/kern From: Attilio Rao To: davidxu@freebsd.org Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 14:50:52 -0000 On Tue, Nov 27, 2012 at 2:35 PM, David Xu wrote: > On 2012/11/27 21:52, Attilio Rao wrote: >> On Tue, Nov 27, 2012 at 6:07 AM, David Xu wrote: >>> Author: davidxu >>> Date: Tue Nov 27 06:07:58 2012 >>> New Revision: 243599 >>> URL: http://svnweb.freebsd.org/changeset/base/243599 >>> >>> Log: >>> Take first active vnode correctly. >> Thanks. >> I had send the exact same report to Kirk and Jeff one week ago, and I >> was still waiting for responses. >> >> Please note that vfs_msync() was completely broken because of this >> change (as not happening at all). >> I think that vinactive() and umount were enough to make the issue not >> really visible. > > Yes, I think so, except quota data ? Yeah, although I don't think many people use QUOTA out of servers/production ready machines (which also usually don't run -CURRENT) and likely only people using QUOTA on STABLE_9 machines could have really experienced problems with this. I think this bug fix must be absolutely included into 9.1-REL. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 15:08:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3431D6F7; Tue, 27 Nov 2012 15:08:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3A08FC16; Tue, 27 Nov 2012 15:08:38 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qARF8VVN077155; Tue, 27 Nov 2012 17:08:31 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qARF8VVN077155 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qARF8V75077154; Tue, 27 Nov 2012 17:08:31 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 27 Nov 2012 17:08:31 +0200 From: Konstantin Belousov To: Andriy Gapon Subject: Re: svn commit: r243599 - head/sys/kern Message-ID: <20121127150831.GK3013@kib.kiev.ua> References: <201211270607.qAR67w6O094153@svn.freebsd.org> <50B48EE9.1090506@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sCNd3Ivk/oijKKf1" Content-Disposition: inline In-Reply-To: <50B48EE9.1090506@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=0.2 required=5.0 tests=ALL_TRUSTED, 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, David Xu X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 15:08:39 -0000 --sCNd3Ivk/oijKKf1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 27, 2012 at 11:59:05AM +0200, Andriy Gapon wrote: > on 27/11/2012 08:07 David Xu said the following: > > Author: davidxu > > Date: Tue Nov 27 06:07:58 2012 > > New Revision: 243599 > > URL: http://svnweb.freebsd.org/changeset/base/243599 > >=20 > > Log: > > Take first active vnode correctly. > > =20 > > Reviewed by: kib > > MFC after: 3 days > >=20 > > Modified: > > head/sys/kern/vfs_subr.c > >=20 > > Modified: head/sys/kern/vfs_subr.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/kern/vfs_subr.c Tue Nov 27 06:01:02 2012 (r243598) > > +++ head/sys/kern/vfs_subr.c Tue Nov 27 06:07:58 2012 (r243599) > > @@ -4755,7 +4755,7 @@ __mnt_vnode_first_active(struct vnode ** > > MNT_REF(mp); > > (*mvp)->v_type =3D VMARKER; > > =20 > > - vp =3D TAILQ_NEXT(*mvp, v_actfreelist); > > + vp =3D TAILQ_FIRST(&mp->mnt_activevnodelist); > > while (vp !=3D NULL) { > > VI_LOCK(vp); > > if (vp->v_mount =3D=3D mp && vp->v_type !=3D VMARKER && > >=20 >=20 > Oh, wow, did this even work before? > Did it always just return NULL and no active list iteration happened? Yes. Due to some redundancy in the VFS, the consequences were much less fatal than it could be. --sCNd3Ivk/oijKKf1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC0124ACgkQC3+MBN1Mb4gGvQCfTPP6l/tIlnZiC7jh8URJEART CT4AoImg06M5EDKf960V1RC0gfiQWiNZ =Oqaj -----END PGP SIGNATURE----- --sCNd3Ivk/oijKKf1-- From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 16:23:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E7E374F; Tue, 27 Nov 2012 16:23:13 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 11DDB8FC08; Tue, 27 Nov 2012 16:23:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARGNCH4007018; Tue, 27 Nov 2012 16:23:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARGNCMH007017; Tue, 27 Nov 2012 16:23:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211271623.qARGNCMH007017@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 27 Nov 2012 16:23:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243617 - head/usr.bin/passwd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 16:23:13 -0000 Author: pjd Date: Tue Nov 27 16:23:12 2012 New Revision: 243617 URL: http://svnweb.freebsd.org/changeset/base/243617 Log: Respect NO_FSCHG and don't set 'schg' flag on passwd/yppasswd is defined. MFC after: 2 weeks Modified: head/usr.bin/passwd/Makefile Modified: head/usr.bin/passwd/Makefile ============================================================================== --- head/usr.bin/passwd/Makefile Tue Nov 27 16:20:44 2012 (r243616) +++ head/usr.bin/passwd/Makefile Tue Nov 27 16:23:12 2012 (r243617) @@ -19,7 +19,9 @@ beforeinstall: chflags noschg ${DESTDIR}${BINDIR}/$i || true .endfor +.if !defined(NO_FSCHG) afterinstall: -chflags schg ${DESTDIR}${BINDIR}/passwd +.endif .include From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 19:07:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6ED8D9B6; Tue, 27 Nov 2012 19:07:29 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52AF38FC14; Tue, 27 Nov 2012 19:07:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARJ7TJR036037; Tue, 27 Nov 2012 19:07:29 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARJ7Tma036036; Tue, 27 Nov 2012 19:07:29 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211271907.qARJ7Tma036036@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 19:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243621 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 19:07:29 -0000 Author: andre Date: Tue Nov 27 19:07:28 2012 New Revision: 243621 URL: http://svnweb.freebsd.org/changeset/base/243621 Log: Add DELACK to list of timers. MFC after: 1 week Modified: head/sys/netinet/tcp_timer.h Modified: head/sys/netinet/tcp_timer.h ============================================================================== --- head/sys/netinet/tcp_timer.h Tue Nov 27 19:00:44 2012 (r243620) +++ head/sys/netinet/tcp_timer.h Tue Nov 27 19:07:28 2012 (r243621) @@ -122,7 +122,7 @@ #ifdef TCPTIMERS static const char *tcptimers[] = - { "REXMT", "PERSIST", "KEEP", "2MSL" }; + { "REXMT", "PERSIST", "KEEP", "2MSL", "DELACK" }; #endif /* From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 19:09:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6034EB45; Tue, 27 Nov 2012 19:09:37 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4551F8FC15; Tue, 27 Nov 2012 19:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARJ9bPY036523; Tue, 27 Nov 2012 19:09:37 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARJ9bST036522; Tue, 27 Nov 2012 19:09:37 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201211271909.qARJ9bST036522@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 27 Nov 2012 19:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243622 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 19:09:37 -0000 Author: bschmidt Date: Tue Nov 27 19:09:36 2012 New Revision: 243622 URL: http://svnweb.freebsd.org/changeset/base/243622 Log: fix a panic resulting from a stray '&' MFC after: 1 week Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue Nov 27 19:07:28 2012 (r243621) +++ head/sys/dev/iwn/if_iwn.c Tue Nov 27 19:09:36 2012 (r243622) @@ -1253,7 +1253,7 @@ iwn_dma_contig_free(struct iwn_dma_info bus_dmamap_sync(dma->tag, dma->map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma->tag, dma->map); - bus_dmamem_free(dma->tag, &dma->vaddr, dma->map); + bus_dmamem_free(dma->tag, dma->vaddr, dma->map); dma->vaddr = NULL; } bus_dmamap_destroy(dma->tag, dma->map); From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 19:31:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DAB32973; Tue, 27 Nov 2012 19:31:49 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B7BAB8FC13; Tue, 27 Nov 2012 19:31:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARJVnHx040851; Tue, 27 Nov 2012 19:31:49 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARJVnxF040845; Tue, 27 Nov 2012 19:31:49 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211271931.qARJVnxF040845@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 19:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243624 - in head/sys: dev/bce dev/bxe net netinet sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 19:31:49 -0000 Author: andre Date: Tue Nov 27 19:31:49 2012 New Revision: 243624 URL: http://svnweb.freebsd.org/changeset/base/243624 Log: Remove unused and unnecessary CSUM_IP_FRAGS checksumming capability. Checksumming the IP header of fragments is no different from doing normal IP headers. Discussed with: yongari MFC after: 1 week Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bxe/if_bxe.c head/sys/net/if_vlan.c head/sys/netinet/ip_output.c head/sys/sys/mbuf.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Nov 27 19:23:54 2012 (r243623) +++ head/sys/dev/bce/if_bce.c Tue Nov 27 19:31:49 2012 (r243624) @@ -9880,7 +9880,7 @@ bce_dump_mbuf(struct bce_softc *sc, stru "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" "\22M_PROMISC\23M_NOFREE", mp->m_pkthdr.csum_flags, - "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS" + "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP" "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" "\12CSUM_IP_VALID\13CSUM_DATA_VALID" "\14CSUM_PSEUDO_HDR"); Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Tue Nov 27 19:23:54 2012 (r243623) +++ head/sys/dev/bxe/if_bxe.c Tue Nov 27 19:31:49 2012 (r243624) @@ -16281,7 +16281,7 @@ void bxe_dump_mbuf(struct bxe_softc *sc, "\15M_FIRSTFRAG\16M_LASTFRAG\21M_VLANTAG" "\22M_PROMISC\23M_NOFREE", m->m_pkthdr.csum_flags, - "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP\4CSUM_IP_FRAGS" + "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP" "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" "\12CSUM_IP_VALID\13CSUM_DATA_VALID" "\14CSUM_PSEUDO_HDR"); Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Nov 27 19:23:54 2012 (r243623) +++ head/sys/net/if_vlan.c Tue Nov 27 19:31:49 2012 (r243624) @@ -1493,7 +1493,7 @@ vlan_capabilities(struct ifvlan *ifv) p->if_capenable & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable = p->if_capenable & IFCAP_HWCSUM; ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP | - CSUM_UDP | CSUM_SCTP | CSUM_IP_FRAGS | CSUM_FRAGMENT); + CSUM_UDP | CSUM_SCTP | CSUM_FRAGMENT); } else { ifp->if_capenable = 0; ifp->if_hwassist = 0; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Nov 27 19:23:54 2012 (r243623) +++ head/sys/netinet/ip_output.c Tue Nov 27 19:31:49 2012 (r243624) @@ -722,14 +722,12 @@ ip_fragment(struct ip *ip, struct mbuf * * If the interface will not calculate checksums on * fragmented packets, then do it here. */ - if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA && - (if_hwassist_flags & CSUM_IP_FRAGS) == 0) { + if (m0->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { in_delayed_cksum(m0); m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #ifdef SCTP - if (m0->m_pkthdr.csum_flags & CSUM_SCTP && - (if_hwassist_flags & CSUM_IP_FRAGS) == 0) { + if (m0->m_pkthdr.csum_flags & CSUM_SCTP) { sctp_delayed_cksum(m0, hlen); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP; } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Tue Nov 27 19:23:54 2012 (r243623) +++ head/sys/sys/mbuf.h Tue Nov 27 19:31:49 2012 (r243624) @@ -279,7 +279,6 @@ struct mbuf { #define CSUM_IP 0x0001 /* will csum IP */ #define CSUM_TCP 0x0002 /* will csum TCP */ #define CSUM_UDP 0x0004 /* will csum UDP */ -#define CSUM_IP_FRAGS 0x0008 /* will csum IP fragments */ #define CSUM_FRAGMENT 0x0010 /* will do IP fragmentation */ #define CSUM_TSO 0x0020 /* will do TSO */ #define CSUM_SCTP 0x0040 /* will csum SCTP */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 20:04:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F238F9D0; Tue, 27 Nov 2012 20:04:52 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD6D28FC13; Tue, 27 Nov 2012 20:04:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARK4qHT047210; Tue, 27 Nov 2012 20:04:52 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARK4qS8047209; Tue, 27 Nov 2012 20:04:52 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211272004.qARK4qS8047209@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 20:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243627 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 20:04:53 -0000 Author: andre Date: Tue Nov 27 20:04:52 2012 New Revision: 243627 URL: http://svnweb.freebsd.org/changeset/base/243627 Log: Fix a race on listen socket teardown where while draining the accept queues a new socket/connection may be added to the queue due to a race on the ACCEPT_LOCK. The submitted patch is slightly changed in comments, teardown and locking order and extended with KASSERT's. Submitted by: Vijay Singh Found by: His team. MFC after: 1 week Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Nov 27 19:35:21 2012 (r243626) +++ head/sys/kern/uipc_socket.c Tue Nov 27 20:04:52 2012 (r243627) @@ -555,6 +555,16 @@ sonewconn(struct socket *head, int conns so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE; so->so_state |= connstatus; ACCEPT_LOCK(); + /* + * The accept socket may be tearing down but we just + * won a race on the ACCEPT_LOCK. + */ + if (!(so->so_options & SO_ACCEPTCONN)) { + SOCK_LOCK(so); + so->so_head = NULL; + sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ + return (NULL); + } if (connstatus) { TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); so->so_qstate |= SQ_COMP; @@ -780,9 +790,14 @@ soclose(struct socket *so) drop: if (so->so_proto->pr_usrreqs->pru_close != NULL) (*so->so_proto->pr_usrreqs->pru_close)(so); + ACCEPT_LOCK(); if (so->so_options & SO_ACCEPTCONN) { struct socket *sp; - ACCEPT_LOCK(); + /* + * Prevent new additions to the accept queues due + * to ACCEPT_LOCK races while we are draining them. + */ + so->so_options &= ~SO_ACCEPTCONN; while ((sp = TAILQ_FIRST(&so->so_incomp)) != NULL) { TAILQ_REMOVE(&so->so_incomp, sp, so_list); so->so_incqlen--; @@ -801,13 +816,15 @@ drop: soabort(sp); ACCEPT_LOCK(); } - ACCEPT_UNLOCK(); + KASSERT((TAILQ_EMPTY(&so->so_comp)), + ("%s: so_comp populated", __func__)); + KASSERT((TAILQ_EMPTY(&so->so_incomp)), + ("%s: so_incomp populated", __func__)); } - ACCEPT_LOCK(); SOCK_LOCK(so); KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); so->so_state |= SS_NOFDREF; - sorele(so); + sorele(so); /* NB: Returns with ACCEPT_UNLOCK(). */ CURVNET_RESTORE(); return (error); } From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 20:16:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 712D2DAB; Tue, 27 Nov 2012 20:16:02 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 56B568FC16; Tue, 27 Nov 2012 20:16:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARKG2lb049492; Tue, 27 Nov 2012 20:16:02 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARKG221049491; Tue, 27 Nov 2012 20:16:02 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211272016.qARKG221049491@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 20:16:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243628 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 20:16:02 -0000 Author: andre Date: Tue Nov 27 20:16:01 2012 New Revision: 243628 URL: http://svnweb.freebsd.org/changeset/base/243628 Log: Update comment to prefer M_NOWAIT over M_DONTWAIT and M_WAITOK over M_WAIT. MFC after: 1 week Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Tue Nov 27 20:04:52 2012 (r243627) +++ head/sys/sys/mbuf.h Tue Nov 27 20:16:01 2012 (r243628) @@ -349,8 +349,8 @@ struct mbstat { * Flags specifying how an allocation should be made. * * The flag to use is as follows: - * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation. - * - M_WAIT or M_WAITOK from wherever it is safe to block. + * - M_NOWAIT (M_DONTWAIT) from an interrupt handler to not block allocation. + * - M_WAITOK (M_WAIT) from wherever it is safe to block. * * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly and * if we cannot allocate immediately we may return NULL, whereas From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 21:19:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC7FC521; Tue, 27 Nov 2012 21:19:59 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 868318FC14; Tue, 27 Nov 2012 21:19:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARLJxf3061088; Tue, 27 Nov 2012 21:19:59 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARLJxXV061083; Tue, 27 Nov 2012 21:19:59 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211272119.qARLJxXV061083@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 21:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243631 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 21:19:59 -0000 Author: andre Date: Tue Nov 27 21:19:58 2012 New Revision: 243631 URL: http://svnweb.freebsd.org/changeset/base/243631 Log: Base the mbuf related limits on the available physical memory or kernel memory, whichever is lower. The overall mbuf related memory limit must be set so that mbufs (and clusters of various sizes) can't exhaust physical RAM or KVM. The limit is set to half of the physical RAM or KVM (whichever is lower) as the baseline. In any normal scenario we want to leave at least half of the physmem/kvm for other kernel functions and userspace to prevent it from swapping too easily. Via a tunable kern.maxmbufmem the limit can be upped to at most 3/4 of physmem/kvm. At the same time divorce maxfiles from maxusers and set maxfiles to physpages / 8 with a floor based on maxusers. This way busy servers can make use of the significantly increased mbuf limits with a much larger number of open sockets. Tidy up ordering in init_param2() and check up on some users of those values calculated here. Out of the overall mbuf memory limit 2K clusters and 4K (page size) clusters to get 1/4 each because these are the most heavily used mbuf sizes. 2K clusters are used for MTU 1500 ethernet inbound packets. 4K clusters are used whenever possible for sends on sockets and thus outbound packets. The larger cluster sizes of 9K and 16K are limited to 1/6 of the overall mbuf memory limit. When jumbo MTU's are used these large clusters will end up only on the inbound path. They are not used on outbound, there it's still 4K. Yes, that will stay that way because otherwise we run into lots of complications in the stack. And it really isn't a problem, so don't make a scene. Normal mbufs (256B) weren't limited at all previously. This was problematic as there are certain places in the kernel that on allocation failure of clusters try to piece together their packet from smaller mbufs. The mbuf limit is the number of all other mbuf sizes together plus some more to allow for standalone mbufs (ACK for example) and to send off a copy of a cluster. Unfortunately there isn't a way to set an overall limit for all mbuf memory together as UMA doesn't support such a limiting. NB: Every cluster also has an mbuf associated with it. Two examples on the revised mbuf sizing limits: 1GB KVM: 512MB limit for mbufs 419,430 mbufs 65,536 2K mbuf clusters 32,768 4K mbuf clusters 9,709 9K mbuf clusters 5,461 16K mbuf clusters 16GB RAM: 8GB limit for mbufs 33,554,432 mbufs 1,048,576 2K mbuf clusters 524,288 4K mbuf clusters 155,344 9K mbuf clusters 87,381 16K mbuf clusters These defaults should be sufficient for even the most demanding network loads. MFC after: 1 month Modified: head/sys/kern/kern_mbuf.c head/sys/kern/subr_param.c head/sys/kern/uipc_socket.c head/sys/sys/eventhandler.h head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Tue Nov 27 20:22:36 2012 (r243630) +++ head/sys/kern/kern_mbuf.c Tue Nov 27 21:19:58 2012 (r243631) @@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$"); * */ +int nmbufs; /* limits number of mbufs */ int nmbclusters; /* limits number of mbuf clusters */ int nmbjumbop; /* limits number of page size jumbo clusters */ int nmbjumbo9; /* limits number of 9k jumbo clusters */ @@ -147,9 +148,11 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) newnmbclusters = nmbclusters; error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); if (error == 0 && req->newptr) { - if (newnmbclusters > nmbclusters) { + if (newnmbclusters > nmbclusters && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbclusters = newnmbclusters; uma_zone_set_max(zone_clust, nmbclusters); + nmbclusters = uma_zone_get_max(zone_clust); EVENTHANDLER_INVOKE(nmbclusters_change); } else error = EINVAL; @@ -168,9 +171,11 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS) newnmbjumbop = nmbjumbop; error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbop> nmbjumbop) { + if (newnmbjumbop > nmbjumbop && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbop = newnmbjumbop; uma_zone_set_max(zone_jumbop, nmbjumbop); + nmbjumbop = uma_zone_get_max(zone_jumbop); } else error = EINVAL; } @@ -189,9 +194,11 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS) newnmbjumbo9 = nmbjumbo9; error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbo9> nmbjumbo9) { + if (newnmbjumbo9 > nmbjumbo9&& + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbo9 = newnmbjumbo9; uma_zone_set_max(zone_jumbo9, nmbjumbo9); + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); } else error = EINVAL; } @@ -209,9 +216,11 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS) newnmbjumbo16 = nmbjumbo16; error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); if (error == 0 && req->newptr) { - if (newnmbjumbo16> nmbjumbo16) { + if (newnmbjumbo16 > nmbjumbo16 && + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { nmbjumbo16 = newnmbjumbo16; uma_zone_set_max(zone_jumbo16, nmbjumbo16); + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); } else error = EINVAL; } @@ -221,6 +230,27 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumb &nmbjumbo16, 0, sysctl_nmbjumbo16, "IU", "Maximum number of mbuf 16k jumbo clusters allowed"); +static int +sysctl_nmbufs(SYSCTL_HANDLER_ARGS) +{ + int error, newnmbufs; + + newnmbufs = nmbufs; + error = sysctl_handle_int(oidp, &newnmbufs, 0, req); + if (error == 0 && req->newptr) { + if (newnmbufs > nmbufs) { + nmbufs = newnmbufs; + uma_zone_set_max(zone_mbuf, nmbufs); + nmbclusters = uma_zone_get_max(zone_mbuf); + EVENTHANDLER_INVOKE(nmbufs_change); + } else + error = EINVAL; + } + return (error); +} +SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW, +&nmbufs, 0, sysctl_nmbufs, "IU", + "Maximum number of mbufs allowed"); SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat, @@ -275,6 +305,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif MSIZE - 1, UMA_ZONE_MAXBUCKET); + if (nmbufs > 0) { + uma_zone_set_max(zone_mbuf, nmbufs); + nmbufs = uma_zone_get_max(zone_mbuf); + } zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, mb_ctor_clust, mb_dtor_clust, @@ -284,8 +318,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbclusters > 0) + if (nmbclusters > 0) { uma_zone_set_max(zone_clust, nmbclusters); + nmbclusters = uma_zone_get_max(zone_clust); + } zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack, mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf); @@ -299,8 +335,10 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbop > 0) + if (nmbjumbop > 0) { uma_zone_set_max(zone_jumbop, nmbjumbop); + nmbjumbop = uma_zone_get_max(zone_jumbop); + } zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, mb_ctor_clust, mb_dtor_clust, @@ -310,9 +348,11 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbo9 > 0) - uma_zone_set_max(zone_jumbo9, nmbjumbo9); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); + if (nmbjumbo9 > 0) { + uma_zone_set_max(zone_jumbo9, nmbjumbo9); + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); + } zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, mb_ctor_clust, mb_dtor_clust, @@ -322,9 +362,11 @@ mbuf_init(void *dummy) NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_REFCNT); - if (nmbjumbo16 > 0) - uma_zone_set_max(zone_jumbo16, nmbjumbo16); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); + if (nmbjumbo16 > 0) { + uma_zone_set_max(zone_jumbo16, nmbjumbo16); + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); + } zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), NULL, NULL, Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Nov 27 20:22:36 2012 (r243630) +++ head/sys/kern/subr_param.c Tue Nov 27 21:19:58 2012 (r243631) @@ -93,6 +93,7 @@ int ncallout; /* maximum # of timer ev int nbuf; int ngroups_max; /* max # groups per process */ int nswbuf; +long maxmbufmem; /* max mbuf memory */ pid_t pid_max = PID_MAX; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ @@ -270,6 +271,7 @@ init_param1(void) void init_param2(long physpages) { + long realmem; /* Base parameters */ maxusers = MAXUSERS; @@ -293,19 +295,25 @@ init_param2(long physpages) /* * The following can be overridden after boot via sysctl. Note: * unless overriden, these macros are ultimately based on maxusers. - */ - maxproc = NPROC; - TUNABLE_INT_FETCH("kern.maxproc", &maxproc); - /* * Limit maxproc so that kmap entries cannot be exhausted by * processes. */ + maxproc = NPROC; + TUNABLE_INT_FETCH("kern.maxproc", &maxproc); if (maxproc > (physpages / 12)) maxproc = physpages / 12; - maxfiles = MAXFILES; - TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); maxprocperuid = (maxproc * 9) / 10; - maxfilesperproc = (maxfiles * 9) / 10; + + /* + * The default limit for maxfiles is 1/12 of the number of + * physical page but not less than 16 times maxusers. + * At most it can be 1/6 the number of physical pages. + */ + maxfiles = imax(MAXFILES, physpages / 8); + TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); + if (maxfiles > (physpages / 4)) + maxfiles = physpages / 4; + maxfilesperproc = (maxfiles / 10) * 9; /* * Cannot be changed after boot. @@ -313,20 +321,35 @@ init_param2(long physpages) nbuf = NBUF; TUNABLE_INT_FETCH("kern.nbuf", &nbuf); + /* + * XXX: Does the callout wheel have to be so big? + */ ncallout = 16 + maxproc + maxfiles; TUNABLE_INT_FETCH("kern.ncallout", &ncallout); /* + * The default limit for all mbuf related memory is 1/2 of all + * available kernel memory (physical or kmem). + * At most it can be 3/4 of available kernel memory. + */ + realmem = lmin(physpages * PAGE_SIZE, + VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); + maxmbufmem = realmem / 2; + TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); + if (maxmbufmem > (realmem / 4) * 3) + maxmbufmem = (realmem / 4) * 3; + + /* * The default for maxpipekva is min(1/64 of the kernel address space, * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. */ maxpipekva = (physpages / 64) * PAGE_SIZE; + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); if (maxpipekva < 512 * 1024) maxpipekva = 512 * 1024; if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64; - TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); } /* Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Nov 27 20:22:36 2012 (r243630) +++ head/sys/kern/uipc_socket.c Tue Nov 27 21:19:58 2012 (r243631) @@ -290,7 +290,7 @@ init_maxsockets(void *ignored) { TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); + maxsockets = imax(maxsockets, maxfiles); } SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); @@ -306,12 +306,9 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) newmaxsockets = maxsockets; error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); if (error == 0 && req->newptr) { - if (newmaxsockets > maxsockets) { + if (newmaxsockets > maxsockets && + newmaxsockets <= maxfiles) { maxsockets = newmaxsockets; - if (maxsockets > ((maxfiles / 4) * 3)) { - maxfiles = (maxsockets * 5) / 4; - maxfilesperproc = (maxfiles * 9) / 10; - } EVENTHANDLER_INVOKE(maxsockets_change); } else error = EINVAL; Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Tue Nov 27 20:22:36 2012 (r243630) +++ head/sys/sys/eventhandler.h Tue Nov 27 21:19:58 2012 (r243631) @@ -253,6 +253,7 @@ EVENTHANDLER_DECLARE(thread_fini, thread typedef void (*uma_zone_chfn)(void *); EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn); +EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn); EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn); #endif /* SYS_EVENTHANDLER_H */ Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Tue Nov 27 20:22:36 2012 (r243630) +++ head/sys/sys/mbuf.h Tue Nov 27 21:19:58 2012 (r243631) @@ -395,7 +395,7 @@ struct mbstat { * * The rest of it is defined in kern/kern_mbuf.c */ - +extern long maxmbufmem; extern uma_zone_t zone_mbuf; extern uma_zone_t zone_clust; extern uma_zone_t zone_pack; From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 21:21:03 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4432F6AA; Tue, 27 Nov 2012 21:21:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id BE6C58FC0C; Tue, 27 Nov 2012 21:21:02 +0000 (UTC) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qARLDeBn016488; Wed, 28 Nov 2012 08:13:40 +1100 Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qARLDMdC027414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Nov 2012 08:13:32 +1100 Date: Wed, 28 Nov 2012 08:13:22 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek Subject: Re: svn commit: r243613 - head/sys/kern In-Reply-To: <201211271038.qARAcBeX044425@svn.freebsd.org> Message-ID: <20121128072724.A1049@besplex.bde.org> References: <201211271038.qARAcBeX044425@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=fbv1UDsF c=1 sm=1 a=baJ7GeqPacgA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=M4roAWbnUW4A:10 a=DSn26mRKnKe-ZutKH90A:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 21:21:03 -0000 On Tue, 27 Nov 2012, Pawel Jakub Dawidek wrote: > Log: > Add kern.capmode_coredump sysctl/tunable to allow processes in capability mode > to dump core. You missed fixing some style bugs before touching this. > Modified: head/sys/kern/kern_sig.c > ============================================================================== > --- head/sys/kern/kern_sig.c Tue Nov 27 10:32:35 2012 (r243612) > +++ head/sys/kern/kern_sig.c Tue Nov 27 10:38:11 2012 (r243613) > @@ -175,6 +175,11 @@ TUNABLE_INT("kern.sugid_coredump", &sugi > SYSCTL_INT(_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW, > &sugid_coredump, 0, "Allow setuid and setgid processes to dump core"); Normal indentation. Abnormal description of a flag. > > +static int capmode_coredump; > +TUNABLE_INT("kern.capmode_coredump", &capmode_coredump); > +SYSCTL_INT(_kern, OID_AUTO, capmode_coredump, CTLFLAG_RW, > + &capmode_coredump, 0, "Allow processes in capability mode to dump core"); > + Normal indentation. Abnormal description of a flag. > static int do_coredump = 1; > SYSCTL_INT(_kern, OID_AUTO, coredump, CTLFLAG_RW, > &do_coredump, 0, "Enable/Disable coredumps"); Abnormal indentation. Normal description of a flag as Enable/Disable (but better if it leaves out "Disable"). I'm not sure if the new flag is sufficiently different to deserve an "Allow" in it. The first one certainly doesn't. It is just another flag that gates the main one; when it is set, set*id processes aren't "Allowed" to dump core, but are forced to. It used to be described more or less correctly as "Enable coredumping set user/group ID processes", but this has been broken. The description was verbose and had bad grammar. Now it is verbose and has correct grammar, but is not obviously just a flag. My version doesn't fix this, but fixes the indentation and the order of the declarations (the basic do_coredump flag should be first, since it is first alphabetically, historically (?) and logically). The 2 newer flag also have a namespace error (they don't have a do_ prefix like the others). Among other bugs, this makes it sort incorrectly with the others. My version adds a do_ prefix to the second-newest one. Suggested rewordings for the old descriptions, and other style fixes (indentation, namespace): &do_coredump, 0, "Enable core dumps"); Statistics: on freefall now, sysctl -nda | grep -i ... shows 115 lines matching "enable", 38 matching "disable", and only 11 matching both; zgrep -ir on /usr/share/man shows 338 lines matching "core dump" and 168 matching "coredump", with most of the compressed spellings being for proper names like the coredumpsize rlimit and the wait flag WCOREDUMP. &do_sugid_coredump, 0, "Enable core dumps for set*id processes"); Now I don't like the "Enable" wording either. This flag is in addition to the other one, and neither "Enable" nor "Allow" fully describes the logic. A full verbose description is "Enable core dumps for set*id processes (if core dumps are not disabled for all processes)". > @@ -3134,12 +3139,17 @@ nomem: > int error, n; > int flags = O_CREAT | O_EXCL | FWRITE | O_NOFOLLOW; > int cmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; Old style bugs: - nested declarations - unsorted declarations - int variables not all in 1 declaration - initialization in declarations. > + int oflags = 0; > + > + if (capmode_coredump) > + oflags = VN_OPEN_NOCAPCHECK; New style bugs: - extend the previous bugs. Half of the initialization of oflags is in its declaration and half in 2 new lines. - extra blank line - other verboseness. The initialization of oflags can be written more concisely and clearly as oflags = capmode_coredump ? VN_OPEN_NOCAPCHECK : 0; This could be squeezed into its declaration line, but shouldn't be. Unless you make it slighly clearer by declaring oflags as const -- then its initialization must be in its declaration. This often applies for variables that hold translations of flags from one set to another. But I wouldn't go that far. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:05:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7396D2A4; Tue, 27 Nov 2012 22:05:02 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 58CEB8FC15; Tue, 27 Nov 2012 22:05:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARM52q3069036; Tue, 27 Nov 2012 22:05:02 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARM52O3069035; Tue, 27 Nov 2012 22:05:02 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201211272205.qARM52O3069035@svn.freebsd.org> From: Devin Teske Date: Tue, 27 Nov 2012 22:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243634 - head/usr.sbin/bsdconfig/networking/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:05:02 -0000 Author: dteske Date: Tue Nov 27 22:05:01 2012 New Revision: 243634 URL: http://svnweb.freebsd.org/changeset/base/243634 Log: Comments. Approved by: adrian (co-mentor) (implicit) Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Modified: head/usr.sbin/bsdconfig/networking/share/ipaddr.subr ============================================================================== --- head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Tue Nov 27 21:45:42 2012 (r243633) +++ head/usr.sbin/bsdconfig/networking/share/ipaddr.subr Tue Nov 27 22:05:01 2012 (r243634) @@ -107,7 +107,7 @@ f_validate_ipaddr() # f_dialog_iperror $error $ipaddr # # Display a msgbox with the appropriate error message for an error returned by -# f_validate_ipaddr above. +# the f_validate_ipaddr function above. # f_dialog_iperror() { @@ -285,7 +285,7 @@ f_validate_ipaddr6() # f_dialog_ip6error $error $ipv6_addr # # Display a msgbox with the appropriate error message for an error returned by -# f_validate_ipaddr6 above. +# the f_validate_ipaddr6 function above. # f_dialog_ip6error() { From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:11:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E42706A8; Tue, 27 Nov 2012 22:11:53 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C8B0F8FC19; Tue, 27 Nov 2012 22:11:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARMBrt4070366; Tue, 27 Nov 2012 22:11:53 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARMBrPm070365; Tue, 27 Nov 2012 22:11:53 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201211272211.qARMBrPm070365@svn.freebsd.org> From: Devin Teske Date: Tue, 27 Nov 2012 22:11:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243635 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:11:54 -0000 Author: dteske Date: Tue Nov 27 22:11:53 2012 New Revision: 243635 URL: http://svnweb.freebsd.org/changeset/base/243635 Log: Change self-initialization to occur when loaded versus the previous behavior which was to self-initialize during the first function-call. This didn't work so well because the first call was may or may-not be within a sub-shell (which prevented proper setup of the pass-thru file descriptor, resulting in dialogs that would not display). Approved by: adrian (co-mentor) (implicit) Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Tue Nov 27 22:05:01 2012 (r243634) +++ head/usr.sbin/bsdconfig/share/dialog.subr Tue Nov 27 22:11:53 2012 (r243635) @@ -72,8 +72,7 @@ unset XDIALOG_FORCE_AUTOSIZE unset XDIALOG_INFOBOX_TIMEOUT # -# Default behavior is to call f_dialog_init() automatically if not already -# called manually by the time the first f_dialog_*() function is used. +# Default behavior is to call f_dialog_init() automatically when loaded. # : ${DIALOG_SELF_INITIALIZE=1} @@ -185,8 +184,6 @@ f_dialog_backtitle_restore() # f_dialog_infobox_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n=0 local min_width max_size @@ -308,8 +305,6 @@ f_dialog_infobox_size() # f_dialog_buttonbox_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" local size="$( f_dialog_infobox_size \ "$title" "$btitle" "$prompt" "$hline" )" @@ -355,8 +350,6 @@ f_dialog_buttonbox_size() # f_dialog_inputbox_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" init="$4" hline="$5" n local size="$( f_dialog_buttonbox_size \ "$title" "$btitle" "$prompt" "$hline" )" @@ -422,8 +415,6 @@ f_dialog_inputbox_size() # f_xdialog_2inputsbox_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" local label1="$4" init1="$5" label2="$6" init2="$7" n local size="$( f_dialog_inputbox_size \ @@ -519,8 +510,6 @@ f_xdialog_2inputsbox_size() # f_dialog_menu_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n=0 local min_width min_rows max_size @@ -603,8 +592,6 @@ f_dialog_menu_size() # f_dialog_menu_with_help_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n=0 local min_width min_rows max_size @@ -704,8 +691,6 @@ f_dialog_menu_with_help_size() # f_dialog_radiolist_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n=0 local min_width min_rows max_size @@ -788,8 +773,6 @@ f_dialog_radiolist_size() # f_dialog_calendar_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n local size="$( f_dialog_infobox_size \ "$title" "$btitle" "$prompt" "$hline" )" @@ -869,8 +852,6 @@ f_dialog_calendar_size() # f_dialog_timebox_size() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local title="$1" btitle="$2" prompt="$3" hline="$4" n local size="$( f_dialog_infobox_size \ "$title" "$btitle" "$prompt" "$hline" )" @@ -934,8 +915,6 @@ f_dialog_timebox_size() # f_dialog_clear() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - $DIALOG --clear } @@ -948,8 +927,6 @@ f_dialog_clear() # f_dialog_info() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local info_text="$*" local size="$( f_dialog_infobox_size \ "$DIALOG_TITLE" \ @@ -972,8 +949,6 @@ f_dialog_info() # f_xdialog_info() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local info_text="$*" local size="$( f_dialog_infobox_size \ "$DIALOG_TITLE" \ @@ -1000,8 +975,6 @@ f_xdialog_info() # f_dialog_msgbox() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local msg_text="$*" local size="$( f_dialog_buttonbox_size \ "$DIALOG_TITLE" \ @@ -1028,8 +1001,6 @@ f_dialog_msgbox() # f_dialog_textbox() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local file="$1" local contents retval size @@ -1070,8 +1041,6 @@ f_dialog_textbox() # f_dialog_yesno() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local msg_text="$*" local hline="$hline_arrows_tab_enter" local size="$( f_dialog_buttonbox_size \ @@ -1112,8 +1081,6 @@ f_dialog_yesno() # f_dialog_noyes() { - [ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init - local msg_text="$*" local hline="$hline_arrows_tab_enter" local size="$( f_dialog_buttonbox_size \ @@ -1462,4 +1429,8 @@ f_dialog_init() fi } +############################################################ MAIN + +[ "$DIALOG_SELF_INITIALIZE" ] && f_dialog_init + fi # ! $_DIALOG_SUBR From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:12:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E673782D for ; Tue, 27 Nov 2012 22:12:25 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 5A7028FC15 for ; Tue, 27 Nov 2012 22:12:25 +0000 (UTC) Received: (qmail 37063 invoked from network); 27 Nov 2012 23:43:59 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 27 Nov 2012 23:43:59 -0000 Message-ID: <50B53ABC.1010304@freebsd.org> Date: Tue, 27 Nov 2012 23:12:12 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Alfred Perlstein Subject: Re: svn commit: r243594 - head/sys/netinet References: <201211270304.qAR34PfD056691@svn.freebsd.org> In-Reply-To: <201211270304.qAR34PfD056691@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:12:26 -0000 On 27.11.2012 04:04, Alfred Perlstein wrote: > Author: alfred > Date: Tue Nov 27 03:04:24 2012 > New Revision: 243594 > URL: http://svnweb.freebsd.org/changeset/base/243594 > > Log: > Auto size the tcbhashsize structure based on max sockets. > > While here, also make the code that enforces power-of-two more > forgiving, instead of just resetting to 512, graciously round-down > to the next lower power of two. The porthash (also a parameter to in_pcbinfo_init()) should not be scaled the same as tcbhashsize. It's unlikely that anyone is going to have more than a thousand listen ports. The default tcbhashsize scaling factor of maxsockets / 4 is IMHO excessive. If someone is running at the limit he's going to up maxsockets to double the target load. Dividing by 8 is a better balance for normal and well used large memory machines. The hashsize calculation logic is done a bit in a roundabout way. What do think of the attached patch to fix the porthash and to simplify the hashsize logic? -- Andre Index: netinet/tcp_subr.c =================================================================== --- netinet/tcp_subr.c (revision 243631) +++ netinet/tcp_subr.c (working copy) @@ -229,14 +229,17 @@ void *ip4hdr, const void *ip6hdr); /* - * Target size of TCP PCB hash tables. Must be a power of two. + * Minimal size of TCP PCB hash tables. Must be a power of two. * * Note that this can be overridden by the kernel environment * variable net.inet.tcp.tcbhashsize */ -#ifndef TCBHASHSIZE -#define TCBHASHSIZE 0 +#ifndef TCBMINHASHSIZE +#define TCBMINHASHSIZE 512 #endif +#ifndef TCBPORTHASHSIZE +#define TCBPORTHASHSIZE 512 +#endif /* * XXX @@ -282,35 +285,10 @@ return (0); } -/* - * Take a value and get the next power of 2 that doesn't overflow. - * Used to size the tcp_inpcb hash buckets. - */ -static int -maketcp_hashsize(int size) -{ - int hashsize; - - /* - * auto tune. - * get the next power of 2 higher than maxsockets. - */ - hashsize = 1 << fls(size); - /* catch overflow, and just go one power of 2 smaller */ - if (hashsize < size) { - hashsize = 1 << (fls(size) - 1); - } - return (hashsize); -} - void tcp_init(void) { - const char *tcbhash_tuneable; - int hashsize; - tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; - if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, &V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) printf("%s: WARNING: unable to register helper hook\n", __func__); @@ -318,49 +296,17 @@ &V_tcp_hhh[HHOOK_TCP_EST_OUT], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) printf("%s: WARNING: unable to register helper hook\n", __func__); - hashsize = TCBHASHSIZE; - TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); - if (hashsize == 0) { - /* - * Auto tune the hash size based on maxsockets. - * A perfect hash would have a 1:1 mapping - * (hashsize = maxsockets) however it's been - * suggested that O(2) average is better. - */ - hashsize = maketcp_hashsize(maxsockets / 4); - /* - * Our historical default is 512, - * do not autotune lower than this. - */ - if (hashsize < 512) - hashsize = 512; - if (bootverbose) - printf("%s: %s auto tuned to %d\n", __func__, - tcbhash_tuneable, hashsize); + tcp_tcbhashsize = 0x1 << fls((maxsockets / 8) - 1); + TUNABLE_INT_FETCH("net.inet.tcp.tcbhashsize", &tcp_tcbhashsize); + if (!powerof2(tcp_tcbhashsize) || + tcp_tcbhashsize < TCBMINHASHSIZE) { + printf("WARNING: TCB hash size not a power of 2 or too small\n"); + tcp_tcbhashsize = TCBMINHASHSIZE; } - /* - * We require a hashsize to be a power of two. - * Previously if it was not a power of two we would just reset it - * back to 512, which could be a nasty surprise if you did not notice - * the error message. - * Instead what we do is clip it to the closest power of two lower - * than the specified hash value. - */ - if (!powerof2(hashsize)) { - int oldhashsize = hashsize; + in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, tcp_tcbhashsize, + TCBPORTHASHSIZE, "tcp_inpcb", tcp_inpcb_init, NULL, + UMA_ZONE_NOFREE, IPI_HASHFIELDS_4TUPLE); - hashsize = maketcp_hashsize(hashsize); - /* prevent absurdly low value */ - if (hashsize < 16) - hashsize = 16; - printf("%s: WARNING: TCB hash size not a power of 2, " - "clipped from %d to %d.\n", __func__, oldhashsize, - hashsize); - } - in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, hashsize, hashsize, - "tcp_inpcb", tcp_inpcb_init, NULL, UMA_ZONE_NOFREE, - IPI_HASHFIELDS_4TUPLE); - /* * These have to be type stable for the benefit of the timers. */ @@ -393,7 +339,6 @@ tcp_rexmit_min = 1; tcp_rexmit_slop = TCPTV_CPU_VAR; tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; - tcp_tcbhashsize = hashsize; TUNABLE_INT_FETCH("net.inet.tcp.soreceive_stream", &tcp_soreceive_stream); if (tcp_soreceive_stream) { From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:14:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 773B1A64; Tue, 27 Nov 2012 22:14:23 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CD268FC15; Tue, 27 Nov 2012 22:14:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARMEN6q070858; Tue, 27 Nov 2012 22:14:23 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARMENIN070857; Tue, 27 Nov 2012 22:14:23 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201211272214.qARMENIN070857@svn.freebsd.org> From: Devin Teske Date: Tue, 27 Nov 2012 22:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243636 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:14:23 -0000 Author: dteske Date: Tue Nov 27 22:14:22 2012 New Revision: 243636 URL: http://svnweb.freebsd.org/changeset/base/243636 Log: Allow setting of NULL titles with f_dialog_[back]title(). Approved by: adrian (co-mentor) (implicit) Modified: head/usr.sbin/bsdconfig/share/dialog.subr Modified: head/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/dialog.subr Tue Nov 27 22:11:53 2012 (r243635) +++ head/usr.sbin/bsdconfig/share/dialog.subr Tue Nov 27 22:14:22 2012 (r243636) @@ -92,7 +92,7 @@ f_dialog_title() { local new_title="$1" - if [ "$new_title" ]; then + if [ "${1+set}" ]; then if [ "$USE_XDIALOG" ]; then _DIALOG_BACKTITLE="$DIALOG_BACKTITLE" DIALOG_BACKTITLE="$new_title" @@ -133,7 +133,7 @@ f_dialog_backtitle() { local new_backtitle="$1" - if [ "$new_backtitle" ]; then + if [ "${1+set}" ]; then if [ "$USE_XDIALOG" ]; then _DIALOG_TITLE="$DIALOG_TITLE" DIALOG_TITLE="$new_backtitle" From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:34:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C6B7B5BD; Tue, 27 Nov 2012 22:34:46 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ADBFD8FC15; Tue, 27 Nov 2012 22:34:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARMYkTs074157; Tue, 27 Nov 2012 22:34:46 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARMYk0D074156; Tue, 27 Nov 2012 22:34:46 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201211272234.qARMYk0D074156@svn.freebsd.org> From: Alfred Perlstein Date: Tue, 27 Nov 2012 22:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243637 - head/usr.sbin/nfsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:34:46 -0000 Author: alfred Date: Tue Nov 27 22:34:46 2012 New Revision: 243637 URL: http://svnweb.freebsd.org/changeset/base/243637 Log: Autoconfigure nfsd threads based on ncpu. Rick Macklem and I discussed the default number of nfsd threads and concluded that it is too low to perform adiquitely on today's hardware. We decided to auto tune the number of nfsds based on the number of cpus in the system. While I'm here I've also added: 1) ability to set the minthreads/maxthreads from userland. 2) ability to run nfsd in debug mode via the cli. Reviewed by: rmacklem MFC after: 2 weeks Modified: head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Tue Nov 27 22:14:22 2012 (r243636) +++ head/usr.sbin/nfsd/nfsd.c Tue Nov 27 22:34:46 2012 (r243637) @@ -53,6 +53,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -71,14 +72,11 @@ static const char rcsid[] = #include #include #include +#include + +#include -/* Global defs */ -#ifdef DEBUG -#define syslog(e, s...) fprintf(stderr,s) -static int debug = 1; -#else static int debug = 0; -#endif #define NFSD_STABLERESTART "/var/db/nfs-stablerestart" #define NFSD_STABLEBACKUP "/var/db/nfs-stablerestart.bak" @@ -86,11 +84,26 @@ static int debug = 0; #define DEFNFSDCNT 4 static pid_t children[MAXNFSDCNT]; /* PIDs of children */ static int nfsdcnt; /* number of children */ +static int nfsdcnt_set; +static int minthreads; +static int maxthreads; static int new_syscall; static int run_v4server = 1; /* Force running of nfsv4 server */ static int nfssvc_nfsd; /* Set to correct NFSSVC_xxx flag */ static int stablefd = -1; /* Fd for the stable restart file */ static int backupfd; /* Fd for the backup stable restart file */ +static const char *getopt_shortopts; +static const char *getopt_usage; + +static int minthreads_set; +static int maxthreads_set; + +static struct option longopts[] = { + { "debug", no_argument, &debug, 1 }, + { "minthreads", required_argument, &minthreads_set, 1 }, + { "maxthreads", required_argument, &maxthreads_set, 1 }, + { NULL, 0, NULL, 0} +}; void cleanup(int); void child_cleanup(int); @@ -145,26 +158,28 @@ main(int argc, char **argv) int udpflag, ecode, error, s, srvcnt; int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; int nfssvc_addsock; + int longindex = 0; + const char *lopt; char **bindhost = NULL; pid_t pid; nfsdcnt = DEFNFSDCNT; unregister = reregister = tcpflag = maxsock = 0; bindanyflag = udpflag = connect_type_cnt = bindhostc = 0; -#define GETOPT "ah:n:rdtueo" -#define USAGE "[-ardtueo] [-n num_servers] [-h bindip]" - while ((ch = getopt(argc, argv, GETOPT)) != -1) + getopt_shortopts = "ah:n:rdtueo"; + getopt_usage = + "usage:\n" + " nfsd [-ardtueo] [-h bindip]\n" + " [-n numservers] [--minthreads #] [--maxthreads #]\n"; + while ((ch = getopt_long(argc, argv, getopt_shortopts, longopts, + &longindex)) != -1) switch (ch) { case 'a': bindanyflag = 1; break; case 'n': + nfsdcnt_set = 1; nfsdcnt = atoi(optarg); - if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) { - warnx("nfsd count %d; reset to %d", nfsdcnt, - DEFNFSDCNT); - nfsdcnt = DEFNFSDCNT; - } break; case 'h': bindhostc++; @@ -193,6 +208,14 @@ main(int argc, char **argv) case 'o': run_v4server = 0; break; + case 0: + lopt = longopts[longindex].name; + if (!strcmp(lopt, "minthreads")) { + minthreads = atoi(optarg); + } else if (!strcmp(lopt, "maxthreads")) { + maxthreads = atoi(optarg); + } + break; default: case '?': usage(); @@ -209,6 +232,7 @@ main(int argc, char **argv) if (argc > 1) usage(); if (argc == 1) { + nfsdcnt_set = 1; nfsdcnt = atoi(argv[0]); if (nfsdcnt < 1 || nfsdcnt > MAXNFSDCNT) { warnx("nfsd count %d; reset to %d", nfsdcnt, @@ -356,7 +380,7 @@ main(int argc, char **argv) (void)signal(SIGCHLD, reapchild); (void)signal(SIGUSR2, backup_stable); - openlog("nfsd", LOG_PID, LOG_DAEMON); + openlog("nfsd", LOG_PID | (debug ? LOG_PERROR : 0), LOG_DAEMON); /* * For V4, we open the stablerestart file and call nfssvc() @@ -374,13 +398,13 @@ main(int argc, char **argv) if (run_v4server > 0) { open_stable(&stablefd, &backupfd); if (stablefd < 0) { - syslog(LOG_ERR, "Can't open %s\n", NFSD_STABLERESTART); + syslog(LOG_ERR, "Can't open %s: %m\n", NFSD_STABLERESTART); exit(1); } /* This system call will fail for old kernels, but that's ok. */ nfssvc(NFSSVC_BACKUPSTABLE, NULL); if (nfssvc(NFSSVC_STABLERESTART, (caddr_t)&stablefd) < 0) { - syslog(LOG_ERR, "Can't read stable storage file\n"); + syslog(LOG_ERR, "Can't read stable storage file: %m\n"); exit(1); } nfssvc_addsock = NFSSVC_NFSDADDSOCK; @@ -401,6 +425,16 @@ main(int argc, char **argv) } if (!new_syscall) { + if (nfsdcnt < 1) { + warnx("nfsd count too low %d; reset to %d", nfsdcnt, + DEFNFSDCNT); + nfsdcnt = DEFNFSDCNT; + } + if (nfsdcnt > MAXNFSDCNT) { + warnx("nfsd counta too high %d; reset to %d", nfsdcnt, + DEFNFSDCNT); + nfsdcnt = MAXNFSDCNT; + } /* If we use UDP only, we start the last server below. */ srvcnt = tcpflag ? nfsdcnt : nfsdcnt - 1; for (i = 0; i < srvcnt; i++) { @@ -855,7 +889,7 @@ setbindhost(struct addrinfo **ai, const void usage(void) { - (void)fprintf(stderr, "usage: nfsd %s\n", USAGE); + (void)fprintf(stderr, "%s", getopt_usage); exit(1); } @@ -923,6 +957,29 @@ nfsd_exit(int status) exit(status); } +static int +get_tuned_nfsdcount(void) +{ + int ncpu, error, tuned_nfsdcnt; + size_t ncpu_size; + + ncpu_size = sizeof(ncpu); + error = sysctlbyname("hw.ncpu", &ncpu, &ncpu_size, NULL, 0); + if (error) { + warnx("sysctlbyname(hw.ncpu) failed defaulting to %d nfs servers", + DEFNFSDCNT); + tuned_nfsdcnt = DEFNFSDCNT; + } else { + tuned_nfsdcnt = ncpu * 8; + } + if (!new_syscall && tuned_nfsdcnt > MAXNFSDCNT) { + warnx("nfsd count %d; truncated to %d", tuned_nfsdcnt, + MAXNFSDCNT); + tuned_nfsdcnt = MAXNFSDCNT; + } + return tuned_nfsdcnt; +} + void start_server(int master) { @@ -952,8 +1009,28 @@ start_server(int master) } } nfsdargs.principal = principal; - nfsdargs.minthreads = nfsdcnt; - nfsdargs.maxthreads = nfsdcnt; + + if (minthreads_set) { + nfsdargs.minthreads = minthreads; + if (!maxthreads_set) + nfsdargs.maxthreads = minthreads; + } + if (maxthreads_set) { + nfsdargs.maxthreads = maxthreads; + if (!minthreads_set) + nfsdargs.minthreads = maxthreads; + } + if (nfsdcnt_set) { + nfsdargs.minthreads = nfsdcnt; + nfsdargs.maxthreads = nfsdcnt; + } + if (!minthreads_set && !maxthreads_set && !nfsdcnt_set) { + int tuned_nfsdcnt; + + tuned_nfsdcnt = get_tuned_nfsdcount(); + nfsdargs.minthreads = tuned_nfsdcnt; + nfsdargs.maxthreads = tuned_nfsdcnt; + } error = nfssvc(nfssvc_nfsd, &nfsdargs); if (error < 0 && errno == EAUTH) { /* From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:35:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C04B7769 for ; Tue, 27 Nov 2012 22:35:44 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 346398FC15 for ; Tue, 27 Nov 2012 22:35:43 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so9836362lbb.13 for ; Tue, 27 Nov 2012 14:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NBZhnIAnjZp+Yc2JRsOuekKN6FwjlIfdnt6xfO+i02M=; b=Mv/HI3BS3TjsKmsofn/3akds0JcTyfjeXBPI406n3l6oU0mbrWXLAtBnCdu2UGATmZ hGmIkavWralFftN/F31m86GDZujWdp7fh1x7KXUsyyM7XxZin9jyR5HAlzjeMk31RBRF fhHEtRhCS4ni7qfevddnPoxPD4euTfwg6ZDwI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=NBZhnIAnjZp+Yc2JRsOuekKN6FwjlIfdnt6xfO+i02M=; b=XoWdUKbV+sw108cDsfIMW7cmCBNkG8diljXZOZytju5hmsoISjjbtnw/GxOpyT62/g FnHdZTJ5Ma5OsQIaf72uzQ6wL1Gp6zwPZilEm7heutXz9Hg18hTBq/4G7zzo5kc03/8C bTDMfrfYSAGg1ZUp0DXwVo2YTYm9xfsgzr+0S5e2TGi/zmt8A4JBW4T0Vrj7/i3gZt5J U31Cqqw1iZ48/hZE9PQ7oj0YV+X4ZmdTvnUICimOWfgvAZEJJju9oyUu+KXCAvM7OcPQ nI6QNJKgVOlg9I4hPxoA9TB3iD36VqLG7ChHsWm5CjNei5kbXcujf8MUKmVl2KAlmUA9 YRhQ== MIME-Version: 1.0 Received: by 10.112.87.40 with SMTP id u8mr7240718lbz.50.1354055742336; Tue, 27 Nov 2012 14:35:42 -0800 (PST) Received: by 10.112.8.36 with HTTP; Tue, 27 Nov 2012 14:35:42 -0800 (PST) In-Reply-To: <201211272004.qARK4qS8047209@svn.freebsd.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> Date: Tue, 27 Nov 2012 14:35:42 -0800 Message-ID: Subject: Re: svn commit: r243627 - head/sys/kern From: Peter Wemm To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmaaymNNjUOwgEsbxxI8k/PjLOet7gWSVlifv5woRpczjMbvEfYuz3NYI2BrOir63KKDewK Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:35:44 -0000 Andre.. this breaks incoming connections. TCP is immediately reset and never even gets to the listener process. You need to back out of fix this urgently please. On Tue, Nov 27, 2012 at 12:04 PM, Andre Oppermann wrote: > Author: andre > Date: Tue Nov 27 20:04:52 2012 > New Revision: 243627 > URL: http://svnweb.freebsd.org/changeset/base/243627 > > Log: > Fix a race on listen socket teardown where while draining the > accept queues a new socket/connection may be added to the queue > due to a race on the ACCEPT_LOCK. > > The submitted patch is slightly changed in comments, teardown > and locking order and extended with KASSERT's. > > Submitted by: Vijay Singh > Found by: His team. > MFC after: 1 week > > Modified: > head/sys/kern/uipc_socket.c > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Tue Nov 27 19:35:21 2012 (r243626) > +++ head/sys/kern/uipc_socket.c Tue Nov 27 20:04:52 2012 (r243627) > @@ -555,6 +555,16 @@ sonewconn(struct socket *head, int conns > so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE; > so->so_state |= connstatus; > ACCEPT_LOCK(); > + /* > + * The accept socket may be tearing down but we just > + * won a race on the ACCEPT_LOCK. > + */ > + if (!(so->so_options & SO_ACCEPTCONN)) { > + SOCK_LOCK(so); > + so->so_head = NULL; > + sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ > + return (NULL); > + } > if (connstatus) { > TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); > so->so_qstate |= SQ_COMP; > @@ -780,9 +790,14 @@ soclose(struct socket *so) > drop: > if (so->so_proto->pr_usrreqs->pru_close != NULL) > (*so->so_proto->pr_usrreqs->pru_close)(so); > + ACCEPT_LOCK(); > if (so->so_options & SO_ACCEPTCONN) { > struct socket *sp; > - ACCEPT_LOCK(); > + /* > + * Prevent new additions to the accept queues due > + * to ACCEPT_LOCK races while we are draining them. > + */ > + so->so_options &= ~SO_ACCEPTCONN; > while ((sp = TAILQ_FIRST(&so->so_incomp)) != NULL) { > TAILQ_REMOVE(&so->so_incomp, sp, so_list); > so->so_incqlen--; > @@ -801,13 +816,15 @@ drop: > soabort(sp); > ACCEPT_LOCK(); > } > - ACCEPT_UNLOCK(); > + KASSERT((TAILQ_EMPTY(&so->so_comp)), > + ("%s: so_comp populated", __func__)); > + KASSERT((TAILQ_EMPTY(&so->so_incomp)), > + ("%s: so_incomp populated", __func__)); > } > - ACCEPT_LOCK(); > SOCK_LOCK(so); > KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); > so->so_state |= SS_NOFDREF; > - sorele(so); > + sorele(so); /* NB: Returns with ACCEPT_UNLOCK(). */ > CURVNET_RESTORE(); > return (error); > } -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:35:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17D0B76D; Tue, 27 Nov 2012 22:35:49 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F1B558FC16; Tue, 27 Nov 2012 22:35:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARMZmor074348; Tue, 27 Nov 2012 22:35:48 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARMZmji074347; Tue, 27 Nov 2012 22:35:48 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211272235.qARMZmji074347@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 22:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243638 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:35:49 -0000 Author: andre Date: Tue Nov 27 22:35:48 2012 New Revision: 243638 URL: http://svnweb.freebsd.org/changeset/base/243638 Log: Fix r243627 by testing against the head socket instead of the socket just created. MFC after: 1 week X-MFC-with: r243627 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Nov 27 22:34:46 2012 (r243637) +++ head/sys/kern/uipc_socket.c Tue Nov 27 22:35:48 2012 (r243638) @@ -556,7 +556,7 @@ sonewconn(struct socket *head, int conns * The accept socket may be tearing down but we just * won a race on the ACCEPT_LOCK. */ - if (!(so->so_options & SO_ACCEPTCONN)) { + if (!(head->so_options & SO_ACCEPTCONN)) { SOCK_LOCK(so); so->so_head = NULL; sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:41:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5736BFD for ; Tue, 27 Nov 2012 22:41:17 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 20E4A8FC14 for ; Tue, 27 Nov 2012 22:41:16 +0000 (UTC) Received: (qmail 37223 invoked from network); 28 Nov 2012 00:12:51 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 00:12:51 -0000 Message-ID: <50B54180.5020608@freebsd.org> Date: Tue, 27 Nov 2012 23:41:04 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Peter Wemm Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:41:18 -0000 On 27.11.2012 23:35, Peter Wemm wrote: > Andre.. this breaks incoming connections. TCP is immediately reset > and never even gets to the listener process. You need to back out of > fix this urgently please. I just found out and fixed it. Sorry for the breakage. -- Andre > On Tue, Nov 27, 2012 at 12:04 PM, Andre Oppermann wrote: >> Author: andre >> Date: Tue Nov 27 20:04:52 2012 >> New Revision: 243627 >> URL: http://svnweb.freebsd.org/changeset/base/243627 >> >> Log: >> Fix a race on listen socket teardown where while draining the >> accept queues a new socket/connection may be added to the queue >> due to a race on the ACCEPT_LOCK. >> >> The submitted patch is slightly changed in comments, teardown >> and locking order and extended with KASSERT's. >> >> Submitted by: Vijay Singh >> Found by: His team. >> MFC after: 1 week >> >> Modified: >> head/sys/kern/uipc_socket.c >> >> Modified: head/sys/kern/uipc_socket.c >> ============================================================================== >> --- head/sys/kern/uipc_socket.c Tue Nov 27 19:35:21 2012 (r243626) >> +++ head/sys/kern/uipc_socket.c Tue Nov 27 20:04:52 2012 (r243627) >> @@ -555,6 +555,16 @@ sonewconn(struct socket *head, int conns >> so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE; >> so->so_state |= connstatus; >> ACCEPT_LOCK(); >> + /* >> + * The accept socket may be tearing down but we just >> + * won a race on the ACCEPT_LOCK. >> + */ >> + if (!(so->so_options & SO_ACCEPTCONN)) { >> + SOCK_LOCK(so); >> + so->so_head = NULL; >> + sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. */ >> + return (NULL); >> + } >> if (connstatus) { >> TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); >> so->so_qstate |= SQ_COMP; >> @@ -780,9 +790,14 @@ soclose(struct socket *so) >> drop: >> if (so->so_proto->pr_usrreqs->pru_close != NULL) >> (*so->so_proto->pr_usrreqs->pru_close)(so); >> + ACCEPT_LOCK(); >> if (so->so_options & SO_ACCEPTCONN) { >> struct socket *sp; >> - ACCEPT_LOCK(); >> + /* >> + * Prevent new additions to the accept queues due >> + * to ACCEPT_LOCK races while we are draining them. >> + */ >> + so->so_options &= ~SO_ACCEPTCONN; >> while ((sp = TAILQ_FIRST(&so->so_incomp)) != NULL) { >> TAILQ_REMOVE(&so->so_incomp, sp, so_list); >> so->so_incqlen--; >> @@ -801,13 +816,15 @@ drop: >> soabort(sp); >> ACCEPT_LOCK(); >> } >> - ACCEPT_UNLOCK(); >> + KASSERT((TAILQ_EMPTY(&so->so_comp)), >> + ("%s: so_comp populated", __func__)); >> + KASSERT((TAILQ_EMPTY(&so->so_incomp)), >> + ("%s: so_incomp populated", __func__)); >> } >> - ACCEPT_LOCK(); >> SOCK_LOCK(so); >> KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); >> so->so_state |= SS_NOFDREF; >> - sorele(so); >> + sorele(so); /* NB: Returns with ACCEPT_UNLOCK(). */ >> CURVNET_RESTORE(); >> return (error); >> } > > > From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:48:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83101E7D; Tue, 27 Nov 2012 22:48:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 361298FC14; Tue, 27 Nov 2012 22:48:50 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id C37CB46B17; Tue, 27 Nov 2012 17:48:49 -0500 (EST) Date: Tue, 27 Nov 2012 22:48:49 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andre Oppermann Subject: Re: svn commit: r243627 - head/sys/kern In-Reply-To: <50B54180.5020608@freebsd.org> Message-ID: References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:48:50 -0000 On Tue, 27 Nov 2012, Andre Oppermann wrote: > On 27.11.2012 23:35, Peter Wemm wrote: >> Andre.. this breaks incoming connections. TCP is immediately reset and >> never even gets to the listener process. You need to back out of fix this >> urgently please. > > I just found out and fixed it. Sorry for the breakage. I'd like to see a much more thorough use of "Reviewed by:" in socket and TCP-related commits -- this is very sensitive code, and a second pair of eyes is always valuable. Post-commit review is not a substitute. Looking back over similar changes in the socket code over the last two years, I see that almost all have reviewers, so I think it would be reasonable to consider it mandatory for these subsystems at this point. The good news is that we have lots of people with expertise in it. Robert > > -- > Andre > >> On Tue, Nov 27, 2012 at 12:04 PM, Andre Oppermann >> wrote: >>> Author: andre >>> Date: Tue Nov 27 20:04:52 2012 >>> New Revision: 243627 >>> URL: http://svnweb.freebsd.org/changeset/base/243627 >>> >>> Log: >>> Fix a race on listen socket teardown where while draining the >>> accept queues a new socket/connection may be added to the queue >>> due to a race on the ACCEPT_LOCK. >>> >>> The submitted patch is slightly changed in comments, teardown >>> and locking order and extended with KASSERT's. >>> >>> Submitted by: Vijay Singh >>> Found by: His team. >>> MFC after: 1 week >>> >>> Modified: >>> head/sys/kern/uipc_socket.c >>> >>> Modified: head/sys/kern/uipc_socket.c >>> ============================================================================== >>> --- head/sys/kern/uipc_socket.c Tue Nov 27 19:35:21 2012 (r243626) >>> +++ head/sys/kern/uipc_socket.c Tue Nov 27 20:04:52 2012 (r243627) >>> @@ -555,6 +555,16 @@ sonewconn(struct socket *head, int conns >>> so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE; >>> so->so_state |= connstatus; >>> ACCEPT_LOCK(); >>> + /* >>> + * The accept socket may be tearing down but we just >>> + * won a race on the ACCEPT_LOCK. >>> + */ >>> + if (!(so->so_options & SO_ACCEPTCONN)) { >>> + SOCK_LOCK(so); >>> + so->so_head = NULL; >>> + sofree(so); /* NB: returns ACCEPT_UNLOCK'ed. >>> */ >>> + return (NULL); >>> + } >>> if (connstatus) { >>> TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); >>> so->so_qstate |= SQ_COMP; >>> @@ -780,9 +790,14 @@ soclose(struct socket *so) >>> drop: >>> if (so->so_proto->pr_usrreqs->pru_close != NULL) >>> (*so->so_proto->pr_usrreqs->pru_close)(so); >>> + ACCEPT_LOCK(); >>> if (so->so_options & SO_ACCEPTCONN) { >>> struct socket *sp; >>> - ACCEPT_LOCK(); >>> + /* >>> + * Prevent new additions to the accept queues due >>> + * to ACCEPT_LOCK races while we are draining them. >>> + */ >>> + so->so_options &= ~SO_ACCEPTCONN; >>> while ((sp = TAILQ_FIRST(&so->so_incomp)) != NULL) { >>> TAILQ_REMOVE(&so->so_incomp, sp, so_list); >>> so->so_incqlen--; >>> @@ -801,13 +816,15 @@ drop: >>> soabort(sp); >>> ACCEPT_LOCK(); >>> } >>> - ACCEPT_UNLOCK(); >>> + KASSERT((TAILQ_EMPTY(&so->so_comp)), >>> + ("%s: so_comp populated", __func__)); >>> + KASSERT((TAILQ_EMPTY(&so->so_incomp)), >>> + ("%s: so_incomp populated", __func__)); >>> } >>> - ACCEPT_LOCK(); >>> SOCK_LOCK(so); >>> KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF")); >>> so->so_state |= SS_NOFDREF; >>> - sorele(so); >>> + sorele(so); /* NB: Returns with >>> ACCEPT_UNLOCK(). */ >>> CURVNET_RESTORE(); >>> return (error); >>> } >> >> >> > > From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 22:54:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64F32213 for ; Tue, 27 Nov 2012 22:54:23 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id BD5608FC1B for ; Tue, 27 Nov 2012 22:54:22 +0000 (UTC) Received: (qmail 37300 invoked from network); 28 Nov 2012 00:25:56 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 00:25:56 -0000 Message-ID: <50B54492.5040100@freebsd.org> Date: Tue, 27 Nov 2012 23:54:10 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Robert Watson Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:54:23 -0000 On 27.11.2012 23:48, Robert Watson wrote: > > On Tue, 27 Nov 2012, Andre Oppermann wrote: > >> On 27.11.2012 23:35, Peter Wemm wrote: >>> Andre.. this breaks incoming connections. TCP is immediately reset and never even gets to the >>> listener process. You need to back out of fix this urgently please. >> >> I just found out and fixed it. Sorry for the breakage. > > I'd like to see a much more thorough use of "Reviewed by:" in socket and TCP-related commits -- this > is very sensitive code, and a second pair of eyes is always valuable. Post-commit review is not a > substitute. Looking back over similar changes in the socket code over the last two years, I see > that almost all have reviewers, so I think it would be reasonable to consider it mandatory for these > subsystems at this point. The good news is that we have lots of people with expertise in it. Good to see you becoming more active again. :-) And yes, you have a point there. -- Andre From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 23:05:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0332E71B; Tue, 27 Nov 2012 23:05:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C1C058FC15; Tue, 27 Nov 2012 23:05:41 +0000 (UTC) Received: from [192.168.2.119] (host86-146-118-26.range86-146.btcentralplus.com [86.146.118.26]) by cyrus.watson.org (Postfix) with ESMTPSA id 8EF1D46B06; Tue, 27 Nov 2012 18:05:40 -0500 (EST) Subject: Re: svn commit: r243627 - head/sys/kern Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: "Robert N. M. Watson" In-Reply-To: <50B54492.5040100@freebsd.org> Date: Tue, 27 Nov 2012 23:05:39 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> To: Andre Oppermann X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 23:05:42 -0000 On 27 Nov 2012, at 22:54, Andre Oppermann wrote: >>>> Andre.. this breaks incoming connections. TCP is immediately reset = and never even gets to the >>>> listener process. You need to back out of fix this urgently = please. >>>=20 >>> I just found out and fixed it. Sorry for the breakage. >>=20 >> I'd like to see a much more thorough use of "Reviewed by:" in socket = and TCP-related commits -- this >> is very sensitive code, and a second pair of eyes is always valuable. = Post-commit review is not a >> substitute. Looking back over similar changes in the socket code = over the last two years, I see >> that almost all have reviewers, so I think it would be reasonable to = consider it mandatory for these >> subsystems at this point. The good news is that we have lots of = people with expertise in it. >=20 > Good to see you becoming more active again. :-) And yes, > you have a point there. Yes -- this is only about three weeks old, however; for the prior = six-twelve months, I've been fairly non-existent in FreeBSD-land due to = outside obligations :-). Robert= From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 23:16:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42E4D123; Tue, 27 Nov 2012 23:16:57 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0D8368FC08; Tue, 27 Nov 2012 23:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qARNGuJL080899; Tue, 27 Nov 2012 23:16:56 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qARNGurs080897; Tue, 27 Nov 2012 23:16:56 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211272316.qARNGurs080897@svn.freebsd.org> From: Andre Oppermann Date: Tue, 27 Nov 2012 23:16:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243639 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 23:16:57 -0000 Author: andre Date: Tue Nov 27 23:16:56 2012 New Revision: 243639 URL: http://svnweb.freebsd.org/changeset/base/243639 Log: Complete r243631 by applying the remainder of kern_mbuf.c that got lost while merging into the commit tree. MFC after: 1 month X-MFC-with: r243631 Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Tue Nov 27 22:35:48 2012 (r243638) +++ head/sys/kern/kern_mbuf.c Tue Nov 27 23:16:56 2012 (r243639) @@ -107,36 +107,38 @@ struct mbstat mbstat; * tunable_mbinit() has to be run before init_maxsockets() thus * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets() * runs at SI_ORDER_ANY. + * + * NB: This has to be done before VM init. */ static void tunable_mbinit(void *dummy) { - /* This has to be done before VM init. */ TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters); - if (nmbclusters == 0) { -#ifdef VM_AUTOTUNE_NMBCLUSTERS - nmbclusters = VM_AUTOTUNE_NMBCLUSTERS; -#else - nmbclusters = 1024 + maxusers * 64; -#endif -#ifdef VM_MAX_AUTOTUNE_NMBCLUSTERS - if (nmbclusters > VM_MAX_AUTOTUNE_NMBCLUSTERS) - nmbclusters = VM_MAX_AUTOTUNE_NMBCLUSTERS; -#endif - } + if (nmbclusters == 0) + nmbclusters = maxmbufmem / MCLBYTES / 4; TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop); if (nmbjumbop == 0) - nmbjumbop = nmbclusters / 2; + nmbjumbop = maxmbufmem / MJUMPAGESIZE / 4; TUNABLE_INT_FETCH("kern.ipc.nmbjumbo9", &nmbjumbo9); if (nmbjumbo9 == 0) - nmbjumbo9 = nmbclusters / 4; + nmbjumbo9 = maxmbufmem / MJUM9BYTES / 6; TUNABLE_INT_FETCH("kern.ipc.nmbjumbo16", &nmbjumbo16); if (nmbjumbo16 == 0) - nmbjumbo16 = nmbclusters / 8; + nmbjumbo16 = maxmbufmem / MJUM16BYTES / 6; + + /* + * We need at least as many mbufs as we have clusters of + * the various types added together. + */ + TUNABLE_INT_FETCH("kern.ipc.nmbufs", &nmbufs); + if (nmbufs < nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) + nmbufs = lmax(maxmbufmem / MSIZE / 5, + nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16); + } SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL); @@ -241,7 +243,7 @@ sysctl_nmbufs(SYSCTL_HANDLER_ARGS) if (newnmbufs > nmbufs) { nmbufs = newnmbufs; uma_zone_set_max(zone_mbuf, nmbufs); - nmbclusters = uma_zone_get_max(zone_mbuf); + nmbufs = uma_zone_get_max(zone_mbuf); EVENTHANDLER_INVOKE(nmbufs_change); } else error = EINVAL; From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 23:21:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 143B3628 for ; Tue, 27 Nov 2012 23:21:25 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 948108FC15 for ; Tue, 27 Nov 2012 23:21:24 +0000 (UTC) Received: (qmail 37468 invoked from network); 28 Nov 2012 00:52:58 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 00:52:58 -0000 Message-ID: <50B54AE8.4060509@freebsd.org> Date: Wed, 28 Nov 2012 00:21:12 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r243639 - head/sys/kern References: <201211272316.qARNGurs080897@svn.freebsd.org> In-Reply-To: <201211272316.qARNGurs080897@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 23:21:25 -0000 On 28.11.2012 00:16, Andre Oppermann wrote: > Author: andre > Date: Tue Nov 27 23:16:56 2012 > New Revision: 243639 > URL: http://svnweb.freebsd.org/changeset/base/243639 > > Log: > Complete r243631 by applying the remainder of kern_mbuf.c that got > lost while merging into the commit tree. Please note that this didn't have any serious negative effects. -- Andre From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 23:29:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6DEBFB59 for ; Tue, 27 Nov 2012 23:29:49 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id AF3238FC1A for ; Tue, 27 Nov 2012 23:29:48 +0000 (UTC) Received: (qmail 37523 invoked from network); 28 Nov 2012 01:01:22 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 01:01:22 -0000 Message-ID: <50B54CE0.6080008@freebsd.org> Date: Wed, 28 Nov 2012 00:29:36 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: "Robert N. M. Watson" Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> In-Reply-To: <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 23:29:49 -0000 On 28.11.2012 00:05, Robert N. M. Watson wrote: > > On 27 Nov 2012, at 22:54, Andre Oppermann wrote: > >>>>> Andre.. this breaks incoming connections. TCP is immediately reset and never even gets to the >>>>> listener process. You need to back out of fix this urgently please. >>>> >>>> I just found out and fixed it. Sorry for the breakage. >>> >>> I'd like to see a much more thorough use of "Reviewed by:" in socket and TCP-related commits -- this >>> is very sensitive code, and a second pair of eyes is always valuable. Post-commit review is not a >>> substitute. Looking back over similar changes in the socket code over the last two years, I see >>> that almost all have reviewers, so I think it would be reasonable to consider it mandatory for these >>> subsystems at this point. The good news is that we have lots of people with expertise in it. >> >> Good to see you becoming more active again. :-) And yes, >> you have a point there. > > Yes -- this is only about three weeks old, however; for the prior six-twelve months, I've been fairly non-existent in FreeBSD-land due to outside obligations :-). Just saw that I did indeed send you a review request three weeks ago. ;-) At the end of a rather long email though. -- Andre From owner-svn-src-head@FreeBSD.ORG Tue Nov 27 23:59:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4165965D; Tue, 27 Nov 2012 23:59:15 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0EDE58FC12; Tue, 27 Nov 2012 23:59:15 +0000 (UTC) Received: from [192.168.2.119] (host86-146-118-26.range86-146.btcentralplus.com [86.146.118.26]) by cyrus.watson.org (Postfix) with ESMTPSA id DC5D146B2C; Tue, 27 Nov 2012 18:59:13 -0500 (EST) Subject: Re: svn commit: r243627 - head/sys/kern Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: "Robert N. M. Watson" In-Reply-To: <50B54CE0.6080008@freebsd.org> Date: Tue, 27 Nov 2012 23:59:12 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> To: Andre Oppermann X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 23:59:15 -0000 On 27 Nov 2012, at 23:29, Andre Oppermann wrote: >>>>>> Andre.. this breaks incoming connections. TCP is immediately = reset and never even gets to the >>>>>> listener process. You need to back out of fix this urgently = please. >>>>>=20 >>>>> I just found out and fixed it. Sorry for the breakage. >>>>=20 >>>> I'd like to see a much more thorough use of "Reviewed by:" in = socket and TCP-related commits -- this >>>> is very sensitive code, and a second pair of eyes is always = valuable. Post-commit review is not a >>>> substitute. Looking back over similar changes in the socket code = over the last two years, I see >>>> that almost all have reviewers, so I think it would be reasonable = to consider it mandatory for these >>>> subsystems at this point. The good news is that we have lots of = people with expertise in it. >>>=20 >>> Good to see you becoming more active again. :-) And yes, >>> you have a point there. >>=20 >> Yes -- this is only about three weeks old, however; for the prior = six-twelve months, I've been fairly non-existent in FreeBSD-land due to = outside obligations :-). >=20 > Just saw that I did indeed send you a review request three weeks ago. = ;-) > At the end of a rather long email though. Yes, indeed -- no patch was attached, and it followed quite a long = e-mail on your plans to rewrite the TCP stack. I'm afraid that went onto = the "read this later as time permits" pile as I was at a conference, = rather than the fast-path "oh, quickly review this patch" pile. However, = simply committing the patch rather than trying a bit harder to find a = reviewer isn't the right answer either. To maximise the likelihood of a = review, construct an e-mail with a subject line like "Review request: = (patch description)", attach the patch, and include a proposed commit = message. Robert= From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 00:36:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 458D4C17; Wed, 28 Nov 2012 00:36:41 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 115C18FC0C; Wed, 28 Nov 2012 00:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS0ae6P094521; Wed, 28 Nov 2012 00:36:40 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS0aeSO094520; Wed, 28 Nov 2012 00:36:40 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201211280036.qAS0aeSO094520@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 28 Nov 2012 00:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243641 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 00:36:41 -0000 Author: pfg Date: Wed Nov 28 00:36:40 2012 New Revision: 243641 URL: http://svnweb.freebsd.org/changeset/base/243641 Log: Partially bring r242520 to ext2fs. When a file is first being written, the dynamic block reallocation (implemented by ext2_reallocblks) relocates the file's blocks so as to cluster them together into a contiguous set of blocks on the disk. When the cluster crosses the boundary into the first indirect block, the first indirect block is initially allocated in a position immediately following the last direct block. Block reallocation would usually destroy locality by moving the indirect block out of the way to keep the data blocks contiguous. The issue was diagnosed long ago by Bruce Evans on ffs and surfaced on ext2fs when block reallocaton was ported. This is only a partial solution based on the similarities with FFS. We still require more review of the allocation details that vary in ext2fs. Reported by: bde MFC after: 1 week Modified: head/sys/fs/ext2fs/ext2_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed Nov 28 00:02:17 2012 (r243640) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed Nov 28 00:36:40 2012 (r243641) @@ -197,6 +197,18 @@ ext2_reallocblks(ap) panic("ext2_reallocblks: non-cluster"); #endif /* + * If the cluster crosses the boundary for the first indirect + * block, leave space for the indirect block. Indirect blocks + * are initially laid out in a position after the last direct + * block. Block reallocation would usually destroy locality by + * moving the indirect block out of the way to make room for + * data blocks if we didn't compensate here. We should also do + * this for other indirect block boundaries, but it is only + * important for the first one. + */ + if (start_lbn < NDADDR && end_lbn >= NDADDR) + return (ENOSPC); + /* * If the latest allocation is in a new cylinder group, assume that * the filesystem has decided to move and do not force it back to * the previous cylinder group. From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 01:55:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A68EA501; Wed, 28 Nov 2012 01:55:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 82D5F8FC08; Wed, 28 Nov 2012 01:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS1tM1k007726; Wed, 28 Nov 2012 01:55:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS1tM3c007725; Wed, 28 Nov 2012 01:55:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211280155.qAS1tM3c007725@svn.freebsd.org> From: Adrian Chadd Date: Wed, 28 Nov 2012 01:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243642 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 01:55:22 -0000 Author: adrian Date: Wed Nov 28 01:55:22 2012 New Revision: 243642 URL: http://svnweb.freebsd.org/changeset/base/243642 Log: Pull out the debugging code from the critical path and make sure it happens _after_ all of the time delta calculations. Modified: head/sys/dev/ath/if_ath_tdma.c Modified: head/sys/dev/ath/if_ath_tdma.c ============================================================================== --- head/sys/dev/ath/if_ath_tdma.c Wed Nov 28 00:36:40 2012 (r243641) +++ head/sys/dev/ath/if_ath_tdma.c Wed Nov 28 01:55:22 2012 (r243642) @@ -402,28 +402,6 @@ ath_tdma_update(struct ieee80211_node *n * not just 0..65535 TU. */ nextslottu = TSF_TO_TU(nextslot>>32, nextslot); - DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, - "rs->rstamp %llu rstamp %llu tsf %llu txtime %d, nextslot %llu, nextslottu %d, nextslottume %d\n", - (unsigned long long) rs->rs_tstamp, rstamp, tsf, txtime, nextslot, nextslottu, TSF_TO_TU(nextslot >> 32, nextslot)); - DPRINTF(sc, ATH_DEBUG_TDMA, - " beacon tstamp: %llu (0x%016llx)\n", - le64toh(ni->ni_tstamp.tsf), - le64toh(ni->ni_tstamp.tsf)); - -#ifdef ATH_DEBUG_ALQ - if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE)) { - struct if_ath_alq_tdma_beacon_state t; - t.rx_tsf = htobe64(rstamp); - t.beacon_tsf = htobe64(le64toh(ni->ni_tstamp.tsf)); - t.tsf64 = htobe64(tsf); - t.nextslot_tsf = htobe64(nextslot); - t.nextslot_tu = htobe32(nextslottu); - t.txtime = htobe32(txtime); - if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE, - sizeof(t), (char *) &t); - } -#endif - /* * Retrieve the hardware NextTBTT in usecs * and calculate the difference between what the @@ -459,27 +437,22 @@ ath_tdma_update(struct ieee80211_node *n tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, + "rs->rstamp %llu rstamp %llu tsf %llu txtime %d, nextslot %llu, " + "nextslottu %d, nextslottume %d\n", + (unsigned long long) rs->rs_tstamp, rstamp, tsf, txtime, + nextslot, nextslottu, TSF_TO_TU(nextslot >> 32, nextslot)); + DPRINTF(sc, ATH_DEBUG_TDMA, + " beacon tstamp: %llu (0x%016llx)\n", + le64toh(ni->ni_tstamp.tsf), + le64toh(ni->ni_tstamp.tsf)); + + DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, "nexttbtt %llu (0x%08llx) tsfdelta %d avg +%d/-%d\n", nexttbtt, (long long) nexttbtt, tsfdelta, TDMA_AVG(sc->sc_avgtsfdeltap), TDMA_AVG(sc->sc_avgtsfdeltam)); -#ifdef ATH_DEBUG_ALQ - if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) { - struct if_ath_alq_tdma_slot_calc t; - - t.nexttbtt = htobe64(nexttbtt_full); - t.next_slot = htobe64(nextslot); - t.tsfdelta = htobe32(tsfdelta); - t.avg_plus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltap)); - t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam)); - - if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC, - sizeof(t), (char *) &t); - } -#endif - if (tsfdelta < 0) { TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0); TDMA_SAMPLE(sc->sc_avgtsfdeltam, -tsfdelta); @@ -496,6 +469,33 @@ ath_tdma_update(struct ieee80211_node *n } tudelta = nextslottu - TSF_TO_TU(nexttbtt_full >> 32, nexttbtt_full); +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE)) { + struct if_ath_alq_tdma_beacon_state t; + t.rx_tsf = htobe64(rstamp); + t.beacon_tsf = htobe64(le64toh(ni->ni_tstamp.tsf)); + t.tsf64 = htobe64(tsf); + t.nextslot_tsf = htobe64(nextslot); + t.nextslot_tu = htobe32(nextslottu); + t.txtime = htobe32(txtime); + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE, + sizeof(t), (char *) &t); + } + + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) { + struct if_ath_alq_tdma_slot_calc t; + + t.nexttbtt = htobe64(nexttbtt_full); + t.next_slot = htobe64(nextslot); + t.tsfdelta = htobe32(tsfdelta); + t.avg_plus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltap)); + t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam)); + + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC, + sizeof(t), (char *) &t); + } +#endif + /* * Copy sender's timetstamp into tdma ie so they can * calculate roundtrip time. We submit a beacon frame From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 02:24:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08A09FA2; Wed, 28 Nov 2012 02:24:00 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E12668FC14; Wed, 28 Nov 2012 02:23:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS2Nx9b013741; Wed, 28 Nov 2012 02:23:59 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS2NxU7013740; Wed, 28 Nov 2012 02:23:59 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201211280223.qAS2NxU7013740@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 28 Nov 2012 02:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243644 - head/usr.sbin/nfsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 02:24:00 -0000 Author: alfred Date: Wed Nov 28 02:23:59 2012 New Revision: 243644 URL: http://svnweb.freebsd.org/changeset/base/243644 Log: Fix typo. Pointed out by: marck Modified: head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:03:53 2012 (r243643) +++ head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:23:59 2012 (r243644) @@ -431,7 +431,7 @@ main(int argc, char **argv) nfsdcnt = DEFNFSDCNT; } if (nfsdcnt > MAXNFSDCNT) { - warnx("nfsd counta too high %d; reset to %d", nfsdcnt, + warnx("nfsd count too high %d; reset to %d", nfsdcnt, DEFNFSDCNT); nfsdcnt = MAXNFSDCNT; } From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 02:47:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 617A79AB; Wed, 28 Nov 2012 02:47:32 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 44B0E8FC15; Wed, 28 Nov 2012 02:47:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS2lWia018007; Wed, 28 Nov 2012 02:47:32 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS2lWS4018006; Wed, 28 Nov 2012 02:47:32 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201211280247.qAS2lWS4018006@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 28 Nov 2012 02:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243645 - head/usr.sbin/nfsd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 02:47:32 -0000 Author: alfred Date: Wed Nov 28 02:47:31 2012 New Revision: 243645 URL: http://svnweb.freebsd.org/changeset/base/243645 Log: Don't allow minthreads > maxthreads. Suggested by: rmacklem Modified: head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:23:59 2012 (r243644) +++ head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:47:31 2012 (r243645) @@ -224,6 +224,10 @@ main(int argc, char **argv) udpflag = 1; argv += optind; argc -= optind; + if (minthreads_set && maxthreads_set && minthreads > maxthreads) + errx(EX_USAGE, + "error: minthreads(%d) can't be greater than " + "maxthreads(%d)", minthreads, maxthreads); /* * XXX From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 03:04:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E52AEDA; Wed, 28 Nov 2012 03:04:44 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 432AA8FC18; Wed, 28 Nov 2012 03:04:44 +0000 (UTC) Received: from Alfreds-MacBook-Pro-5.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 637E81A3D8A; Tue, 27 Nov 2012 19:04:37 -0800 (PST) Message-ID: <50B57F46.1060207@mu.org> Date: Tue, 27 Nov 2012 19:04:38 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r243594 - head/sys/netinet References: <201211270304.qAR34PfD056691@svn.freebsd.org> <50B53ABC.1010304@freebsd.org> In-Reply-To: <50B53ABC.1010304@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 03:04:44 -0000 On 11/27/12 2:12 PM, Andre Oppermann wrote: > On 27.11.2012 04:04, Alfred Perlstein wrote: >> Author: alfred >> Date: Tue Nov 27 03:04:24 2012 >> New Revision: 243594 >> URL: http://svnweb.freebsd.org/changeset/base/243594 >> >> Log: >> Auto size the tcbhashsize structure based on max sockets. >> >> While here, also make the code that enforces power-of-two more >> forgiving, instead of just resetting to 512, graciously round-down >> to the next lower power of two. > > The porthash (also a parameter to in_pcbinfo_init()) should not be > scaled the same as tcbhashsize. It's unlikely that anyone is going > to have more than a thousand listen ports. > > The default tcbhashsize scaling factor of maxsockets / 4 is IMHO > excessive. If someone is running at the limit he's going to up > maxsockets to double the target load. Dividing by 8 is a better > balance for normal and well used large memory machines. > The hashsize calculation logic is done a bit in a roundabout way. > > What do think of the attached patch to fix the porthash and to simplify > the hashsize logic? > I like the porthash fix. However your change: 1) removes explanation of what the code is doing. (comments/clarity) 2) removes the more forgiving code that rounds-down the tcp_tcbhashsize. Can you please maintain the comments (probably keeping the logic of maketcp_hashsize() in a separate function). Can you please maintain the more forgiving code for dealing with non-power of 2 tunable? I like this, it makes it easier for admins and less error prone. - if (!powerof2(hashsize)) { - int oldhashsize = hashsize; - hashsize = maketcp_hashsize(hashsize); - /* prevent absurdly low value */ - if (hashsize < 16) - hashsize = 16; - printf("%s: WARNING: TCB hash size not a power of 2, " - "clipped from %d to %d.\n", __func__, oldhashsize, - hashsize); From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 06:55:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 358FD548; Wed, 28 Nov 2012 06:55:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2428FC08; Wed, 28 Nov 2012 06:55:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS6tYEm060982; Wed, 28 Nov 2012 06:55:34 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS6tYlb060981; Wed, 28 Nov 2012 06:55:34 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211280655.qAS6tYlb060981@svn.freebsd.org> From: Adrian Chadd Date: Wed, 28 Nov 2012 06:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243647 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 06:55:35 -0000 Author: adrian Date: Wed Nov 28 06:55:34 2012 New Revision: 243647 URL: http://svnweb.freebsd.org/changeset/base/243647 Log: Until I figure out what to do here, remind myself that this needs some rate control 'adjustment' when NOACK is set. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Wed Nov 28 03:04:38 2012 (r243646) +++ head/sys/dev/ath/if_ath_tx.c Wed Nov 28 06:55:34 2012 (r243647) @@ -522,6 +522,16 @@ ath_tx_set_ratectrl(struct ath_softc *sc if (! bf->bf_state.bfs_ismrr) rc[1].tries = rc[2].tries = rc[3].tries = 0; +#if 0 + /* + * If NOACK is set, just set ntries=1. + */ + else if (bf->bf_state.bfs_txflags & HAL_TXDESC_NOACK) { + rc[1].tries = rc[2].tries = rc[3].tries = 0; + rc[0].tries = 1; + } +#endif + /* * Always call - that way a retried descriptor will * have the MRR fields overwritten. From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 07:12:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52A21970; Wed, 28 Nov 2012 07:12:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 388ED8FC08; Wed, 28 Nov 2012 07:12:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS7C9Q6064016; Wed, 28 Nov 2012 07:12:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS7C9Lr064014; Wed, 28 Nov 2012 07:12:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211280712.qAS7C9Lr064014@svn.freebsd.org> From: Adrian Chadd Date: Wed, 28 Nov 2012 07:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243648 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 07:12:09 -0000 Author: adrian Date: Wed Nov 28 07:12:08 2012 New Revision: 243648 URL: http://svnweb.freebsd.org/changeset/base/243648 Log: Call if_free() with the correct vnet context if and only if ifp_vnet isn't NULL. If the attach fails prematurely and there's no if_vnet context, calling CURVNET_SET(ifp->if_vnet) is going to dereference a NULL pointer. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Nov 28 06:55:34 2012 (r243647) +++ head/sys/dev/ath/if_ath.c Wed Nov 28 07:12:08 2012 (r243648) @@ -918,11 +918,16 @@ bad2: bad: if (ah) ath_hal_detach(ah); - if (ifp != NULL) { + + /* + * To work around scoping issues with CURVNET_SET/CURVNET_RESTORE.. + */ + if (ifp != NULL && ifp->if_vnet) { CURVNET_SET(ifp->if_vnet); if_free(ifp); CURVNET_RESTORE(); - } + } else if (ifp != NULL) + if_free(ifp); sc->sc_invalid = 1; return error; } From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 08:02:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F210F5F9 for ; Wed, 28 Nov 2012 08:02:07 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 4218F8FC17 for ; Wed, 28 Nov 2012 08:02:07 +0000 (UTC) Received: (qmail 39318 invoked from network); 28 Nov 2012 09:33:36 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 09:33:36 -0000 Message-ID: <50B5C4F1.1020002@freebsd.org> Date: Wed, 28 Nov 2012 09:01:53 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: "Robert N. M. Watson" Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> In-Reply-To: <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 08:02:08 -0000 On 28.11.2012 00:59, Robert N. M. Watson wrote: > > On 27 Nov 2012, at 23:29, Andre Oppermann wrote: > >>>>>>> Andre.. this breaks incoming connections. TCP is immediately reset and never even gets to the >>>>>>> listener process. You need to back out of fix this urgently please. >>>>>> >>>>>> I just found out and fixed it. Sorry for the breakage. >>>>> >>>>> I'd like to see a much more thorough use of "Reviewed by:" in socket and TCP-related commits -- this >>>>> is very sensitive code, and a second pair of eyes is always valuable. Post-commit review is not a >>>>> substitute. Looking back over similar changes in the socket code over the last two years, I see >>>>> that almost all have reviewers, so I think it would be reasonable to consider it mandatory for these >>>>> subsystems at this point. The good news is that we have lots of people with expertise in it. >>>> >>>> Good to see you becoming more active again. :-) And yes, >>>> you have a point there. >>> >>> Yes -- this is only about three weeks old, however; for the prior six-twelve months, I've been fairly non-existent in FreeBSD-land due to outside obligations :-). >> >> Just saw that I did indeed send you a review request three weeks ago. ;-) >> At the end of a rather long email though. > > Yes, indeed -- no patch was attached, and it followed quite a long e-mail on your plans to rewrite the TCP stack. I'm afraid that went onto the "read this later as time permits" pile as I was at a conference, rather than the fast-path "oh, quickly review this patch" pile. However, simply committing the patch rather than trying a bit harder to find a reviewer isn't the right answer either. To maximise the likelihood of a review, construct an e-mail with a subject line like "Review request: (patch description)", attach the patch, and include a proposed commit message. Yes, and I didn't really expect you to answer (at least quickly) during your FreeBSD hiatus. So it was seeking review by chance. Alas I found and fixed the bug myself within 2.5hrs. While not optimal, a sign of poor prior testing and too much trust into the submitter of the patch it wasn't an earth shattering event. Doesn't distract from the fact that it was mea culpa in any case though. For prior review of kern_socket* and netinet/tcp_* related changes it has been on and off by various committers over the past year. If we do have a policy of prior review required then it should be made official and codified in MAINTAINERS and universally applied to all. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 08:31:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A588D99; Wed, 28 Nov 2012 08:31:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 488D68FC0C; Wed, 28 Nov 2012 08:31:02 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6DC9246B2C; Wed, 28 Nov 2012 03:31:01 -0500 (EST) Date: Wed, 28 Nov 2012 08:31:01 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andre Oppermann Subject: Re: svn commit: r243627 - head/sys/kern In-Reply-To: <50B5C4F1.1020002@freebsd.org> Message-ID: References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 08:31:02 -0000 On Wed, 28 Nov 2012, Andre Oppermann wrote: > Yes, and I didn't really expect you to answer (at least quickly) during your > FreeBSD hiatus. So it was seeking review by chance. > > Alas I found and fixed the bug myself within 2.5hrs. While not optimal, a > sign of poor prior testing and too much trust into the submitter of the > patch it wasn't an earth shattering event. Doesn't distract from the fact > that it was mea culpa in any case though. The rapid fix was, of course, extremely appreciated :-). > For prior review of kern_socket* and netinet/tcp_* related changes it has > been on and off by various committers over the past year. If we do have a > policy of prior review required then it should be made official and codified > in MAINTAINERS and universally applied to all. I tend to be of the view that 'maintainers' is a bad idea, and that we should just make a regular practice of seeking review for this sort of thing, especially as our community grows (and, let us be honest, complexity also grows -- your observations about decades of accumulated complexity in the TCP stack are not amiss). I'll try to take a look at this change in detail over the weekend -- listen/accept locking is a bit of a sore point; in the original design, I didn't have a separate accept lock, but ended up being forced to introduce it to solve races along these lines. In the past we've also relied on the pcbinfo lock in the protocol providing significant synchronisation during new connection events, and as we reduce the influence of that lock, finding more structured solutions is necessary. Robert From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 11:47:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19F942E2; Wed, 28 Nov 2012 11:47:48 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D83628FC14; Wed, 28 Nov 2012 11:47:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASBll41018282; Wed, 28 Nov 2012 11:47:47 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASBll2T018280; Wed, 28 Nov 2012 11:47:47 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201211281147.qASBll2T018280@svn.freebsd.org> From: Hajimu UMEMOTO Date: Wed, 28 Nov 2012 11:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243649 - head/contrib/sendmail/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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 11:47:48 -0000 Author: ume Date: Wed Nov 28 11:47:47 2012 New Revision: 243649 URL: http://svnweb.freebsd.org/changeset/base/243649 Log: cyrus-sasl 2.1.26 was released. In this version, the type of callback functions was changed from "unsigned long" to "size_t". Reviewed by: gshapiro MFC after: 3 days Modified: head/contrib/sendmail/src/sasl.c Modified: head/contrib/sendmail/src/sasl.c ============================================================================== --- head/contrib/sendmail/src/sasl.c Wed Nov 28 07:12:08 2012 (r243648) +++ head/contrib/sendmail/src/sasl.c Wed Nov 28 11:47:47 2012 (r243649) @@ -24,9 +24,15 @@ SM_RCSID("@(#)$Id: sasl.c,v 8.22 2006/08 ** using unsigned long: for portability, it should be size_t. */ -void *sm_sasl_malloc __P((unsigned long)); -static void *sm_sasl_calloc __P((unsigned long, unsigned long)); -static void *sm_sasl_realloc __P((void *, unsigned long)); +#if defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a +#define SM_SASL_SIZE_T size_t +#else /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ +#define SM_SASL_SIZE_T unsigned long +#endif /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ + +void *sm_sasl_malloc __P((SM_SASL_SIZE_T)); +static void *sm_sasl_calloc __P((SM_SASL_SIZE_T, SM_SASL_SIZE_T)); +static void *sm_sasl_realloc __P((void *, SM_SASL_SIZE_T)); void sm_sasl_free __P((void *)); /* @@ -50,7 +56,7 @@ void sm_sasl_free __P((void *)); void * sm_sasl_malloc(size) - unsigned long size; + SM_SASL_SIZE_T size; { return sm_malloc((size_t) size); } @@ -71,8 +77,8 @@ sm_sasl_malloc(size) static void * sm_sasl_calloc(nelem, elemsize) - unsigned long nelem; - unsigned long elemsize; + SM_SASL_SIZE_T nelem; + SM_SASL_SIZE_T elemsize; { size_t size; void *p; @@ -99,7 +105,7 @@ sm_sasl_calloc(nelem, elemsize) static void * sm_sasl_realloc(o, size) void *o; - unsigned long size; + SM_SASL_SIZE_T size; { return sm_realloc(o, (size_t) size); } From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 12:16:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2826A7D; Wed, 28 Nov 2012 12:16:59 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 3C0C68FC12; Wed, 28 Nov 2012 12:16:58 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 9BD98358C68; Wed, 28 Nov 2012 13:16:56 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 8097D2848C; Wed, 28 Nov 2012 13:16:56 +0100 (CET) Date: Wed, 28 Nov 2012 13:16:56 +0100 From: Jilles Tjoelker To: Alfred Perlstein Subject: Re: svn commit: r243644 - head/usr.sbin/nfsd Message-ID: <20121128121656.GA14031@stack.nl> References: <201211280223.qAS2NxU7013740@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201211280223.qAS2NxU7013740@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 12:16:59 -0000 On Wed, Nov 28, 2012 at 02:23:59AM +0000, Alfred Perlstein wrote: > Author: alfred > Date: Wed Nov 28 02:23:59 2012 > New Revision: 243644 > URL: http://svnweb.freebsd.org/changeset/base/243644 > Log: > Fix typo. > Pointed out by: marck > Modified: > head/usr.sbin/nfsd/nfsd.c > Modified: head/usr.sbin/nfsd/nfsd.c > ============================================================================== > --- head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:03:53 2012 (r243643) > +++ head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:23:59 2012 (r243644) > @@ -431,7 +431,7 @@ main(int argc, char **argv) > nfsdcnt = DEFNFSDCNT; > } > if (nfsdcnt > MAXNFSDCNT) { > - warnx("nfsd counta too high %d; reset to %d", nfsdcnt, > + warnx("nfsd count too high %d; reset to %d", nfsdcnt, > DEFNFSDCNT); > nfsdcnt = MAXNFSDCNT; > } This says it reset the count to 4, while actually resetting it to 256. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 12:20:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0B41C3D; Wed, 28 Nov 2012 12:20:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 754578FC17; Wed, 28 Nov 2012 12:20:42 +0000 (UTC) Received: by mail-wg0-f50.google.com with SMTP id 12so1478505wgh.31 for ; Wed, 28 Nov 2012 04:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=7wjA9uRD7f8lTujGTk7IcJGja1nc048qSzQBamaPcyM=; b=a2IkE7qgCgaIzXJaf3oYd9YnZTTJtu1Sb7dZHdTY28cKwB+1Ikmx8L1qx3nTAaJw1z 2aOjbqxdI38kD/xxBPoN/0+yWY6To0zhC6VcMDTszDzBHKqXldPsJ46voi4YCdUdVvBk 6PZoTTPmXK42UXEbpHbYt/BVd5SdH6vt375ZxUaOQKM18QuF/q9YphUZlETGeU5PJto1 1yr6WNe2WOKK+ZBHn0er93iHYnDEMhCinvcM7dhN4GdNskjxeYLw8Tlyhc4YUbaNXx/5 8rM9QhNDBZME6wL93jfdBvowwrda4bU9LVlVMgadrjiNHAGodAWOI00WIP2DulPtnjFE 5uig== Received: by 10.216.91.17 with SMTP id g17mr2591333wef.76.1354105241403; Wed, 28 Nov 2012 04:20:41 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id hv4sm6794748wib.0.2012.11.28.04.20.39 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 04:20:40 -0800 (PST) Date: Wed, 28 Nov 2012 13:20:34 +0100 From: Mateusz Guzik To: Alfred Perlstein Subject: Re: svn commit: r243645 - head/usr.sbin/nfsd Message-ID: <20121128122034.GB17871@dft-labs.eu> References: <201211280247.qAS2lWS4018006@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201211280247.qAS2lWS4018006@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 12:20:43 -0000 On Wed, Nov 28, 2012 at 02:47:32AM +0000, Alfred Perlstein wrote: > Author: alfred > Date: Wed Nov 28 02:47:31 2012 > New Revision: 243645 > URL: http://svnweb.freebsd.org/changeset/base/243645 > > Log: > Don't allow minthreads > maxthreads. > > Suggested by: rmacklem > > Modified: > head/usr.sbin/nfsd/nfsd.c > > Modified: head/usr.sbin/nfsd/nfsd.c > ============================================================================== > --- head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:23:59 2012 (r243644) > +++ head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:47:31 2012 (r243645) > @@ -224,6 +224,10 @@ main(int argc, char **argv) > udpflag = 1; > argv += optind; > argc -= optind; > + if (minthreads_set && maxthreads_set && minthreads > maxthreads) > + errx(EX_USAGE, > + "error: minthreads(%d) can't be greater than " > + "maxthreads(%d)", minthreads, maxthreads); > > /* > * XXX Should not this be also checked in the kernel? Looks like nfssvc_nfsd is trustful: [..] if (args) { nfsrv_pool->sp_minthreads = args->minthreads; nfsrv_pool->sp_maxthreads = args->maxthreads; } else { nfsrv_pool->sp_minthreads = 4; nfsrv_pool->sp_maxthreads = 4; } [..] -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 15:48:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36B12FD6; Wed, 28 Nov 2012 15:48:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FDE38FC08; Wed, 28 Nov 2012 15:48:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASFmWTP068832; Wed, 28 Nov 2012 15:48:32 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASFmW1x068830; Wed, 28 Nov 2012 15:48:32 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201211281548.qASFmW1x068830@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 28 Nov 2012 15:48:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243652 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 15:48:33 -0000 Author: pfg Date: Wed Nov 28 15:48:32 2012 New Revision: 243652 URL: http://svnweb.freebsd.org/changeset/base/243652 Log: Update some definitions or make them match NetBSD's headers. Bring several definitions required for newer ext4 features. Rename EXT2F_COMPAT_HTREE to EXT2F_COMPAT_DIRHASHINDEX since it is not being used yet and the new name is more compatible with NetBSD and Linux. This change is purely cosmetic and has no effect on the real code. Obtained from: NetBSD MFC after: 3 days Modified: head/sys/fs/ext2fs/ext2_dinode.h head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- head/sys/fs/ext2fs/ext2_dinode.h Wed Nov 28 13:34:44 2012 (r243651) +++ head/sys/fs/ext2fs/ext2_dinode.h Wed Nov 28 15:48:32 2012 (r243652) @@ -60,8 +60,15 @@ #define EXT2_APPEND 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP 0x00000040 /* do not dump file */ #define EXT2_NOATIME 0x00000080 /* do not update atime */ - -#define EXT2_HTREE 0x00001000 /* HTree-indexed directory */ +#define EXT2_INDEX 0x00001000 /* hash-indexed directory */ +#define EXT2_IMAGIC 0x00002000 /* AFS directory */ +#define EXT2_JOURNAL_DATA 0x00004000 /* file data should be journaled */ +#define EXT2_NOTAIL 0x00008000 /* file tail should not be merged */ +#define EXT2_DIRSYNC 0x00010000 /* dirsync behaviour */ +#define EXT2_TOPDIR 0x00020000 /* Top of directory hierarchies*/ +#define EXT2_HUGE_FILE 0x00040000 /* Set to each huge file */ +#define EXT2_EXTENTS 0x00080000 /* Inode uses extents */ +#define EXT2_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */ /* * Definitions for nanosecond timestamps. @@ -95,9 +102,8 @@ struct ext2fs_dinode { uint32_t e2di_facl; /* 104: file ACL (not implemented) */ uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */ uint32_t e2di_faddr; /* 112: fragment address */ - uint8_t e2di_nfrag; /* 116: fragment number */ - uint8_t e2di_fsize; /* 117: fragment size */ - uint16_t e2di_linux_reserved2; /* 118 */ + uint16_t e2di_nblock_high; /* 116: Blocks count bits 47:32 */ + uint16_t e2di_facl_high; /* 118: file ACL bits 47:32 */ uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */ uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */ uint32_t e2di_linux_reserved3; /* 124 */ Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Wed Nov 28 13:34:44 2012 (r243651) +++ head/sys/fs/ext2fs/ext2fs.h Wed Nov 28 15:48:32 2012 (r243652) @@ -210,15 +210,23 @@ struct m_ext2fs { #define EXT2F_COMPAT_PREALLOC 0x0001 #define EXT2F_COMPAT_HASJOURNAL 0x0004 #define EXT2F_COMPAT_RESIZE 0x0010 -#define EXT2F_COMPAT_HTREE 0x0020 +#define EXT2F_COMPAT_DIRHASHINDEX 0x0020 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 #define EXT2F_ROCOMPAT_BTREE_DIR 0x0004 +#define EXT4F_ROCOMPAT_HUGE_FILE 0x0008 +#define EXT4F_ROCOMPAT_GDT_CSUM 0x0010 +#define EXT4F_ROCOMPAT_DIR_NLINK 0x0020 #define EXT4F_ROCOMPAT_EXTRA_ISIZE 0x0040 #define EXT2F_INCOMPAT_COMP 0x0001 #define EXT2F_INCOMPAT_FTYPE 0x0002 +#define EXT4F_INCOMPAT_META_BG 0x0010 +#define EXT4F_INCOMPAT_EXTENTS 0x0040 +#define EXT4F_INCOMPAT_64BIT 0x0080 +#define EXT4F_INCOMPAT_MMP 0x0100 +#define EXT4F_INCOMPAT_FLEX_BG 0x0200 /* * Features supported in this implementation From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 17:37:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E19DEB0B; Wed, 28 Nov 2012 17:37:53 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by mx1.freebsd.org (Postfix) with ESMTP id AE1358FC15; Wed, 28 Nov 2012 17:37:53 +0000 (UTC) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 955B44C023F; Wed, 28 Nov 2012 11:37:47 -0600 (CST) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 939104C0235; Wed, 28 Nov 2012 11:37:47 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from mh11.mail.rice.edu ([127.0.0.1]) by mh11.mail.rice.edu (mh11.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id l1Im_c4j662U; Wed, 28 Nov 2012 11:37:47 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id C79394C01D0; Wed, 28 Nov 2012 11:37:46 -0600 (CST) Message-ID: <50B64BE8.3040708@rice.edu> Date: Wed, 28 Nov 2012 11:37:44 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:16.0) Gecko/20121111 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> In-Reply-To: <201211272119.qARLJxXV061083@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 17:37:54 -0000 I'm pretty sure that the "realmem" calculation is going to overflow on i386/PAE, where the number of bytes of physical memory is greater than the type long can represent. On 11/27/2012 15:19, Andre Oppermann wrote: > Author: andre > Date: Tue Nov 27 21:19:58 2012 > New Revision: 243631 > URL: http://svnweb.freebsd.org/changeset/base/243631 > > Log: > Base the mbuf related limits on the available physical memory or > kernel memory, whichever is lower. The overall mbuf related memory > limit must be set so that mbufs (and clusters of various sizes) > can't exhaust physical RAM or KVM. > > The limit is set to half of the physical RAM or KVM (whichever is > lower) as the baseline. In any normal scenario we want to leave > at least half of the physmem/kvm for other kernel functions and > userspace to prevent it from swapping too easily. Via a tunable > kern.maxmbufmem the limit can be upped to at most 3/4 of physmem/kvm. > > At the same time divorce maxfiles from maxusers and set maxfiles to > physpages / 8 with a floor based on maxusers. This way busy servers > can make use of the significantly increased mbuf limits with a much > larger number of open sockets. > > Tidy up ordering in init_param2() and check up on some users of > those values calculated here. > > Out of the overall mbuf memory limit 2K clusters and 4K (page size) > clusters to get 1/4 each because these are the most heavily used mbuf > sizes. 2K clusters are used for MTU 1500 ethernet inbound packets. > 4K clusters are used whenever possible for sends on sockets and thus > outbound packets. The larger cluster sizes of 9K and 16K are limited > to 1/6 of the overall mbuf memory limit. When jumbo MTU's are used > these large clusters will end up only on the inbound path. They are > not used on outbound, there it's still 4K. Yes, that will stay that > way because otherwise we run into lots of complications in the > stack. And it really isn't a problem, so don't make a scene. > > Normal mbufs (256B) weren't limited at all previously. This was > problematic as there are certain places in the kernel that on > allocation failure of clusters try to piece together their packet > from smaller mbufs. > > The mbuf limit is the number of all other mbuf sizes together plus > some more to allow for standalone mbufs (ACK for example) and to > send off a copy of a cluster. Unfortunately there isn't a way to > set an overall limit for all mbuf memory together as UMA doesn't > support such a limiting. > > NB: Every cluster also has an mbuf associated with it. > > Two examples on the revised mbuf sizing limits: > > 1GB KVM: > 512MB limit for mbufs > 419,430 mbufs > 65,536 2K mbuf clusters > 32,768 4K mbuf clusters > 9,709 9K mbuf clusters > 5,461 16K mbuf clusters > > 16GB RAM: > 8GB limit for mbufs > 33,554,432 mbufs > 1,048,576 2K mbuf clusters > 524,288 4K mbuf clusters > 155,344 9K mbuf clusters > 87,381 16K mbuf clusters > > These defaults should be sufficient for even the most demanding > network loads. > > MFC after: 1 month > > Modified: > head/sys/kern/kern_mbuf.c > head/sys/kern/subr_param.c > head/sys/kern/uipc_socket.c > head/sys/sys/eventhandler.h > head/sys/sys/mbuf.h > > Modified: head/sys/kern/kern_mbuf.c > ============================================================================== > --- head/sys/kern/kern_mbuf.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/kern_mbuf.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$"); > * > */ > > +int nmbufs; /* limits number of mbufs */ > int nmbclusters; /* limits number of mbuf clusters */ > int nmbjumbop; /* limits number of page size jumbo clusters */ > int nmbjumbo9; /* limits number of 9k jumbo clusters */ > @@ -147,9 +148,11 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) > newnmbclusters = nmbclusters; > error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbclusters > nmbclusters) { > + if (newnmbclusters > nmbclusters && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbclusters = newnmbclusters; > uma_zone_set_max(zone_clust, nmbclusters); > + nmbclusters = uma_zone_get_max(zone_clust); > EVENTHANDLER_INVOKE(nmbclusters_change); > } else > error = EINVAL; > @@ -168,9 +171,11 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS) > newnmbjumbop = nmbjumbop; > error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbop> nmbjumbop) { > + if (newnmbjumbop > nmbjumbop && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbop = newnmbjumbop; > uma_zone_set_max(zone_jumbop, nmbjumbop); > + nmbjumbop = uma_zone_get_max(zone_jumbop); > } else > error = EINVAL; > } > @@ -189,9 +194,11 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS) > newnmbjumbo9 = nmbjumbo9; > error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbo9> nmbjumbo9) { > + if (newnmbjumbo9 > nmbjumbo9&& > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbo9 = newnmbjumbo9; > uma_zone_set_max(zone_jumbo9, nmbjumbo9); > + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); > } else > error = EINVAL; > } > @@ -209,9 +216,11 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS) > newnmbjumbo16 = nmbjumbo16; > error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbo16> nmbjumbo16) { > + if (newnmbjumbo16 > nmbjumbo16 && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbo16 = newnmbjumbo16; > uma_zone_set_max(zone_jumbo16, nmbjumbo16); > + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); > } else > error = EINVAL; > } > @@ -221,6 +230,27 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumb > &nmbjumbo16, 0, sysctl_nmbjumbo16, "IU", > "Maximum number of mbuf 16k jumbo clusters allowed"); > > +static int > +sysctl_nmbufs(SYSCTL_HANDLER_ARGS) > +{ > + int error, newnmbufs; > + > + newnmbufs = nmbufs; > + error = sysctl_handle_int(oidp, &newnmbufs, 0, req); > + if (error == 0 && req->newptr) { > + if (newnmbufs > nmbufs) { > + nmbufs = newnmbufs; > + uma_zone_set_max(zone_mbuf, nmbufs); > + nmbclusters = uma_zone_get_max(zone_mbuf); > + EVENTHANDLER_INVOKE(nmbufs_change); > + } else > + error = EINVAL; > + } > + return (error); > +} > +SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW, > +&nmbufs, 0, sysctl_nmbufs, "IU", > + "Maximum number of mbufs allowed"); > > > SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat, > @@ -275,6 +305,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > MSIZE - 1, UMA_ZONE_MAXBUCKET); > + if (nmbufs > 0) { > + uma_zone_set_max(zone_mbuf, nmbufs); > + nmbufs = uma_zone_get_max(zone_mbuf); > + } > > zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -284,8 +318,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbclusters > 0) > + if (nmbclusters > 0) { > uma_zone_set_max(zone_clust, nmbclusters); > + nmbclusters = uma_zone_get_max(zone_clust); > + } > > zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack, > mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf); > @@ -299,8 +335,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbop > 0) > + if (nmbjumbop > 0) { > uma_zone_set_max(zone_jumbop, nmbjumbop); > + nmbjumbop = uma_zone_get_max(zone_jumbop); > + } > > zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -310,9 +348,11 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbo9 > 0) > - uma_zone_set_max(zone_jumbo9, nmbjumbo9); > uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); > + if (nmbjumbo9 > 0) { > + uma_zone_set_max(zone_jumbo9, nmbjumbo9); > + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); > + } > > zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -322,9 +362,11 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbo16 > 0) > - uma_zone_set_max(zone_jumbo16, nmbjumbo16); > uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); > + if (nmbjumbo16 > 0) { > + uma_zone_set_max(zone_jumbo16, nmbjumbo16); > + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); > + } > > zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), > NULL, NULL, > > Modified: head/sys/kern/subr_param.c > ============================================================================== > --- head/sys/kern/subr_param.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/subr_param.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -93,6 +93,7 @@ int ncallout; /* maximum # of timer ev > int nbuf; > int ngroups_max; /* max # groups per process */ > int nswbuf; > +long maxmbufmem; /* max mbuf memory */ > pid_t pid_max = PID_MAX; > long maxswzone; /* max swmeta KVA storage */ > long maxbcache; /* max buffer cache KVA storage */ > @@ -270,6 +271,7 @@ init_param1(void) > void > init_param2(long physpages) > { > + long realmem; > > /* Base parameters */ > maxusers = MAXUSERS; > @@ -293,19 +295,25 @@ init_param2(long physpages) > /* > * The following can be overridden after boot via sysctl. Note: > * unless overriden, these macros are ultimately based on maxusers. > - */ > - maxproc = NPROC; > - TUNABLE_INT_FETCH("kern.maxproc", &maxproc); > - /* > * Limit maxproc so that kmap entries cannot be exhausted by > * processes. > */ > + maxproc = NPROC; > + TUNABLE_INT_FETCH("kern.maxproc", &maxproc); > if (maxproc > (physpages / 12)) > maxproc = physpages / 12; > - maxfiles = MAXFILES; > - TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); > maxprocperuid = (maxproc * 9) / 10; > - maxfilesperproc = (maxfiles * 9) / 10; > + > + /* > + * The default limit for maxfiles is 1/12 of the number of > + * physical page but not less than 16 times maxusers. > + * At most it can be 1/6 the number of physical pages. > + */ > + maxfiles = imax(MAXFILES, physpages / 8); > + TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); > + if (maxfiles > (physpages / 4)) > + maxfiles = physpages / 4; > + maxfilesperproc = (maxfiles / 10) * 9; > > /* > * Cannot be changed after boot. > @@ -313,20 +321,35 @@ init_param2(long physpages) > nbuf = NBUF; > TUNABLE_INT_FETCH("kern.nbuf", &nbuf); > > + /* > + * XXX: Does the callout wheel have to be so big? > + */ > ncallout = 16 + maxproc + maxfiles; > TUNABLE_INT_FETCH("kern.ncallout", &ncallout); > > /* > + * The default limit for all mbuf related memory is 1/2 of all > + * available kernel memory (physical or kmem). > + * At most it can be 3/4 of available kernel memory. > + */ > + realmem = lmin(physpages * PAGE_SIZE, > + VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); > + maxmbufmem = realmem / 2; > + TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); > + if (maxmbufmem > (realmem / 4) * 3) > + maxmbufmem = (realmem / 4) * 3; > + > + /* > * The default for maxpipekva is min(1/64 of the kernel address space, > * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. > */ > maxpipekva = (physpages / 64) * PAGE_SIZE; > + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); > if (maxpipekva < 512 * 1024) > maxpipekva = 512 * 1024; > if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) > maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / > 64; > - TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); > } > > /* > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/uipc_socket.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -290,7 +290,7 @@ init_maxsockets(void *ignored) > { > > TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); > - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); > + maxsockets = imax(maxsockets, maxfiles); > } > SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); > > @@ -306,12 +306,9 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) > newmaxsockets = maxsockets; > error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); > if (error == 0 && req->newptr) { > - if (newmaxsockets > maxsockets) { > + if (newmaxsockets > maxsockets && > + newmaxsockets <= maxfiles) { > maxsockets = newmaxsockets; > - if (maxsockets > ((maxfiles / 4) * 3)) { > - maxfiles = (maxsockets * 5) / 4; > - maxfilesperproc = (maxfiles * 9) / 10; > - } > EVENTHANDLER_INVOKE(maxsockets_change); > } else > error = EINVAL; > > Modified: head/sys/sys/eventhandler.h > ============================================================================== > --- head/sys/sys/eventhandler.h Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/sys/eventhandler.h Tue Nov 27 21:19:58 2012 (r243631) > @@ -253,6 +253,7 @@ EVENTHANDLER_DECLARE(thread_fini, thread > > typedef void (*uma_zone_chfn)(void *); > EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn); > +EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn); > EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn); > > #endif /* SYS_EVENTHANDLER_H */ > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/sys/mbuf.h Tue Nov 27 21:19:58 2012 (r243631) > @@ -395,7 +395,7 @@ struct mbstat { > * > * The rest of it is defined in kern/kern_mbuf.c > */ > - > +extern long maxmbufmem; > extern uma_zone_t zone_mbuf; > extern uma_zone_t zone_clust; > extern uma_zone_t zone_pack; > From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 17:39:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E614D7A; Wed, 28 Nov 2012 17:39:16 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 41E3B8FC12; Wed, 28 Nov 2012 17:39:16 +0000 (UTC) Received: from Alfreds-MacBook-Pro-5.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 3049C1A3DC1; Wed, 28 Nov 2012 09:39:15 -0800 (PST) Message-ID: <50B64C43.50001@mu.org> Date: Wed, 28 Nov 2012 09:39:15 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> In-Reply-To: <50B5C4F1.1020002@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Robert N. M. Watson" , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 17:39:16 -0000 On 11/28/12 12:01 AM, Andre Oppermann wrote: > On 28.11.2012 00:59, Robert N. M. Watson wrote: >> >> On 27 Nov 2012, at 23:29, Andre Oppermann wrote: >> >>>>>>>> Andre.. this breaks incoming connections. TCP is immediately >>>>>>>> reset and never even gets to the >>>>>>>> listener process. You need to back out of fix this urgently >>>>>>>> please. >>>>>>> >>>>>>> I just found out and fixed it. Sorry for the breakage. >>>>>> >>>>>> I'd like to see a much more thorough use of "Reviewed by:" in >>>>>> socket and TCP-related commits -- this >>>>>> is very sensitive code, and a second pair of eyes is always >>>>>> valuable. Post-commit review is not a >>>>>> substitute. Looking back over similar changes in the socket code >>>>>> over the last two years, I see >>>>>> that almost all have reviewers, so I think it would be reasonable >>>>>> to consider it mandatory for these >>>>>> subsystems at this point. The good news is that we have lots of >>>>>> people with expertise in it. >>>>> >>>>> Good to see you becoming more active again. :-) And yes, >>>>> you have a point there. >>>> >>>> Yes -- this is only about three weeks old, however; for the prior >>>> six-twelve months, I've been fairly non-existent in FreeBSD-land >>>> due to outside obligations :-). >>> >>> Just saw that I did indeed send you a review request three weeks >>> ago. ;-) >>> At the end of a rather long email though. >> >> Yes, indeed -- no patch was attached, and it followed quite a long >> e-mail on your plans to rewrite the TCP stack. I'm afraid that went >> onto the "read this later as time permits" pile as I was at a >> conference, rather than the fast-path "oh, quickly review this patch" >> pile. However, simply committing the patch rather than trying a bit >> harder to find a reviewer isn't the right answer either. To maximise >> the likelihood of a review, construct an e-mail with a subject line >> like "Review request: (patch description)", attach the patch, and >> include a proposed commit message. > > Yes, and I didn't really expect you to answer (at least quickly) during > your FreeBSD hiatus. So it was seeking review by chance. > > Alas I found and fixed the bug myself within 2.5hrs. While not optimal, > a sign of poor prior testing and too much trust into the submitter of > the patch it wasn't an earth shattering event. Doesn't distract from > the fact that it was mea culpa in any case though. > > For prior review of kern_socket* and netinet/tcp_* related changes it has > been on and off by various committers over the past year. If we do have > a policy of prior review required then it should be made official and > codified in MAINTAINERS and universally applied to all. > Personally I don't think we need any more anchors attached to people's feet when developing FreeBSD. Mistakes will happen, they will happen in head. Slowing down the process to eliminate mistakes only works to slow down change and give a false sense of "fixing stability" when in fact the only thing "stable" is the slowness of submitting code. -Alfred From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:13:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 945B1F34; Wed, 28 Nov 2012 18:13:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2E1DA8FC0C; Wed, 28 Nov 2012 18:13:42 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id D3F7E46B17; Wed, 28 Nov 2012 13:13:41 -0500 (EST) Date: Wed, 28 Nov 2012 18:13:41 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Alfred Perlstein Subject: Re: svn commit: r243627 - head/sys/kern In-Reply-To: <50B64C43.50001@mu.org> Message-ID: References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:13:43 -0000 On Wed, 28 Nov 2012, Alfred Perlstein wrote: >> Yes, and I didn't really expect you to answer (at least quickly) during >> your FreeBSD hiatus. So it was seeking review by chance. >> >> Alas I found and fixed the bug myself within 2.5hrs. While not optimal, a >> sign of poor prior testing and too much trust into the submitter of the >> patch it wasn't an earth shattering event. Doesn't distract from the fact >> that it was mea culpa in any case though. >> >> For prior review of kern_socket* and netinet/tcp_* related changes it has >> been on and off by various committers over the past year. If we do have a >> policy of prior review required then it should be made official and >> codified in MAINTAINERS and universally applied to all. >> > Personally I don't think we need any more anchors attached to people's feet > when developing FreeBSD. > > Mistakes will happen, they will happen in head. Slowing down the process to > eliminate mistakes only works to slow down change and give a false sense of > "fixing stability" when in fact the only thing "stable" is the slowness of > submitting code. Yes, the purpose of review in this case would not be to catch (too many) dumb mistakes -- that's what testing is for -- but rather, to introduce architectural review and catch quite subtle mistakes. It was interesting doing the development cycle for the pcbgroup work a year or so ago -- having Bjoern do line-by-line reviews of changes generated not only lots of bug fixes, but also lots of high-level feedback on the design that improved it markedly. "MAINTAINERS" is a concept I'd like to see die, but the idea of seeking pre-commit review for changes, especially in sensitive code, is something to encourage. One reason review is so critical in this area is that there are lots of subtle implications to do with timing, object life cycles, inter-layer locking, etc, in the socket and TCP code -- things that any one author may not see the big picture on. We've been working to improve comments, but the problem there, of course, is that you end up with a book of design comments, and code review actually brings many of those concerns to light in a more structured and practical way. Robert From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:17:27 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 661AD32E; Wed, 28 Nov 2012 18:17:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id CFF328FC16; Wed, 28 Nov 2012 18:17:26 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id qASHpGkd015496; Wed, 28 Nov 2012 21:51:16 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id qASHpGQR015495; Wed, 28 Nov 2012 21:51:16 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 28 Nov 2012 21:51:16 +0400 From: Gleb Smirnoff To: Alfred Perlstein Subject: Re: svn commit: r243627 - head/sys/kern Message-ID: <20121128175116.GI14202@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <50B64C43.50001@mu.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@FreeBSD.org, Andre Oppermann , Peter Wemm , svn-src-all@FreeBSD.org, "Robert N. M. Watson" , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:17:27 -0000 Alfred, On Wed, Nov 28, 2012 at 09:39:15AM -0800, Alfred Perlstein wrote: A> Personally I don't think we need any more anchors attached to people's A> feet when developing FreeBSD. A> A> Mistakes will happen, they will happen in head. Slowing down the A> process to eliminate mistakes only works to slow down change and give a A> false sense of "fixing stability" when in fact the only thing "stable" A> is the slowness of submitting code. This will eventually lead back to the situation when no one runs head, because it is unusable. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:25:08 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5B845D0; Wed, 28 Nov 2012 18:25:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B10208FC13; Wed, 28 Nov 2012 18:25:08 +0000 (UTC) Received: from c0205.aw.cl.cam.ac.uk (c0205.aw.cl.cam.ac.uk [128.232.100.205]) by cyrus.watson.org (Postfix) with ESMTPSA id A16D746B2C; Wed, 28 Nov 2012 13:25:07 -0500 (EST) Subject: Re: svn commit: r243627 - head/sys/kern Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=koi8-r From: "Robert N. M. Watson" In-Reply-To: <20121128175116.GI14202@FreeBSD.org> Date: Wed, 28 Nov 2012 18:25:06 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <41E6060B-5A74-4524-9011-2BFFF5B47E24@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <20121128175116.GI14202@FreeBSD.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.1283) Cc: src-committers@FreeBSD.org, Andre Oppermann , Peter Wemm , svn-src-all@FreeBSD.org, Alfred Perlstein , svn-src-head@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:25:09 -0000 On 28 Nov 2012, at 17:51, Gleb Smirnoff wrote: > On Wed, Nov 28, 2012 at 09:39:15AM -0800, Alfred Perlstein wrote: > A> Personally I don't think we need any more anchors attached to = people's=20 > A> feet when developing FreeBSD. > A>=20 > A> Mistakes will happen, they will happen in head. Slowing down the=20= > A> process to eliminate mistakes only works to slow down change and = give a=20 > A> false sense of "fixing stability" when in fact the only thing = "stable"=20 > A> is the slowness of submitting code. >=20 > This will eventually lead back to the situation when no one runs = head, > because it is unusable. Also, based on past experience: I'm much happier reviewing shaky code = before it goes into the tree than trying to debug it in situ and having = to back it out. If our advice to many companies is that they should = start developing products against head, we can't let the quality of the = head get back to the way it was in the 5.x timeframe. Several factors = have led to our having a nearly-production quality development head over = the last few years -- one is much heavier use of branched development = for features (first Perforce, and more recently, Subversion, git, etc = branches); the other is much heavier use of code review, especially for = critical parts of the system. Device driver authors have a lot more = leeway, but for core parts of the design, seeking review during = development of a feature, and then before merging it upstream, should be = an expectation for all but the most trivial of changes. It's a two-way = street, of course: if you review other people's code, they will review = yours, so as more people use review, the pool of potential reviewers = goes up as well. Robert= From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:29:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C49E38A8; Wed, 28 Nov 2012 18:29:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A93FA8FC14; Wed, 28 Nov 2012 18:29:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASITYbO007515; Wed, 28 Nov 2012 18:29:34 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASITYKn007514; Wed, 28 Nov 2012 18:29:34 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201211281829.qASITYKn007514@svn.freebsd.org> From: Alan Cox Date: Wed, 28 Nov 2012 18:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243659 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:29:34 -0000 Author: alc Date: Wed Nov 28 18:29:34 2012 New Revision: 243659 URL: http://svnweb.freebsd.org/changeset/base/243659 Log: Add support for the (relatively) new object type OBJT_MGTDEVICE to vm_object_set_memattr(). Also, add a "safety belt" so that vm_object_set_memattr() doesn't silently modify undefined object types. Reviewed by: kib MFC after: 10 days Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Nov 28 18:15:38 2012 (r243658) +++ head/sys/vm/vm_object.c Wed Nov 28 18:29:34 2012 (r243659) @@ -301,6 +301,7 @@ vm_object_set_memattr(vm_object_t object switch (object->type) { case OBJT_DEFAULT: case OBJT_DEVICE: + case OBJT_MGTDEVICE: case OBJT_PHYS: case OBJT_SG: case OBJT_SWAP: @@ -310,6 +311,9 @@ vm_object_set_memattr(vm_object_t object break; case OBJT_DEAD: return (KERN_INVALID_ARGUMENT); + default: + panic("vm_object_set_memattr: object %p is of undefined type", + object); } object->memattr = memattr; return (KERN_SUCCESS); From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:35:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D277EB44; Wed, 28 Nov 2012 18:35:46 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ADFC58FC15; Wed, 28 Nov 2012 18:35:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASIZk56008512; Wed, 28 Nov 2012 18:35:46 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASIZknp008510; Wed, 28 Nov 2012 18:35:46 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201211281835.qASIZknp008510@svn.freebsd.org> From: Devin Teske Date: Wed, 28 Nov 2012 18:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243660 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:35:46 -0000 Author: dteske Date: Wed Nov 28 18:35:46 2012 New Revision: 243660 URL: http://svnweb.freebsd.org/changeset/base/243660 Log: Discussed at-length on -arch. Make the following interface changes to my beastie boot menu: + Move boot options to a submenu + Add a new "Boot Single" menu item + Make "Boot" item and new "Boot Single" item reverse when boot_single is set + Add new "Load Defaults" item (in new "Boot Options" submenu) for overridding loader.conf(5) provided values with system defaults. Reviewed by: adrian (co-mentor) Approved by: adrian (co-mentor) Modified: head/sys/boot/forth/menu-commands.4th head/sys/boot/forth/menu.rc Modified: head/sys/boot/forth/menu-commands.4th ============================================================================== --- head/sys/boot/forth/menu-commands.4th Wed Nov 28 18:29:34 2012 (r243659) +++ head/sys/boot/forth/menu-commands.4th Wed Nov 28 18:35:46 2012 (r243660) @@ -32,6 +32,51 @@ variable kernel_state variable root_state \ +\ Boot +\ + +: init_boot ( N -- N ) + dup + s" boot_single" getenv -1 <> if + drop ( n n c-addr -- n n ) \ unused + toggle_menuitem ( n n -- n n ) + s" set menu_keycode[N]=115" \ base command to execute + else + s" set menu_keycode[N]=98" \ base command to execute + then + 17 +c! \ replace 'N' with ASCII numeral + evaluate +; + +\ +\ Alternate Boot +\ + +: init_altboot ( N -- N ) + dup + s" boot_single" getenv -1 <> if + drop ( n c-addr -- n ) \ unused + toggle_menuitem ( n -- n ) + s" set menu_keycode[N]=109" \ base command to execute + else + s" set menu_keycode[N]=115" \ base command to execute + then + 17 +c! \ replace 'N' with ASCII numeral + evaluate +; + +: altboot ( -- ) + s" boot_single" 2dup getenv -1 <> if + drop ( c-addr/u c-addr -- c-addr/u ) \ unused + unsetenv ( c-addr/u -- ) + else + 2drop ( c-addr/u -- ) \ unused + s" set boot_single=YES" evaluate + then + 0 boot ( state -- ) +; + +\ \ ACPI \ @@ -287,3 +332,15 @@ variable root_state menu-redraw TRUE \ Loop menu again ; + +\ +\ Defaults +\ + +: set_default_boot_options ( N -- N TRUE ) + acpi_enable + safemode_disable + singleuser_disable + verbose_disable + 2 goto_menu +; Modified: head/sys/boot/forth/menu.rc ============================================================================== --- head/sys/boot/forth/menu.rc Wed Nov 28 18:29:34 2012 (r243659) +++ head/sys/boot/forth/menu.rc Wed Nov 28 18:35:46 2012 (r243660) @@ -18,57 +18,98 @@ menu-init \ initialize the menu area \ Initialize main menu constructs (see `menu.4th') \ NOTE: To use the `ansi' variants, add `loader_color=1' to loader.conf(5) -set menu_caption[1]="Boot [Enter]" -set menu_command[1]="boot" -set ansi_caption[1]="Boot [Enter]" -set menu_keycode[1]="98" - -set menu_caption[2]="[Esc]ape to loader prompt" -set menu_command[2]="goto_prompt" -set menu_keycode[2]="27" -set ansi_caption[2]="Escape to loader prompt" +\ +\ MAIN MENU +\ + +set menuset_name1="main" + +set mainmenu_init[1]="init_boot" +set mainmenu_caption[1]="Boot Multi User [Enter]" +set maintoggled_text[1]="Boot [S]ingle User [Enter]" +set mainmenu_command[1]="boot" +set mainansi_caption[1]="Boot Multi User [Enter]" +set maintoggled_ansi[1]="Boot Single User [Enter]" +\ keycode set by init_boot + +set mainmenu_init[2]="init_altboot" +set mainmenu_caption[2]="Boot [S]ingle User" +set maintoggled_text[2]="Boot [M]ulti User" +set mainmenu_command[2]="altboot" +set mainansi_caption[2]="Boot Single User" +set maintoggled_ansi[2]="Boot Multi User" +\ keycode set by init_altboot + +set mainmenu_caption[3]="[Esc]ape to loader prompt" +set mainmenu_command[3]="goto_prompt" +set mainmenu_keycode[3]=27 +set mainansi_caption[3]="Escape to loader prompt" \ Enable built-in "Reboot" trailing menuitem \ NOTE: appears before menu_options if configured \ -set menu_reboot +set mainmenu_reboot \ Enable "Options:" separator. When set to a numerical value (1-8), a visual \ separator is inserted before that menuitem number. \ -set menu_options=4 +set mainmenu_options=5 + +set mainmenu_caption[5]="Configure Boot [O]ptions..." +set mainmenu_command[5]="2 goto_menu" +set mainmenu_keycode[5]=111 +set mainansi_caption[5]="Configure Boot Options..." + +\ +\ BOOT OPTIONS MENU +\ + +set menuset_name2="options" -set menu_caption[4]="[A]CPI Support off" -set toggled_text[4]="[A]CPI Support On" -set menu_command[4]="toggle_acpi" -set menu_keycode[4]="97" -set menu_acpi=4 -set ansi_caption[4]="ACPI Support Off" -set toggled_ansi[4]="ACPI Support On" - -set menu_caption[5]="Safe [M]ode... off" -set toggled_text[5]="Safe [M]ode... On" -set menu_init[5]="init_safemode" -set menu_command[5]="toggle_safemode" -set menu_keycode[5]="109" -set ansi_caption[5]="Safe Mode... Off" -set toggled_ansi[5]="Safe Mode... On" - -set menu_caption[6]="[S]ingle User. off" -set toggled_text[6]="[S]ingle User. On" -set menu_init[6]="init_singleuser" -set menu_command[6]="toggle_singleuser" -set menu_keycode[6]="115" -set ansi_caption[6]="Single User. Off" -set toggled_ansi[6]="Single User. On" - -set menu_caption[7]="[V]erbose..... off" -set toggled_text[7]="[V]erbose..... On" -set menu_init[7]="init_verbose" -set menu_command[7]="toggle_verbose" -set menu_keycode[7]="118" -set ansi_caption[7]="Verbose..... Off" -set toggled_ansi[7]="Verbose..... On" +set optionsmenu_caption[1]="Back to Main Menu [Backspace]" +set optionsmenu_command[1]="1 goto_menu" +set optionsmenu_keycode[1]=8 +set optionsansi_caption[1]="Back to Main Menu [Backspace]" + +set optionsmenu_caption[2]="Load System [D]efaults" +set optionsmenu_command[2]="set_default_boot_options" +set optionsmenu_keycode[2]=100 +set optionsansi_caption[2]="Load System Defaults" + +set optionsmenu_options=3 +set optionsmenu_optionstext="Boot Options:" + +set optionsmenu_acpi=3 +set optionsmenu_caption[3]="[A]CPI Support off" +set optionstoggled_text[3]="[A]CPI Support On" +set optionsmenu_command[3]="toggle_acpi" +set optionsmenu_keycode[3]=97 +set optionsansi_caption[3]="ACPI Support Off" +set optionstoggled_ansi[3]="ACPI Support On" + +set optionsmenu_init[4]="init_safemode" +set optionsmenu_caption[4]="Safe [M]ode... off" +set optionstoggled_text[4]="Safe [M]ode... On" +set optionsmenu_command[4]="toggle_safemode" +set optionsmenu_keycode[4]=109 +set optionsansi_caption[4]="Safe Mode... Off" +set optionstoggled_ansi[4]="Safe Mode... On" + +set optionsmenu_init[5]="init_singleuser" +set optionsmenu_caption[5]="[S]ingle User. off" +set optionstoggled_text[5]="[S]ingle User. On" +set optionsmenu_command[5]="toggle_singleuser" +set optionsmenu_keycode[5]=115 +set optionsansi_caption[5]="Single User. Off" +set optionstoggled_ansi[5]="Single User. On" + +set optionsmenu_init[6]="init_verbose" +set optionsmenu_caption[6]="[V]erbose..... off" +set optionstoggled_text[6]="[V]erbose..... On" +set optionsmenu_command[6]="toggle_verbose" +set optionsmenu_keycode[6]=118 +set optionsansi_caption[6]="Verbose..... Off" +set optionstoggled_ansi[6]="Verbose..... On" \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to \ customize the timeout; default is 10-seconds) @@ -76,4 +117,6 @@ set toggled_ansi[7]="Verbose... set menu_timeout_command="boot" \ Display the main menu (see `menu.4th') +set menuset_initial=1 +menuset-loadinitial menu-display From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 18:37:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 30EB2EC9; Wed, 28 Nov 2012 18:37:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F10A48FC08; Wed, 28 Nov 2012 18:37:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASIbKtv008771; Wed, 28 Nov 2012 18:37:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASIbKhQ008770; Wed, 28 Nov 2012 18:37:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201211281837.qASIbKhQ008770@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 28 Nov 2012 18:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243661 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 18:37:21 -0000 Author: hselasky Date: Wed Nov 28 18:37:20 2012 New Revision: 243661 URL: http://svnweb.freebsd.org/changeset/base/243661 Log: Regenerate usb.conf MFC after: 1 week Modified: head/etc/devd/usb.conf Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Wed Nov 28 18:35:46 2012 (r243660) +++ head/etc/devd/usb.conf Wed Nov 28 18:37:20 2012 (r243661) @@ -52,6 +52,17 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "vendor" "0x05ac"; + match "product" "0x12a8"; + match "intclass" "0xff"; + match "intsubclass" "0xfd"; + match "intprotocol" "0x01"; + action "kldload -n if_ipheth"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "vendor" "0x0104"; match "product" "0x00be"; action "kldload -n uipaq"; @@ -3069,7 +3080,7 @@ nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; match "vendor" "0x12d1"; - match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1465|0x14ac|0x14fe|0x1505|0x1506|0x1520|0x1803|0x1c05|0x1c0b)"; + match "product" "(0x1001|0x1003|0x1004|0x1401|0x1402|0x1403|0x1404|0x1405|0x1406|0x1407|0x1408|0x1409|0x140a|0x140b|0x140c|0x140d|0x140e|0x140f|0x1410|0x1411|0x1412|0x1413|0x1414|0x1415|0x1416|0x1417|0x1418|0x1419|0x141a|0x141b|0x141c|0x141d|0x141e|0x141f|0x1420|0x1421|0x1422|0x1423|0x1424|0x1425|0x1426|0x1427|0x1428|0x1429|0x142a|0x142b|0x142c|0x142d|0x142e|0x142f|0x1430|0x1431|0x1432|0x1433|0x1434|0x1435|0x1436|0x1437|0x1438|0x1439|0x143a|0x143b|0x143c|0x143d|0x143e|0x143f|0x1446|0x1464|0x1465|0x14ac|0x14c9|0x14d1|0x14fe|0x1505|0x1506|0x1520|0x1521|0x1803|0x1c05|0x1c0b)"; action "kldload -n u3g"; }; @@ -4600,5 +4611,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2274 USB entries processed +# 2279 USB entries processed From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 19:32:30 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2684BD4; Wed, 28 Nov 2012 19:32:30 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id B98CC8FC0C; Wed, 28 Nov 2012 19:32:30 +0000 (UTC) Received: from [10.250.141.33] (181.sub-174-254-232.myvzw.com [174.254.232.181]) by elvis.mu.org (Postfix) with ESMTPSA id CB2421A3DD8; Wed, 28 Nov 2012 11:32:29 -0800 (PST) References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <20121128175116.GI14202@FreeBSD.org> <41E6060B-5A74-4524-9011-2BFFF5B47E24@FreeBSD.org> Mime-Version: 1.0 (1.0) In-Reply-To: <41E6060B-5A74-4524-9011-2BFFF5B47E24@FreeBSD.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <645253DB-A722-477B-8E86-FDBD9E3E58C4@mu.org> X-Mailer: iPhone Mail (10A523) From: Alfred Perlstein Subject: Re: svn commit: r243627 - head/sys/kern Date: Wed, 28 Nov 2012 11:32:27 -0800 To: "Robert N. M. Watson" Cc: "src-committers@FreeBSD.org" , Andre Oppermann , Peter Wemm , "svn-src-all@FreeBSD.org" , Gleb Smirnoff , "svn-src-head@FreeBSD.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 19:32:31 -0000 Do you think we need another TRB? It could be used to oust undesirable committers if needed.=20 Sent from my iPhone On Nov 28, 2012, at 10:25 AM, "Robert N. M. Watson" wr= ote: >=20 > On 28 Nov 2012, at 17:51, Gleb Smirnoff wrote: >=20 >> On Wed, Nov 28, 2012 at 09:39:15AM -0800, Alfred Perlstein wrote: >> A> Personally I don't think we need any more anchors attached to people's= =20 >> A> feet when developing FreeBSD. >> A>=20 >> A> Mistakes will happen, they will happen in head. Slowing down the=20 >> A> process to eliminate mistakes only works to slow down change and give a= =20 >> A> false sense of "fixing stability" when in fact the only thing "stable"= =20 >> A> is the slowness of submitting code. >>=20 >> This will eventually lead back to the situation when no one runs head, >> because it is unusable. >=20 > Also, based on past experience: I'm much happier reviewing shaky code befo= re it goes into the tree than trying to debug it in situ and having to back i= t out. If our advice to many companies is that they should start developing p= roducts against head, we can't let the quality of the head get back to the w= ay it was in the 5.x timeframe. Several factors have led to our having a nea= rly-production quality development head over the last few years -- one is mu= ch heavier use of branched development for features (first Perforce, and mor= e recently, Subversion, git, etc branches); the other is much heavier use of= code review, especially for critical parts of the system. Device driver aut= hors have a lot more leeway, but for core parts of the design, seeking revie= w during development of a feature, and then before merging it upstream, shou= ld be an expectation for all but the most trivial of changes. It's a two-way= street, of course: if you review other people's code, they will review your= s, so as more people use review, the pool of potential reviewers goes up as w= ell. >=20 > Robert From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 21:00:18 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0E05D129; Wed, 28 Nov 2012 21:00:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B60298FC0C; Wed, 28 Nov 2012 21:00:17 +0000 (UTC) Received: from [10.141.19.129] (unknown [212.183.128.188]) by cyrus.watson.org (Postfix) with ESMTPSA id 27D2D46B09; Wed, 28 Nov 2012 16:00:17 -0500 (EST) References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <20121128175116.GI14202@FreeBSD.org> <41E6060B-5A74-4524-9011-2BFFF5B47E24@FreeBSD.org> <645253DB-A722-477B-8E86-FDBD9E3E58C4@mu.org> Mime-Version: 1.0 (1.0) In-Reply-To: <645253DB-A722-477B-8E86-FDBD9E3E58C4@mu.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: X-Mailer: iPad Mail (10A403) From: "Robert N. M. Watson" Subject: Re: svn commit: r243627 - head/sys/kern Date: Wed, 28 Nov 2012 21:00:13 +0000 To: Alfred Perlstein Cc: "src-committers@FreeBSD.org" , Andre Oppermann , Peter Wemm , "svn-src-all@FreeBSD.org" , Gleb Smirnoff , "svn-src-head@FreeBSD.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 21:00:18 -0000 On 28 Nov 2012, at 19:32, Alfred Perlstein wrote: > Do you think we need another TRB? >=20 > It could be used to oust undesirable committers if needed.=20 Are we seriously having a discussion in which the merits of favouring pre-co= mmit code review for the things like TCP stack are in doubt? I'm not saying w= e need to seek universal consensus on all changes, rather, that I would stro= ngly prefer that people committing to this code seek review (and clearly ind= icate it in commit messages) before rather than after sticking things in the= tree. This stuff is incredibly subtle, and debugging problems in the field i= s vastly harder than catching them early in the cycle. I certainly wouldn't c= ommit any non-trivial change to the code in question without asking someone t= o go through it line-by-line, and I'd prefer if others took the same view, a= s I often end up chasing the bugs later, in the field, where it is hardest t= o do so. Robert >=20 > Sent from my iPhone >=20 > On Nov 28, 2012, at 10:25 AM, "Robert N. M. Watson" w= rote: >=20 >>=20 >> On 28 Nov 2012, at 17:51, Gleb Smirnoff wrote: >>=20 >>> On Wed, Nov 28, 2012 at 09:39:15AM -0800, Alfred Perlstein wrote: >>> A> Personally I don't think we need any more anchors attached to people'= s=20 >>> A> feet when developing FreeBSD. >>> A>=20 >>> A> Mistakes will happen, they will happen in head. Slowing down the=20 >>> A> process to eliminate mistakes only works to slow down change and give= a=20 >>> A> false sense of "fixing stability" when in fact the only thing "stable= "=20 >>> A> is the slowness of submitting code. >>>=20 >>> This will eventually lead back to the situation when no one runs head, >>> because it is unusable. >>=20 >> Also, based on past experience: I'm much happier reviewing shaky code bef= ore it goes into the tree than trying to debug it in situ and having to back= it out. If our advice to many companies is that they should start developin= g products against head, we can't let the quality of the head get back to th= e way it was in the 5.x timeframe. Several factors have led to our having a n= early-production quality development head over the last few years -- one is m= uch heavier use of branched development for features (first Perforce, and mo= re recently, Subversion, git, etc branches); the other is much heavier use o= f code review, especially for critical parts of the system. Device driver au= thors have a lot more leeway, but for core parts of the design, seeking revi= ew during development of a feature, and then before merging it upstream, sho= uld be an expectation for all but the most trivial of changes. It's a two-wa= y street, of course: if you review other people's code, they will review you= rs, so as more people use review, the pool of potential reviewers goes up as= well. >>=20 >> Robert From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 21:45:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77472F62; Wed, 28 Nov 2012 21:45:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id C06278FC13; Wed, 28 Nov 2012 21:45:48 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qASLjYRB008859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Nov 2012 08:45:39 +1100 Date: Thu, 29 Nov 2012 08:45:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Cox Subject: Re: svn commit: r243631 - in head/sys: kern sys In-Reply-To: <50B64BE8.3040708@rice.edu> Message-ID: <20121129072617.T1123@besplex.bde.org> References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=Zoq1sKHG c=1 sm=1 a=PcN1GEuqyV8A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=Y5AXMyR2jB0A:10 a=ZpmuPUM5UnzFerMvZvEA:9 a=CjuIK1q_8ugA:10 a=qNwCHDfXISvSPmd_:21 a=yMgbbjGJPBlhYQA9:21 a=LyIlnvU96IiO9QpA:21 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andre Oppermann X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 21:45:49 -0000 On Wed, 28 Nov 2012, Alan Cox wrote: > I'm pretty sure that the "realmem" calculation is going to overflow on > i386/PAE, where the number of bytes of physical memory is greater than > the type long can represent. It overflows on i386 even without PAE, where the number of bytes of physical memory is greater than the type long can represent (2GB). This is the usual case for new hardware. I think it changes the defaults for machines with small amounts of memory (say 32MB) in dangerous ways. Reserving half of kva for mbufs is network-centric. I reserve more than half of kva for the buffer cache in some configurations (VM_BCACHE_SIZE_MAX defaults too 200 MB, but I use 512 MB), and in the old scheme where the default for mbufs was under-sized, this may even have fitted without separate tuning for mbufs. The code has lots of style bugs. > On 11/27/2012 15:19, Andre Oppermann wrote: >> ... >> NB: Every cluster also has an mbuf associated with it. >> >> Two examples on the revised mbuf sizing limits: >> >> 1GB KVM: >> 512MB limit for mbufs >> 419,430 mbufs >> 65,536 2K mbuf clusters >> 32,768 4K mbuf clusters >> 9,709 9K mbuf clusters >> 5,461 16K mbuf clusters >> >> 16GB RAM: >> 8GB limit for mbufs >> 33,554,432 mbufs >> 1,048,576 2K mbuf clusters >> 524,288 4K mbuf clusters >> 155,344 9K mbuf clusters >> 87,381 16K mbuf clusters >> >> These defaults should be sufficient for even the most demanding >> network loads. I noticed in earlier mail that there were no examples with small amounts of physical memory. This case mixes unusually with the relatively large amount of kva. PAE gives the opposite extreme. >> Modified: head/sys/kern/kern_mbuf.c >> ============================================================================== >> --- head/sys/kern/kern_mbuf.c Tue Nov 27 20:22:36 2012 (r243630) >> +++ head/sys/kern/kern_mbuf.c Tue Nov 27 21:19:58 2012 (r243631) >> @@ -147,9 +148,11 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) >> newnmbclusters = nmbclusters; >> error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); >> if (error == 0 && req->newptr) { >> - if (newnmbclusters > nmbclusters) { >> + if (newnmbclusters > nmbclusters && >> + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { Style bug: long line. This bogotifies early splitting in the previous line. >> nmbclusters = newnmbclusters; >> uma_zone_set_max(zone_clust, nmbclusters); >> + nmbclusters = uma_zone_get_max(zone_clust); >> EVENTHANDLER_INVOKE(nmbclusters_change); >> } else >> error = EINVAL; >> @@ -168,9 +171,11 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS) >> newnmbjumbop = nmbjumbop; >> error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req); >> if (error == 0 && req->newptr) { >> - if (newnmbjumbop> nmbjumbop) { >> + if (newnmbjumbop > nmbjumbop && >> + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { Style bug, as above. >> nmbjumbop = newnmbjumbop; >> uma_zone_set_max(zone_jumbop, nmbjumbop); >> + nmbjumbop = uma_zone_get_max(zone_jumbop); >> } else >> error = EINVAL; >> } >> @@ -189,9 +194,11 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS) >> newnmbjumbo9 = nmbjumbo9; >> error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req); >> if (error == 0 && req->newptr) { >> - if (newnmbjumbo9> nmbjumbo9) { >> + if (newnmbjumbo9 > nmbjumbo9&& Style bug, not as above (no space before '&&'). >> + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { Style bug, as above. >> nmbjumbo9 = newnmbjumbo9; >> uma_zone_set_max(zone_jumbo9, nmbjumbo9); >> + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); >> } else >> error = EINVAL; >> } >> @@ -209,9 +216,11 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS) >> newnmbjumbo16 = nmbjumbo16; >> error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); >> if (error == 0 && req->newptr) { >> - if (newnmbjumbo16> nmbjumbo16) { >> + if (newnmbjumbo16 > nmbjumbo16 && >> + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { Style bug, as above. >> nmbjumbo16 = newnmbjumbo16; >> uma_zone_set_max(zone_jumbo16, nmbjumbo16); >> + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); >> } else >> error = EINVAL; >> } The code surrounding these style bugs uses the technique of nested elses to make the indentation march to the right, when it could simply return after an error and after the usual case where the sysctl only does a read. For one of the sysctls, the old code is: @ static int @ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) @ { @ int error, newnmbclusters; @ @ newnmbclusters = nmbclusters; @ error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); Style bug: hard-coding of the variable type (int) hard-coding sysctl_handle_int() here. @ if (error == 0 && req->newptr) { Style bug: boolean check for null pointer. Technique for marching to the right starts here. @ if (newnmbclusters > nmbclusters) { Use another nested else to get 2 indentation levels deeper than necessary altogether. @ nmbclusters = newnmbclusters; @ uma_zone_set_max(zone_clust, nmbclusters); @ EVENTHANDLER_INVOKE(nmbclusters_change); @ } else @ error = EINVAL; Only increasing nmbclusters is supported. Even null changes of it give this error. @ } @ return (error); @ } After fixing some style bugs and reducing the indentation. @@ if (error != 0 || req->newptr == NULL) @@ return (error); @@ if (newnmbclusters <= nmbclusters) @@ return (EINVAL); /* XXX preserve bogusness when equal */ @@ nmbclusters = newnmbclusters; @@ uma_zone_set_max(zone_clust, nmbclusters); @@ EVENTHANDLER_INVOKE(nmbclusters_change); @@ return (0); @@ } @ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbclusters, CTLTYPE_INT|CTLFLAG_RW, Missing spaces around binary operation '|'. @ &nmbclusters, 0, sysctl_nmbclusters, "IU", Missing indentation. @ "Maximum number of mbuf clusters allowed"); @ Back to the commit. >> @@ -221,6 +230,27 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumb >> &nmbjumbo16, 0, sysctl_nmbjumbo16, "IU", >> "Maximum number of mbuf 16k jumbo clusters allowed"); >> >> +static int >> +sysctl_nmbufs(SYSCTL_HANDLER_ARGS) >> +{ >> + int error, newnmbufs; >> + >> + newnmbufs = nmbufs; >> + error = sysctl_handle_int(oidp, &newnmbufs, 0, req); >> + if (error == 0 && req->newptr) { >> + if (newnmbufs > nmbufs) { >> + nmbufs = newnmbufs; >> + uma_zone_set_max(zone_mbuf, nmbufs); >> + nmbclusters = uma_zone_get_max(zone_mbuf); >> + EVENTHANDLER_INVOKE(nmbufs_change); >> + } else >> + error = EINVAL; >> + } >> + return (error); >> +} >> +SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW, >> +&nmbufs, 0, sysctl_nmbufs, "IU", >> + "Maximum number of mbufs allowed"); All the bugs in the old sysctl are cloned here. >> >> This is not bug for bug compatible. There used to be 3 blank lines here (2 extra). Now there are only 2 (1 extra). >> Modified: head/sys/kern/subr_param.c >> ============================================================================== >> --- head/sys/kern/subr_param.c Tue Nov 27 20:22:36 2012 (r243630) >> +++ head/sys/kern/subr_param.c Tue Nov 27 21:19:58 2012 (r243631) >> @@ -93,6 +93,7 @@ int ncallout; /* maximum # of timer ev >> int nbuf; >> int ngroups_max; /* max # groups per process */ >> int nswbuf; >> +long maxmbufmem; /* max mbuf memory */ This can overflow too, since once the other overflows are fixed, it is only limited to 3/4 of physical memory so the limit on i386 is 3G, which overflows to -1G when stored here. >> pid_t pid_max = PID_MAX; >> long maxswzone; /* max swmeta KVA storage */ >> long maxbcache; /* max buffer cache KVA storage */ >> @@ -270,6 +271,7 @@ init_param1(void) >> void >> init_param2(long physpages) vm mostly uses u_int for page counts (see . v_page_count is only u_int). This avoids most overflow problems. I think alc wants to change to longs. But long is just bogus here. It can't even handle the range of u_int on 32-bit systems. But since 32-bit systems can't have >= 2**31 pages, this type error is only cosmetic. >> { >> + long realmem; u_long would work up to 4GB. >> >> /* Base parameters */ >> maxusers = MAXUSERS; >> @@ -293,19 +295,25 @@ init_param2(long physpages) >> /* >> * The following can be overridden after boot via sysctl. Note: >> * unless overriden, these macros are ultimately based on maxusers. >> - */ >> - maxproc = NPROC; >> - TUNABLE_INT_FETCH("kern.maxproc", &maxproc); >> - /* >> * Limit maxproc so that kmap entries cannot be exhausted by >> * processes. >> */ >> + maxproc = NPROC; >> + TUNABLE_INT_FETCH("kern.maxproc", &maxproc); The comments are misplaced in different ways than before. >> if (maxproc > (physpages / 12)) Old style bug: excessive parentheses. >> maxproc = physpages / 12; I dodn't like limiting the values that can be set by tunables. This prevents the administrator overring bad limits, including ones caused by overflows. >> - maxfiles = MAXFILES; >> - TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); >> maxprocperuid = (maxproc * 9) / 10; >> - maxfilesperproc = (maxfiles * 9) / 10; >> + >> + /* >> + * The default limit for maxfiles is 1/12 of the number of >> + * physical page but not less than 16 times maxusers. >> + * At most it can be 1/6 the number of physical pages. >> + */ Very wrong comment: - 1/12 is unrelated to maxfiles. It is for maxproc, and is used for that without comment above. The code uses 1/8. - 16 is quite wrong too, but the actual limit is hard to describe. The code uses a limit of MAXFILES, where MAXFILES defaults to (maxproc * 2) but can be #defined; maxproc defaults to NPROC but can be clamped. NPROC is (20 + 16 * maxusers), and cannot be #defined. The 16 in it seems to be the relevant magic numbner. But since there is a factor of 2 in (maxproc * 2), 16 is just wrong and 32 is closer to being correct. - 1/6 seems to be wrong too. The code uses 1/4. I don't like limiting tunable at all. This code has too many comments, and most of them are not useful. Most of them just echo the magic numbers in the code (here the code's value of 1/8 is not even echoed). Few or none describe when these values are what the are. Of course, this is hard to describe since the values are either heuristics or the result of very complicated calculations to ensure that everything can be packed into the available physical/virtual memory, or more likely some fuzzy combination of these. >> + maxfiles = imax(MAXFILES, physpages / 8); >> + TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); >> + if (maxfiles > (physpages / 4)) Style bug (excessive parentheses). >> + maxfiles = physpages / 4; >> + maxfilesperproc = (maxfiles / 10) * 9; Style bug (excessive parentheses). >> >> /* >> * Cannot be changed after boot. >> @@ -313,20 +321,35 @@ init_param2(long physpages) >> nbuf = NBUF; >> TUNABLE_INT_FETCH("kern.nbuf", &nbuf); >> >> + /* >> + * XXX: Does the callout wheel have to be so big? >> + */ >> ncallout = 16 + maxproc + maxfiles; >> TUNABLE_INT_FETCH("kern.ncallout", &ncallout); >> >> /* >> + * The default limit for all mbuf related memory is 1/2 of all >> + * available kernel memory (physical or kmem). >> + * At most it can be 3/4 of available kernel memory. >> + */ >> + realmem = lmin(physpages * PAGE_SIZE, >> + VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); As well as overflowing, this has a weird continuation indentation of 2 tabs to not line up with anything, instead of the KNF 4 spaces to line up with that level of indentation. >> + maxmbufmem = realmem / 2; >> + TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); >> + if (maxmbufmem > (realmem / 4) * 3) >> + maxmbufmem = (realmem / 4) * 3; Style bugs (excessive indentation; 2 instances). You added a lot of upper clamps on tunables. I don't like them, as above. There are no lower clamps, so foot shooting is still easy by setting tunables to preposterous values like 0 or negative, or to large values that overflow to negative. And if some other subsystem uses a tunable or option like VM_BCACHE_SIZE_MAX to reserve lots of kva for itself, none of the upper clams here is right. >> + >> + /* >> * The default for maxpipekva is min(1/64 of the kernel address space, >> * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. >> */ >> maxpipekva = (physpages / 64) * PAGE_SIZE; Old style bug (excessive parentheses). This divides by 64 first, so its multiplication doesn't overflow so easily. It works up to 64 * 2GB. I don't know the limit for PAE, but this much physical memory is easy to reach now. >> + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); >> if (maxpipekva < 512 * 1024) >> maxpipekva = 512 * 1024; >> if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) >> maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / >> 64; >> - TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); This used to be correctly placed, so that the administrator can set any value. >> } >> >> /* >> >> Modified: head/sys/kern/uipc_socket.c >> ============================================================================== >> --- head/sys/kern/uipc_socket.c Tue Nov 27 20:22:36 2012 (r243630) >> +++ head/sys/kern/uipc_socket.c Tue Nov 27 21:19:58 2012 (r243631) >> @@ -306,12 +306,9 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) >> newmaxsockets = maxsockets; >> error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); >> if (error == 0 && req->newptr) { >> - if (newmaxsockets > maxsockets) { >> + if (newmaxsockets > maxsockets && >> + newmaxsockets <= maxfiles) { No need to split this line. >> maxsockets = newmaxsockets; >> - if (maxsockets > ((maxfiles / 4) * 3)) { >> - maxfiles = (maxsockets * 5) / 4; >> - maxfilesperproc = (maxfiles * 9) / 10; >> - } Bad examples with exessive parnetheses in old code. >> EVENTHANDLER_INVOKE(maxsockets_change); >> } else >> error = EINVAL; >> Bruce From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 22:04:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4320A688; Wed, 28 Nov 2012 22:04:19 +0000 (UTC) (envelope-from pgj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2778F8FC08; Wed, 28 Nov 2012 22:04:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qASM4Jif038847; Wed, 28 Nov 2012 22:04:19 GMT (envelope-from pgj@svn.freebsd.org) Received: (from pgj@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qASM4Ino038846; Wed, 28 Nov 2012 22:04:18 GMT (envelope-from pgj@svn.freebsd.org) Message-Id: <201211282204.qASM4Ino038846@svn.freebsd.org> From: Gabor Pali Date: Wed, 28 Nov 2012 22:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243662 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 22:04:19 -0000 Author: pgj (ports committer) Date: Wed Nov 28 22:04:18 2012 New Revision: 243662 URL: http://svnweb.freebsd.org/changeset/base/243662 Log: - Update organization.dot to reflect that attilio resigned from core Approved by: core (implicit) Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Wed Nov 28 18:37:20 2012 (r243661) +++ head/share/misc/organization.dot Wed Nov 28 22:04:18 2012 (r243662) @@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\ncore@FreeBSD.org\ntabthorpe, gavin, jhb, kib,\ntheraven, attilio, hrs,\npeter, miwi"] +core [label="Core Team\ncore@FreeBSD.org\ntabthorpe, gavin, jhb, kib,\ntheraven, hrs, peter, miwi"] coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\npgj"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\ngjb, blackend,\ngabor, hrs"] From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 22:13:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4122A74; Wed, 28 Nov 2012 22:13:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx1.freebsd.org (Postfix) with ESMTP id BD3C38FC08; Wed, 28 Nov 2012 22:13:32 +0000 (UTC) Received: by mail-wi0-f174.google.com with SMTP id hm9so5125436wib.13 for ; Wed, 28 Nov 2012 14:13:31 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=i1BP0dya9udJILpewnzaGBWOMWHe5COyMg5FXUHRHAY=; b=UTcnO7tYbYtgB5eW3zGLJD34eqJy/dul9hV5fmcXRfZIXE4bfZxFOFG6LNSbhPInnO jghBQZa8y4DwRnrzgdhUk5qIPEYr2eHEZf2Lq/95xiGjaD2ZBFgvm6D+H9zG/9u9JONM vUWHvAs4YDgTnfrgrppsYi6nQKop6ljhj2Jmshq2gcqbYo/qF9Z+oHUdXVXIF7bILrUG x36fPzd2h4by7shlxfDnovPylVz/0Ksq3gTstiXk6EYqr3E423qDJG0yht1v1O1RbfVO tydUmnxPqoUmohKfYsuJlGA8jGl8nNtsSvnQi9zvRciaX2p7RUTxyniyxMB7iMZJms1N OoLw== MIME-Version: 1.0 Received: by 10.216.85.211 with SMTP id u61mr2470608wee.212.1354140811660; Wed, 28 Nov 2012 14:13:31 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Wed, 28 Nov 2012 14:13:31 -0800 (PST) In-Reply-To: <201211272119.qARLJxXV061083@svn.freebsd.org> References: <201211272119.qARLJxXV061083@svn.freebsd.org> Date: Wed, 28 Nov 2012 14:13:31 -0800 X-Google-Sender-Auth: jXSNodJZ-aPm9bsAd7QiZjSnmv8 Message-ID: Subject: Re: svn commit: r243631 - in head/sys: kern sys From: Adrian Chadd To: Andre Oppermann 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 22:13:33 -0000 Can you please post some example figures for machines with 16, 32, 64 and 128MB? As Bruce has just replied, there's concern about this tuning being very "lots of RAM" centric, which certainly isn't the case. I'd hate to see this swing from one extreme (not enough mbufs) to the other extreme .. Adrian On 27 November 2012 13:19, Andre Oppermann wrote: > Author: andre > Date: Tue Nov 27 21:19:58 2012 > New Revision: 243631 > URL: http://svnweb.freebsd.org/changeset/base/243631 > > Log: > Base the mbuf related limits on the available physical memory or > kernel memory, whichever is lower. The overall mbuf related memory > limit must be set so that mbufs (and clusters of various sizes) > can't exhaust physical RAM or KVM. > > The limit is set to half of the physical RAM or KVM (whichever is > lower) as the baseline. In any normal scenario we want to leave > at least half of the physmem/kvm for other kernel functions and > userspace to prevent it from swapping too easily. Via a tunable > kern.maxmbufmem the limit can be upped to at most 3/4 of physmem/kvm. > > At the same time divorce maxfiles from maxusers and set maxfiles to > physpages / 8 with a floor based on maxusers. This way busy servers > can make use of the significantly increased mbuf limits with a much > larger number of open sockets. > > Tidy up ordering in init_param2() and check up on some users of > those values calculated here. > > Out of the overall mbuf memory limit 2K clusters and 4K (page size) > clusters to get 1/4 each because these are the most heavily used mbuf > sizes. 2K clusters are used for MTU 1500 ethernet inbound packets. > 4K clusters are used whenever possible for sends on sockets and thus > outbound packets. The larger cluster sizes of 9K and 16K are limited > to 1/6 of the overall mbuf memory limit. When jumbo MTU's are used > these large clusters will end up only on the inbound path. They are > not used on outbound, there it's still 4K. Yes, that will stay that > way because otherwise we run into lots of complications in the > stack. And it really isn't a problem, so don't make a scene. > > Normal mbufs (256B) weren't limited at all previously. This was > problematic as there are certain places in the kernel that on > allocation failure of clusters try to piece together their packet > from smaller mbufs. > > The mbuf limit is the number of all other mbuf sizes together plus > some more to allow for standalone mbufs (ACK for example) and to > send off a copy of a cluster. Unfortunately there isn't a way to > set an overall limit for all mbuf memory together as UMA doesn't > support such a limiting. > > NB: Every cluster also has an mbuf associated with it. > > Two examples on the revised mbuf sizing limits: > > 1GB KVM: > 512MB limit for mbufs > 419,430 mbufs > 65,536 2K mbuf clusters > 32,768 4K mbuf clusters > 9,709 9K mbuf clusters > 5,461 16K mbuf clusters > > 16GB RAM: > 8GB limit for mbufs > 33,554,432 mbufs > 1,048,576 2K mbuf clusters > 524,288 4K mbuf clusters > 155,344 9K mbuf clusters > 87,381 16K mbuf clusters > > These defaults should be sufficient for even the most demanding > network loads. > > MFC after: 1 month > > Modified: > head/sys/kern/kern_mbuf.c > head/sys/kern/subr_param.c > head/sys/kern/uipc_socket.c > head/sys/sys/eventhandler.h > head/sys/sys/mbuf.h > > Modified: head/sys/kern/kern_mbuf.c > ============================================================================== > --- head/sys/kern/kern_mbuf.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/kern_mbuf.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$"); > * > */ > > +int nmbufs; /* limits number of mbufs */ > int nmbclusters; /* limits number of mbuf clusters */ > int nmbjumbop; /* limits number of page size jumbo clusters */ > int nmbjumbo9; /* limits number of 9k jumbo clusters */ > @@ -147,9 +148,11 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) > newnmbclusters = nmbclusters; > error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbclusters > nmbclusters) { > + if (newnmbclusters > nmbclusters && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbclusters = newnmbclusters; > uma_zone_set_max(zone_clust, nmbclusters); > + nmbclusters = uma_zone_get_max(zone_clust); > EVENTHANDLER_INVOKE(nmbclusters_change); > } else > error = EINVAL; > @@ -168,9 +171,11 @@ sysctl_nmbjumbop(SYSCTL_HANDLER_ARGS) > newnmbjumbop = nmbjumbop; > error = sysctl_handle_int(oidp, &newnmbjumbop, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbop> nmbjumbop) { > + if (newnmbjumbop > nmbjumbop && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbop = newnmbjumbop; > uma_zone_set_max(zone_jumbop, nmbjumbop); > + nmbjumbop = uma_zone_get_max(zone_jumbop); > } else > error = EINVAL; > } > @@ -189,9 +194,11 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS) > newnmbjumbo9 = nmbjumbo9; > error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbo9> nmbjumbo9) { > + if (newnmbjumbo9 > nmbjumbo9&& > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbo9 = newnmbjumbo9; > uma_zone_set_max(zone_jumbo9, nmbjumbo9); > + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); > } else > error = EINVAL; > } > @@ -209,9 +216,11 @@ sysctl_nmbjumbo16(SYSCTL_HANDLER_ARGS) > newnmbjumbo16 = nmbjumbo16; > error = sysctl_handle_int(oidp, &newnmbjumbo16, 0, req); > if (error == 0 && req->newptr) { > - if (newnmbjumbo16> nmbjumbo16) { > + if (newnmbjumbo16 > nmbjumbo16 && > + nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) { > nmbjumbo16 = newnmbjumbo16; > uma_zone_set_max(zone_jumbo16, nmbjumbo16); > + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); > } else > error = EINVAL; > } > @@ -221,6 +230,27 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbjumb > &nmbjumbo16, 0, sysctl_nmbjumbo16, "IU", > "Maximum number of mbuf 16k jumbo clusters allowed"); > > +static int > +sysctl_nmbufs(SYSCTL_HANDLER_ARGS) > +{ > + int error, newnmbufs; > + > + newnmbufs = nmbufs; > + error = sysctl_handle_int(oidp, &newnmbufs, 0, req); > + if (error == 0 && req->newptr) { > + if (newnmbufs > nmbufs) { > + nmbufs = newnmbufs; > + uma_zone_set_max(zone_mbuf, nmbufs); > + nmbclusters = uma_zone_get_max(zone_mbuf); > + EVENTHANDLER_INVOKE(nmbufs_change); > + } else > + error = EINVAL; > + } > + return (error); > +} > +SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW, > +&nmbufs, 0, sysctl_nmbufs, "IU", > + "Maximum number of mbufs allowed"); > > > SYSCTL_STRUCT(_kern_ipc, OID_AUTO, mbstat, CTLFLAG_RD, &mbstat, mbstat, > @@ -275,6 +305,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > MSIZE - 1, UMA_ZONE_MAXBUCKET); > + if (nmbufs > 0) { > + uma_zone_set_max(zone_mbuf, nmbufs); > + nmbufs = uma_zone_get_max(zone_mbuf); > + } > > zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -284,8 +318,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbclusters > 0) > + if (nmbclusters > 0) { > uma_zone_set_max(zone_clust, nmbclusters); > + nmbclusters = uma_zone_get_max(zone_clust); > + } > > zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack, > mb_dtor_pack, mb_zinit_pack, mb_zfini_pack, zone_mbuf); > @@ -299,8 +335,10 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbop > 0) > + if (nmbjumbop > 0) { > uma_zone_set_max(zone_jumbop, nmbjumbop); > + nmbjumbop = uma_zone_get_max(zone_jumbop); > + } > > zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -310,9 +348,11 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbo9 > 0) > - uma_zone_set_max(zone_jumbo9, nmbjumbo9); > uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); > + if (nmbjumbo9 > 0) { > + uma_zone_set_max(zone_jumbo9, nmbjumbo9); > + nmbjumbo9 = uma_zone_get_max(zone_jumbo9); > + } > > zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, > mb_ctor_clust, mb_dtor_clust, > @@ -322,9 +362,11 @@ mbuf_init(void *dummy) > NULL, NULL, > #endif > UMA_ALIGN_PTR, UMA_ZONE_REFCNT); > - if (nmbjumbo16 > 0) > - uma_zone_set_max(zone_jumbo16, nmbjumbo16); > uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); > + if (nmbjumbo16 > 0) { > + uma_zone_set_max(zone_jumbo16, nmbjumbo16); > + nmbjumbo16 = uma_zone_get_max(zone_jumbo16); > + } > > zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), > NULL, NULL, > > Modified: head/sys/kern/subr_param.c > ============================================================================== > --- head/sys/kern/subr_param.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/subr_param.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -93,6 +93,7 @@ int ncallout; /* maximum # of timer ev > int nbuf; > int ngroups_max; /* max # groups per process */ > int nswbuf; > +long maxmbufmem; /* max mbuf memory */ > pid_t pid_max = PID_MAX; > long maxswzone; /* max swmeta KVA storage */ > long maxbcache; /* max buffer cache KVA storage */ > @@ -270,6 +271,7 @@ init_param1(void) > void > init_param2(long physpages) > { > + long realmem; > > /* Base parameters */ > maxusers = MAXUSERS; > @@ -293,19 +295,25 @@ init_param2(long physpages) > /* > * The following can be overridden after boot via sysctl. Note: > * unless overriden, these macros are ultimately based on maxusers. > - */ > - maxproc = NPROC; > - TUNABLE_INT_FETCH("kern.maxproc", &maxproc); > - /* > * Limit maxproc so that kmap entries cannot be exhausted by > * processes. > */ > + maxproc = NPROC; > + TUNABLE_INT_FETCH("kern.maxproc", &maxproc); > if (maxproc > (physpages / 12)) > maxproc = physpages / 12; > - maxfiles = MAXFILES; > - TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); > maxprocperuid = (maxproc * 9) / 10; > - maxfilesperproc = (maxfiles * 9) / 10; > + > + /* > + * The default limit for maxfiles is 1/12 of the number of > + * physical page but not less than 16 times maxusers. > + * At most it can be 1/6 the number of physical pages. > + */ > + maxfiles = imax(MAXFILES, physpages / 8); > + TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); > + if (maxfiles > (physpages / 4)) > + maxfiles = physpages / 4; > + maxfilesperproc = (maxfiles / 10) * 9; > > /* > * Cannot be changed after boot. > @@ -313,20 +321,35 @@ init_param2(long physpages) > nbuf = NBUF; > TUNABLE_INT_FETCH("kern.nbuf", &nbuf); > > + /* > + * XXX: Does the callout wheel have to be so big? > + */ > ncallout = 16 + maxproc + maxfiles; > TUNABLE_INT_FETCH("kern.ncallout", &ncallout); > > /* > + * The default limit for all mbuf related memory is 1/2 of all > + * available kernel memory (physical or kmem). > + * At most it can be 3/4 of available kernel memory. > + */ > + realmem = lmin(physpages * PAGE_SIZE, > + VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); > + maxmbufmem = realmem / 2; > + TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); > + if (maxmbufmem > (realmem / 4) * 3) > + maxmbufmem = (realmem / 4) * 3; > + > + /* > * The default for maxpipekva is min(1/64 of the kernel address space, > * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. > */ > maxpipekva = (physpages / 64) * PAGE_SIZE; > + TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); > if (maxpipekva < 512 * 1024) > maxpipekva = 512 * 1024; > if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) > maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / > 64; > - TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); > } > > /* > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/kern/uipc_socket.c Tue Nov 27 21:19:58 2012 (r243631) > @@ -290,7 +290,7 @@ init_maxsockets(void *ignored) > { > > TUNABLE_INT_FETCH("kern.ipc.maxsockets", &maxsockets); > - maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); > + maxsockets = imax(maxsockets, maxfiles); > } > SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); > > @@ -306,12 +306,9 @@ sysctl_maxsockets(SYSCTL_HANDLER_ARGS) > newmaxsockets = maxsockets; > error = sysctl_handle_int(oidp, &newmaxsockets, 0, req); > if (error == 0 && req->newptr) { > - if (newmaxsockets > maxsockets) { > + if (newmaxsockets > maxsockets && > + newmaxsockets <= maxfiles) { > maxsockets = newmaxsockets; > - if (maxsockets > ((maxfiles / 4) * 3)) { > - maxfiles = (maxsockets * 5) / 4; > - maxfilesperproc = (maxfiles * 9) / 10; > - } > EVENTHANDLER_INVOKE(maxsockets_change); > } else > error = EINVAL; > > Modified: head/sys/sys/eventhandler.h > ============================================================================== > --- head/sys/sys/eventhandler.h Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/sys/eventhandler.h Tue Nov 27 21:19:58 2012 (r243631) > @@ -253,6 +253,7 @@ EVENTHANDLER_DECLARE(thread_fini, thread > > typedef void (*uma_zone_chfn)(void *); > EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn); > +EVENTHANDLER_DECLARE(nmbufs_change, uma_zone_chfn); > EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn); > > #endif /* SYS_EVENTHANDLER_H */ > > Modified: head/sys/sys/mbuf.h > ============================================================================== > --- head/sys/sys/mbuf.h Tue Nov 27 20:22:36 2012 (r243630) > +++ head/sys/sys/mbuf.h Tue Nov 27 21:19:58 2012 (r243631) > @@ -395,7 +395,7 @@ struct mbstat { > * > * The rest of it is defined in kern/kern_mbuf.c > */ > - > +extern long maxmbufmem; > extern uma_zone_t zone_mbuf; > extern uma_zone_t zone_clust; > extern uma_zone_t zone_pack; From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 22:26:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88001D7D for ; Wed, 28 Nov 2012 22:26:51 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 0FC348FC13 for ; Wed, 28 Nov 2012 22:26:50 +0000 (UTC) Received: (qmail 45398 invoked from network); 28 Nov 2012 23:58:08 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 28 Nov 2012 23:58:08 -0000 Message-ID: <50B68F97.3010206@freebsd.org> Date: Wed, 28 Nov 2012 23:26:31 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Alan Cox Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> In-Reply-To: <50B64BE8.3040708@rice.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 22:26:51 -0000 On 28.11.2012 18:37, Alan Cox wrote: > I'm pretty sure that the "realmem" calculation is going to overflow on > i386/PAE, where the number of bytes of physical memory is greater than > the type long can represent. Right. long == int on i386/PAE, not LP64. Is uint64_t the correct type to use to catch that? -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 23:14:52 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CE225CD; Wed, 28 Nov 2012 23:14:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id CB7658FC14; Wed, 28 Nov 2012 23:14:51 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qASNEZgb021539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Nov 2012 10:14:42 +1100 Date: Thu, 29 Nov 2012 10:14:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andre Oppermann Subject: Re: svn commit: r243631 - in head/sys: kern sys In-Reply-To: <50B68F97.3010206@freebsd.org> Message-ID: <20121129100035.P1734@besplex.bde.org> References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> <50B68F97.3010206@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=LfNkcUji c=1 sm=1 a=PcN1GEuqyV8A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=Y5AXMyR2jB0A:10 a=2YkA8vpbpZSPZ7cIIj4A:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Alan Cox X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 23:14:52 -0000 On Wed, 28 Nov 2012, Andre Oppermann wrote: > On 28.11.2012 18:37, Alan Cox wrote: >> I'm pretty sure that the "realmem" calculation is going to overflow on >> i386/PAE, where the number of bytes of physical memory is greater than >> the type long can represent. > > Right. long == int on i386/PAE, not LP64. Is uint64_t the correct type > to use to catch that? No. 2**63-1 bytes of physical memory might be enough for anyone, but more than that is is useful for virtual memory, and there is no need to ensure that P128 will be broken when it exists. I would just use sizes in pages for everything so that 32-bit u_ints are enough. Although this may break before P128 exists. Otherwise, uintmax_t should be used. Sloppy code can also depend on uintmax_t being "infinitely" large, so that multiplications by small scale factors don't overflow (use the more natural 'foo = bar * 3 / 4;' instead of 'foo = bar / 4 * 3;', but this can still overflow if bar is user input (say a tunable) that is not already limited enough. vm_paddr_t could be used for physical memory sizes, but might be too small or too large for virtual memory sizes, so using it would often give the same bloat as using uintmax_t, and more complications than using either u_int or uintmax_t for everything. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 23:16:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92A2874D for ; Wed, 28 Nov 2012 23:16:01 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id E507B8FC15 for ; Wed, 28 Nov 2012 23:16:00 +0000 (UTC) Received: (qmail 46685 invoked from network); 29 Nov 2012 00:47:23 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 29 Nov 2012 00:47:23 -0000 Message-ID: <50B69B22.80706@freebsd.org> Date: Thu, 29 Nov 2012 00:15:46 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Bruce Evans Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> <20121129072617.T1123@besplex.bde.org> In-Reply-To: <20121129072617.T1123@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alan Cox X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 23:16:01 -0000 On 28.11.2012 22:45, Bruce Evans wrote: > On Wed, 28 Nov 2012, Alan Cox wrote: > >> I'm pretty sure that the "realmem" calculation is going to overflow on >> i386/PAE, where the number of bytes of physical memory is greater than >> the type long can represent. > > It overflows on i386 even without PAE, where the number of bytes of > physical memory is greater than the type long can represent (2GB). This is the usual case for new > hardware. Please have a look at the attached patch. Is quad_t the appropriate type to use? If not, which is the right one? > I think it changes the defaults for machines with small amounts of > memory (say 32MB) in dangerous ways. > > Reserving half of kva for mbufs is network-centric. I reserve more > than half of kva for the buffer cache in some configurations > (VM_BCACHE_SIZE_MAX defaults too 200 MB, but I use 512 MB), and in the > old scheme where the default for mbufs was under-sized, this may even > have fitted without separate tuning for mbufs. Please note that NO *reservations* are made for mbufs. It's only *limits* that are enforced. For example stand-alone mbufs were not limited at all previously and could completely exhaust all available kernel memory. > The code has lots of style bugs. Thank you for your detailed input. I'll handle that after the "long" overflow issue is solved. -- Andre Index: kern/subr_param.c =================================================================== --- kern/subr_param.c (revision 243631) +++ kern/subr_param.c (working copy) @@ -271,7 +271,7 @@ void init_param2(long physpages) { - long realmem; + quad_t realmem; /* Base parameters */ maxusers = MAXUSERS; @@ -332,10 +332,10 @@ * available kernel memory (physical or kmem). * At most it can be 3/4 of available kernel memory. */ - realmem = lmin(physpages * PAGE_SIZE, + realmem = qmin(physpages * PAGE_SIZE, VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); maxmbufmem = realmem / 2; - TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); + TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem); if (maxmbufmem > (realmem / 4) * 3) maxmbufmem = (realmem / 4) * 3; Index: sys/mbuf.h =================================================================== --- sys/mbuf.h (revision 243631) +++ sys/mbuf.h (working copy) @@ -395,7 +395,7 @@ * * The rest of it is defined in kern/kern_mbuf.c */ -extern long maxmbufmem; +extern quad_t maxmbufmem; extern uma_zone_t zone_mbuf; extern uma_zone_t zone_clust; extern uma_zone_t zone_pack; From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 23:21:45 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 828EF9C2 for ; Wed, 28 Nov 2012 23:21:45 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id DDB938FC12 for ; Wed, 28 Nov 2012 23:21:44 +0000 (UTC) Received: (qmail 46719 invoked from network); 29 Nov 2012 00:53:07 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 29 Nov 2012 00:53:07 -0000 Message-ID: <50B69C7A.4010904@freebsd.org> Date: Thu, 29 Nov 2012 00:21:30 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Bruce Evans Subject: Re: svn commit: r243631 - in head/sys: kern sys References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> <50B68F97.3010206@freebsd.org> <20121129100035.P1734@besplex.bde.org> In-Reply-To: <20121129100035.P1734@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Alan Cox X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 23:21:45 -0000 On 29.11.2012 00:14, Bruce Evans wrote: > On Wed, 28 Nov 2012, Andre Oppermann wrote: > >> On 28.11.2012 18:37, Alan Cox wrote: >>> I'm pretty sure that the "realmem" calculation is going to overflow on >>> i386/PAE, where the number of bytes of physical memory is greater than >>> the type long can represent. >> >> Right. long == int on i386/PAE, not LP64. Is uint64_t the correct type >> to use to catch that? > > No. 2**63-1 bytes of physical memory might be enough for anyone, but > more than that is is useful for virtual memory, and there is no need > to ensure that P128 will be broken when it exists. > > I would just use sizes in pages for everything so that 32-bit u_ints > are enough. Although this may break before P128 exists. Pages is not optimal as it would complicate the translations to the different mbuf sizes which are not necessarily integer multiple of pages. > Otherwise, uintmax_t should be used. Sloppy code can also depend on > uintmax_t being "infinitely" large, so that multiplications by small > scale factors don't overflow (use the more natural 'foo = bar * 3 / 4;' > instead of 'foo = bar / 4 * 3;', but this can still overflow if bar > is user input (say a tunable) that is not already limited enough. In the other patch I already sent to you I've used quad_t because we already have an existing TUNABLE_QUAD_FETCH macro for it. It also more natural for people to specify a memory related number in raw bytes rather than pages (which are 8k on IA64 IIRC). > vm_paddr_t could be used for physical memory sizes, but might be too > small or too large for virtual memory sizes, so using it would often > give the same bloat as using uintmax_t, and more complications than > using either u_int or uintmax_t for everything. -- Andre From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 23:53:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3E242FD; Wed, 28 Nov 2012 23:53:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 3449E8FC12; Wed, 28 Nov 2012 23:53:56 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qASNrk4Q016806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 29 Nov 2012 10:53:48 +1100 Date: Thu, 29 Nov 2012 10:53:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andre Oppermann Subject: Re: svn commit: r243631 - in head/sys: kern sys In-Reply-To: <50B69B22.80706@freebsd.org> Message-ID: <20121129103059.W1853@besplex.bde.org> References: <201211272119.qARLJxXV061083@svn.freebsd.org> <50B64BE8.3040708@rice.edu> <20121129072617.T1123@besplex.bde.org> <50B69B22.80706@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=FoRdZBXq c=1 sm=1 a=PcN1GEuqyV8A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=Y5AXMyR2jB0A:10 a=9rSyG_wS7LSbufcbvGEA:9 a=CjuIK1q_8ugA:10 a=9p-u1cbOahvkULHJ:21 a=rgtl55nj80HkSBee:21 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans , Alan Cox X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 23:53:57 -0000 On Thu, 29 Nov 2012, Andre Oppermann wrote: > On 28.11.2012 22:45, Bruce Evans wrote: >> On Wed, 28 Nov 2012, Alan Cox wrote: >> >>> I'm pretty sure that the "realmem" calculation is going to overflow on >>> i386/PAE, where the number of bytes of physical memory is greater than >>> the type long can represent. >> >> It overflows on i386 even without PAE, where the number of bytes of >> physical memory is greater than the type long can represent (2GB). This is >> the usual case for new >> hardware. > > Please have a look at the attached patch. Is quad_t the appropriate > type to use? If not, which is the right one? quad_t is an old BSD type and shouldn't be used in any code newer than C99. Using a signed type risks sign extension bugs (but using an unsigned type may risk more). >> Reserving half of kva for mbufs is network-centric. I reserve more >> than half of kva for the buffer cache in some configurations >> (VM_BCACHE_SIZE_MAX defaults too 200 MB, but I use 512 MB), and in the >> old scheme where the default for mbufs was under-sized, this may even >> have fitted without separate tuning for mbufs. > > Please note that NO *reservations* are made for mbufs. It's only *limits* > that are enforced. For example stand-alone mbufs were not limited at all > previously and could completely exhaust all available kernel memory. I think there is no real difference. If the limits are reached then virtual memory may still be overcommitted. > Index: kern/subr_param.c > =================================================================== > --- kern/subr_param.c (revision 243631) > +++ kern/subr_param.c (working copy) > @@ -271,7 +271,7 @@ > void > init_param2(long physpages) > { > - long realmem; > + quad_t realmem; > > /* Base parameters */ > maxusers = MAXUSERS; > @@ -332,10 +332,10 @@ > * available kernel memory (physical or kmem). > * At most it can be 3/4 of available kernel memory. > */ > - realmem = lmin(physpages * PAGE_SIZE, > + realmem = qmin(physpages * PAGE_SIZE, > VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); Oops, libkern hasn't caught up with C99 yet, so it doesn't have uimmin() or uimmax() for uintmax_t. Its only new min/max functions since 1993 are for off_t. These are mistakes, since off_t is not a basic type like all the others and it is much less important than intmax_t. Using these functions is too hard, but 4.4BSD intentionally left out the unsafe macros MIN() and MAX() in the kernel. Someone broke this, so we now have MIN() and MAX() and random choices of which is used. Older subr_param code mostly doesn't use min/max functions, and you could copy this and just use compare-and-assign for uintmax_t here. > maxmbufmem = realmem / 2; > - TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); > + TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem); It is a more intractable problem that tunables also haven't caught up with C99 despite them being born in 1999 too. Nothing larger than quad_t is supported. Values larger than QUAD_MAX are blindly clamped to QUAD_MAX. This is better than for 32-bit ints and longs -- values larger than the respective MAX are blindly truncated mod 2**32. sysctls also haven't caught up with C99. So there is nothing better than TUNABLE_QUAD_FETCH() here. Then you can use any of quad_t, uquad_t, intmax_t or uintmax_t on the value. But quad_t shouldn't be used after C99... > if (maxmbufmem > (realmem / 4) * 3) > maxmbufmem = (realmem / 4) * 3; > > Index: sys/mbuf.h > =================================================================== > --- sys/mbuf.h (revision 243631) > +++ sys/mbuf.h (working copy) > @@ -395,7 +395,7 @@ > * > * The rest of it is defined in kern/kern_mbuf.c > */ > -extern long maxmbufmem; > +extern quad_t maxmbufmem; > extern uma_zone_t zone_mbuf; > extern uma_zone_t zone_clust; > extern uma_zone_t zone_pack; > Bruce From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 00:14:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 464FCC23; Thu, 29 Nov 2012 00:14:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.net.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 2AEAF8FC0C; Thu, 29 Nov 2012 00:14:24 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap8EALyntlCDaFvO/2dsb2JhbABFhiq6DnOCHgEBBSMEUhsOBgQCAg0ZAlkGiBEDDwysJ4kWDYlUgSKLHYMugRMDiF6NI4EcjyiDEIID X-IronPort-AV: E=Sophos;i="4.84,180,1355115600"; d="scan'208";a="2472250" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu.net.uoguelph.ca with ESMTP; 28 Nov 2012 19:14:23 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 72483B4023; Wed, 28 Nov 2012 19:14:23 -0500 (EST) Date: Wed, 28 Nov 2012 19:14:23 -0500 (EST) From: Rick Macklem To: Mateusz Guzik Message-ID: <460700956.954956.1354148063432.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20121128122034.GB17871@dft-labs.eu> Subject: Re: svn commit: r243645 - head/usr.sbin/nfsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alfred Perlstein X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 00:14:25 -0000 Mateusz Guzik wrote: > On Wed, Nov 28, 2012 at 02:47:32AM +0000, Alfred Perlstein wrote: > > Author: alfred > > Date: Wed Nov 28 02:47:31 2012 > > New Revision: 243645 > > URL: http://svnweb.freebsd.org/changeset/base/243645 > > > > Log: > > Don't allow minthreads > maxthreads. > > > > Suggested by: rmacklem > > > > Modified: > > head/usr.sbin/nfsd/nfsd.c > > > > Modified: head/usr.sbin/nfsd/nfsd.c > > ============================================================================== > > --- head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:23:59 2012 (r243644) > > +++ head/usr.sbin/nfsd/nfsd.c Wed Nov 28 02:47:31 2012 (r243645) > > @@ -224,6 +224,10 @@ main(int argc, char **argv) > > udpflag = 1; > > argv += optind; > > argc -= optind; > > + if (minthreads_set && maxthreads_set && minthreads > maxthreads) > > + errx(EX_USAGE, > > + "error: minthreads(%d) can't be greater than " > > + "maxthreads(%d)", minthreads, maxthreads); > > > > /* > > * XXX > > Should not this be also checked in the kernel? Looks like nfssvc_nfsd > is > trustful: > [..] > if (args) { > nfsrv_pool->sp_minthreads = args->minthreads; > nfsrv_pool->sp_maxthreads = args->maxthreads; > } else { > nfsrv_pool->sp_minthreads = 4; > nfsrv_pool->sp_maxthreads = 4; > } > [..] > Well, since only root can do this and I can't think of why a sysadmin would use anything other than nfsd, I'm not sure it matters much? (But I don't see a problem with adding a sanity check in the kernel code.) rick > -- > Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 00:32:04 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F23233CC; Thu, 29 Nov 2012 00:32:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D5BDC8FC14; Thu, 29 Nov 2012 00:32:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT0W3qF059974; Thu, 29 Nov 2012 00:32:03 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT0W3qc059972; Thu, 29 Nov 2012 00:32:03 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211290032.qAT0W3qc059972@svn.freebsd.org> From: Eitan Adler Date: Thu, 29 Nov 2012 00:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243663 - in head/sys/dev/usb: . serial X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 00:32:04 -0000 Author: eadler Date: Thu Nov 29 00:32:03 2012 New Revision: 243663 URL: http://svnweb.freebsd.org/changeset/base/243663 Log: Add support for AT&T Sierra Wireless USB 3G adapter PR: kern/173982 Submitted by: Eric Camachat Approved by: cperciva (implicit) MFC after: 1 week Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Wed Nov 28 22:04:18 2012 (r243662) +++ head/sys/dev/usb/serial/u3g.c Thu Nov 29 00:32:03 2012 (r243663) @@ -213,6 +213,7 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(ACERP, H10, 0), U3G_DEV(AIRPLUS, MCD650, 0), U3G_DEV(AIRPRIME, PC5220, 0), + U3G_DEV(AIRPRIME, AC313U, 0), U3G_DEV(ALINK, 3G, 0), U3G_DEV(ALINK, 3GU, 0), U3G_DEV(ALINK, DWM652U5, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Wed Nov 28 22:04:18 2012 (r243662) +++ head/sys/dev/usb/usbdevs Thu Nov 29 00:32:03 2012 (r243663) @@ -943,6 +943,7 @@ product AIRPLUS MCD650 0x3198 MCD650 mo /* AirPrime products */ product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card product AIRPRIME USB308 0x68A3 USB308 HSPA+ USB Modem +product AIRPRIME AC313U 0x68aa Sierra Wireless AirCard 313U /* AirTies products */ product AIRTIES RT3070 0x2310 RT3070 From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 00:35:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A27966C; Thu, 29 Nov 2012 00:35:16 +0000 (UTC) (envelope-from vijju.singh@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5FF448FC0C; Thu, 29 Nov 2012 00:35:15 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c13so9794071eek.13 for ; Wed, 28 Nov 2012 16:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/rKuLrzQHIkAlKfwvAEmBrXTwQX11/KR3z2D8NX7s5s=; b=r9qwxb0zyiF0PXntJMTWenV/F6Y6iYOM78HKfJf3Z/vmnujQwZP0SxY+tyFsFR4ENt mr5K3lhK9ZpY0S7r50YXVbhb6lV4rfU/1TuzV3yZiEle7RmdR0SwI9FUM8r0T10cnRrS 0yJwnAyI5mi9C/0DA+gnJWPbUmAGhFKIYlI1tZBMSpSr7Z2PS91A8Ru4RSAp+vc/wAdf ZbpCeTe8MSUuNXDfGHA243YFFY9RfUwJ7DQKzSHK7WfTA1ayBtaSp3BCnEUBjDBdSTJE Cp1yegL+RIpLlt3PEEYVs/JMDupyMV2frRyKQThzzzYWQdRjNKDF91CmBwhWnDohYIhO eUmg== MIME-Version: 1.0 Received: by 10.14.205.198 with SMTP id j46mr75778483eeo.27.1354149314061; Wed, 28 Nov 2012 16:35:14 -0800 (PST) Received: by 10.14.3.133 with HTTP; Wed, 28 Nov 2012 16:35:13 -0800 (PST) In-Reply-To: <50B5C4F1.1020002@freebsd.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> Date: Wed, 28 Nov 2012 16:35:13 -0800 Message-ID: Subject: Re: svn commit: r243627 - head/sys/kern From: Vijay Singh To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Robert N. M. Watson" , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 00:35:16 -0000 > a sign of poor prior testing and too much trust into the submitter of > the patch it wasn't an earth shattering event. Doesn't distract from Andre, I am really quite disappointed to read this from you. The patch I sent you was fine, and has been well tested here. You modified it and made the error. If you wish, I can attach the mail I sent with the patch. -vijay From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 00:39:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C59747FE; Thu, 29 Nov 2012 00:39:06 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id B4F188FC08; Thu, 29 Nov 2012 00:39:05 +0000 (UTC) Received: by mail-wg0-f50.google.com with SMTP id 12so1910350wgh.31 for ; Wed, 28 Nov 2012 16:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=moew9CWavpDAZ+8fRZU/C3//+P+aKt5SW9CXYJhJ0WI=; b=UwAtodlCZf8cOJoOtv9FwxsssfHVN+OP3yMbRjtDu0SHUDXy7V8j8QXRi0Ini/cRGa qJdM55pNNcM5S/ZXbfb4ATw5vcXdZJSyNxxXJULeM5POHTs9np970SU2WlqLChsuigaK pUr/aTHlQc/DOWyprkZwMFvnaxqaPHAgHJI8D71iCvMqkXT6nc+UvN5rU0Ac9jxbrHNi 1MkHuUiNIE41YnjxrgOXC7it+i+09Fa3Hx0P3tYNeWX0U+LMJ0uP50N3pp7BVeEFGDGH Wqw1i4zD7Xn1Sdm4W4ztun28JaBpF9ZRkesIaepomFHbd6EhcqQsRF2ps/S8KWynSF9R SP7g== Received: by 10.216.209.130 with SMTP id s2mr8658303weo.86.1354149544517; Wed, 28 Nov 2012 16:39:04 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id d9sm9475242wiw.0.2012.11.28.16.39.02 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 16:39:03 -0800 (PST) Date: Thu, 29 Nov 2012 01:38:53 +0100 From: Mateusz Guzik To: Rick Macklem Subject: Re: svn commit: r243645 - head/usr.sbin/nfsd Message-ID: <20121129003853.GB22327@dft-labs.eu> References: <20121128122034.GB17871@dft-labs.eu> <460700956.954956.1354148063432.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <460700956.954956.1354148063432.JavaMail.root@erie.cs.uoguelph.ca> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alfred Perlstein X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 00:39:06 -0000 On Wed, Nov 28, 2012 at 07:14:23PM -0500, Rick Macklem wrote: > Mateusz Guzik wrote: > > On Wed, Nov 28, 2012 at 02:47:32AM +0000, Alfred Perlstein wrote: > > > Author: alfred > > > Date: Wed Nov 28 02:47:31 2012 > > > New Revision: 243645 > > > URL: http://svnweb.freebsd.org/changeset/base/243645 > > > > > > Log: > > > Don't allow minthreads > maxthreads. > > > > > Should not this be also checked in the kernel? Looks like nfssvc_nfsd > > is > > trustful: > > > Well, since only root can do this and I can't think of why a sysadmin > would use anything other than nfsd, I'm not sure it matters much? > (But I don't see a problem with adding a sanity check in the kernel code.) > It's nothing serious and I'm not going to insist, especially since this is your code. I just prefer the kernel to be resistant if it does not cost much. I had something like this in mind (untested): http://people.freebsd.org/~mjg/patches/nfs-threads-check.diff -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 01:00:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2E7AB9C; Thu, 29 Nov 2012 01:00:36 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (cl-414.sto-01.se.sixxs.net [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 5CB038FC08; Thu, 29 Nov 2012 01:00:36 +0000 (UTC) Received: from freebsd (unknown [72.5.114.2]) by mx0.deglitch.com (Postfix) with ESMTPA id 291818FC36; Thu, 29 Nov 2012 05:00:32 +0400 (MSK) Date: Wed, 28 Nov 2012 17:00:32 -0800 From: Stanislav Sedov To: Eitan Adler Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-Id: <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> In-Reply-To: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 01:00:36 -0000 On Mon, 26 Nov 2012 05:11:07 +0000 (UTC) Eitan Adler mentioned: > Author: eadler > Date: Mon Nov 26 05:11:07 2012 > New Revision: 243554 > URL: http://svnweb.freebsd.org/changeset/base/243554 > > Log: > Provide an option to users to shoot themselves in the foot. > This should probably be a default behavior. It's not good when all these warnings pop up everywhere just because local.sqlite file is present. -- Stanislav Sedov ST4096-RIPE () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 02:04:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C9F7F64B for ; Thu, 29 Nov 2012 02:04:30 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0278FC13 for ; Thu, 29 Nov 2012 02:04:29 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so11144679lbb.13 for ; Wed, 28 Nov 2012 18:04:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=Cb/TeAk5VGpkAyl+lHQLLbrFyJNI6mG7nksCNbUj9O8=; b=ukENIs17LuEjZCP4iyHTysdAJFjLc39ieNep5h6xcjGGuaebArkhtbi4RJ36FzYAKp r5i0PvlPYkTOiFRBv1dZ3SIhF5MPvcAuNl5+yAyw1ynS89B+XwAsCngQtzYqpAFlXIGP UbQrI1m8BlWKRbPFytQpIWXZIkrXNog4pPJBA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=Cb/TeAk5VGpkAyl+lHQLLbrFyJNI6mG7nksCNbUj9O8=; b=NMmG1vXYT3U7loXwKdejUKl4IvL0GjEY4DvzgYpoS3oRA0DV//3jjz/NBduQQAhIRQ RlRB19WGsMsQKQQ4iOI7pjcsSLXx7fM1p1sIYc7wJcUrCVbMN5dn8Epk1IuOpxq8WLH5 NGDhnPaqnBJNH6MCz/YCKePQvTwRbmZvRU7Vgrt/v+bksDt4ju4wQIJ3QDsZ9NSGeekP R33MiVgu2e1HFkWp2p4MAmZzvg8vR+1fdPhgnEKsNfN5umpiidrZrlpcx5wcp+jt+5En oO9AI10uwBlXNZ9nrSW+aqDn7Z+OOk3/HB1VDLkaaT4xZa2GSL4RGiuPhg5yD6oJdovy 4vyg== Received: by 10.112.38.103 with SMTP id f7mr5655849lbk.120.1354154668610; Wed, 28 Nov 2012 18:04:28 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Wed, 28 Nov 2012 18:03:58 -0800 (PST) In-Reply-To: <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> From: Eitan Adler Date: Wed, 28 Nov 2012 21:03:58 -0500 X-Google-Sender-Auth: nIQTHxx9n7emBtSmrKMWogG8MSg Message-ID: Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version To: Stanislav Sedov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnG/mgUWmJiiIosdz6GejFyIecOL5llfdhJekjU25Pj4RxfBqoRL0wtKqJxjA7ixDmg3ykZ Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 02:04:30 -0000 On 28 November 2012 20:00, Stanislav Sedov wrote: > On Mon, 26 Nov 2012 05:11:07 +0000 (UTC) > Eitan Adler mentioned: > >> Author: eadler >> Date: Mon Nov 26 05:11:07 2012 >> New Revision: 243554 >> URL: http://svnweb.freebsd.org/changeset/base/243554 >> >> Log: >> Provide an option to users to shoot themselves in the foot. >> > > This should probably be a default behavior. It's not good when all these > warnings pop up everywhere just because local.sqlite file is present. Making the foot shooting behavior default defeats the point. If local.sqlite exists it almost certainly means that you don't want to run the old pkg_ tools. For the few correct uses an opt-out option is provided. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 02:34:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF8F5C0D; Thu, 29 Nov 2012 02:34:27 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [78.110.53.255]) by mx1.freebsd.org (Postfix) with ESMTP id 1070C8FC15; Thu, 29 Nov 2012 02:34:27 +0000 (UTC) Received: from freebsd (unknown [72.5.114.2]) by mx0.deglitch.com (Postfix) with ESMTPA id 9E3BF8FC2B; Thu, 29 Nov 2012 06:34:23 +0400 (MSK) Date: Wed, 28 Nov 2012 18:34:22 -0800 From: Stanislav Sedov To: Eitan Adler Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-Id: <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> In-Reply-To: References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 02:34:28 -0000 On Wed, 28 Nov 2012 21:03:58 -0500 Eitan Adler mentioned: > On 28 November 2012 20:00, Stanislav Sedov wrote: > > On Mon, 26 Nov 2012 05:11:07 +0000 (UTC) > > Eitan Adler mentioned: > > > >> Author: eadler > >> Date: Mon Nov 26 05:11:07 2012 > >> New Revision: 243554 > >> URL: http://svnweb.freebsd.org/changeset/base/243554 > >> > >> Log: > >> Provide an option to users to shoot themselves in the foot. > >> > > > > This should probably be a default behavior. It's not good when all these > > warnings pop up everywhere just because local.sqlite file is present. > > Making the foot shooting behavior default defeats the point. > If local.sqlite exists it almost certainly means that you don't want > to run the old pkg_ tools. > For the few correct uses an opt-out option is provided. > Well, it's not entirely true. I did end up with local.sqlite because I stepped on the landmine of portmgr-pkg becoming the default for some reason. So I did end up with half of my packages being in the pkgng sqlite database, and half in standard /var/db/pkg. I had to convert them back to standard format by hand, but I still have the sqlite database just in case. I guess if you really want to prevent a foot-shooting, you should add a message to pkgng sayng in all caps e.g. "You are running experimental package manager and there's no migration plan from pkgng to old pkg exists." and maybe ask for confirmation. I don't really see how this message being in pkg_ tools helps to prevent a possible foot-shooting at all. At very least, it makes sense to make it conditional on WITH_PKGNG, so this code does not end up compiled in if PKGNG is disabled in src.conf. -- Stanislav Sedov ST4096-RIPE () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 02:49:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D85DEE8 for ; Thu, 29 Nov 2012 02:49:48 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B26C8FC08 for ; Thu, 29 Nov 2012 02:49:47 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so11169091lbb.13 for ; Wed, 28 Nov 2012 18:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=OM6+Nw0d9vdPEeLg+mezkTEkFOtkjTi/hcgTAEjFomM=; b=T+HsQciv9BU/CbCZWzQpT0dKlxVWH1FvJBUzbfNaZzOK1Jjm5DEOCQlbKVOZGAIJ2D 1OoP1ZZMdvxLAeu1dFFo5Cnv2Bae95hMXK4OL0Fpeq1OBKRXDeRN/oQc3HZYwmi/hjbh RlZsMd/4QeYmSCU6I7wDdm2yzq08sVAToB2N8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=OM6+Nw0d9vdPEeLg+mezkTEkFOtkjTi/hcgTAEjFomM=; b=n8yKWnLosU17PQq7uOQAhd5BX6vmuCIQXr6Y1IcRABo++87w7EPnqkS9ie51I6GvbG 9lKYwLRrUB4m51BTxDGn2EsVojmHq4w408bh3eNZohG180pRKjCMOL4q0lFFkHxx7JL9 VugfrPzCHs3kpPJ5bI/zVTCI8QpLsOzgnctIx6qn9EIQj6v20QBi2oujbB7UwqMo+keu ZRJTETKk1fcpi+vFCCRDUdGIcxJHkO2rSDzPI6kw1f25RSFntI3USrISlo8zsiuhVbY+ tWk+KJ3nj1LUXGyiyUAgUWfdOQXVUbcxz8aYhPpP0kwl++cDX1R7rYf90iCPh32Qhkxp 7EJA== Received: by 10.112.103.135 with SMTP id fw7mr4182156lbb.17.1354157386591; Wed, 28 Nov 2012 18:49:46 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Wed, 28 Nov 2012 18:49:15 -0800 (PST) In-Reply-To: <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> From: Eitan Adler Date: Wed, 28 Nov 2012 21:49:15 -0500 X-Google-Sender-Auth: vG7KSl0E-pOx1DO1jUGGp4pMLrw Message-ID: Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version To: Stanislav Sedov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQm8S6eT9OjvnxI6JEPvlN83A/88hkw/nSZNa4V3P51zFhZ+klSx+A6aGwVSF6oKz6W8vjCL Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 02:49:49 -0000 On 28 November 2012 21:34, Stanislav Sedov wrote: > Well, it's not entirely true. I did end up with local.sqlite because I > stepped on the landmine of portmgr-pkg becoming the default for some > reason. So I did end up with half of my packages being in the pkgng > sqlite database, and half in standard /var/db/pkg. How did this happen without running pkg2ng ? > I had to convert > them back to standard format by hand, but I still have the sqlite database > just in case. This is a rare case and exactly the use case for the environment variable. Perhaps you could also just rename the file. > I guess if you really want to prevent a foot-shooting, you should add > a message to pkgng sayng in all caps e.g. "You are running experimental > package manager and there's no migration plan from pkgng to old pkg > exists." and maybe ask for confirmation. pkg is not maintained by FreeBSD so I couldn't add this if I wanted to ;) > I don't really see how this > message being in pkg_ tools helps to prevent a possible foot-shooting > at all. It reminds people that using the pkg_* tools once a conversion is done is wrong. > At very least, it makes sense to make it conditional on WITH_PKGNG, so this > code does not end up compiled in if PKGNG is disabled in src.conf. Interesting idea. Maybe I shall do this. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 03:48:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 21F8E903; Thu, 29 Nov 2012 03:48:40 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E06CA8FC08; Thu, 29 Nov 2012 03:48:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT3md2u086795; Thu, 29 Nov 2012 03:48:39 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT3mdRB086793; Thu, 29 Nov 2012 03:48:39 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201211290348.qAT3mdRB086793@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 29 Nov 2012 03:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243664 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 03:48:40 -0000 Author: marcel Date: Thu Nov 29 03:48:39 2012 New Revision: 243664 URL: http://svnweb.freebsd.org/changeset/base/243664 Log: Fix LINT build for arm: NOTES defines LDFLAGS by way of a make option but LDFLAGS is not (yet) passed on to the linker (via SYSTEM_LD et al). Do so now. As such, any kernel configuration can now define linker flags by setting LDFLAGS as normal and not have to revert to hacks like setting DEBUG for flags that do not relate to debugging (see sys/powerpc/conf/MPC85XX). Modified: head/sys/conf/Makefile.arm head/sys/conf/kern.pre.mk Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Thu Nov 29 00:32:03 2012 (r243663) +++ head/sys/conf/Makefile.arm Thu Nov 29 03:48:39 2012 (r243664) @@ -43,7 +43,7 @@ STRIP_FLAGS = -S CFLAGS += -mno-apcs-frame .endif -SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \ +SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${LDFLAGS} \ -warn-common -export-dynamic -dynamic-linker /red/herring -o \ ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\ Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Thu Nov 29 00:32:03 2012 (r243663) +++ head/sys/conf/kern.pre.mk Thu Nov 29 03:48:39 2012 (r243664) @@ -167,7 +167,7 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJS} SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS} SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o} SYSTEM_OBJS+= hack.So -SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} --no-warn-mismatch \ +SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} ${LDFLAGS} --no-warn-mismatch \ -warn-common -export-dynamic -dynamic-linker /red/herring \ -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \ From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 03:49:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4EF89B1C; Thu, 29 Nov 2012 03:49:50 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id EC6568FC0C; Thu, 29 Nov 2012 03:49:49 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id wz12so10496069pbc.13 for ; Wed, 28 Nov 2012 19:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date :to; bh=qiLaJtSoc//JPSWh0uDp9bg5LtBA/TXf8isr1HBdeWo=; b=fRXjbca57Os6t29uxrH0bDtpsOfzcKct5VXPyn+Dq2KIE2wa+GZARm26uhfoMHtkCj /QtrHnV5tUm2OVokxgEbJQvydhgalSV5pIimLkOiYRwORWC5kuh2sOulLLpjropSsymQ Bw4zGHPC4jEgji4o4iM6tI+radbfqNUbju9ZLZDrmvpBH2f/ZK4mQHJQivh3K3CwWEiA 93WnW8iw2kcq7OmT3qxNnolHvVcSTjlxVKK5OVQ4bMjWqX4gstE1PRSP873Ed19yDHDL iCEAT5AS7nVmMbDGQqK2nhfOJgjDNvPQAFU91yXoCMwZwa0trBEnPgvpCH7wCKGIBK4M Cm0A== Received: by 10.68.247.39 with SMTP id yb7mr65431088pbc.15.1354160988265; Wed, 28 Nov 2012 19:49:48 -0800 (PST) Received: from [10.11.216.81] (mobile-166-147-095-130.mycingular.net. [166.147.95.130]) by mx.google.com with ESMTPS id o7sm296629pax.31.2012.11.28.19.49.45 (version=SSLv3 cipher=OTHER); Wed, 28 Nov 2012 19:49:47 -0800 (PST) References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> Mime-Version: 1.0 (1.0) In-Reply-To: <50B64C43.50001@mu.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: X-Mailer: iPhone Mail (10A523) From: Garrett Cooper Subject: Reviewing before commit and stability minibikeshed (Re: svn commit: r243627 - head/sys/kern) Date: Wed, 28 Nov 2012 19:49:40 -0800 To: Alfred Perlstein Cc: "src-committers@freebsd.org" , Andre Oppermann , Peter Wemm , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 03:49:50 -0000 On Nov 28, 2012, at 9:39 AM, Alfred Perlstein wrote: > On 11/28/12 12:01 AM, Andre Oppermann wrote: >> On 28.11.2012 00:59, Robert N. M. Watson wrote: >>>=20 >>> On 27 Nov 2012, at 23:29, Andre Oppermann wrote: >>>=20 >>>>>>>>> Andre.. this breaks incoming connections. TCP is immediately rese= t and never even gets to the >>>>>>>>> listener process. You need to back out of fix this urgently pleas= e. >>>>>>>>=20 >>>>>>>> I just found out and fixed it. Sorry for the breakage. >>>>>>>=20 >>>>>>> I'd like to see a much more thorough use of "Reviewed by:" in socket= and TCP-related commits -- this >>>>>>> is very sensitive code, and a second pair of eyes is always valuable= . Post-commit review is not a >>>>>>> substitute. Looking back over similar changes in the socket code ov= er the last two years, I see >>>>>>> that almost all have reviewers, so I think it would be reasonable to= consider it mandatory for these >>>>>>> subsystems at this point. The good news is that we have lots of peo= ple with expertise in it. >>>>>>=20 >>>>>> Good to see you becoming more active again. :-) And yes, >>>>>> you have a point there. >>>>>=20 >>>>> Yes -- this is only about three weeks old, however; for the prior six-= twelve months, I've been fairly non-existent in FreeBSD-land due to outside o= bligations :-). >>>>=20 >>>> Just saw that I did indeed send you a review request three weeks ago. ;= -) >>>> At the end of a rather long email though. >>>=20 >>> Yes, indeed -- no patch was attached, and it followed quite a long e-mai= l on your plans to rewrite the TCP stack. I'm afraid that went onto the "rea= d this later as time permits" pile as I was at a conference, rather than the= fast-path "oh, quickly review this patch" pile. However, simply committing t= he patch rather than trying a bit harder to find a reviewer isn't the right a= nswer either. To maximise the likelihood of a review, construct an e-mail wi= th a subject line like "Review request: (patch description)", attach the pat= ch, and include a proposed commit message. >>=20 >> Yes, and I didn't really expect you to answer (at least quickly) during >> your FreeBSD hiatus. So it was seeking review by chance. >>=20 >> Alas I found and fixed the bug myself within 2.5hrs. While not optimal, >> a sign of poor prior testing and too much trust into the submitter of >> the patch it wasn't an earth shattering event. Doesn't distract from >> the fact that it was mea culpa in any case though. >>=20 >> For prior review of kern_socket* and netinet/tcp_* related changes it has= >> been on and off by various committers over the past year. If we do have >> a policy of prior review required then it should be made official and >> codified in MAINTAINERS and universally applied to all. > Personally I don't think we need any more anchors attached to people's fee= t when developing FreeBSD. >=20 > Mistakes will happen, they will happen in head. Slowing down the process t= o eliminate mistakes only works to slow down change and give a false sense o= f "fixing stability" when in fact the only thing "stable" is the slowness of= submitting code. Organizing cabals of people to review code is the best way to go. It's an ex= tension of the maintainers concept applied in a better fashion because it en= courages several developers to provide input on a series of commits instead o= f one. I know it's sort of done in some groups [based on commit messages], but it w= ould be nice to have it better formalized and socialized as well. Things lik= e this are helpful for other potential freebsd contributors/developers (like= some folks I work with for instance!). An extension of this code review idea would probably be reviewboard. Email b= ased review is doable and a lot of OSS groups use it, but there are some nic= e points to using a more advanced tool, in particular: 1. Colorized diffs. 2. Various diff niceties (hide white space changes, etc). 3. It does a reasonable job at establishing code context (code block A has m= oved to B). There are 2 FreeBSD corporate consumers that use it, with at least one other= group considering it, and there are probably more groups that using it as w= ell. Plus it integrates well with p4, and does pretty well with git and svn.= Thanks! -Garrett= From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 04:17:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B436A7; Thu, 29 Nov 2012 04:17:40 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 405718FC08; Thu, 29 Nov 2012 04:17:40 +0000 (UTC) Received: from Alfreds-MacBook-Pro-5.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 8E5CB1A3D17; Wed, 28 Nov 2012 20:17:34 -0800 (PST) Message-ID: <50B6E1DD.2030908@mu.org> Date: Wed, 28 Nov 2012 20:17:33 -0800 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Garrett Cooper Subject: Re: Reviewing before commit and stability minibikeshed (Re: svn commit: r243627 - head/sys/kern) References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "src-committers@freebsd.org" , Andre Oppermann , Peter Wemm , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 04:17:40 -0000 On 11/28/12 7:49 PM, Garrett Cooper wrote: > On Nov 28, 2012, at 9:39 AM, Alfred Perlstein wrote: > >> On 11/28/12 12:01 AM, Andre Oppermann wrote: >>> On 28.11.2012 00:59, Robert N. M. Watson wrote: >>>> On 27 Nov 2012, at 23:29, Andre Oppermann wrote: >>>> >>>>>>>>>> Andre.. this breaks incoming connections. TCP is immediately reset and never even gets to the >>>>>>>>>> listener process. You need to back out of fix this urgently please. >>>>>>>>> I just found out and fixed it. Sorry for the breakage. >>>>>>>> I'd like to see a much more thorough use of "Reviewed by:" in socket and TCP-related commits -- this >>>>>>>> is very sensitive code, and a second pair of eyes is always valuable. Post-commit review is not a >>>>>>>> substitute. Looking back over similar changes in the socket code over the last two years, I see >>>>>>>> that almost all have reviewers, so I think it would be reasonable to consider it mandatory for these >>>>>>>> subsystems at this point. The good news is that we have lots of people with expertise in it. >>>>>>> Good to see you becoming more active again. :-) And yes, >>>>>>> you have a point there. >>>>>> Yes -- this is only about three weeks old, however; for the prior six-twelve months, I've been fairly non-existent in FreeBSD-land due to outside obligations :-). >>>>> Just saw that I did indeed send you a review request three weeks ago. ;-) >>>>> At the end of a rather long email though. >>>> Yes, indeed -- no patch was attached, and it followed quite a long e-mail on your plans to rewrite the TCP stack. I'm afraid that went onto the "read this later as time permits" pile as I was at a conference, rather than the fast-path "oh, quickly review this patch" pile. However, simply committing the patch rather than trying a bit harder to find a reviewer isn't the right answer either. To maximise the likelihood of a review, construct an e-mail with a subject line like "Review request: (patch description)", attach the patch, and include a proposed commit message. >>> Yes, and I didn't really expect you to answer (at least quickly) during >>> your FreeBSD hiatus. So it was seeking review by chance. >>> >>> Alas I found and fixed the bug myself within 2.5hrs. While not optimal, >>> a sign of poor prior testing and too much trust into the submitter of >>> the patch it wasn't an earth shattering event. Doesn't distract from >>> the fact that it was mea culpa in any case though. >>> >>> For prior review of kern_socket* and netinet/tcp_* related changes it has >>> been on and off by various committers over the past year. If we do have >>> a policy of prior review required then it should be made official and >>> codified in MAINTAINERS and universally applied to all. >> Personally I don't think we need any more anchors attached to people's feet when developing FreeBSD. >> >> Mistakes will happen, they will happen in head. Slowing down the process to eliminate mistakes only works to slow down change and give a false sense of "fixing stability" when in fact the only thing "stable" is the slowness of submitting code. > Organizing cabals of people to review code is the best way to go. It's an extension of the maintainers concept applied in a better fashion because it encourages several developers to provide input on a series of commits instead of one. > > I know it's sort of done in some groups [based on commit messages], but it would be nice to have it better formalized and socialized as well. Things like this are helpful for other potential freebsd contributors/developers (like some folks I work with for instance!). > > An extension of this code review idea would probably be reviewboard. Email based review is doable and a lot of OSS groups use it, but there are some nice points to using a more advanced tool, in particular: > 1. Colorized diffs. > 2. Various diff niceties (hide white space changes, etc). > 3. It does a reasonable job at establishing code context (code block A has moved to B). > > There are 2 FreeBSD corporate consumers that use it, with at least one other group considering it, and there are probably more groups that using it as well. Plus it integrates well with p4, and does pretty well with git and svn. > > I've seen what happens with large groups, it doesn't scale and basically you wind up with the following type of reviewers: 1) whitespace nazis 2) rubber stampers 3) forever absentee reviewers 4) name nazis The whitespace nazis will never give review approval until you've gone through 600 iterations of the code. Imagine Bruce... but if he wasn't pragmatic and awesome and didn't have other amazing skills. The rubber stampers are friends or people that feel bad about what's happening to you by the whitespace nazis and name nazis so they just glance and approve based on the fact that you're a good guy who has committed to the same place before and usually doesn't break stuff. The forever absentee reviewers are the ones that sign up to review, but never are around to review, or just don't have the time. Eventually an entire subsystem becomes "owned" by absentee reviewers and then it's a huge, delicate and annoying process to get that part of the code under some other list or remove the absentee people. Finally the name nazis, these will debate you on if your code should be of the name kern_foo.c, subr_foo.c or maybe in the new-name-ng should actually be called kernel_subr_foo.c, but whatever you name something, they will make you change it, because you are wrong. Anyhow, that is my opinion on heavy handed reviews in a large project. I've been fortunate enough to work on one project where luckily it was dominated by rubber stampers, that was silly but awesome because at least we could get stuff done... Unfortunately I then worked on quite a few dominated by a mix of all the four I mentioned. The result sucked. -Alfred From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 05:16:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9CB3881D; Thu, 29 Nov 2012 05:16:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 81BE88FC0C; Thu, 29 Nov 2012 05:16:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT5GoR8098710; Thu, 29 Nov 2012 05:16:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT5GoT5098709; Thu, 29 Nov 2012 05:16:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211290516.qAT5GoT5098709@svn.freebsd.org> From: Eitan Adler Date: Thu, 29 Nov 2012 05:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243665 - head/sbin/dump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 05:16:50 -0000 Author: eadler Date: Thu Nov 29 05:16:50 2012 New Revision: 243665 URL: http://svnweb.freebsd.org/changeset/base/243665 Log: Mark non-returning function as such PR: bin/172978 Approved by: cperciva MFC after: 3 days Modified: head/sbin/dump/dump.h Modified: head/sbin/dump/dump.h ============================================================================== --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) @@ -121,7 +121,7 @@ void trewind(void); void writerec(char *dp, int isspcl); void Exit(int status) __dead2; -void dumpabort(int signo); +void dumpabort(int signo) __dead2; void dump_getfstab(void); char *rawname(char *cp); From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 05:46:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CF17C60; Thu, 29 Nov 2012 05:46:47 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F3AE48FC0C; Thu, 29 Nov 2012 05:46:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT5kkNn002560; Thu, 29 Nov 2012 05:46:46 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT5kkZx002559; Thu, 29 Nov 2012 05:46:46 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211290546.qAT5kkZx002559@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 29 Nov 2012 05:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243666 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 05:46:47 -0000 Author: gonzo Date: Thu Nov 29 05:46:46 2012 New Revision: 243666 URL: http://svnweb.freebsd.org/changeset/base/243666 Log: Fix hardcoded bpp value Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Thu Nov 29 05:16:50 2012 (r243665) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Thu Nov 29 05:46:46 2012 (r243666) @@ -751,7 +751,7 @@ bcmfb_putc(video_adapter_t *adp, vm_offs p = sc->font + c*BCMFB_FONT_HEIGHT; addr = (uint8_t *)sc->fb_addr + (row + sc->ymargin)*(sc->stride) - + 3 * (col + sc->xmargin); + + (sc->depth/8) * (col + sc->xmargin); fg = a & 0xf ; bg = (a >> 8) & 0xf; From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:05:13 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9C12C7D4; Thu, 29 Nov 2012 07:05:13 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from exprod7og108.obsmtp.com (exprod7og108.obsmtp.com [64.18.2.169]) by mx1.freebsd.org (Postfix) with ESMTP id 0554B8FC0C; Thu, 29 Nov 2012 07:05:09 +0000 (UTC) Received: from P-EMHUB03-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by exprod7ob108.postini.com ([64.18.6.12]) with SMTP ID DSNKULcJJDMRa77b0Wqe+tbHYfoyBH3i4MFD@postini.com; Wed, 28 Nov 2012 23:05:13 PST Received: from magenta.juniper.net (172.17.27.123) by P-EMHUB03-HQ.jnpr.net (172.24.192.33) with Microsoft SMTP Server (TLS) id 8.3.213.0; Wed, 28 Nov 2012 23:02:35 -0800 Received: from chaos.jnpr.net (chaos.jnpr.net [172.24.29.229]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id qAT72Y324267; Wed, 28 Nov 2012 23:02:34 -0800 (PST) (envelope-from sjg@juniper.net) Received: from chaos.jnpr.net (localhost [127.0.0.1]) by chaos.jnpr.net (Postfix) with ESMTP id 9C68458094; Wed, 28 Nov 2012 23:02:34 -0800 (PST) To: Alfred Perlstein Subject: Re: Reviewing before commit and stability minibikeshed (Re: svn commit: r243627 - head/sys/kern) In-Reply-To: <50B6E1DD.2030908@mu.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <50B6E1DD.2030908@mu.org> Comments: In-reply-to: Alfred Perlstein message dated "Wed, 28 Nov 2012 20:17:33 -0800." From: "Simon J. Gerraty" X-Mailer: MH-E 7.82+cvs; nmh 1.3; GNU Emacs 22.3.1 Date: Wed, 28 Nov 2012 23:02:34 -0800 Message-ID: <20121129070234.9C68458094@chaos.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain Cc: "src-committers@freebsd.org" , Andre Oppermann , Peter Wemm , Garrett Cooper , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:05:13 -0000 >On 11/28/12 7:49 PM, Garrett Cooper wrote: >> I know it's sort of done in some groups [based on commit messages], but it w >ould be nice to have it better formalized and socialized as well. Things like Trying to get too formalized could be counter productive. >> An extension of this code review idea would probably be reviewboard. Email b >ased review is doable and a lot of OSS groups use it, but there are some nice >points to using a more advanced tool, in particular: >> 1. Colorized diffs. FWIW all the Colorized tools I've seen just hurt my eyes. On Wed, 28 Nov 2012 20:17:33 -0800, Alfred Perlstein writes: >I've seen what happens with large groups, it doesn't scale and basically >you wind up with the following type of reviewers: The issues you cite, are the result of taking a good idea too far. Mandating reviews for all changes - does not make sense, and all the ills you describe are natural consequences. But AFAIK that wasn't what Robert was talking about. Some bits of code do warrant extra care when touching. Unless you are the sole author and maintainer (and sometimes even then) getting a 2nd opinion (from someone familiar with the code) makes sense. That does not have to map to a requirement for formal reviewers, review tracking etc - none of which would scale in a volunteer organization anyway. From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:24:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C3517DC6 for ; Thu, 29 Nov 2012 07:24:00 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 214088FC12 for ; Thu, 29 Nov 2012 07:23:59 +0000 (UTC) Received: (qmail 48575 invoked from network); 29 Nov 2012 08:55:19 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 29 Nov 2012 08:55:19 -0000 Message-ID: <50B70D81.5090000@freebsd.org> Date: Thu, 29 Nov 2012 08:23:45 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Vijay Singh Subject: Re: svn commit: r243627 - head/sys/kern References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Robert N. M. Watson" , Peter Wemm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:24:00 -0000 On 29.11.2012 01:35, Vijay Singh wrote: >> a sign of poor prior testing and too much trust into the submitter of >> the patch it wasn't an earth shattering event. Doesn't distract from > > Andre, I am really quite disappointed to read this from you. The patch > I sent you was fine, and has been well tested here. You modified it > and made the error. If you wish, I can attach the mail I sent with the > patch. Vijay, Your original patch indeed was correct wrt. testing against the head pointer. On Nov. 2 I sent you my (wrongly) modified patch for review and testing. On Nov. 5 you replied that is looks good to you. There is no doubt that I screwed up about everything else on this patch but I did send it for review and you didn't catch the mistake I made. -- Andre From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:30:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FBA2F8B; Thu, 29 Nov 2012 07:30:43 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2C2578FC0C; Thu, 29 Nov 2012 07:30:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT7UhLX016747; Thu, 29 Nov 2012 07:30:43 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT7Uhkv016745; Thu, 29 Nov 2012 07:30:43 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201211290730.qAT7Uhkv016745@svn.freebsd.org> From: Andre Oppermann Date: Thu, 29 Nov 2012 07:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243668 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:30:43 -0000 Author: andre Date: Thu Nov 29 07:30:42 2012 New Revision: 243668 URL: http://svnweb.freebsd.org/changeset/base/243668 Log: Using a long is the wrong type to represent the realmem and maxmbufmem variable as they may overflow on i386/PAE and i386 with > 2GB RAM. Use 64bit quad_t instead. It has broader kernel infrastructure support with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types. Pointed out by: alc, bde Modified: head/sys/kern/subr_param.c head/sys/sys/mbuf.h Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Thu Nov 29 06:26:42 2012 (r243667) +++ head/sys/kern/subr_param.c Thu Nov 29 07:30:42 2012 (r243668) @@ -93,7 +93,7 @@ int ncallout; /* maximum # of timer ev int nbuf; int ngroups_max; /* max # groups per process */ int nswbuf; -long maxmbufmem; /* max mbuf memory */ +quad_t maxmbufmem; /* max mbuf memory */ pid_t pid_max = PID_MAX; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ @@ -271,7 +271,7 @@ init_param1(void) void init_param2(long physpages) { - long realmem; + quad_t realmem; /* Base parameters */ maxusers = MAXUSERS; @@ -332,10 +332,10 @@ init_param2(long physpages) * available kernel memory (physical or kmem). * At most it can be 3/4 of available kernel memory. */ - realmem = lmin(physpages * PAGE_SIZE, + realmem = qmin(physpages * PAGE_SIZE, VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); maxmbufmem = realmem / 2; - TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem); + TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem); if (maxmbufmem > (realmem / 4) * 3) maxmbufmem = (realmem / 4) * 3; Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Nov 29 06:26:42 2012 (r243667) +++ head/sys/sys/mbuf.h Thu Nov 29 07:30:42 2012 (r243668) @@ -395,7 +395,7 @@ struct mbstat { * * The rest of it is defined in kern/kern_mbuf.c */ -extern long maxmbufmem; +extern quad_t maxmbufmem; extern uma_zone_t zone_mbuf; extern uma_zone_t zone_clust; extern uma_zone_t zone_pack; From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:38:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E15327E; Thu, 29 Nov 2012 07:38:52 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id D59818FC0C; Thu, 29 Nov 2012 07:38:50 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id a14so5039769eaa.13 for ; Wed, 28 Nov 2012 23:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=rZxwGivGaPVIN+gB4LguqbzpwDcl/nzN0nnrKE+9iyA=; b=F4fsxERsz2OkgoKOWTgafKzeMAGMYIfaUhAEcu4JVBbmHnZ97uMWEzTyrm/mw+XmZm qTxmtIF/C44Zn+V+bVnNbI2qgorzWqKMMOkDFpaG525hlr9u1S0FFuXqSwpF9R0V1/0U y5anaqK9ghZmVbM5ByAys+J9zncMBMISDiw+6t8A9NkMdaTxqF3D9UEo3gXJRASdy3yh 4AdESN2n0ArJM6rr187bosiWi8AUmfw6lZCReNmwuckuv2FmuZMEbAc2nsIppzoB0DWL k9Qhzi/3qBfn0GELeD6w2gc19KWYfCJzSeg+U2y6f6htKPDvizoYACUT1zlAScRZz383 sVXQ== Received: by 10.14.178.7 with SMTP id e7mr63276677eem.44.1354174730057; Wed, 28 Nov 2012 23:38:50 -0800 (PST) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPS id e1sm1886601eem.3.2012.11.28.23.38.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 23:38:49 -0800 (PST) Sender: Baptiste Daroussin Date: Thu, 29 Nov 2012 08:38:47 +0100 From: Baptiste Daroussin To: Stanislav Sedov Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-ID: <20121129073846.GG97474@ithaqua.etoilebsd.net> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="S5HS5MvDw4DmbRmb" Content-Disposition: inline In-Reply-To: <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:38:52 -0000 --S5HS5MvDw4DmbRmb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 28, 2012 at 06:34:22PM -0800, Stanislav Sedov wrote: > On Wed, 28 Nov 2012 21:03:58 -0500 > Eitan Adler mentioned: >=20 > > On 28 November 2012 20:00, Stanislav Sedov wrote: > > > On Mon, 26 Nov 2012 05:11:07 +0000 (UTC) > > > Eitan Adler mentioned: > > > > > >> Author: eadler > > >> Date: Mon Nov 26 05:11:07 2012 > > >> New Revision: 243554 > > >> URL: http://svnweb.freebsd.org/changeset/base/243554 > > >> > > >> Log: > > >> Provide an option to users to shoot themselves in the foot. > > >> > > > > > > This should probably be a default behavior. It's not good when all t= hese > > > warnings pop up everywhere just because local.sqlite file is present. > >=20 > > Making the foot shooting behavior default defeats the point. > > If local.sqlite exists it almost certainly means that you don't want > > to run the old pkg_ tools. > > For the few correct uses an opt-out option is provided. > >=20 >=20 > Well, it's not entirely true. I did end up with local.sqlite because I > stepped on the landmine of portmgr-pkg becoming the default for some > reason. So I did end up with half of my packages being in the pkgng > sqlite database, and half in standard /var/db/pkg. I had to convert > them back to standard format by hand, but I still have the sqlite database > just in case. >=20 > I guess if you really want to prevent a foot-shooting, you should add > a message to pkgng sayng in all caps e.g. "You are running experimental > package manager and there's no migration plan from pkgng to old pkg > exists." and maybe ask for confirmation. I don't really see how this > message being in pkg_ tools helps to prevent a possible foot-shooting > at all. pkg is no more experimental at all, it is not perfect there are large rooms= for improvements, but it is perfectly ready to be used, if you have any concern about some missing "feature" just report it; Concerning a landmine, when you have big flashy lights all over the place: http://lists.freebsd.org/pipermail/freebsd-ports-announce/2012-October/0000= 32.html http://lists.freebsd.org/pipermail/freebsd-current/2012-October/037001.html a fanfare playing in front of it saying beware landsmine: http://svnweb.freebsd.org/ports?view=3Drevision&revision=3D305637 and maps available all over the places to explains where the mine are how to workaround them, or be mine proof: http://svnweb.freebsd.org/ports/head/CHANGES (entry 20121010) http://svnweb.freebsd.org/ports/head/UPDATING (entry 20121010) I'd say in that case it is no more considered as a landmine but just a new = safe way. Bapt --S5HS5MvDw4DmbRmb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC3EQYACgkQ8kTtMUmk6EwhjgCfbWItx7QrIoYQL4o5WkiDLK0H l/YAn2+w1YL7Zl5guHYtBdqVFxnKD936 =ucWY -----END PGP SIGNATURE----- --S5HS5MvDw4DmbRmb-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:44:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3E69438; Thu, 29 Nov 2012 07:44:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 9A5358FC12; Thu, 29 Nov 2012 07:44:00 +0000 (UTC) Received: from [192.168.2.119] (host86-146-118-26.range86-146.btcentralplus.com [86.146.118.26]) by cyrus.watson.org (Postfix) with ESMTPSA id 2A0AB46B17; Thu, 29 Nov 2012 02:43:58 -0500 (EST) Subject: Re: Reviewing before commit and stability minibikeshed (Re: svn commit: r243627 - head/sys/kern) Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 From: "Robert N. M. Watson" In-Reply-To: <50B6E1DD.2030908@mu.org> Date: Thu, 29 Nov 2012 07:43:57 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <450D9522-1878-41C7-B1E1-3C5388B5A2A4@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <50B6E1DD.2030908@mu.org> To: Alfred Perlstein X-Mailer: Apple Mail (2.1283) Cc: "src-committers@freebsd.org" , Andre Oppermann , Peter Wemm , Garrett Cooper , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:44:01 -0000 On 29 Nov 2012, at 04:17, Alfred Perlstein wrote: > I've seen what happens with large groups, it doesn't scale and = basically you wind up with the following type of reviewers: I think we have to assume best intent here -- the goal of code review in = complex critical components is not to eliminate creativity, but to = reduce the occurrence of errors and improve the extent to which larger = architectural goals are applied and understood in substantive changes. I = would much rather we agree by consensus that this sort of code requires = mutual code review than chase the "stick" aspect -- as I've said, I feel = strongly that code review applied in the last few years has improved = code quality markedly in this area, and prevented a lot of problems from = being shipped in production kernels. Obviously, you've had some bad = experiences with code review, and I have sympathies -- however, if we = grant commit bits on the basis of not just technical competence and = independence, but also their ability to work well with others, then we = need to trust them to perform code reviews in a mature way. And by "code = review", I'm incorporating the idea of "design review" as well -- some = collaboration throughout development of non-trivial changes (e.g., in a = branch) really does improve not just quality of local areas of code, but = the overall design. Robert >=20 > 1) whitespace nazis > 2) rubber stampers > 3) forever absentee reviewers > 4) name nazis >=20 > The whitespace nazis will never give review approval until you've gone = through 600 iterations of the code. Imagine Bruce... but if he wasn't = pragmatic and awesome and didn't have other amazing skills. >=20 > The rubber stampers are friends or people that feel bad about what's = happening to you by the whitespace nazis and name nazis so they just = glance and approve based on the fact that you're a good guy who has = committed to the same place before and usually doesn't break stuff. >=20 > The forever absentee reviewers are the ones that sign up to review, = but never are around to review, or just don't have the time. Eventually = an entire subsystem becomes "owned" by absentee reviewers and then it's = a huge, delicate and annoying process to get that part of the code under = some other list or remove the absentee people. >=20 > Finally the name nazis, these will debate you on if your code should = be of the name kern_foo.c, subr_foo.c or maybe in the new-name-ng should = actually be called kernel_subr_foo.c, but whatever you name something, = they will make you change it, because you are wrong. >=20 > Anyhow, that is my opinion on heavy handed reviews in a large project. >=20 > I've been fortunate enough to work on one project where luckily it was = dominated by rubber stampers, that was silly but awesome because at = least we could get stuff done... >=20 > Unfortunately I then worked on quite a few dominated by a mix of all = the four I mentioned. The result sucked. >=20 > -Alfred >=20 >=20 From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 07:53:19 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E109827; Thu, 29 Nov 2012 07:53:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1379B8FC08; Thu, 29 Nov 2012 07:53:19 +0000 (UTC) Received: from [192.168.2.119] (host86-146-118-26.range86-146.btcentralplus.com [86.146.118.26]) by cyrus.watson.org (Postfix) with ESMTPSA id 7E40F46B09; Thu, 29 Nov 2012 02:53:17 -0500 (EST) Subject: Re: Reviewing before commit and stability minibikeshed (Re: svn commit: r243627 - head/sys/kern) Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <20121129070234.9C68458094@chaos.jnpr.net> Date: Thu, 29 Nov 2012 07:53:15 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <49B76E37-D3AB-4FCE-85F4-34A7864117D8@FreeBSD.org> References: <201211272004.qARK4qS8047209@svn.freebsd.org> <50B54180.5020608@freebsd.org> <50B54492.5040100@freebsd.org> <956CE44A-BA0F-4FE4-AA38-F4B90C85ECBA@FreeBSD.org> <50B54CE0.6080008@freebsd.org> <2A12C740-1D72-4D30-B663-47A37AAC2FF3@FreeBSD.org> <50B5C4F1.1020002@freebsd.org> <50B64C43.50001@mu.org> <50B6E1DD.2030908@mu.org> <20121129070234.9C68458094@chaos.jnpr.net> To: Simon J. Gerraty X-Mailer: Apple Mail (2.1283) Cc: "src-committers@freebsd.org" , Andre Oppermann , Peter Wemm , Garrett Cooper , "svn-src-all@freebsd.org" , Alfred Perlstein , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 07:53:19 -0000 On 29 Nov 2012, at 07:02, Simon J. Gerraty wrote: > On Wed, 28 Nov 2012 20:17:33 -0800, Alfred Perlstein writes: >> I've seen what happens with large groups, it doesn't scale and = basically=20 >> you wind up with the following type of reviewers: >=20 > The issues you cite, are the result of taking a good idea too far. > Mandating reviews for all changes - does not make sense, and all the > ills you describe are natural consequences. >=20 > But AFAIK that wasn't what Robert was talking about. >=20 > Some bits of code do warrant extra care when touching. > Unless you are the sole author and maintainer (and sometimes even = then) > getting a 2nd opinion (from someone familiar with the code) makes = sense. >=20 > That does not have to map to a requirement for formal reviewers, = review > tracking etc - none of which would scale in a volunteer organization > anyway. Yes, exactly so. Perhaps I took too much for granted in my original = e-mail, and too much focus was placed on the original commit that = triggered the larger thread, so I should be more explicit: - I have in mind developers increasing their practice of seeking code = review when touching critical and extremely sensitive subsystems in the = network stack -- e.g., socket buffers, inter-layer locking, TCP = structure, etc, rather than an edge-case device drivers. - When I say "mandatory", what I mean is a mutual consensus that = everyone involved in that area thinks that review is an important part = of working on it, and seeks review as part of their development process. - That this obviously applies to non-trivial changes rather than every = tweak to a comment. - That it be done sensibly and with good intentions by people who = understand the code. - That it occur in a culture of mutual review: if we have four active = developers in the socket code, then they all agree to participate in = both sides of the process. E.g., I suggest code review to Andre and = agree to do some, but in return, he reviews some of my changes. An = imbalance in code production and review leads to dissatisfaction for = everyone, and is not sustainable. Looking back through svn log on netinet over the last thousand changes, = excluding the last month and a half, SCTP, and mechanical/cosmetic = changes, we can see that roughly half of changes are "reviewed by" or = "discussed with", and there are patterns of mutual review, especially = for major changes. I suspect more were reviewed but that it wasn't = specifically tagged in commit messages. That doesn't mean errors don't = creep in, changes don't have to be backed out, etc, but it has = significant benefits. Robert= From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 08:06:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D254B01; Thu, 29 Nov 2012 08:06:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E27C48FC08; Thu, 29 Nov 2012 08:06:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAT86Nwb022285; Thu, 29 Nov 2012 08:06:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAT86NxD022284; Thu, 29 Nov 2012 08:06:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211290806.qAT86NxD022284@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 29 Nov 2012 08:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243669 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 08:06:24 -0000 Author: pjd Date: Thu Nov 29 08:06:23 2012 New Revision: 243669 URL: http://svnweb.freebsd.org/changeset/base/243669 Log: - Use more appropriate loop (do { } while()) when generating ethernet address for bridge interface. - If we found a collision we can break the loop - only one collision is possible and one is exactly enough to need to renegerate. Obtained from: WHEEL Systems MFC after: 1 week Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Thu Nov 29 07:30:42 2012 (r243668) +++ head/sys/net/if_bridge.c Thu Nov 29 08:06:23 2012 (r243669) @@ -615,7 +615,7 @@ bridge_clone_create(struct if_clone *ifc */ fb = 0; getcredhostid(curthread->td_ucred, &hostid); - for (retry = 1; retry != 0;) { + do { if (fb || hostid == 0) { arc4rand(sc->sc_defaddr, ETHER_ADDR_LEN, 1); sc->sc_defaddr[0] &= ~1;/* clear multicast bit */ @@ -635,11 +635,13 @@ bridge_clone_create(struct if_clone *ifc LIST_FOREACH(sc2, &bridge_list, sc_list) { bifp = sc2->sc_ifp; if (memcmp(sc->sc_defaddr, - IF_LLADDR(bifp), ETHER_ADDR_LEN) == 0) + IF_LLADDR(bifp), ETHER_ADDR_LEN) == 0) { retry = 1; + break; + } } mtx_unlock(&bridge_list_mtx); - } + } while (retry == 1); bstp_attach(&sc->sc_stp, &bridge_ops); ether_ifattach(ifp, sc->sc_defaddr); From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 08:50:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19D814DB; Thu, 29 Nov 2012 08:50:55 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5D88FC14; Thu, 29 Nov 2012 08:50:54 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 02CE989E; Thu, 29 Nov 2012 09:48:55 +0100 (CET) Date: Thu, 29 Nov 2012 09:52:08 +0100 From: Pawel Jakub Dawidek To: Andre Oppermann Subject: Re: svn commit: r241726 - head/sys/kern Message-ID: <20121129085208.GA1370@garage.freebsd.pl> References: <201210191015.q9JAFWm5060261@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <201210191015.q9JAFWm5060261@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 08:50:55 -0000 --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 19, 2012 at 10:15:32AM +0000, Andre Oppermann wrote: > Author: andre > Date: Fri Oct 19 10:15:32 2012 > New Revision: 241726 > URL: http://svn.freebsd.org/changeset/base/241726 >=20 > Log: > Move UMA socket zone initialization from uipc_domain.c to uipc_socket.c > into one place next to its other related functions to avoid confusion. I think you can remove include of vm/uma.h from uipc_domain.c now. > Modified: > head/sys/kern/uipc_domain.c > head/sys/kern/uipc_socket.c >=20 > Modified: head/sys/kern/uipc_domain.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/kern/uipc_domain.c Fri Oct 19 10:07:55 2012 (r241725) > +++ head/sys/kern/uipc_domain.c Fri Oct 19 10:15:32 2012 (r241726) > @@ -239,28 +239,11 @@ domain_add(void *data) > mtx_unlock(&dom_mtx); > } > =20 > -static void > -socket_zone_change(void *tag) > -{ > - > - uma_zone_set_max(socket_zone, maxsockets); > -} > - > /* ARGSUSED*/ > static void > domaininit(void *dummy) > { > =20 > - /* > - * Before we do any setup, make sure to initialize the > - * zone allocator we get struct sockets from. > - */ > - socket_zone =3D uma_zcreate("socket", sizeof(struct socket), NULL, NULL, > - NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > - uma_zone_set_max(socket_zone, maxsockets); > - EVENTHANDLER_REGISTER(maxsockets_change, socket_zone_change, NULL, > - EVENTHANDLER_PRI_FIRST); > - > if (max_linkhdr < 16) /* XXX */ > max_linkhdr =3D 16; > =20 >=20 > Modified: head/sys/kern/uipc_socket.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/kern/uipc_socket.c Fri Oct 19 10:07:55 2012 (r241725) > +++ head/sys/kern/uipc_socket.c Fri Oct 19 10:15:32 2012 (r241726) > @@ -227,6 +227,29 @@ MTX_SYSINIT(so_global_mtx, &so_global_mt > SYSCTL_NODE(_kern, KERN_IPC, ipc, CTLFLAG_RW, 0, "IPC"); > =20 > /* > + * Initialize the socket subsystem and set up the socket > + * memory allocator. > + */ > +static void > +socket_zone_change(void *tag) > +{ > + > + uma_zone_set_max(socket_zone, maxsockets); > +} > + > +static void > +socket_init(void *tag) > +{ > + > + socket_zone =3D uma_zcreate("socket", sizeof(struct socket), NUL= L, NULL, > + NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); > + uma_zone_set_max(socket_zone, maxsockets); > + EVENTHANDLER_REGISTER(maxsockets_change, socket_zone_change, NUL= L, > + EVENTHANDLER_PRI_FIRST); > +} > +SYSINIT(socket, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_init, NULL= ); > + > +/* > * Sysctl to get and set the maximum global sockets limit. Notify proto= cols > * of the change so that they can update their dependent limits as requi= red. > */ --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC3IjcACgkQForvXbEpPzTMXQCg0ZuntUfMPwvrM5HOHUtQwC0Z /5cAoNO6sxzK+qE7fy3mjTuvfxSaivrN =DdPA -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 09:11:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25DCB9BF; Thu, 29 Nov 2012 09:11:10 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (garage.dawidek.net [91.121.88.72]) by mx1.freebsd.org (Postfix) with ESMTP id D784A8FC0C; Thu, 29 Nov 2012 09:11:09 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 12E218AA; Thu, 29 Nov 2012 10:09:18 +0100 (CET) Date: Thu, 29 Nov 2012 10:12:30 +0100 From: Pawel Jakub Dawidek To: Andre Oppermann Subject: Re: svn commit: r241726 - head/sys/kern Message-ID: <20121129091230.GC1370@garage.freebsd.pl> References: <201210191015.q9JAFWm5060261@svn.freebsd.org> <20121129085208.GA1370@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xesSdrSSBC0PokLI" Content-Disposition: inline In-Reply-To: <20121129085208.GA1370@garage.freebsd.pl> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 09:11:10 -0000 --xesSdrSSBC0PokLI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 29, 2012 at 09:52:08AM +0100, Pawel Jakub Dawidek wrote: > On Fri, Oct 19, 2012 at 10:15:32AM +0000, Andre Oppermann wrote: > > Author: andre > > Date: Fri Oct 19 10:15:32 2012 > > New Revision: 241726 > > URL: http://svn.freebsd.org/changeset/base/241726 > >=20 > > Log: > > Move UMA socket zone initialization from uipc_domain.c to uipc_socket= =2Ec > > into one place next to its other related functions to avoid confusion. >=20 > I think you can remove include of vm/uma.h from uipc_domain.c now. Also, you changed tabs to spaces while moving it. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --xesSdrSSBC0PokLI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC3Jv4ACgkQForvXbEpPzSepQCgvs430GhE7b0FXs9K0ha+nr0G R50Ani0sU6BzaEFUunx5hAiJOul9xtwt =SAdo -----END PGP SIGNATURE----- --xesSdrSSBC0PokLI-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 12:01:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C2D55A7; Thu, 29 Nov 2012 12:01:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8877D8FC0C; Thu, 29 Nov 2012 12:01:58 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qATC1l5G057758; Thu, 29 Nov 2012 14:01:47 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qATC1l5G057758 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qATC1lDN057757; Thu, 29 Nov 2012 14:01:47 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Nov 2012 14:01:47 +0200 From: Konstantin Belousov To: Eitan Adler Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129120147.GE3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qCuyVVLLFvr0p6ls" Content-Disposition: inline In-Reply-To: <201211290516.qAT5GoT5098709@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 12:01:59 -0000 --qCuyVVLLFvr0p6ls Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: > Author: eadler > Date: Thu Nov 29 05:16:50 2012 > New Revision: 243665 > URL: http://svnweb.freebsd.org/changeset/base/243665 >=20 > Log: > Mark non-returning function as such > =20 > PR: bin/172978 > Approved by: cperciva > MFC after: 3 days >=20 > Modified: > head/sbin/dump/dump.h >=20 > Modified: head/sbin/dump/dump.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) > +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) > @@ -121,7 +121,7 @@ void trewind(void); > void writerec(char *dp, int isspcl); > =20 > void Exit(int status) __dead2; > -void dumpabort(int signo); > +void dumpabort(int signo) __dead2; > void dump_getfstab(void); > =20 > char *rawname(char *cp); What is the goal of this change ? It is arguably backward. There is absolutely no use to mark signal handler as __dead2, and all other uses do not benefit from the redundand declaratio= n. Also, being quite removed from the function definition, there is a chance that some future modification would make the attribute a lie. --qCuyVVLLFvr0p6ls Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC3TqsACgkQC3+MBN1Mb4gUFACgpYhL1B/3guz8Tlgck1sj4wGn 2ugAoMqd9AWWaF+qby3HusN/pzOGnr3d =kUCf -----END PGP SIGNATURE----- --qCuyVVLLFvr0p6ls-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 12:45:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6473F3B3 for ; Thu, 29 Nov 2012 12:45:45 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C2F9C8FC0C for ; Thu, 29 Nov 2012 12:45:44 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so14182888lah.13 for ; Thu, 29 Nov 2012 04:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=V7u83gyxNED4BE1u60bhHeogAN6F8OWS/EO/cjYTAzA=; b=jKdrnAZpb97+bpIypsn+Kff6SAO7zSO+4GJ5y0F5+Fe5stpC3PXMKN2kppnEdx3pJY aKpr3Xhqqsy3iaJgNOb+ilHaBbL0tF5qBjogWsoHY+LG9ZjHcx7USYmp5XSLEAP1EpWG 0QkAhcLEt3mezqi9idDAQ1YSUIsf9FBFJNK60= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=V7u83gyxNED4BE1u60bhHeogAN6F8OWS/EO/cjYTAzA=; b=b65l+noBpZ4d1HFYwRCQ2WeRjwRzAiCMfhYnwXwipdjQUAmxpfKgpTc1ngQ9zpcrGi 0nn1Nz6tlaGdXahGVnIdvRHJa2+DDrAD9ncUpudnSwUWo3PO6mTdy+PKDm59CDGx/TuJ KICJqphbboVTLaqGbhDAigA8bm2Ntftr2uykCxQoygCuyhySLGYZrZkZRLtfhdoaSV9i BOGrsAIVCCk3Lf8Lh3MLQVUn00Iq7ZIym1V82K5qBL3hogzv2RWN6U871vbEo/ZfXiIv SoJi6IW9AyoEGqWXmyAk1eZ5G+yldzQz1NXfdvO9eKfCuf5tDtXHpMesiL7yzqVK6pGO d73g== Received: by 10.152.105.33 with SMTP id gj1mr21566731lab.49.1354193143111; Thu, 29 Nov 2012 04:45:43 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Thu, 29 Nov 2012 04:45:12 -0800 (PST) In-Reply-To: <20121129120147.GE3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> From: Eitan Adler Date: Thu, 29 Nov 2012 07:45:12 -0500 X-Google-Sender-Auth: iGMQ3Ff5eAbQZkdUkdlyLrkfo0w Message-ID: Subject: Re: svn commit: r243665 - head/sbin/dump To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQns23mp2FMPN7/7Ga5BD4+7bA4SS7NU043x+SVSnks12fxKIU9VnIwglG5jl7K9jK6zpLY6 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 12:45:45 -0000 On 29 November 2012 07:01, Konstantin Belousov wrote: > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: >> Author: eadler >> Date: Thu Nov 29 05:16:50 2012 >> New Revision: 243665 >> URL: http://svnweb.freebsd.org/changeset/base/243665 >> >> Log: >> Mark non-returning function as such >> >> PR: bin/172978 >> Approved by: cperciva >> MFC after: 3 days >> >> Modified: >> head/sbin/dump/dump.h >> >> Modified: head/sbin/dump/dump.h >> ============================================================================== >> --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) >> +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) >> @@ -121,7 +121,7 @@ void trewind(void); >> void writerec(char *dp, int isspcl); >> >> void Exit(int status) __dead2; >> -void dumpabort(int signo); >> +void dumpabort(int signo) __dead2; >> void dump_getfstab(void); >> >> char *rawname(char *cp); > What is the goal of this change ? It fixes some static analyzer warnings. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 12:51:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A96D87D; Thu, 29 Nov 2012 12:51:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2094A8FC16; Thu, 29 Nov 2012 12:51:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qATCpBL1078278; Thu, 29 Nov 2012 12:51:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qATCpA7w078277; Thu, 29 Nov 2012 12:51:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201211291251.qATCpA7w078277@svn.freebsd.org> From: Eitan Adler Date: Thu, 29 Nov 2012 12:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243670 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 12:51:11 -0000 Author: eadler Date: Thu Nov 29 12:51:10 2012 New Revision: 243670 URL: http://svnweb.freebsd.org/changeset/base/243670 Log: Generalize make.conf man page: use "cc" instead of "gcc" PR: misc/173604 Submitted by: Dan McGregor Approved by: bcr (mentor) MFC after: 3 days Modified: head/share/man/man5/make.conf.5 Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Thu Nov 29 08:06:23 2012 (r243669) +++ head/share/man/man5/make.conf.5 Thu Nov 29 12:51:10 2012 (r243670) @@ -143,7 +143,7 @@ and are not supported. .Va BDECFLAGS is provided as a set of -.Xr gcc 1 +.Xr cc 1 settings suggested by .An "Bruce Evans" Aq bde@FreeBSD.org for developing and testing changes. @@ -162,7 +162,7 @@ the value of and .Va COPTFLAGS to contain the appropriate optimization directive to -.Xr gcc 1 . +.Xr cc 1 . The automatic setting of .Va CFLAGS and @@ -693,7 +693,7 @@ The default number is 20011. .Pq Vt int Causes the system compiler to be built such that it forces high optimization levels to a lower one. -.Xr gcc 1 +.Xr cc 1 .Fl O2 and above is known to trigger known optimizer bugs at various times. @@ -735,7 +735,7 @@ filter, or both. .It Pa /usr/src/Makefile.inc1 .El .Sh SEE ALSO -.Xr gcc 1 , +.Xr cc 1 , .Xr install 1 , .Xr make 1 , .Xr src.conf 5 , From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 13:04:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 420CEC66; Thu, 29 Nov 2012 13:04:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id C36F38FC08; Thu, 29 Nov 2012 13:04:56 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qATD4n66063652; Thu, 29 Nov 2012 15:04:49 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qATD4n66063652 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qATD4n4G063651; Thu, 29 Nov 2012 15:04:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Nov 2012 15:04:49 +0200 From: Konstantin Belousov To: Eitan Adler Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129130449.GH3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7e8BFhNxqpjiNKz7" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 13:04:57 -0000 --7e8BFhNxqpjiNKz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 29, 2012 at 07:45:12AM -0500, Eitan Adler wrote: > On 29 November 2012 07:01, Konstantin Belousov wrot= e: > > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: > >> Author: eadler > >> Date: Thu Nov 29 05:16:50 2012 > >> New Revision: 243665 > >> URL: http://svnweb.freebsd.org/changeset/base/243665 > >> > >> Log: > >> Mark non-returning function as such > >> > >> PR: bin/172978 > >> Approved by: cperciva > >> MFC after: 3 days > >> > >> Modified: > >> head/sbin/dump/dump.h > >> > >> Modified: head/sbin/dump/dump.h > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >> --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) > >> +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) > >> @@ -121,7 +121,7 @@ void trewind(void); > >> void writerec(char *dp, int isspcl); > >> > >> void Exit(int status) __dead2; > >> -void dumpabort(int signo); > >> +void dumpabort(int signo) __dead2; > >> void dump_getfstab(void); > >> > >> char *rawname(char *cp); > > What is the goal of this change ? >=20 > It fixes some static analyzer warnings. This cannot be a reason to cripple the code. --7e8BFhNxqpjiNKz7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQt11vAAoJEJDCuSvBvK1BOtoP+wUojm+INQ2WCWJIJicFBe6h lRw+a1cJw38Ww/4dAjytL1cQe7vdG9YgJf3MK3+n7ZVDjBRa+TtyZpsR97A6nI8B XHB+Ozl/qGagebrguoOoCy+IYcR04R6E/wC+Q2mxhko7HPzoXZQSUFh+hpkj0BFl xysz4IBHjfXL1kh8r2TPeuSBcd6MQN/xWjmPZZFPIsHcwRAgsTQb+h0a9LrrUfp5 C/3CZPopsuICbwMuLgWiPcliudU0/fdivzoL6snUEzg0EV0g+32w0rPfUU2Jsfin VjEinuYT7M6NZsNv2Scl+xLxaOSQpNKcnz0hWBMFARuLgTVBHt3fBpa6CqKiL2Yy TWUAGdTu9YwbjdjsCJ3eLEe+6n5TijbepK5OvQGYqNRZz3/se0C5cRpYF6318TFD 3o1kXK/eu+aJ93SaJkIbkZmbX6TNXMJRyDpQ+Ik2g0pt4NKOmKcWt9uOySlRTbVx UN8BHU9DxhJz4lR6z/YwlBN4Uu4mmmMF2QsRLcJ7wV4b4qbo6zhd8XFEkNcHESVj JTZlq9ktXAKUd4DnWBiQuZmSn4UbKAWW3f1pjHyDBAcWnoM/y3FnaxgpqoIBStE4 VCF0PfuUoMeOcCZEJohsfsM5BgApq62OOmseisOSzgBWVTeGzvLNvdgMEYe9xdZF elq7gjruUC2jMGPzcOTA =aaDE -----END PGP SIGNATURE----- --7e8BFhNxqpjiNKz7-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 13:35:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 243338DB; Thu, 29 Nov 2012 13:35:45 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F18438FC15; Thu, 29 Nov 2012 13:35:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qATDZiHH086284; Thu, 29 Nov 2012 13:35:44 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qATDZiLX086281; Thu, 29 Nov 2012 13:35:44 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201211291335.qATDZiLX086281@svn.freebsd.org> From: David Chisnall Date: Thu, 29 Nov 2012 13:35:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243673 - head/contrib/libc++/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 13:35:45 -0000 Author: theraven Date: Thu Nov 29 13:35:44 2012 New Revision: 243673 URL: http://svnweb.freebsd.org/changeset/base/243673 Log: Merge new libc++ into head. Modified: head/contrib/libc++/include/exception head/contrib/libc++/include/iterator head/contrib/libc++/include/locale Directory Properties: head/contrib/libc++/ (props changed) Modified: head/contrib/libc++/include/exception ============================================================================== --- head/contrib/libc++/include/exception Thu Nov 29 13:29:58 2012 (r243672) +++ head/contrib/libc++/include/exception Thu Nov 29 13:35:44 2012 (r243673) @@ -143,7 +143,7 @@ public: {return !(__x == __y);} friend exception_ptr current_exception() _NOEXCEPT; - _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr); + friend void rethrow_exception(exception_ptr); }; template Modified: head/contrib/libc++/include/iterator ============================================================================== --- head/contrib/libc++/include/iterator Thu Nov 29 13:29:58 2012 (r243672) +++ head/contrib/libc++/include/iterator Thu Nov 29 13:35:44 2012 (r243673) @@ -317,6 +317,10 @@ template T* end(T (& #include #include #include +#if __APPLE__ +#include +#endif + #ifdef _LIBCPP_DEBUG #include #endif @@ -795,7 +799,7 @@ public: typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_istream<_CharT,_Traits> istream_type; private: - streambuf_type* __sbuf_; + mutable streambuf_type* __sbuf_; class __proxy { @@ -809,13 +813,14 @@ private: }; _LIBCPP_INLINE_VISIBILITY - void __test_for_eof() + bool __test_for_eof() const { if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) __sbuf_ = 0; + return __sbuf_ == 0; } public: - _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {__test_for_eof();} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT @@ -828,19 +833,16 @@ public: _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() { - if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof())) - __sbuf_ = 0; + __sbuf_->sbumpc(); return *this; } _LIBCPP_INLINE_VISIBILITY __proxy operator++(int) { - char_type __c = __sbuf_->sgetc(); - ++(*this); - return __proxy(__c, __sbuf_); + return __proxy(__sbuf_->sbumpc(), __sbuf_); } _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const - {return (__sbuf_ == 0) == (__b.__sbuf_ == 0);} + {return __test_for_eof() == __b.__test_for_eof();} }; template @@ -882,6 +884,10 @@ public: _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) + template friend _LIBCPP_HIDDEN @@ -889,6 +895,7 @@ public: __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl); +#endif }; template Modified: head/contrib/libc++/include/locale ============================================================================== --- head/contrib/libc++/include/locale Thu Nov 29 13:29:58 2012 (r243672) +++ head/contrib/libc++/include/locale Thu Nov 29 13:35:44 2012 (r243673) @@ -192,6 +192,10 @@ template class messages_by #include #endif // !_WIN32 +#if __APPLE__ +#include +#endif + #include <__undef_min_max> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -1587,6 +1591,10 @@ __pad_and_output(_OutputIterator __s, return __s; } +#if !defined(__APPLE__) || \ + (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) + template _LIBCPP_HIDDEN ostreambuf_iterator<_CharT, _Traits> @@ -1633,6 +1641,8 @@ __pad_and_output(ostreambuf_iterator<_Ch return __s; } +#endif + template _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 15:16:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0FF55881 for ; Thu, 29 Nov 2012 15:16:28 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 692288FC14 for ; Thu, 29 Nov 2012 15:16:26 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so11780663lbb.13 for ; Thu, 29 Nov 2012 07:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=ZCS1ElbtcQhuQwSz5D0kz9P3hh/jf/EDzkd0xwxEhlE=; b=OeZXOqT0Zp2pcX5b/PZZl5ww8XxC5XwJaByp4oT0uImXcou+DZjdgMEEPwd/L4Xcrf 3bgBDCZ/3pekjY5KSHiMffj+6nEDBSxafCHCk4laCnIUj7q0hyY58cLTVCgVUTwJgDOQ zHpXQ9+eO+gNKEs93X88DNG4kE83JLPKiLRIg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=ZCS1ElbtcQhuQwSz5D0kz9P3hh/jf/EDzkd0xwxEhlE=; b=OQx/4xH7G13fuZWD/vkjmojMc6UH3wKMR7IQx9bbhVLNQ/jOZntB9EpxKwa0UpdUMM QpIZf4py3xo/viQB4Ucg7AYG49l+zFN2rgT9IjRJfE7VUyAAa91Hr16vm1UMi1umU7VF Jb15IYexsKBJGJ/jdcJZiLSQJvwta2VI6rhSneICm57X6JRqWusAv4zktdmcCSdBjJd1 NFh3/ZUJkSawe25tV3HlDA+dOPsB++HSHQjOSDLXcm4JumKU8Ll2YGg3BHzoac6m+4JV hORlLLBK4Qr2tNFeeylIekOH+kBgiNSIbaDKditdE0dklbOYyP71lQY8RHNo0NLzsi/8 7l1A== Received: by 10.152.105.33 with SMTP id gj1mr22020411lab.49.1354202185945; Thu, 29 Nov 2012 07:16:25 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Thu, 29 Nov 2012 07:15:54 -0800 (PST) In-Reply-To: <20121129130449.GH3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> <20121129130449.GH3013@kib.kiev.ua> From: Eitan Adler Date: Thu, 29 Nov 2012 10:15:54 -0500 X-Google-Sender-Auth: Kh35L_3S08YPNfNYrDu_i6xvmZ4 Message-ID: Subject: Re: svn commit: r243665 - head/sbin/dump To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlYWIFcT5sJWD6Cehb7mLE9TFb/RnjPBHkd+sMoHtjIsd/1d+K4b5ivDaAU6QPZC3gmR5v9 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 15:16:28 -0000 On 29 November 2012 08:04, Konstantin Belousov wrote: >> It fixes some static analyzer warnings. > This cannot be a reason to cripple the code. How is the code crippled? -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 16:18:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1C8A9284; Thu, 29 Nov 2012 16:18:11 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo6-p05-ob.rzone.de (mo6-p05-ob.rzone.de [IPv6:2a01:238:20a:202:5305::1]) by mx1.freebsd.org (Postfix) with ESMTP id 1C8F38FC16; Thu, 29 Nov 2012 16:18:09 +0000 (UTC) X-RZG-CLASS-ID: mo05 X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnrylsiW6obkY= Received: from britannica.bec.de (ip-109-45-0-1.web.vodafone.de [109.45.0.1]) by smtp.strato.de (josoe mo25) (RZmta 31.6 DYNA|AUTH) with (AES128-SHA encrypted) ESMTPA id 2057e1oATF5M8N ; Thu, 29 Nov 2012 17:18:08 +0100 (CET) Received: by britannica.bec.de (sSMTP sendmail emulation); Thu, 29 Nov 2012 17:18:06 +0100 Resent-From: Joerg Sonnenberger Resent-Date: Thu, 29 Nov 2012 17:18:06 +0100 Resent-Message-ID: <20121129161806.GA13655@britannica.bec.de> Resent-To: svn-src-head@freebsd.org, svn-src-all@freebsd.org Received: from pop3.strato.de (pop3.strato.de [81.169.145.131]) by britannica.bec.de (mpop-1.0.25) with POP3 for ; Thu, 29 Nov 2012 15:46:01 +0100 X-Envelope-From: X-Envelope-To: X-Delivery-Time: 1354200129 X-UID: 1085504 X-RZG-MI-VALUES: bm=0 mafl=1 sh=0 du=0 sp=2,1 vv=1 nf=0 X-Strato-MessageType: email X-RZG-CLASS-ID: mi Received: from mx2.freebsd.org ([IPv6:2001:4f8:fff6::35]) by mailin.rzone.de (joses mi78) (RZmta 31.6 OK) with ESMTP id y0637coATEfICr for ; Thu, 29 Nov 2012 15:42:08 +0100 (CET) Received: from hub.freebsd.org (hub.FreeBSD.org [8.8.178.136]) by mx2.freebsd.org (Postfix) with ESMTP id B55033B5DE9; Thu, 29 Nov 2012 14:41:56 +0000 (UTC) Received: from hub.FreeBSD.org (hub.FreeBSD.org [8.8.178.136]) by hub.freebsd.org (Postfix) with ESMTP id BACC9C15; Thu, 29 Nov 2012 14:42:02 +0000 (UTC) (envelope-from owner-svn-src-all@freebsd.org) Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 26EFABBB for ; Thu, 29 Nov 2012 14:41:45 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo6-p00-ob.rzone.de (mo6-p00-ob.rzone.de [IPv6:2a01:238:20a:202:5300::1]) by mx1.freebsd.org (Postfix) with ESMTP id AB1358FC21 for ; Thu, 29 Nov 2012 14:41:44 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnrylsiW6obkY= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-109-45-0-1.web.vodafone.de [109.45.0.1]) by smtp.strato.de (jored mo27) (RZmta 31.6 DYNA|AUTH) with (AES128-SHA encrypted) ESMTPA id k05fe0oATE0WO6 for ; Thu, 29 Nov 2012 15:41:42 +0100 (CET) Received: by britannica.bec.de (sSMTP sendmail emulation); Thu, 29 Nov 2012 15:41:41 +0100 Date: Thu, 29 Nov 2012 15:41:41 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129144141.GA10843@britannica.bec.de> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121129120147.GE3013@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: owner-svn-src-all@freebsd.org Sender: owner-svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 16:18:11 -0000 On Thu, Nov 29, 2012 at 02:01:47PM +0200, Konstantin Belousov wrote: > Also, being quite removed from the function definition, there is a chance > that some future modification would make the attribute a lie. At least clang enforces the correctness of the attribute. Joerg _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 16:24:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F7673C7; Thu, 29 Nov 2012 16:24:17 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id CC48A8FC14; Thu, 29 Nov 2012 16:24:16 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 8EF0A1203C0; Thu, 29 Nov 2012 17:24:12 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 68D522848C; Thu, 29 Nov 2012 17:24:12 +0100 (CET) Date: Thu, 29 Nov 2012 17:24:12 +0100 From: Jilles Tjoelker To: Konstantin Belousov Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129162412.GD29338@stack.nl> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121129120147.GE3013@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 16:24:17 -0000 On Thu, Nov 29, 2012 at 02:01:47PM +0200, Konstantin Belousov wrote: > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: > > Author: eadler > > Date: Thu Nov 29 05:16:50 2012 > > New Revision: 243665 > > URL: http://svnweb.freebsd.org/changeset/base/243665 > > Log: > > Mark non-returning function as such > > PR: bin/172978 > > Approved by: cperciva > > MFC after: 3 days > > Modified: > > head/sbin/dump/dump.h > > Modified: head/sbin/dump/dump.h > > ============================================================================== > > --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) > > +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) > > @@ -121,7 +121,7 @@ void trewind(void); > > void writerec(char *dp, int isspcl); > > > > void Exit(int status) __dead2; > > -void dumpabort(int signo); > > +void dumpabort(int signo) __dead2; > > void dump_getfstab(void); > > > > char *rawname(char *cp); > What is the goal of this change ? This has been discussed before in http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022179.html and the rest of the thread. The result there seems that it is the least bad thing to add __dead2 even on static functions that do not return to reduce compiler/analyzer warnings and improve the generated code with GCC 4.2.1 and GCC 4.5. > It is arguably backward. There is absolutely no use to mark signal > handler as __dead2, and all other uses do not benefit from the > redundand declaration. Although most of the uses of dumpabort() are in the same file as its definition, GCC 4.2.1 is too dumb to detect its noreturn property automatically. Furthermore, some of the uses are in separate files. In particular, __dead2 on dumpabort() is required to mark or detect quit() as noreturn. > Also, being quite removed from the function definition, there is a > chance that some future modification would make the attribute a lie. Both GCC and Clang generate a warning by default if it appears possible for a noreturn function to return, so as long as -Werror remains enabled it should be safe enough. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 19:10:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6BA21AC1; Thu, 29 Nov 2012 19:10:05 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 50FF98FC17; Thu, 29 Nov 2012 19:10:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qATJA5nI039954; Thu, 29 Nov 2012 19:10:05 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qATJA58C039951; Thu, 29 Nov 2012 19:10:05 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211291910.qATJA58C039951@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 29 Nov 2012 19:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243680 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 19:10:05 -0000 Author: np Date: Thu Nov 29 19:10:04 2012 New Revision: 243680 URL: http://svnweb.freebsd.org/changeset/base/243680 Log: cxgbe/tom: Add a flag to indicate that the L2 table entry for an embryonic connection has been setup and never attempt to abort a tid before this is done. This fixes a bad race where a listening socket is closed when the driver is in the middle of step (b) here. The symptom of this were "ARP miss" errors from the driver followed by tid leaks. A hardware-offloaded passive open works this way: a) A SYN "hits" the TCAM entry for a server tid and the chip delivers it to the queue associated with the server tid (say, queue A). It waits for a response from the driver telling it what to do. b) The driver decides it is ok to proceed. It adds the new tid to the list of embryonic connections associated with the server tid and then hands off the SYN to the kernel's syncache to make sure that the kernel okays it too. If it does then the driver provides an L2 table entry, queue id (say, queue B), etc. and instructs the chip to send the SYN/ACK response. c) The chip delivers a status to queue B depending on how the third step of the 3-way handshake goes. The driver removes the tid from its list of embryonic connections and either expands the syncache entry or destroys the tid. In any case all subsequent messages for the new tid will be delivered to queue B, not queue A. Anything running in queue B knows that the L2 entry has long been setup and the new flag is of no interest from here on. If the listener is closed it will deal with so_comp as normal. MFC after: 1 week Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 18:23:21 2012 (r243679) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 19:10:04 2012 (r243680) @@ -786,6 +786,29 @@ do_peer_close(struct sge_iq *iq, const s KASSERT(opcode == CPL_PEER_CLOSE, ("%s: unexpected opcode 0x%x", __func__, opcode)); KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); + + if (__predict_false(toep->flags & TPF_SYNQE)) { +#ifdef INVARIANTS + struct synq_entry *synqe = (void *)toep; + + INP_WLOCK(synqe->lctx->inp); + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } else { + /* + * do_pass_accept_req is still running and will + * eventually take care of this tid. + */ + } + INP_WUNLOCK(synqe->lctx->inp); +#endif + CTR4(KTR_CXGBE, "%s: tid %u, synqe %p (0x%x)", __func__, tid, + toep, toep->flags); + return (0); + } + KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); INP_INFO_WLOCK(&V_tcbinfo); @@ -1092,13 +1115,24 @@ do_rx_data(struct sge_iq *iq, const stru int len; if (__predict_false(toep->flags & TPF_SYNQE)) { - /* - * do_pass_establish failed and must be attempting to abort the - * synqe's tid. Meanwhile, the T4 has sent us data for such a - * connection. - */ - KASSERT(toep->flags & TPF_ABORT_SHUTDOWN, - ("%s: synqe and tid isn't being aborted.", __func__)); +#ifdef INVARIANTS + struct synq_entry *synqe = (void *)toep; + + INP_WLOCK(synqe->lctx->inp); + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } else { + /* + * do_pass_accept_req is still running and will + * eventually take care of this tid. + */ + } + INP_WUNLOCK(synqe->lctx->inp); +#endif + CTR4(KTR_CXGBE, "%s: tid %u, synqe %p (0x%x)", __func__, tid, + toep, toep->flags); m_freem(m); return (0); } Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 29 18:23:21 2012 (r243679) +++ head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 29 19:10:04 2012 (r243680) @@ -282,8 +282,8 @@ send_reset_synqe(struct toedev *tod, str INP_WLOCK_ASSERT(synqe->lctx->inp); - CTR4(KTR_CXGBE, "%s: synqe %p, tid %d%s", - __func__, synqe, synqe->tid, + CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s", + __func__, synqe, synqe->flags, synqe->tid, synqe->flags & TPF_ABORT_SHUTDOWN ? " (abort already in progress)" : ""); if (synqe->flags & TPF_ABORT_SHUTDOWN) @@ -501,8 +501,10 @@ t4_listen_stop(struct toedev *tod, struc * socket's so_comp. It doesn't know about the connections on the synq * so we need to take care of those. */ - TAILQ_FOREACH(synqe, &lctx->synq, link) - send_reset_synqe(tod, synqe); + TAILQ_FOREACH(synqe, &lctx->synq, link) { + if (synqe->flags & TPF_SYNQE_HAS_L2TE) + send_reset_synqe(tod, synqe); + } destroy_server(sc, lctx); return (0); @@ -1131,8 +1133,7 @@ do_pass_accept_req(struct sge_iq *iq, co synqe->lctx = lctx; synqe->syn = m; m = NULL; - refcount_init(&synqe->refcnt, 1); /* 1 so that it is held for the - duration of this function */ + refcount_init(&synqe->refcnt, 0); synqe->l2e_idx = e->idx; synqe->rcv_bufsize = rx_credits; atomic_store_rel_ptr(&synqe->wr, (uintptr_t)wr); @@ -1155,46 +1156,9 @@ do_pass_accept_req(struct sge_iq *iq, co * If we replied during syncache_add (synqe->wr has been consumed), * good. Otherwise, set it to 0 so that further syncache_respond * attempts by the kernel will be ignored. - * - * The extra hold on the synqe makes sure that it is still around, even - * if the listener has been dropped and the synqe was aborted and the - * reply to the abort has removed and released the synqe from the synq - * list. */ if (atomic_cmpset_ptr(&synqe->wr, (uintptr_t)wr, 0)) { - INP_WLOCK(inp); - if (__predict_false(inp->inp_flags & INP_DROPPED)) { - /* listener closed. synqe must have been aborted. */ - KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, - ("%s: listener %p closed but synqe %p not aborted", - __func__, inp, synqe)); - - CTR5(KTR_CXGBE, - "%s: stid %u, tid %u, lctx %p, synqe %p, ABORTED", - __func__, stid, tid, lctx, synqe); - INP_WUNLOCK(inp); - free(wr, M_CXGBE); - release_synqe(synqe); /* about to exit function */ - return (__LINE__); - } - - /* - * synqe aborted before TOM replied to PASS_ACCEPT_REQ. But - * that can only happen if the listener was closed and we just - * checked for that. - */ - KASSERT(!(synqe->flags & TPF_ABORT_SHUTDOWN), - ("%s: synqe %p aborted, but listener %p not dropped.", - __func__, synqe, inp)); - - /* Yank the synqe out of the lctx synq. */ - TAILQ_REMOVE(&lctx->synq, synqe, link); - release_synqe(synqe); /* removed from synq list */ - inp = release_lctx(sc, lctx); - if (inp) - INP_WUNLOCK(inp); - /* * syncache may or may not have a hold on the synqe, which may * or may not be stashed in the original SYN mbuf passed to us. @@ -1205,13 +1169,39 @@ do_pass_accept_req(struct sge_iq *iq, co m->m_pkthdr.rcvif = ifp; remove_tid(sc, synqe->tid); - release_synqe(synqe); /* about to exit function */ free(wr, M_CXGBE); + + /* Yank the synqe out of the lctx synq. */ + INP_WLOCK(inp); + TAILQ_REMOVE(&lctx->synq, synqe, link); + release_synqe(synqe); /* removed from synq list */ + inp = release_lctx(sc, lctx); + if (inp) + INP_WUNLOCK(inp); + REJECT_PASS_ACCEPT(); } - release_synqe(synqe); /* about to exit function */ + CTR5(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p, synqe %p, SYNACK", __func__, stid, tid, lctx, synqe); + + INP_WLOCK(inp); + synqe->flags |= TPF_SYNQE_HAS_L2TE; + if (__predict_false(inp->inp_flags & INP_DROPPED)) { + /* + * Listening socket closed but tod_listen_stop did not abort + * this tid because there was no L2T entry for the tid at that + * time. Abort it now. The reply to the abort will clean up. + */ + CTR5(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p, synqe %p, ABORT", + __func__, stid, tid, lctx, synqe); + send_reset_synqe(tod, synqe); + INP_WUNLOCK(inp); + + return (__LINE__); + } + INP_WUNLOCK(inp); + return (0); reject: CTR4(KTR_CXGBE, "%s: stid %u, tid %u, REJECT (%d)", __func__, stid, tid, @@ -1293,15 +1283,12 @@ do_pass_establish(struct sge_iq *iq, con __func__, stid, tid, synqe, synqe->flags, inp->inp_flags); if (__predict_false(inp->inp_flags & INP_DROPPED)) { - /* - * The listening socket has closed. The TOM must have aborted - * all the embryonic connections (including this one) that were - * on the lctx's synq. do_abort_rpl for the tid is responsible - * for cleaning up. - */ - KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, - ("%s: listen socket dropped but tid %u not aborted.", - __func__, tid)); + + if (synqe->flags & TPF_SYNQE_HAS_L2TE) { + KASSERT(synqe->flags & TPF_ABORT_SHUTDOWN, + ("%s: listen socket closed but tid %u not aborted.", + __func__, tid)); + } INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); @@ -1321,7 +1308,12 @@ do_pass_establish(struct sge_iq *iq, con toep = alloc_toepcb(pi, txqid, rxqid, M_NOWAIT); if (toep == NULL) { reset: - /* The reply to this abort will perform final cleanup */ + /* + * The reply to this abort will perform final cleanup. There is + * no need to check for HAS_L2TE here. We can be here only if + * we responded to the PASS_ACCEPT_REQ, and our response had the + * L2T idx. + */ send_reset_synqe(TOEDEV(ifp), synqe); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 18:23:21 2012 (r243679) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 19:10:04 2012 (r243680) @@ -67,6 +67,7 @@ enum { TPF_SYNQE_NEEDFREE = (1 << 9), /* synq_entry was malloc'd separately */ TPF_SYNQE_TCPDDP = (1 << 10), /* ulp_mode TCPDDP in toepcb */ TPF_SYNQE_EXPANDED = (1 << 11), /* toepcb ready, tid context updated */ + TPF_SYNQE_HAS_L2TE = (1 << 12), /* we've replied to PASS_ACCEPT_REQ */ }; enum { From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 19:39:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0E30056A; Thu, 29 Nov 2012 19:39:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E83938FC17; Thu, 29 Nov 2012 19:39:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qATJdRtk043962; Thu, 29 Nov 2012 19:39:27 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qATJdR2v043959; Thu, 29 Nov 2012 19:39:27 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201211291939.qATJdR2v043959@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 29 Nov 2012 19:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243681 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 19:39:28 -0000 Author: np Date: Thu Nov 29 19:39:27 2012 New Revision: 243681 URL: http://svnweb.freebsd.org/changeset/base/243681 Log: cxgbe/tom: Handle the case where the chip falls out of DDP mode by itself. The hole in the receive sequence space corresponds to the number of bytes placed directly up to that point. MFC after: 1 week Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 19:10:04 2012 (r243680) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Nov 29 19:39:27 2012 (r243681) @@ -1113,6 +1113,7 @@ do_rx_data(struct sge_iq *iq, const stru struct socket *so; struct sockbuf *sb; int len; + uint32_t ddp_placed = 0; if (__predict_false(toep->flags & TPF_SYNQE)) { #ifdef INVARIANTS @@ -1154,13 +1155,8 @@ do_rx_data(struct sge_iq *iq, const stru tp = intotcpcb(inp); -#ifdef INVARIANTS - if (__predict_false(tp->rcv_nxt != be32toh(cpl->seq))) { - log(LOG_ERR, - "%s: unexpected seq# %x for TID %u, rcv_nxt %x\n", - __func__, be32toh(cpl->seq), toep->tid, tp->rcv_nxt); - } -#endif + if (__predict_false(tp->rcv_nxt != be32toh(cpl->seq))) + ddp_placed = be32toh(cpl->seq) - tp->rcv_nxt; tp->rcv_nxt += len; KASSERT(tp->rcv_wnd >= len, ("%s: negative window size", __func__)); @@ -1207,12 +1203,20 @@ do_rx_data(struct sge_iq *iq, const stru int changed = !(toep->ddp_flags & DDP_ON) ^ cpl->ddp_off; if (changed) { - if (__predict_false(!(toep->ddp_flags & DDP_SC_REQ))) { - /* XXX: handle this if legitimate */ - panic("%s: unexpected DDP state change %d", - __func__, cpl->ddp_off); + if (toep->ddp_flags & DDP_SC_REQ) + toep->ddp_flags ^= DDP_ON | DDP_SC_REQ; + else { + KASSERT(cpl->ddp_off == 1, + ("%s: DDP switched on by itself.", + __func__)); + + /* Fell out of DDP mode */ + toep->ddp_flags &= ~(DDP_ON | DDP_BUF0_ACTIVE | + DDP_BUF1_ACTIVE); + + if (ddp_placed) + insert_ddp_data(toep, ddp_placed); } - toep->ddp_flags ^= DDP_ON | DDP_SC_REQ; } if ((toep->ddp_flags & DDP_OK) == 0 && Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Thu Nov 29 19:10:04 2012 (r243680) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Thu Nov 29 19:39:27 2012 (r243681) @@ -205,6 +205,42 @@ release_ddp_resources(struct toepcb *toe } } +/* XXX: handle_ddp_data code duplication */ +void +insert_ddp_data(struct toepcb *toep, uint32_t n) +{ + struct inpcb *inp = toep->inp; + struct tcpcb *tp = intotcpcb(inp); + struct sockbuf *sb = &inp->inp_socket->so_rcv; + struct mbuf *m; + + INP_WLOCK_ASSERT(inp); + SOCKBUF_LOCK_ASSERT(sb); + + m = m_get(M_NOWAIT, MT_DATA); + if (m == NULL) + CXGBE_UNIMPLEMENTED("mbuf alloc failure"); + m->m_len = n; + m->m_flags |= M_DDP; /* Data is already where it should be */ + m->m_data = "nothing to see here"; + + tp->rcv_nxt += n; +#ifndef USE_DDP_RX_FLOW_CONTROL + KASSERT(tp->rcv_wnd >= n, ("%s: negative window size", __func__)); + tp->rcv_wnd -= n; +#endif + + KASSERT(toep->sb_cc >= sb->sb_cc, + ("%s: sb %p has more data (%d) than last time (%d).", + __func__, sb, sb->sb_cc, toep->sb_cc)); + toep->rx_credits += toep->sb_cc - sb->sb_cc; +#ifdef USE_DDP_RX_FLOW_CONTROL + toep->rx_credits -= n; /* adjust for F_RX_FC_DDP */ +#endif + sbappendstream_locked(sb, m); + toep->sb_cc = sb->sb_cc; +} + /* SET_TCB_FIELD sent as a ULP command looks like this */ #define LEN__SET_TCB_FIELD_ULP (sizeof(struct ulp_txpkt) + \ sizeof(struct ulptx_idata) + sizeof(struct cpl_set_tcb_field_core)) Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 19:10:04 2012 (r243680) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Nov 29 19:39:27 2012 (r243681) @@ -273,4 +273,5 @@ int t4_soreceive_ddp(struct socket *, st struct mbuf **, struct mbuf **, int *); void enable_ddp(struct adapter *, struct toepcb *toep); void release_ddp_resources(struct toepcb *toep); +void insert_ddp_data(struct toepcb *, uint32_t); #endif From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 20:57:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB4AE8F9; Thu, 29 Nov 2012 20:57:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 2096D8FC0C; Thu, 29 Nov 2012 20:57:37 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qATKvTGk009937; Thu, 29 Nov 2012 22:57:29 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qATKvTGk009937 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qATKvTrt009936; Thu, 29 Nov 2012 22:57:29 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Nov 2012 22:57:29 +0200 From: Konstantin Belousov To: Jilles Tjoelker Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129205729.GN3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> <20121129162412.GD29338@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s33OSBZCP+C8M/FY" Content-Disposition: inline In-Reply-To: <20121129162412.GD29338@stack.nl> User-Agent: Mutt/1.5.21 (2010-09-15) 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, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 20:57:38 -0000 --s33OSBZCP+C8M/FY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 29, 2012 at 05:24:12PM +0100, Jilles Tjoelker wrote: > On Thu, Nov 29, 2012 at 02:01:47PM +0200, Konstantin Belousov wrote: > > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: > > > Author: eadler > > > Date: Thu Nov 29 05:16:50 2012 > > > New Revision: 243665 > > > URL: http://svnweb.freebsd.org/changeset/base/243665 >=20 > > > Log: > > > Mark non-returning function as such >=20 > > > PR: bin/172978 > > > Approved by: cperciva > > > MFC after: 3 days >=20 > > > Modified: > > > head/sbin/dump/dump.h >=20 > > > Modified: head/sbin/dump/dump.h > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) > > > +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) > > > @@ -121,7 +121,7 @@ void trewind(void); > > > void writerec(char *dp, int isspcl); > > > =20 > > > void Exit(int status) __dead2; > > > -void dumpabort(int signo); > > > +void dumpabort(int signo) __dead2; > > > void dump_getfstab(void); > > > =20 > > > char *rawname(char *cp); >=20 > > What is the goal of this change ? >=20 > This has been discussed before in > http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022179.ht= ml > and the rest of the thread. The result there seems that it is the least > bad thing to add __dead2 even on static functions that do not return to > reduce compiler/analyzer warnings and improve the generated code with > GCC 4.2.1 and GCC 4.5. But we are already in the shiny new world ? We should not care about so antique and unsupported compilers any more ? Or, at least, the commit message should have said that we do. I suppose that the worry about slightly unefficient code in the dump(8) wou= ld be good April 1 subject. >=20 > > It is arguably backward. There is absolutely no use to mark signal > > handler as __dead2, and all other uses do not benefit from the > > redundand declaration. >=20 > Although most of the uses of dumpabort() are in the same file as its > definition, GCC 4.2.1 is too dumb to detect its noreturn property > automatically. >=20 > Furthermore, some of the uses are in separate files. In particular, > __dead2 on dumpabort() is required to mark or detect quit() as noreturn. >=20 > > Also, being quite removed from the function definition, there is a > > chance that some future modification would make the attribute a lie. >=20 > Both GCC and Clang generate a warning by default if it appears possible > for a noreturn function to return, so as long as -Werror remains enabled > it should be safe enough. The annotation is very much like comment which rephrase the code and thus is useless. But in this case, the attribute annotation does has a chance of changing the compiler behaviour. IMO, such changes shall not be done, and the already accumulated nonsense needs to be reverted. --s33OSBZCP+C8M/FY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQt8w4AAoJEJDCuSvBvK1B1gwQAJ0ILgnDl6p7NFlMZJX9Dsg0 Je71RR6hibh8InvO6QSfKkj+QFNIAmjFDAaFrw9YsK1cGCHmN87F8DUncdDyxm/p ZClOsiBErb6eAh6lBXLFpde0FHyEpVZgC0lw1e2+3WPoj3dd2mCIQuYvnC0Afg3d vbENP2A4n+5Ttra6SgwmCueayWxw24IQE1uE1u+JETxkdqpeyW6iP6cpYFN4ueuJ MNglJ9lDhRa6Q3aekAS6ktx6Na5Ac0QC0yRNnz1WWhF/1kecL8y3kOqe29Gqsepo Rmr6tLkv+FhASybLC3AB1HIY8nunihnZ/x7QFHuTzqc+7B93bCWWBeOBNDulniVL ERx/k+x2SjzJyeZHR1Y6jZd63+aH5KfKGVZNSfRdWzueTdLsP9OW02emy06PoG7O 32pPmsy945/bTdLHqAh3caTW/QJ5IIdj1RVJ7TGqXYyhsOxik3LbDMzEDCQLPT6g vOqSXtyxGAGZpJXk1VLbMr0WYGtN/gPX7FIIviX6i7RgH8qcLH943ILZ5j4fR43+ bO2JWVTYJvUndkxwDmnXaqiltB8SfLH77K+yxejcCIQzmer4A8U6PwLe/SUOJj5q bcgbAa1UcnRFLs8h7eYh6gIo8WtIDLy0LcTu4OfJ/E/8c/R4GfifNKkBRiu0uyRN cHmu3THybrHfyZd8OUS4 =05Qe -----END PGP SIGNATURE----- --s33OSBZCP+C8M/FY-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 20:58:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3E247A83; Thu, 29 Nov 2012 20:58:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 96ED68FC16; Thu, 29 Nov 2012 20:58:19 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qATKwG9C009949; Thu, 29 Nov 2012 22:58:16 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qATKwG9C009949 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qATKwGLj009948; Thu, 29 Nov 2012 22:58:16 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Nov 2012 22:58:16 +0200 From: Konstantin Belousov To: Eitan Adler Subject: Re: svn commit: r243665 - head/sbin/dump Message-ID: <20121129205816.GO3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> <20121129130449.GH3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9ZRxqsK4bBEmgNeO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 20:58:20 -0000 --9ZRxqsK4bBEmgNeO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 29, 2012 at 10:15:54AM -0500, Eitan Adler wrote: > On 29 November 2012 08:04, Konstantin Belousov wrot= e: > >> It fixes some static analyzer warnings. > > This cannot be a reason to cripple the code. >=20 > How is the code crippled? I described it in the part of the first message, which you stripped. --9ZRxqsK4bBEmgNeO Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQt8xmAAoJEJDCuSvBvK1ByKoP/iydkwHdl7nOlWcoQOpQnnEF qVY2OE5XzVVr935ojF/3b7KL9W91n1T7mMb4dnK+ZtEc8g4aFlQxCPe+FgxT3Rfd 7wQ8SQ/PILwwk1ttpWv1nHDwo40T3sNAgBdgwQi/LFte4PABERbkXOGiSFTIHSZ4 PuyMitfB4c4l/DDwfVOKFupRikTlvU5V8ArZ/muXJ4yb6MOYFtn8U35WrKISHyVC AcZIQGQmyKnWTx9bXf8T3VwAivQ50lRG5apZwp2X7uQcPzZ3nTunrfqNzBHUHjKu oTtIecbLT96XAduEbrvdH63BKxYc+CZwT9D8+QBnPCfD+HH92D13veokjDfeia0b 7dy3xb7SBHDeyjmknUY4E8WJshNzwnrW1r8DBu1wwU7ql0KzFqTPR29CkVIiIC/l ef0oboOXmov41gtqF1mZzRreJ+Wivx9YiLQLCxr77uCYX8wmL48jmZi+ooATzuSo 1JbdEnZPMbLPsGiVhfOaXOI/UQEQBefNWBYbs6Qs9GulHiP0z/pHjg/YLM2qTupL 944X8kcoNSODR8StMw0THP29vH4BRgv1t4mKBG35siZxjc3ubNv6fnRrxNFeTUuB mq1ijMeCieTlGOtCkI5LPoX5Tz+eBPt9lZ0byjtGIar+J7YgC1qusNhDeJEoMbPY U2XVV2aeXSRcl7wbt/o/ =97vL -----END PGP SIGNATURE----- --9ZRxqsK4bBEmgNeO-- From owner-svn-src-head@FreeBSD.ORG Thu Nov 29 23:39:29 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06108A04; Thu, 29 Nov 2012 23:39:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 8BC958FC12; Thu, 29 Nov 2012 23:39:28 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qATNdNdZ017356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Nov 2012 10:39:24 +1100 Date: Fri, 30 Nov 2012 10:39:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r243665 - head/sbin/dump In-Reply-To: <20121129205729.GN3013@kib.kiev.ua> Message-ID: <20121130100508.R1242@besplex.bde.org> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> <20121129162412.GD29338@stack.nl> <20121129205729.GN3013@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Zr21sKHG c=1 sm=1 a=L02UnmsDQJIA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=rj3hlHQjMzkA:10 a=6I5d2MoRAAAA:8 a=mr-JSwSOzfl-SWpwChUA:9 a=CjuIK1q_8ugA:10 a=OJY-0xXhBfMA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , Jilles Tjoelker X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 23:39:29 -0000 On Thu, 29 Nov 2012, Konstantin Belousov wrote: > On Thu, Nov 29, 2012 at 05:24:12PM +0100, Jilles Tjoelker wrote: >> On Thu, Nov 29, 2012 at 02:01:47PM +0200, Konstantin Belousov wrote: >>> On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: >>>> Log: >>>> Mark non-returning function as such >> >>>> PR: bin/172978 >>>> Approved by: cperciva >>>> MFC after: 3 days >> >>>> Modified: >>>> head/sbin/dump/dump.h >> >>>> Modified: head/sbin/dump/dump.h >>>> ============================================================================== >>>> --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 (r243664) >>>> +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 (r243665) >>>> @@ -121,7 +121,7 @@ void trewind(void); >>>> void writerec(char *dp, int isspcl); >>>> >>>> void Exit(int status) __dead2; >>>> -void dumpabort(int signo); >>>> +void dumpabort(int signo) __dead2; >>>> void dump_getfstab(void); >>>> >>>> char *rawname(char *cp); >> >>> What is the goal of this change ? It seems reasonable. The function is not static, so compilers can't always see that it is no-return. But I think most older uses of __dead2 for static functions are like uses of the register keyword. >> This has been discussed before in >> http://lists.freebsd.org/pipermail/freebsd-current/2011-January/022179.html >> and the rest of the thread. The result there seems that it is the least >> bad thing to add __dead2 even on static functions that do not return to >> reduce compiler/analyzer warnings and improve the generated code with >> GCC 4.2.1 and GCC 4.5. > But we are already in the shiny new world ? We should not care about so > antique and unsupported compilers any more ? > Or, at least, the commit message should have said that we do. > > I suppose that the worry about slightly unefficient code in the dump(8) would > be good April 1 subject. >> >>> It is arguably backward. There is absolutely no use to mark signal >>> handler as __dead2, and all other uses do not benefit from the >>> redundand declaration. >> >> Although most of the uses of dumpabort() are in the same file as its >> definition, GCC 4.2.1 is too dumb to detect its noreturn property >> automatically. >> >> Furthermore, some of the uses are in separate files. In particular, >> __dead2 on dumpabort() is required to mark or detect quit() as noreturn. >> >>> Also, being quite removed from the function definition, there is a >>> chance that some future modification would make the attribute a lie. >> >> Both GCC and Clang generate a warning by default if it appears possible >> for a noreturn function to return, so as long as -Werror remains enabled >> it should be safe enough. > > The annotation is very much like comment which rephrase the code and thus is > useless. But in this case, the attribute annotation does has a chance of > changing the compiler behaviour. > > IMO, such changes shall not be done, and the already accumulated nonsense > needs to be reverted. The only problem that I see is that the change obfuscates the actual bugs: - dumpabort() is a normal function that is used as a signal handler - the use of dumpabort() as a signal handler is not just a style bug, since it is very async-signal unsafe and thus cannot be used as a (non-broken) signal handler. Similar bugs were fixed in the less-critical application dd(1). Even in 4.4BSD, the signal handler summaryx() was safe (it used and still uses a combination of snprintf() and write()), and the only fix needed was to chane exit() to _exit() in the signal handler terminate(). dumpabort() does much more than exit() in some cases, so it is harder to fix. dd was presumably more correct since signals occur in normal operation so races in the signal handling would have been more obvious. I'm not happy with some other fixes for unsafe signal handlers. The ones in ping and top are still broken AFAIK. Just setting a flag in the signal and checking the in the main loop doesn't work if any syscall is restarted. In top, the read() syscall is restarted, so top is broken for signal that occur in its read() loop (e.g., for responding to the prompt for the 's' command). So SA_RESTART should be kept clear for most signals. But then every syscall has to check for EINTR. This is a burden and is not done by top, although it is probably manageable for top (there aren't any (?) syscalls other than the one in the read() loop to check). ping is more careful and keeps SA_RESTART clear, but it is still broken when the resolver library restarts. Libraries in general might not handle the EINTR's from !SA_RESTART properly, but in the resolver library the problem is sort of the opposite: at least in very old versions that use select(), EINTR is normal but the resolvier library doesn't want to return for EINTR, so it restarts at the library level and thus the main loop in ping is never reached in another way. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 00:07:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CE552F03; Fri, 30 Nov 2012 00:07:11 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.net.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id AC10A8FC0C; Fri, 30 Nov 2012 00:07:10 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqAEAMf3t1CDaFvO/2dsb2JhbABEFoYWuXBzgh4BAQQBI1YFFg4GBAICDRkCWQaIEQMJBgysLYkFDYlUgSKLHoMugRMDiF6NI4EcjyiDEIID X-IronPort-AV: E=Sophos;i="4.84,188,1355115600"; d="scan'208";a="2656235" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu.net.uoguelph.ca with ESMTP; 29 Nov 2012 19:07:02 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id B5138B4060; Thu, 29 Nov 2012 19:07:02 -0500 (EST) Date: Thu, 29 Nov 2012 19:07:02 -0500 (EST) From: Rick Macklem To: Mateusz Guzik Message-ID: <1665336113.1002130.1354234022710.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20121129003853.GB22327@dft-labs.eu> Subject: Re: svn commit: r243645 - head/usr.sbin/nfsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Alfred Perlstein X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 00:07:12 -0000 Mateusz Guzik wrote: > On Wed, Nov 28, 2012 at 07:14:23PM -0500, Rick Macklem wrote: > > Mateusz Guzik wrote: > > > On Wed, Nov 28, 2012 at 02:47:32AM +0000, Alfred Perlstein wrote: > > > > Author: alfred > > > > Date: Wed Nov 28 02:47:31 2012 > > > > New Revision: 243645 > > > > URL: http://svnweb.freebsd.org/changeset/base/243645 > > > > > > > > Log: > > > > Don't allow minthreads > maxthreads. > > > > > > > Should not this be also checked in the kernel? Looks like > > > nfssvc_nfsd > > > is > > > trustful: > > > > > Well, since only root can do this and I can't think of why a > > sysadmin > > would use anything other than nfsd, I'm not sure it matters much? > > (But I don't see a problem with adding a sanity check in the kernel > > code.) > > > > It's nothing serious and I'm not going to insist, especially since > this > is your code. It's not my code, it's the collective's code. (For want of a better term for the FreeBSD project.;-) Also, I wasn't the author of the krpc related stuff (which these thread limits are a part of). I just cloned it from the old NFS server for the new one. > I just prefer the kernel to be resistant if it does not > cost much. > > I had something like this in mind (untested): > http://people.freebsd.org/~mjg/patches/nfs-threads-check.diff > Since it was alfred@'s patch, I'll let him decide. As I said before, I have no problem with adding the check to the kernel. Have fun with it, rick > -- > Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 00:09:22 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E793103; Fri, 30 Nov 2012 00:09:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 19B648FC0C; Fri, 30 Nov 2012 00:09:21 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAU09BXf008546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Nov 2012 11:09:13 +1100 Date: Fri, 30 Nov 2012 11:09:11 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler Subject: Re: svn commit: r243670 - head/share/man/man5 In-Reply-To: <201211291251.qATCpA7w078277@svn.freebsd.org> Message-ID: <20121130110154.E1441@besplex.bde.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Zr21sKHG c=1 sm=1 a=bvcLnixDC-gA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=TdF0Wd7UlPIA:10 a=6I5d2MoRAAAA:8 a=WaMP1lU5r4K276wGbWcA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 00:09:22 -0000 On Thu, 29 Nov 2012, Eitan Adler wrote: > Log: > Generalize make.conf man page: use "cc" instead of "gcc" > > PR: misc/173604 > Submitted by: Dan McGregor > Approved by: bcr (mentor) > MFC after: 3 days "gcc" was mostly correct here, since the flags are unportable gcc ones. They don't work with any "cc", but may work with clang, although this is unclear since none of them is documented in clang(1). > Modified: head/share/man/man5/make.conf.5 > ============================================================================== > --- head/share/man/man5/make.conf.5 Thu Nov 29 08:06:23 2012 (r243669) > +++ head/share/man/man5/make.conf.5 Thu Nov 29 12:51:10 2012 (r243670) > @@ -143,7 +143,7 @@ and > are not supported. > .Va BDECFLAGS > is provided as a set of > -.Xr gcc 1 > +.Xr cc 1 > settings suggested by > .An "Bruce Evans" Aq bde@FreeBSD.org > for developing and testing changes. However, I never would have agreed to putting any of them here. Lots here is now superseded by flags set by WARNS anyway. clang's even more unportable new flags are not documented in clang(1) and the settings here are too old to have dreamed of these. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 00:15:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2902242F for ; Fri, 30 Nov 2012 00:15:56 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8C3C58FC18 for ; Fri, 30 Nov 2012 00:15:55 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id j13so14864787lah.13 for ; Thu, 29 Nov 2012 16:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=umjPM7gCTmT/0LwQgwimVOa/hsSzHu4769NHpwhl0LY=; b=eK57JD+DEbqc15saLSoCBpmnn0GievA6ciaRMD5Y2bFJZMHKJ2yn1wuJDRsc6iuoVm IOwwSbaAUL8ksl+CdLhuvjsmjVMYwJhk/B3urMmd973Y+1wSSqnhBILHsKvfbF1V145o O1yuBjOiSP38CyQ6t8ppHzhlNzDtjB+QTlJ1c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=umjPM7gCTmT/0LwQgwimVOa/hsSzHu4769NHpwhl0LY=; b=DPEbw7t1ek6WOWsLj4Qqtga5OOgEGIE4hFHFLTrR1WUY0c5Saa2PMU6dgN1Clr0ZPZ 3O7nI5QiKtjN8QMbUDhV5208sxvxUk6moL76Tfc8mouu6MZUoDDg9HrrdTJPX7zvOjb4 4czMVomlP4DQ13JhQye4GCBErPgGqnzs0AyC+6d6XXjfYw6sI3XcYBfmzSDNZNdvm0Ey YPBDMy7/ILn0SyJg3hsfWg8NzlEtF3MxKGTu+R8n3JsbtJjdGMVfJQrqGSEl6/OyEjZz EmhfHaSTycAyIKqlP7WZZ/HrhVFStZKwsPcB11Bf2Ap22+RSBWZKl3Wvo2Pgc1f9TIxG T7ww== Received: by 10.112.17.170 with SMTP id p10mr90922lbd.53.1354234554038; Thu, 29 Nov 2012 16:15:54 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Thu, 29 Nov 2012 16:15:23 -0800 (PST) In-Reply-To: <20121130110154.E1441@besplex.bde.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> <20121130110154.E1441@besplex.bde.org> From: Eitan Adler Date: Thu, 29 Nov 2012 19:15:23 -0500 X-Google-Sender-Auth: Hg9N7v240W7HZpxO6ncdE1Za5PM Message-ID: Subject: Re: svn commit: r243670 - head/share/man/man5 To: Bruce Evans Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkqJDYT/rfHWBiWZnE4QUyapTkZ6j6NlLiIzsFdiJfcvr10r/Si4PiHJ955kCz/3PM4zifJ Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 00:15:56 -0000 On 29 November 2012 19:09, Bruce Evans wrote: > On Thu, 29 Nov 2012, Eitan Adler wrote: > "gcc" was mostly correct here, since the flags are unportable gcc ones. > They don't work with any "cc", but may work with clang, although this > is unclear since none of them is documented in clang(1). Every time I talk to the clang folk about flags they point me to gcc documentation. > However, I never would have agreed to putting any of them here. > > Lots here is now superseded by flags set by WARNS anyway. > > clang's even more unportable new flags are not documented in clang(1) > and the settings here are too old to have dreamed of these. The reference to BDECFLAGS actually isn't true - there is no such variable. There is a *commented out* version which I had planned to email you about at some point. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 00:19:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7943672 for ; Fri, 30 Nov 2012 00:19:07 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 337AA8FC0C for ; Fri, 30 Nov 2012 00:19:06 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so54171lbb.13 for ; Thu, 29 Nov 2012 16:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=qb0vbC3JRACClkpqBuOk9GAmS4B5mL/+yw8QurzdulE=; b=kU6MhQq+F7etiImixSpGTbCEo3jWr/ou+er0xtFbN1GSd4P4TpwIrJRYA3ifEBIMh0 4117RGERCbEotKbDYfh+NQ6e2KOT0JT42ZJhT0BbfHzUvHPK5p2OM9sSHU3KG81yDZCX cDkYN62d0k3J+qMI/Jauc2/ZJ/eWvo9VTF6Oo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=qb0vbC3JRACClkpqBuOk9GAmS4B5mL/+yw8QurzdulE=; b=iMOyBjcblQ+bjNSt5DND3uqr+K7xVQ+7k2OIR6b9c+FtRIb41K1AAKyhask3lCCu0J MBbJ2wqe1I35FTSi5XYaLZr/aL5srQbbpkxm7i1XwvpL7ujIgE7LBqj8v2uQggYC05za Rm0gqIi7xnmRwQnuUYtJbkCR8Tqp+quPYiAuzgGrM7UuXTB2gg4OUyLOdNJsZHQMDs0H c+4zXvMsZNFu4r4Ky4qgVy42YooKmOAG0ZUmPbe9NJmKFe4ygEAPxGTQ1Q27fzK9MCJP ePScB8tx9lK7/bzLObRhRGJ9IQbgcnMfPxdPlj7lndRfcHkODPUz/OCFqbRzRpdu+/wA 7A2A== Received: by 10.152.105.103 with SMTP id gl7mr23141783lab.10.1354234746094; Thu, 29 Nov 2012 16:19:06 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Thu, 29 Nov 2012 16:18:35 -0800 (PST) In-Reply-To: <20121129205729.GN3013@kib.kiev.ua> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> <20121129162412.GD29338@stack.nl> <20121129205729.GN3013@kib.kiev.ua> From: Eitan Adler Date: Thu, 29 Nov 2012 19:18:35 -0500 X-Google-Sender-Auth: jmtyCgqPpYJmF9eXxwb0AQM0YB8 Message-ID: Subject: Re: svn commit: r243665 - head/sbin/dump To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQluH6Ww7kb+uu84H4bwJgE1yV0rUBvk8z1/oDdImYNkyUungAAS6U+jJDZvrm+Je8ceejK/ Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Jilles Tjoelker X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 00:19:07 -0000 On 29 November 2012 15:57, Konstantin Belousov wrote: > IMO, such changes shall not be done, and the already accumulated nonsense > needs to be reverted. It causes no harm, and helps reduce the number of false positives in the clang static analyzer code so I fail to see why this should be reverted. This isn't akin to a comment as it changes the behavior of at least one helpful tool. Any future change which changed the return behavior of the function would cause an error (due to -Werror) and then the attribute could be changed. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 00:59:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2CF97BE6; Fri, 30 Nov 2012 00:59:38 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1075E8FC14; Fri, 30 Nov 2012 00:59:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU0xbRk086991; Fri, 30 Nov 2012 00:59:37 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU0xbc1086989; Fri, 30 Nov 2012 00:59:37 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201211300059.qAU0xbc1086989@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 30 Nov 2012 00:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243685 - in head/sys: amd64/pci i386/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 00:59:38 -0000 Author: jkim Date: Fri Nov 30 00:59:37 2012 New Revision: 243685 URL: http://svnweb.freebsd.org/changeset/base/243685 Log: Tidy up inline assembly. No functional change. Modified: head/sys/amd64/pci/pci_cfgreg.c head/sys/i386/pci/pci_cfgreg.c Modified: head/sys/amd64/pci/pci_cfgreg.c ============================================================================== --- head/sys/amd64/pci/pci_cfgreg.c Fri Nov 30 00:13:31 2012 (r243684) +++ head/sys/amd64/pci/pci_cfgreg.c Fri Nov 30 00:59:37 2012 (r243685) @@ -324,15 +324,15 @@ pciereg_cfgread(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("mov %1, %%eax" : "=a" (data) + __asm __volatile("movl %1, %0" : "=a" (data) : "m" (*(uint32_t *)va)); break; case 2: - __asm __volatile("movzwl %1, %%eax" : "=a" (data) + __asm __volatile("movzwl %1, %0" : "=a" (data) : "m" (*(uint16_t *)va)); break; case 1: - __asm __volatile("movzbl %1, %%eax" : "=a" (data) + __asm __volatile("movzbl %1, %0" : "=a" (data) : "m" (*(uint8_t *)va)); break; } @@ -354,16 +354,16 @@ pciereg_cfgwrite(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("mov %%eax, %0" : "=m" (*(uint32_t *)va) + __asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va) : "a" (data)); break; case 2: - __asm __volatile("mov %%ax, %0" : "=m" (*(uint16_t *)va) - : "a" (data)); + __asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va) + : "a" ((uint16_t)data)); break; case 1: - __asm __volatile("mov %%al, %0" : "=m" (*(uint8_t *)va) - : "a" (data)); + __asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va) + : "a" ((uint8_t)data)); break; } } Modified: head/sys/i386/pci/pci_cfgreg.c ============================================================================== --- head/sys/i386/pci/pci_cfgreg.c Fri Nov 30 00:13:31 2012 (r243684) +++ head/sys/i386/pci/pci_cfgreg.c Fri Nov 30 00:59:37 2012 (r243685) @@ -681,15 +681,15 @@ pciereg_cfgread(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("mov %1, %%eax" : "=a" (data) + __asm __volatile("movl %1, %0" : "=a" (data) : "m" (*(uint32_t *)va)); break; case 2: - __asm __volatile("movzwl %1, %%eax" : "=a" (data) + __asm __volatile("movzwl %1, %0" : "=a" (data) : "m" (*(uint16_t *)va)); break; case 1: - __asm __volatile("movzbl %1, %%eax" : "=a" (data) + __asm __volatile("movzbl %1, %0" : "=a" (data) : "m" (*(uint8_t *)va)); break; } @@ -718,16 +718,16 @@ pciereg_cfgwrite(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("mov %%eax, %0" : "=m" (*(uint32_t *)va) + __asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va) : "a" (data)); break; case 2: - __asm __volatile("mov %%ax, %0" : "=m" (*(uint16_t *)va) - : "a" (data)); + __asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va) + : "a" ((uint16_t)data)); break; case 1: - __asm __volatile("mov %%al, %0" : "=m" (*(uint8_t *)va) - : "a" (data)); + __asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va) + : "a" ((uint8_t)data)); break; } From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 01:13:37 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B09AE56; Fri, 30 Nov 2012 01:13:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id D46348FC0C; Fri, 30 Nov 2012 01:13:36 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAU1DVPB012214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Nov 2012 12:13:33 +1100 Date: Fri, 30 Nov 2012 12:13:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler Subject: Re: svn commit: r243670 - head/share/man/man5 In-Reply-To: Message-ID: <20121130121105.W1707@besplex.bde.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> <20121130110154.E1441@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=FoRdZBXq c=1 sm=1 a=bvcLnixDC-gA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=TdF0Wd7UlPIA:10 a=wAwkY7PBfuqKK9cADVEA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 01:13:37 -0000 On Thu, 29 Nov 2012, Eitan Adler wrote: > On 29 November 2012 19:09, Bruce Evans wrote: >> On Thu, 29 Nov 2012, Eitan Adler wrote: > >> "gcc" was mostly correct here, since the flags are unportable gcc ones. >> They don't work with any "cc", but may work with clang, although this >> is unclear since none of them is documented in clang(1). > > Every time I talk to the clang folk about flags they point me to gcc > documentation. That's where I look too. It doesn't cover clang extensions. >> However, I never would have agreed to putting any of them here. >> >> Lots here is now superseded by flags set by WARNS anyway. >> >> clang's even more unportable new flags are not documented in clang(1) >> and the settings here are too old to have dreamed of these. > > The reference to BDECFLAGS actually isn't true - there is no such > variable. There is a *commented out* version which I had planned to > email you about at some point. The whole file src/share/examples/etc consists of commented-out examples and comments about the examples, with most of its value in the latter. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 01:37:07 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95BB3312; Fri, 30 Nov 2012 01:37:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 27A4C8FC14; Fri, 30 Nov 2012 01:37:06 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAU1atk9018159 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Nov 2012 12:36:57 +1100 Date: Fri, 30 Nov 2012 12:36:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans Subject: Re: svn commit: r243670 - head/share/man/man5 In-Reply-To: <20121130121105.W1707@besplex.bde.org> Message-ID: <20121130121426.X1735@besplex.bde.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> <20121130110154.E1441@besplex.bde.org> <20121130121105.W1707@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=e5de0tV/ c=1 sm=1 a=bvcLnixDC-gA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=TdF0Wd7UlPIA:10 a=hT-wbfSIKCv8klB7IyYA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 01:37:07 -0000 On Fri, 30 Nov 2012, Bruce Evans wrote: > On Thu, 29 Nov 2012, Eitan Adler wrote: >> ... >> The reference to BDECFLAGS actually isn't true - there is no such >> variable. There is a *commented out* version which I had planned to >> email you about at some point. > > The whole file src/share/examples/etc consists of commented-out examples > and comments about the examples, with most of its value in the latter. PS: ... with many bad examples and no comments about the difficulty of changing or extending the defaultes in sys.mk using /etc/make.conf or the bugs if the bad examples are uncommented. Redefining CFLAGS is especially problematic. sys.mk uses "?=" on CFLAGS so that the command line has precedence. That doesn't work in /etc/make.conf, since CFLAGS is always defined when it is included. The correct fix is to include /etc/make.conf near the start of sys.mk and use "?=" in it. I'm not sure why that wasn't always done, but seem to remember some technical problems with this order too. I just use ifdefs like the following in /etc/make.conf: % .if ${CFLAGS} == "-O -pipe" % CFLAGS+= -mcpu=athlon-xp % .endif This adds to CFLAGS if and only if CFLAGS is identical to the default in sys.mk (with older sys.mk that hasn't been broken to default to -O2). % # CPUTYPE= athlon-xp I don't believe in using CPUTYPE or bsd.cpu.mk. If you use them, then the it becomes even more difficult to change or extend the defaults in all the nested include files. You have to look up the undocumented implementation details for the defaults and figure out where to put the changes. bsd.cpu.mk happens to be included after /etc/make.conf, so extending it in /etc/make.conf is impossible. It probably cannot be controlled by earlier settings, short of turning it all off. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 01:38:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E713484; Fri, 30 Nov 2012 01:38:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1476C8FC0C; Fri, 30 Nov 2012 01:38:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU1c0lp092237; Fri, 30 Nov 2012 01:38:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU1c092092235; Fri, 30 Nov 2012 01:38:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201211300138.qAU1c092092235@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 30 Nov 2012 01:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243686 - head/sys/dev/bge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 01:38:01 -0000 Author: yongari Date: Fri Nov 30 01:38:00 2012 New Revision: 243686 URL: http://svnweb.freebsd.org/changeset/base/243686 Log: Add preliminary support for BCM57766 ASIC. While I'm here add BCM57762 device id which is found on Apple Thunderbolt ethernet. Tested by: Richard Kuhns < rjk <> wintek dot com > Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Fri Nov 30 00:59:37 2012 (r243685) +++ head/sys/dev/bge/if_bge.c Fri Nov 30 01:38:00 2012 (r243686) @@ -216,7 +216,9 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5906M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57760 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57761 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57762 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57765 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM57766 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57780 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57781 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM57785 }, @@ -347,6 +349,7 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { BGE_ASICREV_BCM57765, "unknown BCM57765" }, + { BGE_ASICREV_BCM57766, "unknown BCM57766" }, { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, @@ -362,6 +365,7 @@ static const struct bge_revision bge_maj #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) #define BGE_IS_5717_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5717_PLUS) +#define BGE_IS_57765_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_57765_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -2243,7 +2247,7 @@ bge_blockinit(struct bge_softc *sc) } else if (!BGE_IS_5705_PLUS(sc)) limit = BGE_RX_RINGS_MAX; else if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) + BGE_IS_57765_PLUS(sc)) limit = 4; else limit = 1; @@ -2657,7 +2661,9 @@ bge_probe(device_t dev) BGE_PCI_GEN2_PRODID_ASICREV, 4); break; case BCOM_DEVICEID_BCM57761: + case BCOM_DEVICEID_BCM57762: case BCOM_DEVICEID_BCM57765: + case BCOM_DEVICEID_BCM57766: case BCOM_DEVICEID_BCM57781: case BCOM_DEVICEID_BCM57785: case BCOM_DEVICEID_BCM57791: @@ -3258,7 +3264,9 @@ bge_attach(device_t dev) BGE_PCI_GEN2_PRODID_ASICREV, 4); break; case BCOM_DEVICEID_BCM57761: + case BCOM_DEVICEID_BCM57762: case BCOM_DEVICEID_BCM57765: + case BCOM_DEVICEID_BCM57766: case BCOM_DEVICEID_BCM57781: case BCOM_DEVICEID_BCM57785: case BCOM_DEVICEID_BCM57791: @@ -3321,10 +3329,13 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM57765: + case BGE_ASICREV_BCM57766: + sc->bge_flags |= BGE_FLAG_57765_PLUS; + /* FALLTHROUGH */ case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: case BGE_ASICREV_BCM5720: - case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | BGE_FLAG_JUMBO_FRAME; @@ -3738,12 +3749,9 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_NO_3LED; if ((BGE_IS_5705_PLUS(sc)) && sc->bge_asicrev != BGE_ASICREV_BCM5906 && - sc->bge_asicrev != BGE_ASICREV_BCM5717 && - sc->bge_asicrev != BGE_ASICREV_BCM5719 && - sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && - sc->bge_asicrev != BGE_ASICREV_BCM57765 && - sc->bge_asicrev != BGE_ASICREV_BCM57780) { + sc->bge_asicrev != BGE_ASICREV_BCM57780 && + !BGE_IS_5717_PLUS(sc)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Fri Nov 30 00:59:37 2012 (r243685) +++ head/sys/dev/bge/if_bgereg.h Fri Nov 30 01:38:00 2012 (r243686) @@ -360,6 +360,7 @@ #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 #define BGE_ASICREV_BCM57765 0x57785 +#define BGE_ASICREV_BCM57766 0x57766 #define BGE_ASICREV_BCM57780 0x57780 /* chip revisions */ @@ -2483,7 +2484,9 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5906M 0x1713 #define BCOM_DEVICEID_BCM57760 0x1690 #define BCOM_DEVICEID_BCM57761 0x16B0 +#define BCOM_DEVICEID_BCM57762 0x1682 #define BCOM_DEVICEID_BCM57765 0x16B4 +#define BCOM_DEVICEID_BCM57766 0x1686 #define BCOM_DEVICEID_BCM57780 0x1692 #define BCOM_DEVICEID_BCM57781 0x16B1 #define BCOM_DEVICEID_BCM57785 0x16B5 @@ -2961,6 +2964,7 @@ struct bge_softc { #define BGE_FLAG_5755_PLUS 0x00100000 #define BGE_FLAG_5788 0x00200000 #define BGE_FLAG_5717_PLUS 0x00400000 +#define BGE_FLAG_57765_PLUS 0x00800000 #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 02:31:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4317B90; Fri, 30 Nov 2012 02:31:08 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B77748FC08; Fri, 30 Nov 2012 02:31:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU2V8pZ099371; Fri, 30 Nov 2012 02:31:08 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU2V8Tq099370; Fri, 30 Nov 2012 02:31:08 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300231.qAU2V8Tq099370@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 02:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243687 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 02:31:09 -0000 Author: gonzo Date: Fri Nov 30 02:31:08 2012 New Revision: 243687 URL: http://svnweb.freebsd.org/changeset/base/243687 Log: Fix RGB565 case Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Nov 30 01:38:00 2012 (r243686) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c Fri Nov 30 02:31:08 2012 (r243687) @@ -776,11 +776,11 @@ bcmfb_putc(video_adapter_t *adp, vm_offs addr[3*j+2] = bcmfb_palette[color].b; break; case 16: - rgb = (bcmfb_palette[color].r >> 3) << 10; - rgb |= (bcmfb_palette[color].g >> 3) << 5; + rgb = (bcmfb_palette[color].r >> 3) << 11; + rgb |= (bcmfb_palette[color].g >> 2) << 5; rgb |= (bcmfb_palette[color].b >> 3); - addr[2*j] = (rgb >> 8) & 0xff; - addr[2*j + 1] = rgb & 0xff; + addr[2*j] = rgb & 0xff; + addr[2*j + 1] = (rgb >> 8) & 0xff; default: /* Not supported yet */ break; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 02:32:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA5DED0D; Fri, 30 Nov 2012 02:32:38 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 717AE8FC08; Fri, 30 Nov 2012 02:32:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU2WcAb099570; Fri, 30 Nov 2012 02:32:38 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU2WcTA099569; Fri, 30 Nov 2012 02:32:38 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300232.qAU2WcTA099569@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 02:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243688 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 02:32:38 -0000 Author: gonzo Date: Fri Nov 30 02:32:37 2012 New Revision: 243688 URL: http://svnweb.freebsd.org/changeset/base/243688 Log: Get frequency from "clock-frequency" property of "/axi/sdhci" FDT node Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 30 02:31:08 2012 (r243687) +++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Fri Nov 30 02:32:37 2012 (r243688) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -66,6 +67,8 @@ __FBSDID("$FreeBSD$"); #include #include "sdhci_if.h" +#define BCM2835_DEFAULT_SDHCI_FREQ 50 + #define DEBUG #ifdef DEBUG @@ -129,10 +132,20 @@ bcm_sdhci_attach(device_t dev) { struct bcm_sdhci_softc *sc = device_get_softc(dev); int rid, err; + phandle_t node; + pcell_t cell; + int default_freq; sc->sc_dev = dev; sc->sc_req = NULL; + default_freq = BCM2835_DEFAULT_SDHCI_FREQ; + node = ofw_bus_get_node(sc->sc_dev); + if ((OF_getprop(node, "clock-frequency", &cell, sizeof(cell))) > 0) + default_freq = (int)fdt32_to_cpu(cell)/1000000; + + dprintf("SDHCI frequency: %dMHz\n", default_freq); + mtx_init(&sc->sc_mtx, "bcm sdhci", "sdhci", MTX_DEF); rid = 0; @@ -168,7 +181,7 @@ bcm_sdhci_attach(device_t dev) } sc->sc_slot.caps = SDHCI_CAN_VDD_330 | SDHCI_CAN_VDD_180 | SDHCI_CAN_DO_HISPD; - sc->sc_slot.caps |= (50 << SDHCI_CLOCK_BASE_SHIFT); + sc->sc_slot.caps |= (default_freq << SDHCI_CLOCK_BASE_SHIFT); sc->sc_slot.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_MISSING_CAPS; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 02:35:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB6A7E97; Fri, 30 Nov 2012 02:35:13 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 950948FC08; Fri, 30 Nov 2012 02:35:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU2ZDHg099935; Fri, 30 Nov 2012 02:35:13 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU2ZDYR099933; Fri, 30 Nov 2012 02:35:13 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300235.qAU2ZDYR099933@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 02:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243689 - head/sys/dev/sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 02:35:13 -0000 Author: gonzo Date: Fri Nov 30 02:35:13 2012 New Revision: 243689 URL: http://svnweb.freebsd.org/changeset/base/243689 Log: - Get proper maximum clock frequency for SDHCI v3.0 and higher Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Fri Nov 30 02:32:37 2012 (r243688) +++ head/sys/dev/sdhci/sdhci.c Fri Nov 30 02:35:13 2012 (r243689) @@ -96,6 +96,8 @@ static void sdhci_card_task(void *, int) #define SDHCI_ASSERT_LOCKED(_slot) mtx_assert(&_slot->mtx, MA_OWNED); #define SDHCI_ASSERT_UNLOCKED(_slot) mtx_assert(&_slot->mtx, MA_NOTOWNED); +#define SDHCI_DEFAULT_MAX_FREQ 50 + static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { @@ -516,12 +518,16 @@ sdhci_init_slot(device_t dev, struct sdh else caps = RD4(slot, SDHCI_CAPABILITIES); /* Calculate base clock frequency. */ - slot->max_clk = - (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; + if (slot->version >= SDHCI_SPEC_300) + slot->max_clk = (caps & SDHCI_CLOCK_V3_BASE_MASK) + >> SDHCI_CLOCK_BASE_SHIFT; + else + slot->max_clk = (caps & SDHCI_CLOCK_BASE_MASK) + >> SDHCI_CLOCK_BASE_SHIFT; if (slot->max_clk == 0) { - slot->max_clk = 50; + slot->max_clk = SDHCI_DEFAULT_MAX_FREQ; device_printf(dev, "Hardware doesn't specify base clock " - "frequency.\n"); + "frequency, using %dMHz as default.\n", SDHCI_DEFAULT_MAX_FREQ); } slot->max_clk *= 1000000; /* Calculate timeout clock frequency. */ Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Fri Nov 30 02:32:37 2012 (r243688) +++ head/sys/dev/sdhci/sdhci.h Fri Nov 30 02:35:13 2012 (r243689) @@ -191,6 +191,7 @@ #define SDHCI_TIMEOUT_CLK_SHIFT 0 #define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 #define SDHCI_CLOCK_BASE_MASK 0x00003F00 +#define SDHCI_CLOCK_V3_BASE_MASK 0x0000FF00 #define SDHCI_CLOCK_BASE_SHIFT 8 #define SDHCI_MAX_BLOCK_MASK 0x00030000 #define SDHCI_MAX_BLOCK_SHIFT 16 From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 03:08:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 100C3C40; Fri, 30 Nov 2012 03:08:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E83498FC0C; Fri, 30 Nov 2012 03:08:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU38nS6005120; Fri, 30 Nov 2012 03:08:49 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU38nQe005118; Fri, 30 Nov 2012 03:08:49 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300308.qAU38nQe005118@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 03:08:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243690 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 03:08:50 -0000 Author: gonzo Date: Fri Nov 30 03:08:49 2012 New Revision: 243690 URL: http://svnweb.freebsd.org/changeset/base/243690 Log: Add fdt_get_reserved_regions function. API is simmilar to fdt_get_mem_regions It returns memory regions restricted from being used by kernel. These regions are dfined in "memreserve" property of root node in the same format as "reg" property of /memory node Modified: head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Fri Nov 30 02:35:13 2012 (r243689) +++ head/sys/dev/fdt/fdt_common.c Fri Nov 30 03:08:49 2012 (r243690) @@ -634,6 +634,66 @@ fdt_get_phyaddr(phandle_t node, device_t } int +fdt_get_reserved_regions(struct mem_region *mr, int *mrcnt) +{ + pcell_t reserve[FDT_REG_CELLS * FDT_MEM_REGIONS]; + pcell_t *reservep; + phandle_t memory, root; + uint32_t memory_size; + int addr_cells, size_cells; + int i, max_size, res_len, rv, tuple_size, tuples; + + max_size = sizeof(reserve); + root = OF_finddevice("/"); + memory = OF_finddevice("/memory"); + if (memory == -1) { + rv = ENXIO; + goto out; + } + + if ((rv = fdt_addrsize_cells(OF_parent(memory), &addr_cells, + &size_cells)) != 0) + goto out; + + if (addr_cells > 2) { + rv = ERANGE; + goto out; + } + + tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); + + res_len = OF_getproplen(root, "memreserve"); + if (res_len <= 0 || res_len > sizeof(reserve)) { + rv = ERANGE; + goto out; + } + + if (OF_getprop(root, "memreserve", reserve, res_len) <= 0) { + rv = ENXIO; + goto out; + } + + memory_size = 0; + tuples = res_len / tuple_size; + reservep = (pcell_t *)&reserve; + for (i = 0; i < tuples; i++) { + + rv = fdt_data_to_res(reservep, addr_cells, size_cells, + (u_long *)&mr[i].mr_start, (u_long *)&mr[i].mr_size); + + if (rv != 0) + goto out; + + reservep += addr_cells + size_cells; + } + + *mrcnt = i; + rv = 0; +out: + return (rv); +} + +int fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint32_t *memsize) { pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS]; Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Fri Nov 30 02:35:13 2012 (r243689) +++ head/sys/dev/fdt/fdt_common.h Fri Nov 30 03:08:49 2012 (r243690) @@ -90,6 +90,7 @@ int fdt_data_to_res(pcell_t *, int, int, int fdt_data_verify(void *, int); phandle_t fdt_find_compatible(phandle_t, const char *, int); int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *); +int fdt_get_reserved_regions(struct mem_region *, int *); int fdt_get_phyaddr(phandle_t, device_t, int *, void **); int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 03:11:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9910ADF7; Fri, 30 Nov 2012 03:11:03 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7ED308FC08; Fri, 30 Nov 2012 03:11:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU3B3qr005547; Fri, 30 Nov 2012 03:11:03 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU3B3T1005546; Fri, 30 Nov 2012 03:11:03 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300311.qAU3B3T1005546@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 03:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243691 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 03:11:03 -0000 Author: gonzo Date: Fri Nov 30 03:11:03 2012 New Revision: 243691 URL: http://svnweb.freebsd.org/changeset/base/243691 Log: Get reserved memory regions and exclude them from available memory map Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Nov 30 03:08:49 2012 (r243690) +++ head/sys/arm/arm/machdep.c Fri Nov 30 03:11:03 2012 (r243691) @@ -1144,7 +1144,9 @@ physmap_init(struct mem_region *availmem void * initarm(struct arm_boot_params *abp) { + struct mem_region memory_regions[FDT_MEM_REGIONS]; struct mem_region availmem_regions[FDT_MEM_REGIONS]; + struct mem_region reserved_regions[FDT_MEM_REGIONS]; struct pv_addr kernel_l1pt; struct pv_addr dpcpu; vm_offset_t dtbp, freemempos, l2_start, lastaddr; @@ -1154,7 +1156,12 @@ initarm(struct arm_boot_params *abp) void *kmdp; u_int l1pagetable; int i = 0, j = 0, err_devmap = 0; + int memory_regions_sz; int availmem_regions_sz; + int reserved_regions_sz; + vm_offset_t start, end; + vm_offset_t rstart, rend; + int curr; lastaddr = parse_boot_param(abp); memsize = 0; @@ -1185,10 +1192,73 @@ initarm(struct arm_boot_params *abp) while (1); /* Grab physical memory regions information from device tree. */ - if (fdt_get_mem_regions(availmem_regions, &availmem_regions_sz, + if (fdt_get_mem_regions(memory_regions, &memory_regions_sz, &memsize) != 0) while(1); + /* Grab physical memory regions information from device tree. */ + if (fdt_get_reserved_regions(reserved_regions, &reserved_regions_sz) != 0) + reserved_regions_sz = 0; + + /* + * Now exclude all the reserved regions + */ + curr = 0; + for (i = 0; i < memory_regions_sz; i++) { + start = memory_regions[i].mr_start; + end = start + memory_regions[i].mr_size; + for (j = 0; j < reserved_regions_sz; j++) { + rstart = reserved_regions[j].mr_start; + rend = rstart + reserved_regions[j].mr_size; + /* + * Restricted region is before available + * Skip restricted region + */ + if (rend <= start) + continue; + /* + * Restricted region is behind available + * No further processing required + */ + if (rstart >= end) + break; + /* + * Restricted region includes memory region + * skip availble region + */ + if ((start >= rstart) && (rend >= end)) { + start = rend; + end = rend; + break; + } + /* + * Memory region includes restricted region + */ + if ((rstart > start) && (end > rend)) { + availmem_regions[curr].mr_start = start; + availmem_regions[curr++].mr_size = rstart - start; + start = rend; + break; + } + /* + * Memory region partially overlaps with restricted + */ + if ((rstart >= start) && (rstart <= end)) { + end = rstart; + } + else if ((rend >= start) && (rend <= end)) { + start = rend; + } + } + + if (end > start) { + availmem_regions[curr].mr_start = start; + availmem_regions[curr++].mr_size = end - start; + } + } + + availmem_regions_sz = curr; + /* Platform-specific initialisation */ pmap_bootstrap_lastaddr = initarm_lastaddr(); From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 03:14:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63BD2F88; Fri, 30 Nov 2012 03:14:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 482488FC12; Fri, 30 Nov 2012 03:14:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU3ECrT006025; Fri, 30 Nov 2012 03:14:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU3ECkD006024; Fri, 30 Nov 2012 03:14:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211300314.qAU3ECkD006024@svn.freebsd.org> From: Adrian Chadd Date: Fri, 30 Nov 2012 03:14:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243692 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 03:14:12 -0000 Author: adrian Date: Fri Nov 30 03:14:11 2012 New Revision: 243692 URL: http://svnweb.freebsd.org/changeset/base/243692 Log: Include opt_wlan.h so the net80211 RX debug API compiles correctly. Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Fri Nov 30 03:11:03 2012 (r243691) +++ head/sys/dev/iwn/if_iwn.c Fri Nov 30 03:14:11 2012 (r243692) @@ -26,6 +26,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_wlan.h" + #include #include #include From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 03:15:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A7B017C; Fri, 30 Nov 2012 03:15:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6EB588FC13; Fri, 30 Nov 2012 03:15:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU3Fo9q006255; Fri, 30 Nov 2012 03:15:50 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU3FoRU006253; Fri, 30 Nov 2012 03:15:50 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300315.qAU3FoRU006253@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 03:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243693 - in head/sys/boot: fdt uboot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 03:15:50 -0000 Author: gonzo Date: Fri Nov 30 03:15:50 2012 New Revision: 243693 URL: http://svnweb.freebsd.org/changeset/base/243693 Log: - Implement "fdt mres" sub-command that prints reserved memory regions - Add "fdt addr" subcommand that lets you specify preloaded blob address - Do not pre-initialize blob for "fdt addr" - Do not try to load dtb every time fdt subcommand is issued, do it only once - Change the way DTB is passed to kernel. With introduction of "fdt addr" actual blob address can be not virtual but physical or reside in area higher then 64Mb. ubldr should create copy of it in kernel area and pass pointer to this newly allocated buffer which is guaranteed to work in kernel after switching on MMU. - Convert memreserv FDT info to "memreserv" property of root node FDT uses /memreserve/ data to notify OS about reserved memory areas. Technically it's not real property, it's just data blob, sequence of pairs where both start and size are 64-bit integers. It doesn't fit nicely with OF API we use in kernel, so in order to unify thing ubldr converts this data to "memreserve" property using the same format for addresses and sizes as /memory node. Modified: head/sys/boot/fdt/fdt_loader_cmd.c head/sys/boot/uboot/common/metadata.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Fri Nov 30 03:14:11 2012 (r243692) +++ head/sys/boot/fdt/fdt_loader_cmd.c Fri Nov 30 03:15:50 2012 (r243693) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "glue.h" -#define DEBUG - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) @@ -62,6 +60,8 @@ __FBSDID("$FreeBSD$"); #define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb" +#define CMD_REQUIRES_BLOB 0x01 + /* Local copy of FDT */ static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ @@ -69,8 +69,11 @@ static size_t fdtp_size = 0; /* Location of FDT in kernel or module */ static vm_offset_t fdtp_va = 0; +static int fdt_load_dtb(vm_offset_t va); + static int fdt_cmd_nyi(int argc, char *argv[]); +static int fdt_cmd_addr(int argc, char *argv[]); static int fdt_cmd_mkprop(int argc, char *argv[]); static int fdt_cmd_cd(int argc, char *argv[]); static int fdt_cmd_hdr(int argc, char *argv[]); @@ -79,25 +82,28 @@ static int fdt_cmd_prop(int argc, char * static int fdt_cmd_pwd(int argc, char *argv[]); static int fdt_cmd_rm(int argc, char *argv[]); static int fdt_cmd_mknode(int argc, char *argv[]); +static int fdt_cmd_mres(int argc, char *argv[]); typedef int cmdf_t(int, char *[]); struct cmdtab { char *name; cmdf_t *handler; + int flags; }; static const struct cmdtab commands[] = { - { "alias", &fdt_cmd_nyi }, - { "cd", &fdt_cmd_cd }, - { "header", &fdt_cmd_hdr }, - { "ls", &fdt_cmd_ls }, - { "mknode", &fdt_cmd_mknode }, - { "mkprop", &fdt_cmd_mkprop }, - { "mres", &fdt_cmd_nyi }, - { "prop", &fdt_cmd_prop }, - { "pwd", &fdt_cmd_pwd }, - { "rm", &fdt_cmd_rm }, + { "addr", &fdt_cmd_addr, 0 }, + { "alias", &fdt_cmd_nyi, 0 }, + { "cd", &fdt_cmd_cd, CMD_REQUIRES_BLOB }, + { "header", &fdt_cmd_hdr, CMD_REQUIRES_BLOB }, + { "ls", &fdt_cmd_ls, CMD_REQUIRES_BLOB }, + { "mknode", &fdt_cmd_mknode, CMD_REQUIRES_BLOB }, + { "mkprop", &fdt_cmd_mkprop, CMD_REQUIRES_BLOB }, + { "mres", &fdt_cmd_mres, CMD_REQUIRES_BLOB }, + { "prop", &fdt_cmd_prop, CMD_REQUIRES_BLOB }, + { "pwd", &fdt_cmd_pwd, CMD_REQUIRES_BLOB }, + { "rm", &fdt_cmd_rm, CMD_REQUIRES_BLOB }, { NULL, NULL } }; @@ -128,7 +134,7 @@ fdt_find_static_dtb() if (md == NULL) return (0); bcopy(md->md_data, &esym, sizeof(esym)); - // esym is already offset + /* esym is already offset */ md = file_findmetadata(kfp, MODINFOMD_DYNAMIC); if (md == NULL) @@ -188,53 +194,67 @@ fdt_find_static_dtb() } static int -fdt_setup_fdtp() +fdt_load_dtb(vm_offset_t va) { struct fdt_header header; - struct preloaded_file *bfp; int err; + COPYOUT(va, &header, sizeof(header)); + err = fdt_check_header(&header); + if (err < 0) { + if (err == -FDT_ERR_BADVERSION) + sprintf(command_errbuf, + "incompatible blob version: %d, should be: %d", + fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); + + else + sprintf(command_errbuf, "error validating blob: %s", + fdt_strerror(err)); + return (1); + } + /* - * Find the device tree blob. + * Release previous blob */ - bfp = file_findfile(NULL, "dtb"); - if (bfp == NULL) { - if ((fdtp_va = fdt_find_static_dtb()) == 0) { - command_errmsg = "no device tree blob found!"; - printf("%s\n", command_errmsg); - return (CMD_ERROR); - } - } else { - /* Dynamic blob has precedence over static. */ - fdtp_va = bfp->f_addr; - } + if (fdtp) + free(fdtp); - COPYOUT(fdtp_va, &header, sizeof(header)); fdtp_size = fdt_totalsize(&header); fdtp = malloc(fdtp_size); + if (fdtp == NULL) { command_errmsg = "can't allocate memory for device tree copy"; - printf("%s\n", command_errmsg); - return (CMD_ERROR); + return (1); } - COPYOUT(fdtp_va, fdtp, fdtp_size); - /* - * Validate the blob. - */ - err = fdt_check_header(fdtp); - if (err < 0) { - if (err == -FDT_ERR_BADVERSION) - sprintf(command_errbuf, - "incompatible blob version: %d, should be: %d", - fdt_version(fdtp), FDT_LAST_SUPPORTED_VERSION); + fdtp_va = va; + COPYOUT(va, fdtp, fdtp_size); + debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); - else - sprintf(command_errbuf, "error validating blob: %s", - fdt_strerror(err)); - return (CMD_ERROR); + return (0); +} + +static int +fdt_setup_fdtp() +{ + struct preloaded_file *bfp; + vm_offset_t va; + + bfp = file_findfile(NULL, "dtb"); + if (bfp == NULL) { + if ((va = fdt_find_static_dtb()) == 0) { + command_errmsg = "no device tree blob found!"; + return (1); + } + } else { + /* Dynamic blob has precedence over static. */ + va = bfp->f_addr; } - return (CMD_OK); + + if (fdt_load_dtb(va) != 0) + return (1); + + return (0); } #define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \ @@ -414,6 +434,8 @@ fixup_memory(struct sys_info *si) uint32_t *addr_cellsp, *reg, *size_cellsp; int err, i, len, memory, realmrno, root; uint8_t *buf, *sb; + uint64_t rstart, rsize; + int reserved; root = fdt_path_offset(fdtp, "/"); if (root < 0) { @@ -453,6 +475,52 @@ fixup_memory(struct sys_info *si) addr_cells = fdt32_to_cpu(*addr_cellsp); size_cells = fdt32_to_cpu(*size_cellsp); + /* + * Convert memreserve data to memreserve property + * Check if property already exists + */ + reserved = fdt_num_mem_rsv(fdtp); + if (reserved && + (fdt_getprop(fdtp, root, "memreserve", NULL) == NULL)) { + len = (addr_cells + size_cells) * reserved * sizeof(uint32_t); + sb = buf = (uint8_t *)malloc(len); + if (!buf) + return; + + bzero(buf, len); + + for (i = 0; i < reserved; i++) { + curmr = &si->mr[i]; + if (fdt_get_mem_rsv(fdtp, i, &rstart, &rsize)) + break; + if (rsize) { + /* Ensure endianess, and put cells into a buffer */ + if (addr_cells == 2) + *(uint64_t *)buf = + cpu_to_fdt64(rstart); + else + *(uint32_t *)buf = + cpu_to_fdt32(rstart); + + buf += sizeof(uint32_t) * addr_cells; + if (size_cells == 2) + *(uint64_t *)buf = + cpu_to_fdt64(rsize); + else + *(uint32_t *)buf = + cpu_to_fdt32(rsize); + + buf += sizeof(uint32_t) * size_cells; + } + } + + /* Set property */ + if ((err = fdt_setprop(fdtp, root, "memreserve", sb, len)) < 0) + printf("Could not fixup 'memreserve' property.\n"); + + free(sb); + } + /* Count valid memory regions entries in sysinfo. */ realmrno = si->mr_no; for (i = 0; i < si->mr_no; i++) @@ -509,6 +577,8 @@ fixup_memory(struct sys_info *si) /* Set property */ if ((err = fdt_setprop(fdtp, memory, "reg", sb, len)) < 0) sprintf(command_errbuf, "Could not fixup '/memory' node.\n"); + + free(sb); } void @@ -564,7 +634,7 @@ fixup_stdout(const char *env) /* * Locate the blob, fix it up and return its location. */ -vm_offset_t +static vm_offset_t fdt_fixup(void) { const char *env; @@ -577,10 +647,12 @@ fdt_fixup(void) ethstr = NULL; len = 0; - err = fdt_setup_fdtp(); - if (err) { - sprintf(command_errbuf, "No valid device tree blob found!"); - return (0); + if (fdtp == NULL) { + err = fdt_setup_fdtp(); + if (err) { + sprintf(command_errbuf, "No valid device tree blob found!"); + return (0); + } } /* Create /chosen node (if not exists) */ @@ -640,10 +712,36 @@ success: return (fdtp_va); } +/* + * Copy DTB blob to specified location and its return size + */ +int +fdt_copy(vm_offset_t va) +{ + int err; + + if (fdtp == NULL) { + err = fdt_setup_fdtp(); + if (err) { + printf("No valid device tree blob found!"); + return (0); + } + } + + if (fdt_fixup() == 0) + return (0); + + COPYIN(fdtp, va, fdtp_size); + return (fdtp_size); +} + + + int command_fdt_internal(int argc, char *argv[]) { cmdf_t *cmdh; + int flags; char *cmd; int i, err; @@ -653,12 +751,6 @@ command_fdt_internal(int argc, char *arg } /* - * Check if uboot env vars were parsed already. If not, do it now. - */ - if (fdt_fixup() == 0) - return (CMD_ERROR); - - /* * Validate fdt . */ cmd = strdup(argv[1]); @@ -668,6 +760,7 @@ command_fdt_internal(int argc, char *arg if (strcmp(cmd, commands[i].name) == 0) { /* found it */ cmdh = commands[i].handler; + flags = commands[i].flags; break; } i++; @@ -677,6 +770,14 @@ command_fdt_internal(int argc, char *arg return (CMD_ERROR); } + if (flags & CMD_REQUIRES_BLOB) { + /* + * Check if uboot env vars were parsed already. If not, do it now. + */ + if (fdt_fixup() == 0) + return (CMD_ERROR); + } + /* * Call command handler. */ @@ -686,6 +787,31 @@ command_fdt_internal(int argc, char *arg } static int +fdt_cmd_addr(int argc, char *argv[]) +{ + vm_offset_t va; + char *addr, *cp; + + if (argc > 2) + addr = argv[2]; + else { + sprintf(command_errbuf, "no address specified"); + return (CMD_ERROR); + } + + va = strtol(addr, &cp, 0); + if (cp == addr) { + sprintf(command_errbuf, "Invalid address: %s", addr); + return (CMD_ERROR); + } + + if (fdt_load_dtb(va) != 0) + return (CMD_ERROR); + + return (CMD_OK); +} + +static int fdt_cmd_cd(int argc, char *argv[]) { char *path; @@ -1445,6 +1571,30 @@ fdt_cmd_pwd(int argc, char *argv[]) } static int +fdt_cmd_mres(int argc, char *argv[]) +{ + uint64_t start, size; + int i, total; + char line[80]; + + pager_open(); + total = fdt_num_mem_rsv(fdtp); + if (total > 0) { + pager_output("Reserved memory regions:\n"); + for (i = 0; i < total; i++) { + fdt_get_mem_rsv(fdtp, i, &start, &size); + sprintf(line, "reg#%d: (start: 0x%jx, size: 0x%jx)\n", + i, start, size); + pager_output(line); + } + } else + pager_output("No reserved memory regions\n"); + pager_close(); + + return (CMD_OK); +} + +static int fdt_cmd_nyi(int argc, char *argv[]) { Modified: head/sys/boot/uboot/common/metadata.c ============================================================================== --- head/sys/boot/uboot/common/metadata.c Fri Nov 30 03:14:11 2012 (r243692) +++ head/sys/boot/uboot/common/metadata.c Fri Nov 30 03:15:50 2012 (r243693) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -extern vm_offset_t fdt_fixup(void); +extern int fdt_copy(vm_offset_t); #endif /* @@ -279,7 +279,10 @@ md_load(char *args, vm_offset_t *modulep vm_offset_t envp; vm_offset_t size; vm_offset_t vaddr; +#if defined(LOADER_FDT_SUPPORT) vm_offset_t dtbp; + int dtb_size; +#endif char *rootdevname; int howto; int i; @@ -325,6 +328,16 @@ md_load(char *args, vm_offset_t *modulep /* Pad to a page boundary */ addr = roundup(addr, PAGE_SIZE); +#if defined(LOADER_FDT_SUPPORT) + /* Handle device tree blob */ + dtbp = addr; + dtb_size = fdt_copy(addr); + + /* Pad to a page boundary */ + if (dtb_size) + addr += roundup(dtb_size, PAGE_SIZE); +#endif + kernend = 0; kfp = file_findfile(NULL, "elf32 kernel"); if (kfp == NULL) @@ -335,9 +348,7 @@ md_load(char *args, vm_offset_t *modulep file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp); #if defined(LOADER_FDT_SUPPORT) - /* Handle device tree blob */ - dtbp = fdt_fixup(); - if (dtbp != 0) + if (dtb_size) file_addmetadata(kfp, MODINFOMD_DTBP, sizeof dtbp, &dtbp); else pager_output("WARNING! Trying to fire up the kernel, but no " From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 03:16:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEABD2F2; Fri, 30 Nov 2012 03:16:45 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A36BA8FC15; Fri, 30 Nov 2012 03:16:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU3GjfP006395; Fri, 30 Nov 2012 03:16:45 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU3Gjx4006393; Fri, 30 Nov 2012 03:16:45 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300316.qAU3Gjx4006393@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 03:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243694 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 03:16:45 -0000 Author: gonzo Date: Fri Nov 30 03:16:45 2012 New Revision: 243694 URL: http://svnweb.freebsd.org/changeset/base/243694 Log: Add vchiq node Modified: head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Modified: head/sys/boot/fdt/dts/bcm2835-rpi-b.dts ============================================================================== --- head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Fri Nov 30 03:15:50 2012 (r243693) +++ head/sys/boot/fdt/dts/bcm2835-rpi-b.dts Fri Nov 30 03:16:45 2012 (r243694) @@ -471,6 +471,13 @@ reg-shift = <2>; }; + vchiq { + compatible = "broadcom,bcm2835-vchiq"; + reg = <0xB800 0x50>; + interrupts = <2>; + interrupt-parent = <&intc>; + }; + usb { compatible = "broadcom,bcm2835-usb", "broadcom,bcm2708-usb", "synopsys,designware-hs-otg2"; reg = <0x980000 0x20000>; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 04:44:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8F4DF7D6; Fri, 30 Nov 2012 04:44:32 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7392E8FC14; Fri, 30 Nov 2012 04:44:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU4iWd3017659; Fri, 30 Nov 2012 04:44:32 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU4iWQi017657; Fri, 30 Nov 2012 04:44:32 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201211300444.qAU4iWQi017657@svn.freebsd.org> From: Neel Natu Date: Fri, 30 Nov 2012 04:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243700 - head/sys/boot/userboot/userboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 04:44:32 -0000 Author: neel Date: Fri Nov 30 04:44:32 2012 New Revision: 243700 URL: http://svnweb.freebsd.org/changeset/base/243700 Log: Teach userboot to boot from ISO image files. Reviewed by: ae@, dfr@ Obtained from: NetApp Modified: head/sys/boot/userboot/userboot/conf.c head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/userboot/userboot/conf.c ============================================================================== --- head/sys/boot/userboot/userboot/conf.c Fri Nov 30 03:48:45 2012 (r243699) +++ head/sys/boot/userboot/userboot/conf.c Fri Nov 30 04:44:32 2012 (r243700) @@ -57,6 +57,7 @@ struct devsw *devsw[] = { struct fs_ops *file_system[] = { &host_fsops, &ufs_fsops, + &cd9660_fsops, &gzipfs_fsops, NULL }; Modified: head/sys/boot/userboot/userboot/main.c ============================================================================== --- head/sys/boot/userboot/userboot/main.c Fri Nov 30 03:48:45 2012 (r243699) +++ head/sys/boot/userboot/userboot/main.c Fri Nov 30 04:44:32 2012 (r243700) @@ -153,11 +153,13 @@ extract_currdev(void) dev.d_slice = 0; dev.d_partition = 0; /* - * Figure out if we are using MBR or GPT - for GPT we - * set the partition to 0 since everything is a GPT slice. + * If we cannot auto-detect the partition type then + * access the disk as a raw device. */ - if (dev.d_dev->dv_open(NULL, &dev)) - dev.d_partition = 255; + if (dev.d_dev->dv_open(NULL, &dev)) { + dev.d_slice = -1; + dev.d_partition = -1; + } } else { dev.d_dev = &host_dev; dev.d_type = dev.d_dev->dv_type; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 04:56:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D09AEB76; Fri, 30 Nov 2012 04:56:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B57F88FC15; Fri, 30 Nov 2012 04:56:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAU4udKi019156; Fri, 30 Nov 2012 04:56:39 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAU4ud7j019155; Fri, 30 Nov 2012 04:56:39 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201211300456.qAU4ud7j019155@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 30 Nov 2012 04:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243701 - head/sys/arm/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 04:56:39 -0000 Author: gonzo Date: Fri Nov 30 04:56:39 2012 New Revision: 243701 URL: http://svnweb.freebsd.org/changeset/base/243701 Log: - Enable syscons/framebuffer by default - Enable NFS client by default. Might be useful for building ports Modified: head/sys/arm/conf/RPI-B Modified: head/sys/arm/conf/RPI-B ============================================================================== --- head/sys/arm/conf/RPI-B Fri Nov 30 04:44:32 2012 (r243700) +++ head/sys/arm/conf/RPI-B Fri Nov 30 04:56:39 2012 (r243701) @@ -44,7 +44,8 @@ options UFS_ACL #Support for access c options UFS_DIRHASH #Improve performance on big directories device snp -#options NFSCL #Network Filesystem Client +options NFSCL #Network Filesystem Client + #options NFS_ROOT #NFS usable as /, requires NFSCLIENT #options BOOTP_NFSROOT #options BOOTP_COMPAT @@ -73,13 +74,12 @@ device pl011 device pty -# NOTE: serial console will be disabled if syscons enabled -# Uncomment following lines for framebuffer/syscons support -# device sc -# device kbdmux -# options SC_DFLT_FONT # compile font in -# makeoptions SC_DFLT_FONT=cp437 -# device ukbd +# Comment following lines for boot console on serial port +device sc +device kbdmux +options SC_DFLT_FONT # compile font in +makeoptions SC_DFLT_FONT=cp437 +device ukbd device sdhci device mmc From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 09:12:25 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C3BE15C; Fri, 30 Nov 2012 09:12:25 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) by mx1.freebsd.org (Postfix) with ESMTP id E28B48FC0C; Fri, 30 Nov 2012 09:12:23 +0000 (UTC) Received: from [192.168.0.2] (cpc39-cmbg15-2-0-cust69.5-4.cable.virginmedia.com [81.101.138.70]) (authenticated bits=0) by theravensnest.org (8.14.5/8.14.5) with ESMTP id qAU9CFgl019701 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Fri, 30 Nov 2012 09:12:16 GMT (envelope-from theraven@FreeBSD.org) Subject: Re: svn commit: r243670 - head/share/man/man5 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: Date: Fri, 30 Nov 2012 09:12:11 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <4DDE660C-B809-47A5-AEBD-026FAAE8DB8B@FreeBSD.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> <20121130110154.E1441@besplex.bde.org> To: Eitan Adler X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 09:12:25 -0000 On 30 Nov 2012, at 00:15, Eitan Adler wrote: > Every time I talk to the clang folk about flags they point me to gcc > documentation. No we don't. We point you at the gcc documentation and at the clang = manual. Clang aims to support all of the gcc flags, and provides some = extra ones as documented here: http://clang.llvm.org/docs/UsersManual.html If you are interested in writing a full manual for clang including the = gcc options, then that would almost certainly be appreciated. Most of = this can be automatically generated. The best thing to do would be to = write a tablegen back end that could emit mandoc from the existing = options descriptions. David= From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 09:30:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5396892; Fri, 30 Nov 2012 09:30:31 +0000 (UTC) (envelope-from erik@cederstrand.dk) Received: from csmtp2.one.com (csmtp2.one.com [91.198.169.22]) by mx1.freebsd.org (Postfix) with ESMTP id 093528FC19; Fri, 30 Nov 2012 09:30:31 +0000 (UTC) Received: from [192.168.1.18] (unknown [217.157.7.221]) by csmtp2.one.com (Postfix) with ESMTPA id 81A72304042C; Fri, 30 Nov 2012 09:30:23 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: svn commit: r243665 - head/sbin/dump From: Erik Cederstrand In-Reply-To: <20121129120147.GE3013@kib.kiev.ua> Date: Fri, 30 Nov 2012 10:30:25 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <9E5035D8-506F-4A18-9511-BFA0511ACE10@cederstrand.dk> References: <201211290516.qAT5GoT5098709@svn.freebsd.org> <20121129120147.GE3013@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1499) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 09:30:31 -0000 Den 29/11/2012 kl. 13.01 skrev Konstantin Belousov = : > On Thu, Nov 29, 2012 at 05:16:50AM +0000, Eitan Adler wrote: >> Author: eadler >> Date: Thu Nov 29 05:16:50 2012 >> New Revision: 243665 >> URL: http://svnweb.freebsd.org/changeset/base/243665 >>=20 >> Log: >> Mark non-returning function as such >>=20 >> PR: bin/172978 >> Approved by: cperciva >> MFC after: 3 days >>=20 >> Modified: >> head/sbin/dump/dump.h >>=20 >> Modified: head/sbin/dump/dump.h >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sbin/dump/dump.h Thu Nov 29 03:48:39 2012 = (r243664) >> +++ head/sbin/dump/dump.h Thu Nov 29 05:16:50 2012 = (r243665) >> @@ -121,7 +121,7 @@ void trewind(void); >> void writerec(char *dp, int isspcl); >>=20 >> void Exit(int status) __dead2; >> -void dumpabort(int signo); >> +void dumpabort(int signo) __dead2; >> void dump_getfstab(void); >>=20 >> char *rawname(char *cp); > What is the goal of this change ? >=20 > It is arguably backward. There is absolutely no use to mark signal = handler > as __dead2, and all other uses do not benefit from the redundand = declaration. I submitted this patch because it fixes static analysis warnings. = Compilation units that contain the header but not the implementation = need this to reason about the code. As I see it, the __dead2 is part of the function definition, just like = 'void' and 'int signo'. Actually, before the patch, return type 'void' = was a lie, because the function never returns. > Also, being quite removed from the function definition, there is a = chance > that some future modification would make the attribute a lie. That is not any different than some future modification changing the = return type to 'int', which the compiler would also warn about. Thanks, Erik= From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 12:41:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CC6E130 for ; Fri, 30 Nov 2012 12:41:38 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id CEA9C8FC15 for ; Fri, 30 Nov 2012 12:41:37 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id go10so535242lbb.13 for ; Fri, 30 Nov 2012 04:41:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=fKkzRRsh7S7O/ILiDqME2bgh/bbHs/0afj4TVJBcz0Q=; b=CmFhFoH5ORyU7PqgEEFqWsVjji7jo7CNfk1aoQu4zLhEnFSEChjx+8sdwoGM1Hau9B jhdi5w0UtS1HYzSnPUXI35X/RWyNUvXfnAhsEFAPshTBxYCZsUyv9W6ThIGnyjfe5FEW EuLNpIKRSZBRlEEn2GOEm/wF2OAzrDGtd/gpc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=fKkzRRsh7S7O/ILiDqME2bgh/bbHs/0afj4TVJBcz0Q=; b=MjZxoJpk7k546ysNLxNgidRd3X8x8e5cI1giILsL6KqPGpo+ZQR3UALYtVhZu1fWI9 O3lSyocS2tw9kkPgrWQRKxP5mSt59gQvfm03zaz5Z9WeNYs501lnAMYoVEYbjWE8Fl3A 4YtD3io/P03h54jwuuBVRDERmCuP7nhzfN0M3LVTekAiLHw5DfV+2yYZ3KmakOgbsqMm DHQ1lu949etu701vr9B9P4NTRSK9edpkvcrn2HiXO6BMv5lQryA0dovA9uL3KyqxKVZ6 Zrpmu3O7qA/GEof7TDVtLb5gG0qpIjciW/Xsw6mNCYk9+6EXAlLAYLIYW4kq3GQv4Xy4 kPgA== Received: by 10.152.108.48 with SMTP id hh16mr1143286lab.25.1354279296198; Fri, 30 Nov 2012 04:41:36 -0800 (PST) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.154.168 with HTTP; Fri, 30 Nov 2012 04:41:05 -0800 (PST) In-Reply-To: <4DDE660C-B809-47A5-AEBD-026FAAE8DB8B@FreeBSD.org> References: <201211291251.qATCpA7w078277@svn.freebsd.org> <20121130110154.E1441@besplex.bde.org> <4DDE660C-B809-47A5-AEBD-026FAAE8DB8B@FreeBSD.org> From: Eitan Adler Date: Fri, 30 Nov 2012 07:41:05 -0500 X-Google-Sender-Auth: DN0bVROW2SuW2az_4enhUwPPBvY Message-ID: Subject: Re: svn commit: r243670 - head/share/man/man5 To: David Chisnall Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQki1s46+I6nJqGN8/whZ/TgvVPOhZFRUX2K9qtH2gF9Q2OZJ8Fe7LeOxNoCGZPaV8OWbHmn Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 12:41:38 -0000 On 30 November 2012 04:12, David Chisnall wrote: > On 30 Nov 2012, at 00:15, Eitan Adler wrote: > >> Every time I talk to the clang folk about flags they point me to gcc >> documentation. > > No we don't. We point you at the gcc documentation and at the clang manu= al. Clang aims to support all of the gcc flags, and provides some extra on= es as documented here: Actually, every time I've asked the response I got has been exactly "man gc= c" > If you are interested in writing a full manual for clang including the gc= c options, then that would almost certainly be appreciated. Most of this c= an be automatically generated. The best thing to do would be to write a ta= blegen back end that could emit mandoc from the existing options descriptio= ns. and then they mention this. I've thought about working on it, but ENOTIME usually ;) --=20 Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 16:33:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D4FFDFE5; Fri, 30 Nov 2012 16:33:22 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B85658FC13; Fri, 30 Nov 2012 16:33:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUGXMG5017823; Fri, 30 Nov 2012 16:33:22 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUGXMPd017820; Fri, 30 Nov 2012 16:33:22 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201211301633.qAUGXMPd017820@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 30 Nov 2012 16:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243707 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 16:33:22 -0000 Author: melifaro Date: Fri Nov 30 16:33:22 2012 New Revision: 243707 URL: http://svnweb.freebsd.org/changeset/base/243707 Log: Make ipfw dynamic states operations SMP-ready. * Global IPFW_DYN_LOCK() is changed to per-bucket mutex. * State expiration is done in ipfw_tick every second. * No expiration is done on forwarding path. * hash table resize is done automatically and does not flush all states. * Dynamic UMA zone is now allocated per each VNET * State limiting is now done via UMA(9) api. Discussed with: ipfw MFC after: 3 weeks Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Fri Nov 30 16:18:26 2012 (r243706) +++ head/sys/netpfil/ipfw/ip_fw2.c Fri Nov 30 16:33:22 2012 (r243707) @@ -2046,7 +2046,7 @@ do { \ f->rulenum, f->id); cmd = ACTION_PTR(f); l = f->cmd_len - f->act_ofs; - ipfw_dyn_unlock(); + ipfw_dyn_unlock(q); cmdlen = 0; match = 1; break; @@ -2525,7 +2525,6 @@ ipfw_init(void) { int error = 0; - ipfw_dyn_attach(); /* * Only print out this stuff the first time around, * when called from the sysinit code. @@ -2579,7 +2578,6 @@ ipfw_destroy(void) { ipfw_log_bpf(0); /* uninit */ - ipfw_dyn_detach(); printf("IP firewall unloaded\n"); } @@ -2637,7 +2635,7 @@ vnet_ipfw_init(const void *unused) chain->id = rule->id = 1; IPFW_LOCK_INIT(chain); - ipfw_dyn_init(); + ipfw_dyn_init(chain); /* First set up some values that are compile time options */ V_ipfw_vnet_ready = 1; /* Open for business */ Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 30 16:18:26 2012 (r243706) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 30 16:33:22 2012 (r243707) @@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$"); * The lifetime of dynamic rules is regulated by dyn_*_lifetime, * measured in seconds and depending on the flags. * - * The total number of dynamic rules is stored in dyn_count. + * The total number of dynamic rules is equal to UMA zone items count. * The max number of dynamic rules is dyn_max. When we reach * the maximum number of rules we do not create anymore. This is * done to avoid consuming too much memory, but also too much @@ -111,37 +111,33 @@ __FBSDID("$FreeBSD$"); * passes through the firewall. XXX check the latter!!! */ +struct ipfw_dyn_bucket { + struct mtx mtx; /* Bucket protecting lock */ + ipfw_dyn_rule *head; /* Pointer to first rule */ +}; + /* * Static variables followed by global ones */ -static VNET_DEFINE(ipfw_dyn_rule **, ipfw_dyn_v); -static VNET_DEFINE(u_int32_t, dyn_buckets); +static VNET_DEFINE(struct ipfw_dyn_bucket *, ipfw_dyn_v); +static VNET_DEFINE(u_int32_t, dyn_buckets_max); static VNET_DEFINE(u_int32_t, curr_dyn_buckets); static VNET_DEFINE(struct callout, ipfw_timeout); #define V_ipfw_dyn_v VNET(ipfw_dyn_v) -#define V_dyn_buckets VNET(dyn_buckets) +#define V_dyn_buckets_max VNET(dyn_buckets_max) #define V_curr_dyn_buckets VNET(curr_dyn_buckets) #define V_ipfw_timeout VNET(ipfw_timeout) -static uma_zone_t ipfw_dyn_rule_zone; -#ifndef __FreeBSD__ -DEFINE_SPINLOCK(ipfw_dyn_mtx); -#else -static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */ -#endif - -#define IPFW_DYN_LOCK_INIT() \ - mtx_init(&ipfw_dyn_mtx, "IPFW dynamic rules", NULL, MTX_DEF) -#define IPFW_DYN_LOCK_DESTROY() mtx_destroy(&ipfw_dyn_mtx) -#define IPFW_DYN_LOCK() mtx_lock(&ipfw_dyn_mtx) -#define IPFW_DYN_UNLOCK() mtx_unlock(&ipfw_dyn_mtx) -#define IPFW_DYN_LOCK_ASSERT() mtx_assert(&ipfw_dyn_mtx, MA_OWNED) +static VNET_DEFINE(uma_zone_t, ipfw_dyn_rule_zone); +#define V_ipfw_dyn_rule_zone VNET(ipfw_dyn_rule_zone) -void -ipfw_dyn_unlock(void) -{ - IPFW_DYN_UNLOCK(); -} +#define IPFW_BUCK_LOCK_INIT(b) \ + mtx_init(&(b)->mtx, "IPFW dynamic bucket", NULL, MTX_DEF) +#define IPFW_BUCK_LOCK_DESTROY(b) \ + mtx_destroy(&(b)->mtx) +#define IPFW_BUCK_LOCK(i) mtx_lock(&V_ipfw_dyn_v[(i)].mtx) +#define IPFW_BUCK_UNLOCK(i) mtx_unlock(&V_ipfw_dyn_v[(i)].mtx) +#define IPFW_BUCK_ASSERT(i) mtx_assert(&V_ipfw_dyn_v[(i)].mtx, MA_OWNED) /* * Timeouts for various events in handing dynamic rules. @@ -171,33 +167,42 @@ static VNET_DEFINE(u_int32_t, dyn_short_ static VNET_DEFINE(u_int32_t, dyn_keepalive_interval); static VNET_DEFINE(u_int32_t, dyn_keepalive_period); static VNET_DEFINE(u_int32_t, dyn_keepalive); +static VNET_DEFINE(time_t, dyn_keepalive_last); #define V_dyn_keepalive_interval VNET(dyn_keepalive_interval) #define V_dyn_keepalive_period VNET(dyn_keepalive_period) #define V_dyn_keepalive VNET(dyn_keepalive) +#define V_dyn_keepalive_last VNET(dyn_keepalive_last) -static VNET_DEFINE(u_int32_t, dyn_count); /* # of dynamic rules */ static VNET_DEFINE(u_int32_t, dyn_max); /* max # of dynamic rules */ -#define V_dyn_count VNET(dyn_count) +#define DYN_COUNT uma_zone_get_cur(V_ipfw_dyn_rule_zone) #define V_dyn_max VNET(dyn_max) +static int last_log; /* Log ratelimiting */ + +static void ipfw_dyn_tick(void *vnetx); +static void check_dyn_rules(struct ip_fw_chain *, struct ip_fw *, + int, int, int); #ifdef SYSCTL_NODE +static int sysctl_ipfw_dyn_count(SYSCTL_HANDLER_ARGS); +static int sysctl_ipfw_dyn_max(SYSCTL_HANDLER_ARGS); + SYSBEGIN(f2) SYSCTL_DECL(_net_inet_ip_fw); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_buckets, - CTLFLAG_RW, &VNET_NAME(dyn_buckets), 0, - "Number of dyn. buckets"); + CTLFLAG_RW, &VNET_NAME(dyn_buckets_max), 0, + "Max number of dyn. buckets"); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, curr_dyn_buckets, CTLFLAG_RD, &VNET_NAME(curr_dyn_buckets), 0, "Current Number of dyn. buckets"); -SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_count, - CTLFLAG_RD, &VNET_NAME(dyn_count), 0, +SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, dyn_count, + CTLTYPE_UINT|CTLFLAG_RD, 0, 0, sysctl_ipfw_dyn_count, "IU", "Number of dyn. rules"); -SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_max, - CTLFLAG_RW, &VNET_NAME(dyn_max), 0, +SYSCTL_VNET_PROC(_net_inet_ip_fw, OID_AUTO, dyn_max, + CTLTYPE_UINT|CTLFLAG_RW, 0, 0, sysctl_ipfw_dyn_max, "IU", "Max number of dyn. rules"); SYSCTL_VNET_UINT(_net_inet_ip_fw, OID_AUTO, dyn_ack_lifetime, CTLFLAG_RW, &VNET_NAME(dyn_ack_lifetime), 0, @@ -244,7 +249,7 @@ hash_packet6(struct ipfw_flow_id *id) * and we want to find both in the same bucket. */ static __inline int -hash_packet(struct ipfw_flow_id *id) +hash_packet(struct ipfw_flow_id *id, int buckets) { u_int32_t i; @@ -254,7 +259,7 @@ hash_packet(struct ipfw_flow_id *id) else #endif /* INET6 */ i = (id->dst_ip) ^ (id->src_ip) ^ (id->dst_port) ^ (id->src_port); - i &= (V_curr_dyn_buckets - 1); + i &= (buckets - 1); return i; } @@ -286,124 +291,19 @@ print_dyn_rule_flags(struct ipfw_flow_id } log(log_flags, "ipfw: %s type %d %s %d -> %s %d, %d %s\n", prefix, dyn_type, src, id->src_port, dst, - id->dst_port, V_dyn_count, postfix); + id->dst_port, DYN_COUNT, postfix); } #define print_dyn_rule(id, dtype, prefix, postfix) \ print_dyn_rule_flags(id, dtype, LOG_DEBUG, prefix, postfix) -/** - * unlink a dynamic rule from a chain. prev is a pointer to - * the previous one, q is a pointer to the rule to delete, - * head is a pointer to the head of the queue. - * Modifies q and potentially also head. - */ -#define UNLINK_DYN_RULE(prev, head, q) { \ - ipfw_dyn_rule *old_q = q; \ - \ - /* remove a refcount to the parent */ \ - if (q->dyn_type == O_LIMIT) \ - q->parent->count--; \ - V_dyn_count--; \ - DEB(print_dyn_rule(&q->id, q->dyn_type, "unlink entry", "left");) \ - if (prev != NULL) \ - prev->next = q = q->next; \ - else \ - head = q = q->next; \ - uma_zfree(ipfw_dyn_rule_zone, old_q); } - #define TIME_LEQ(a,b) ((int)((a)-(b)) <= 0) -/** - * Remove dynamic rules pointing to "rule", or all of them if rule == NULL. - * - * If keep_me == NULL, rules are deleted even if not expired, - * otherwise only expired rules are removed. - * - * The value of the second parameter is also used to point to identify - * a rule we absolutely do not want to remove (e.g. because we are - * holding a reference to it -- this is the case with O_LIMIT_PARENT - * rules). The pointer is only used for comparison, so any non-null - * value will do. - */ -static void -remove_dyn_rule(struct ip_fw *rule, ipfw_dyn_rule *keep_me) -{ - static u_int32_t last_remove = 0; - -#define FORCE (keep_me == NULL) - - ipfw_dyn_rule *prev, *q; - int i, pass = 0, max_pass = 0; - - IPFW_DYN_LOCK_ASSERT(); - - if (V_ipfw_dyn_v == NULL || V_dyn_count == 0) - return; - /* do not expire more than once per second, it is useless */ - if (!FORCE && last_remove == time_uptime) - return; - last_remove = time_uptime; - - /* - * because O_LIMIT refer to parent rules, during the first pass only - * remove child and mark any pending LIMIT_PARENT, and remove - * them in a second pass. - */ -next_pass: - for (i = 0 ; i < V_curr_dyn_buckets ; i++) { - for (prev=NULL, q = V_ipfw_dyn_v[i] ; q ; ) { - /* - * Logic can become complex here, so we split tests. - */ - if (q == keep_me) - goto next; - if (rule != NULL && rule != q->rule) - goto next; /* not the one we are looking for */ - if (q->dyn_type == O_LIMIT_PARENT) { - /* - * handle parent in the second pass, - * record we need one. - */ - max_pass = 1; - if (pass == 0) - goto next; - if (FORCE && q->count != 0 ) { - /* XXX should not happen! */ - printf("ipfw: OUCH! cannot remove rule," - " count %d\n", q->count); - } - } else { - if (!FORCE && - !TIME_LEQ( q->expire, time_uptime )) - goto next; - } - if (q->dyn_type != O_LIMIT_PARENT || !q->count) { - UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); - continue; - } -next: - prev=q; - q=q->next; - } - } - if (pass++ < max_pass) - goto next_pass; -} - -void -ipfw_remove_dyn_children(struct ip_fw *rule) -{ - IPFW_DYN_LOCK(); - remove_dyn_rule(rule, NULL /* force removal */); - IPFW_DYN_UNLOCK(); -} - /* * Lookup a dynamic rule, locked version. */ static ipfw_dyn_rule * -lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int *match_direction, +lookup_dyn_rule_locked(struct ipfw_flow_id *pkt, int i, int *match_direction, struct tcphdr *tcp) { /* @@ -414,23 +314,17 @@ lookup_dyn_rule_locked(struct ipfw_flow_ #define MATCH_FORWARD 1 #define MATCH_NONE 2 #define MATCH_UNKNOWN 3 - int i, dir = MATCH_NONE; + int dir = MATCH_NONE; ipfw_dyn_rule *prev, *q = NULL; - IPFW_DYN_LOCK_ASSERT(); + IPFW_BUCK_ASSERT(i); - if (V_ipfw_dyn_v == NULL) - goto done; /* not found */ - i = hash_packet(pkt); - for (prev = NULL, q = V_ipfw_dyn_v[i]; q != NULL;) { + for (prev = NULL, q = V_ipfw_dyn_v[i].head; q; prev = q, q = q->next) { if (q->dyn_type == O_LIMIT_PARENT && q->count) - goto next; - if (TIME_LEQ(q->expire, time_uptime)) { /* expire entry */ - UNLINK_DYN_RULE(prev, V_ipfw_dyn_v[i], q); continue; - } + if (pkt->proto != q->id.proto || q->dyn_type == O_LIMIT_PARENT) - goto next; + continue; if (IS_IP6_FLOW_ID(pkt)) { if (IN6_ARE_ADDR_EQUAL(&pkt->src_ip6, &q->id.src_ip6) && @@ -463,17 +357,14 @@ lookup_dyn_rule_locked(struct ipfw_flow_ break; } } -next: - prev = q; - q = q->next; } if (q == NULL) goto done; /* q = NULL, not found */ if (prev != NULL) { /* found and not in front */ prev->next = q->next; - q->next = V_ipfw_dyn_v[i]; - V_ipfw_dyn_v[i] = q; + q->next = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = q; } if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */ uint32_t ack; @@ -556,42 +447,108 @@ ipfw_lookup_dyn_rule(struct ipfw_flow_id struct tcphdr *tcp) { ipfw_dyn_rule *q; + int i; - IPFW_DYN_LOCK(); - q = lookup_dyn_rule_locked(pkt, match_direction, tcp); + i = hash_packet(pkt, V_curr_dyn_buckets); + + IPFW_BUCK_LOCK(i); + q = lookup_dyn_rule_locked(pkt, i, match_direction, tcp); if (q == NULL) - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); /* NB: return table locked when q is not NULL */ return q; } -static void -realloc_dynamic_table(void) +/* + * Unlock bucket mtx + * @p - pointer to dynamic rule + */ +void +ipfw_dyn_unlock(ipfw_dyn_rule *q) +{ + + IPFW_BUCK_UNLOCK(q->bucket); +} + +static int +resize_dynamic_table(struct ip_fw_chain *chain, int nbuckets) { - IPFW_DYN_LOCK_ASSERT(); + int i, k, nbuckets_old; + ipfw_dyn_rule *q; + struct ipfw_dyn_bucket *dyn_v, *dyn_v_old; + + /* Check if given number is power of 2 and less than 64k */ + if ((nbuckets > 65536) || (!powerof2(nbuckets))) + return 1; + + CTR3(KTR_NET, "%s: resize dynamic hash: %d -> %d", __func__, + V_curr_dyn_buckets, nbuckets); + + /* Allocate and initialize new hash */ + dyn_v = malloc(nbuckets * sizeof(ipfw_dyn_rule), M_IPFW, + M_WAITOK | M_ZERO); + + for (i = 0 ; i < nbuckets; i++) + IPFW_BUCK_LOCK_INIT(&dyn_v[i]); /* - * Try reallocation, make sure we have a power of 2 and do - * not allow more than 64k entries. In case of overflow, - * default to 1024. + * Call upper half lock, as get_map() do to ease + * read-only access to dynamic rules hash from sysctl */ + IPFW_UH_WLOCK(chain); - if (V_dyn_buckets > 65536) - V_dyn_buckets = 1024; - if ((V_dyn_buckets & (V_dyn_buckets-1)) != 0) { /* not a power of 2 */ - V_dyn_buckets = V_curr_dyn_buckets; /* reset */ - return; + /* + * Acquire chain write lock to permit hash access + * for main traffic path without additional locks + */ + IPFW_WLOCK(chain); + + /* Save old values */ + nbuckets_old = V_curr_dyn_buckets; + dyn_v_old = V_ipfw_dyn_v; + + /* Skip relinking if array is not set up */ + if (V_ipfw_dyn_v == NULL) + V_curr_dyn_buckets = 0; + + /* Re-link all dynamic states */ + for (i = 0 ; i < V_curr_dyn_buckets ; i++) { + while (V_ipfw_dyn_v[i].head != NULL) { + /* Remove from current chain */ + q = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = q->next; + + /* Get new hash value */ + k = hash_packet(&q->id, nbuckets); + q->bucket = k; + /* Add to the new head */ + q->next = dyn_v[k].head; + dyn_v[k].head = q; + } } - V_curr_dyn_buckets = V_dyn_buckets; - if (V_ipfw_dyn_v != NULL) - free(V_ipfw_dyn_v, M_IPFW); - for (;;) { - V_ipfw_dyn_v = malloc(V_curr_dyn_buckets * sizeof(ipfw_dyn_rule *), - M_IPFW, M_NOWAIT | M_ZERO); - if (V_ipfw_dyn_v != NULL || V_curr_dyn_buckets <= 2) - break; - V_curr_dyn_buckets /= 2; + + /* Update current pointers/buckets values */ + V_curr_dyn_buckets = nbuckets; + V_ipfw_dyn_v = dyn_v; + + IPFW_WUNLOCK(chain); + + IPFW_UH_WUNLOCK(chain); + + /* Start periodic callout on initial creation */ + if (dyn_v_old == NULL) { + callout_reset_on(&V_ipfw_timeout, hz, ipfw_dyn_tick, curvnet, 0); + return (0); } + + /* Destroy all mutexes */ + for (i = 0 ; i < nbuckets_old ; i++) + IPFW_BUCK_LOCK_DESTROY(&dyn_v_old[i]); + + /* Free old hash */ + free(dyn_v_old, M_IPFW); + + return 0; } /** @@ -605,33 +562,30 @@ realloc_dynamic_table(void) * - "parent" rules for the above (O_LIMIT_PARENT). */ static ipfw_dyn_rule * -add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) +add_dyn_rule(struct ipfw_flow_id *id, int i, u_int8_t dyn_type, struct ip_fw *rule) { ipfw_dyn_rule *r; - int i; - IPFW_DYN_LOCK_ASSERT(); + IPFW_BUCK_ASSERT(i); - if (V_ipfw_dyn_v == NULL || - (V_dyn_count == 0 && V_dyn_buckets != V_curr_dyn_buckets)) { - realloc_dynamic_table(); - if (V_ipfw_dyn_v == NULL) - return NULL; /* failed ! */ - } - i = hash_packet(id); - - r = uma_zalloc(ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); + r = uma_zalloc(V_ipfw_dyn_rule_zone, M_NOWAIT | M_ZERO); if (r == NULL) { - printf ("ipfw: sorry cannot allocate state\n"); + if (last_log != time_uptime) { + last_log = time_uptime; + log(LOG_DEBUG, "ipfw: %s: Cannot allocate rule\n", + __func__); + } return NULL; } - /* increase refcount on parent, and set pointer */ + /* + * refcount on parent is already incremented, so + * it is safe to use parent unlocked. + */ if (dyn_type == O_LIMIT) { ipfw_dyn_rule *parent = (ipfw_dyn_rule *)rule; if ( parent->dyn_type != O_LIMIT_PARENT) panic("invalid parent"); - parent->count++; r->parent = parent; rule = parent->rule; } @@ -644,9 +598,8 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ r->count = 0; r->bucket = i; - r->next = V_ipfw_dyn_v[i]; - V_ipfw_dyn_v[i] = r; - V_dyn_count++; + r->next = V_ipfw_dyn_v[i].head; + V_ipfw_dyn_v[i].head = r; DEB(print_dyn_rule(id, dyn_type, "add dyn entry", "total");) return r; } @@ -656,40 +609,40 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ * If the lookup fails, then install one. */ static ipfw_dyn_rule * -lookup_dyn_parent(struct ipfw_flow_id *pkt, struct ip_fw *rule) +lookup_dyn_parent(struct ipfw_flow_id *pkt, int *pindex, struct ip_fw *rule) { ipfw_dyn_rule *q; - int i; + int i, is_v6; - IPFW_DYN_LOCK_ASSERT(); + is_v6 = IS_IP6_FLOW_ID(pkt); + i = hash_packet( pkt, V_curr_dyn_buckets ); + *pindex = i; + IPFW_BUCK_LOCK(i); + for (q = V_ipfw_dyn_v[i].head ; q != NULL ; q=q->next) + if (q->dyn_type == O_LIMIT_PARENT && + rule== q->rule && + pkt->proto == q->id.proto && + pkt->src_port == q->id.src_port && + pkt->dst_port == q->id.dst_port && + ( + (is_v6 && + IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), + &(q->id.src_ip6)) && + IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), + &(q->id.dst_ip6))) || + (!is_v6 && + pkt->src_ip == q->id.src_ip && + pkt->dst_ip == q->id.dst_ip) + ) + ) { + q->expire = time_uptime + V_dyn_short_lifetime; + DEB(print_dyn_rule(pkt, q->dyn_type, + "lookup_dyn_parent found", "");) + return q; + } - if (V_ipfw_dyn_v) { - int is_v6 = IS_IP6_FLOW_ID(pkt); - i = hash_packet( pkt ); - for (q = V_ipfw_dyn_v[i] ; q != NULL ; q=q->next) - if (q->dyn_type == O_LIMIT_PARENT && - rule== q->rule && - pkt->proto == q->id.proto && - pkt->src_port == q->id.src_port && - pkt->dst_port == q->id.dst_port && - ( - (is_v6 && - IN6_ARE_ADDR_EQUAL(&(pkt->src_ip6), - &(q->id.src_ip6)) && - IN6_ARE_ADDR_EQUAL(&(pkt->dst_ip6), - &(q->id.dst_ip6))) || - (!is_v6 && - pkt->src_ip == q->id.src_ip && - pkt->dst_ip == q->id.dst_ip) - ) - ) { - q->expire = time_uptime + V_dyn_short_lifetime; - DEB(print_dyn_rule(pkt, q->dyn_type, - "lookup_dyn_parent found", "");) - return q; - } - } - return add_dyn_rule(pkt, O_LIMIT_PARENT, rule); + /* Add virtual limiting rule */ + return add_dyn_rule(pkt, i, O_LIMIT_PARENT, rule); } /** @@ -702,14 +655,16 @@ int ipfw_install_state(struct ip_fw *rule, ipfw_insn_limit *cmd, struct ip_fw_args *args, uint32_t tablearg) { - static int last_log; ipfw_dyn_rule *q; + int i; DEB(print_dyn_rule(&args->f_id, cmd->o.opcode, "install_state", "");) + + i = hash_packet(&args->f_id, V_curr_dyn_buckets); - IPFW_DYN_LOCK(); + IPFW_BUCK_LOCK(i); - q = lookup_dyn_rule_locked(&args->f_id, NULL, NULL); + q = lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL); if (q != NULL) { /* should never occur */ DEB( @@ -718,26 +673,20 @@ ipfw_install_state(struct ip_fw *rule, i printf("ipfw: %s: entry already present, done\n", __func__); }) - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); return (0); } - if (V_dyn_count >= V_dyn_max) - /* Run out of slots, try to remove any expired rule. */ - remove_dyn_rule(NULL, (ipfw_dyn_rule *)1); - - if (V_dyn_count >= V_dyn_max) { - if (last_log != time_uptime) { - last_log = time_uptime; - printf("ipfw: %s: Too many dynamic rules\n", __func__); - } - IPFW_DYN_UNLOCK(); - return (1); /* cannot install, notify caller */ - } + /* + * State limiting is done via uma(9) zone limiting. + * Save pointer to newly-installed rule and reject + * packet if add_dyn_rule() returned NULL. + * Note q is currently set to NULL. + */ switch (cmd->o.opcode) { case O_KEEP_STATE: /* bidir rule */ - add_dyn_rule(&args->f_id, O_KEEP_STATE, rule); + q = add_dyn_rule(&args->f_id, i, O_KEEP_STATE, rule); break; case O_LIMIT: { /* limit number of sessions */ @@ -745,6 +694,7 @@ ipfw_install_state(struct ip_fw *rule, i ipfw_dyn_rule *parent; uint32_t conn_limit; uint16_t limit_mask = cmd->limit_mask; + int pindex; conn_limit = (cmd->conn_limit == IP_FW_TABLEARG) ? tablearg : cmd->conn_limit; @@ -778,46 +728,65 @@ ipfw_install_state(struct ip_fw *rule, i id.src_port = args->f_id.src_port; if (limit_mask & DYN_DST_PORT) id.dst_port = args->f_id.dst_port; - if ((parent = lookup_dyn_parent(&id, rule)) == NULL) { + + /* + * We have to release lock for previous bucket to + * avoid possible deadlock + */ + IPFW_BUCK_UNLOCK(i); + + if ((parent = lookup_dyn_parent(&id, &pindex, rule)) == NULL) { printf("ipfw: %s: add parent failed\n", __func__); - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(pindex); return (1); } if (parent->count >= conn_limit) { - /* See if we can remove some expired rule. */ - remove_dyn_rule(rule, parent); - if (parent->count >= conn_limit) { - if (V_fw_verbose && last_log != time_uptime) { - last_log = time_uptime; - char sbuf[24]; - last_log = time_uptime; - snprintf(sbuf, sizeof(sbuf), - "%d drop session", - parent->rule->rulenum); - print_dyn_rule_flags(&args->f_id, - cmd->o.opcode, - LOG_SECURITY | LOG_DEBUG, - sbuf, "too many entries"); - } - IPFW_DYN_UNLOCK(); - return (1); + if (V_fw_verbose && last_log != time_uptime) { + last_log = time_uptime; + char sbuf[24]; + last_log = time_uptime; + snprintf(sbuf, sizeof(sbuf), + "%d drop session", + parent->rule->rulenum); + print_dyn_rule_flags(&args->f_id, + cmd->o.opcode, + LOG_SECURITY | LOG_DEBUG, + sbuf, "too many entries"); } + IPFW_BUCK_UNLOCK(pindex); + return (1); + } + /* Increment counter on parent */ + parent->count++; + IPFW_BUCK_UNLOCK(pindex); + + IPFW_BUCK_LOCK(i); + q = add_dyn_rule(&args->f_id, i, O_LIMIT, (struct ip_fw *)parent); + if (q == NULL) { + /* Decrement index and notify caller */ + IPFW_BUCK_UNLOCK(i); + IPFW_BUCK_LOCK(pindex); + parent->count--; + IPFW_BUCK_UNLOCK(pindex); + return (1); } - add_dyn_rule(&args->f_id, O_LIMIT, (struct ip_fw *)parent); break; } default: printf("ipfw: %s: unknown dynamic rule type %u\n", __func__, cmd->o.opcode); - IPFW_DYN_UNLOCK(); - return (1); + } + + if (q == NULL) { + IPFW_BUCK_UNLOCK(i); + return (1); /* Notify caller about failure */ } /* XXX just set lifetime */ - lookup_dyn_rule_locked(&args->f_id, NULL, NULL); + lookup_dyn_rule_locked(&args->f_id, i, NULL, NULL); - IPFW_DYN_UNLOCK(); + IPFW_BUCK_UNLOCK(i); return (0); } @@ -996,23 +965,92 @@ ipfw_dyn_send_ka(struct mbuf **mtailp, i } /* - * This procedure is only used to handle keepalives. It is invoked - * every dyn_keepalive_period + * This procedure is used to perform various maintance + * on dynamic hash list. Currently it is called every second. */ static void -ipfw_tick(void * vnetx) +ipfw_dyn_tick(void * vnetx) { - struct mbuf *m0, *m, *mnext, **mtailp; - struct ip *h; - int i; - ipfw_dyn_rule *q; + struct ip_fw_chain *chain; + int check_ka = 0; #ifdef VIMAGE struct vnet *vp = vnetx; #endif CURVNET_SET(vp); - if (V_dyn_keepalive == 0 || V_ipfw_dyn_v == NULL || V_dyn_count == 0) - goto done; + + chain = &V_layer3_chain; + + /* Run keepalive checks every keepalive_interval iff ka is enabled */ + if ((V_dyn_keepalive_last + V_dyn_keepalive_interval >= time_uptime) && + (V_dyn_keepalive != 0)) { + V_dyn_keepalive_last = time_uptime; + check_ka = 1; + } + + check_dyn_rules(chain, NULL, RESVD_SET, check_ka, 1); + + callout_reset_on(&V_ipfw_timeout, hz, ipfw_dyn_tick, vnetx, 0); + + CURVNET_RESTORE(); +} + + +/* + * Walk thru all dynamic states doing generic maintance: + * 1) free expired states + * 2) free all states based on deleted rule / set + * 3) send keepalives for states if needed + * + * @chain - pointer to current ipfw rules chain + * @rule - delete all states originated by given rule if != NULL + * @set - delete all states originated by any rule in set @set if != RESVD_SET + * @check_ka - perform checking/sending keepalives + * @timer - indicate call from timer routine. + * + * Timer routine must call this function unlocked to permit + * sending keepalives/resizing table. + * + * Others has to call function with IPFW_UH_WLOCK held. + * Additionally, function assume that dynamic rule/set is + * ALREADY deleted so no new states can be generated by + * 'deleted' rules. + * + * Write lock is needed to ensure that unused parent rules + * are not freed by other instance (see stage 2, 3) + */ +static void +check_dyn_rules(struct ip_fw_chain *chain, struct ip_fw *rule, + int set, int check_ka, int timer) +{ + struct mbuf *m0, *m, *mnext, **mtailp; + struct ip *h; + int i, dyn_count, new_buckets = 0, max_buckets; + int expired = 0, expired_limits = 0, parents = 0, total = 0; + ipfw_dyn_rule *q, *q_prev, *q_next; + ipfw_dyn_rule *exp_head, **exptailp; + ipfw_dyn_rule *exp_lhead, **expltailp; + + KASSERT(V_ipfw_dyn_v != NULL, ("%s: dynamic table not allocated", + __func__)); + + /* Avoid possible LOR */ + KASSERT(!check_ka || timer, ("%s: keepalive check with lock held", + __func__)); + + /* + * Do not perform any checks if we currently have no dynamic states + */ + if (DYN_COUNT == 0) + return; + + /* Expired states */ + exp_head = NULL; + exptailp = &exp_head; + + /* Expired limit states */ + exp_lhead = NULL; + expltailp = &exp_lhead; /* * We make a chain of packets to go out here -- not deferring @@ -1022,26 +1060,211 @@ ipfw_tick(void * vnetx) */ m0 = NULL; mtailp = &m0; - IPFW_DYN_LOCK(); + + /* Protect from hash resizing */ + if (timer != 0) + IPFW_UH_WLOCK(chain); + else + IPFW_UH_WLOCK_ASSERT(chain); + +#define NEXT_RULE() { q_prev = q; q = q->next ; continue; } + + /* Stage 1: perform requested deletion */ for (i = 0 ; i < V_curr_dyn_buckets ; i++) { - for (q = V_ipfw_dyn_v[i] ; q ; q = q->next ) { - if (q->dyn_type == O_LIMIT_PARENT) - continue; - if (TIME_LEQ(q->expire, time_uptime)) - continue; /* too late, rule expired */ + IPFW_BUCK_LOCK(i); + for (q = V_ipfw_dyn_v[i].head, q_prev = q; q ; ) { + /* account every rule */ + total++; - if (q->id.proto != IPPROTO_TCP) - continue; - if ( (q->state & BOTH_SYN) != BOTH_SYN) + /* Skip parent rules at all */ + if (q->dyn_type == O_LIMIT_PARENT) { + parents++; + NEXT_RULE(); + } + + /* + * Remove rules which are: + * 1) expired + * 2) created by given rule + * 3) created by any rule in given set + */ + if ((TIME_LEQ(q->expire, time_uptime)) || + ((rule != NULL) && (q->rule == rule)) || + ((set != RESVD_SET) && (q->rule->set == set))) { + /* Unlink q from current list */ + q_next = q->next; + if (q == V_ipfw_dyn_v[i].head) + V_ipfw_dyn_v[i].head = q_next; + else + q_prev->next = q_next; + + q->next = NULL; + + /* queue q to expire list */ + if (q->dyn_type != O_LIMIT) { + *exptailp = q; + exptailp = &(*exptailp)->next; + DEB(print_dyn_rule(&q->id, q->dyn_type, + "unlink entry", "left"); + ) + } else { + /* Separate list for limit rules */ + *expltailp = q; + expltailp = &(*expltailp)->next; + expired_limits++; + DEB(print_dyn_rule(&q->id, q->dyn_type, + "unlink limit entry", "left"); + ) + } + + q = q_next; + expired++; continue; - if (TIME_LEQ(time_uptime + V_dyn_keepalive_interval, - q->expire)) - continue; /* too early */ + } + + /* + * Check if we need to send keepalive: + * we need to ensure if is time to do KA, + * this is established TCP session, and + * expire time is within keepalive interval + */ + if ((check_ka != 0) && (q->id.proto == IPPROTO_TCP) && + ((q->state & BOTH_SYN) == BOTH_SYN) && + (TIME_LEQ(q->expire, time_uptime + + V_dyn_keepalive_interval))) + mtailp = ipfw_dyn_send_ka(mtailp, q); + + NEXT_RULE(); + } + IPFW_BUCK_UNLOCK(i); + } + + /* Stage 2: decrement counters from O_LIMIT parents */ + if (expired_limits != 0) { + /* + * XXX: Note that deleting set with more than one + * heavily-used LIMIT rules can result in overwhelming + * locking due to lack of per-hash value sorting + * + * We should probably think about: + * 1) pre-allocating hash of size, say, + * MAX(16, V_curr_dyn_buckets / 1024) + * 2) checking if expired_limits is large enough + * 3) If yes, init hash (or its part), re-link + * current list and start decrementing procedure in + * each bucket separately + */ + + /* + * Small optimization: do not unlock bucket until + * we see the next item resides in different bucket + */ + if (exp_lhead != NULL) { + i = exp_lhead->parent->bucket; + IPFW_BUCK_LOCK(i); + } + for (q = exp_lhead; q != NULL; q = q->next) { + if (i != q->parent->bucket) { + IPFW_BUCK_UNLOCK(i); + i = q->parent->bucket; + IPFW_BUCK_LOCK(i); + } - mtailp = ipfw_dyn_send_ka(mtailp, q); + /* Decrease parent refcount */ + q->parent->count--; + } + if (exp_lhead != NULL) + IPFW_BUCK_UNLOCK(i); + } + + /* + * We protectet ourselves from unused parent deletion + * (from the timer function) by holding UH write lock. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 19:36:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE1B5310; Fri, 30 Nov 2012 19:36:55 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CA3528FC17; Fri, 30 Nov 2012 19:36:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUJatfU044339; Fri, 30 Nov 2012 19:36:55 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUJatp4044335; Fri, 30 Nov 2012 19:36:55 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201211301936.qAUJatp4044335@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Fri, 30 Nov 2012 19:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243711 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 19:36:56 -0000 Author: melifaro Date: Fri Nov 30 19:36:55 2012 New Revision: 243711 URL: http://svnweb.freebsd.org/changeset/base/243711 Log: Use common macros for working with rule/dynamic counters. This is done as preparation to introduce per-cpu ipfw counters. MFC after: 3 weeks Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Fri Nov 30 19:36:20 2012 (r243710) +++ head/sys/netpfil/ipfw/ip_fw2.c Fri Nov 30 19:36:55 2012 (r243711) @@ -2034,8 +2034,7 @@ do { \ * the parent rule by setting * f, cmd, l and clearing cmdlen. */ - q->pcnt++; - q->bcnt += pktlen; + IPFW_INC_DYN_COUNTER(q, pktlen); /* XXX we would like to have f_pos * readily accessible in the dynamic * rule, instead of having to @@ -2096,16 +2095,12 @@ do { \ break; case O_COUNT: - f->pcnt++; /* update stats */ - f->bcnt += pktlen; - f->timestamp = time_uptime; + IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* exit inner loop */ break; case O_SKIPTO: - f->pcnt++; /* update stats */ - f->bcnt += pktlen; - f->timestamp = time_uptime; + IPFW_INC_RULE_COUNTER(f, pktlen); /* If possible use cached f_pos (in f->next_rule), * whose version is written in f->next_rule * (horrible hacks to avoid changing the ABI). @@ -2202,9 +2197,7 @@ do { \ break; } - f->pcnt++; /* update stats */ - f->bcnt += pktlen; - f->timestamp = time_uptime; + IPFW_INC_RULE_COUNTER(f, pktlen); stack = (uint16_t *)(mtag + 1); /* @@ -2357,9 +2350,7 @@ do { \ case O_SETFIB: { uint32_t fib; - f->pcnt++; /* update stats */ - f->bcnt += pktlen; - f->timestamp = time_uptime; + IPFW_INC_RULE_COUNTER(f, pktlen); fib = (cmd->arg1 == IP_FW_TABLEARG) ? tablearg: cmd->arg1; if (fib >= rt_numfibs) @@ -2409,8 +2400,7 @@ do { \ case O_REASS: { int ip_off; - f->pcnt++; - f->bcnt += pktlen; + IPFW_INC_RULE_COUNTER(f, pktlen); l = 0; /* in any case exit inner loop */ ip_off = ntohs(ip->ip_off); @@ -2473,9 +2463,7 @@ do { \ if (done) { struct ip_fw *rule = chain->map[f_pos]; /* Update statistics */ - rule->pcnt++; - rule->bcnt += pktlen; - rule->timestamp = time_uptime; + IPFW_INC_RULE_COUNTER(rule, pktlen); } else { retval = IP_FW_DENY; printf("ipfw: ouch!, skip past end of rules, denying packet\n"); Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 30 19:36:20 2012 (r243710) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Nov 30 19:36:55 2012 (r243711) @@ -594,7 +594,7 @@ add_dyn_rule(struct ipfw_flow_id *id, in r->expire = time_uptime + V_dyn_syn_lifetime; r->rule = rule; r->dyn_type = dyn_type; - r->pcnt = r->bcnt = 0; + IPFW_ZERO_DYN_COUNTER(r); r->count = 0; r->bucket = i; Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Fri Nov 30 19:36:20 2012 (r243710) +++ head/sys/netpfil/ipfw/ip_fw_private.h Fri Nov 30 19:36:55 2012 (r243711) @@ -236,6 +236,28 @@ struct ip_fw_chain { struct sockopt; /* used by tcp_var.h */ +/* Macro for working with various counters */ +#define IPFW_INC_RULE_COUNTER(_cntr, _bytes) do { \ + (_cntr)->pcnt++; \ + (_cntr)->bcnt += _bytes; \ + (_cntr)->timestamp = time_uptime; \ + } while (0) + +#define IPFW_INC_DYN_COUNTER(_cntr, _bytes) do { \ + (_cntr)->pcnt++; \ + (_cntr)->bcnt += _bytes; \ + } while (0) + +#define IPFW_ZERO_RULE_COUNTER(_cntr) do { \ + (_cntr)->pcnt = 0; \ + (_cntr)->bcnt = 0; \ + (_cntr)->timestamp = 0; \ + } while (0) + +#define IPFW_ZERO_DYN_COUNTER(_cntr) do { \ + (_cntr)->pcnt = 0; \ + (_cntr)->bcnt = 0; \ + } while (0) /* * The lock is heavily used by ip_fw2.c (the main file) and ip_fw_nat.c * so the variable and the macros must be here. Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Nov 30 19:36:20 2012 (r243710) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Nov 30 19:36:55 2012 (r243711) @@ -175,9 +175,7 @@ ipfw_add_rule(struct ip_fw_chain *chain, /* clear fields not settable from userland */ rule->x_next = NULL; rule->next_rule = NULL; - rule->pcnt = 0; - rule->bcnt = 0; - rule->timestamp = 0; + IPFW_ZERO_RULE_COUNTER(rule); if (V_autoinc_step < 1) V_autoinc_step = 1; @@ -439,10 +437,8 @@ clear_counters(struct ip_fw *rule, int l { ipfw_insn_log *l = (ipfw_insn_log *)ACTION_PTR(rule); - if (log_only == 0) { - rule->bcnt = rule->pcnt = 0; - rule->timestamp = 0; - } + if (log_only == 0) + IPFW_ZERO_RULE_COUNTER(rule); if (l->o.opcode == O_LOG) l->log_left = l->max_log; } From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 20:15:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80CF6A08; Fri, 30 Nov 2012 20:15:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 66ECC8FC13; Fri, 30 Nov 2012 20:15:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUKF2NP049360; Fri, 30 Nov 2012 20:15:02 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUKF2BA049358; Fri, 30 Nov 2012 20:15:02 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201211302015.qAUKF2BA049358@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 30 Nov 2012 20:15:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243712 - in head/sys: amd64/pci i386/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 20:15:02 -0000 Author: jkim Date: Fri Nov 30 20:15:01 2012 New Revision: 243712 URL: http://svnweb.freebsd.org/changeset/base/243712 Log: Use volatile keywords properly. Modified: head/sys/amd64/pci/pci_cfgreg.c head/sys/i386/pci/pci_cfgreg.c Modified: head/sys/amd64/pci/pci_cfgreg.c ============================================================================== --- head/sys/amd64/pci/pci_cfgreg.c Fri Nov 30 19:36:55 2012 (r243711) +++ head/sys/amd64/pci/pci_cfgreg.c Fri Nov 30 20:15:01 2012 (r243712) @@ -313,7 +313,7 @@ static int pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg, unsigned bytes) { - volatile vm_offset_t va; + vm_offset_t va; int data = -1; if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || @@ -324,16 +324,16 @@ pciereg_cfgread(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("movl %1, %0" : "=a" (data) - : "m" (*(uint32_t *)va)); + __asm("movl %1, %0" : "=a" (data) + : "m" (*(volatile uint32_t *)va)); break; case 2: - __asm __volatile("movzwl %1, %0" : "=a" (data) - : "m" (*(uint16_t *)va)); + __asm("movzwl %1, %0" : "=a" (data) + : "m" (*(volatile uint16_t *)va)); break; case 1: - __asm __volatile("movzbl %1, %0" : "=a" (data) - : "m" (*(uint8_t *)va)); + __asm("movzbl %1, %0" : "=a" (data) + : "m" (*(volatile uint8_t *)va)); break; } @@ -344,7 +344,7 @@ static void pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data, unsigned bytes) { - volatile vm_offset_t va; + vm_offset_t va; if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) @@ -354,15 +354,15 @@ pciereg_cfgwrite(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va) + __asm("movl %1, %0" : "=m" (*(volatile uint32_t *)va) : "a" (data)); break; case 2: - __asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va) + __asm("movw %1, %0" : "=m" (*(volatile uint16_t *)va) : "a" ((uint16_t)data)); break; case 1: - __asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va) + __asm("movb %1, %0" : "=m" (*(volatile uint8_t *)va) : "a" ((uint8_t)data)); break; } Modified: head/sys/i386/pci/pci_cfgreg.c ============================================================================== --- head/sys/i386/pci/pci_cfgreg.c Fri Nov 30 19:36:55 2012 (r243711) +++ head/sys/i386/pci/pci_cfgreg.c Fri Nov 30 20:15:01 2012 (r243712) @@ -665,7 +665,7 @@ pciereg_cfgread(int bus, unsigned slot, unsigned bytes) { struct pcie_cfg_elem *elem; - volatile vm_offset_t va; + vm_offset_t va; vm_paddr_t pa, papage; int data = -1; @@ -681,16 +681,16 @@ pciereg_cfgread(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("movl %1, %0" : "=a" (data) - : "m" (*(uint32_t *)va)); + __asm("movl %1, %0" : "=a" (data) + : "m" (*(volatile uint32_t *)va)); break; case 2: - __asm __volatile("movzwl %1, %0" : "=a" (data) - : "m" (*(uint16_t *)va)); + __asm("movzwl %1, %0" : "=a" (data) + : "m" (*(volatile uint16_t *)va)); break; case 1: - __asm __volatile("movzbl %1, %0" : "=a" (data) - : "m" (*(uint8_t *)va)); + __asm("movzbl %1, %0" : "=a" (data) + : "m" (*(volatile uint8_t *)va)); break; } @@ -703,7 +703,7 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned bytes) { struct pcie_cfg_elem *elem; - volatile vm_offset_t va; + vm_offset_t va; vm_paddr_t pa, papage; if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || @@ -718,15 +718,15 @@ pciereg_cfgwrite(int bus, unsigned slot, switch (bytes) { case 4: - __asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va) + __asm("movl %1, %0" : "=m" (*(volatile uint32_t *)va) : "a" (data)); break; case 2: - __asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va) + __asm("movw %1, %0" : "=m" (*(volatile uint16_t *)va) : "a" ((uint16_t)data)); break; case 1: - __asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va) + __asm("movb %1, %0" : "=m" (*(volatile uint8_t *)va) : "a" ((uint8_t)data)); break; } From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 20:50:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A0AC1CD; Fri, 30 Nov 2012 20:50:35 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7BE8FC15; Fri, 30 Nov 2012 20:50:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUKoZ19053579; Fri, 30 Nov 2012 20:50:35 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUKoZFT053578; Fri, 30 Nov 2012 20:50:35 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201211302050.qAUKoZFT053578@svn.freebsd.org> From: "Simon J. Gerraty" Date: Fri, 30 Nov 2012 20:50:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243713 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 20:50:35 -0000 Author: sjg Date: Fri Nov 30 20:50:34 2012 New Revision: 243713 URL: http://svnweb.freebsd.org/changeset/base/243713 Log: The build-tools step during build32 also needs the -legacy magic. Approved by: marcel (mentor) Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Nov 30 20:15:01 2012 (r243712) +++ head/Makefile.inc1 Fri Nov 30 20:50:34 2012 (r243713) @@ -511,6 +511,8 @@ build32: .endfor .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic cd ${.CURDIR}/${_dir}; \ + WORLDTMP=${WORLDTMP} \ + MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ -DEARLY_BUILD build-tools From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 20:52:53 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ABB5D359; Fri, 30 Nov 2012 20:52:53 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vps.rulingia.com (host-122-100-2-194.octopus.com.au [122.100.2.194]) by mx1.freebsd.org (Postfix) with ESMTP id 1AF228FC0C; Fri, 30 Nov 2012 20:52:52 +0000 (UTC) Received: from server.rulingia.com (c220-239-239-142.belrs5.nsw.optusnet.com.au [220.239.239.142]) by vps.rulingia.com (8.14.5/8.14.5) with ESMTP id qAUKqhJd070945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 1 Dec 2012 07:52:44 +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.5/8.14.5) with ESMTP id qAUKqbVM069282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 1 Dec 2012 07:52:37 +1100 (EST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.14.5/8.14.5/Submit) id qAUKqaBF069280; Sat, 1 Dec 2012 07:52:36 +1100 (EST) (envelope-from peter) Date: Sat, 1 Dec 2012 07:52:35 +1100 From: Peter Jeremy To: "Matthew D. Fuller" Subject: Re: svn commit: r242102 - in head: contrib/bmake usr.bin/bmake Message-ID: <20121130205235.GA84363@server.rulingia.com> References: <201210252318.q9PNI6IQ069461@svn.freebsd.org> <20121114172823.GA20127@dragon.NUXI.org> <20121114184837.GA73505@kib.kiev.ua> <20121115151622.J1179@besplex.bde.org> <20121115084121.GI66994@over-yonder.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline In-Reply-To: <20121115084121.GI66994@over-yonder.net> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 20:52:53 -0000 --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [A bit delayed] On 2012-Nov-15 02:41:22 -0600, "Matthew D. Fuller" wrote: >On Thu, Nov 15, 2012 at 06:07:27PM +1100 I heard the voice of >Bruce Evans, and lo! it spake thus: >>=20 >> Maybe malloc() would be faster with MALLOC_PRODUCTION. I use >> /etc/malloc.conf -> aj locally. freefall doesn't have >> /etc/malloc.conf. MALLOC_OPTIONS no longer works, and MALLOC_CONF >> is too large for me to understand, so I don't know how to turn off >> non-production features dynamically. > >FWIW, I suspected MALLOC_PRODUCTION in some massive slowdowns I see >from time to time on my -CURRENT box. Most vividly around running >portupgrade-related bits (portupgrade, pkgdb, etc). I got annoyed by >it enough a few weeks ago to write up a quickie to bang malloc() >around and see what happened. Attached, just for grins. Not defining MALLOC_PRODUCTION causes quite significant startup costs for any process that uses malloc() at all. In this case, jemalloc verifies that memory obtained from the kernel is zero-filled, causing (thousands of unnecessary) page faults. For a short-running process that doesn't allocate all the space in the jemalloc arenas, this dominates the runtime - in the case of /bin/echo, I measured 87 page faults with MALLOC_PRODUCTION and 2133 without. --=20 Peter Jeremy --VS++wcV0S1rZb1Fb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlC5HJMACgkQ/opHv/APuIeCqACgtQM6+UkZ7zbht12xgkTZoilv Mf0AoJ0aeI5dZENkCDFSkE2RX3PNZJ9D =nraQ -----END PGP SIGNATURE----- --VS++wcV0S1rZb1Fb-- From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:19:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EC40EB72; Fri, 30 Nov 2012 22:19:18 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D14428FC08; Fri, 30 Nov 2012 22:19:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMJIbw065474; Fri, 30 Nov 2012 22:19:18 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMJIkI065470; Fri, 30 Nov 2012 22:19:18 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302219.qAUMJIkI065470@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 22:19:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243714 - in head/sys/dev: ixgbe netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:19:19 -0000 Author: jfv Date: Fri Nov 30 22:19:18 2012 New Revision: 243714 URL: http://svnweb.freebsd.org/changeset/base/243714 Log: First of a series of 11 patches leading to new ixgbe version 2.5.0 This removes the header split and supporting code from the driver. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/netmap/ixgbe_netmap.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 20:50:34 2012 (r243713) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:19:18 2012 (r243714) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.4.11"; +char ixgbe_driver_version[] = "2.5.0 - 1"; /********************************************************************* * PCI Device ID Table @@ -266,15 +266,6 @@ static int ixgbe_enable_msix = 1; TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* - * Header split: this causes the hardware to DMA - * the header into a separate mbuf from the payload, - * it can be a performance win in some workloads, but - * in others it actually hurts, its off by default. - */ -static int ixgbe_header_split = FALSE; -TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split); - -/* * Number of Queues, can be set to 0, * it then autoconfigures based on the * number of cpus with a max of 8. This @@ -1117,7 +1108,7 @@ ixgbe_init_locked(struct adapter *adapte /* ** Determine the correct mbuf pool - ** for doing jumbo/headersplit + ** for doing jumbo frames */ if (adapter->max_frame_size <= 2048) adapter->rx_mbuf_sz = MCLBYTES; @@ -3728,10 +3719,9 @@ static void ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) { struct adapter *adapter = rxr->adapter; - bus_dma_segment_t hseg[1]; - bus_dma_segment_t pseg[1]; + bus_dma_segment_t seg[1]; struct ixgbe_rx_buf *rxbuf; - struct mbuf *mh, *mp; + struct mbuf *mp; int i, j, nsegs, error; bool refreshed = FALSE; @@ -3742,43 +3732,13 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, while (j != limit) { rxbuf = &rxr->rx_buffers[i]; - if (rxr->hdr_split == FALSE) - goto no_split; - - if (rxbuf->m_head == NULL) { - mh = m_gethdr(M_DONTWAIT, MT_DATA); - if (mh == NULL) - goto update; - } else - mh = rxbuf->m_head; - - mh->m_pkthdr.len = mh->m_len = MHLEN; - mh->m_len = MHLEN; - mh->m_flags |= M_PKTHDR; - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->htag, - rxbuf->hmap, mh, hseg, &nsegs, BUS_DMA_NOWAIT); - if (error != 0) { - printf("Refresh mbufs: hdr dmamap load" - " failure - %d\n", error); - m_free(mh); - rxbuf->m_head = NULL; - goto update; - } - rxbuf->m_head = mh; - bus_dmamap_sync(rxr->htag, rxbuf->hmap, - BUS_DMASYNC_PREREAD); - rxr->rx_base[i].read.hdr_addr = - htole64(hseg[0].ds_addr); - -no_split: - if (rxbuf->m_pack == NULL) { + if (rxbuf->buf == NULL) { mp = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (mp == NULL) goto update; } else - mp = rxbuf->m_pack; + mp = rxbuf->buf; mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; @@ -3787,22 +3747,22 @@ no_split: */ if ((rxbuf->flags & IXGBE_RX_COPY) == 0) { /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->ptag, - rxbuf->pmap, mp, pseg, &nsegs, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(rxr->tag, + rxbuf->map, mp, seg, &nsegs, BUS_DMA_NOWAIT); if (error != 0) { printf("Refresh mbufs: payload dmamap load" " failure - %d\n", error); m_free(mp); - rxbuf->m_pack = NULL; + rxbuf->buf = NULL; goto update; } - rxbuf->m_pack = mp; - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + rxbuf->buf = mp; + bus_dmamap_sync(rxr->tag, rxbuf->map, BUS_DMASYNC_PREREAD); - rxbuf->paddr = rxr->rx_base[i].read.pkt_addr = - htole64(pseg[0].ds_addr); + rxbuf->addr = rxr->rx_base[i].read.pkt_addr = + htole64(seg[0].ds_addr); } else { - rxr->rx_base[i].read.pkt_addr = rxbuf->paddr; + rxr->rx_base[i].read.pkt_addr = rxbuf->addr; rxbuf->flags &= ~IXGBE_RX_COPY; } @@ -3850,45 +3810,23 @@ ixgbe_allocate_receive_buffers(struct rx BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSIZE, /* maxsize */ - 1, /* nsegments */ - MSIZE, /* maxsegsize */ - 0, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockfuncarg */ - &rxr->htag))) { - device_printf(dev, "Unable to create RX DMA tag\n"); - goto fail; - } - - if ((error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ - 1, 0, /* alignment, bounds */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ MJUM16BYTES, /* maxsize */ 1, /* nsegments */ MJUM16BYTES, /* maxsegsize */ 0, /* flags */ NULL, /* lockfunc */ NULL, /* lockfuncarg */ - &rxr->ptag))) { + &rxr->tag))) { device_printf(dev, "Unable to create RX DMA tag\n"); goto fail; } for (i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; - error = bus_dmamap_create(rxr->htag, - BUS_DMA_NOWAIT, &rxbuf->hmap); - if (error) { - device_printf(dev, "Unable to create RX head map\n"); - goto fail; - } - error = bus_dmamap_create(rxr->ptag, - BUS_DMA_NOWAIT, &rxbuf->pmap); + error = bus_dmamap_create(rxr->tag, + BUS_DMA_NOWAIT, &rxbuf->map); if (error) { - device_printf(dev, "Unable to create RX pkt map\n"); + device_printf(dev, "Unable to create RX dma map\n"); goto fail; } } @@ -3986,22 +3924,14 @@ ixgbe_free_receive_ring(struct rx_ring * adapter = rxr->adapter; for (i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) { - bus_dmamap_sync(rxr->htag, rxbuf->hmap, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->htag, rxbuf->hmap); - rxbuf->m_head->m_flags |= M_PKTHDR; - m_freem(rxbuf->m_head); - } - if (rxbuf->m_pack != NULL) { - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + if (rxbuf->buf != NULL) { + bus_dmamap_sync(rxr->tag, rxbuf->map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->ptag, rxbuf->pmap); - rxbuf->m_pack->m_flags |= M_PKTHDR; - m_freem(rxbuf->m_pack); + bus_dmamap_unload(rxr->tag, rxbuf->map); + rxbuf->buf->m_flags |= M_PKTHDR; + m_freem(rxbuf->buf); + rxbuf->buf = NULL; } - rxbuf->m_head = NULL; - rxbuf->m_pack = NULL; } } @@ -4018,7 +3948,7 @@ ixgbe_setup_receive_ring(struct rx_ring struct ifnet *ifp; device_t dev; struct ixgbe_rx_buf *rxbuf; - bus_dma_segment_t pseg[1], hseg[1]; + bus_dma_segment_t seg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; #ifdef DEV_NETMAP @@ -4043,13 +3973,9 @@ ixgbe_setup_receive_ring(struct rx_ring /* Free current RX buffer structs and their mbufs */ ixgbe_free_receive_ring(rxr); - /* Configure header split? */ - if (ixgbe_header_split) - rxr->hdr_split = TRUE; - /* Now replenish the mbufs */ for (int j = 0; j != adapter->num_rx_desc; ++j) { - struct mbuf *mh, *mp; + struct mbuf *mp; rxbuf = &rxr->rx_buffers[j]; #ifdef DEV_NETMAP @@ -4066,60 +3992,30 @@ ixgbe_setup_receive_ring(struct rx_ring void *addr; addr = PNMB(slot + sj, &paddr); - netmap_load_map(rxr->ptag, rxbuf->pmap, addr); + netmap_load_map(rxr->tag, rxbuf->map, addr); /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(paddr); continue; } #endif /* DEV_NETMAP */ - /* - ** Don't allocate mbufs if not - ** doing header split, its wasteful - */ - if (rxr->hdr_split == FALSE) - goto skip_head; - - /* First the header */ - rxbuf->m_head = m_gethdr(M_NOWAIT, MT_DATA); - if (rxbuf->m_head == NULL) { - error = ENOBUFS; - goto fail; - } - m_adj(rxbuf->m_head, ETHER_ALIGN); - mh = rxbuf->m_head; - mh->m_len = mh->m_pkthdr.len = MHLEN; - mh->m_flags |= M_PKTHDR; - /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->htag, - rxbuf->hmap, rxbuf->m_head, hseg, - &nsegs, BUS_DMA_NOWAIT); - if (error != 0) /* Nothing elegant to do here */ - goto fail; - bus_dmamap_sync(rxr->htag, - rxbuf->hmap, BUS_DMASYNC_PREREAD); - /* Update descriptor */ - rxr->rx_base[j].read.hdr_addr = htole64(hseg[0].ds_addr); - -skip_head: - /* Now the payload cluster */ - rxbuf->m_pack = m_getjcl(M_NOWAIT, MT_DATA, + rxbuf->buf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); - if (rxbuf->m_pack == NULL) { + if (rxbuf->buf == NULL) { error = ENOBUFS; goto fail; } - mp = rxbuf->m_pack; + mp = rxbuf->buf; mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; /* Get the memory mapping */ - error = bus_dmamap_load_mbuf_sg(rxr->ptag, - rxbuf->pmap, mp, pseg, + error = bus_dmamap_load_mbuf_sg(rxr->tag, + rxbuf->map, mp, seg, &nsegs, BUS_DMA_NOWAIT); if (error != 0) goto fail; - bus_dmamap_sync(rxr->ptag, - rxbuf->pmap, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(rxr->tag, + rxbuf->map, BUS_DMASYNC_PREREAD); /* Update descriptor */ - rxr->rx_base[j].read.pkt_addr = htole64(pseg[0].ds_addr); + rxr->rx_base[j].read.pkt_addr = htole64(seg[0].ds_addr); } @@ -4127,7 +4023,6 @@ skip_head: rxr->next_to_check = 0; rxr->next_to_refresh = 0; rxr->lro_enabled = FALSE; - rxr->rx_split_packets = 0; rxr->rx_copies = 0; rxr->rx_bytes = 0; rxr->discard = FALSE; @@ -4258,14 +4153,7 @@ ixgbe_initialize_receive_units(struct ad srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; srrctl &= ~IXGBE_SRRCTL_BSIZEPKT_MASK; srrctl |= bufsz; - if (rxr->hdr_split) { - /* Use a standard mbuf for the header */ - srrctl |= ((IXGBE_RX_HDR << - IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) - & IXGBE_SRRCTL_BSIZEHDR_MASK); - srrctl |= IXGBE_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS; - } else - srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF; + srrctl |= IXGBE_SRRCTL_DESCTYPE_ADV_ONEBUF; IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(i), srrctl); /* Setup the HW Rx Head and Tail Descriptor Pointers */ @@ -4371,29 +4259,17 @@ ixgbe_free_receive_buffers(struct rx_rin if (rxr->rx_buffers != NULL) { for (int i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; - if (rxbuf->m_head != NULL) { - bus_dmamap_sync(rxr->htag, rxbuf->hmap, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->htag, rxbuf->hmap); - rxbuf->m_head->m_flags |= M_PKTHDR; - m_freem(rxbuf->m_head); - } - if (rxbuf->m_pack != NULL) { - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + if (rxbuf->buf != NULL) { + bus_dmamap_sync(rxr->tag, rxbuf->map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(rxr->ptag, rxbuf->pmap); - rxbuf->m_pack->m_flags |= M_PKTHDR; - m_freem(rxbuf->m_pack); - } - rxbuf->m_head = NULL; - rxbuf->m_pack = NULL; - if (rxbuf->hmap != NULL) { - bus_dmamap_destroy(rxr->htag, rxbuf->hmap); - rxbuf->hmap = NULL; + bus_dmamap_unload(rxr->tag, rxbuf->map); + rxbuf->buf->m_flags |= M_PKTHDR; + m_freem(rxbuf->buf); } - if (rxbuf->pmap != NULL) { - bus_dmamap_destroy(rxr->ptag, rxbuf->pmap); - rxbuf->pmap = NULL; + rxbuf->buf = NULL; + if (rxbuf->map != NULL) { + bus_dmamap_destroy(rxr->tag, rxbuf->map); + rxbuf->map = NULL; } } if (rxr->rx_buffers != NULL) { @@ -4402,13 +4278,9 @@ ixgbe_free_receive_buffers(struct rx_rin } } - if (rxr->htag != NULL) { - bus_dma_tag_destroy(rxr->htag); - rxr->htag = NULL; - } - if (rxr->ptag != NULL) { - bus_dma_tag_destroy(rxr->ptag); - rxr->ptag = NULL; + if (rxr->tag != NULL) { + bus_dma_tag_destroy(rxr->tag); + rxr->tag = NULL; } return; @@ -4467,16 +4339,11 @@ ixgbe_rx_discard(struct rx_ring *rxr, in ** the normal refresh path to get new buffers ** and mapping. */ - if (rbuf->m_head) { - m_free(rbuf->m_head); - rbuf->m_head = NULL; + if (rbuf->buf) { + m_free(rbuf->buf); + rbuf->buf = NULL; } - if (rbuf->m_pack) { - m_free(rbuf->m_pack); - rbuf->m_pack = NULL; - } - return; } @@ -4527,9 +4394,9 @@ ixgbe_rxeof(struct ix_queue *que, int co } #endif /* DEV_NETMAP */ for (i = rxr->next_to_check; count != 0;) { - struct mbuf *sendmp, *mh, *mp; + struct mbuf *sendmp, *mp; u32 rsc, ptype; - u16 hlen, plen, hdr; + u16 len; u16 vtag = 0; bool eop; @@ -4551,19 +4418,13 @@ ixgbe_rxeof(struct ix_queue *que, int co rsc = 0; cur->wb.upper.status_error = 0; rbuf = &rxr->rx_buffers[i]; - mh = rbuf->m_head; - mp = rbuf->m_pack; + mp = rbuf->buf; - plen = le16toh(cur->wb.upper.length); + len = le16toh(cur->wb.upper.length); ptype = le32toh(cur->wb.lower.lo_dword.data) & IXGBE_RXDADV_PKTTYPE_MASK; - hdr = le16toh(cur->wb.lower.lo_dword.hs_rss.hdr_info); eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); - /* Process vlan info */ - if ((rxr->vtag_strip) && (staterr & IXGBE_RXD_STAT_VP)) - vtag = le16toh(cur->wb.upper.vlan); - /* Make sure bad packets are discarded */ if (((staterr & IXGBE_RXDADV_ERR_FRAME_ERR_MASK) != 0) || (rxr->discard)) { @@ -4611,130 +4472,71 @@ ixgbe_rxeof(struct ix_queue *que, int co prefetch(nbuf); } /* - ** The header mbuf is ONLY used when header - ** split is enabled, otherwise we get normal - ** behavior, ie, both header and payload - ** are DMA'd into the payload buffer. - ** ** Rather than using the fmp/lmp global pointers ** we now keep the head of a packet chain in the ** buffer struct and pass this along from one ** descriptor to the next, until we get EOP. */ - if (rxr->hdr_split && (rbuf->fmp == NULL)) { - /* This must be an initial descriptor */ - hlen = (hdr & IXGBE_RXDADV_HDRBUFLEN_MASK) >> - IXGBE_RXDADV_HDRBUFLEN_SHIFT; - if (hlen > IXGBE_RX_HDR) - hlen = IXGBE_RX_HDR; - mh->m_len = hlen; - mh->m_flags |= M_PKTHDR; - mh->m_next = NULL; - mh->m_pkthdr.len = mh->m_len; - /* Null buf pointer so it is refreshed */ - rbuf->m_head = NULL; - /* - ** Check the payload length, this - ** could be zero if its a small - ** packet. - */ - if (plen > 0) { - mp->m_len = plen; - mp->m_next = NULL; - mp->m_flags &= ~M_PKTHDR; - mh->m_next = mp; - mh->m_pkthdr.len += mp->m_len; - /* Null buf pointer so it is refreshed */ - rbuf->m_pack = NULL; - rxr->rx_split_packets++; - } - /* - ** Now create the forward - ** chain so when complete - ** we wont have to. - */ - if (eop == 0) { - /* stash the chain head */ - nbuf->fmp = mh; - /* Make forward chain */ - if (plen) - mp->m_next = nbuf->m_pack; - else - mh->m_next = nbuf->m_pack; - } else { - /* Singlet, prepare to send */ - sendmp = mh; - /* If hardware handled vtag */ - if (vtag) { - sendmp->m_pkthdr.ether_vtag = vtag; - sendmp->m_flags |= M_VLANTAG; - } - } + mp->m_len = len; + /* + ** See if there is a stored head + ** that determines what we are + */ + sendmp = rbuf->fmp; + if (sendmp != NULL) { /* secondary frag */ + rbuf->buf = rbuf->fmp = NULL; + mp->m_flags &= ~M_PKTHDR; + sendmp->m_pkthdr.len += mp->m_len; } else { /* - ** Either no header split, or a - ** secondary piece of a fragmented - ** split packet. - */ - mp->m_len = plen; - /* - ** See if there is a stored head - ** that determines what we are - */ - sendmp = rbuf->fmp; - - if (sendmp != NULL) { /* secondary frag */ - rbuf->m_pack = rbuf->fmp = NULL; - mp->m_flags &= ~M_PKTHDR; - sendmp->m_pkthdr.len += mp->m_len; - } else { - /* - * Optimize. This might be a small packet, - * maybe just a TCP ACK. Do a fast copy that - * is cache aligned into a new mbuf, and - * leave the old mbuf+cluster for re-use. - */ - if (eop && plen <= IXGBE_RX_COPY_LEN) { - sendmp = m_gethdr(M_DONTWAIT, MT_DATA); - if (sendmp != NULL) { - sendmp->m_data += - IXGBE_RX_COPY_ALIGN; - ixgbe_bcopy(mp->m_data, - sendmp->m_data, plen); - sendmp->m_len = plen; - rxr->rx_copies++; - rbuf->flags |= IXGBE_RX_COPY; - } - } - if (sendmp == NULL) { - rbuf->m_pack = rbuf->fmp = NULL; - sendmp = mp; - } - - /* first desc of a non-ps chain */ - sendmp->m_flags |= M_PKTHDR; - sendmp->m_pkthdr.len = mp->m_len; - if (vtag) { - sendmp->m_pkthdr.ether_vtag = vtag; - sendmp->m_flags |= M_VLANTAG; + * Optimize. This might be a small packet, + * maybe just a TCP ACK. Do a fast copy that + * is cache aligned into a new mbuf, and + * leave the old mbuf+cluster for re-use. + */ + if (eop && len <= IXGBE_RX_COPY_LEN) { + sendmp = m_gethdr(M_NOWAIT, MT_DATA); + if (sendmp != NULL) { + sendmp->m_data += + IXGBE_RX_COPY_ALIGN; + ixgbe_bcopy(mp->m_data, + sendmp->m_data, len); + sendmp->m_len = len; + rxr->rx_copies++; + rbuf->flags |= IXGBE_RX_COPY; } - } - /* Pass the head pointer on */ - if (eop == 0) { - nbuf->fmp = sendmp; - sendmp = NULL; - mp->m_next = nbuf->m_pack; } + if (sendmp == NULL) { + rbuf->buf = rbuf->fmp = NULL; + sendmp = mp; + } + + /* first desc of a non-ps chain */ + sendmp->m_flags |= M_PKTHDR; + sendmp->m_pkthdr.len = mp->m_len; } ++processed; - /* Sending this frame? */ - if (eop) { + + /* Pass the head pointer on */ + if (eop == 0) { + nbuf->fmp = sendmp; + sendmp = NULL; + mp->m_next = nbuf->buf; + } else { /* Sending this frame */ sendmp->m_pkthdr.rcvif = ifp; ifp->if_ipackets++; rxr->rx_packets++; /* capture data for AIM */ rxr->bytes += sendmp->m_pkthdr.len; rxr->rx_bytes += sendmp->m_pkthdr.len; + /* Process vlan info */ + if ((rxr->vtag_strip) && + (staterr & IXGBE_RXD_STAT_VP)) + vtag = le16toh(cur->wb.upper.vlan); + if (vtag) { + sendmp->m_pkthdr.ether_vtag = vtag; + sendmp->m_flags |= M_VLANTAG; + } if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) ixgbe_rx_checksum(staterr, sendmp, ptype); #if __FreeBSD_version >= 800000 Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 20:50:34 2012 (r243713) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 22:19:18 2012 (r243714) @@ -253,14 +253,12 @@ struct ixgbe_tx_buf { }; struct ixgbe_rx_buf { - struct mbuf *m_head; - struct mbuf *m_pack; + struct mbuf *buf; struct mbuf *fmp; - bus_dmamap_t hmap; - bus_dmamap_t pmap; + bus_dmamap_t map; u_int flags; #define IXGBE_RX_COPY 0x01 - uint64_t paddr; + uint64_t addr; }; /* @@ -339,7 +337,6 @@ struct rx_ring { struct ixgbe_dma_alloc rxdma; struct lro_ctrl lro; bool lro_enabled; - bool hdr_split; bool hw_rsc; bool discard; bool vtag_strip; @@ -347,15 +344,13 @@ struct rx_ring { u32 next_to_check; char mtx_name[16]; struct ixgbe_rx_buf *rx_buffers; - bus_dma_tag_t htag; - bus_dma_tag_t ptag; + bus_dma_tag_t tag; u32 bytes; /* Used for AIM calc */ u32 packets; /* Soft stats */ u64 rx_irq; - u64 rx_split_packets; u64 rx_copies; u64 rx_packets; u64 rx_bytes; Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Fri Nov 30 20:50:34 2012 (r243713) +++ head/sys/dev/netmap/ixgbe_netmap.h Fri Nov 30 22:19:18 2012 (r243714) @@ -503,8 +503,8 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u ring->slot[j].len = le16toh(curr->wb.upper.length) - crclen; if (ix_write_len) D("rx[%d] len %d", j, ring->slot[j].len); - bus_dmamap_sync(rxr->ptag, - rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(rxr->tag, + rxr->rx_buffers[l].map, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; } @@ -556,12 +556,12 @@ ixgbe_netmap_rxsync(struct ifnet *ifp, u goto ring_reset; if (slot->flags & NS_BUF_CHANGED) { - netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); + netmap_reload_map(rxr->tag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } curr->wb.upper.status_error = 0; curr->read.pkt_addr = htole64(paddr); - bus_dmamap_sync(rxr->ptag, rxbuf->pmap, + bus_dmamap_sync(rxr->tag, rxbuf->map, BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; l = (l == lim) ? 0 : l + 1; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:23:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 735C4D61; Fri, 30 Nov 2012 22:23:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5960F8FC15; Fri, 30 Nov 2012 22:23:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMNOY8066010; Fri, 30 Nov 2012 22:23:24 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMNOxS066009; Fri, 30 Nov 2012 22:23:24 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302223.qAUMNOxS066009@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 22:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243715 - head/crypto/openssl/crypto/rand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:23:24 -0000 Author: pjd Date: Fri Nov 30 22:23:23 2012 New Revision: 243715 URL: http://svnweb.freebsd.org/changeset/base/243715 Log: Allow OpenSSL to use arc4random(3) on FreeBSD. arc4random(3) was modified some time ago to use sysctl instead of /dev/random to get random data, so is now much better choice, especially for sandboxed processes that have no direct access to /dev/random. Approved by: benl MFC after: 2 weeks Modified: head/crypto/openssl/crypto/rand/rand_unix.c Modified: head/crypto/openssl/crypto/rand/rand_unix.c ============================================================================== --- head/crypto/openssl/crypto/rand/rand_unix.c Fri Nov 30 22:19:18 2012 (r243714) +++ head/crypto/openssl/crypto/rand/rand_unix.c Fri Nov 30 22:23:23 2012 (r243715) @@ -216,7 +216,7 @@ int RAND_poll(void) } return 1; } -#elif defined __OpenBSD__ +#elif defined(__FreeBSD__) || defined(__OpenBSD__) int RAND_poll(void) { u_int32_t rnd = 0, i; @@ -233,7 +233,7 @@ int RAND_poll(void) return 1; } -#else /* !defined(__OpenBSD__) */ +#else /* !defined(__FreeBSD__) && !defined(__OpenBSD__) */ int RAND_poll(void) { unsigned long l; @@ -419,7 +419,7 @@ int RAND_poll(void) #endif } -#endif /* defined(__OpenBSD__) */ +#endif /* defined(__FreeBSD__) || defined(__OpenBSD__) */ #endif /* !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)) */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:33:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A07116A; Fri, 30 Nov 2012 22:33:21 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6D0388FC08; Fri, 30 Nov 2012 22:33:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMXLi2067281; Fri, 30 Nov 2012 22:33:21 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMXLX2067279; Fri, 30 Nov 2012 22:33:21 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302233.qAUMXLX2067279@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 22:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243716 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:33:21 -0000 Author: jfv Date: Fri Nov 30 22:33:21 2012 New Revision: 243716 URL: http://svnweb.freebsd.org/changeset/base/243716 Log: Patch #2 - remove OACTIVE and DEPLETED notions from the multiqueue code, this functionality has proven to be more trouble than it was worth. Thanks to Gleb for a second critical look over my code and help in the patches! Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:23:23 2012 (r243715) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:33:21 2012 (r243716) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 1"; +char ixgbe_driver_version[] = "2.5.0 - 2"; /********************************************************************* * PCI Device ID Table @@ -736,17 +736,14 @@ ixgbe_start_locked(struct tx_ring *txr, IXGBE_TX_LOCK_ASSERT(txr); - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; if (!adapter->link_active) return; while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) { - txr->queue_status |= IXGBE_QUEUE_DEPLETED; + if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) break; - } IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) @@ -755,8 +752,6 @@ ixgbe_start_locked(struct tx_ring *txr, if (ixgbe_xmit(txr, &m_head)) { if (m_head != NULL) IFQ_DRV_PREPEND(&ifp->if_snd, m_head); - if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE) - txr->queue_status |= IXGBE_QUEUE_DEPLETED; break; } /* Send a copy of the frame to the BPF listener */ @@ -811,8 +806,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct txr = &adapter->tx_rings[i]; que = &adapter->queues[i]; - if (((txr->queue_status & IXGBE_QUEUE_DEPLETED) == 0) && - IXGBE_TX_TRYLOCK(txr)) { + if (IXGBE_TX_TRYLOCK(txr)) { err = ixgbe_mq_start_locked(ifp, txr, m); IXGBE_TX_UNLOCK(txr); } else { @@ -831,7 +825,6 @@ ixgbe_mq_start_locked(struct ifnet *ifp, int enqueued, err = 0; if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || - (txr->queue_status == IXGBE_QUEUE_DEPLETED) || adapter->link_active == 0) { if (m != NULL) err = drbr_enqueue(ifp, txr->br, m); @@ -862,16 +855,12 @@ ixgbe_mq_start_locked(struct ifnet *ifp, break; if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) ixgbe_txeof(txr); - if (txr->tx_avail < IXGBE_TX_OP_THRESHOLD) { - txr->queue_status |= IXGBE_QUEUE_DEPLETED; - break; - } next = drbr_dequeue(ifp, txr->br); } if (enqueued > 0) { /* Set watchdog on */ - txr->queue_status |= IXGBE_QUEUE_WORKING; + txr->queue_status = IXGBE_QUEUE_WORKING; txr->watchdog_time = ticks; } @@ -1316,7 +1305,6 @@ ixgbe_init_locked(struct adapter *adapte /* Now inform the stack we're ready */ ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; return; } @@ -2018,13 +2006,11 @@ ixgbe_local_timer(void *arg) { struct adapter *adapter = arg; device_t dev = adapter->dev; - struct ifnet *ifp = adapter->ifp; struct ix_queue *que = adapter->queues; struct tx_ring *txr = adapter->tx_rings; - int hung, busy, paused; + int hung = 0, paused = 0; mtx_assert(&adapter->core_mtx, MA_OWNED); - hung = busy = paused = 0; /* Check for pluggable optics */ if (adapter->sfp_probe) @@ -2046,23 +2032,15 @@ ixgbe_local_timer(void *arg) ** - watchdog only if all queues show hung */ for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { - if ((txr->queue_status & IXGBE_QUEUE_HUNG) && + if ((txr->queue_status == IXGBE_QUEUE_HUNG) && (paused == 0)) ++hung; - if (txr->queue_status & IXGBE_QUEUE_DEPLETED) - ++busy; - if ((txr->queue_status & IXGBE_QUEUE_IDLE) == 0) + else if (txr->queue_status == IXGBE_QUEUE_WORKING) taskqueue_enqueue(que->tq, &que->que_task); } /* Only truely watchdog if all queues show hung */ if (hung == adapter->num_queues) goto watchdog; - /* Only turn off the stack flow when ALL are depleted */ - if (busy == adapter->num_queues) - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - else if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) && - (busy < adapter->num_queues)) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; out: ixgbe_rearm_queues(adapter, adapter->que_mask); @@ -2091,7 +2069,6 @@ static void ixgbe_update_link_status(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; - struct tx_ring *txr = adapter->tx_rings; device_t dev = adapter->dev; @@ -2112,9 +2089,6 @@ ixgbe_update_link_status(struct adapter device_printf(dev,"Link is Down\n"); if_link_state_change(ifp, LINK_STATE_DOWN); adapter->link_active = FALSE; - for (int i = 0; i < adapter->num_queues; - i++, txr++) - txr->queue_status = IXGBE_QUEUE_IDLE; } } @@ -2145,7 +2119,6 @@ ixgbe_stop(void *arg) /* Let the stack know...*/ ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; ixgbe_reset_hw(hw); hw->adapter_stopped = FALSE; @@ -3694,10 +3667,6 @@ ixgbe_txeof(struct tx_ring *txr) if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)) txr->queue_status = IXGBE_QUEUE_HUNG; - /* With a minimum free clear the depleted state bit. */ - if (txr->tx_avail > IXGBE_TX_CLEANUP_THRESHOLD) - txr->queue_status &= ~IXGBE_QUEUE_DEPLETED; - if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IXGBE_QUEUE_IDLE; return (FALSE); Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 22:23:23 2012 (r243715) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 22:33:21 2012 (r243716) @@ -198,10 +198,6 @@ #define IXGBE_VFTA_SIZE 128 #define IXGBE_BR_SIZE 4096 #define IXGBE_QUEUE_MIN_FREE 32 -#define IXGBE_QUEUE_IDLE 1 -#define IXGBE_QUEUE_WORKING 2 -#define IXGBE_QUEUE_HUNG 4 -#define IXGBE_QUEUE_DEPLETED 8 /* Offload bits in mbuf flag */ #if __FreeBSD_version >= 800000 @@ -299,7 +295,11 @@ struct tx_ring { struct adapter *adapter; struct mtx tx_mtx; u32 me; - int queue_status; + enum { + IXGBE_QUEUE_IDLE, + IXGBE_QUEUE_WORKING, + IXGBE_QUEUE_HUNG, + } queue_status; int watchdog_time; union ixgbe_adv_tx_desc *tx_base; struct ixgbe_dma_alloc txdma; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:40:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CCE348F; Fri, 30 Nov 2012 22:40:52 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [78.110.53.255]) by mx1.freebsd.org (Postfix) with ESMTP id 565C08FC12; Fri, 30 Nov 2012 22:40:51 +0000 (UTC) Received: from freebsd (unknown [72.5.114.2]) by mx0.deglitch.com (Postfix) with ESMTPA id 9C47B8FC2B; Sat, 1 Dec 2012 02:40:42 +0400 (MSK) Date: Fri, 30 Nov 2012 14:40:40 -0800 From: Stanislav Sedov To: Baptiste Daroussin Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version Message-Id: <20121130144040.99559ed924a48b909cbd3c4b@FreeBSD.org> In-Reply-To: <20121129073846.GG97474@ithaqua.etoilebsd.net> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> <20121129073846.GG97474@ithaqua.etoilebsd.net> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:40:52 -0000 On Thu, 29 Nov 2012 08:38:47 +0100 Baptiste Daroussin mentioned: > > pkg is no more experimental at all, it is not perfect there are large rooms for > improvements, but it is perfectly ready to be used, if you have any concern > about some missing "feature" just report it; > > Concerning a landmine, when you have big flashy lights all over the place: > http://lists.freebsd.org/pipermail/freebsd-ports-announce/2012-October/000032.html > http://lists.freebsd.org/pipermail/freebsd-current/2012-October/037001.html > a fanfare playing in front of it saying beware landsmine: > http://svnweb.freebsd.org/ports?view=revision&revision=305637 > and maps available all over the places to explains where the mine are how to > workaround them, or be mine proof: > http://svnweb.freebsd.org/ports/head/CHANGES (entry 20121010) > http://svnweb.freebsd.org/ports/head/UPDATING (entry 20121010) > > I'd say in that case it is no more considered as a landmine but just a new safe > way. It is a new way forced on users. I didn't ask to use pkgng on my system, neither I got any warning when it silently stopped creating entries in /var/db/pkg. Do you expect all users to read UPDATING and/or svn commit logs each time they update? Switching to pkgng was not a community descision, it was a decision made by a small group of people (alledgedly, considering input from the community). Personally, I don't see why it should be that way, and why the default had to be forceably changed. It is an open question (at least for me) whether pkgng is any better than the old tools, and there is at least on drawback in using pkgng, namely sqlite database, which will make you lose all packages in the case of a small fs corruption. That problem was raised before numerous times starting when developing a new pkg tool was proposed. But it is a design decision, and I respect it. What I don't like is that the switch to the new pkg system lacks any legitemacy, as it was largely a portmgr descision. If instead you ran it alongside for some time and it ended up being used by majority of users compared to the legacy pkg, and then pulled the switch, then it'd a different story. The bottom line is that I ended up with a corrupted pkg database for no particular reason. And it didn't have to be that way. -- Stanislav Sedov ST4096-RIPE () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:41:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F2F1602; Fri, 30 Nov 2012 22:41:33 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4ACF48FC08; Fri, 30 Nov 2012 22:41:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMfXOt068316; Fri, 30 Nov 2012 22:41:33 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMfXfu068314; Fri, 30 Nov 2012 22:41:33 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302241.qAUMfXfu068314@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 22:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243718 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:41:33 -0000 Author: jfv Date: Fri Nov 30 22:41:32 2012 New Revision: 243718 URL: http://svnweb.freebsd.org/changeset/base/243718 Log: Patch #3 - Add a new ioctl to access SFP+ module diagnostic data via the I2C routines in shared code. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:38:42 2012 (r243717) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:41:32 2012 (r243718) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 2"; +char ixgbe_driver_version[] = "2.5.0 - 3"; /********************************************************************* * PCI Device ID Table @@ -919,6 +919,7 @@ static int ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; + struct ixgbe_hw *hw = &adapter->hw; struct ifreq *ifr = (struct ifreq *) data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; @@ -1024,7 +1025,22 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c VLAN_CAPABILITIES(ifp); break; } - + case SIOCGI2C: + { + struct ixgbe_i2c_req i2c; + IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)"); + error = copyin(ifr->ifr_data, &i2c, sizeof(i2c)); + if (error) + break; + if ((i2c.dev_addr != 0xA0) || (i2c.dev_addr != 0xA2)){ + error = EINVAL; + break; + } + hw->phy.ops.read_i2c_byte(hw, i2c.offset, + i2c.dev_addr, i2c.data); + error = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); + break; + } default: IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command); error = ether_ioctl(ifp, command, data); Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 22:38:42 2012 (r243717) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 22:41:32 2012 (r243718) @@ -199,6 +199,9 @@ #define IXGBE_BR_SIZE 4096 #define IXGBE_QUEUE_MIN_FREE 32 +/* IOCTL define to gather SFP+ Diagnostic data */ +#define SIOCGI2C SIOCGIFGENERIC + /* Offload bits in mbuf flag */ #if __FreeBSD_version >= 800000 #define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) @@ -241,6 +244,13 @@ typedef struct _ixgbe_vendor_info_t { unsigned int index; } ixgbe_vendor_info_t; +/* This is used to get SFP+ module data */ +struct ixgbe_i2c_req { + u8 dev_addr; + u8 offset; + u8 len; + u8 data[8]; +}; struct ixgbe_tx_buf { u32 eop_index; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:49:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A7EF87A; Fri, 30 Nov 2012 22:49:29 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5EF538FC0C; Fri, 30 Nov 2012 22:49:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMnTGJ069336; Fri, 30 Nov 2012 22:49:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMnTY8069335; Fri, 30 Nov 2012 22:49:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302249.qAUMnTY8069335@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 22:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243719 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:49:29 -0000 Author: pjd Date: Fri Nov 30 22:49:28 2012 New Revision: 243719 URL: http://svnweb.freebsd.org/changeset/base/243719 Log: IFp4 @208450: Remove redundant call to AUDIT_ARG_UPATH1(). Path will be remembered by the following NDINIT(AUDITVNODE1) call. Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Fri Nov 30 22:41:32 2012 (r243718) +++ head/sys/kern/vfs_mount.c Fri Nov 30 22:49:28 2012 (r243719) @@ -1170,7 +1170,6 @@ sys_unmount(td, uap) } mtx_unlock(&mountlist_mtx); } else { - AUDIT_ARG_UPATH1(td, pathbuf); /* * Try to find global path for path argument. */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:52:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29F9BA33; Fri, 30 Nov 2012 22:52:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FD4B8FC19; Fri, 30 Nov 2012 22:52:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMqZSv069763; Fri, 30 Nov 2012 22:52:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMqZ2w069762; Fri, 30 Nov 2012 22:52:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302252.qAUMqZ2w069762@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 22:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243720 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:52:36 -0000 Author: pjd Date: Fri Nov 30 22:52:35 2012 New Revision: 243720 URL: http://svnweb.freebsd.org/changeset/base/243720 Log: IFp4 @208381: For VOP_GETATTR() we just need vnode to be shared-locked. Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks Modified: head/sys/security/audit/audit_worker.c Modified: head/sys/security/audit/audit_worker.c ============================================================================== --- head/sys/security/audit/audit_worker.c Fri Nov 30 22:49:28 2012 (r243719) +++ head/sys/security/audit/audit_worker.c Fri Nov 30 22:52:35 2012 (r243720) @@ -133,7 +133,7 @@ audit_record_write(struct vnode *vp, str error = VFS_STATFS(vp->v_mount, mnt_stat); if (error) goto fail; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, &vattr, cred); VOP_UNLOCK(vp, 0); if (error) From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:54:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7A31BC5; Fri, 30 Nov 2012 22:54:14 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AF46D8FC12; Fri, 30 Nov 2012 22:54:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMsEP6070003; Fri, 30 Nov 2012 22:54:14 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMsE1v070002; Fri, 30 Nov 2012 22:54:14 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302254.qAUMsE1v070002@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 22:54:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243721 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:54:14 -0000 Author: jfv Date: Fri Nov 30 22:54:14 2012 New Revision: 243721 URL: http://svnweb.freebsd.org/changeset/base/243721 Log: Patch #4 - this does two things, it removes a number of statistics, these are FCOE stats (fiber channel over ethernet), something that FreeBSD does not yet have, they were mistaken for flow control by the implementor I believe. Secondly, the real flow control stats are oddly named with a 'link' tag on the front, it was requested by my validation engineer to make these stats have the same name as the igb driver for clarity and that seemed reasonable to me. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:52:35 2012 (r243720) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 22:54:14 2012 (r243721) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 3"; +char ixgbe_driver_version[] = "2.5.0 - 4"; /********************************************************************* * PCI Device ID Table @@ -5388,16 +5388,18 @@ ixgbe_add_hw_stats(struct adapter *adapt SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rec_len_errs", CTLFLAG_RD, &stats->rlec, "Receive Length Errors"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "link_xon_txd", + + /* Flow Control stats */ + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "xon_txd", CTLFLAG_RD, &stats->lxontxc, "Link XON Transmitted"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "link_xon_rcvd", + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "xon_recvd", CTLFLAG_RD, &stats->lxonrxc, "Link XON Received"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "link_xoff_txd", + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "xoff_txd", CTLFLAG_RD, &stats->lxofftxc, "Link XOFF Transmitted"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "link_xoff_rcvd", + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", CTLFLAG_RD, &stats->lxoffrxc, "Link XOFF Received"); @@ -5497,29 +5499,6 @@ ixgbe_add_hw_stats(struct adapter *adapt SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", CTLFLAG_RD, &stats->ptc1522, "1024-1522 byte frames transmitted"); - - /* FC Stats */ - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_crc", - CTLFLAG_RD, &stats->fccrc, - "FC CRC Errors"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_last", - CTLFLAG_RD, &stats->fclast, - "FC Last Error"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_drpd", - CTLFLAG_RD, &stats->fcoerpdc, - "FCoE Packets Dropped"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_pkts_rcvd", - CTLFLAG_RD, &stats->fcoeprc, - "FCoE Packets Received"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_pkts_txd", - CTLFLAG_RD, &stats->fcoeptc, - "FCoE Packets Transmitted"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_dword_rcvd", - CTLFLAG_RD, &stats->fcoedwrc, - "FCoE DWords Received"); - SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "fc_dword_txd", - CTLFLAG_RD, &stats->fcoedwtc, - "FCoE DWords Transmitted"); } /* From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 22:59:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8C89E44; Fri, 30 Nov 2012 22:59:20 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B12DD8FC12; Fri, 30 Nov 2012 22:59:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUMxKuS070944; Fri, 30 Nov 2012 22:59:20 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUMxKMt070943; Fri, 30 Nov 2012 22:59:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302259.qAUMxKMt070943@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 22:59:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243722 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 22:59:21 -0000 Author: pjd Date: Fri Nov 30 22:59:20 2012 New Revision: 243722 URL: http://svnweb.freebsd.org/changeset/base/243722 Log: IFp4 @208382: Currently on each record write we call VFS_STATFS() to get available space on the file system as well as VOP_GETATTR() to get trail file size. We can assume that trail file is only updated by the audit worker, so instead of asking for file size on every write, get file size on trail switch only (it should be zero, but it's not expensive) and use global variable audit_size protected by the audit worker lock to keep track of trail file's size. This eliminates VOP_GETATTR() call for every write. VFS_STATFS() is satisfied from in-memory data (mount->mnt_stat), so shouldn't be expensive. Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks Modified: head/sys/security/audit/audit_worker.c Modified: head/sys/security/audit/audit_worker.c ============================================================================== --- head/sys/security/audit/audit_worker.c Fri Nov 30 22:54:14 2012 (r243721) +++ head/sys/security/audit/audit_worker.c Fri Nov 30 22:59:20 2012 (r243722) @@ -88,6 +88,7 @@ static struct proc *audit_thread; static int audit_file_rotate_wait; static struct ucred *audit_cred; static struct vnode *audit_vp; +static off_t audit_size; static struct sx audit_worker_lock; #define AUDIT_WORKER_LOCK_INIT() sx_init(&audit_worker_lock, \ @@ -115,7 +116,6 @@ audit_record_write(struct vnode *vp, str struct statfs *mnt_stat; int error; static int cur_fail; - struct vattr vattr; long temp; AUDIT_WORKER_LOCK_ASSERT(); @@ -133,12 +133,6 @@ audit_record_write(struct vnode *vp, str error = VFS_STATFS(vp->v_mount, mnt_stat); if (error) goto fail; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, &vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - goto fail; - audit_fstat.af_currsz = vattr.va_size; /* * We handle four different space-related limits: @@ -196,7 +190,7 @@ audit_record_write(struct vnode *vp, str * records may be generated before the daemon rotates the file. */ if ((audit_fstat.af_filesz != 0) && (audit_file_rotate_wait == 0) && - (vattr.va_size >= audit_fstat.af_filesz)) { + (audit_size >= audit_fstat.af_filesz)) { AUDIT_WORKER_LOCK_ASSERT(); audit_file_rotate_wait = 1; @@ -238,6 +232,8 @@ audit_record_write(struct vnode *vp, str goto fail_enospc; else if (error) goto fail; + AUDIT_WORKER_LOCK_ASSERT(); + audit_size += len; /* * Catch completion of a queue drain here; if we're draining and the @@ -448,10 +444,20 @@ audit_rotate_vnode(struct ucred *cred, s { struct ucred *old_audit_cred; struct vnode *old_audit_vp; + struct vattr vattr; KASSERT((cred != NULL && vp != NULL) || (cred == NULL && vp == NULL), ("audit_rotate_vnode: cred %p vp %p", cred, vp)); + if (vp != NULL) { + vn_lock(vp, LK_SHARED | LK_RETRY); + if (VOP_GETATTR(vp, &vattr, cred) != 0) + vattr.va_size = 0; + VOP_UNLOCK(vp, 0); + } else { + vattr.va_size = 0; + } + /* * Rotate the vnode/cred, and clear the rotate flag so that we will * send a rotate trigger if the new file fills. @@ -461,6 +467,7 @@ audit_rotate_vnode(struct ucred *cred, s old_audit_vp = audit_vp; audit_cred = cred; audit_vp = vp; + audit_size = vattr.va_size; audit_file_rotate_wait = 0; audit_enabled = (audit_vp != NULL); AUDIT_WORKER_UNLOCK(); From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:03:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BED46FEE; Fri, 30 Nov 2012 23:03:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2758FC15; Fri, 30 Nov 2012 23:03:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUN3p7X071839; Fri, 30 Nov 2012 23:03:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUN3peT071838; Fri, 30 Nov 2012 23:03:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302303.qAUN3peT071838@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 23:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243723 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:03:52 -0000 Author: pjd Date: Fri Nov 30 23:03:51 2012 New Revision: 243723 URL: http://svnweb.freebsd.org/changeset/base/243723 Log: IFp4 @208383: Currently when we discover that trail file is greater than configured limit we send AUDIT_TRIGGER_ROTATE_KERNEL trigger to the auditd daemon once. If for some reason auditd didn't rotate trail file it will never be rotated. Change it by sending the trigger when trail file size grows by the configured limit. For example if the limit is 1MB, we will send trigger on 1MB, 2MB, 3MB, etc. This is also needed for the auditd change that will be committed soon where auditd may ignore the trigger - it might be ignored if kernel requests the trail file to be rotated too quickly (often than once a second) which would result in overwriting previous trail file. Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks Modified: head/sys/security/audit/audit_worker.c Modified: head/sys/security/audit/audit_worker.c ============================================================================== --- head/sys/security/audit/audit_worker.c Fri Nov 30 22:59:20 2012 (r243722) +++ head/sys/security/audit/audit_worker.c Fri Nov 30 23:03:51 2012 (r243723) @@ -189,11 +189,11 @@ audit_record_write(struct vnode *vp, str * to the daemon. This is only approximate, which is fine as more * records may be generated before the daemon rotates the file. */ - if ((audit_fstat.af_filesz != 0) && (audit_file_rotate_wait == 0) && - (audit_size >= audit_fstat.af_filesz)) { + if (audit_fstat.af_filesz != 0 && + audit_size >= audit_fstat.af_filesz * (audit_file_rotate_wait + 1)) { AUDIT_WORKER_LOCK_ASSERT(); - audit_file_rotate_wait = 1; + audit_file_rotate_wait++; (void)audit_send_trigger(AUDIT_TRIGGER_ROTATE_KERNEL); } From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:06:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ED9602B9; Fri, 30 Nov 2012 23:06:27 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BA1C68FC08; Fri, 30 Nov 2012 23:06:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUN6RSt072391; Fri, 30 Nov 2012 23:06:27 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUN6Ris072388; Fri, 30 Nov 2012 23:06:27 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302306.qAUN6Ris072388@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 23:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243724 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:06:28 -0000 Author: jfv Date: Fri Nov 30 23:06:27 2012 New Revision: 243724 URL: http://svnweb.freebsd.org/changeset/base/243724 Log: Patch #5 Cleanup unused IEEE1588 code fragments, the day may come when this feature gets implemented, but its not here yet and I see no reason to leave this laying around. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:03:51 2012 (r243723) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:06:27 2012 (r243724) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 4"; +char ixgbe_driver_version[] = "2.5.0 - 5"; /********************************************************************* * PCI Device ID Table @@ -1830,12 +1830,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m } else if (ixgbe_tx_ctx_setup(txr, m_head)) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; -#ifdef IXGBE_IEEE1588 - /* This is changing soon to an mtag detection */ - if (we detect this mbuf has a TSTAMP mtag) - cmd_type_len |= IXGBE_ADVTXD_MAC_TSTAMP; -#endif - #ifdef IXGBE_FDIR /* Do the flow director magic */ if ((txr->atr_sample) && (!adapter->fdir_reinit)) { Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:03:51 2012 (r243723) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:06:27 2012 (r243724) @@ -89,10 +89,6 @@ #include #include -#ifdef IXGBE_IEEE1588 -#include -#endif - #include "ixgbe_api.h" /* Tunables */ From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:13:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D871A5B9; Fri, 30 Nov 2012 23:13:56 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BB3948FC08; Fri, 30 Nov 2012 23:13:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNDuUl073578; Fri, 30 Nov 2012 23:13:56 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNDuhN073576; Fri, 30 Nov 2012 23:13:56 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302313.qAUNDuhN073576@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 23:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243725 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:13:57 -0000 Author: jfv Date: Fri Nov 30 23:13:56 2012 New Revision: 243725 URL: http://svnweb.freebsd.org/changeset/base/243725 Log: Patch #6 Whitespace cleanup, and removal of some very old defines (at Gleb's request). Also, change the defines around the old transmit code to IXGBE_LEGACY_TX, I do this to make it possible to define this regardless of the OS level (it is not defined by default). There are also a couple changed comments for clarity. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:06:27 2012 (r243724) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:13:56 2012 (r243725) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 5"; +char ixgbe_driver_version[] = "2.5.0 - 6"; /********************************************************************* * PCI Device ID Table @@ -104,16 +104,16 @@ static int ixgbe_probe(device_t); static int ixgbe_attach(device_t); static int ixgbe_detach(device_t); static int ixgbe_shutdown(device_t); -#if __FreeBSD_version >= 800000 +#ifdef IXGBE_LEGACY_TX +static void ixgbe_start(struct ifnet *); +static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); +#else /* ! IXGBE_LEGACY_TX */ static int ixgbe_mq_start(struct ifnet *, struct mbuf *); static int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *, struct mbuf *); static void ixgbe_qflush(struct ifnet *); static void ixgbe_deferred_mq_start(void *, int); -#else -static void ixgbe_start(struct ifnet *); -static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); -#endif +#endif /* IXGBE_LEGACY_TX */ static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); static void ixgbe_init(void *); static void ixgbe_init_locked(struct adapter *); @@ -541,7 +541,6 @@ ixgbe_attach(device_t dev) case IXGBE_ERR_SFP_NOT_SUPPORTED: device_printf(dev,"Unsupported SFP+ Module\n"); error = EIO; - device_printf(dev,"Hardware Initialization Failure\n"); goto err_late; case IXGBE_ERR_SFP_NOT_PRESENT: device_printf(dev,"No SFP+ Module found\n"); @@ -653,7 +652,7 @@ ixgbe_detach(device_t dev) for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { if (que->tq) { -#if __FreeBSD_version >= 800000 +#ifdef IXGBE_LEGACY_TX taskqueue_drain(que->tq, &txr->txq_task); #endif taskqueue_drain(que->tq, &que->que_task); @@ -717,7 +716,7 @@ ixgbe_shutdown(device_t dev) } -#if __FreeBSD_version < 800000 +#ifdef IXGBE_LEGACY_TX /********************************************************************* * Transmit entry point * @@ -784,7 +783,8 @@ ixgbe_start(struct ifnet *ifp) return; } -#else +#else /* ! IXGBE_LEGACY_TX */ + /* ** Multiqueue Transmit driver ** @@ -904,7 +904,7 @@ ixgbe_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#endif /* __FreeBSD_version >= 800000 */ +#endif /* IXGBE_LEGACY_TX */ /********************************************************************* * Ioctl entry point @@ -1413,7 +1413,7 @@ ixgbe_handle_que(void *context, int pend more = ixgbe_rxeof(que, adapter->rx_process_limit); IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX if (!drbr_empty(ifp, txr->br)) ixgbe_mq_start_locked(ifp, txr, NULL); #else @@ -1513,7 +1513,7 @@ ixgbe_msix_que(void *arg) ** has anything queued the task gets ** scheduled to handle it. */ -#if __FreeBSD_version < 800000 +#ifdef IXGBE_LEGACY_TX if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) #else if (!drbr_empty(adapter->ifp, txr->br)) @@ -1809,15 +1809,14 @@ ixgbe_xmit(struct tx_ring *txr, struct m /* Make certain there are enough descriptors */ if (nsegs > txr->tx_avail - 2) { txr->no_desc_avail++; - error = ENOBUFS; - goto xmit_fail; + bus_dmamap_unload(txr->txtag, map); + return (ENOBUFS); } m_head = *m_headp; /* ** Set up the appropriate offload context - ** this becomes the first descriptor of - ** a packet. + ** this will consume the first descriptor */ if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { if (ixgbe_tso_setup(txr, m_head, &paylen, &olinfo_status)) { @@ -1874,7 +1873,12 @@ ixgbe_xmit(struct tx_ring *txr, struct m txr->next_avail_desc = i; txbuf->m_head = m_head; - /* Swap the dma map between the first and last descriptor */ + /* + ** Here we swap the map so the last descriptor, + ** which gets the completion interrupt has the + ** real map, and the first descriptor gets the + ** unused map from this descriptor. + */ txr->tx_buffers[first].map = txbuf->map; txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -1894,10 +1898,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m return (0); -xmit_fail: - bus_dmamap_unload(txr->txtag, txbuf->map); - return (error); - } static void @@ -2240,12 +2240,12 @@ ixgbe_setup_optics(struct adapter *adapt static int ixgbe_allocate_legacy(struct adapter *adapter) { - device_t dev = adapter->dev; + device_t dev = adapter->dev; struct ix_queue *que = adapter->queues; -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX struct tx_ring *txr = adapter->tx_rings; #endif - int error, rid = 0; + int error, rid = 0; /* MSI RID at 1 */ if (adapter->msix == 1) @@ -2264,7 +2264,7 @@ ixgbe_allocate_legacy(struct adapter *ad * Try allocating a fast interrupt and the associated deferred * processing contexts. */ -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); #endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); @@ -2346,7 +2346,7 @@ ixgbe_allocate_msix(struct adapter *adap if (adapter->num_queues > 1) bus_bind_intr(dev, que->res, i); -#if __FreeBSD_version >= 800000 +#ifdef IXGBE_LEGACY_TX TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); #endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); @@ -2592,7 +2592,7 @@ ixgbe_setup_interface(device_t dev, stru ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ixgbe_ioctl; -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX ifp->if_transmit = ixgbe_mq_start; ifp->if_qflush = ixgbe_qflush; #else @@ -2840,7 +2840,7 @@ ixgbe_allocate_queues(struct adapter *ad error = ENOMEM; goto err_tx_desc; } -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX /* Allocate a buf ring */ txr->br = buf_ring_alloc(IXGBE_BR_SIZE, M_DEVBUF, M_WAITOK, &txr->tx_mtx); @@ -3198,7 +3198,7 @@ ixgbe_free_transmit_buffers(struct tx_ri tx_buffer->map = NULL; } } -#if __FreeBSD_version >= 800000 +#ifdef IXGBE_LEGACY_TX if (txr->br != NULL) buf_ring_free(txr->br, M_DEVBUF); #endif @@ -3245,7 +3245,8 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, /* ** In advanced descriptors the vlan tag must - ** be placed into the descriptor itself. + ** be placed into the context descriptor. Hence + ** we need to make one even if not doing offloads. */ if (mp->m_flags & M_VLANTAG) { vtag = htole16(mp->m_pkthdr.ether_vtag); @@ -3576,7 +3577,8 @@ ixgbe_txeof(struct tx_ring *txr) */ if (!netmap_mitigate || (kring->nr_kflags < kring->nkr_num_slots && - tx_desc[kring->nr_kflags].upper.fields.status & IXGBE_TXD_STAT_DD)) { + tx_desc[kring->nr_kflags].upper.fields.status & + IXGBE_TXD_STAT_DD)) { kring->nr_kflags = kring->nkr_num_slots; selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); IXGBE_TX_UNLOCK(txr); Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:06:27 2012 (r243724) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:13:56 2012 (r243725) @@ -39,7 +39,7 @@ #include #include -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX #include #endif #include @@ -205,16 +205,6 @@ #define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP) #endif -/* For 6.X code compatibility */ -#if !defined(ETHER_BPF_MTAP) -#define ETHER_BPF_MTAP BPF_MTAP -#endif - -#if __FreeBSD_version < 700000 -#define CSUM_TSO 0 -#define IFCAP_TSO4 0 -#endif - /* * Interrupt Moderation parameters */ @@ -316,7 +306,7 @@ struct tx_ring { u32 txd_cmd; bus_dma_tag_t txtag; char mtx_name[16]; -#if __FreeBSD_version >= 800000 +#ifndef IXGBE_LEGACY_TX struct buf_ring *br; struct task txq_task; #endif From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:18:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 035F6799; Fri, 30 Nov 2012 23:18:49 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D89148FC14; Fri, 30 Nov 2012 23:18:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNInFJ074244; Fri, 30 Nov 2012 23:18:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNInIh074238; Fri, 30 Nov 2012 23:18:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302318.qAUNInIh074238@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 23:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243726 - in head/sys: kern security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:18:50 -0000 Author: pjd Date: Fri Nov 30 23:18:49 2012 New Revision: 243726 URL: http://svnweb.freebsd.org/changeset/base/243726 Log: IFp4 @208451: Fix path handling for *at() syscalls. Before the change directory descriptor was totally ignored, so the relative path argument was appended to current working directory path and not to the path provided by descriptor, thus wrong paths were stored in audit logs. Now that we use directory descriptor in vfs_lookup, move AUDIT_ARG_UPATH1() and AUDIT_ARG_UPATH2() calls to the place where we hold file descriptors table lock, so we are sure paths will be resolved according to the same directory in audit record and in actual operation. Sponsored by: FreeBSD Foundation (auditdistd) Reviewed by: rwatson MFC after: 2 weeks Modified: head/sys/kern/vfs_lookup.c head/sys/security/audit/audit.c head/sys/security/audit/audit.h head/sys/security/audit/audit_arg.c head/sys/security/audit/audit_bsm_klib.c head/sys/security/audit/audit_private.h Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/kern/vfs_lookup.c Fri Nov 30 23:18:49 2012 (r243726) @@ -160,17 +160,6 @@ namei(struct nameidata *ndp) error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, (size_t *)&ndp->ni_pathlen); - if (error == 0) { - /* - * If we are auditing the kernel pathname, save the user - * pathname. - */ - if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf); - if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf); - } - /* * Don't allow empty pathnames. */ @@ -218,6 +207,14 @@ namei(struct nameidata *ndp) ndp->ni_rootdir = fdp->fd_rdir; ndp->ni_topdir = fdp->fd_jdir; + /* + * If we are auditing the kernel pathname, save the user pathname. + */ + if (cnp->cn_flags & AUDITVNODE1) + AUDIT_ARG_UPATH1(td, ndp->ni_dirfd, , cnp->cn_pnbuf); + if (cnp->cn_flags & AUDITVNODE2) + AUDIT_ARG_UPATH2(td, ndp->ni_dirfd, , cnp->cn_pnbuf); + dp = NULL; if (cnp->cn_pnbuf[0] != '/') { if (ndp->ni_startdir != NULL) { Modified: head/sys/security/audit/audit.c ============================================================================== --- head/sys/security/audit/audit.c Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/security/audit/audit.c Fri Nov 30 23:18:49 2012 (r243726) @@ -691,7 +691,7 @@ audit_proc_coredump(struct thread *td, c if (path != NULL) { pathp = &ar->k_ar.ar_arg_upath1; *pathp = malloc(MAXPATHLEN, M_AUDITPATH, M_WAITOK); - audit_canon_path(td, path, *pathp); + audit_canon_path(td, AT_FDCWD, path, *pathp); ARG_SET_VALID(ar, ARG_UPATH1); } ar->k_ar.ar_arg_signum = td->td_proc->p_sig; Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/security/audit/audit.h Fri Nov 30 23:18:49 2012 (r243726) @@ -99,8 +99,8 @@ void audit_arg_sockaddr(struct thread * void audit_arg_auid(uid_t auid); void audit_arg_auditinfo(struct auditinfo *au_info); void audit_arg_auditinfo_addr(struct auditinfo_addr *au_info); -void audit_arg_upath1(struct thread *td, char *upath); -void audit_arg_upath2(struct thread *td, char *upath); +void audit_arg_upath1(struct thread *td, int dirfd, char *upath); +void audit_arg_upath2(struct thread *td, int dirfd, char *upath); void audit_arg_vnode1(struct vnode *vp); void audit_arg_vnode2(struct vnode *vp); void audit_arg_text(char *text); @@ -276,14 +276,14 @@ void audit_thread_free(struct thread *t audit_arg_uid((uid)); \ } while (0) -#define AUDIT_ARG_UPATH1(td, upath) do { \ +#define AUDIT_ARG_UPATH1(td, dirfd, upath) do { \ if (AUDITING_TD(curthread)) \ - audit_arg_upath1((td), (upath)); \ + audit_arg_upath1((td), (dirfd), (upath)); \ } while (0) -#define AUDIT_ARG_UPATH2(td, upath) do { \ +#define AUDIT_ARG_UPATH2(td, dirfd, upath) do { \ if (AUDITING_TD(curthread)) \ - audit_arg_upath2((td), (upath)); \ + audit_arg_upath2((td), (dirfd), (upath)); \ } while (0) #define AUDIT_ARG_VALUE(value) do { \ @@ -356,8 +356,8 @@ void audit_thread_free(struct thread *t #define AUDIT_ARG_SUID(suid) #define AUDIT_ARG_TEXT(text) #define AUDIT_ARG_UID(uid) -#define AUDIT_ARG_UPATH1(td, upath) -#define AUDIT_ARG_UPATH2(td, upath) +#define AUDIT_ARG_UPATH1(td, dirfd, upath) +#define AUDIT_ARG_UPATH2(td, dirfd, upath) #define AUDIT_ARG_VALUE(value) #define AUDIT_ARG_VNODE1(vp) #define AUDIT_ARG_VNODE2(vp) Modified: head/sys/security/audit/audit_arg.c ============================================================================== --- head/sys/security/audit/audit_arg.c Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/security/audit/audit_arg.c Fri Nov 30 23:18:49 2012 (r243726) @@ -463,7 +463,8 @@ audit_arg_sockaddr(struct thread *td, st break; case AF_UNIX: - audit_arg_upath1(td, ((struct sockaddr_un *)sa)->sun_path); + audit_arg_upath1(td, AT_FDCWD, + ((struct sockaddr_un *)sa)->sun_path); ARG_SET_VALID(ar, ARG_SADDRUNIX); break; /* XXXAUDIT: default:? */ @@ -707,16 +708,16 @@ audit_arg_file(struct proc *p, struct fi * freed when the audit record is freed. */ static void -audit_arg_upath(struct thread *td, char *upath, char **pathp) +audit_arg_upath(struct thread *td, int dirfd, char *upath, char **pathp) { if (*pathp == NULL) *pathp = malloc(MAXPATHLEN, M_AUDITPATH, M_WAITOK); - audit_canon_path(td, upath, *pathp); + audit_canon_path(td, dirfd, upath, *pathp); } void -audit_arg_upath1(struct thread *td, char *upath) +audit_arg_upath1(struct thread *td, int dirfd, char *upath) { struct kaudit_record *ar; @@ -724,12 +725,12 @@ audit_arg_upath1(struct thread *td, char if (ar == NULL) return; - audit_arg_upath(td, upath, &ar->k_ar.ar_arg_upath1); + audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath1); ARG_SET_VALID(ar, ARG_UPATH1); } void -audit_arg_upath2(struct thread *td, char *upath) +audit_arg_upath2(struct thread *td, int dirfd, char *upath) { struct kaudit_record *ar; @@ -737,7 +738,7 @@ audit_arg_upath2(struct thread *td, char if (ar == NULL) return; - audit_arg_upath(td, upath, &ar->k_ar.ar_arg_upath2); + audit_arg_upath(td, dirfd, upath, &ar->k_ar.ar_arg_upath2); ARG_SET_VALID(ar, ARG_UPATH2); } Modified: head/sys/security/audit/audit_bsm_klib.c ============================================================================== --- head/sys/security/audit/audit_bsm_klib.c Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/security/audit/audit_bsm_klib.c Fri Nov 30 23:18:49 2012 (r243726) @@ -462,13 +462,13 @@ auditon_command_event(int cmd) * leave the filename starting with '/' in the audit log in this case. */ void -audit_canon_path(struct thread *td, char *path, char *cpath) +audit_canon_path(struct thread *td, int dirfd, char *path, char *cpath) { struct vnode *cvnp, *rvnp; char *rbuf, *fbuf, *copy; struct filedesc *fdp; struct sbuf sbf; - int error, cwir; + int error, needslash, vfslocked; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", __func__, __FILE__, __LINE__); @@ -491,10 +491,27 @@ audit_canon_path(struct thread *td, char * path. */ if (*path != '/') { - cvnp = fdp->fd_cdir; - vhold(cvnp); + if (dirfd == AT_FDCWD) { + cvnp = fdp->fd_cdir; + vhold(cvnp); + } else { + /* XXX: fgetvp() that vhold()s vnode instead of vref()ing it would be better */ + error = fgetvp(td, dirfd, 0, &cvnp); + if (error) { + cpath[0] = '\0'; + if (rvnp != NULL) + vdrop(rvnp); + return; + } + vhold(cvnp); + vfslocked = VFS_LOCK_GIANT(cvnp->v_mount); + vrele(cvnp); + VFS_UNLOCK_GIANT(vfslocked); + } + needslash = (fdp->fd_rdir != cvnp); + } else { + needslash = 1; } - cwir = (fdp->fd_rdir == fdp->fd_cdir); FILEDESC_SUNLOCK(fdp); /* * NB: We require that the supplied array be at least MAXPATHLEN bytes @@ -536,7 +553,7 @@ audit_canon_path(struct thread *td, char (void) sbuf_cat(&sbf, rbuf); free(fbuf, M_TEMP); } - if (cwir == 0 || (cwir != 0 && cvnp == NULL)) + if (needslash) (void) sbuf_putc(&sbf, '/'); /* * Now that we have processed any alternate root and relative path Modified: head/sys/security/audit/audit_private.h ============================================================================== --- head/sys/security/audit/audit_private.h Fri Nov 30 23:13:56 2012 (r243725) +++ head/sys/security/audit/audit_private.h Fri Nov 30 23:18:49 2012 (r243726) @@ -388,7 +388,8 @@ au_event_t audit_flags_and_error_to_ope au_event_t audit_flags_and_error_to_openatevent(int oflags, int error); au_event_t audit_msgctl_to_event(int cmd); au_event_t audit_semctl_to_event(int cmr); -void audit_canon_path(struct thread *td, char *path, char *cpath); +void audit_canon_path(struct thread *td, int dirfd, char *path, + char *cpath); au_event_t auditon_command_event(int cmd); /* From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:21:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 75643915; Fri, 30 Nov 2012 23:21:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4196A8FC13; Fri, 30 Nov 2012 23:21:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNLuuH074663; Fri, 30 Nov 2012 23:21:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNLuer074662; Fri, 30 Nov 2012 23:21:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201211302321.qAUNLuer074662@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 30 Nov 2012 23:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243727 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:21:56 -0000 Author: pjd Date: Fri Nov 30 23:21:55 2012 New Revision: 243727 URL: http://svnweb.freebsd.org/changeset/base/243727 Log: IFp4 @208452: Audit handling for missing events: - AUE_READLINKAT - AUE_FACCESSAT - AUE_MKDIRAT - AUE_MKFIFOAT - AUE_MKNODAT - AUE_SYMLINKAT Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks Modified: head/sys/security/audit/audit_bsm.c Modified: head/sys/security/audit/audit_bsm.c ============================================================================== --- head/sys/security/audit/audit_bsm.c Fri Nov 30 23:18:49 2012 (r243726) +++ head/sys/security/audit/audit_bsm.c Fri Nov 30 23:21:55 2012 (r243727) @@ -724,13 +724,6 @@ kaudit_to_bsm(struct kaudit_record *kar, */ break; - case AUE_MKFIFO: - if (ARG_IS_VALID(kar, ARG_MODE)) { - tok = au_to_arg32(2, "mode", ar->ar_arg_mode); - kau_write(rec, tok); - } - /* FALLTHROUGH */ - case AUE_CHDIR: case AUE_CHROOT: case AUE_FSTATAT: @@ -743,6 +736,7 @@ kaudit_to_bsm(struct kaudit_record *kar, case AUE_LPATHCONF: case AUE_PATHCONF: case AUE_READLINK: + case AUE_READLINKAT: case AUE_REVOKE: case AUE_RMDIR: case AUE_SEARCHFS: @@ -762,6 +756,8 @@ kaudit_to_bsm(struct kaudit_record *kar, case AUE_ACCESS: case AUE_EACCESS: + case AUE_FACCESSAT: + ATFD1_TOKENS(1); UPATH1_VNODE1_TOKENS; if (ARG_IS_VALID(kar, ARG_VALUE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_value); @@ -1059,6 +1055,10 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_MKDIR: + case AUE_MKDIRAT: + case AUE_MKFIFO: + case AUE_MKFIFOAT: + ATFD1_TOKENS(1); if (ARG_IS_VALID(kar, ARG_MODE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); @@ -1067,6 +1067,8 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_MKNOD: + case AUE_MKNODAT: + ATFD1_TOKENS(1); if (ARG_IS_VALID(kar, ARG_MODE)) { tok = au_to_arg32(2, "mode", ar->ar_arg_mode); kau_write(rec, tok); @@ -1546,10 +1548,12 @@ kaudit_to_bsm(struct kaudit_record *kar, break; case AUE_SYMLINK: + case AUE_SYMLINKAT: if (ARG_IS_VALID(kar, ARG_TEXT)) { tok = au_to_text(ar->ar_arg_text); kau_write(rec, tok); } + ATFD1_TOKENS(1); UPATH1_VNODE1_TOKENS; break; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:28:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C71A5B30; Fri, 30 Nov 2012 23:28:01 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9F2AA8FC13; Fri, 30 Nov 2012 23:28:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNS1Kv075448; Fri, 30 Nov 2012 23:28:01 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNS1Un075446; Fri, 30 Nov 2012 23:28:01 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302328.qAUNS1Un075446@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 23:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243728 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:28:02 -0000 Author: jfv Date: Fri Nov 30 23:28:01 2012 New Revision: 243728 URL: http://svnweb.freebsd.org/changeset/base/243728 Log: Patch #7 This is primarily about processing limit control. - add a limit for both RX and TX, change the default to 256 - change the sysctl usage to be common, and now to be called during init for each ring. - the TX limit is not yet used, but the changes in the last patch in this series uses the value. - the motivation behind these changes is to improve data locality in the final code. - rxeof interface changes since it now gets limit from the ring struct Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:21:55 2012 (r243727) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:28:01 2012 (r243728) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 6"; +char ixgbe_driver_version[] = "2.5.0 - 7"; /********************************************************************* * PCI Device ID Table @@ -150,7 +150,7 @@ static void ixgbe_enable_intr(struct static void ixgbe_disable_intr(struct adapter *); static void ixgbe_update_stats_counters(struct adapter *); static bool ixgbe_txeof(struct tx_ring *); -static bool ixgbe_rxeof(struct ix_queue *, int); +static bool ixgbe_rxeof(struct ix_queue *); static void ixgbe_rx_checksum(u32, struct mbuf *, u32); static void ixgbe_set_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); @@ -163,7 +163,7 @@ static int ixgbe_set_thermal_test(SYSCTL static int ixgbe_dma_malloc(struct adapter *, bus_size_t, struct ixgbe_dma_alloc *, int); static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); -static void ixgbe_add_rx_process_limit(struct adapter *, const char *, +static void ixgbe_add_process_limit(struct adapter *, const char *, const char *, int *, int); static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *); @@ -246,9 +246,13 @@ static int ixgbe_max_interrupt_rate = (4 TUNABLE_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate); /* How many packets rxeof tries to clean at a time */ -static int ixgbe_rx_process_limit = 128; +static int ixgbe_rx_process_limit = 256; TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit); +/* How many packets txeof tries to clean at a time */ +static int ixgbe_tx_process_limit = 256; +TUNABLE_INT("hw.ixgbe.tx_process_limit", &ixgbe_tx_process_limit); + /* ** Smart speed setting, default to on ** this only works as a compile option @@ -563,11 +567,6 @@ ixgbe_attach(device_t dev) if (ixgbe_setup_interface(dev, adapter) != 0) goto err_late; - /* Sysctl for limiting the amount of work done in the taskqueue */ - ixgbe_add_rx_process_limit(adapter, "rx_processing_limit", - "max number of rx packets to process", &adapter->rx_process_limit, - ixgbe_rx_process_limit); - /* Initialize statistics */ ixgbe_update_stats_counters(adapter); @@ -1410,7 +1409,7 @@ ixgbe_handle_que(void *context, int pend bool more; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - more = ixgbe_rxeof(que, adapter->rx_process_limit); + more = ixgbe_rxeof(que); IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); #ifndef IXGBE_LEGACY_TX @@ -1458,7 +1457,7 @@ ixgbe_legacy_irq(void *arg) return; } - more_rx = ixgbe_rxeof(que, adapter->rx_process_limit); + more_rx = ixgbe_rxeof(que); IXGBE_TX_LOCK(txr); do { @@ -1504,7 +1503,7 @@ ixgbe_msix_que(void *arg) ixgbe_disable_queue(adapter, que->msix); ++que->irqs; - more_rx = ixgbe_rxeof(que, adapter->rx_process_limit); + more_rx = ixgbe_rxeof(que); IXGBE_TX_LOCK(txr); more_tx = ixgbe_txeof(txr); @@ -3083,6 +3082,11 @@ ixgbe_initialize_transmit_units(struct a u64 tdba = txr->txdma.dma_paddr; u32 txctrl; + /* Sysctl for limiting work done in tx clean */ + ixgbe_add_process_limit(adapter, "tx_processing_limit", + "max number of packets to process", &txr->process_limit, + ixgbe_tx_process_limit); + IXGBE_WRITE_REG(hw, IXGBE_TDBAL(i), (tdba & 0x00000000ffffffffULL)); IXGBE_WRITE_REG(hw, IXGBE_TDBAH(i), (tdba >> 32)); @@ -4122,6 +4126,11 @@ ixgbe_initialize_receive_units(struct ad for (int i = 0; i < adapter->num_queues; i++, rxr++) { u64 rdba = rxr->rxdma.dma_paddr; + /* Sysctl for limiting work done in rx clean */ + ixgbe_add_process_limit(adapter, "rx_processing_limit", + "max number of packets to process", &rxr->process_limit, + ixgbe_rx_process_limit); + /* Setup the Base and Length of the Rx Descriptor Ring */ IXGBE_WRITE_REG(hw, IXGBE_RDBAL(i), (rdba & 0x00000000ffffffffULL)); @@ -4341,7 +4350,7 @@ ixgbe_rx_discard(struct rx_ring *rxr, in * Return TRUE for more work, FALSE for all clean. *********************************************************************/ static bool -ixgbe_rxeof(struct ix_queue *que, int count) +ixgbe_rxeof(struct ix_queue *que) { struct adapter *adapter = que->adapter; struct rx_ring *rxr = que->rxr; @@ -4350,6 +4359,7 @@ ixgbe_rxeof(struct ix_queue *que, int co struct lro_entry *queued; int i, nextp, processed = 0; u32 staterr = 0; + u32 count = rxr->process_limit; union ixgbe_adv_rx_desc *cur; struct ixgbe_rx_buf *rbuf, *nbuf; @@ -5541,13 +5551,13 @@ ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS) } static void -ixgbe_add_rx_process_limit(struct adapter *adapter, const char *name, +ixgbe_add_process_limit(struct adapter *adapter, const char *name, const char *description, int *limit, int value) { *limit = value; - SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev), + SYSCTL_ADD_UINT(device_get_sysctl_ctx(adapter->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); + OID_AUTO, name, CTLTYPE_UINT|CTLFLAG_RW, limit, value, description); } /* Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:21:55 2012 (r243727) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:28:01 2012 (r243728) @@ -296,6 +296,7 @@ struct tx_ring { IXGBE_QUEUE_WORKING, IXGBE_QUEUE_HUNG, } queue_status; + u32 process_limit; int watchdog_time; union ixgbe_adv_tx_desc *tx_base; struct ixgbe_dma_alloc txdma; @@ -338,6 +339,7 @@ struct rx_ring { bool vtag_strip; u32 next_to_refresh; u32 next_to_check; + u32 process_limit; char mtx_name[16]; struct ixgbe_rx_buf *rx_buffers; bus_dma_tag_t tag; @@ -444,7 +446,6 @@ struct adapter { struct rx_ring *rx_rings; int num_rx_desc; u64 que_mask; - u32 rx_process_limit; /* Multicast array memory */ u8 *mta; From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:45:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4BB7CD41; Fri, 30 Nov 2012 23:45:56 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 32B738FC13; Fri, 30 Nov 2012 23:45:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNjuuP077697; Fri, 30 Nov 2012 23:45:56 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNjubV077695; Fri, 30 Nov 2012 23:45:56 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302345.qAUNjubV077695@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 23:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243729 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:45:56 -0000 Author: jfv Date: Fri Nov 30 23:45:55 2012 New Revision: 243729 URL: http://svnweb.freebsd.org/changeset/base/243729 Log: Patch #8 Performance changes - this one improves locality, moving some counters and data to the ring struct from the adapter struct, also compressing some data in the move. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:28:01 2012 (r243728) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:45:55 2012 (r243729) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 7"; +char ixgbe_driver_version[] = "2.5.0 - 8"; /********************************************************************* * PCI Device ID Table @@ -164,7 +164,7 @@ static int ixgbe_dma_malloc(struct adapt struct ixgbe_dma_alloc *, int); static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); static void ixgbe_add_process_limit(struct adapter *, const char *, - const char *, int *, int); + const char *, u16 *, u16); static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *); static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); @@ -1787,19 +1787,19 @@ ixgbe_xmit(struct tx_ring *txr, struct m *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); if (error == ENOMEM) { - adapter->no_tx_dma_setup++; + txr->no_tx_dma_setup++; return (error); } else if (error != 0) { - adapter->no_tx_dma_setup++; + txr->no_tx_dma_setup++; m_freem(*m_headp); *m_headp = NULL; return (error); } } else if (error == ENOMEM) { - adapter->no_tx_dma_setup++; + txr->no_tx_dma_setup++; return (error); } else if (error != 0) { - adapter->no_tx_dma_setup++; + txr->no_tx_dma_setup++; m_freem(*m_headp); *m_headp = NULL; return (error); @@ -1822,7 +1822,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE; olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT; - ++adapter->tso_tx; + ++txr->tso_tx; } else return (ENXIO); } else if (ixgbe_tx_ctx_setup(txr, m_head)) @@ -1859,7 +1859,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m txd->read.olinfo_status = htole32(olinfo_status); last = i; /* descriptor that will get completion IRQ */ - if (++i == adapter->num_tx_desc) + if (++i == txr->num_desc) i = 0; txbuf->m_head = NULL; @@ -2816,6 +2816,7 @@ ixgbe_allocate_queues(struct adapter *ad txr = &adapter->tx_rings[i]; txr->adapter = adapter; txr->me = i; + txr->num_desc = adapter->num_tx_desc; /* Initialize the TX side lock */ snprintf(txr->mtx_name, sizeof(txr->mtx_name), "%s:tx(%d)", @@ -2862,6 +2863,7 @@ ixgbe_allocate_queues(struct adapter *ad /* Set up some basics */ rxr->adapter = adapter; rxr->me = i; + rxr->num_desc = adapter->num_rx_desc; /* Initialize the RX side lock */ snprintf(rxr->mtx_name, sizeof(rxr->mtx_name), "%s:rx(%d)", @@ -3007,7 +3009,7 @@ ixgbe_setup_transmit_ring(struct tx_ring /* Free any existing tx buffers. */ txbuf = txr->tx_buffers; - for (i = 0; i < adapter->num_tx_desc; i++, txbuf++) { + for (i = 0; i < txr->num_desc; i++, txbuf++) { if (txbuf->m_head != NULL) { bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_POSTWRITE); @@ -3226,7 +3228,6 @@ ixgbe_free_transmit_buffers(struct tx_ri static bool ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) { - struct adapter *adapter = txr->adapter; struct ixgbe_adv_tx_context_desc *TXD; struct ixgbe_tx_buf *tx_buffer; u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; @@ -3329,7 +3330,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, tx_buffer->eop_index = -1; /* We've consumed the first desc, adjust counters */ - if (++ctxd == adapter->num_tx_desc) + if (++ctxd == txr->num_desc) ctxd = 0; txr->next_avail_desc = ctxd; --txr->tx_avail; @@ -3347,7 +3348,6 @@ static bool ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen, u32 *olinfo_status) { - struct adapter *adapter = txr->adapter; struct ixgbe_adv_tx_context_desc *TXD; struct ixgbe_tx_buf *tx_buffer; u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; @@ -3450,7 +3450,7 @@ ixgbe_tso_setup(struct tx_ring *txr, str tx_buffer->m_head = NULL; tx_buffer->eop_index = -1; - if (++ctxd == adapter->num_tx_desc) + if (++ctxd == txr->num_desc) ctxd = 0; txr->tx_avail--; @@ -3595,7 +3595,7 @@ ixgbe_txeof(struct tx_ring *txr) } #endif /* DEV_NETMAP */ - if (txr->tx_avail == adapter->num_tx_desc) { + if (txr->tx_avail == txr->num_desc) { txr->queue_status = IXGBE_QUEUE_IDLE; return FALSE; } @@ -3683,7 +3683,7 @@ ixgbe_txeof(struct tx_ring *txr) if ((!processed) && ((ticks - txr->watchdog_time) > IXGBE_WATCHDOG)) txr->queue_status = IXGBE_QUEUE_HUNG; - if (txr->tx_avail == adapter->num_tx_desc) { + if (txr->tx_avail == txr->num_desc) { txr->queue_status = IXGBE_QUEUE_IDLE; return (FALSE); } @@ -3712,20 +3712,20 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, i = j = rxr->next_to_refresh; /* Control the loop with one beyond */ - if (++j == adapter->num_rx_desc) + if (++j == rxr->num_desc) j = 0; while (j != limit) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->buf == NULL) { mp = m_getjcl(M_DONTWAIT, MT_DATA, - M_PKTHDR, adapter->rx_mbuf_sz); + M_PKTHDR, rxr->mbuf_sz); if (mp == NULL) goto update; } else mp = rxbuf->buf; - mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz; /* If we're dealing with an mbuf that was copied rather * than replaced, there's no need to go through busdma. @@ -3755,7 +3755,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, /* Next is precalculated */ i = j; rxr->next_to_refresh = i; - if (++j == adapter->num_rx_desc) + if (++j == rxr->num_desc) j = 0; } update: @@ -3781,7 +3781,7 @@ ixgbe_allocate_receive_buffers(struct rx struct ixgbe_rx_buf *rxbuf; int i, bsize, error; - bsize = sizeof(struct ixgbe_rx_buf) * adapter->num_rx_desc; + bsize = sizeof(struct ixgbe_rx_buf) * rxr->num_desc; if (!(rxr->rx_buffers = (struct ixgbe_rx_buf *) malloc(bsize, M_DEVBUF, M_NOWAIT | M_ZERO))) { @@ -3806,7 +3806,7 @@ ixgbe_allocate_receive_buffers(struct rx goto fail; } - for (i = 0; i < adapter->num_rx_desc; i++, rxbuf++) { + for (i = 0; i < rxr->num_desc; i++, rxbuf++) { rxbuf = &rxr->rx_buffers[i]; error = bus_dmamap_create(rxr->tag, BUS_DMA_NOWAIT, &rxbuf->map); @@ -3875,11 +3875,11 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) ** Limit the total number of descriptors that ** can be combined, so it does not exceed 64K */ - if (adapter->rx_mbuf_sz == MCLBYTES) + if (rxr->mbuf_sz == MCLBYTES) rscctrl |= IXGBE_RSCCTL_MAXDESC_16; - else if (adapter->rx_mbuf_sz == MJUMPAGESIZE) + else if (rxr->mbuf_sz == MJUMPAGESIZE) rscctrl |= IXGBE_RSCCTL_MAXDESC_8; - else if (adapter->rx_mbuf_sz == MJUM9BYTES) + else if (rxr->mbuf_sz == MJUM9BYTES) rscctrl |= IXGBE_RSCCTL_MAXDESC_4; else /* Using 16K cluster */ rscctrl |= IXGBE_RSCCTL_MAXDESC_1; @@ -3902,12 +3902,10 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) static void ixgbe_free_receive_ring(struct rx_ring *rxr) { - struct adapter *adapter; struct ixgbe_rx_buf *rxbuf; int i; - adapter = rxr->adapter; - for (i = 0; i < adapter->num_rx_desc; i++) { + for (i = 0; i < rxr->num_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->buf != NULL) { bus_dmamap_sync(rxr->tag, rxbuf->map, @@ -3954,12 +3952,14 @@ ixgbe_setup_receive_ring(struct rx_ring rsize = roundup2(adapter->num_rx_desc * sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); + /* Cache the size */ + rxr->mbuf_sz = adapter->rx_mbuf_sz; /* Free current RX buffer structs and their mbufs */ ixgbe_free_receive_ring(rxr); /* Now replenish the mbufs */ - for (int j = 0; j != adapter->num_rx_desc; ++j) { + for (int j = 0; j != rxr->num_desc; ++j) { struct mbuf *mp; rxbuf = &rxr->rx_buffers[j]; @@ -3990,7 +3990,7 @@ ixgbe_setup_receive_ring(struct rx_ring goto fail; } mp = rxbuf->buf; - mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; + mp->m_pkthdr.len = mp->m_len = rxr->mbuf_sz; /* Get the memory mapping */ error = bus_dmamap_load_mbuf_sg(rxr->tag, rxbuf->map, mp, seg, @@ -4359,7 +4359,7 @@ ixgbe_rxeof(struct ix_queue *que) struct lro_entry *queued; int i, nextp, processed = 0; u32 staterr = 0; - u32 count = rxr->process_limit; + u16 count = rxr->process_limit; union ixgbe_adv_rx_desc *cur; struct ixgbe_rx_buf *rbuf, *nbuf; @@ -4540,7 +4540,7 @@ next_desc: BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Advance our pointers to the next descriptor. */ - if (++i == adapter->num_rx_desc) + if (++i == rxr->num_desc) i = 0; /* Now send to the stack or do LRO */ @@ -5286,15 +5286,9 @@ ixgbe_add_hw_stats(struct adapter *adapt SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_failed", CTLFLAG_RD, &adapter->mbuf_defrag_failed, "m_defrag() failed"); - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "no_tx_dma_setup", - CTLFLAG_RD, &adapter->no_tx_dma_setup, - "Driver tx dma failure in xmit"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events", CTLFLAG_RD, &adapter->watchdog_events, "Watchdog timeouts"); - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tso_tx", - CTLFLAG_RD, &adapter->tso_tx, - "TSO"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", CTLFLAG_RD, &adapter->link_irq, "Link MSIX IRQ Handled"); @@ -5321,6 +5315,12 @@ ixgbe_add_hw_stats(struct adapter *adapt CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr), ixgbe_sysctl_tdt_handler, "IU", "Transmit Descriptor Tail"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "tso_tx", + CTLFLAG_RD, &txr->tso_tx, + "TSO"); + SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "no_tx_dma_setup", + CTLFLAG_RD, &txr->no_tx_dma_setup, + "Driver tx dma failure in xmit"); SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", CTLFLAG_RD, &txr->no_desc_avail, "Queue No Descriptor Available"); @@ -5552,7 +5552,7 @@ ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS) static void ixgbe_add_process_limit(struct adapter *adapter, const char *name, - const char *description, int *limit, int value) + const char *description, u16 *limit, u16 value) { *limit = value; SYSCTL_ADD_UINT(device_get_sysctl_ctx(adapter->dev), Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:28:01 2012 (r243728) +++ head/sys/dev/ixgbe/ixgbe.h Fri Nov 30 23:45:55 2012 (r243729) @@ -291,19 +291,20 @@ struct tx_ring { struct adapter *adapter; struct mtx tx_mtx; u32 me; + int watchdog_time; + union ixgbe_adv_tx_desc *tx_base; + struct ixgbe_tx_buf *tx_buffers; + struct ixgbe_dma_alloc txdma; + volatile u16 tx_avail; + u16 next_avail_desc; + u16 next_to_clean; + u16 process_limit; + u16 num_desc; enum { IXGBE_QUEUE_IDLE, IXGBE_QUEUE_WORKING, IXGBE_QUEUE_HUNG, } queue_status; - u32 process_limit; - int watchdog_time; - union ixgbe_adv_tx_desc *tx_base; - struct ixgbe_dma_alloc txdma; - u32 next_avail_desc; - u32 next_to_clean; - struct ixgbe_tx_buf *tx_buffers; - volatile u16 tx_avail; u32 txd_cmd; bus_dma_tag_t txtag; char mtx_name[16]; @@ -318,6 +319,9 @@ struct tx_ring { u32 bytes; /* used for AIM */ u32 packets; /* Soft Stats */ + unsigned long tso_tx; + unsigned long no_tx_map_avail; + unsigned long no_tx_dma_setup; u64 no_desc_avail; u64 total_packets; }; @@ -337,9 +341,11 @@ struct rx_ring { bool hw_rsc; bool discard; bool vtag_strip; - u32 next_to_refresh; - u32 next_to_check; - u32 process_limit; + u16 next_to_refresh; + u16 next_to_check; + u16 num_desc; + u16 mbuf_sz; + u16 process_limit; char mtx_name[16]; struct ixgbe_rx_buf *rx_buffers; bus_dma_tag_t tag; @@ -437,15 +443,15 @@ struct adapter { * Allocated at run time, an array of rings. */ struct tx_ring *tx_rings; - int num_tx_desc; + u32 num_tx_desc; /* * Receive rings: * Allocated at run time, an array of rings. */ struct rx_ring *rx_rings; - int num_rx_desc; u64 que_mask; + u32 num_rx_desc; /* Multicast array memory */ u8 *mta; @@ -455,10 +461,7 @@ struct adapter { unsigned long mbuf_defrag_failed; unsigned long mbuf_header_failed; unsigned long mbuf_packet_failed; - unsigned long no_tx_map_avail; - unsigned long no_tx_dma_setup; unsigned long watchdog_events; - unsigned long tso_tx; unsigned long link_irq; struct ixgbe_hw_stats stats; @@ -522,12 +525,10 @@ drbr_needs_enqueue(struct ifnet *ifp, st static inline u16 ixgbe_rx_unrefreshed(struct rx_ring *rxr) { - struct adapter *adapter = rxr->adapter; - if (rxr->next_to_check > rxr->next_to_refresh) return (rxr->next_to_check - rxr->next_to_refresh - 1); else - return ((adapter->num_rx_desc + rxr->next_to_check) - + return ((rxr->num_desc + rxr->next_to_check) - rxr->next_to_refresh - 1); } From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:51:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D33C806; Fri, 30 Nov 2012 23:51:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 066F18FC15; Fri, 30 Nov 2012 23:51:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNpXPI079391; Fri, 30 Nov 2012 23:51:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNpXtC079387; Fri, 30 Nov 2012 23:51:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201211302351.qAUNpXtC079387@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 30 Nov 2012 23:51:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243731 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:51:35 -0000 Author: jilles Date: Fri Nov 30 23:51:33 2012 New Revision: 243731 URL: http://svnweb.freebsd.org/changeset/base/243731 Log: libc: Allow setting close-on-exec in fopen/freopen/fdopen. This commit adds a new mode option 'e' that must follow any 'b', '+' and/or 'x' options. C11 is clear about the 'x' needing to follow 'b' and/or '+' and that is what we implement; therefore, require a strict position for 'e' as well. For freopen() with a non-NULL path argument and fopen(), the close-on-exec flag is set iff the 'e' mode option is specified. For freopen() with a NULL path argument and fdopen(), the close-on-exec flag is turned on if the 'e' mode option is specified and remains unchanged otherwise. Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC) and fdopen(), this needlessly complicates the calling code. Apart from the ordering requirement, the new option matches glibc. PR: kern/169320 Modified: head/lib/libc/stdio/fdopen.c head/lib/libc/stdio/flags.c head/lib/libc/stdio/fopen.3 head/lib/libc/stdio/freopen.c Modified: head/lib/libc/stdio/fdopen.c ============================================================================== --- head/lib/libc/stdio/fdopen.c Fri Nov 30 23:50:07 2012 (r243730) +++ head/lib/libc/stdio/fdopen.c Fri Nov 30 23:51:33 2012 (r243731) @@ -80,6 +80,12 @@ fdopen(fd, mode) if ((fp = __sfp()) == NULL) return (NULL); + + if ((oflags & O_CLOEXEC) && _fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + fp->_flags = 0; + return (NULL); + } + fp->_flags = flags; /* * If opened for appending, but underlying descriptor does not have Modified: head/lib/libc/stdio/flags.c ============================================================================== --- head/lib/libc/stdio/flags.c Fri Nov 30 23:50:07 2012 (r243730) +++ head/lib/libc/stdio/flags.c Fri Nov 30 23:51:33 2012 (r243731) @@ -97,6 +97,7 @@ __sflags(mode, optr) /* 'x' means exclusive (fail if the file exists) */ if (*mode == 'x') { + mode++; if (m == O_RDONLY) { errno = EINVAL; return (0); @@ -104,6 +105,10 @@ __sflags(mode, optr) o |= O_EXCL; } + /* set close-on-exec */ + if (*mode == 'e') + o |= O_CLOEXEC; + *optr = m | o; return (ret); } Modified: head/lib/libc/stdio/fopen.3 ============================================================================== --- head/lib/libc/stdio/fopen.3 Fri Nov 30 23:50:07 2012 (r243730) +++ head/lib/libc/stdio/fopen.3 Fri Nov 30 23:51:33 2012 (r243731) @@ -32,7 +32,7 @@ .\" @(#)fopen.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 17, 2011 +.Dd November 30, 2012 .Dt FOPEN 3 .Os .Sh NAME @@ -97,6 +97,14 @@ or causes the .Fn fopen call to fail if the file already exists. +An optional +.Dq Li e +following the above +causes the +.Fn fopen +call to set the +.Dv FD_CLOEXEC +flag on the underlying file descriptor. .Pp The .Fa mode @@ -144,6 +152,11 @@ of the stream must be compatible with th The .Dq Li x mode option is ignored. +If the +.Dq Li e +mode option is present, the +.Dv FD_CLOEXEC +flag is set, otherwise it remains unchanged. When the stream is closed via .Xr fclose 3 , .Fa fildes @@ -277,3 +290,7 @@ The function conforms to .St -p1003.1-88 . +The +.Dq Li e +mode option does not conform to any standard +but is also supported by glibc. Modified: head/lib/libc/stdio/freopen.c ============================================================================== --- head/lib/libc/stdio/freopen.c Fri Nov 30 23:50:07 2012 (r243730) +++ head/lib/libc/stdio/freopen.c Fri Nov 30 23:51:33 2012 (r243731) @@ -118,6 +118,8 @@ freopen(file, mode, fp) (void) ftruncate(fp->_file, (off_t)0); if (!(oflags & O_APPEND)) (void) _sseek(fp, (fpos_t)0, SEEK_SET); + if (oflags & O_CLOEXEC) + (void) _fcntl(fp->_file, F_SETFD, FD_CLOEXEC); f = fp->_file; isopen = 0; wantfd = -1; @@ -194,7 +196,8 @@ finish: * assume stderr is always fd STDERR_FILENO, even if being freopen'd. */ if (wantfd >= 0) { - if (_dup2(f, wantfd) >= 0) { + if ((oflags & O_CLOEXEC ? _fcntl(f, F_DUP2FD_CLOEXEC, wantfd) : + _dup2(f, wantfd)) >= 0) { (void)_close(f); f = wantfd; } else From owner-svn-src-head@FreeBSD.ORG Fri Nov 30 23:54:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE6434FC; Fri, 30 Nov 2012 23:54:57 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BAA438FC12; Fri, 30 Nov 2012 23:54:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAUNsvqx080809; Fri, 30 Nov 2012 23:54:57 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAUNsvgg080808; Fri, 30 Nov 2012 23:54:57 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201211302354.qAUNsvgg080808@svn.freebsd.org> From: Jack F Vogel Date: Fri, 30 Nov 2012 23:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243733 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Nov 2012 23:54:58 -0000 Author: jfv Date: Fri Nov 30 23:54:57 2012 New Revision: 243733 URL: http://svnweb.freebsd.org/changeset/base/243733 Log: Patch #9 Performance - improve the tx dma failure path, similar to a change done in igb long ago. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:52:45 2012 (r243732) +++ head/sys/dev/ixgbe/ixgbe.c Fri Nov 30 23:54:57 2012 (r243733) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 8"; +char ixgbe_driver_version[] = "2.5.0 - 9"; /********************************************************************* * PCI Device ID Table @@ -1740,6 +1740,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m u32 paylen = 0; int i, j, error, nsegs; int first, last = 0; + bool remap = TRUE; struct mbuf *m_head; bus_dma_segment_t segs[adapter->num_segs]; bus_dmamap_t map; @@ -1767,42 +1768,38 @@ ixgbe_xmit(struct tx_ring *txr, struct m /* * Map the packet for DMA. */ +retry: error = bus_dmamap_load_mbuf_sg(txr->txtag, map, *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); - if (error == EFBIG) { + if (__predict_false(error)) { struct mbuf *m; - m = m_defrag(*m_headp, M_DONTWAIT); - if (m == NULL) { - adapter->mbuf_defrag_failed++; - m_freem(*m_headp); - *m_headp = NULL; - return (ENOBUFS); - } - *m_headp = m; - - /* Try it again */ - error = bus_dmamap_load_mbuf_sg(txr->txtag, map, - *m_headp, segs, &nsegs, BUS_DMA_NOWAIT); - - if (error == ENOMEM) { + switch (error) { + case EFBIG: + /* Try it again? - one try */ + if (remap == TRUE) { + remap = FALSE; + m = m_defrag(*m_headp, M_NOWAIT); + if (m == NULL) { + adapter->mbuf_defrag_failed++; + m_freem(*m_headp); + *m_headp = NULL; + return (ENOBUFS); + } + *m_headp = m; + goto retry; + } else + return (error); + case ENOMEM: txr->no_tx_dma_setup++; return (error); - } else if (error != 0) { + default: txr->no_tx_dma_setup++; m_freem(*m_headp); *m_headp = NULL; return (error); } - } else if (error == ENOMEM) { - txr->no_tx_dma_setup++; - return (error); - } else if (error != 0) { - txr->no_tx_dma_setup++; - m_freem(*m_headp); - *m_headp = NULL; - return (error); } /* Make certain there are enough descriptors */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 00:04:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA871E37; Sat, 1 Dec 2012 00:04:00 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5C368FC16; Sat, 1 Dec 2012 00:04:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB103xNq083980; Sat, 1 Dec 2012 00:03:59 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB103xUD083978; Sat, 1 Dec 2012 00:03:59 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201212010003.qB103xUD083978@svn.freebsd.org> From: Jack F Vogel Date: Sat, 1 Dec 2012 00:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243735 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 00:04:00 -0000 Author: jfv Date: Sat Dec 1 00:03:58 2012 New Revision: 243735 URL: http://svnweb.freebsd.org/changeset/base/243735 Log: Patch #10 Performance - this changes the protocol offload interface and code in the TX path,making it tighter and hopefully more efficient. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 00:02:31 2012 (r243734) +++ head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 00:03:58 2012 (r243735) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 9"; +char ixgbe_driver_version[] = "2.5.0 - 10"; /********************************************************************* * PCI Device ID Table @@ -165,8 +165,10 @@ static int ixgbe_dma_malloc(struct adapt static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); static void ixgbe_add_process_limit(struct adapter *, const char *, const char *, u16 *, u16); -static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); -static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *); +static int ixgbe_tx_ctx_setup(struct tx_ring *, + struct mbuf *, u32 *, u32 *); +static int ixgbe_tso_setup(struct tx_ring *, + struct mbuf *, u32 *, u32 *); static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); static void ixgbe_configure_ivars(struct adapter *); static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); @@ -1737,7 +1739,6 @@ ixgbe_xmit(struct tx_ring *txr, struct m { struct adapter *adapter = txr->adapter; u32 olinfo_status = 0, cmd_type_len; - u32 paylen = 0; int i, j, error, nsegs; int first, last = 0; bool remap = TRUE; @@ -1814,16 +1815,12 @@ retry: ** Set up the appropriate offload context ** this will consume the first descriptor */ - if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { - if (ixgbe_tso_setup(txr, m_head, &paylen, &olinfo_status)) { - cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE; - olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; - olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT; - ++txr->tso_tx; - } else - return (ENXIO); - } else if (ixgbe_tx_ctx_setup(txr, m_head)) - olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; + error = ixgbe_tx_ctx_setup(txr, m_head, &cmd_type_len, &olinfo_status); + if (__predict_false(error)) { + if (error == ENOBUFS) + *m_headp = NULL; + return (error); + } #ifdef IXGBE_FDIR /* Do the flow director magic */ @@ -1835,10 +1832,6 @@ retry: } } #endif - /* Record payload length */ - if (paylen == 0) - olinfo_status |= m_head->m_pkthdr.len << - IXGBE_ADVTXD_PAYLEN_SHIFT; i = txr->next_avail_desc; for (j = 0; j < nsegs; j++) { @@ -3218,31 +3211,37 @@ ixgbe_free_transmit_buffers(struct tx_ri /********************************************************************* * - * Advanced Context Descriptor setup for VLAN or CSUM + * Advanced Context Descriptor setup for VLAN, CSUM or TSO * **********************************************************************/ -static bool -ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) +static int +ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp, + u32 *cmd_type_len, u32 *olinfo_status) { struct ixgbe_adv_tx_context_desc *TXD; - struct ixgbe_tx_buf *tx_buffer; - u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; struct ether_vlan_header *eh; struct ip *ip; struct ip6_hdr *ip6; - int ehdrlen, ip_hlen = 0; + u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; + int ehdrlen, ip_hlen = 0; u16 etype; u8 ipproto = 0; - bool offload = TRUE; - int ctxd = txr->next_avail_desc; - u16 vtag = 0; - + int offload = TRUE; + int ctxd = txr->next_avail_desc; + u16 vtag = 0; + + /* First check if TSO is to be used */ + if (mp->m_pkthdr.csum_flags & CSUM_TSO) + return (ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status)); if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) offload = FALSE; - tx_buffer = &txr->tx_buffers[ctxd]; + /* Indicate the whole packet as payload when not doing TSO */ + *olinfo_status |= mp->m_pkthdr.len << IXGBE_ADVTXD_PAYLEN_SHIFT; + + /* Now ready a context descriptor */ TXD = (struct ixgbe_adv_tx_context_desc *) &txr->tx_base[ctxd]; /* @@ -3253,8 +3252,8 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, if (mp->m_flags & M_VLANTAG) { vtag = htole16(mp->m_pkthdr.ether_vtag); vlan_macip_lens |= (vtag << IXGBE_ADVTXD_VLAN_SHIFT); - } else if (offload == FALSE) - return FALSE; + } else if (offload == FALSE) /* ... no offload to do */ + return (0); /* * Determine where frame payload starts. @@ -3317,22 +3316,22 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, break; } + if (offload) /* For the TX descriptor setup */ + *olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; + /* Now copy bits into descriptor */ TXD->vlan_macip_lens |= htole32(vlan_macip_lens); TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); TXD->seqnum_seed = htole32(0); TXD->mss_l4len_idx = htole32(0); - tx_buffer->m_head = NULL; - tx_buffer->eop_index = -1; - /* We've consumed the first desc, adjust counters */ if (++ctxd == txr->num_desc) ctxd = 0; txr->next_avail_desc = ctxd; --txr->tx_avail; - return (offload); + return (0); } /********************************************************************** @@ -3341,14 +3340,13 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, * adapters using advanced tx descriptors * **********************************************************************/ -static bool -ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen, - u32 *olinfo_status) +static int +ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, + u32 *cmd_type_len, u32 *olinfo_status) { struct ixgbe_adv_tx_context_desc *TXD; - struct ixgbe_tx_buf *tx_buffer; u32 vlan_macip_lens = 0, type_tucmd_mlhl = 0; - u32 mss_l4len_idx = 0, len; + u32 mss_l4len_idx = 0, paylen; u16 vtag = 0, eh_type; int ctxd, ehdrlen, ip_hlen, tcp_hlen; struct ether_vlan_header *eh; @@ -3374,18 +3372,15 @@ ixgbe_tso_setup(struct tx_ring *txr, str eh_type = eh->evl_encap_proto; } - /* Ensure we have at least the IP+TCP header in the first mbuf. */ - len = ehdrlen + sizeof(struct tcphdr); switch (ntohs(eh_type)) { #ifdef INET6 case ETHERTYPE_IPV6: - if (mp->m_len < len + sizeof(struct ip6_hdr)) - return FALSE; ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); /* XXX-BZ For now we do not pretend to support ext. hdrs. */ if (ip6->ip6_nxt != IPPROTO_TCP) - return FALSE; + return (ENXIO); ip_hlen = sizeof(struct ip6_hdr); + ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); th = (struct tcphdr *)((caddr_t)ip6 + ip_hlen); th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6; @@ -3393,11 +3388,9 @@ ixgbe_tso_setup(struct tx_ring *txr, str #endif #ifdef INET case ETHERTYPE_IP: - if (mp->m_len < len + sizeof(struct ip)) - return FALSE; ip = (struct ip *)(mp->m_data + ehdrlen); if (ip->ip_p != IPPROTO_TCP) - return FALSE; + return (ENXIO); ip->ip_sum = 0; ip_hlen = ip->ip_hl << 2; th = (struct tcphdr *)((caddr_t)ip + ip_hlen); @@ -3415,13 +3408,12 @@ ixgbe_tso_setup(struct tx_ring *txr, str } ctxd = txr->next_avail_desc; - tx_buffer = &txr->tx_buffers[ctxd]; TXD = (struct ixgbe_adv_tx_context_desc *) &txr->tx_base[ctxd]; tcp_hlen = th->th_off << 2; /* This is used in the transmit desc in encap */ - *paylen = mp->m_pkthdr.len - ehdrlen - ip_hlen - tcp_hlen; + paylen = mp->m_pkthdr.len - ehdrlen - ip_hlen - tcp_hlen; /* VLAN MACLEN IPLEN */ if (mp->m_flags & M_VLANTAG) { @@ -3444,15 +3436,17 @@ ixgbe_tso_setup(struct tx_ring *txr, str TXD->mss_l4len_idx = htole32(mss_l4len_idx); TXD->seqnum_seed = htole32(0); - tx_buffer->m_head = NULL; - tx_buffer->eop_index = -1; if (++ctxd == txr->num_desc) ctxd = 0; txr->tx_avail--; txr->next_avail_desc = ctxd; - return TRUE; + *cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE; + *olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; + *olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT; + ++txr->tso_tx; + return (0); } #ifdef IXGBE_FDIR From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 00:11:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A809C1E8; Sat, 1 Dec 2012 00:11:24 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8F5DE8FC14; Sat, 1 Dec 2012 00:11:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB10BOhc085600; Sat, 1 Dec 2012 00:11:24 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB10BO0Q085598; Sat, 1 Dec 2012 00:11:24 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201212010011.qB10BO0Q085598@svn.freebsd.org> From: Jack F Vogel Date: Sat, 1 Dec 2012 00:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243736 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 00:11:24 -0000 Author: jfv Date: Sat Dec 1 00:11:24 2012 New Revision: 243736 URL: http://svnweb.freebsd.org/changeset/base/243736 Log: Patch #11 - The final patch: this one greatly improves the TX hot path by getting rid of index calculations and simply managing pointers. Much of the creative code is due to my coworker here at Intel, Alex Duyck, thanks Alex! Also, this whole series of patches was given the critical eye of Gleb Smirnoff and is all the better for it, thanks Gleb! Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 00:03:58 2012 (r243735) +++ head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 00:11:24 2012 (r243736) @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 10"; +char ixgbe_driver_version[] = "2.5.0"; /********************************************************************* * PCI Device ID Table @@ -1740,7 +1740,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m struct adapter *adapter = txr->adapter; u32 olinfo_status = 0, cmd_type_len; int i, j, error, nsegs; - int first, last = 0; + int first; bool remap = TRUE; struct mbuf *m_head; bus_dma_segment_t segs[adapter->num_segs]; @@ -1847,13 +1847,9 @@ retry: txd->read.cmd_type_len = htole32(txr->txd_cmd | cmd_type_len |seglen); txd->read.olinfo_status = htole32(olinfo_status); - last = i; /* descriptor that will get completion IRQ */ if (++i == txr->num_desc) i = 0; - - txbuf->m_head = NULL; - txbuf->eop_index = -1; } txd->read.cmd_type_len |= @@ -1872,9 +1868,9 @@ retry: txbuf->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); - /* Set the index of the descriptor that will be marked done */ + /* Set the EOP descriptor that will be marked done */ txbuf = &txr->tx_buffers[first]; - txbuf->eop_index = last; + txbuf->eop = txd; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -3023,8 +3019,8 @@ ixgbe_setup_transmit_ring(struct tx_ring netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } #endif /* DEV_NETMAP */ - /* Clear the EOP index */ - txbuf->eop_index = -1; + /* Clear the EOP descriptor pointer */ + txbuf->eop = NULL; } #ifdef IXGBE_FDIR @@ -3083,7 +3079,7 @@ ixgbe_initialize_transmit_units(struct a (tdba & 0x00000000ffffffffULL)); IXGBE_WRITE_REG(hw, IXGBE_TDBAH(i), (tdba >> 32)); IXGBE_WRITE_REG(hw, IXGBE_TDLEN(i), - adapter->num_tx_desc * sizeof(struct ixgbe_legacy_tx_desc)); + adapter->num_tx_desc * sizeof(union ixgbe_adv_tx_desc)); /* Setup the HW Tx Head and Tail descriptor pointers */ IXGBE_WRITE_REG(hw, IXGBE_TDH(i), 0); @@ -3320,8 +3316,8 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, *olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; /* Now copy bits into descriptor */ - TXD->vlan_macip_lens |= htole32(vlan_macip_lens); - TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); + TXD->vlan_macip_lens = htole32(vlan_macip_lens); + TXD->type_tucmd_mlhl = htole32(type_tucmd_mlhl); TXD->seqnum_seed = htole32(0); TXD->mss_l4len_idx = htole32(0); @@ -3423,12 +3419,12 @@ ixgbe_tso_setup(struct tx_ring *txr, str vlan_macip_lens |= ehdrlen << IXGBE_ADVTXD_MACLEN_SHIFT; vlan_macip_lens |= ip_hlen; - TXD->vlan_macip_lens |= htole32(vlan_macip_lens); + TXD->vlan_macip_lens = htole32(vlan_macip_lens); /* ADV DTYPE TUCMD */ type_tucmd_mlhl |= IXGBE_ADVTXD_DCMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT; type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; - TXD->type_tucmd_mlhl |= htole32(type_tucmd_mlhl); + TXD->type_tucmd_mlhl = htole32(type_tucmd_mlhl); /* MSS L4LEN IDX */ mss_l4len_idx |= (mp->m_pkthdr.tso_segsz << IXGBE_ADVTXD_MSS_SHIFT); @@ -3535,11 +3531,12 @@ ixgbe_atr(struct tx_ring *txr, struct mb static bool ixgbe_txeof(struct tx_ring *txr) { - struct adapter *adapter = txr->adapter; - struct ifnet *ifp = adapter->ifp; - u32 first, last, done, processed; - struct ixgbe_tx_buf *tx_buffer; - struct ixgbe_legacy_tx_desc *tx_desc, *eop_desc; + struct adapter *adapter = txr->adapter; + struct ifnet *ifp = adapter->ifp; + u32 work, processed = 0; + u16 limit = txr->process_limit; + struct ixgbe_tx_buf *buf; + union ixgbe_adv_tx_desc *txd; mtx_assert(&txr->tx_mtx, MA_OWNED); @@ -3547,9 +3544,7 @@ ixgbe_txeof(struct tx_ring *txr) if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->tx_rings[txr->me]; - - tx_desc = (struct ixgbe_legacy_tx_desc *)txr->tx_base; - + txd = txr->tx_base; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); /* @@ -3572,8 +3567,7 @@ ixgbe_txeof(struct tx_ring *txr) */ if (!netmap_mitigate || (kring->nr_kflags < kring->nkr_num_slots && - tx_desc[kring->nr_kflags].upper.fields.status & - IXGBE_TXD_STAT_DD)) { + txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD)) { kring->nr_kflags = kring->nkr_num_slots; selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); IXGBE_TX_UNLOCK(txr); @@ -3591,79 +3585,87 @@ ixgbe_txeof(struct tx_ring *txr) return FALSE; } - processed = 0; - first = txr->next_to_clean; - tx_buffer = &txr->tx_buffers[first]; - /* For cleanup we just use legacy struct */ - tx_desc = (struct ixgbe_legacy_tx_desc *)&txr->tx_base[first]; - last = tx_buffer->eop_index; - if (last == -1) - return FALSE; - eop_desc = (struct ixgbe_legacy_tx_desc *)&txr->tx_base[last]; - - /* - ** Get the index of the first descriptor - ** BEYOND the EOP and call that 'done'. - ** I do this so the comparison in the - ** inner while loop below can be simple - */ - if (++last == adapter->num_tx_desc) last = 0; - done = last; - + /* Get work starting point */ + work = txr->next_to_clean; + buf = &txr->tx_buffers[work]; + txd = &txr->tx_base[work]; + work -= txr->num_desc; /* The distance to ring end */ bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* - ** Only the EOP descriptor of a packet now has the DD - ** bit set, this is what we look for... - */ - while (eop_desc->upper.fields.status & IXGBE_TXD_STAT_DD) { - /* We clean the range of the packet */ - while (first != done) { - tx_desc->upper.data = 0; - tx_desc->lower.data = 0; - tx_desc->buffer_addr = 0; - ++txr->tx_avail; - ++processed; - if (tx_buffer->m_head) { + do { + union ixgbe_adv_tx_desc *eop= buf->eop; + if (eop == NULL) /* No work */ + break; + + if ((eop->wb.status & IXGBE_TXD_STAT_DD) == 0) + break; /* I/O not complete */ + + if (buf->m_head) { + txr->bytes += + buf->m_head->m_pkthdr.len; + bus_dmamap_sync(txr->txtag, + buf->map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(txr->txtag, + buf->map); + m_freem(buf->m_head); + buf->m_head = NULL; + buf->map = NULL; + } + buf->eop = NULL; + ++txr->tx_avail; + + /* We clean the range if multi segment */ + while (txd != eop) { + ++txd; + ++buf; + ++work; + /* wrap the ring? */ + if (__predict_false(!work)) { + work -= txr->num_desc; + buf = txr->tx_buffers; + txd = txr->tx_base; + } + if (buf->m_head) { txr->bytes += - tx_buffer->m_head->m_pkthdr.len; + buf->m_head->m_pkthdr.len; bus_dmamap_sync(txr->txtag, - tx_buffer->map, + buf->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(txr->txtag, - tx_buffer->map); - m_freem(tx_buffer->m_head); - tx_buffer->m_head = NULL; - tx_buffer->map = NULL; + buf->map); + m_freem(buf->m_head); + buf->m_head = NULL; + buf->map = NULL; } - tx_buffer->eop_index = -1; - txr->watchdog_time = ticks; - - if (++first == adapter->num_tx_desc) - first = 0; + ++txr->tx_avail; + buf->eop = NULL; - tx_buffer = &txr->tx_buffers[first]; - tx_desc = - (struct ixgbe_legacy_tx_desc *)&txr->tx_base[first]; } ++txr->packets; + ++processed; ++ifp->if_opackets; - /* See if there is more work now */ - last = tx_buffer->eop_index; - if (last != -1) { - eop_desc = - (struct ixgbe_legacy_tx_desc *)&txr->tx_base[last]; - /* Get next done point */ - if (++last == adapter->num_tx_desc) last = 0; - done = last; - } else - break; - } + txr->watchdog_time = ticks; + + /* Try the next packet */ + ++txd; + ++buf; + ++work; + /* reset with a wrap */ + if (__predict_false(!work)) { + work -= txr->num_desc; + buf = txr->tx_buffers; + txd = txr->tx_base; + } + prefetch(txd); + } while (__predict_true(--limit)); + bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - txr->next_to_clean = first; + work += txr->num_desc; + txr->next_to_clean = work; /* ** Watchdog calculation, we know there's Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Sat Dec 1 00:03:58 2012 (r243735) +++ head/sys/dev/ixgbe/ixgbe.h Sat Dec 1 00:11:24 2012 (r243736) @@ -239,7 +239,7 @@ struct ixgbe_i2c_req { }; struct ixgbe_tx_buf { - u32 eop_index; + union ixgbe_adv_tx_desc *eop; struct mbuf *m_head; bus_dmamap_t map; }; From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 00:56:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A5D6629; Sat, 1 Dec 2012 00:56:20 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D6EBF8FC0C; Sat, 1 Dec 2012 00:56:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB10uJ3x091653; Sat, 1 Dec 2012 00:56:19 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB10uJY2091651; Sat, 1 Dec 2012 00:56:19 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201212010056.qB10uJY2091651@svn.freebsd.org> From: Jung-uk Kim Date: Sat, 1 Dec 2012 00:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243737 - in head/sys: amd64/pci i386/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 00:56:20 -0000 Author: jkim Date: Sat Dec 1 00:56:19 2012 New Revision: 243737 URL: http://svnweb.freebsd.org/changeset/base/243737 Log: Remove duplicate code. Reduce diff between amd64 and i386. Modified: head/sys/amd64/pci/pci_cfgreg.c head/sys/i386/pci/pci_cfgreg.c Modified: head/sys/amd64/pci/pci_cfgreg.c ============================================================================== --- head/sys/amd64/pci/pci_cfgreg.c Sat Dec 1 00:11:24 2012 (r243736) +++ head/sys/amd64/pci/pci_cfgreg.c Sat Dec 1 00:56:19 2012 (r243737) @@ -295,6 +295,13 @@ pcie_cfgregopen(uint64_t base, uint8_t m return (1); } +#define PCIE_VADDR(base, reg, bus, slot, func) \ + ((base) + \ + ((((bus) & 0xff) << 20) | \ + (((slot) & 0x1f) << 15) | \ + (((func) & 0x7) << 12) | \ + ((reg) & 0xfff))) + /* * AMD BIOS And Kernel Developer's Guides for CPU families starting with 10h * have a requirement that all accesses to the memory mapped PCI configuration @@ -302,12 +309,6 @@ pcie_cfgregopen(uint64_t base, uint8_t m * Since other vendors do not currently have any contradicting requirements * the AMD access pattern is applied universally. */ -#define PCIE_VADDR(base, reg, bus, slot, func) \ - ((base) + \ - ((((bus) & 0xff) << 20) | \ - (((slot) & 0x1f) << 15) | \ - (((func) & 0x7) << 12) | \ - ((reg) & 0xfff))) static int pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg, Modified: head/sys/i386/pci/pci_cfgreg.c ============================================================================== --- head/sys/i386/pci/pci_cfgreg.c Sat Dec 1 00:11:24 2012 (r243736) +++ head/sys/i386/pci/pci_cfgreg.c Sat Dec 1 00:56:19 2012 (r243737) @@ -610,25 +610,29 @@ pcie_cfgregopen(uint64_t base, uint8_t m } #endif /* !XEN */ -#define PCIE_PADDR(bar, reg, bus, slot, func) \ - ((bar) | \ - (((bus) & 0xff) << 20) | \ +#define PCIE_PADDR(base, reg, bus, slot, func) \ + ((base) + \ + ((((bus) & 0xff) << 20) | \ (((slot) & 0x1f) << 15) | \ (((func) & 0x7) << 12) | \ - ((reg) & 0xfff)) + ((reg) & 0xfff))) -/* - * Find an element in the cache that matches the physical page desired, or - * create a new mapping from the least recently used element. - * A very simple LRU algorithm is used here, does it need to be more - * efficient? - */ -static __inline struct pcie_cfg_elem * -pciereg_findelem(vm_paddr_t papage) +static __inline vm_offset_t +pciereg_findaddr(int bus, unsigned slot, unsigned func, unsigned reg) { struct pcie_cfg_list *pcielist; struct pcie_cfg_elem *elem; + vm_paddr_t pa, papage; + pa = PCIE_PADDR(pcie_base, reg, bus, slot, func); + papage = pa & ~PAGE_MASK; + + /* + * Find an element in the cache that matches the physical page desired, + * or create a new mapping from the least recently used element. + * A very simple LRU algorithm is used here, does it need to be more + * efficient? + */ pcielist = &pcie_list[PCPU_GET(cpuid)]; TAILQ_FOREACH(elem, pcielist, elem) { if (elem->papage == papage) @@ -649,7 +653,7 @@ pciereg_findelem(vm_paddr_t papage) TAILQ_REMOVE(pcielist, elem, elem); TAILQ_INSERT_HEAD(pcielist, elem, elem); } - return (elem); + return (elem->vapage | (pa & PAGE_MASK)); } /* @@ -664,9 +668,7 @@ static int pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg, unsigned bytes) { - struct pcie_cfg_elem *elem; vm_offset_t va; - vm_paddr_t pa, papage; int data = -1; if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || @@ -674,10 +676,7 @@ pciereg_cfgread(int bus, unsigned slot, return (-1); critical_enter(); - pa = PCIE_PADDR(pcie_base, reg, bus, slot, func); - papage = pa & ~PAGE_MASK; - elem = pciereg_findelem(papage); - va = elem->vapage | (pa & PAGE_MASK); + va = pciereg_findaddr(bus, slot, func, reg); switch (bytes) { case 4: @@ -702,19 +701,14 @@ static void pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data, unsigned bytes) { - struct pcie_cfg_elem *elem; vm_offset_t va; - vm_paddr_t pa, papage; if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX || func > PCI_FUNCMAX || reg > PCIE_REGMAX) return; critical_enter(); - pa = PCIE_PADDR(pcie_base, reg, bus, slot, func); - papage = pa & ~PAGE_MASK; - elem = pciereg_findelem(papage); - va = elem->vapage | (pa & PAGE_MASK); + va = pciereg_findaddr(bus, slot, func, reg); switch (bytes) { case 4: From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 01:24:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F137DE98; Sat, 1 Dec 2012 01:24:40 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4BB48FC14; Sat, 1 Dec 2012 01:24:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB11OeJA096414; Sat, 1 Dec 2012 01:24:40 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB11OefS096413; Sat, 1 Dec 2012 01:24:40 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201212010124.qB11OefS096413@svn.freebsd.org> From: Jack F Vogel Date: Sat, 1 Dec 2012 01:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243741 - head/sys/dev/ixgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 01:24:41 -0000 Author: jfv Date: Sat Dec 1 01:24:40 2012 New Revision: 243741 URL: http://svnweb.freebsd.org/changeset/base/243741 Log: Patch #12 OK, I said there was only 11 patches, but unfortunately the revamped sysctl code did not work, and needed a change. This makes the limit get set at the time that all sysctl stats are created and is actually more elegant imho anyway. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 01:16:40 2012 (r243740) +++ head/sys/dev/ixgbe/ixgbe.c Sat Dec 1 01:24:40 2012 (r243741) @@ -163,8 +163,6 @@ static int ixgbe_set_thermal_test(SYSCTL static int ixgbe_dma_malloc(struct adapter *, bus_size_t, struct ixgbe_dma_alloc *, int); static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); -static void ixgbe_add_process_limit(struct adapter *, const char *, - const char *, u16 *, u16); static int ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *, u32 *, u32 *); static int ixgbe_tso_setup(struct tx_ring *, @@ -3070,11 +3068,6 @@ ixgbe_initialize_transmit_units(struct a u64 tdba = txr->txdma.dma_paddr; u32 txctrl; - /* Sysctl for limiting work done in tx clean */ - ixgbe_add_process_limit(adapter, "tx_processing_limit", - "max number of packets to process", &txr->process_limit, - ixgbe_tx_process_limit); - IXGBE_WRITE_REG(hw, IXGBE_TDBAL(i), (tdba & 0x00000000ffffffffULL)); IXGBE_WRITE_REG(hw, IXGBE_TDBAH(i), (tdba >> 32)); @@ -4119,11 +4112,6 @@ ixgbe_initialize_receive_units(struct ad for (int i = 0; i < adapter->num_queues; i++, rxr++) { u64 rdba = rxr->rxdma.dma_paddr; - /* Sysctl for limiting work done in rx clean */ - ixgbe_add_process_limit(adapter, "rx_processing_limit", - "max number of packets to process", &rxr->process_limit, - ixgbe_rx_process_limit); - /* Setup the Base and Length of the Rx Descriptor Ring */ IXGBE_WRITE_REG(hw, IXGBE_RDBAL(i), (rdba & 0x00000000ffffffffULL)); @@ -5185,6 +5173,23 @@ ixgbe_sysctl_tdt_handler(SYSCTL_HANDLER_ return 0; } +/** ixgbe_sysctl_tx_process_limit - Handler function + * Set the limit value for TX processing + */ +static int +ixgbe_sysctl_tx_process_limit(SYSCTL_HANDLER_ARGS) +{ + int error; + + struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1); + if (!txr) return 0; + + error = sysctl_handle_int(oidp, &ixgbe_tx_process_limit, 0, req); + if (error || !req->newptr) + return error; + return 0; +} + /** ixgbe_sysctl_rdh_handler - Handler function * Retrieves the RDH value from the hardware */ @@ -5221,6 +5226,23 @@ ixgbe_sysctl_rdt_handler(SYSCTL_HANDLER_ return 0; } +/** ixgbe_sysctl_rx_process_limit - Handler function + * Set the limit value for RX processing + */ +static int +ixgbe_sysctl_rx_process_limit(SYSCTL_HANDLER_ARGS) +{ + int error; + + struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1); + if (!rxr) return 0; + + error = sysctl_handle_int(oidp, &ixgbe_rx_process_limit, 0, req); + if (error || !req->newptr) + return error; + return 0; +} + static int ixgbe_sysctl_interrupt_rate_handler(SYSCTL_HANDLER_ARGS) { @@ -5308,6 +5330,10 @@ ixgbe_add_hw_stats(struct adapter *adapt CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr), ixgbe_sysctl_tdt_handler, "IU", "Transmit Descriptor Tail"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "tx_process_limit", + CTLTYPE_UINT | CTLFLAG_RD, txr, sizeof(txr), + ixgbe_sysctl_tx_process_limit, "IU", + "Transmit Process Limit"); SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO, "tso_tx", CTLFLAG_RD, &txr->tso_tx, "TSO"); @@ -5343,6 +5369,10 @@ ixgbe_add_hw_stats(struct adapter *adapt CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr), ixgbe_sysctl_rdt_handler, "IU", "Receive Descriptor Tail"); + SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rx_process_limit", + CTLTYPE_UINT | CTLFLAG_RD, rxr, sizeof(rxr), + ixgbe_sysctl_rx_process_limit, "IU", + "Receive Process Limit"); SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_packets", CTLFLAG_RD, &rxr->rx_packets, "Queue Packets Received"); @@ -5543,16 +5573,6 @@ ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS) return error; } -static void -ixgbe_add_process_limit(struct adapter *adapter, const char *name, - const char *description, u16 *limit, u16 value) -{ - *limit = value; - SYSCTL_ADD_UINT(device_get_sysctl_ctx(adapter->dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), - OID_AUTO, name, CTLTYPE_UINT|CTLFLAG_RW, limit, value, description); -} - /* ** Control link advertise speed: ** 1 - advertise only 1G From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 03:48:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1F1FDFF; Sat, 1 Dec 2012 03:48:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9FF198FC08; Sat, 1 Dec 2012 03:48:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB13mB7d017387; Sat, 1 Dec 2012 03:48:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB13mBpZ017385; Sat, 1 Dec 2012 03:48:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201212010348.qB13mBpZ017385@svn.freebsd.org> From: Adrian Chadd Date: Sat, 1 Dec 2012 03:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243743 - in head/sys/dev/ath/ath_hal: . ar5416 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 03:48:12 -0000 Author: adrian Date: Sat Dec 1 03:48:11 2012 New Revision: 243743 URL: http://svnweb.freebsd.org/changeset/base/243743 Log: Add a new HAL capability - check and enforce whether the NIC supports enforcing the TXOP and TBTT limits: * Frames which will overlap with TBTT will not TX; * Frames which will exceed TXOP will be filtered. This is not enabled by default; it's intended to be enabled by the TDMA code on 802.11n capable chipsets. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Sat Dec 1 02:02:19 2012 (r243742) +++ head/sys/dev/ath/ath_hal/ah.h Sat Dec 1 03:48:11 2012 (r243743) @@ -192,6 +192,7 @@ typedef enum { HAL_CAP_LONG_RXDESC_TSF = 243, /* hardware supports 32bit TSF in RX descriptor */ HAL_CAP_BB_READ_WAR = 244, /* baseband read WAR */ HAL_CAP_SERIALISE_WAR = 245, /* serialise register access on PCI */ + HAL_CAP_ENFORCE_TXOP = 246, /* Enforce TXOP if supported */ } HAL_CAPABILITY_TYPE; /* Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat Dec 1 02:02:19 2012 (r243742) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat Dec 1 03:48:11 2012 (r243743) @@ -451,6 +451,10 @@ ar5416GetCapability(struct ath_hal *ah, HAL_OK : HAL_ENOTSUPP; case HAL_CAP_DIVERSITY: /* disable classic fast diversity */ return HAL_ENXIO; + case HAL_CAP_ENFORCE_TXOP: + (*result) = + !! (AH5212(ah)->ah_miscMode & AR_PCU_TXOP_TBTT_LIMIT_ENA); + return (HAL_OK); default: break; } @@ -480,6 +484,19 @@ ar5416SetCapability(struct ath_hal *ah, else pCap->halTxStreams = 1; return AH_TRUE; + case HAL_CAP_ENFORCE_TXOP: + if (setting) { + AH5212(ah)->ah_miscMode + |= AR_PCU_TXOP_TBTT_LIMIT_ENA; + OS_REG_SET_BIT(ah, AR_MISC_MODE, + AR_PCU_TXOP_TBTT_LIMIT_ENA); + } else { + AH5212(ah)->ah_miscMode + &= ~AR_PCU_TXOP_TBTT_LIMIT_ENA; + OS_REG_CLR_BIT(ah, AR_MISC_MODE, + AR_PCU_TXOP_TBTT_LIMIT_ENA); + } + return AH_TRUE; default: break; } From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 08:41:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D285C2A for ; Sat, 1 Dec 2012 08:41:05 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9CAEB8FC15 for ; Sat, 1 Dec 2012 08:41:04 +0000 (UTC) Received: (qmail 77701 invoked from network); 1 Dec 2012 10:12:01 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 1 Dec 2012 10:12:01 -0000 Message-ID: <50B9C291.4030107@freebsd.org> Date: Sat, 01 Dec 2012 09:40:49 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Jack F Vogel Subject: Re: svn commit: r243714 - in head/sys/dev: ixgbe netmap References: <201211302219.qAUMJIkI065470@svn.freebsd.org> In-Reply-To: <201211302219.qAUMJIkI065470@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 08:41:05 -0000 On 30.11.2012 23:19, Jack F Vogel wrote: > Author: jfv > Date: Fri Nov 30 22:19:18 2012 > New Revision: 243714 > URL: http://svnweb.freebsd.org/changeset/base/243714 > > Log: > First of a series of 11 patches leading to new ixgbe version 2.5.0 > This removes the header split and supporting code from the driver. You did this because the datasheet says the header split feature is not supported and using it gives unpredictable results? -- Andre From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 08:51:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B12DDA6; Sat, 1 Dec 2012 08:51:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8048F8FC08; Sat, 1 Dec 2012 08:51:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB18peX3067078; Sat, 1 Dec 2012 08:51:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB18pea1067077; Sat, 1 Dec 2012 08:51:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212010851.qB18pea1067077@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 1 Dec 2012 08:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243745 - head/sys/security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 08:51:40 -0000 Author: pjd Date: Sat Dec 1 08:51:40 2012 New Revision: 243745 URL: http://svnweb.freebsd.org/changeset/base/243745 Log: IFp4 @219811: VFS is now fully MPSAFE, fix compilation. Modified: head/sys/security/audit/audit_bsm_klib.c Modified: head/sys/security/audit/audit_bsm_klib.c ============================================================================== --- head/sys/security/audit/audit_bsm_klib.c Sat Dec 1 05:07:49 2012 (r243744) +++ head/sys/security/audit/audit_bsm_klib.c Sat Dec 1 08:51:40 2012 (r243745) @@ -468,7 +468,7 @@ audit_canon_path(struct thread *td, int char *rbuf, *fbuf, *copy; struct filedesc *fdp; struct sbuf sbf; - int error, needslash, vfslocked; + int error, needslash; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s: at %s:%d", __func__, __FILE__, __LINE__); @@ -504,9 +504,7 @@ audit_canon_path(struct thread *td, int return; } vhold(cvnp); - vfslocked = VFS_LOCK_GIANT(cvnp->v_mount); vrele(cvnp); - VFS_UNLOCK_GIANT(vfslocked); } needslash = (fdp->fd_rdir != cvnp); } else { From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 08:53:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F070AEC4; Sat, 1 Dec 2012 08:53:00 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7EB6A8FC14; Sat, 1 Dec 2012 08:52:59 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id je9so591533bkc.13 for ; Sat, 01 Dec 2012 00:52:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GA5Bj+t0CJ/sU59TOjjJFr0yM5/R9fVjgtHHIaQHufI=; b=Jp58U62652WDMQvLhVLVQYYgVQ4/sEi7L95QvEsuq2StHOEi7TqtwNjKnCINSwOnP9 BVGWK1NcF+B8dl6hi3aw2fN0USBBHC6Ypsg6Tcdhuxc3UmpLtDMqFIzjyHHracFZKF6F STOFoCpNclh6csCP+JBsfElx9SMd4MPv3G6ugxuZ4tz9Y41U3QAEtWHinXi2pH4s3AsT 0+YDK/eZ1iEI4VDR1iYY7a0ul9njYsKpowwZax85O4bgMG/KyimB8A8Mf3vCuwagov0Z BexBU0xz5PTm1yLZFtLFJmlg2XUja1HOwvTMlwadt0r5DKJpmFc/Gi0GAxY0P/yySPfb 6xwA== MIME-Version: 1.0 Received: by 10.204.150.137 with SMTP id y9mr1148240bkv.103.1354351973100; Sat, 01 Dec 2012 00:52:53 -0800 (PST) Received: by 10.204.167.71 with HTTP; Sat, 1 Dec 2012 00:52:52 -0800 (PST) Received: by 10.204.167.71 with HTTP; Sat, 1 Dec 2012 00:52:52 -0800 (PST) In-Reply-To: <20121130144040.99559ed924a48b909cbd3c4b@FreeBSD.org> References: <201211260511.qAQ5B7DQ002346@svn.freebsd.org> <20121128170032.730be5fab68dba2a09aaa14e@FreeBSD.org> <20121128183422.714562856f27371c95d2a84e@FreeBSD.org> <20121129073846.GG97474@ithaqua.etoilebsd.net> <20121130144040.99559ed924a48b909cbd3c4b@FreeBSD.org> Date: Sat, 1 Dec 2012 08:52:52 +0000 Message-ID: Subject: Re: svn commit: r243554 - in head/usr.sbin/pkg_install: add create delete info lib updating version From: Chris Rees To: Stanislav Sedov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Eitan Adler , Baptiste Daroussin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 08:53:01 -0000 On 30 Nov 2012 22:41, "Stanislav Sedov" wrote: > > On Thu, 29 Nov 2012 08:38:47 +0100 > Baptiste Daroussin mentioned: > > > > > pkg is no more experimental at all, it is not perfect there are large rooms for > > improvements, but it is perfectly ready to be used, if you have any concern > > about some missing "feature" just report it; > > > > Concerning a landmine, when you have big flashy lights all over the place: > > http://lists.freebsd.org/pipermail/freebsd-ports-announce/2012-October/000032.html > > http://lists.freebsd.org/pipermail/freebsd-current/2012-October/037001.html > > a fanfare playing in front of it saying beware landsmine: > > http://svnweb.freebsd.org/ports?view=revision&revision=305637 > > and maps available all over the places to explains where the mine are how to > > workaround them, or be mine proof: > > http://svnweb.freebsd.org/ports/head/CHANGES (entry 20121010) > > http://svnweb.freebsd.org/ports/head/UPDATING (entry 20121010) > > > > I'd say in that case it is no more considered as a landmine but just a new safe > > way. > > It is a new way forced on users. I didn't ask to use pkgng on my system, neither > I got any warning when it silently stopped creating entries in /var/db/pkg. Do > you expect all users to read UPDATING and/or svn commit logs each time they update? UPDATING, yes. Also as I reminded you in IRC last week, users of -CURRENT are expected to follow -current@. Users of ports are also strongly recommended to read -ports-announce. > Switching to pkgng was not a community descision, it was a decision made by a small > group of people (alledgedly, considering input from the community). Personally, > I don't see why it should be that way, and why the default had to be forceably > changed. It is an open question (at least for me) whether pkgng is any better > than the old tools, and there is at least on drawback in using pkgng, namely sqlite > database, which will make you lose all packages in the case of a small fs corruption. > That problem was raised before numerous times starting when developing a new pkg > tool was proposed. But it is a design decision, and I respect it. What I don't > like is that the switch to the new pkg system lacks any legitemacy, as it was largely > a portmgr descision. If instead you ran it alongside for some time and it ended up > being used by majority of users compared to the legacy pkg, and then pulled the switch, > then it'd a different story. > > The bottom line is that I ended up with a corrupted pkg database for no particular > reason. And it didn't have to be that way. What are you trying to achieve here? You discussed this previously, and got exactly the same answer. There were extensive discussions over it in ports@. You got burned because you weren't paying attention. Get over it. Chris From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 08:59:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC35B9F; Sat, 1 Dec 2012 08:59:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 917748FC08; Sat, 1 Dec 2012 08:59:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB18xaww068491; Sat, 1 Dec 2012 08:59:36 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB18xa9u068490; Sat, 1 Dec 2012 08:59:36 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201212010859.qB18xa9u068490@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 1 Dec 2012 08:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243746 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 08:59:36 -0000 Author: pjd Date: Sat Dec 1 08:59:36 2012 New Revision: 243746 URL: http://svnweb.freebsd.org/changeset/base/243746 Log: Fix one more compilation issue. Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sat Dec 1 08:51:40 2012 (r243745) +++ head/sys/kern/vfs_lookup.c Sat Dec 1 08:59:36 2012 (r243746) @@ -211,9 +211,9 @@ namei(struct nameidata *ndp) * If we are auditing the kernel pathname, save the user pathname. */ if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG_UPATH1(td, ndp->ni_dirfd, , cnp->cn_pnbuf); + AUDIT_ARG_UPATH1(td, ndp->ni_dirfd, cnp->cn_pnbuf); if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG_UPATH2(td, ndp->ni_dirfd, , cnp->cn_pnbuf); + AUDIT_ARG_UPATH2(td, ndp->ni_dirfd, cnp->cn_pnbuf); dp = NULL; if (cnp->cn_pnbuf[0] != '/') { From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 09:48:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCDBD79C; Sat, 1 Dec 2012 09:48:49 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2E5EB8FC12; Sat, 1 Dec 2012 09:48:48 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so341835vba.13 for ; Sat, 01 Dec 2012 01:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=G9nGLg49LDLGywuvstQ3FyFLWnGKxTxh/11NsbXme60=; b=eQHleEJIee+D8aAKXu+mndg2rApm5kqAVDuI71X7gFJlSgXYCc1ZpwL371gCaI/U8M d65Kht6CUIrIVdOlDPkmWnXHX5ZWY5tRfd0tTJ8CqU+cZMI78WV+4E0xf0s3ToduxEpS 08JKGfNdE27GFCc0otfrWzncFvYAbl4OBR27oPikIeAl0KMY8UR0jp9ycExYR2uR664y ye2/PPZ8ZgzJatUxTNRBzRKfCZntf5nAp7jaWD4Mhz2Lim/5T4FZXOPo8tR7k/G1sEKz aBvi7nWGEwyJR5ycF4LG+8fqZhPVpeoeVxnWJU70C4yJq+JFlGs0Po69tRkljBjxtLne 85ZQ== MIME-Version: 1.0 Received: by 10.220.153.201 with SMTP id l9mr3373949vcw.33.1354355322134; Sat, 01 Dec 2012 01:48:42 -0800 (PST) Received: by 10.220.50.6 with HTTP; Sat, 1 Dec 2012 01:48:41 -0800 (PST) In-Reply-To: <50B9C291.4030107@freebsd.org> References: <201211302219.qAUMJIkI065470@svn.freebsd.org> <50B9C291.4030107@freebsd.org> Date: Sat, 1 Dec 2012 01:48:41 -0800 Message-ID: Subject: Re: svn commit: r243714 - in head/sys/dev: ixgbe netmap From: Jack Vogel To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 09:48:50 -0000 On Sat, Dec 1, 2012 at 12:40 AM, Andre Oppermann wrote: > On 30.11.2012 23:19, Jack F Vogel wrote: > >> Author: jfv >> Date: Fri Nov 30 22:19:18 2012 >> New Revision: 243714 >> URL: http://svnweb.freebsd.org/**changeset/base/243714 >> >> Log: >> First of a series of 11 patches leading to new ixgbe version 2.5.0 >> This removes the header split and supporting code from the driver. >> > > You did this because the datasheet says the header split feature is > not supported and using it gives unpredictable results? > I'm not sure what the datasheet says, but yes there is a hardware issue on some of the 10G adapters if using header split. I have left the code in in a disabled state for a long time, thinking it would be there as example code, but I think it best to remove it and simplify the code at this point. Oh, and yes, results have always been mixed with the feature in my experience anyway. Regards, Jack From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 10:23:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7FFAA81 for ; Sat, 1 Dec 2012 10:23:16 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 420068FC0C for ; Sat, 1 Dec 2012 10:23:15 +0000 (UTC) Received: (qmail 78104 invoked from network); 1 Dec 2012 11:54:11 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 1 Dec 2012 11:54:11 -0000 Message-ID: <50B9DA84.8070701@freebsd.org> Date: Sat, 01 Dec 2012 11:23:00 +0100 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Jack Vogel Subject: Re: svn commit: r243714 - in head/sys/dev: ixgbe netmap References: <201211302219.qAUMJIkI065470@svn.freebsd.org> <50B9C291.4030107@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 10:23:16 -0000 On 01.12.2012 10:48, Jack Vogel wrote: > > > On Sat, Dec 1, 2012 at 12:40 AM, Andre Oppermann > wrote: > > On 30.11.2012 23:19, Jack F Vogel wrote: > > Author: jfv > Date: Fri Nov 30 22:19:18 2012 > New Revision: 243714 > URL: http://svnweb.freebsd.org/__changeset/base/243714 > > > Log: > First of a series of 11 patches leading to new ixgbe version 2.5.0 > This removes the header split and supporting code from the driver. > > > You did this because the datasheet says the header split feature is > not supported and using it gives unpredictable results? > > > I'm not sure what the datasheet says, but yes there is a hardware issue > on some of the 10G adapters if using header split. I have left the code in > in a disabled state for a long time, thinking it would be there as example > code, but I think it best to remove it and simplify the code at this point. It says so in section 7.1.10 Header Splitting: Note: Header Splitting mode might cause unpredictable behavior and should not be used with the 82599. For more information, see the product specification update errata on this subject. > Oh, and yes, results have always been mixed with the feature in my > experience anyway. I can imagine. Considering how we work with the packet through the stack and in the socket buffers there isn't much benefit from header splitting. -- Andre From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 11:58:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F327D35B; Sat, 1 Dec 2012 11:58:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D40D18FC08; Sat, 1 Dec 2012 11:58:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1Bw8h4003623; Sat, 1 Dec 2012 11:58:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1Bw8Uo003611; Sat, 1 Dec 2012 11:58:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212011158.qB1Bw8Uo003611@svn.freebsd.org> From: Robert Watson Date: Sat, 1 Dec 2012 11:58:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243750 - in head/contrib/openbsm: . bin bin/audit bin/auditd bin/auditdistd bin/auditfilterd bin/auditreduce bin/praudit bsm compat config etc libauditd libbsm m4 man modules modules/a... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 11:58:09 -0000 Author: rwatson Date: Sat Dec 1 11:58:08 2012 New Revision: 243750 URL: http://svnweb.freebsd.org/changeset/base/243750 Log: Merge OpenBSM 1.2-alpha2 from vendor branch to FreeBSD 10-CURRENT; the primary new feature is auditdistd. Obtained from: TrustedBSD Project Sponsored by: The FreeBSD Foundation (auditdistd) Added: head/contrib/openbsm/bin/auditdistd/ - copied from r243735, vendor/openbsm/dist/bin/auditdistd/ head/contrib/openbsm/compat/closefrom.h - copied unchanged from r243735, vendor/openbsm/dist/compat/closefrom.h head/contrib/openbsm/compat/compat.h - copied unchanged from r243735, vendor/openbsm/dist/compat/compat.h head/contrib/openbsm/compat/endian_enc.h - copied unchanged from r243735, vendor/openbsm/dist/compat/endian_enc.h head/contrib/openbsm/compat/flopen.h - copied unchanged from r243735, vendor/openbsm/dist/compat/flopen.h head/contrib/openbsm/compat/pidfile.h - copied unchanged from r243735, vendor/openbsm/dist/compat/pidfile.h head/contrib/openbsm/compat/vis.h - copied unchanged from r243735, vendor/openbsm/dist/compat/vis.h head/contrib/openbsm/config/ylwrap - copied unchanged from r243735, vendor/openbsm/dist/config/ylwrap head/contrib/openbsm/m4/ - copied from r243735, vendor/openbsm/dist/m4/ Modified: head/contrib/openbsm/CREDITS head/contrib/openbsm/INSTALL head/contrib/openbsm/LICENSE head/contrib/openbsm/Makefile.am head/contrib/openbsm/Makefile.in head/contrib/openbsm/NEWS head/contrib/openbsm/README head/contrib/openbsm/TODO head/contrib/openbsm/VERSION head/contrib/openbsm/aclocal.m4 head/contrib/openbsm/autogen.sh head/contrib/openbsm/bin/Makefile.am head/contrib/openbsm/bin/Makefile.in head/contrib/openbsm/bin/audit/Makefile.am head/contrib/openbsm/bin/audit/Makefile.in head/contrib/openbsm/bin/audit/audit.8 head/contrib/openbsm/bin/auditd/Makefile.am head/contrib/openbsm/bin/auditd/Makefile.in head/contrib/openbsm/bin/auditd/auditd.8 head/contrib/openbsm/bin/auditd/auditd.c head/contrib/openbsm/bin/auditfilterd/Makefile.am head/contrib/openbsm/bin/auditfilterd/Makefile.in head/contrib/openbsm/bin/auditreduce/Makefile.am head/contrib/openbsm/bin/auditreduce/Makefile.in head/contrib/openbsm/bin/auditreduce/auditreduce.1 head/contrib/openbsm/bin/praudit/Makefile.am head/contrib/openbsm/bin/praudit/Makefile.in head/contrib/openbsm/bin/praudit/praudit.1 head/contrib/openbsm/bin/praudit/praudit.c head/contrib/openbsm/bsm/Makefile.am head/contrib/openbsm/bsm/Makefile.in head/contrib/openbsm/bsm/auditd_lib.h head/contrib/openbsm/bsm/libbsm.h head/contrib/openbsm/compat/endian.h head/contrib/openbsm/config/config.h head/contrib/openbsm/config/config.h.in head/contrib/openbsm/config/ltmain.sh head/contrib/openbsm/configure head/contrib/openbsm/configure.ac head/contrib/openbsm/etc/audit_control head/contrib/openbsm/etc/audit_event head/contrib/openbsm/libauditd/Makefile.am head/contrib/openbsm/libauditd/Makefile.in head/contrib/openbsm/libauditd/auditd_lib.c head/contrib/openbsm/libbsm/Makefile.am head/contrib/openbsm/libbsm/Makefile.in head/contrib/openbsm/libbsm/au_control.3 head/contrib/openbsm/libbsm/au_fcntl_cmd.3 head/contrib/openbsm/libbsm/au_io.3 head/contrib/openbsm/libbsm/audit_submit.3 head/contrib/openbsm/libbsm/bsm_audit.c head/contrib/openbsm/libbsm/bsm_class.c head/contrib/openbsm/libbsm/bsm_control.c head/contrib/openbsm/libbsm/bsm_errno.c head/contrib/openbsm/libbsm/bsm_io.c head/contrib/openbsm/libbsm/bsm_token.c head/contrib/openbsm/libbsm/bsm_user.c head/contrib/openbsm/libbsm/bsm_wrappers.c head/contrib/openbsm/man/Makefile.am head/contrib/openbsm/man/Makefile.in head/contrib/openbsm/man/audit.log.5 head/contrib/openbsm/man/audit_control.5 head/contrib/openbsm/man/auditon.2 head/contrib/openbsm/man/getaudit.2 head/contrib/openbsm/man/setaudit.2 head/contrib/openbsm/modules/Makefile.am head/contrib/openbsm/modules/Makefile.in head/contrib/openbsm/modules/auditfilter_noop/Makefile.am head/contrib/openbsm/modules/auditfilter_noop/Makefile.in head/contrib/openbsm/sys/Makefile.am head/contrib/openbsm/sys/Makefile.in head/contrib/openbsm/sys/bsm/Makefile.am head/contrib/openbsm/sys/bsm/Makefile.in head/contrib/openbsm/sys/bsm/audit_errno.h head/contrib/openbsm/sys/bsm/audit_internal.h head/contrib/openbsm/sys/bsm/audit_kevents.h head/contrib/openbsm/test/Makefile.am head/contrib/openbsm/test/Makefile.in head/contrib/openbsm/test/bsm/Makefile.am head/contrib/openbsm/test/bsm/Makefile.in head/contrib/openbsm/tools/Makefile.am head/contrib/openbsm/tools/Makefile.in Directory Properties: head/contrib/openbsm/ (props changed) Modified: head/contrib/openbsm/CREDITS ============================================================================== --- head/contrib/openbsm/CREDITS Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/CREDITS Sat Dec 1 11:58:08 2012 (r243750) @@ -29,6 +29,12 @@ the development of OpenBSM: Stacey Son Todd Heberlein Gary Hoo + Dave Bertouille + Jonathan Anderson + Pawel Jakub Dawidek + Joel Dahl + Ryan Steinmetz + The FreeBSD Foundation In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the Modified: head/contrib/openbsm/INSTALL ============================================================================== --- head/contrib/openbsm/INSTALL Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/INSTALL Sat Dec 1 11:58:08 2012 (r243750) @@ -14,6 +14,12 @@ force the compile to fail if a warning i CFLAGS="-Wall -Werror" ./configure +On Linux systems, OpenSSL headers may have to be installed to support +encryption of on-the-wire audit streams using auditdistd; the following +appears to work on Ubuntu: + + sudo apt-get install libssl-dev + To install the library, binaries, and man pages, use: make install Modified: head/contrib/openbsm/LICENSE ============================================================================== --- head/contrib/openbsm/LICENSE Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/LICENSE Sat Dec 1 11:58:08 2012 (r243750) @@ -2,34 +2,37 @@ OpenBSM Copyrights and Licensing OpenBSM is covered by a number of copyrights, with licenses being either two or three clause BSD licenses. Individual file headers should be consulted -for specific copyrights on specific components. The TrustedBSD Project would -appreciate the contribution of fixes and enhancements under identical or -substantially similar licenses: - - * Copyright (c) - * All rights reserved. - * - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. +for copyrights on specific elements of the distribution. -$P4: //depot/projects/trustedbsd/openbsm/LICENSE#5 $ +The following copyright and license are asserted over the OpenBSM distribution +as a whole: + + Copyright (c) 2005-2012 Robert N.M. Watson + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +The TrustedBSD Project would appreciate the contribution of fixes and +enhancements under an identical license in order to avoid potentially +confusing license proliferation. + +$P4: //depot/projects/trustedbsd/openbsm/LICENSE#6 $ Modified: head/contrib/openbsm/Makefile.am ============================================================================== --- head/contrib/openbsm/Makefile.am Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/Makefile.am Sat Dec 1 11:58:08 2012 (r243750) @@ -1,6 +1,6 @@ -# -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#4 $ -# +## +## $P4: //depot/projects/trustedbsd/openbsm/Makefile.am#5 $ +## SUBDIRS = \ bsm @@ -17,6 +17,7 @@ SUBDIRS += \ modules \ sys +ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ CHANGELOG \ Modified: head/contrib/openbsm/Makefile.in ============================================================================== --- head/contrib/openbsm/Makefile.in Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/Makefile.in Sat Dec 1 11:58:08 2012 (r243750) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,14 +13,28 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - -# -# $P4: //depot/projects/trustedbsd/openbsm/Makefile.in#10 $ -# VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -40,10 +54,14 @@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/config/config.h.in \ - $(top_srcdir)/configure INSTALL NEWS TODO config/config.guess \ - config/config.sub config/depcomp config/install-sh \ - config/ltmain.sh config/missing + $(srcdir)/Makefile.in $(top_srcdir)/config/config.guess \ + $(top_srcdir)/config/config.h.in \ + $(top_srcdir)/config/config.sub \ + $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ + $(top_srcdir)/config/missing $(top_srcdir)/configure INSTALL \ + NEWS TODO config/config.guess config/config.sub config/depcomp \ + config/install-sh config/ltmain.sh config/missing \ + config/ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -53,6 +71,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -62,21 +81,61 @@ RECURSIVE_TARGETS = all-recursive check- install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + cscope distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = bsm libauditd libbsm bin man modules sys DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -90,45 +149,52 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MIG = @MIG@ MKDIR_P = @MKDIR_P@ +NM = @NM@ NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -137,13 +203,15 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -190,6 +258,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = bsm $(am__append_1) libbsm bin man modules sys +ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = \ CHANGELOG \ LICENSE \ @@ -200,21 +269,21 @@ EXTRA_DIST = \ all: all-recursive .SUFFIXES: -am--refresh: +am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -230,21 +299,20 @@ $(top_builddir)/config.status: $(top_src $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) + $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): config/config.h: config/stamp-h1 - @if test ! -f $@; then \ - rm -f config/stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) config/stamp-h1; \ - else :; fi + @if test ! -f $@; then rm -f config/stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) config/stamp-h1; else :; fi config/stamp-h1: $(top_srcdir)/config/config.h.in $(top_builddir)/config.status @rm -f config/stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config/config.h $(top_srcdir)/config/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f config/stamp-h1 touch $@ @@ -258,16 +326,16 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -rm -f libtool + -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ @@ -276,7 +344,11 @@ $(RECURSIVE_TARGETS): done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -284,50 +356,23 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -335,14 +380,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ @@ -354,7 +399,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -363,36 +408,65 @@ TAGS: tags-recursive $(HEADERS) $(SOURCE done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) + +clean-cscope: + -rm -f cscope.files + +cscope.files: clean-cscope cscopelist-recursive cscopelist + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) + test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -408,66 +482,84 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) + || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -475,26 +567,31 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -515,14 +612,24 @@ distcheck: dist && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ @@ -553,16 +660,22 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -583,6 +696,8 @@ dvi-am: html: html-recursive +html-am: + info: info-recursive info-am: @@ -591,18 +706,28 @@ install-data-am: install-dvi: install-dvi-recursive +install-dvi-am: + install-exec-am: install-html: install-html-recursive +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: install-pdf: install-pdf-recursive +install-pdf-am: + install-ps: install-ps-recursive +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -625,24 +750,27 @@ ps-am: uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \ + cscopelist-recursive ctags-recursive install-am install-strip \ + tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ - distclean distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am + all all-am am--refresh check check-am clean clean-cscope \ + clean-generic clean-libtool cscope cscopelist \ + cscopelist-recursive ctags ctags-recursive dist dist-all \ + dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Modified: head/contrib/openbsm/NEWS ============================================================================== --- head/contrib/openbsm/NEWS Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/NEWS Sat Dec 1 11:58:08 2012 (r243750) @@ -1,5 +1,30 @@ OpenBSM Version History +OpenBSM 1.2 alpha 2 + +- auditdistd, a distributed audit trail management daemon, has now been + merged. This allows trail files to be securely and reliably synced from + audited hosts to an audit server, and employs TLS encryption. Where + available, it uses Capsicum to sandbox the service. This work was + contributed by Pawel Jakub Dawidek under sponsorship from the FreeBSD + Foundation. + +OpenBSM 1.2 alpha 1 + +- Add Capsicum-related error numbers for FreeBSD: ENOTCAPABLE, ECAPMODE. +- Add Capsicum, process descriptor audit events for FreeBSD. +- Allow 0% minspace. +- Fixes from the clang static analyser. +- Fix expiration of trail files when the host parameter is used. +- Various typo fixes. +- Support for Solaris privilege and privilege set tokens. +- Documentation for getachost(), improvements for getacfilesz(). +- Fix a directory descriptor leak that happened when audit trail partitions + filled. +- Support for more Linux distributions with a partial contemporary endian.h. +- Improved escaping of XML-encapsulated BSM. +- A variety of minor documentation, style, and functional. + OpenBSM 1.1p2 - Fix audit_event definitions of AUE_OPENAT_RWT and AUE_OPENAT_RWTC. @@ -464,4 +489,4 @@ OpenBSM 1.0 alpha 1 to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/NEWS#43 $ +$P4: //depot/projects/trustedbsd/openbsm/NEWS#53 $ Modified: head/contrib/openbsm/README ============================================================================== --- head/contrib/openbsm/README Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/README Sat Dec 1 11:58:08 2012 (r243750) @@ -1,4 +1,4 @@ -OpenBSM 1.1p2 +OpenBSM 1.2a2 Introduction @@ -38,6 +38,7 @@ The following programs are included with audit Command line audit control tool auditd Audit management daemon + auditdistd Audit trail distribution daemon auditfilterd Experimental event monitoring framework auditreduce Audit trail reduction tool audump Debugging tool to parse and print audit databases @@ -64,4 +65,4 @@ Information on TrustedBSD may be found o http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#37 $ +$P4: //depot/projects/trustedbsd/openbsm/README#41 $ Modified: head/contrib/openbsm/TODO ============================================================================== --- head/contrib/openbsm/TODO Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/TODO Sat Dec 1 11:58:08 2012 (r243750) @@ -21,5 +21,7 @@ OpenBSM TODO alternative locations can be used. - NLS support for au_strerror(3), which provides error strings for BSM errors not available on the local OS platform. +- Support for client certificates in auditdistd, to include certificate chain + validation. -$P4: //depot/projects/trustedbsd/openbsm/TODO#13 $ +$P4: //depot/projects/trustedbsd/openbsm/TODO#14 $ Modified: head/contrib/openbsm/VERSION ============================================================================== --- head/contrib/openbsm/VERSION Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/VERSION Sat Dec 1 11:58:08 2012 (r243750) @@ -1 +1 @@ -OPENBSM_1_1p2 +OPENBSM_1_2alpha2 Modified: head/contrib/openbsm/aclocal.m4 ============================================================================== --- head/contrib/openbsm/aclocal.m4 Sat Dec 1 11:12:04 2012 (r243749) +++ head/contrib/openbsm/aclocal.m4 Sat Dec 1 11:58:08 2012 (r243750) @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10.1 -*- Autoconf -*- +# generated automatically by aclocal 1.12.2 -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,108 +13,206 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.62],, -[m4_warning([this file was generated for autoconf 2.62. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 13:46:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 24E888F0; Sat, 1 Dec 2012 13:46:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09F9B8FC08; Sat, 1 Dec 2012 13:46:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1DkbNw024451; Sat, 1 Dec 2012 13:46:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1Dkb8v024446; Sat, 1 Dec 2012 13:46:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212011346.qB1Dkb8v024446@svn.freebsd.org> From: Robert Watson Date: Sat, 1 Dec 2012 13:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243751 - in head/sys: bsm security/audit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 13:46:38 -0000 Author: rwatson Date: Sat Dec 1 13:46:37 2012 New Revision: 243751 URL: http://svnweb.freebsd.org/changeset/base/243751 Log: Merge OpenBSM 1.2-alpha2 changes from contrib/openbsm to src/sys/{bsm,security/audit}. There are a few tweaks to help with the FreeBSD build environment that will be merged back to OpenBSM. No significant functional changes appear on the kernel side. Obtained from: TrustedBSD Project Sponsored by: The FreeBSD Foundation (auditdistd) Modified: head/sys/bsm/audit_errno.h head/sys/bsm/audit_internal.h head/sys/bsm/audit_record.h head/sys/security/audit/audit_bsm_errno.c head/sys/security/audit/audit_bsm_token.c Modified: head/sys/bsm/audit_errno.h ============================================================================== --- head/sys/bsm/audit_errno.h Sat Dec 1 11:58:08 2012 (r243750) +++ head/sys/bsm/audit_errno.h Sat Dec 1 13:46:37 2012 (r243751) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#7 * $FreeBSD$ */ Modified: head/sys/bsm/audit_internal.h ============================================================================== --- head/sys/bsm/audit_internal.h Sat Dec 1 11:58:08 2012 (r243750) +++ head/sys/bsm/audit_internal.h Sat Dec 1 13:46:37 2012 (r243751) @@ -15,7 +15,7 @@ * 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. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#5 + * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#6 * $FreeBSD$ */ Modified: head/sys/bsm/audit_record.h ============================================================================== --- head/sys/bsm/audit_record.h Sat Dec 1 11:58:08 2012 (r243750) +++ head/sys/bsm/audit_record.h Sat Dec 1 13:46:37 2012 (r243751) @@ -234,6 +234,7 @@ token_t *au_to_ipc_perm(struct ipc_perm token_t *au_to_iport(uint16_t iport); token_t *au_to_opaque(const char *data, uint16_t bytes); token_t *au_to_path(const char *path); +token_t *au_to_privset(char *privtypestr, char *privstr); token_t *au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); token_t *au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, @@ -279,6 +280,7 @@ token_t *au_to_exec_env(char **envp); token_t *au_to_text(const char *text); token_t *au_to_kevent(struct kevent *kev); token_t *au_to_trailer(int rec_size); +token_t *au_to_upriv(char sorf, char *priv); token_t *au_to_zonename(const char *zonename); /* Modified: head/sys/security/audit/audit_bsm_errno.c ============================================================================== --- head/sys/security/audit/audit_bsm_errno.c Sat Dec 1 11:58:08 2012 (r243750) +++ head/sys/security/audit/audit_bsm_errno.c Sat Dec 1 13:46:37 2012 (r243751) @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#18 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#22 */ #include @@ -494,7 +494,7 @@ static const struct bsm_errno bsm_errnos #ifdef EPROCUNAVAIL EPROCUNAVAIL, #else - ERRNO_NO_LOCAL_MAPPING + ERRNO_NO_LOCAL_MAPPING, #endif ES("Bad procedure for program") }, { BSM_ERRNO_EFTYPE, @@ -666,7 +666,7 @@ static const struct bsm_errno bsm_errnos #endif ES("Required key not available") }, { BSM_ERRNO_EKEYEXPIRED, -#ifdef EKEEXPIRED +#ifdef EKEYEXPIRED EKEYEXPIRED, #else ERRNO_NO_LOCAL_MAPPING, @@ -680,7 +680,7 @@ static const struct bsm_errno bsm_errnos #endif ES("Key has been revoked") }, { BSM_ERRNO_EKEYREJECTED, -#ifdef EKEREJECTED +#ifdef EKEYREJECTED EKEYREJECTED, #else ERRNO_NO_LOCAL_MAPPING, Modified: head/sys/security/audit/audit_bsm_token.c ============================================================================== --- head/sys/security/audit/audit_bsm_token.c Sat Dec 1 11:58:08 2012 (r243750) +++ head/sys/security/audit/audit_bsm_token.c Sat Dec 1 13:46:37 2012 (r243751) @@ -30,7 +30,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#93 + * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#99 */ #include @@ -68,6 +68,57 @@ __FBSDID("$FreeBSD$"); /* * token ID 1 byte + * success/failure 1 byte + * privstrlen 2 bytes + * privstr N bytes + 1 (\0 byte) + */ +token_t * +au_to_upriv(char sorf, char *priv) +{ + u_int16_t textlen; + u_char *dptr; + token_t *t; + + textlen = strlen(priv) + 1; + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_char) + + sizeof(u_int16_t) + textlen); + + ADD_U_CHAR(dptr, AUT_UPRIV); + ADD_U_CHAR(dptr, sorf); + ADD_U_INT16(dptr, textlen); + ADD_STRING(dptr, priv, textlen); + return (t); +} + +/* + * token ID 1 byte + * privtstrlen 2 bytes + * privtstr N bytes + 1 + * privstrlen 2 bytes + * privstr N bytes + 1 + */ +token_t * +au_to_privset(char *privtypestr, char *privstr) +{ + u_int16_t type_len, priv_len; + u_char *dptr; + token_t *t; + + type_len = strlen(privtypestr) + 1; + priv_len = strlen(privstr) + 1; + GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + + sizeof(u_int16_t) + type_len + priv_len); + + ADD_U_CHAR(dptr, AUT_PRIV); + ADD_U_INT16(dptr, type_len); + ADD_STRING(dptr, privtypestr, type_len); + ADD_U_INT16(dptr, priv_len); + ADD_STRING(dptr, privstr, priv_len); + return (t); +} + +/* + * token ID 1 byte * argument # 1 byte * argument value 4 bytes/8 bytes (32-bit/64-bit value) * text length 2 bytes @@ -1204,9 +1255,9 @@ au_to_me(void) auinfo.ai_asid, &auinfo.ai_termid)); } else { /* getaudit_addr(2) failed for some other reason. */ - return (NULL); + return (NULL); } - } + } return (au_to_subject32_ex(aia.ai_auid, geteuid(), getegid(), getuid(), getgid(), getpid(), aia.ai_asid, &aia.ai_termid)); @@ -1438,7 +1489,7 @@ au_to_header32_ex_tm(int rec_size, au_ev ADD_U_INT32(dptr, tm.tv_sec); ADD_U_INT32(dptr, timems); /* We need time in ms. */ - return (t); + return (t); } token_t * From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 15:11:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D13D7F1; Sat, 1 Dec 2012 15:11:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 41DDF8FC12; Sat, 1 Dec 2012 15:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1FBlM8036826; Sat, 1 Dec 2012 15:11:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1FBkBA036816; Sat, 1 Dec 2012 15:11:46 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201212011511.qB1FBkBA036816@svn.freebsd.org> From: Robert Watson Date: Sat, 1 Dec 2012 15:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243752 - in head: etc etc/defaults etc/mail etc/mtree etc/rc.d share/man/man4 usr.sbin usr.sbin/auditdistd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 15:11:47 -0000 Author: rwatson Date: Sat Dec 1 15:11:46 2012 New Revision: 243752 URL: http://svnweb.freebsd.org/changeset/base/243752 Log: Merge a number of changes required to hook up OpenBSM 1.2-alpha2's auditdistd (distributed audit daemon) to the build: - Manual cross references - Makefile for auditdistd - rc.d script, rc.conf entrie - New group and user for auditdistd; associated aliases, etc. The audit trail distribution daemon provides reliable, cryptographically protected (and sandboxed) delivery of audit tails from live clients to audit server hosts in order to both allow centralised analysis, and improve resilience in the event of client compromises: clients are not permitted to change trail contents after submission. Submitted by: pjd Sponsored by: The FreeBSD Foundation (auditdistd) Added: head/etc/rc.d/auditdistd (contents, props changed) head/usr.sbin/auditdistd/ head/usr.sbin/auditdistd/Makefile (contents, props changed) Modified: head/etc/defaults/rc.conf head/etc/ftpusers head/etc/mail/aliases head/etc/master.passwd head/etc/mtree/BSD.var.dist head/etc/rc.d/Makefile head/share/man/man4/audit.4 head/usr.sbin/Makefile Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/defaults/rc.conf Sat Dec 1 15:11:46 2012 (r243752) @@ -590,6 +590,9 @@ sendmail_rebuild_aliases="NO" # Run newa auditd_enable="NO" # Run the audit daemon. auditd_program="/usr/sbin/auditd" # Path to the audit daemon. auditd_flags="" # Which options to pass to the audit daemon. +auditdistd_enable="NO" # Run the audit daemon. +auditdistd_program="/usr/sbin/auditdistd" # Path to the auditdistd daemon. +auditdistd_flags="" # Which options to pass to the auditdistd daemon. cron_enable="YES" # Run the periodic job daemon. cron_program="/usr/sbin/cron" # Which cron executable to run (if enabled). cron_dst="YES" # Handle DST transitions intelligently (YES/NO) Modified: head/etc/ftpusers ============================================================================== --- head/etc/ftpusers Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/ftpusers Sat Dec 1 15:11:46 2012 (r243752) @@ -19,6 +19,7 @@ _pflogd _dhcp uucp pop +auditdistd www hast nobody Modified: head/etc/mail/aliases ============================================================================== --- head/etc/mail/aliases Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/mail/aliases Sat Dec 1 15:11:46 2012 (r243752) @@ -26,6 +26,7 @@ postmaster: root # General redirections for pseudo accounts _dhcp: root _pflogd: root +auditdistd: root bin: root bind: root daemon: root Modified: head/etc/master.passwd ============================================================================== --- head/etc/master.passwd Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/master.passwd Sat Dec 1 15:11:46 2012 (r243752) @@ -20,6 +20,7 @@ _pflogd:*:64:64::0:0:pflogd privsep user _dhcp:*:65:65::0:0:dhcp programs:/var/empty:/usr/sbin/nologin uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin +auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin Modified: head/etc/mtree/BSD.var.dist ============================================================================== --- head/etc/mtree/BSD.var.dist Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/mtree/BSD.var.dist Sat Dec 1 15:11:46 2012 (r243752) @@ -19,6 +19,10 @@ /set gname=audit audit .. + dist uname=auditdistd gname=audit mode=0770 + .. + remote uname=auditdistd gname=wheel mode=0700 + .. /set gname=wheel backups .. Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Sat Dec 1 13:46:37 2012 (r243751) +++ head/etc/rc.d/Makefile Sat Dec 1 15:11:46 2012 (r243752) @@ -19,6 +19,7 @@ FILES= DAEMON \ atm2 \ atm3 \ auditd \ + auditdistd \ bgfsck \ bluetooth \ bootparams \ Added: head/etc/rc.d/auditdistd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/auditdistd Sat Dec 1 15:11:46 2012 (r243752) @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: auditdistd +# REQUIRE: auditd +# BEFORE: DAEMON +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="auditdistd" +rcvar="${name}_enable" +pidfile="/var/run/${name}.pid" +command="/usr/sbin/${name}" +required_files="/etc/${name}.conf" +extra_commands="reload" + +load_rc_config $name +run_rc_command "$1" Modified: head/share/man/man4/audit.4 ============================================================================== --- head/share/man/man4/audit.4 Sat Dec 1 13:46:37 2012 (r243751) +++ head/share/man/man4/audit.4 Sat Dec 1 15:11:46 2012 (r243752) @@ -96,7 +96,8 @@ to track users and events in a fine-grai .Xr audit_warn 5 , .Xr rc.conf 5 , .Xr audit 8 , -.Xr auditd 8 +.Xr auditd 8 , +.Xr auditdistd 8 .Sh HISTORY The .Tn OpenBSM Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sat Dec 1 13:46:37 2012 (r243751) +++ head/usr.sbin/Makefile Sat Dec 1 15:11:46 2012 (r243752) @@ -110,6 +110,9 @@ SUBDIR+= amd .if ${MK_AUDIT} != "no" SUBDIR+= audit SUBDIR+= auditd +.if ${MK_OPENSSL} != "no" +SUBDIR+= auditdistd +.endif SUBDIR+= auditreduce SUBDIR+= praudit .endif Added: head/usr.sbin/auditdistd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/auditdistd/Makefile Sat Dec 1 15:11:46 2012 (r243752) @@ -0,0 +1,32 @@ +# +# $FreeBSD$ +# + +OPENBSMDIR=${.CURDIR}/../../contrib/openbsm +.PATH: ${OPENBSMDIR}/bin/auditdistd + +# Addition of auditdistd because otherwise generated parse.c can't find +# auditdistd.h. This seems like a makefile non-feature. +CFLAGS+=-I${OPENBSMDIR} -I${OPENBSMDIR}/bin/auditdistd + +NO_WFORMAT= + +PROG= auditdistd +SRCS= auditdistd.c +SRCS+= parse.y pjdlog.c +SRCS+= proto.c proto_common.c proto_socketpair.c proto_tcp.c proto_tls.c +SRCS+= receiver.c +SRCS+= sandbox.c sender.c subr.c +SRCS+= token.l trail.c +MAN= auditdistd.8 auditdistd.conf.5 + +DPADD= ${LIBL} ${LIBPTHREAD} ${LIBUTIL} +LDADD= -ll -lpthread -lutil +DPADD+= ${LIBCRYPTO} ${LIBSSL} +LDADD+= -lcrypto -lssl + +YFLAGS+=-v + +CLEANFILES=parse.c parse.h parse.output + +.include From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 15:25:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 71787A46; Sat, 1 Dec 2012 15:25:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 563588FC08; Sat, 1 Dec 2012 15:25:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1FPgYA038658; Sat, 1 Dec 2012 15:25:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1FPgQT038657; Sat, 1 Dec 2012 15:25:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212011525.qB1FPgQT038657@svn.freebsd.org> From: Eitan Adler Date: Sat, 1 Dec 2012 15:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243753 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 15:25:42 -0000 Author: eadler Date: Sat Dec 1 15:25:41 2012 New Revision: 243753 URL: http://svnweb.freebsd.org/changeset/base/243753 Log: The getline function returns the number of characters read, not written. Use clearer text for this. PR: docs/174023 Submitted by: Paul Procacci Approved by: bcr (mentor) MFC after: 1 week Modified: head/lib/libc/stdio/getline.3 Modified: head/lib/libc/stdio/getline.3 ============================================================================== --- head/lib/libc/stdio/getline.3 Sat Dec 1 15:11:46 2012 (r243752) +++ head/lib/libc/stdio/getline.3 Sat Dec 1 15:25:41 2012 (r243753) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2010 +.Dd November 30, 2012 .Dt GETLINE 3 .Os .Sh NAME @@ -76,7 +76,7 @@ The .Fn getdelim and .Fn getline -functions return the number of characters written, excluding the +functions return the number of characters stored in the buffer, excluding the terminating .Dv NUL character. From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 17:44:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F759AB2; Sat, 1 Dec 2012 17:44:07 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 244858FC22; Sat, 1 Dec 2012 17:44:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1Hi7aO058736; Sat, 1 Dec 2012 17:44:07 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1Hi7mD058735; Sat, 1 Dec 2012 17:44:07 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201212011744.qB1Hi7mD058735@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 1 Dec 2012 17:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243758 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 17:44:07 -0000 Author: marcel Date: Sat Dec 1 17:44:06 2012 New Revision: 243758 URL: http://svnweb.freebsd.org/changeset/base/243758 Log: In globextend() when the pathv vector cannot be (re-)allocated, don't free and clear the gl_pathv pointer in the glob_t structure. Such breaks the invariant of the glob_t structure, as stated in the comment right in front of the globextend() function. If gl_pathv was non-NULL, then gl_pathc was > 0. Making gl_pathv a NULL pointer without also setting gl_pathc to 0 is wrong. Since we otherwise don't free the memory associated with a glob_t in error cases, it's unlikely that this change will cause a memory leak that wasn't already there to begin with. Callers of glob(3) must call globfree(3) irrespective of whether glob(3) returned an error or not. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sat Dec 1 16:44:33 2012 (r243757) +++ head/lib/libc/gen/glob.c Sat Dec 1 17:44:06 2012 (r243758) @@ -718,13 +718,8 @@ globextend(const Char *path, glob_t *pgl pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) : malloc(newsize); - if (pathv == NULL) { - if (pglob->gl_pathv) { - free(pglob->gl_pathv); - pglob->gl_pathv = NULL; - } + if (pathv == NULL) return (GLOB_NOSPACE); - } if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { /* first time around -- clear initial gl_offs items */ From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 17:50:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C460AC46; Sat, 1 Dec 2012 17:50:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A83C38FC19; Sat, 1 Dec 2012 17:50:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1HodCW059718; Sat, 1 Dec 2012 17:50:39 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1HodxR059717; Sat, 1 Dec 2012 17:50:39 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201212011750.qB1HodxR059717@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 1 Dec 2012 17:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243759 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 17:50:39 -0000 Author: marcel Date: Sat Dec 1 17:50:39 2012 New Revision: 243759 URL: http://svnweb.freebsd.org/changeset/base/243759 Log: In globextend(), take advantage of the fact that realloc(NULL, size) is equivalent to malloc(size). This eliminates the conditional expression used for calling either realloc() or malloc() when realloc() will do all the time. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sat Dec 1 17:44:06 2012 (r243758) +++ head/lib/libc/gen/glob.c Sat Dec 1 17:50:39 2012 (r243759) @@ -715,9 +715,8 @@ globextend(const Char *path, glob_t *pgl } newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); - pathv = pglob->gl_pathv ? - realloc((char *)pglob->gl_pathv, newsize) : - malloc(newsize); + /* realloc(NULL, newsize) is equivalent to malloc(newsize). */ + pathv = realloc((void *)pglob->gl_pathv, newsize); if (pathv == NULL) return (GLOB_NOSPACE); From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 18:01:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29CE4E4D; Sat, 1 Dec 2012 18:01:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id EF6AB8FC08; Sat, 1 Dec 2012 18:01:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1I1150061414; Sat, 1 Dec 2012 18:01:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1I11qN061413; Sat, 1 Dec 2012 18:01:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212011801.qB1I11qN061413@svn.freebsd.org> From: Andriy Gapon Date: Sat, 1 Dec 2012 18:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243760 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 18:01:02 -0000 Author: avg Date: Sat Dec 1 18:01:01 2012 New Revision: 243760 URL: http://svnweb.freebsd.org/changeset/base/243760 Log: acpi_cpu: change cpu_disable_idle to be a per-cpu flag... and make it safe to manipulate and check the flag With help from: jhb Tested by: trociny, emaste, dumbbell MFC after: 1 week Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Sat Dec 1 17:50:39 2012 (r243759) +++ head/sys/dev/acpica/acpi_cpu.c Sat Dec 1 18:01:01 2012 (r243760) @@ -92,6 +92,7 @@ struct acpi_cpu_softc { struct sysctl_oid *cpu_sysctl_tree; int cpu_cx_lowest; int cpu_cx_lowest_lim; + int cpu_disable_idle; /* Disable entry to idle function */ char cpu_cx_supported[64]; }; @@ -138,9 +139,6 @@ static uint32_t cpu_smi_cmd; /* Value static uint8_t cpu_cst_cnt; /* Indicate we are _CST aware. */ static int cpu_quirks; /* Indicate any hardware bugs. */ -/* Runtime state. */ -static int cpu_disable_idle; /* Disable entry to idle function */ - /* Values for sysctl. */ static struct sysctl_ctx_list cpu_sysctl_ctx; static struct sysctl_oid *cpu_sysctl_tree; @@ -419,6 +417,39 @@ acpi_cpu_postattach(void *unused __unuse SYSINIT(acpi_cpu, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, acpi_cpu_postattach, NULL); +static void +disable_idle(struct acpi_cpu_softc *sc) +{ + cpuset_t cpuset; + + CPU_SETOF(sc->cpu_pcpu->pc_cpuid, &cpuset); + sc->cpu_disable_idle = TRUE; + + /* + * Ensure that the CPU is not in idle state or in acpi_cpu_idle(). + * Note that this code depends on the fact that the rendezvous IPI + * can not penetrate context where interrupts are disabled and acpi_cpu_idle + * is called and executed in such a context with interrupts being re-enabled + * right before return. + */ + smp_rendezvous_cpus(cpuset, smp_no_rendevous_barrier, NULL, + smp_no_rendevous_barrier, NULL); +} + +static void +enable_idle(struct acpi_cpu_softc *sc) +{ + + sc->cpu_disable_idle = FALSE; +} + +static int +is_idle_disabled(struct acpi_cpu_softc *sc) +{ + + return (sc->cpu_disable_idle); +} + /* * Disable any entry to the idle function during suspend and re-enable it * during resume. @@ -431,7 +462,7 @@ acpi_cpu_suspend(device_t dev) error = bus_generic_suspend(dev); if (error) return (error); - cpu_disable_idle = TRUE; + disable_idle(device_get_softc(dev)); return (0); } @@ -439,7 +470,7 @@ static int acpi_cpu_resume(device_t dev) { - cpu_disable_idle = FALSE; + enable_idle(device_get_softc(dev)); return (bus_generic_resume(dev)); } @@ -573,12 +604,14 @@ acpi_cpu_shutdown(device_t dev) bus_generic_shutdown(dev); /* - * Disable any entry to the idle function. There is a small race where - * an idle thread have passed this check but not gone to sleep. This - * is ok since device_shutdown() does not free the softc, otherwise - * we'd have to be sure all threads were evicted before returning. + * Disable any entry to the idle function. + */ + disable_idle(device_get_softc(dev)); + + /* + * CPU devices are not truely detached and remain referenced, + * so their resources are not freed. */ - cpu_disable_idle = TRUE; return_VALUE (0); } @@ -860,7 +893,10 @@ acpi_cpu_startup(void *arg) /* Take over idling from cpu_idle_default(). */ cpu_cx_lowest_lim = 0; - cpu_disable_idle = FALSE; + for (i = 0; i < cpu_ndevices; i++) { + sc = device_get_softc(cpu_devices[i]); + enable_idle(sc); + } cpu_idle_hook = acpi_cpu_idle; } @@ -926,12 +962,6 @@ acpi_cpu_idle() uint32_t start_time, end_time; int bm_active, cx_next_idx, i; - /* If disabled, return immediately. */ - if (cpu_disable_idle) { - ACPI_ENABLE_IRQS(); - return; - } - /* * Look up our CPU id to get our softc. If it's NULL, we'll use C1 * since there is no ACPI processor object for this CPU. This occurs @@ -943,6 +973,12 @@ acpi_cpu_idle() return; } + /* If disabled, return immediately. */ + if (is_idle_disabled(sc)) { + ACPI_ENABLE_IRQS(); + return; + } + /* Find the lowest state that has small enough latency. */ cx_next_idx = 0; if (cpu_disable_deep_sleep) From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 18:06:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1125CA6; Sat, 1 Dec 2012 18:06:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CF1138FC0C; Sat, 1 Dec 2012 18:06:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1I65kS062472; Sat, 1 Dec 2012 18:06:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1I65EM062470; Sat, 1 Dec 2012 18:06:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212011806.qB1I65EM062470@svn.freebsd.org> From: Andriy Gapon Date: Sat, 1 Dec 2012 18:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243761 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 18:06:06 -0000 Author: avg Date: Sat Dec 1 18:06:05 2012 New Revision: 243761 URL: http://svnweb.freebsd.org/changeset/base/243761 Log: acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data ... to avoid any races or inconsistencies. This should fix a regression introduced in r243404. Also, remove a stale comment that has not been true for quite a while now. Pointyhat to: avg Teested by: trociny, emaste, dumbbell (earlier version) MFC after: 1 week Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Sat Dec 1 18:01:01 2012 (r243760) +++ head/sys/dev/acpica/acpi_cpu.c Sat Dec 1 18:06:05 2012 (r243761) @@ -973,9 +973,9 @@ acpi_cpu_idle() return; } - /* If disabled, return immediately. */ + /* If disabled, take the safe path. */ if (is_idle_disabled(sc)) { - ACPI_ENABLE_IRQS(); + acpi_cpu_c1(); return; } @@ -1081,23 +1081,31 @@ acpi_cpu_idle() /* * Re-evaluate the _CST object when we are notified that it changed. - * - * XXX Re-evaluation disabled until locking is done. */ static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context; - + if (notify != ACPI_NOTIFY_CX_STATES) return; + /* + * C-state data for target CPU is going to be in flux while we execute + * acpi_cpu_cx_cst, so disable entering acpi_cpu_idle. + * Also, it may happen that multiple ACPI taskqueues may concurrently + * execute notifications for the same CPU. ACPI_SERIAL is used to + * protect against that. + */ + ACPI_SERIAL_BEGIN(cpu); + disable_idle(sc); + /* Update the list of Cx states. */ acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); - - ACPI_SERIAL_BEGIN(cpu); acpi_cpu_set_cx_lowest(sc); + + enable_idle(sc); ACPI_SERIAL_END(cpu); acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify); From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 18:12:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 219BB240; Sat, 1 Dec 2012 18:12:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E17F78FC14; Sat, 1 Dec 2012 18:12:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1ICtP1063720; Sat, 1 Dec 2012 18:12:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1ICt7O063719; Sat, 1 Dec 2012 18:12:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212011812.qB1ICt7O063719@svn.freebsd.org> From: Andriy Gapon Date: Sat, 1 Dec 2012 18:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243762 - head/sys/cddl/contrib/opensolaris/uts/common/fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 18:12:56 -0000 Author: avg Date: Sat Dec 1 18:12:55 2012 New Revision: 243762 URL: http://svnweb.freebsd.org/changeset/base/243762 Log: gfs_file_inactive: replace bad code with ugly code Also, make it explicit that V_XATTRDIR is not properly supported in gfs code yet. The bad code was plain incorrect: (a) it spoiled handling of v_usecount reaching zero and (b) it leaked v_holdcnt. The ugly code employs potentially unsafe locking tricks. Ideally we should separate vnode lifecycle and gfs node lifecycle. A gfs node should have its own reference count where its child nodes should be accounted. PR: kern/151111 Reviewed by: kib MFC after: 13 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Dec 1 18:06:05 2012 (r243761) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Dec 1 18:12:55 2012 (r243762) @@ -665,8 +665,10 @@ gfs_file_inactive(vnode_t *vp) ge = NULL; found: +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_LOCK(fp->gfs_parent); +#endif VI_LOCK(vp); /* * Really remove this vnode @@ -687,16 +689,17 @@ found: if (fp->gfs_parent) { if (dp) gfs_dir_unlock(dp); - VI_LOCK(fp->gfs_parent); - fp->gfs_parent->v_usecount--; - VI_UNLOCK(fp->gfs_parent); + VOP_UNLOCK(vp, 0); + VN_RELE(fp->gfs_parent); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); } else { ASSERT(vp->v_vfsp != NULL); VFS_RELE(vp->v_vfsp); } +#ifdef TODO if (vp->v_flag & V_XATTRDIR) VI_UNLOCK(fp->gfs_parent); - +#endif return (data); } From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 18:13:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 491C7363; Sat, 1 Dec 2012 18:13:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2DDAF8FC08; Sat, 1 Dec 2012 18:13:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1IDsdP063888; Sat, 1 Dec 2012 18:13:54 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1IDs4l063887; Sat, 1 Dec 2012 18:13:54 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212011813.qB1IDs4l063887@svn.freebsd.org> From: Andriy Gapon Date: Sat, 1 Dec 2012 18:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243763 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 18:13:54 -0000 Author: avg Date: Sat Dec 1 18:13:53 2012 New Revision: 243763 URL: http://svnweb.freebsd.org/changeset/base/243763 Log: zfs_getpages: make use of vm_page_readahead_finish Suggested by: kib MFC after: 5 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 1 18:12:55 2012 (r243762) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 1 18:13:53 2012 (r243763) @@ -5675,27 +5675,11 @@ zfs_getpages(struct vnode *vp, vm_page_t VM_OBJECT_LOCK(object); for (i = reqstart; i < reqstart + reqsize; i++) { - m[i]->valid = VM_PAGE_BITS_ALL; + if (!error) + m[i]->valid = VM_PAGE_BITS_ALL; KASSERT(m[i]->dirty == 0, ("zfs_getpages: page %p is dirty", m[i])); - if (i != reqpage) { - if (!error) { - if (m[i]->oflags & VPO_WANTED) { - vm_page_lock(m[i]); - vm_page_activate(m[i]); - vm_page_unlock(m[i]); - } else { - vm_page_lock(m[i]); - vm_page_deactivate(m[i]); - vm_page_unlock(m[i]); - } - vm_page_wakeup(m[i]); - } else { - vm_page_lock(m[i]); - vm_page_free(m[i]); - vm_page_unlock(m[i]); - } - } - + if (i != reqpage) + vm_page_readahead_finish(m[i]); } VM_OBJECT_UNLOCK(object); From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 18:16:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C27CA4D1; Sat, 1 Dec 2012 18:16:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8EFC68FC14; Sat, 1 Dec 2012 18:16:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1IGE2l064319; Sat, 1 Dec 2012 18:16:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1IGE2Y064317; Sat, 1 Dec 2012 18:16:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201212011816.qB1IGE2Y064317@svn.freebsd.org> From: Andriy Gapon Date: Sat, 1 Dec 2012 18:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243764 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 18:16:14 -0000 Author: avg Date: Sat Dec 1 18:16:14 2012 New Revision: 243764 URL: http://svnweb.freebsd.org/changeset/base/243764 Log: ioapic_program_intpin: program high bits before low bits Programming the low bits has a side-effect if unmasking the pin if it is not disabled. So if an interrupt was pending then it would be delivered with the correct new vector but to the incorrect old LAPIC. This fix could be made clearer by preserving the mask bit while programming the low bits and then explicitly resetting the mask bit after all the programming is done. Probability to trip over the fixed bug could be increased by bootverbose because printing of the interrupt information in ioapic_assign_cpu lengthened the time window during which an interrupt could arrive while a pin is masked. Reported by: Andreas Longwitz Tested by: Andreas Longwitz MFC after: 12 days Modified: head/sys/x86/x86/io_apic.c Modified: head/sys/x86/x86/io_apic.c ============================================================================== --- head/sys/x86/x86/io_apic.c Sat Dec 1 18:13:53 2012 (r243763) +++ head/sys/x86/x86/io_apic.c Sat Dec 1 18:16:14 2012 (r243764) @@ -311,12 +311,12 @@ ioapic_program_intpin(struct ioapic_ints } /* Write the values to the APIC. */ - intpin->io_lowreg = low; - ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low); value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin)); value &= ~IOART_DEST; value |= high; ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value); + intpin->io_lowreg = low; + ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low); } static int From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 21:26:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CC5EB5F7; Sat, 1 Dec 2012 21:26:46 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 98FC48FC08; Sat, 1 Dec 2012 21:26:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1LQkXj098233; Sat, 1 Dec 2012 21:26:46 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1LQkjo098232; Sat, 1 Dec 2012 21:26:46 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201212012126.qB1LQkjo098232@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 1 Dec 2012 21:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243779 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 21:26:47 -0000 Author: marcel Date: Sat Dec 1 21:26:46 2012 New Revision: 243779 URL: http://svnweb.freebsd.org/changeset/base/243779 Log: Protect against DoS attacks, such as being described in CVE-2010-2632. The changes were derived from what has been committed to NetBSD, with modifications. These are: 1. Preserve the existsing GLOB_LIMIT behaviour by including the number of matches to the set of parameters to limit. 2. Change some of the limits to avoid impacting normal use cases: GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3) can still provide a full command line of expanded names. GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than that 128 feels too low (it's not a limit that impacts the behaviour of the test program listed in CVE-2010-2632). GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can still provide a fill command line of expanded names. 3. Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we would otherwise overrun the buffer. This change also modifies the existing behaviour of glob(3) in case GLOB_LIMIT is specifies by limiting the *new* matches and not all matches. This is an important distinction when GLOB_APPEND is set or when the caller uses a non-zero gl_offs. Previously pre-existing matches or the value of gl_offs would be counted in the number of matches even though the man page states that glob(3) would return GLOB_NOSPACE when gl_matchc or more matches were found. The limits that cannot be circumvented are GLOB_LIMIT_STRING and GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3) again and with GLOB_APPEND set. The entire description above applies only when GLOB_LIMIT has been specified of course. No limits apply when this flag isn't set! Obtained from: Juniper Networks, Inc Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Sat Dec 1 19:24:27 2012 (r243778) +++ head/lib/libc/gen/glob.c Sat Dec 1 21:26:46 2012 (r243779) @@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$"); #include "collate.h" +/* + * glob(3) expansion limits. Stop the expansion if any of these limits + * is reached. This caps the runtime in the face of DoS attacks. See + * also CVE-2010-2632 + */ +#define GLOB_LIMIT_BRACE 128 /* number of brace calls */ +#define GLOB_LIMIT_PATH 65536 /* number of path elements */ +#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */ +#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */ +#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */ + +struct glob_limit { + size_t l_brace_cnt; + size_t l_path_lim; + size_t l_readdir_cnt; + size_t l_stat_cnt; + size_t l_string_cnt; +}; + #define DOLLAR '$' #define DOT '.' #define EOS '\0' @@ -153,15 +172,18 @@ static const Char *g_strchr(const Char * static Char *g_strcat(Char *, const Char *); #endif static int g_stat(Char *, struct stat *, glob_t *); -static int glob0(const Char *, glob_t *, size_t *); -static int glob1(Char *, glob_t *, size_t *); -static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *); -static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *); -static int globextend(const Char *, glob_t *, size_t *); -static const Char * +static int glob0(const Char *, glob_t *, struct glob_limit *); +static int glob1(Char *, glob_t *, struct glob_limit *); +static int glob2(Char *, Char *, Char *, Char *, glob_t *, + struct glob_limit *); +static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, + struct glob_limit *); +static int globextend(const Char *, glob_t *, struct glob_limit *); +static const Char * globtilde(const Char *, Char *, size_t, glob_t *); -static int globexp1(const Char *, glob_t *, size_t *); -static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *); +static int globexp1(const Char *, glob_t *, struct glob_limit *); +static int globexp2(const Char *, const Char *, glob_t *, int *, + struct glob_limit *); static int match(Char *, Char *, Char *); #ifdef DEBUG static void qprintf(const char *, Char *); @@ -171,8 +193,8 @@ int glob(const char * __restrict pattern, int flags, int (*errfunc)(const char *, int), glob_t * __restrict pglob) { + struct glob_limit limit = { 0, 0, 0, 0, 0 }; const char *patnext; - size_t limit; Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot; mbstate_t mbs; wchar_t wc; @@ -186,11 +208,10 @@ glob(const char * __restrict pattern, in pglob->gl_offs = 0; } if (flags & GLOB_LIMIT) { - limit = pglob->gl_matchc; - if (limit == 0) - limit = ARG_MAX; - } else - limit = 0; + limit.l_path_lim = pglob->gl_matchc; + if (limit.l_path_lim == 0) + limit.l_path_lim = GLOB_LIMIT_PATH; + } pglob->gl_flags = flags & ~GLOB_MAGCHAR; pglob->gl_errfunc = errfunc; pglob->gl_matchc = 0; @@ -243,11 +264,17 @@ glob(const char * __restrict pattern, in * characters */ static int -globexp1(const Char *pattern, glob_t *pglob, size_t *limit) +globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit) { const Char* ptr = pattern; int rv; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) { + errno = 0; + return (GLOB_NOSPACE); + } + /* Protect a single {}, for find(1), like csh */ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) return glob0(pattern, pglob, limit); @@ -266,7 +293,8 @@ globexp1(const Char *pattern, glob_t *pg * If it fails then it tries to glob the rest of the pattern and returns. */ static int -globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit) +globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, + struct glob_limit *limit) { int i; Char *lm, *ls; @@ -436,7 +464,7 @@ globtilde(const Char *pattern, Char *pat * if things went well, nonzero if errors occurred. */ static int -glob0(const Char *pattern, glob_t *pglob, size_t *limit) +glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit) { const Char *qpatnext; int err; @@ -529,7 +557,7 @@ compare(const void *p, const void *q) } static int -glob1(Char *pattern, glob_t *pglob, size_t *limit) +glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit) { Char pathbuf[MAXPATHLEN]; @@ -547,7 +575,7 @@ glob1(Char *pattern, glob_t *pglob, size */ static int glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern, - glob_t *pglob, size_t *limit) + glob_t *pglob, struct glob_limit *limit) { struct stat sb; Char *p, *q; @@ -563,6 +591,15 @@ glob2(Char *pathbuf, Char *pathend, Char if (g_lstat(pathbuf, &sb, pglob)) return (0); + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) { + errno = 0; + if (pathend + 1 > pathend_last) + return (GLOB_ABORTED); + *pathend++ = SEP; + *pathend = EOS; + return (GLOB_NOSPACE); + } if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || (S_ISLNK(sb.st_mode) && @@ -606,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char static int glob3(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern, Char *restpattern, - glob_t *pglob, size_t *limit) + glob_t *pglob, struct glob_limit *limit) { struct dirent *dp; DIR *dirp; @@ -652,6 +689,19 @@ glob3(Char *pathbuf, Char *pathend, Char size_t clen; mbstate_t mbs; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) { + errno = 0; + if (pathend + 1 > pathend_last) + err = GLOB_ABORTED; + else { + *pathend++ = SEP; + *pathend = EOS; + err = GLOB_NOSPACE; + } + break; + } + /* Initial DOT must be matched literally. */ if (dp->d_name[0] == DOT && *pattern != DOT) continue; @@ -702,14 +752,15 @@ glob3(Char *pathbuf, Char *pathend, Char * gl_pathv points to (gl_offs + gl_pathc + 1) items. */ static int -globextend(const Char *path, glob_t *pglob, size_t *limit) +globextend(const Char *path, glob_t *pglob, struct glob_limit *limit) { char **pathv; size_t i, newsize, len; char *copy; const Char *p; - if (*limit && pglob->gl_pathc > *limit) { + if ((pglob->gl_flags & GLOB_LIMIT) && + pglob->gl_matchc > limit->l_path_lim) { errno = 0; return (GLOB_NOSPACE); } @@ -731,6 +782,12 @@ globextend(const Char *path, glob_t *pgl for (p = path; *p++;) continue; len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */ + limit->l_string_cnt += len; + if ((pglob->gl_flags & GLOB_LIMIT) && + limit->l_string_cnt >= GLOB_LIMIT_STRING) { + errno = 0; + return (GLOB_NOSPACE); + } if ((copy = malloc(len)) != NULL) { if (g_Ctoc(path, copy, len)) { free(copy); From owner-svn-src-head@FreeBSD.ORG Sat Dec 1 22:13:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E0B645A; Sat, 1 Dec 2012 22:13:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F27348FC12; Sat, 1 Dec 2012 22:13:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qB1MDc0P006371; Sat, 1 Dec 2012 22:13:38 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qB1MDcWA006369; Sat, 1 Dec 2012 22:13:38 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201212012213.qB1MDcWA006369@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 1 Dec 2012 22:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243780 - 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.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 22:13:39 -0000 Author: hselasky Date: Sat Dec 1 22:13:38 2012 New Revision: 243780 URL: http://svnweb.freebsd.org/changeset/base/243780 Log: - Add support for Etron EJ168 USB 3.0 Host Controllers. This brand of controllers expects that the number of contexts specified in the input slot context points to an active endpoint context, else it refuses to operate. - Ring the correct doorbell when streams mode is used. - Wrap one or two long lines. Tested by: Markus Pfeiffer (DragonFlyBSD) MFC after: 1 week Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sat Dec 1 21:26:46 2012 (r243779) +++ head/sys/dev/usb/controller/xhci.c Sat Dec 1 22:13:38 2012 (r243780) @@ -2045,7 +2045,9 @@ xhci_configure_mask(struct usb_device *u struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); struct usb_page_search buf_inp; struct xhci_input_dev_ctx *pinp; + uint32_t temp; uint8_t index; + uint8_t x; index = udev->controller_slot_id; @@ -2060,6 +2062,24 @@ xhci_configure_mask(struct usb_device *u } else { xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx0, 0); xhci_ctx_set_le32(sc, &pinp->ctx_input.dwInCtx1, mask); + + /* find most significant set bit */ + for (x = 31; x != 1; x--) { + if (mask & (1 << x)) + break; + } + + /* adjust */ + x--; + + /* figure out maximum */ + if (x > sc->sc_hw.devs[index].context_num) { + sc->sc_hw.devs[index].context_num = x; + temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0); + temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31); + temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1); + xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp); + } } return (0); } @@ -2311,16 +2331,9 @@ xhci_configure_device(struct usb_device DPRINTF("Route=0x%08x\n", route); - temp = XHCI_SCTX_0_ROUTE_SET(route); - - switch (sc->sc_hw.devs[index].state) { - case XHCI_ST_CONFIGURED: - temp |= XHCI_SCTX_0_CTX_NUM_SET(XHCI_MAX_ENDPOINTS - 1); - break; - default: - temp |= XHCI_SCTX_0_CTX_NUM_SET(1); - break; - } + temp = XHCI_SCTX_0_ROUTE_SET(route) | + XHCI_SCTX_0_CTX_NUM_SET( + sc->sc_hw.devs[index].context_num + 1); switch (udev->speed) { case USB_SPEED_LOW: @@ -2464,8 +2477,9 @@ xhci_alloc_device_ext(struct usb_device if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? (2 * sizeof(struct xhci_input_dev_ctx)) : - sizeof(struct xhci_input_dev_ctx), XHCI_PAGE_SIZE)) + sizeof(struct xhci_input_dev_ctx), XHCI_PAGE_SIZE)) { goto error; + } pc = &sc->sc_hw.devs[index].endpoint_pc; pg = &sc->sc_hw.devs[index].endpoint_pg; @@ -2473,15 +2487,18 @@ xhci_alloc_device_ext(struct usb_device /* need to initialize the page cache */ pc->tag_parent = sc->sc_bus.dma_parent_tag; - if (usb_pc_alloc_mem(pc, pg, sizeof(struct xhci_dev_endpoint_trbs), XHCI_PAGE_SIZE)) + if (usb_pc_alloc_mem(pc, pg, + sizeof(struct xhci_dev_endpoint_trbs), XHCI_PAGE_SIZE)) { goto error; + } /* initialise all endpoint LINK TRBs */ for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) { /* lookup endpoint TRB ring */ - usbd_get_page(pc, (uintptr_t)&((struct xhci_dev_endpoint_trbs *)0)->trb[i][0], &buf_ep); + usbd_get_page(pc, (uintptr_t)& + ((struct xhci_dev_endpoint_trbs *)0)->trb[i][0], &buf_ep); /* get TRB pointer */ trb = buf_ep.buffer; @@ -2568,8 +2585,10 @@ xhci_endpoint_doorbell(struct usb_xfer * epno = XHCI_EPNO2EPID(epno); index = xfer->xroot->udev->controller_slot_id; - if (xfer->xroot->udev->flags.self_suspended == 0) - XWRITE4(sc, door, XHCI_DOORBELL(index), epno | XHCI_DB_SID_SET(0)); + if (xfer->xroot->udev->flags.self_suspended == 0) { + XWRITE4(sc, door, XHCI_DOORBELL(index), + epno | XHCI_DB_SID_SET(xfer->stream_id)); + } } static void @@ -3584,7 +3603,7 @@ xhci_configure_reset_endpoint(struct usb * endpoint context state diagram in the XHCI specification: */ - xhci_configure_mask(udev, 1U << epno, 0); + xhci_configure_mask(udev, (1U << epno) | 1U, 0); err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index); @@ -3858,6 +3877,7 @@ xhci_device_resume(struct usb_device *ud struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); uint8_t index; uint8_t n; + uint8_t p; DPRINTF("\n"); @@ -3873,8 +3893,12 @@ xhci_device_resume(struct usb_device *ud USB_BUS_LOCK(udev->bus); - for (n = 1; n != XHCI_MAX_ENDPOINTS; n++) - XWRITE4(sc, door, XHCI_DOORBELL(index), n | XHCI_DB_SID_SET(0)); + for (n = 1; n != XHCI_MAX_ENDPOINTS; n++) { + for (p = 0; p != XHCI_MAX_STREAMS; p++) { + XWRITE4(sc, door, XHCI_DOORBELL(index), + n | XHCI_DB_SID_SET(p)); + } + } USB_BUS_UNLOCK(udev->bus); @@ -3948,8 +3972,12 @@ xhci_device_state_change(struct usb_devi if (sc->sc_hw.devs[index].state == XHCI_ST_DEFAULT) break; + /* set default state */ sc->sc_hw.devs[index].state = XHCI_ST_DEFAULT; + /* reset number of contexts */ + sc->sc_hw.devs[index].context_num = 0; + err = xhci_cmd_reset_dev(sc, index); if (err != 0) { @@ -3976,11 +4004,15 @@ xhci_device_state_change(struct usb_devi if (sc->sc_hw.devs[index].state == XHCI_ST_CONFIGURED) break; + /* set configured state */ sc->sc_hw.devs[index].state = XHCI_ST_CONFIGURED; + /* reset number of contexts */ + sc->sc_hw.devs[index].context_num = 0; + usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); - xhci_configure_mask(udev, 1, 0); + xhci_configure_mask(udev, 3, 0); err = xhci_configure_device(udev); if (err != 0) { Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Sat Dec 1 21:26:46 2012 (r243779) +++ head/sys/dev/usb/controller/xhci.h Sat Dec 1 22:13:38 2012 (r243780) @@ -394,7 +394,7 @@ struct xhci_hw_dev { uint8_t state; uint8_t nports; uint8_t tt; - uint8_t reserved; + uint8_t context_num; }; struct xhci_hw_softc {