From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 10 07:24:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 398EE106564A; Sun, 10 Jun 2012 07:24:05 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22AAF8FC15; Sun, 10 Jun 2012 07:24:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7O5XT080186; Sun, 10 Jun 2012 07:24:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7O5Tr080183; Sun, 10 Jun 2012 07:24:05 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100724.q5A7O5Tr080183@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236838 - in stable/8/cddl/contrib/opensolaris: cmd/ztest lib/libzfs/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:24:05 -0000 Author: mm Date: Sun Jun 10 07:24:04 2012 New Revision: 236838 URL: http://svn.freebsd.org/changeset/base/236838 Log: MFC r236143, r236705: MFC r236143 [1]: Import illumos changeset 13571:a5771a96228c 1950 ztest backwards compatibility testing option MFC r236705 [2]: Import Illumos revision 13715:351036203e4b 2803 zfs get guid pretty-prints the output References: https://www.illumos.org/issues/1950 [1] https://www.illumos.org/issues/2803 [2] Obtained from: illumos (issue #1950 [1], #2803 [2]) Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:23:45 2012 (r236837) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:24:04 2012 (r236838) @@ -20,8 +20,9 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ /* @@ -51,7 +52,9 @@ * At random times, the child self-immolates with a SIGKILL. * This is the software equivalent of pulling the power cord. * The parent then runs the test again, using the existing - * storage pool, as many times as desired. + * storage pool, as many times as desired. If backwards compatability + * testing is enabled ztest will sometimes run the "older" version + * of ztest after a SIGKILL. * * (6) To verify that we don't have future leaks or temporal incursions, * many of the functional tests record the transaction group number @@ -68,9 +71,15 @@ * You can ask more more vdevs [-v], datasets [-d], or threads [-t] * to increase the pool capacity, fanout, and overall stress level. * - * The -N(okill) option will suppress kills, so each child runs to completion. - * This can be useful when you're trying to distinguish temporal incursions - * from plain old race conditions. + * Use the -k option to set the desired frequency of kills. + * + * When ztest invokes itself it passes all relevant information through a + * temporary file which is mmap-ed in the child process. This allows shared + * memory to survive the exec syscall. The ztest_shared_hdr_t struct is always + * stored at offset 0 of this file and contains information on the size and + * number of shared structures in the file. The information stored in this file + * must remain backwards compatible with older versions of ztest so that + * ztest can invoke them during backwards compatibility testing (-B). */ #include @@ -111,29 +120,82 @@ #include #include -static char cmdname[] = "ztest"; -static char *zopt_pool = cmdname; -static char *progname; - -static uint64_t zopt_vdevs = 5; -static uint64_t zopt_vdevtime; -static int zopt_ashift = SPA_MINBLOCKSHIFT; -static int zopt_mirrors = 2; -static int zopt_raidz = 4; -static int zopt_raidz_parity = 1; -static size_t zopt_vdev_size = SPA_MINDEVSIZE; -static int zopt_datasets = 7; -static int zopt_threads = 23; -static uint64_t zopt_passtime = 60; /* 60 seconds */ -static uint64_t zopt_killrate = 70; /* 70% kill rate */ -static int zopt_verbose = 0; -static int zopt_init = 1; -static char *zopt_dir = "/tmp"; -static uint64_t zopt_time = 300; /* 5 minutes */ -static uint64_t zopt_maxloops = 50; /* max loops during spa_freeze() */ +#define ZTEST_FD_DATA 3 +#define ZTEST_FD_RAND 4 + +typedef struct ztest_shared_hdr { + uint64_t zh_hdr_size; + uint64_t zh_opts_size; + uint64_t zh_size; + uint64_t zh_stats_size; + uint64_t zh_stats_count; + uint64_t zh_ds_size; + uint64_t zh_ds_count; +} ztest_shared_hdr_t; + +static ztest_shared_hdr_t *ztest_shared_hdr; + +typedef struct ztest_shared_opts { + char zo_pool[MAXNAMELEN]; + char zo_dir[MAXNAMELEN]; + char zo_alt_ztest[MAXNAMELEN]; + char zo_alt_libpath[MAXNAMELEN]; + uint64_t zo_vdevs; + uint64_t zo_vdevtime; + size_t zo_vdev_size; + int zo_ashift; + int zo_mirrors; + int zo_raidz; + int zo_raidz_parity; + int zo_datasets; + int zo_threads; + uint64_t zo_passtime; + uint64_t zo_killrate; + int zo_verbose; + int zo_init; + uint64_t zo_time; + uint64_t zo_maxloops; + uint64_t zo_metaslab_gang_bang; +} ztest_shared_opts_t; + +static const ztest_shared_opts_t ztest_opts_defaults = { + .zo_pool = { 'z', 't', 'e', 's', 't', '\0' }, + .zo_dir = { '/', 't', 'm', 'p', '\0' }, + .zo_alt_ztest = { '\0' }, + .zo_alt_libpath = { '\0' }, + .zo_vdevs = 5, + .zo_ashift = SPA_MINBLOCKSHIFT, + .zo_mirrors = 2, + .zo_raidz = 4, + .zo_raidz_parity = 1, + .zo_vdev_size = SPA_MINDEVSIZE, + .zo_datasets = 7, + .zo_threads = 23, + .zo_passtime = 60, /* 60 seconds */ + .zo_killrate = 70, /* 70% kill rate */ + .zo_verbose = 0, + .zo_init = 1, + .zo_time = 300, /* 5 minutes */ + .zo_maxloops = 50, /* max loops during spa_freeze() */ + .zo_metaslab_gang_bang = 32 << 10 +}; + +extern uint64_t metaslab_gang_bang; +extern uint64_t metaslab_df_alloc_threshold; + +static ztest_shared_opts_t *ztest_shared_opts; +static ztest_shared_opts_t ztest_opts; + +typedef struct ztest_shared_ds { + uint64_t zd_seq; +} ztest_shared_ds_t; + +static ztest_shared_ds_t *ztest_shared_ds; +#define ZTEST_GET_SHARED_DS(d) (&ztest_shared_ds[d]) #define BT_MAGIC 0x123456789abcdefULL -#define MAXFAULTS() (MAX(zs->zs_mirrors, 1) * (zopt_raidz_parity + 1) - 1) +#define MAXFAULTS() \ + (MAX(zs->zs_mirrors, 1) * (ztest_opts.zo_raidz_parity + 1) - 1) enum ztest_io_type { ZTEST_IO_WRITE_TAG, @@ -205,10 +267,10 @@ typedef struct ztest_od { * Per-dataset state. */ typedef struct ztest_ds { + ztest_shared_ds_t *zd_shared; objset_t *zd_os; rwlock_t zd_zilog_lock; zilog_t *zd_zilog; - uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ char zd_name[MAXNAMELEN]; mutex_t zd_dirobj_lock; @@ -225,11 +287,17 @@ typedef struct ztest_info { ztest_func_t *zi_func; /* test function */ uint64_t zi_iters; /* iterations per execution */ uint64_t *zi_interval; /* execute every seconds */ - uint64_t zi_call_count; /* per-pass count */ - uint64_t zi_call_time; /* per-pass time */ - uint64_t zi_call_next; /* next time to call this function */ } ztest_info_t; +typedef struct ztest_shared_callstate { + uint64_t zc_count; /* per-pass count */ + uint64_t zc_time; /* per-pass time */ + uint64_t zc_next; /* next time to call this function */ +} ztest_shared_callstate_t; + +static ztest_shared_callstate_t *ztest_shared_callstate; +#define ZTEST_GET_SHARED_CALLSTATE(c) (&ztest_shared_callstate[c]) + /* * Note: these aren't static because we want dladdr() to work. */ @@ -297,8 +365,10 @@ ztest_info_t ztest_info[] = { { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, { ztest_vdev_attach_detach, 1, &zopt_rarely }, { ztest_vdev_LUN_growth, 1, &zopt_rarely }, - { ztest_vdev_add_remove, 1, &zopt_vdevtime }, - { ztest_vdev_aux_add_remove, 1, &zopt_vdevtime }, + { ztest_vdev_add_remove, 1, + &ztest_opts.zo_vdevtime }, + { ztest_vdev_aux_add_remove, 1, + &ztest_opts.zo_vdevtime }, }; #define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t)) @@ -316,8 +386,7 @@ typedef struct ztest_cb_list { * Stuff we need to share writably between parent and child. */ typedef struct ztest_shared { - char *zs_pool; - spa_t *zs_spa; + boolean_t zs_do_init; hrtime_t zs_proc_start; hrtime_t zs_proc_stop; hrtime_t zs_thread_start; @@ -328,13 +397,11 @@ typedef struct ztest_shared { uint64_t zs_vdev_aux; uint64_t zs_alloc; uint64_t zs_space; - uint64_t zs_guid; - mutex_t zs_vdev_lock; - rwlock_t zs_name_lock; - ztest_info_t zs_info[ZTEST_FUNCS]; uint64_t zs_splits; uint64_t zs_mirrors; - ztest_ds_t zs_zd[]; + uint64_t zs_metaslab_sz; + uint64_t zs_metaslab_df_alloc_threshold; + uint64_t zs_guid; } ztest_shared_t; #define ID_PARALLEL -1ULL @@ -342,20 +409,19 @@ typedef struct ztest_shared { static char ztest_dev_template[] = "%s/%s.%llua"; static char ztest_aux_template[] = "%s/%s.%s.%llu"; ztest_shared_t *ztest_shared; -uint64_t *ztest_seq; -static int ztest_random_fd; -static int ztest_dump_core = 1; +static spa_t *ztest_spa = NULL; +static ztest_ds_t *ztest_ds; +static mutex_t ztest_vdev_lock; +static rwlock_t ztest_name_lock; + +static boolean_t ztest_dump_core = B_TRUE; static boolean_t ztest_exiting; /* Global commit callback list */ static ztest_cb_list_t zcl; -extern uint64_t metaslab_gang_bang; -extern uint64_t metaslab_df_alloc_threshold; -static uint64_t metaslab_sz; - enum ztest_object { ZTEST_META_DNODE = 0, ZTEST_DIROBJ, @@ -468,12 +534,14 @@ nicenumtoull(const char *buf) static void usage(boolean_t requested) { + const ztest_shared_opts_t *zo = &ztest_opts_defaults; + char nice_vdev_size[10]; char nice_gang_bang[10]; FILE *fp = requested ? stdout : stderr; - nicenum(zopt_vdev_size, nice_vdev_size); - nicenum(metaslab_gang_bang, nice_gang_bang); + nicenum(zo->zo_vdev_size, nice_vdev_size); + nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang); (void) fprintf(fp, "Usage: %s\n" "\t[-v vdevs (default: %llu)]\n" @@ -494,42 +562,43 @@ usage(boolean_t requested) "\t[-T time (default: %llu sec)] total run time\n" "\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n" "\t[-P passtime (default: %llu sec)] time per pass\n" + "\t[-B alt_ztest (default: )] alternate ztest path\n" "\t[-h] (print help)\n" "", - cmdname, - (u_longlong_t)zopt_vdevs, /* -v */ + zo->zo_pool, + (u_longlong_t)zo->zo_vdevs, /* -v */ nice_vdev_size, /* -s */ - zopt_ashift, /* -a */ - zopt_mirrors, /* -m */ - zopt_raidz, /* -r */ - zopt_raidz_parity, /* -R */ - zopt_datasets, /* -d */ - zopt_threads, /* -t */ + zo->zo_ashift, /* -a */ + zo->zo_mirrors, /* -m */ + zo->zo_raidz, /* -r */ + zo->zo_raidz_parity, /* -R */ + zo->zo_datasets, /* -d */ + zo->zo_threads, /* -t */ nice_gang_bang, /* -g */ - zopt_init, /* -i */ - (u_longlong_t)zopt_killrate, /* -k */ - zopt_pool, /* -p */ - zopt_dir, /* -f */ - (u_longlong_t)zopt_time, /* -T */ - (u_longlong_t)zopt_maxloops, /* -F */ - (u_longlong_t)zopt_passtime); /* -P */ + zo->zo_init, /* -i */ + (u_longlong_t)zo->zo_killrate, /* -k */ + zo->zo_pool, /* -p */ + zo->zo_dir, /* -f */ + (u_longlong_t)zo->zo_time, /* -T */ + (u_longlong_t)zo->zo_maxloops, /* -F */ + (u_longlong_t)zo->zo_passtime); exit(requested ? 0 : 1); } static void process_options(int argc, char **argv) { + char *path; + ztest_shared_opts_t *zo = &ztest_opts; + int opt; uint64_t value; + char altdir[MAXNAMELEN] = { 0 }; - /* Remember program name. */ - progname = argv[0]; - - /* By default, test gang blocks for blocks 32K and greater */ - metaslab_gang_bang = 32 << 10; + bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -550,58 +619,71 @@ process_options(int argc, char **argv) } switch (opt) { case 'v': - zopt_vdevs = value; + zo->zo_vdevs = value; break; case 's': - zopt_vdev_size = MAX(SPA_MINDEVSIZE, value); + zo->zo_vdev_size = MAX(SPA_MINDEVSIZE, value); break; case 'a': - zopt_ashift = value; + zo->zo_ashift = value; break; case 'm': - zopt_mirrors = value; + zo->zo_mirrors = value; break; case 'r': - zopt_raidz = MAX(1, value); + zo->zo_raidz = MAX(1, value); break; case 'R': - zopt_raidz_parity = MIN(MAX(value, 1), 3); + zo->zo_raidz_parity = MIN(MAX(value, 1), 3); break; case 'd': - zopt_datasets = MAX(1, value); + zo->zo_datasets = MAX(1, value); break; case 't': - zopt_threads = MAX(1, value); + zo->zo_threads = MAX(1, value); break; case 'g': - metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, value); + zo->zo_metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, + value); break; case 'i': - zopt_init = value; + zo->zo_init = value; break; case 'k': - zopt_killrate = value; + zo->zo_killrate = value; break; case 'p': - zopt_pool = strdup(optarg); + (void) strlcpy(zo->zo_pool, optarg, + sizeof (zo->zo_pool)); break; case 'f': - zopt_dir = strdup(optarg); + path = realpath(optarg, NULL); + if (path == NULL) { + (void) fprintf(stderr, "error: %s: %s\n", + optarg, strerror(errno)); + usage(B_FALSE); + } else { + (void) strlcpy(zo->zo_dir, path, + sizeof (zo->zo_dir)); + } break; case 'V': - zopt_verbose++; + zo->zo_verbose++; break; case 'E': - zopt_init = 0; + zo->zo_init = 0; break; case 'T': - zopt_time = value; + zo->zo_time = value; break; case 'P': - zopt_passtime = MAX(1, value); + zo->zo_passtime = MAX(1, value); break; case 'F': - zopt_maxloops = MAX(1, value); + zo->zo_maxloops = MAX(1, value); + break; + case 'B': + (void) strlcpy(altdir, optarg, sizeof (altdir)); break; case 'h': usage(B_TRUE); @@ -613,17 +695,59 @@ process_options(int argc, char **argv) } } - zopt_raidz_parity = MIN(zopt_raidz_parity, zopt_raidz - 1); + zo->zo_raidz_parity = MIN(zo->zo_raidz_parity, zo->zo_raidz - 1); - zopt_vdevtime = (zopt_vdevs > 0 ? zopt_time * NANOSEC / zopt_vdevs : + zo->zo_vdevtime = + (zo->zo_vdevs > 0 ? zo->zo_time * NANOSEC / zo->zo_vdevs : UINT64_MAX >> 2); + + if (strlen(altdir) > 0) { + char cmd[MAXNAMELEN]; + char realaltdir[MAXNAMELEN]; + char *bin; + char *ztest; + char *isa; + int isalen; + + (void) realpath(getexecname(), cmd); + if (0 != access(altdir, F_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest path: %s", + altdir); + } + VERIFY(NULL != realpath(altdir, realaltdir)); + + /* + * 'cmd' should be of the form "/usr/bin//ztest". + * We want to extract to determine if we should use + * 32 or 64 bit binaries. + */ + bin = strstr(cmd, "/usr/bin/"); + ztest = strstr(bin, "/ztest"); + isa = bin + 9; + isalen = ztest - isa; + (void) snprintf(zo->zo_alt_ztest, sizeof (zo->zo_alt_ztest), + "%s/usr/bin/%.*s/ztest", realaltdir, isalen, isa); + (void) snprintf(zo->zo_alt_libpath, sizeof (zo->zo_alt_libpath), + "%s/usr/lib/%.*s", realaltdir, isalen, isa); + + if (0 != access(zo->zo_alt_ztest, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest: %s", + zo->zo_alt_ztest); + } else if (0 != access(zo->zo_alt_libpath, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate lib directory %s", + zo->zo_alt_libpath); + } + } } static void ztest_kill(ztest_shared_t *zs) { - zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(zs->zs_spa)); - zs->zs_space = metaslab_class_get_space(spa_normal_class(zs->zs_spa)); + zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa)); + zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa)); (void) kill(getpid(), SIGKILL); } @@ -635,7 +759,7 @@ ztest_random(uint64_t range) if (range == 0) return (0); - if (read(ztest_random_fd, &r, sizeof (r)) != sizeof (r)) + if (read(ZTEST_FD_RAND, &r, sizeof (r)) != sizeof (r)) fatal(1, "short read from /dev/urandom"); return (r % range); @@ -651,9 +775,9 @@ ztest_record_enospc(const char *s) static uint64_t ztest_get_ashift(void) { - if (zopt_ashift == 0) + if (ztest_opts.zo_ashift == 0) return (SPA_MINBLOCKSHIFT + ztest_random(3)); - return (zopt_ashift); + return (ztest_opts.zo_ashift); } static nvlist_t * @@ -671,12 +795,14 @@ make_vdev_file(char *path, char *aux, si if (aux != NULL) { vdev = ztest_shared->zs_vdev_aux; - (void) sprintf(path, ztest_aux_template, - zopt_dir, zopt_pool, aux, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_aux_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, aux, vdev); } else { vdev = ztest_shared->zs_vdev_next_leaf++; - (void) sprintf(path, ztest_dev_template, - zopt_dir, zopt_pool, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_dev_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, vdev); } } @@ -714,7 +840,7 @@ make_vdev_raidz(char *path, char *aux, s VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, VDEV_TYPE_RAIDZ) == 0); VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY, - zopt_raidz_parity) == 0); + ztest_opts.zo_raidz_parity) == 0); VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN, child, r) == 0); @@ -852,7 +978,7 @@ ztest_dsl_prop_set_uint64(char *osname, VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval), 1, &curval, setpoint), ==, 0); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0); (void) printf("%s %s = %s at '%s'\n", osname, propname, valname, setpoint); @@ -862,9 +988,9 @@ ztest_dsl_prop_set_uint64(char *osname, } static int -ztest_spa_prop_set_uint64(ztest_shared_t *zs, zpool_prop_t prop, uint64_t value) +ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value) { - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; nvlist_t *props = NULL; int error; @@ -986,13 +1112,16 @@ ztest_range_unlock(rl_t *rl) } static void -ztest_zd_init(ztest_ds_t *zd, objset_t *os) +ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, objset_t *os) { zd->zd_os = os; zd->zd_zilog = dmu_objset_zil(os); - zd->zd_seq = 0; + zd->zd_shared = szd; dmu_objset_name(os, zd->zd_name); + if (zd->zd_shared != NULL) + zd->zd_shared->zd_seq = 0; + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); @@ -2076,8 +2205,9 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ * will verify that the log really does contain this record. */ mutex_enter(&zilog->zl_lock); - ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); - zd->zd_seq = zilog->zl_commit_lr_seq; + ASSERT(zd->zd_shared != NULL); + ASSERT3U(zd->zd_shared->zd_seq, <=, zilog->zl_commit_lr_seq); + zd->zd_shared->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); (void) rw_unlock(&zd->zd_zilog_lock); @@ -2114,7 +2244,7 @@ ztest_zil_remount(ztest_ds_t *zd, uint64 void ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; + ztest_shared_opts_t *zo = &ztest_opts; spa_t *spa; nvlist_t *nvroot; @@ -2138,15 +2268,15 @@ ztest_spa_create_destroy(ztest_ds_t *zd, * Attempt to create an existing pool. It shouldn't matter * what's in the nvroot; we should fail with EEXIST. */ - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); - VERIFY3U(EEXIST, ==, spa_create(zs->zs_pool, nvroot, NULL, NULL, NULL)); + VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); - VERIFY3U(0, ==, spa_open(zs->zs_pool, &spa, FTAG)); - VERIFY3U(EBUSY, ==, spa_destroy(zs->zs_pool)); + VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); + VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); spa_close(spa, FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); } static vdev_t * @@ -2193,14 +2323,15 @@ void ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; uint64_t leaves; uint64_t guid; nvlist_t *nvroot; int error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = + MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2225,9 +2356,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui * dmu_objset_destroy() to fail with EBUSY thus * leaving the dataset in an inconsistent state. */ - VERIFY(rw_wrlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_wrlock(&ztest_name_lock) == 0); error = spa_vdev_remove(spa, guid, B_FALSE); - VERIFY(rw_unlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_unlock(&ztest_name_lock) == 0); if (error && error != EEXIST) fatal(0, "spa_vdev_remove() = %d", error); @@ -2237,8 +2368,10 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui /* * Make 1/4 of the devices be log devices. */ - nvroot = make_vdev_root(NULL, NULL, zopt_vdev_size, 0, - ztest_random(4) == 0, zopt_raidz, zs->zs_mirrors, 1); + nvroot = make_vdev_root(NULL, NULL, + ztest_opts.zo_vdev_size, 0, + ztest_random(4) == 0, ztest_opts.zo_raidz, + zs->zs_mirrors, 1); error = spa_vdev_add(spa, nvroot); nvlist_free(nvroot); @@ -2249,7 +2382,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui fatal(0, "spa_vdev_add() = %d", error); } - VERIFY(mutex_unlock(&ztest_shared->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2260,7 +2393,7 @@ void ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; spa_aux_vdev_t *sav; char *aux; @@ -2275,7 +2408,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd aux = ZPOOL_CONFIG_L2CACHE; } - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2292,8 +2425,9 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd for (;;) { char path[MAXPATHLEN]; int c; - (void) sprintf(path, ztest_aux_template, zopt_dir, - zopt_pool, aux, zs->zs_vdev_aux); + (void) snprintf(path, sizeof (path), ztest_aux_template, + ztest_opts.zo_dir, ztest_opts.zo_pool, aux, + zs->zs_vdev_aux); for (c = 0; c < sav->sav_count; c++) if (strcmp(sav->sav_vdevs[c]->vdev_path, path) == 0) @@ -2312,7 +2446,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd * Add a new device. */ nvlist_t *nvroot = make_vdev_root(NULL, aux, - (zopt_vdev_size * 5) / 4, 0, 0, 0, 0, 1); + (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); error = spa_vdev_add(spa, nvroot); if (error != 0) fatal(0, "spa_vdev_add(%p) = %d", nvroot, error); @@ -2331,7 +2465,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd fatal(0, "spa_vdev_remove(%llu) = %d", guid, error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2342,17 +2476,17 @@ void ztest_split_pool(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; nvlist_t *tree, **child, *config, *split, **schild; uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); /* ensure we have a useable config; mirrors of raidz aren't supported */ - if (zs->zs_mirrors < 3 || zopt_raidz > 1) { - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + if (zs->zs_mirrors < 3 || ztest_opts.zo_raidz > 1) { + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2411,9 +2545,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ spa_config_exit(spa, SCL_VDEV, FTAG); - (void) rw_wrlock(&zs->zs_name_lock); + (void) rw_wrlock(&ztest_name_lock); error = spa_vdev_split_mirror(spa, "splitp", config, NULL, B_FALSE); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); nvlist_free(config); @@ -2426,7 +2560,7 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ ++zs->zs_splits; --zs->zs_mirrors; } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } @@ -2438,7 +2572,7 @@ void ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; spa_aux_vdev_t *sav = &spa->spa_spares; vdev_t *rvd = spa->spa_root_vdev; vdev_t *oldvd, *newvd, *pvd; @@ -2455,8 +2589,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, int oldvd_is_log; int error, expected_error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2482,12 +2616,12 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (zs->zs_mirrors >= 1) { ASSERT(oldvd->vdev_ops == &vdev_mirror_ops); ASSERT(oldvd->vdev_children >= zs->zs_mirrors); - oldvd = oldvd->vdev_child[leaf / zopt_raidz]; + oldvd = oldvd->vdev_child[leaf / ztest_opts.zo_raidz]; } - if (zopt_raidz > 1) { + if (ztest_opts.zo_raidz > 1) { ASSERT(oldvd->vdev_ops == &vdev_raidz_ops); - ASSERT(oldvd->vdev_children == zopt_raidz); - oldvd = oldvd->vdev_child[leaf % zopt_raidz]; + ASSERT(oldvd->vdev_children == ztest_opts.zo_raidz); + oldvd = oldvd->vdev_child[leaf % ztest_opts.zo_raidz]; } /* @@ -2516,7 +2650,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (error != 0 && error != ENODEV && error != EBUSY && error != ENOTSUP) fatal(0, "detach (%s) returned %d", oldpath, error); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2530,7 +2664,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (void) strcpy(newpath, newvd->vdev_path); } else { (void) snprintf(newpath, sizeof (newpath), ztest_dev_template, - zopt_dir, zopt_pool, top * leaves + leaf); + ztest_opts.zo_dir, ztest_opts.zo_pool, + top * leaves + leaf); if (ztest_random(2) == 0) newpath[strlen(newpath) - 1] = 'b'; newvd = vdev_lookup_by_path(rvd, newpath); @@ -2609,7 +2744,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (longlong_t)newsize, replacing, error, expected_error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2632,7 +2767,7 @@ grow_vdev(vdev_t *vd, void *arg) fsize = lseek(fd, 0, SEEK_END); (void) ftruncate(fd, *newsize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("%s grew from %lu to %lu bytes\n", vd->vdev_path, (ulong_t)fsize, (ulong_t)*newsize); } @@ -2668,7 +2803,7 @@ online_vdev(vdev_t *vd, void *arg) * vdev_open fails is by checking the returned newstate. */ if (error || newstate != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Unable to expand vdev, state %llu, " "error %d\n", (u_longlong_t)newstate, error); } @@ -2683,7 +2818,7 @@ online_vdev(vdev_t *vd, void *arg) * trying to online it. */ if (generation != spa->spa_config_generation) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("vdev configuration has changed, " "guid %llu, state %llu, expected gen %llu, " "got gen %llu\n", @@ -2729,8 +2864,7 @@ vdev_walk_tree(vdev_t *vd, vdev_t *(*fun void ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *vd, *tvd; metaslab_class_t *mc; metaslab_group_t *mg; @@ -2738,7 +2872,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui uint64_t top; uint64_t old_class_space, new_class_space, old_ms_count, new_ms_count; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_STATE, spa, RW_READER); top = ztest_random_vdev_top(spa, B_TRUE); @@ -2764,16 +2898,16 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui * original size, and it has a valid psize. */ if (tvd->vdev_state != VDEV_STATE_HEALTHY || - psize == 0 || psize >= 4 * zopt_vdev_size) { + psize == 0 || psize >= 4 * ztest_opts.zo_vdev_size) { spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } ASSERT(psize > 0); newsize = psize + psize / 8; ASSERT3U(newsize, >, psize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("Expanding LUN %s from %lu to %lu\n", vd->vdev_path, (ulong_t)psize, (ulong_t)newsize); } @@ -2786,12 +2920,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui if (vdev_walk_tree(tvd, grow_vdev, &newsize) != NULL || vdev_walk_tree(tvd, online_vdev, NULL) != NULL || tvd->vdev_state != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not expand LUN because " "the vdev configuration changed.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2820,12 +2954,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui new_class_space = metaslab_class_get_space(mc); if (tvd->vdev_mg != mg || mg->mg_class != mc) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not verify LUN expansion due to " "intervening vdev offline or remove.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2843,7 +2977,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui fatal(0, "LUN expansion failed: class_space %llu <= %llu\n", old_class_space, new_class_space); - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { char oldnumbuf[6], newnumbuf[6]; nicenum(old_class_space, oldnumbuf); @@ -2853,7 +2987,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2880,7 +3014,8 @@ ztest_dataset_create(char *dsname) if (err || zilset < 80) return (err); - (void) printf("Setting dataset %s to sync always\n", dsname); + if (ztest_opts.zo_verbose >= 6) + (void) printf("Setting dataset %s to sync always\n", dsname); return (ztest_dsl_prop_set_uint64(dsname, ZFS_PROP_SYNC, ZFS_SYNC_ALWAYS, B_FALSE)); } @@ -2952,7 +3087,6 @@ ztest_snapshot_destroy(char *osname, uin void ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; ztest_ds_t zdtmp; int iters; int error; @@ -2960,10 +3094,10 @@ ztest_dmu_objset_create_destroy(ztest_ds char name[MAXNAMELEN]; zilog_t *zilog; - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); (void) snprintf(name, MAXNAMELEN, "%s/temp_%llu", - zs->zs_pool, (u_longlong_t)id); + ztest_opts.zo_pool, (u_longlong_t)id); /* * If this dataset exists from a previous run, process its replay log @@ -2972,7 +3106,7 @@ ztest_dmu_objset_create_destroy(ztest_ds */ if (ztest_random(2) == 0 && dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) == 0) { - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); zil_replay(os, &zdtmp, ztest_replay_vector); ztest_zd_fini(&zdtmp); dmu_objset_disown(os, FTAG); @@ -2998,7 +3132,7 @@ ztest_dmu_objset_create_destroy(ztest_ds if (error) { if (error == ENOSPC) { ztest_record_enospc(FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); return; } fatal(0, "dmu_objset_create(%s) = %d", name, error); @@ -3007,7 +3141,7 @@ ztest_dmu_objset_create_destroy(ztest_ds VERIFY3U(0, ==, dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os)); - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); /* * Open the intent log for it. @@ -3047,7 +3181,7 @@ ztest_dmu_objset_create_destroy(ztest_ds dmu_objset_disown(os, FTAG); ztest_zd_fini(&zdtmp); - (void) rw_unlock(&zs->zs_name_lock); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 10 07:40:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE67E1065674; Sun, 10 Jun 2012 07:40:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A416D8FC19; Sun, 10 Jun 2012 07:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7ehat081035; Sun, 10 Jun 2012 07:40:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7ehXs081018; Sun, 10 Jun 2012 07:40:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100740.q5A7ehXs081018@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236840 - in stable/8: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/z... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:40:43 -0000 Author: mm Date: Sun Jun 10 07:40:43 2012 New Revision: 236840 URL: http://svn.freebsd.org/changeset/base/236840 Log: MFC r236155: Import illumos changeset 13570:3411fd5f1589 1948 zpool list should show more detailed pool information Display per-vdev information with "zpool list -v". The added expandsize property has currently no value on FreeBSD. This changeset allows adding expansion support to individual vdevs in the future. References: https://www.illumos.org/issues/1948 Obtained from: illumos (issue #1948) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:40:43 2012 (r236840) @@ -537,6 +537,8 @@ value of 1.76 indicates that 1.76 units for a description of the deduplication feature. .It Sy free Number of blocks within the pool that are not allocated. +.It Sy expandsize +This property has currently no value on FreeBSD. .It Sy guid A unique identifier for the pool. .It Sy health @@ -1275,7 +1277,7 @@ Treat exported or foreign devices as ina .It Xo .Nm .Cm list -.Op Fl H +.Op Fl Hv .Op Fl o Ar property Ns Op , Ns Ar ... .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,9 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. - * Copyright (c) 2011 Martin Matuska . All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ #include @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ static int zpool_do_status(int, char **) static int zpool_do_online(int, char **); static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reopen(int, char **); static int zpool_do_reguid(int, char **); @@ -132,7 +134,8 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, - HELP_REGUID + HELP_REGUID, + HELP_REOPEN } zpool_help_t; @@ -167,6 +170,7 @@ static zpool_command_t command_table[] = { "online", zpool_do_online, HELP_ONLINE }, { "offline", zpool_do_offline, HELP_OFFLINE }, { "clear", zpool_do_clear, HELP_CLEAR }, + { "reopen", zpool_do_reopen, HELP_REOPEN }, { NULL }, { "attach", zpool_do_attach, HELP_ATTACH }, { "detach", zpool_do_detach, HELP_DETACH }, @@ -241,6 +245,8 @@ get_usage(zpool_help_t idx) { "[new-device]\n")); case HELP_REMOVE: return (gettext("\tremove ...\n")); + case HELP_REOPEN: + return (""); /* Undocumented command */ case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: @@ -2109,10 +2115,10 @@ error: } typedef struct iostat_cbdata { - zpool_list_t *cb_list; - int cb_verbose; - int cb_iteration; + boolean_t cb_verbose; int cb_namewidth; + int cb_iteration; + zpool_list_t *cb_list; } iostat_cbdata_t; static void @@ -2582,8 +2588,9 @@ zpool_do_iostat(int argc, char **argv) } typedef struct list_cbdata { + boolean_t cb_verbose; + int cb_namewidth; boolean_t cb_scripted; - boolean_t cb_first; zprop_list_t *cb_proplist; } list_cbdata_t; @@ -2591,16 +2598,27 @@ typedef struct list_cbdata { * Given a list of columns to display, output appropriate headers for each one. */ static void -print_header(zprop_list_t *pl) +print_header(list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; const char *header; boolean_t first = B_TRUE; boolean_t right_justify; + size_t width = 0; for (; pl != NULL; pl = pl->pl_next) { if (pl->pl_prop == ZPROP_INVAL) continue; + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) (void) printf(" "); else @@ -2612,9 +2630,10 @@ print_header(zprop_list_t *pl) if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) - (void) printf("%*s", pl->pl_width, header); + (void) printf("%*s", width, header); else - (void) printf("%-*s", pl->pl_width, header); + (void) printf("%-*s", width, header); + } (void) printf("\n"); @@ -2625,17 +2644,28 @@ print_header(zprop_list_t *pl) * to the described layout. */ static void -print_pool(zpool_handle_t *zhp, zprop_list_t *pl, int scripted) +print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; boolean_t first = B_TRUE; char property[ZPOOL_MAXPROPLEN]; char *propstr; boolean_t right_justify; - int width; + size_t width; for (; pl != NULL; pl = pl->pl_next) { + + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) { - if (scripted) + if (cb->cb_scripted) (void) printf("\t"); else (void) printf(" "); @@ -2645,7 +2675,10 @@ print_pool(zpool_handle_t *zhp, zprop_li right_justify = B_FALSE; if (pl->pl_prop != ZPROP_INVAL) { - if (zpool_get_prop(zhp, pl->pl_prop, property, + if (pl->pl_prop == ZPOOL_PROP_EXPANDSZ && + zpool_get_prop_int(zhp, pl->pl_prop, NULL) == 0) + propstr = "-"; + else if (zpool_get_prop(zhp, pl->pl_prop, property, sizeof (property), NULL) != 0) propstr = "-"; else @@ -2656,14 +2689,13 @@ print_pool(zpool_handle_t *zhp, zprop_li propstr = "-"; } - width = pl->pl_width; /* * If this is being called in scripted mode, or if this is the * last column and it is left-justified, don't include a width * format specifier. */ - if (scripted || (pl->pl_next == NULL && !right_justify)) + if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify)) (void) printf("%s", propstr); else if (right_justify) (void) printf("%*s", width, propstr); @@ -2674,6 +2706,101 @@ print_pool(zpool_handle_t *zhp, zprop_li (void) printf("\n"); } +static void +print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted) +{ + char propval[64]; + boolean_t fixed; + size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); + + zfs_nicenum(value, propval, sizeof (propval)); + + if (prop == ZPOOL_PROP_EXPANDSZ && value == 0) + (void) strlcpy(propval, "-", sizeof (propval)); + + if (scripted) + (void) printf("\t%s", propval); + else + (void) printf(" %*s", width, propval); +} + +void +print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, + list_cbdata_t *cb, int depth) +{ + nvlist_t **child; + vdev_stat_t *vs; + uint_t c, children; + char *vname; + boolean_t scripted = cb->cb_scripted; + + verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &c) == 0); + + if (name != NULL) { + if (scripted) + (void) printf("\t%s", name); + else if (strlen(name) + depth > cb->cb_namewidth) + (void) printf("%*s%s", depth, "", name); + else + (void) printf("%*s%s%*s", depth, "", name, + (int)(cb->cb_namewidth - strlen(name) - depth), ""); + + /* only toplevel vdevs have capacity stats */ + if (vs->vs_space == 0) { + if (scripted) + (void) printf("\t-\t-\t-"); + else + (void) printf(" - - -"); + } else { + print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, + scripted); + print_one_column(ZPOOL_PROP_CAPACITY, vs->vs_alloc, + scripted); + print_one_column(ZPOOL_PROP_FREE, + vs->vs_space - vs->vs_alloc, scripted); + } + print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, + scripted); + (void) printf("\n"); + } + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) != 0) + return; + + for (c = 0; c < children; c++) { + uint64_t ishole = B_FALSE; + + if (nvlist_lookup_uint64(child[c], + ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + + /* + * Include level 2 ARC devices in iostat output + */ + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, + &child, &children) != 0) + return; + + if (children > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "cache"); + for (c = 0; c < children; c++) { + vname = zpool_vdev_name(g_zfs, zhp, child[c], + B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + } +} + + /* * Generic callback function to list a pool. */ @@ -2681,14 +2808,18 @@ int list_callback(zpool_handle_t *zhp, void *data) { list_cbdata_t *cbp = data; + nvlist_t *config; + nvlist_t *nvroot; - if (cbp->cb_first) { - if (!cbp->cb_scripted) - print_header(cbp->cb_proplist); - cbp->cb_first = B_FALSE; - } + config = zpool_get_config(zhp, NULL); - print_pool(zhp, cbp->cb_proplist, cbp->cb_scripted); + print_pool(zhp, cbp); + if (!cbp->cb_verbose) + return (0); + + verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, + &nvroot) == 0); + print_list_stats(zhp, NULL, nvroot, cbp, 0); return (0); } @@ -2712,12 +2843,15 @@ zpool_do_list(int argc, char **argv) int ret; list_cbdata_t cb = { 0 }; static char default_props[] = - "name,size,allocated,free,capacity,dedupratio,health,altroot"; + "name,size,allocated,free,capacity,dedupratio," + "health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; + zpool_list_t *list; + boolean_t first = B_TRUE; /* check options */ - while ((c = getopt(argc, argv, ":Ho:T:")) != -1) { + while ((c = getopt(argc, argv, ":Ho:T:v")) != -1) { switch (c) { case 'H': cb.cb_scripted = B_TRUE; @@ -2728,6 +2862,9 @@ zpool_do_list(int argc, char **argv) case 'T': get_timestamp_arg(*optarg); break; + case 'v': + cb.cb_verbose = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -2748,21 +2885,32 @@ zpool_do_list(int argc, char **argv) if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); - cb.cb_first = B_TRUE; + if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL) + return (1); + + if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) { + (void) printf(gettext("no pools available\n")); + zprop_free_list(cb.cb_proplist); + return (0); + } for (;;) { + pool_list_update(list); + + if (pool_list_count(list) == 0) + break; + + cb.cb_namewidth = 0; + (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb); if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); - ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist, - list_callback, &cb); - - if (argc == 0 && cb.cb_first && !cb.cb_scripted) { - (void) printf(gettext("no pools available\n")); - zprop_free_list(cb.cb_proplist); - return (0); + if (!cb.cb_scripted && (first || cb.cb_verbose)) { + print_header(&cb); + first = B_FALSE; } + ret = pool_list_iter(list, B_TRUE, list_callback, &cb); if (interval == 0) break; @@ -3382,6 +3530,36 @@ zpool_do_reguid(int argc, char **argv) } +/* + * zpool reopen + * + * Reopen the pool so that the kernel can update the sizes of all vdevs. + * + * NOTE: This command is currently undocumented. If the command is ever + * exposed then the appropriate usage() messages will need to be made. + */ +int +zpool_do_reopen(int argc, char **argv) +{ + int ret = 0; + zpool_handle_t *zhp; + char *pool; + + argc--; + argv++; + + if (argc != 1) + return (2); + + pool = argv[0]; + if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) + return (1); + + ret = zpool_reopen(zhp); + zpool_close(zhp); + return (ret); +} + typedef struct scrub_cbdata { int cb_type; int cb_argc; Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:40:43 2012 (r236840) @@ -24,7 +24,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. */ @@ -237,6 +237,7 @@ typedef struct splitflags { extern int zpool_scan(zpool_handle_t *, pool_scan_func_t); extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); extern int zpool_reguid(zpool_handle_t *); +extern int zpool_reopen(zpool_handle_t *); extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -301,6 +301,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpoo case ZPOOL_PROP_SIZE: case ZPOOL_PROP_ALLOCATED: case ZPOOL_PROP_FREE: + case ZPOOL_PROP_EXPANDSZ: (void) zfs_nicenum(intval, buf, len); break; @@ -390,8 +391,8 @@ pool_uses_efi(nvlist_t *config) return (B_FALSE); } -static boolean_t -pool_is_bootable(zpool_handle_t *zhp) +boolean_t +zpool_is_bootable(zpool_handle_t *zhp) { char bootfs[ZPOOL_MAXNAMELEN]; @@ -1126,7 +1127,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t return (zfs_error(hdl, EZFS_BADVERSION, msg)); } - if (pool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, + if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) { uint64_t s; @@ -2412,7 +2413,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, uint_t children; nvlist_t *config_root; libzfs_handle_t *hdl = zhp->zpool_hdl; - boolean_t rootpool = pool_is_bootable(zhp); + boolean_t rootpool = zpool_is_bootable(zhp); if (replacing) (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, @@ -3054,6 +3055,26 @@ zpool_reguid(zpool_handle_t *zhp) } /* + * Reopen the pool. + */ +int +zpool_reopen(zpool_handle_t *zhp) +{ + zfs_cmd_t zc = { 0 }; + char msg[1024]; + libzfs_handle_t *hdl = zhp->zpool_hdl; + + (void) snprintf(msg, sizeof (msg), + dgettext(TEXT_DOMAIN, "cannot reopen '%s'"), + zhp->zpool_name); + + (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); + if (zfs_ioctl(hdl, ZFS_IOC_POOL_REOPEN, &zc) == 0) + return (0); + return (zpool_standard_error(hdl, errno, msg)); +} + +/* * Convert from a devid string to a path. */ static char * @@ -3703,7 +3724,7 @@ zpool_label_disk(libzfs_handle_t *hdl, z if (zhp) { nvlist_t *nvroot; - if (pool_is_bootable(zhp)) { + if (zpool_is_bootable(zhp)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "EFI labeled devices are not supported on root " "pools.")); Modified: stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -81,6 +81,8 @@ zpool_prop_init(void) ZFS_TYPE_POOL, "", "FREE"); zprop_register_number(ZPOOL_PROP_ALLOCATED, "allocated", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "ALLOC"); + zprop_register_number(ZPOOL_PROP_EXPANDSZ, "expandsize", 0, + PROP_READONLY, ZFS_TYPE_POOL, "", "EXPANDSZ"); zprop_register_number(ZPOOL_PROP_CAPACITY, "capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "CAP"); zprop_register_number(ZPOOL_PROP_GUID, "guid", 0, PROP_READONLY, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -175,15 +175,17 @@ spa_prop_add_list(nvlist_t *nvl, zpool_p static void spa_prop_get_config(spa_t *spa, nvlist_t **nvp) { + vdev_t *rvd = spa->spa_root_vdev; uint64_t size; uint64_t alloc; + uint64_t space; uint64_t cap, version; zprop_source_t src = ZPROP_SRC_NONE; spa_config_dirent_t *dp; ASSERT(MUTEX_HELD(&spa->spa_props_lock)); - if (spa->spa_root_vdev != NULL) { + if (rvd != NULL) { alloc = metaslab_class_get_alloc(spa_normal_class(spa)); size = metaslab_class_get_space(spa_normal_class(spa)); spa_prop_add_list(*nvp, ZPOOL_PROP_NAME, spa_name(spa), 0, src); @@ -191,6 +193,15 @@ spa_prop_get_config(spa_t *spa, nvlist_t spa_prop_add_list(*nvp, ZPOOL_PROP_ALLOCATED, NULL, alloc, src); spa_prop_add_list(*nvp, ZPOOL_PROP_FREE, NULL, size - alloc, src); + + space = 0; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, space, + src); + spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL, (spa_mode(spa) == FREAD), src); @@ -201,7 +212,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t ddt_get_pool_dedup_ratio(spa), src); spa_prop_add_list(*nvp, ZPOOL_PROP_HEALTH, NULL, - spa->spa_root_vdev->vdev_state, src); + rvd->vdev_state, src); version = spa_version(spa); if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION)) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:40:43 2012 (r236840) @@ -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_VDEV_IMPL_H @@ -55,7 +56,8 @@ typedef struct vdev_cache_entry vdev_cac /* * Virtual device operations */ -typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift); +typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size, + uint64_t *ashift); typedef void vdev_close_func_t(vdev_t *vd); typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize); typedef int vdev_io_start_func_t(zio_t *zio); @@ -118,6 +120,7 @@ struct vdev { uint64_t vdev_orig_guid; /* orig. guid prior to remove */ uint64_t vdev_asize; /* allocatable device capacity */ uint64_t vdev_min_asize; /* min acceptable asize */ + uint64_t vdev_max_asize; /* max acceptable asize */ uint64_t vdev_ashift; /* block alignment shift */ uint64_t vdev_state; /* see VDEV_STATE_* #defines */ uint64_t vdev_prevstate; /* used when reopening a vdev */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -119,7 +119,7 @@ vdev_get_min_asize(vdev_t *vd) vdev_t *pvd = vd->vdev_parent; /* - * The our parent is NULL (inactive spare or cache) or is the root, + * If our parent is NULL (inactive spare or cache) or is the root, * just return our own asize. */ if (pvd == NULL) @@ -748,6 +748,7 @@ vdev_add_parent(vdev_t *cvd, vdev_ops_t mvd->vdev_asize = cvd->vdev_asize; mvd->vdev_min_asize = cvd->vdev_min_asize; + mvd->vdev_max_asize = cvd->vdev_max_asize; mvd->vdev_ashift = cvd->vdev_ashift; mvd->vdev_state = cvd->vdev_state; mvd->vdev_crtxg = cvd->vdev_crtxg; @@ -1119,7 +1120,8 @@ vdev_open(vdev_t *vd) spa_t *spa = vd->vdev_spa; int error; uint64_t osize = 0; - uint64_t asize, psize; + uint64_t max_osize = 0; + uint64_t asize, max_asize, psize; uint64_t ashift = 0; ASSERT(vd->vdev_open_thread == curthread || @@ -1150,7 +1152,7 @@ vdev_open(vdev_t *vd) return (ENXIO); } - error = vd->vdev_ops->vdev_op_open(vd, &osize, &ashift); + error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift); /* * Reset the vdev_reopening flag so that we actually close @@ -1208,6 +1210,7 @@ vdev_open(vdev_t *vd) } osize = P2ALIGN(osize, (uint64_t)sizeof (vdev_label_t)); + max_osize = P2ALIGN(max_osize, (uint64_t)sizeof (vdev_label_t)); if (vd->vdev_children == 0) { if (osize < SPA_MINDEVSIZE) { @@ -1217,6 +1220,8 @@ vdev_open(vdev_t *vd) } psize = osize; asize = osize - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE); + max_asize = max_osize - (VDEV_LABEL_START_SIZE + + VDEV_LABEL_END_SIZE); } else { if (vd->vdev_parent != NULL && osize < SPA_MINDEVSIZE - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE)) { @@ -1226,6 +1231,7 @@ vdev_open(vdev_t *vd) } psize = 0; asize = osize; + max_asize = max_osize; } vd->vdev_psize = psize; @@ -1245,6 +1251,7 @@ vdev_open(vdev_t *vd) * For testing purposes, a higher ashift can be requested. */ vd->vdev_asize = asize; + vd->vdev_max_asize = max_asize; vd->vdev_ashift = MAX(ashift, vd->vdev_ashift); } else { /* @@ -1255,6 +1262,7 @@ vdev_open(vdev_t *vd) VDEV_AUX_BAD_LABEL); return (EINVAL); } + vd->vdev_max_asize = max_asize; } /* @@ -2478,6 +2486,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; mutex_exit(&vd->vdev_stat_lock); /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:40:43 2012 (r236840) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -30,6 +31,7 @@ #include #include #include +#include #include /* @@ -102,8 +104,39 @@ vdev_disk_rele(vdev_t *vd) } } +static uint64_t +vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz) +{ + ASSERT(vd->vdev_wholedisk); + + vdev_disk_t *dvd = vd->vdev_tsd; + dk_efi_t dk_ioc; + efi_gpt_t *efi; + uint64_t avail_space = 0; + int efisize = EFI_LABEL_SIZE * 2; + + dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP); + dk_ioc.dki_lba = 1; + dk_ioc.dki_length = efisize; + dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data; + efi = dk_ioc.dki_data; + + if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)&dk_ioc, + FKIOCTL, kcred, NULL) == 0) { + uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA); + + zfs_dbgmsg("vdev %s, capacity %llu, altern lba %llu", + vd->vdev_path, capacity, efi_altern_lba); + if (capacity > efi_altern_lba) + avail_space = (capacity - efi_altern_lba) * blksz; + } + kmem_free(dk_ioc.dki_data, efisize); + return (avail_space); +} + static int -vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { spa_t *spa = vd->vdev_spa; vdev_disk_t *dvd; @@ -274,16 +307,6 @@ skip_open: } /* - * If we own the whole disk, try to enable disk write caching. - * We ignore errors because it's OK if we can't do it. - */ - if (vd->vdev_wholedisk == 1) { - int wce = 1; - (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, - FKIOCTL, kcred, NULL); - } - - /* * Determine the device's minimum transfer size. * If the ioctl isn't supported, assume DEV_BSIZE. */ @@ -293,6 +316,25 @@ skip_open: *ashift = highbit(MAX(dkmext.dki_pbsize, SPA_MINBLOCKSIZE)) - 1; + if (vd->vdev_wholedisk == 1) { + uint64_t capacity = dkmext.dki_capacity - 1; + uint64_t blksz = dkmext.dki_lbsize; + int wce = 1; + + /* + * If we own the whole disk, try to enable disk write caching. + * We ignore errors because it's OK if we can't do it. + */ + (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, + FKIOCTL, kcred, NULL); + + *max_psize = *psize + vdev_disk_get_space(vd, capacity, blksz); + zfs_dbgmsg("capacity change: vdev %s, psize %llu, " + "max_psize %llu", vd->vdev_path, *psize, *max_psize); + } else { + *max_psize = *psize; + } + /* * Clear the nowritecache bit, so that on a vdev_reopen() we will * try again. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:40:43 2012 (r236840) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -47,7 +48,8 @@ vdev_file_rele(vdev_t *vd) } static int -vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { vdev_file_t *vf; vnode_t *vp; @@ -125,7 +127,7 @@ skip_open: return (error); } - *psize = vattr.va_size; + *max_psize = *psize = vattr.va_size; *ashift = SPA_MINBLOCKSHIFT; return (0); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,6 +21,8 @@ /* * Copyright (c) 2006 Pawel Jakub Dawidek * All rights reserved. + * + * Portions Copyright (c) 2012 Martin Matuska */ #include @@ -405,7 +407,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c } static int -vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { struct g_provider *pp; struct g_consumer *cp; @@ -488,7 +491,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi /* * Determine the actual size of the device. */ - *psize = pp->mediasize; + *max_psize = *psize = pp->mediasize; /* * Determine the device's minimum transfer size. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:40:43 2012 (r236840) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include #include #include @@ -127,7 +131,8 @@ vdev_mirror_map_alloc(zio_t *zio) } static int -vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { int numerrors = 0; int lasterror = 0; @@ -149,6 +154,7 @@ vdev_mirror_open(vdev_t *vd, uint64_t *a } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:40:43 2012 (r236840) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* * The 'missing' vdev is a special vdev type used only during import. It * signifies a placeholder in the root vdev for some vdev that we know is * missing. We pass it down to the kernel to allow the rest of the @@ -40,7 +44,8 @@ /* ARGSUSED */ static int -vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { /* * Really this should just fail. But then the root vdev will be in the @@ -49,6 +54,7 @@ vdev_missing_open(vdev_t *vd, uint64_t * * will fail the GUID sum check before ever trying to open the pool. */ *psize = 0; + *max_psize = 0; *ashift = 0; return (0); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -1441,7 +1442,8 @@ vdev_raidz_reconstruct(raidz_map_t *rm, } static int -vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { vdev_t *cvd; uint64_t nparity = vd->vdev_nparity; @@ -1469,10 +1471,12 @@ vdev_raidz_open(vdev_t *vd, uint64_t *as } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } *asize *= vd->vdev_children; + *max_asize *= vd->vdev_children; if (numerrors > nparity) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:40:43 2012 (r236840) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sun Jun 10 19:43:32 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1509106566C; Sun, 10 Jun 2012 19:43:32 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBBD58FC16; Sun, 10 Jun 2012 19:43:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AJhWEh017306; Sun, 10 Jun 2012 19:43:32 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AJhW6n017304; Sun, 10 Jun 2012 19:43:32 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206101943.q5AJhW6n017304@svn.freebsd.org> From: Warren Block Date: Sun, 10 Jun 2012 19:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236856 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 19:43:32 -0000 Author: wblock (doc committer) Date: Sun Jun 10 19:43:32 2012 New Revision: 236856 URL: http://svn.freebsd.org/changeset/base/236856 Log: MFC r236716: Add specific supported revision of ASUS USB-N13 ver. A1. http://lists.freebsd.org/pipermail/freebsd-doc/2012-June/019960.html Submitted by: PseudoCylon (AK) Approved by: gjb (mentor) Modified: stable/8/share/man/man4/run.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/run.4 ============================================================================== --- stable/8/share/man/man4/run.4 Sun Jun 10 16:46:57 2012 (r236855) +++ stable/8/share/man/man4/run.4 Sun Jun 10 19:43:32 2012 (r236856) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2011 +.Dd June 7, 2012 .Os .Dt RUN 4 .Sh NAME @@ -112,7 +112,7 @@ driver supports the following wireless a .Bl -tag -width Ds -offset indent -compact .It Airlink101 AWLL6090 .It ASUS USB-N11 -.It ASUS USB-N13 +.It ASUS USB-N13 ver. A1 .It ASUS WL-160N .It Belkin F5D8051 ver 3000 .It Belkin F5D8053 From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 07:11:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83CCC1065670; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5479D8FC0A; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7BZkY049459; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7BZwm049456; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206110711.q5B7BZwm049456@svn.freebsd.org> From: Xin LI Date: Mon, 11 Jun 2012 07:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236875 - in stable: 7/usr.sbin/inetd 8/usr.sbin/inetd 9/usr.sbin/inetd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:11:35 -0000 Author: delphij Date: Mon Jun 11 07:11:34 2012 New Revision: 236875 URL: http://svn.freebsd.org/changeset/base/236875 Log: MFC r236572: Replace the use of wall clock time with monotonically increasing clock. In general, gettimeofday() is not appropriate interface when accounting for elasped time because it can go backward, in which case the policy code could errornously consider the limit as exceeded. Reported by: Mahesh Arumugam Submitted by: Dorr H. Clark via gnn Sponsored by: Citrix / NetScaler Modified: stable/8/usr.sbin/inetd/inetd.c stable/8/usr.sbin/inetd/inetd.h Directory Properties: stable/8/usr.sbin/inetd/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.sbin/inetd/inetd.c stable/7/usr.sbin/inetd/inetd.h stable/9/usr.sbin/inetd/inetd.c stable/9/usr.sbin/inetd/inetd.h Directory Properties: stable/7/usr.sbin/inetd/ (props changed) stable/9/usr.sbin/inetd/ (props changed) Modified: stable/8/usr.sbin/inetd/inetd.c ============================================================================== --- stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:11:34 2012 (r236875) @@ -688,11 +688,11 @@ main(int argc, char **argv) */ if (dofork) { if (sep->se_count++ == 0) - (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &sep->se_time); else if (toomany > 0 && sep->se_count >= toomany) { - struct timeval now; + struct timespec now; - (void)gettimeofday(&now, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &now); if (now.tv_sec - sep->se_time.tv_sec > CNT_INTVL) { sep->se_time = now; Modified: stable/8/usr.sbin/inetd/inetd.h ============================================================================== --- stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:11:34 2012 (r236875) @@ -109,7 +109,7 @@ struct servtab { u_int se_rpc_lowvers; /* RPC low version */ u_int se_rpc_highvers; /* RPC high version */ int se_count; /* number started since se_time */ - struct timeval se_time; /* start of se_count */ + struct timespec se_time; /* start of se_count */ struct servtab *se_next; struct se_flags { u_int se_nomapped : 1; From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 13:17:45 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFCAB106566C; Mon, 11 Jun 2012 13:17:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FEF28FC14; Mon, 11 Jun 2012 13:17:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BDHjSl086439; Mon, 11 Jun 2012 13:17:45 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BDHjdN086437; Mon, 11 Jun 2012 13:17:45 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206111317.q5BDHjdN086437@svn.freebsd.org> From: Rick Macklem Date: Mon, 11 Jun 2012 13:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236888 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 13:17:45 -0000 Author: rmacklem Date: Mon Jun 11 13:17:45 2012 New Revision: 236888 URL: http://svn.freebsd.org/changeset/base/236888 Log: MFC: r235381 Fix two cases in the new NFS server where a tsleep() is used, when the code should actually protect the tested variable with a mutex. Since the tsleep()s had a 10sec timeout, the race would have only delayed the allocation of a new clientid for a client. The sleeps will also rarely occur, since having a callback in progress when a client acquires a new clientid, is unlikely. in practice, since having a callback in progress when a fresh clientid is being acquired by a client is unlikely. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 12:34:14 2012 (r236887) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 13:17:45 2012 (r236888) @@ -331,11 +331,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; goto out; @@ -385,10 +387,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, "nfsd clp", 10 * hz); + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", + 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; @@ -3816,11 +3821,9 @@ nfsrv_docallback(struct nfsclient *clp, clp->lc_cbref--; if ((clp->lc_flags & LCL_WAKEUPWANTED) && clp->lc_cbref == 0) { clp->lc_flags &= ~LCL_WAKEUPWANTED; - NFSUNLOCKSTATE(); - wakeup((caddr_t)clp); - } else { - NFSUNLOCKSTATE(); + wakeup(clp); } + NFSUNLOCKSTATE(); NFSEXITCODE(error); return (error); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 17:22:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C885310656B1; Mon, 11 Jun 2012 17:22:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98E048FC21; Mon, 11 Jun 2012 17:22:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHMROf098527; Mon, 11 Jun 2012 17:22:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHMRO1098524; Mon, 11 Jun 2012 17:22:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111722.q5BHMRO1098524@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 17:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236896 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:22:27 -0000 Author: hselasky Date: Mon Jun 11 17:22:27 2012 New Revision: 236896 URL: http://svn.freebsd.org/changeset/base/236896 Log: MFC r236407: Improve support for detaching kernel drivers on a per interface basis. Modified: stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_generic.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:22:27 2012 (r236896) @@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev if (do_init) { /* setup the USB interface structure */ iface->idesc = id; - /* default setting */ - iface->parent_iface_index = USB_IFACE_INDEX_ANY; /* set alternate index */ iface->alt_index = alt_index; + /* set default interface parent */ + if (iface_index == USB_IFACE_INDEX_ANY) { + iface->parent_iface_index = + USB_IFACE_INDEX_ANY; + } } DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); @@ -1229,10 +1232,13 @@ usbd_set_parent_iface(struct usb_device { struct usb_interface *iface; + if (udev == NULL) { + /* nothing to do */ + return; + } iface = usbd_get_iface(udev, iface_index); - if (iface) { + if (iface != NULL) iface->parent_iface_index = parent_index; - } } static void Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:22:27 2012 (r236896) @@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo break; } + /* + * Detach the currently attached driver. + */ usb_detach_device(f->udev, n, 0); + + /* + * Set parent to self, this should keep attach away + * until the next set configuration event. + */ + usbd_set_parent_iface(f->udev, n, n); break; case USB_SET_POWER_MODE: From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 18:02:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B911A1065672; Mon, 11 Jun 2012 18:02:30 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2D6A8FC0A; Mon, 11 Jun 2012 18:02:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BI2UYE001430; Mon, 11 Jun 2012 18:02:30 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BI2UOE001428; Mon, 11 Jun 2012 18:02:30 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201206111802.q5BI2UOE001428@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 11 Jun 2012 18:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236901 - stable/8/sbin/mount X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:02:30 -0000 Author: jh Date: Mon Jun 11 18:02:30 2012 New Revision: 236901 URL: http://svn.freebsd.org/changeset/base/236901 Log: MFC r230373: Change mount_fs() to not exit on error. The "failok" mount option requires that errors are passed to the caller. PR: 163668 Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c ============================================================================== --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 17:54:40 2012 (r236900) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:02:30 2012 (r236901) @@ -86,7 +86,6 @@ mount_fs(const char *vfstype, int argc, char fstype[32]; char errmsg[255]; char *p, *val; - int ret; strlcpy(fstype, vfstype, sizeof(fstype)); memset(errmsg, 0, sizeof(errmsg)); @@ -129,10 +128,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "from", dev, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - - ret = nmount(iov, iovlen, mntflags); - if (ret < 0) - err(1, "%s %s", dev, errmsg); - return (ret); + if (nmount(iov, iovlen, mntflags) == -1) { + warn("%s: %s", dev, errmsg); + return (1); + } + return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 18:10:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FD92106567F; Mon, 11 Jun 2012 18:10:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF928FC1D; Mon, 11 Jun 2012 18:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BIADk6001807; Mon, 11 Jun 2012 18:10:13 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BIAD6a001805; Mon, 11 Jun 2012 18:10:13 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206111810.q5BIAD6a001805@svn.freebsd.org> From: Mateusz Guzik Date: Mon, 11 Jun 2012 18:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236903 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:10:13 -0000 Author: mjg Date: Mon Jun 11 18:10:12 2012 New Revision: 236903 URL: http://svn.freebsd.org/changeset/base/236903 Log: MFC r236738: Plug socket refcount leak on error in sys_sctp_peeloff. Modified: stable/8/sys/kern/uipc_syscalls.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Mon Jun 11 18:09:04 2012 (r236902) +++ stable/8/sys/kern/uipc_syscalls.c Mon Jun 11 18:10:12 2012 (r236903) @@ -2302,11 +2302,11 @@ sctp_peeloff(td, uap) goto done2; if (head->so_proto->pr_protocol != IPPROTO_SCTP) { error = EOPNOTSUPP; - goto done2; + goto done; } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) - goto done2; + goto done; /* * At this point we know we do have a assoc to pull * we proceed to get the fd setup. This may block From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 18:22:04 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF1AD106566B; Mon, 11 Jun 2012 18:22:04 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA9218FC0A; Mon, 11 Jun 2012 18:22:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BIM441002333; Mon, 11 Jun 2012 18:22:04 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BIM45F002331; Mon, 11 Jun 2012 18:22:04 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201206111822.q5BIM45F002331@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 11 Jun 2012 18:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236904 - stable/8/sbin/mount X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:22:04 -0000 Author: jh Date: Mon Jun 11 18:22:04 2012 New Revision: 236904 URL: http://svn.freebsd.org/changeset/base/236904 Log: MFC r230377: Don't print the nmount(2) provided error message if it is empty. Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c ============================================================================== --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:10:12 2012 (r236903) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:22:04 2012 (r236904) @@ -130,7 +130,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, mntflags) == -1) { - warn("%s: %s", dev, errmsg); + if (*errmsg != '\0') + warn("%s: %s", dev, errmsg); + else + warn("%s", dev); return (1); } return (0); From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 19:09:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C8DE106564A; Mon, 11 Jun 2012 19:09:55 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 770188FC18; Mon, 11 Jun 2012 19:09:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJ9tcY004551; Mon, 11 Jun 2012 19:09:55 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJ9tO8004549; Mon, 11 Jun 2012 19:09:55 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206111909.q5BJ9tO8004549@svn.freebsd.org> From: Isabell Long Date: Mon, 11 Jun 2012 19:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:09:55 -0000 Author: issyl0 (doc committer) Date: Mon Jun 11 19:09:55 2012 New Revision: 236908 URL: http://svn.freebsd.org/changeset/base/236908 Log: Partial merge of r213507 from head: In r178993, the ability to view a man page by giving a path to the man page itself was added, but never documented. Subsequently, the GNU-licensed man(1) and its man page were replaced by BSD licensed implementations, and later on this undocumented functionality was also added to the new BSD-licensed man(1), together with documentation. This is a merge of the documentation part of that commit (r213507) into the GNU-licensed man(1) man page in stable/8, in order to document the available functionality. PR: docs/158973 Merge help: bz Approved by: gabor (mentor) Modified: stable/8/gnu/usr.bin/man/man/man.man Directory Properties: stable/8/gnu/usr.bin/man/ (props changed) Modified: stable/8/gnu/usr.bin/man/man/man.man ============================================================================== --- stable/8/gnu/usr.bin/man/man/man.man Mon Jun 11 19:05:10 2012 (r236907) +++ stable/8/gnu/usr.bin/man/man/man.man Mon Jun 11 19:09:55 2012 (r236908) @@ -14,7 +14,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 3, 2005 +.Dd October 7, 2010 .Dt MAN 1 .Os .Sh NAME @@ -233,6 +233,13 @@ printed. Do not actually display the man pages, but do print the location(s) of the files that would be formatted or displayed. .El +.Ss Displaying Specific Manual Files +The +.Nm +utility also supports displaying a specific manual page if passed a path +to the file as long as it contains a +.Sq / +character. .Sh ENVIRONMENT .Bl -tag -width ".Ev MACHINE_ARCH" .It Ev LC_ALL , LC_CTYPE , LANG From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 19:14:22 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BFF4C1065677 for ; Mon, 11 Jun 2012 19:14:22 +0000 (UTC) (envelope-from isabell@issyl0.co.uk) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 80D108FC14 for ; Mon, 11 Jun 2012 19:14:22 +0000 (UTC) Received: by obcni5 with SMTP id ni5so9198730obc.13 for ; Mon, 11 Jun 2012 12:14:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding:x-gm-message-state; bh=YhVBomREpiaHUgWcTZuz8oPsuja3NB3x4+77FRWZ6a4=; b=SnNwYfObUrxjnn2XeS0442IYQyin4sq+HMD+LzgARjelbei+QnLBacHgullbXAG9Fh v9bsGJPuVM8WhcYfIGFmzIY/T1Bo3rL6xBujAxf/8E8Glrd1FJ5OuST33RRwgeLGJxuv 0SrGeVowNPHj9QOwzqgjLYJzQBg2Adv28NhJuasYS8KMniMPwU0Pyw6mriQtcYettNh2 ERgc7SPse3t0eoKOnKxOw6NHZ2r3TBx4LDJirE0uZOaomcJQeC+X1cWWye8PIaRoCLJA z/0IyLoSxH0ukx2SmGcU2wnW6XesOkcytvpVkZhD5zgFWrtjBN+siZpCJJIpY+TyN+fV NNog== MIME-Version: 1.0 Received: by 10.182.11.69 with SMTP id o5mr17394068obb.33.1339442061898; Mon, 11 Jun 2012 12:14:21 -0700 (PDT) Sender: isabell@issyl0.co.uk Received: by 10.76.79.37 with HTTP; Mon, 11 Jun 2012 12:14:21 -0700 (PDT) X-Originating-IP: [95.147.81.192] In-Reply-To: <201206111909.q5BJ9tO8004549@svn.freebsd.org> References: <201206111909.q5BJ9tO8004549@svn.freebsd.org> Date: Mon, 11 Jun 2012 20:14:21 +0100 X-Google-Sender-Auth: hJYCOA3ay8LkDcy8VfZ3Gkarddw Message-ID: From: Isabell Long To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnn0+h271OuYItt+v6CTkxHHMZF9ljTyzK/vQzTGuRYDgxG+p1yMHU9rj74TJlDDzQZECP5 Cc: Subject: Re: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:14:22 -0000 On Mon, Jun 11, 2012 at 8:09 PM, Isabell Long wrote: > =A0PR: =A0 =A0 =A0 =A0 =A0 docs/158973 > =A0Merge help: =A0 bz > =A0Approved by: =A0gabor (mentor) Sorry, in this and my previous commit messages, I can never seem to get the indentation right! This time, I explicitly set vi's tab length to 8 characters, and it still didn't like it, despite displaying fine in my editor before I sent the commit. Must try harder... From owner-svn-src-stable-8@FreeBSD.ORG Mon Jun 11 19:48:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBE5B106564A; Mon, 11 Jun 2012 19:48:49 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 255AC8FC18; Mon, 11 Jun 2012 19:48:49 +0000 (UTC) Received: by yhgm50 with SMTP id m50so3263101yhg.13 for ; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) 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:content-transfer-encoding; bh=FHCJweQw7uolitt5EICciULp/8otDBSsFsgp2eguQhI=; b=Ou6w8VShoHo8LNvQNzG9HqJABqw1iUUxSgDgnoPe+Ciy80I95CAyon7/9CAaxdl9SD /rLOvLDkRTIqo+kHirFQ5Ams8lJwJaDTZrQP1QqG26PEeXKuGc0/Jce0jatqXlKuusWQ qlX1cj5xdvj/zLLMFnlcUv2ejV70wga4jJUBzmtEXUktr2sPLD7okgO1VMsimbENfeAt HoFY8s945Mv1SZ+RsTixCVyM14slIthnAptHOryNo7ihhdES7whwNyCj3gvOpQKJpI7v LUbqhLDRQuRjf6NYT6WxFeeORSScNCchVdJV3a84au2sqVSmqp5gACTIokVrzbMUVkcK TAAQ== MIME-Version: 1.0 Received: by 10.50.195.234 with SMTP id ih10mr7170783igc.0.1339444128325; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) Received: by 10.64.8.170 with HTTP; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) In-Reply-To: References: <201206111909.q5BJ9tO8004549@svn.freebsd.org> Date: Mon, 11 Jun 2012 23:48:48 +0400 Message-ID: From: Sergey Kandaurov To: Isabell Long Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:48:49 -0000 On 11 June 2012 23:14, Isabell Long wrote: > On Mon, Jun 11, 2012 at 8:09 PM, Isabell Long wrote: >> =A0PR: =A0 =A0 =A0 =A0 =A0 docs/158973 >> =A0Merge help: =A0 bz >> =A0Approved by: =A0gabor (mentor) > > Sorry, in this and my previous commit messages, I can never seem to > get the indentation right! =A0This time, I explicitly set vi's tab > length to 8 characters, and it still didn't like it, despite > displaying fine in my editor before I sent the commit. =A0Must try > harder... No, it looks pretty good, at lest in both message source (tab symbols), and there http://svnweb.freebsd.org/base?view=3Drevision&revision=3D236908. It probably doesn't look well in various email and web clients which do not respect fixed width (until it is managed to display it so). --=20 wbr, pluknet From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 12 07:43:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CAEE106564A; Tue, 12 Jun 2012 07:43:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F420F8FC0C; Tue, 12 Jun 2012 07:43:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C7h1uu037621; Tue, 12 Jun 2012 07:43:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C7h1rm037619; Tue, 12 Jun 2012 07:43:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206120743.q5C7h1rm037619@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 12 Jun 2012 07:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236945 - stable/8/sys/dev/jme X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:43:02 -0000 Author: yongari Date: Tue Jun 12 07:43:01 2012 New Revision: 236945 URL: http://svn.freebsd.org/changeset/base/236945 Log: MFC r236700: Fix a logic error when use PCIY_PMG capability Modified: stable/8/sys/dev/jme/if_jme.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/jme/if_jme.c ============================================================================== --- stable/8/sys/dev/jme/if_jme.c Tue Jun 12 07:28:25 2012 (r236944) +++ stable/8/sys/dev/jme/if_jme.c Tue Jun 12 07:43:01 2012 (r236945) @@ -1669,7 +1669,7 @@ jme_resume(device_t dev) sc = device_get_softc(dev); JME_LOCK(sc); - if (pci_find_extcap(sc->jme_dev, PCIY_PMG, &pmc) != 0) { + if (pci_find_extcap(sc->jme_dev, PCIY_PMG, &pmc) == 0) { pmstat = pci_read_config(sc->jme_dev, pmc + PCIR_POWER_STATUS, 2); /* Disable PME clear PME status. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 12 07:53:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8F96106564A; Tue, 12 Jun 2012 07:53:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 937DD8FC08; Tue, 12 Jun 2012 07:53:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C7rdQ5038110; Tue, 12 Jun 2012 07:53:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C7rdHs038108; Tue, 12 Jun 2012 07:53:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206120753.q5C7rdHs038108@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 12 Jun 2012 07:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236946 - stable/8/sys/dev/ae X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:53:39 -0000 Author: yongari Date: Tue Jun 12 07:53:39 2012 New Revision: 236946 URL: http://svn.freebsd.org/changeset/base/236946 Log: MFC 236649,236670: Check the return value of pci_find_extcap() Modified: stable/8/sys/dev/ae/if_ae.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Tue Jun 12 07:43:01 2012 (r236945) +++ stable/8/sys/dev/ae/if_ae.c Tue Jun 12 07:53:39 2012 (r236946) @@ -1382,12 +1382,13 @@ ae_pm_init(ae_softc_t *sc) /* * Configure PME. */ - pci_find_extcap(sc->dev, PCIY_PMG, &pmc); - pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); - pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); - if ((ifp->if_capenable & IFCAP_WOL) != 0) - pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + if (pci_find_extcap(sc->dev, PCIY_PMG, &pmc) == 0) { + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + } } static int From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 12 08:10:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668851065670; Tue, 12 Jun 2012 08:10:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 474308FC18; Tue, 12 Jun 2012 08:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C8AFk1038924; Tue, 12 Jun 2012 08:10:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C8AFgn038919; Tue, 12 Jun 2012 08:10:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206120810.q5C8AFgn038919@svn.freebsd.org> From: Alexander Motin Date: Tue, 12 Jun 2012 08:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236948 - in stable/8/sys/dev: ahci ata mvs siis X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 08:10:15 -0000 Author: mav Date: Tue Jun 12 08:10:14 2012 New Revision: 236948 URL: http://svn.freebsd.org/changeset/base/236948 Log: MFC r236847: Partially revert r236666: Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/ahci/ahci.c Tue Jun 12 08:10:14 2012 (r236948) @@ -2963,7 +2963,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/ata/ata-all.c Tue Jun 12 08:10:14 2012 (r236948) @@ -1873,7 +1873,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/mvs/mvs.c Tue Jun 12 08:10:14 2012 (r236948) @@ -2383,7 +2383,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/siis/siis.c Tue Jun 12 08:10:14 2012 (r236948) @@ -1964,7 +1964,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->ccb_h.status = CAM_REQ_CMP; cpi->maxio = MAXPHYS; From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 12 12:10:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31784106567B; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 142E38FC14; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCABkj052396; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCABq0052394; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCABq0052394@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:12 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: stable/8/sys/amd64/amd64/trap.c Changes in other areas also in this revision: Modified: head/sys/amd64/amd64/trap.c releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/trap.c Modified: stable/8/sys/amd64/amd64/trap.c ============================================================================== --- stable/8/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/8/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -968,4 +968,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 12 20:05:22 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B12B7106566C; Tue, 12 Jun 2012 20:05:22 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B1A28FC1E; Tue, 12 Jun 2012 20:05:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CK5M0i073059; Tue, 12 Jun 2012 20:05:22 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CK5Mod073055; Tue, 12 Jun 2012 20:05:22 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206122005.q5CK5Mod073055@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 12 Jun 2012 20:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236971 - stable/8/usr.sbin/daemon X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:05:22 -0000 Author: trociny Date: Tue Jun 12 20:05:22 2012 New Revision: 236971 URL: http://svn.freebsd.org/changeset/base/236971 Log: MFC r236550, r236551: r236550: On a child exit, call waitpid(2) to clean up the process table. Submitted by: Andrey Zonov r236551: Document -r option in SYNOPSIS and usage statement. Submitted by: Andrey Zonov Modified: stable/8/usr.sbin/daemon/daemon.8 stable/8/usr.sbin/daemon/daemon.c Directory Properties: stable/8/usr.sbin/daemon/ (props changed) Modified: stable/8/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/8/usr.sbin/daemon/daemon.8 Tue Jun 12 20:04:23 2012 (r236970) +++ stable/8/usr.sbin/daemon/daemon.8 Tue Jun 12 20:05:22 2012 (r236971) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2012 +.Dd June 4, 2012 .Dt DAEMON 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cf +.Op Fl cfr .Op Fl p Ar pidfile .Op Fl u Ar user .Ar command arguments ... Modified: stable/8/usr.sbin/daemon/daemon.c ============================================================================== --- stable/8/usr.sbin/daemon/daemon.c Tue Jun 12 20:04:23 2012 (r236970) +++ stable/8/usr.sbin/daemon/daemon.c Tue Jun 12 20:05:22 2012 (r236971) @@ -217,6 +217,10 @@ wait_child(pid_t pid, sigset_t *mask) } switch (signo) { case SIGCHLD: + if (waitpid(pid, NULL, WNOHANG) == -1) { + warn("waitpid"); + return (-1); + } return (terminate); case SIGTERM: terminate = 1; @@ -236,7 +240,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: daemon [-cf] [-p pidfile] [-u user] command " + "usage: daemon [-cfr] [-p pidfile] [-u user] command " "arguments ...\n"); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 03:19:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26664106567D; Wed, 13 Jun 2012 03:19:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10CDC8FC16; Wed, 13 Jun 2012 03:19:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3JBwS092120; Wed, 13 Jun 2012 03:19:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3JBlO092118; Wed, 13 Jun 2012 03:19:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130319.q5D3JBlO092118@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236980 - stable/8/share/man/man5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:19:12 -0000 Author: eadler Date: Wed Jun 13 03:19:11 2012 New Revision: 236980 URL: http://svn.freebsd.org/changeset/base/236980 Log: MFC r236290: Document daily_status_security_chkportsum_enable PR: docs/167980 Approved by: cperciva (implicit) Modified: stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Wed Jun 13 03:18:47 2012 (r236979) +++ stable/8/share/man/man5/periodic.conf.5 Wed Jun 13 03:19:11 2012 (r236980) @@ -504,6 +504,12 @@ Set to .Dq Li YES to compare the modes and modification times of setuid executables with the previous day's values. +.It Va daily_status_security_chkportsum_enable +.Pq Vt bool +Set to +.Dq Li YES +to verify checksums of all installed packages against the known checksums in +.Pa /var/db/pkg . .It Va daily_status_security_neggrpperm_enable .Pq Vt bool Set to From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 03:30:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E382A10656E9; Wed, 13 Jun 2012 03:30:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CED008FC18; Wed, 13 Jun 2012 03:30:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3UOwr092683; Wed, 13 Jun 2012 03:30:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3UOoK092681; Wed, 13 Jun 2012 03:30:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130330.q5D3UOoK092681@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236982 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:30:25 -0000 Author: eadler Date: Wed Jun 13 03:30:24 2012 New Revision: 236982 URL: http://svn.freebsd.org/changeset/base/236982 Log: MFC r236288: Only set _w to 0 when the file stream is not currently reading. Without this fflush may fail to write data in the buffer. PR: kern/137819 Approved by: cperciva (implicit) Modified: stable/8/lib/libc/stdio/fpurge.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/fpurge.c ============================================================================== --- stable/8/lib/libc/stdio/fpurge.c Wed Jun 13 03:29:57 2012 (r236981) +++ stable/8/lib/libc/stdio/fpurge.c Wed Jun 13 03:30:24 2012 (r236982) @@ -62,7 +62,7 @@ fpurge(fp) FREEUB(fp); fp->_p = fp->_bf._base; fp->_r = 0; - fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size; + fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size; retval = 0; } FUNLOCKFILE(fp); From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 03:41:23 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2320A10657EA; Wed, 13 Jun 2012 03:41:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DFA38FC12; Wed, 13 Jun 2012 03:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3fM7R093290; Wed, 13 Jun 2012 03:41:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3fMKY093288; Wed, 13 Jun 2012 03:41:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130341.q5D3fMKY093288@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236985 - stable/8/usr.bin/mail X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:41:23 -0000 Author: eadler Date: Wed Jun 13 03:41:22 2012 New Revision: 236985 URL: http://svn.freebsd.org/changeset/base/236985 Log: MFC r236286: Fix likely race condition if wait_child() is interrupted by sigchild() PR: bin/102834 Approved by: cperciva (implicit) Modified: stable/8/usr.bin/mail/popen.c Directory Properties: stable/8/usr.bin/mail/ (props changed) Modified: stable/8/usr.bin/mail/popen.c ============================================================================== --- stable/8/usr.bin/mail/popen.c Wed Jun 13 03:40:59 2012 (r236984) +++ stable/8/usr.bin/mail/popen.c Wed Jun 13 03:41:22 2012 (r236985) @@ -364,12 +364,14 @@ wait_child(pid) int pid; { sigset_t nset, oset; - struct child *cp = findchild(pid); + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); (void)sigprocmask(SIG_BLOCK, &nset, &oset); + cp = findchild(pid); + while (!cp->done) (void)sigsuspend(&oset); wait_status = cp->status; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 15:25:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FA001065678; Wed, 13 Jun 2012 15:25:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 752718FC08; Wed, 13 Jun 2012 15:25:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DFPrab032334; Wed, 13 Jun 2012 15:25:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DFPr3o032307; Wed, 13 Jun 2012 15:25:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131525.q5DFPr3o032307@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 15:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237009 - in stable/8: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/sparc64/gen sys/amd64/acpica ... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 15:25:53 -0000 Author: jhb Date: Wed Jun 13 15:25:52 2012 New Revision: 237009 URL: http://svn.freebsd.org/changeset/base/237009 Log: MFC 230260-230262,230269,230270,230426,230429,230538,230765,230766,230864, 232520 (partial),235563: Add support for the extended FPU states on amd64, both for native 64bit and 32bit ABIs. As a side-effect, it enables AVX on capable CPUs. In particular: - Query the CPU support for XSAVE, list of the supported extensions and the required size of FPU save area. The hw.use_xsave tunable is provided for disabling XSAVE, and hw.xsave_mask may be used to select the enabled extensions. - Remove the FPU save area from PCB and dynamically allocate the (run-time sized) user save area on the top of the kernel stack, right above the PCB. Reorganize the thread0 PCB initialization to postpone it after BSP is queried for save area size. - The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as well. FPU state is only useful for suspend, where it is saved in dynamically allocated suspfpusave area. - Use XSAVE and XRSTOR to save/restore FPU state, if supported and enabled. - Define new mcontext_t flag _MC_HASFPXSTATE, indicating that mcontext_t has a valid pointer to out-of-struct extended FPU state. Signal handlers are supplied with stack-allocated fpu state. The sigreturn(2) and setcontext(2) syscall honour the flag, allowing the signal handlers to inspect and manipilate extended state in the interrupted context. - The getcontext(2) never returns extended state, since there is no place in the fixed-sized mcontext_t to place variable-sized save area. And, since mcontext_t is embedded into ucontext_t, makes it impossible to fix in a reasonable way. Provide a sysarch(2) facility to query extended FPU state. - Add API for obtaining extended machine context states that cannot be fit into existing mcontext_t. On i386 and amd64 return the extended FPU states using getcontextx(3). For other architectures, getcontextx(3) returns the same information as getcontext(2). - Add ptrace(2) support for getting and setting extended state; while there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries. - Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to consumers, making it opaque. Internally, struct fpu_kern_ctx now contains a space for the extended state. Convert in-kernel consumers of fpu_kern KPI both on i386 and amd64. Reviewed by: kib Added: stable/8/lib/libc/amd64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/amd64/gen/getcontextx.c stable/8/lib/libc/arm/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/arm/gen/getcontextx.c stable/8/lib/libc/i386/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/i386/gen/getcontextx.c stable/8/lib/libc/ia64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/ia64/gen/getcontextx.c stable/8/lib/libc/mips/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/mips/gen/getcontextx.c stable/8/lib/libc/powerpc/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/powerpc/gen/getcontextx.c stable/8/lib/libc/sparc64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/sparc64/gen/getcontextx.c stable/8/sys/amd64/amd64/ptrace_machdep.c - copied, changed from r230426, head/sys/amd64/amd64/ptrace_machdep.c Modified: stable/8/lib/libc/amd64/gen/Makefile.inc stable/8/lib/libc/arm/gen/Makefile.inc stable/8/lib/libc/gen/Symbol.map stable/8/lib/libc/gen/getcontext.3 stable/8/lib/libc/gen/ucontext.3 stable/8/lib/libc/i386/gen/Makefile.inc stable/8/lib/libc/ia64/gen/Makefile.inc stable/8/lib/libc/mips/gen/Makefile.inc stable/8/lib/libc/powerpc/gen/Makefile.inc stable/8/lib/libc/sparc64/gen/Makefile.inc stable/8/sys/amd64/acpica/acpi_switch.S stable/8/sys/amd64/acpica/acpi_wakecode.S stable/8/sys/amd64/acpica/acpi_wakeup.c stable/8/sys/amd64/amd64/cpu_switch.S stable/8/sys/amd64/amd64/fpu.c stable/8/sys/amd64/amd64/genassym.c stable/8/sys/amd64/amd64/initcpu.c stable/8/sys/amd64/amd64/machdep.c stable/8/sys/amd64/amd64/mp_machdep.c stable/8/sys/amd64/amd64/sys_machdep.c stable/8/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/vm_machdep.c stable/8/sys/amd64/ia32/ia32_reg.c stable/8/sys/amd64/ia32/ia32_signal.c stable/8/sys/amd64/include/fpu.h stable/8/sys/amd64/include/frame.h stable/8/sys/amd64/include/md_var.h stable/8/sys/amd64/include/pcb.h stable/8/sys/amd64/include/pcpu.h stable/8/sys/amd64/include/ptrace.h stable/8/sys/amd64/include/signal.h stable/8/sys/amd64/include/specialreg.h stable/8/sys/amd64/include/sysarch.h stable/8/sys/amd64/include/ucontext.h stable/8/sys/compat/ia32/ia32_signal.h stable/8/sys/conf/files.amd64 stable/8/sys/crypto/aesni/aesni.c stable/8/sys/crypto/aesni/aesni.h stable/8/sys/crypto/aesni/aesni_wrap.c stable/8/sys/crypto/via/padlock.c stable/8/sys/crypto/via/padlock.h stable/8/sys/crypto/via/padlock_cipher.c stable/8/sys/crypto/via/padlock_hash.c stable/8/sys/dev/random/nehemiah.c stable/8/sys/i386/i386/machdep.c stable/8/sys/i386/include/npx.h stable/8/sys/i386/include/ptrace.h stable/8/sys/i386/include/signal.h stable/8/sys/i386/include/specialreg.h stable/8/sys/i386/include/sysarch.h stable/8/sys/i386/include/ucontext.h stable/8/sys/i386/isa/npx.c stable/8/sys/pc98/pc98/machdep.c stable/8/sys/sys/ucontext.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) stable/8/lib/libc/uuid/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/lib/libc/amd64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/amd64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/amd64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,7 +2,7 @@ # $FreeBSD$ SRCS+= _setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ - fabs.S modf.S \ + fabs.S getcontextx.c modf.S \ infinity.c ldexp.c makecontext.c signalcontext.c \ flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ fpgetround.c fpsetround.c fpgetsticky.c Copied and modified: stable/8/lib/libc/amd64/gen/getcontextx.c (from r230429, head/lib/libc/amd64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/amd64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/amd64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); static int xstate_sz = -1; -size_t +int __getcontextx_size(void) { u_int p[4]; Modified: stable/8/lib/libc/arm/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/arm/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/arm/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ # $FreeBSD$ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ - infinity.c ldexp.c makecontext.c modf.c \ + getcontextx.c infinity.c ldexp.c makecontext.c modf.c \ setjmp.S signalcontext.c sigsetjmp.S divsi3.S Copied and modified: stable/8/lib/libc/arm/gen/getcontextx.c (from r230429, head/lib/libc/arm/gen/getcontextx.c) ============================================================================== --- head/lib/libc/arm/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/arm/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/gen/Symbol.map ============================================================================== --- stable/8/lib/libc/gen/Symbol.map Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/Symbol.map Wed Jun 13 15:25:52 2012 (r237009) @@ -371,6 +371,7 @@ FBSD_1.2 { FBSD_1.3 { __FreeBSD_libc_enter_restricted_mode; + getcontextx; }; FBSDprivate_1.0 { @@ -487,4 +488,6 @@ FBSDprivate_1.0 { _wait; __waitpid; _waitpid; + __fillcontextx; + __getcontextx_size; }; Modified: stable/8/lib/libc/gen/getcontext.3 ============================================================================== --- stable/8/lib/libc/gen/getcontext.3 Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/getcontext.3 Wed Jun 13 15:25:52 2012 (r237009) @@ -35,11 +35,11 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2002 +.Dd December 26, 2011 .Dt GETCONTEXT 3 .Os .Sh NAME -.Nm getcontext , setcontext +.Nm getcontext , getcontextx , setcontext .Nd get and set user thread context .Sh LIBRARY .Lb libc @@ -59,6 +59,20 @@ This saved context may then later be res .Fn setcontext . .Pp The +.Fn getcontextx +function saves the current execution context in the newly allocated structure +.Vt ucontext_t , +which is returned on success. +If architecture defines additional CPU states that can be stored in extended +blocks referenced from the +.Vt ucontext_t , +the memory for them may be allocated and their context also stored. +Memory returned by +.Fn getcontextx +function shall be freed using +.Fn free 3 . +.Pp +The .Fn setcontext function makes a previously saved thread context the current thread context, i.e., @@ -109,11 +123,24 @@ If successful, returns zero and .Fn setcontext does not return; otherwise \-1 is returned. +The +.Fn getcontextx +returns pointer to the allocated and initialized context on success, and +.Va NULL +on failure. .Sh ERRORS No errors are defined for .Fn getcontext or .Fn setcontext . +The +.Fn getcontextx +may return the following errors in +.Va errno : +.Bl -tag -width Er +.It Bq Er ENOMEM +No memory was available to allocate for the context or some extended state. +.El .Sh SEE ALSO .Xr sigaction 2 , .Xr sigaltstack 2 , Modified: stable/8/lib/libc/gen/ucontext.3 ============================================================================== --- stable/8/lib/libc/gen/ucontext.3 Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/ucontext.3 Wed Jun 13 15:25:52 2012 (r237009) @@ -92,6 +92,9 @@ structures: .Ft int .Fn getcontext "ucontext_t *" ; .It +.Ft "ucontext_t *" +.Fn getcontextx "void" ; +.It .Ft int .Fn setcontext "const ucontext_t *" ; .It @@ -104,4 +107,5 @@ structures: .Sh SEE ALSO .Xr sigaltstack 2 , .Xr getcontext 3 , +.Xr getcontextx 3 , .Xr makecontext 3 Modified: stable/8/lib/libc/i386/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/i386/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/i386/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ # $FreeBSD$ SRCS+= _ctx_start.S _setjmp.S _set_tp.c fabs.S \ - flt_rounds.c infinity.c ldexp.c makecontext.c modf.S \ + flt_rounds.c getcontextx.c infinity.c ldexp.c makecontext.c modf.S \ rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S Copied and modified: stable/8/lib/libc/i386/gen/getcontextx.c (from r230429, head/lib/libc/i386/gen/getcontextx.c) ============================================================================== --- head/lib/libc/i386/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/i386/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); static int xstate_sz = -1; -size_t +int __getcontextx_size(void) { u_int p[4]; Modified: stable/8/lib/libc/ia64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/ia64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/ia64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -3,8 +3,8 @@ SRCS+= __divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \ __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _mcount.S _set_tp.c \ _setjmp.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \ - fpsetround.c infinity.c ldexp.c makecontext.c modf.c setjmp.S \ - signalcontext.c sigsetjmp.S + fpsetround.c getcontextx.c infinity.c ldexp.c makecontext.c modf.c \ + setjmp.S signalcontext.c sigsetjmp.S # The following may go away if function _Unwind_FindTableEntry() # will be part of GCC. Copied and modified: stable/8/lib/libc/ia64/gen/getcontextx.c (from r230429, head/lib/libc/ia64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/ia64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/ia64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/mips/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/mips/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/mips/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -6,4 +6,5 @@ SRCS+= infinity.c fabs.c ldexp.c modf.c # SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ # fpsetround.c fpsetsticky.c -SRCS+= _ctx_start.S _set_tp.c _setjmp.S makecontext.c setjmp.S signalcontext.c sigsetjmp.S +SRCS+= _ctx_start.S _set_tp.c _setjmp.S getcontextx.c makecontext.c \ + setjmp.S signalcontext.c sigsetjmp.S Copied and modified: stable/8/lib/libc/mips/gen/getcontextx.c (from r230429, head/lib/libc/mips/gen/getcontextx.c) ============================================================================== --- head/lib/libc/mips/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/mips/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/powerpc/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/powerpc/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/powerpc/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -1,7 +1,7 @@ # $FreeBSD$ SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \ infinity.c ldexp.c makecontext.c modf.c _setjmp.S \ setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ _set_tp.c Copied and modified: stable/8/lib/libc/powerpc/gen/getcontextx.c (from r230429, head/lib/libc/powerpc/gen/getcontextx.c) ============================================================================== --- head/lib/libc/powerpc/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/powerpc/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/sparc64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/sparc64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/sparc64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ SRCS+= _ctx_start.S _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpgetmask.c \ fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c modf.S \ + getcontextx.c infinity.c ldexp.c makecontext.c modf.S \ signalcontext.c setjmp.S sigsetjmp.S _set_tp.c Copied and modified: stable/8/lib/libc/sparc64/gen/getcontextx.c (from r230429, head/lib/libc/sparc64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/sparc64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/sparc64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/sys/amd64/acpica/acpi_switch.S ============================================================================== --- stable/8/sys/amd64/acpica/acpi_switch.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_switch.S Wed Jun 13 15:25:52 2012 (r237009) @@ -146,11 +146,22 @@ ENTRY(acpi_restorecpu) /* Restore FPU state. */ fninit - fxrstor PCB_USERFPU(%rdi) + movq WAKEUP_CTX(fpusave),%rdi + cmpl $0,use_xsave + jne 1f + fxrstor (%rdi) + jmp 2f +1: movl xsave_mask,%eax + movl xsave_mask+4,%edx +/* xrstor (%rdi) */ + .byte 0x0f,0xae,0x2f +2: /* Reload CR0. */ movq %rcx, %cr0 + movq WAKEUP_CTX(pcb),%rdi + /* Restore return address. */ movq PCB_RIP(%rdi), %rax movq %rax, (%rsp) Modified: stable/8/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- stable/8/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 15:25:52 2012 (r237009) @@ -270,6 +270,8 @@ wakeup_pcb: wakeup_gdt: .word 0 .quad 0 +wakeup_fpusave: + .quad 0 ALIGN_DATA wakeup_efer: Modified: stable/8/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- stable/8/sys/amd64/acpica/acpi_wakeup.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_wakeup.c Wed Jun 13 15:25:52 2012 (r237009) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef SMP #include @@ -67,8 +68,10 @@ extern int acpi_reset_video; #ifdef SMP extern struct pcb **susppcbs; +extern void **suspfpusave; #else static struct pcb **susppcbs; +static void **suspfpusave; #endif int acpi_restorecpu(vm_offset_t, struct pcb *); @@ -105,6 +108,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, in int ms; WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[cpu]); + WAKECODE_FIXUP(wakeup_fpusave, void *, suspfpusave[cpu]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[cpu]->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, susppcbs[cpu]->pcb_gdt.rd_base); @@ -243,6 +247,7 @@ acpi_sleep_machdep(struct acpi_softc *sc load_cr3(KPML4phys); if (savectx(susppcbs[0])) { + ctx_fpusave(suspfpusave[0]); #ifdef SMP if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) { device_printf(sc->acpi_dev, @@ -256,6 +261,7 @@ acpi_sleep_machdep(struct acpi_softc *sc WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]); + WAKECODE_FIXUP(wakeup_fpusave, void *, suspfpusave[0]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[0]->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, @@ -333,8 +339,11 @@ acpi_alloc_wakeup_handler(void) return (NULL); } susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); - for (i = 0; i < mp_ncpus; i++) + suspfpusave = malloc(mp_ncpus * sizeof(void *), M_DEVBUF, M_WAITOK); + for (i = 0; i < mp_ncpus; i++) { susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); + suspfpusave[i] = alloc_fpusave(M_WAITOK); + } return (wakeaddr); } Modified: stable/8/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/8/sys/amd64/amd64/cpu_switch.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/cpu_switch.S Wed Jun 13 15:25:52 2012 (r237009) @@ -112,16 +112,25 @@ done_store_dr: /* have we used fp, and need a save? */ cmpq %rdi,PCPU(FPCURTHREAD) - jne 1f + jne 3f movq PCB_SAVEFPU(%r8),%r8 clts + cmpl $0,use_xsave + jne 1f fxsave (%r8) - smsw %ax + jmp 2f +1: movq %rdx,%rcx + movl xsave_mask,%eax + movl xsave_mask+4,%edx +/* xsave (%r8) */ + .byte 0x41,0x0f,0xae,0x20 + movq %rcx,%rdx +2: smsw %ax orb $CR0_TS,%al lmsw %ax xorl %eax,%eax movq %rax,PCPU(FPCURTHREAD) -1: +3: /* Save is done. Now fire up new thread. Leave old vmspace. */ movq TD_PCB(%rsi),%r8 @@ -354,10 +363,19 @@ ENTRY(savectx) sldt PCB_LDT(%rdi) str PCB_TR(%rdi) - clts - fxsave PCB_USERFPU(%rdi) - movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ +2: movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ movl $1,%eax ret END(savectx) + +/* + * Wrapper around fpusave to care about TS0_CR. + */ +ENTRY(ctx_fpusave) + movq %cr0,%rsi + clts + call fpusave + movq %rsi,%cr0 + ret +END(ctx_fpusave) Modified: stable/8/sys/amd64/amd64/fpu.c ============================================================================== --- stable/8/sys/amd64/amd64/fpu.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/fpu.c Wed Jun 13 15:25:52 2012 (r237009) @@ -78,6 +78,41 @@ __FBSDID("$FreeBSD$"); : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm __volatile("clts") +static __inline void +xrstor(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xrstor (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x2f" : : + "a" (low), "d" (hi), "D" (addr)); +} + +static __inline void +xsave(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xsave (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x27" : : + "a" (low), "d" (hi), "D" (addr) : "memory"); +} + +static __inline void +xsetbv(uint32_t reg, uint64_t val) +{ + uint32_t low, hi; + + low = val; + hi = val >> 32; + __asm __volatile(".byte 0x0f,0x01,0xd1" : : + "c" (reg), "a" (low), "d" (hi)); +} + #else /* !(__GNUCLIKE_ASM && !lint) */ void fldcw(u_short cw); @@ -90,25 +125,106 @@ void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); void start_emulating(void); void stop_emulating(void); +void xrstor(char *addr, uint64_t mask); +void xsave(char *addr, uint64_t mask); +void xsetbv(uint32_t reg, uint64_t val); #endif /* __GNUCLIKE_ASM && !lint */ #define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) #define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) -typedef u_char bool_t; +CTASSERT(sizeof(struct savefpu) == 512); +CTASSERT(sizeof(struct xstate_hdr) == 64); +CTASSERT(sizeof(struct savefpu_ymm) == 832); + +/* + * This requirement is to make it easier for asm code to calculate + * offset of the fpu save area from the pcb address. FPU save area + * must by 64-bytes aligned. + */ +CTASSERT(sizeof(struct pcb) % XSAVE_AREA_ALIGN == 0); static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, NULL, 1, "Floating point instructions executed in hardware"); -static struct savefpu fpu_initialstate; +int use_xsave; /* non-static for cpu_switch.S */ +uint64_t xsave_mask; /* the same */ +static struct savefpu *fpu_initialstate; + +void +fpusave(void *addr) +{ + + if (use_xsave) + xsave((char *)addr, xsave_mask); + else + fxsave((char *)addr); +} + +static void +fpurestore(void *addr) +{ + + if (use_xsave) + xrstor((char *)addr, xsave_mask); + else + fxrstor((char *)addr); +} /* - * Initialize the floating point unit. On the boot CPU we generate a - * clean state that is used to initialize the floating point unit when - * it is first used by a process. + * Enable XSAVE if supported and allowed by user. + * Calculate the xsave_mask. + */ +static void +fpuinit_bsp1(void) +{ + u_int cp[4]; + uint64_t xsave_mask_user; + + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { + use_xsave = 1; + TUNABLE_INT_FETCH("hw.use_xsave", &use_xsave); + } + if (!use_xsave) + return; + + cpuid_count(0xd, 0x0, cp); + xsave_mask = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; + if ((cp[0] & xsave_mask) != xsave_mask) + panic("CPU0 does not support X87 or SSE: %x", cp[0]); + xsave_mask = ((uint64_t)cp[3] << 32) | cp[0]; + xsave_mask_user = xsave_mask; + TUNABLE_ULONG_FETCH("hw.xsave_mask", &xsave_mask_user); + xsave_mask_user |= XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; + xsave_mask &= xsave_mask_user; +} + +/* + * Calculate the fpu save area size. + */ +static void +fpuinit_bsp2(void) +{ + u_int cp[4]; + + if (use_xsave) { + cpuid_count(0xd, 0x0, cp); + cpu_max_ext_state_size = cp[1]; + + /* + * Reload the cpu_feature2, since we enabled OSXSAVE. + */ + do_cpuid(1, cp); + cpu_feature2 = cp[2]; + } else + cpu_max_ext_state_size = sizeof(struct savefpu); +} + +/* + * Initialize the floating point unit. */ void fpuinit(void) @@ -117,6 +233,20 @@ fpuinit(void) u_int mxcsr; u_short control; + if (IS_BSP()) + fpuinit_bsp1(); + + if (use_xsave) { + load_cr4(rcr4() | CR4_XSAVE); + xsetbv(XCR0, xsave_mask); + } + + /* + * XCR0 shall be set up before CPU can report the save area size. + */ + if (IS_BSP()) + fpuinit_bsp2(); + /* * It is too early for critical_enter() to work on AP. */ @@ -127,20 +257,46 @@ fpuinit(void) fldcw(control); mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); - if (PCPU_GET(cpuid) == 0) { - fxsave(&fpu_initialstate); - if (fpu_initialstate.sv_env.en_mxcsr_mask) - cpu_mxcsr_mask = fpu_initialstate.sv_env.en_mxcsr_mask; - else - cpu_mxcsr_mask = 0xFFBF; - bzero(fpu_initialstate.sv_fp, sizeof(fpu_initialstate.sv_fp)); - bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); - } start_emulating(); intr_restore(saveintr); } /* + * On the boot CPU we generate a clean state that is used to + * initialize the floating point unit when it is first used by a + * process. + */ +static void +fpuinitstate(void *arg __unused) +{ + register_t saveintr; + + fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, + M_WAITOK | M_ZERO); + saveintr = intr_disable(); + stop_emulating(); + + fpusave(fpu_initialstate); + if (fpu_initialstate->sv_env.en_mxcsr_mask) + cpu_mxcsr_mask = fpu_initialstate->sv_env.en_mxcsr_mask; + else + cpu_mxcsr_mask = 0xFFBF; + + /* + * The fninit instruction does not modify XMM registers. The + * fpusave call dumped the garbage contained in the registers + * after reset to the initial state saved. Clear XMM + * registers file image to make the startup program state and + * signal handler XMM register content predictable. + */ + bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc)); + + start_emulating(); + intr_restore(saveintr); +} +SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL); + +/* * Free coprocessor (if we have it). */ void @@ -150,7 +306,7 @@ fpuexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fxsave(PCPU_GET(curpcb)->pcb_save); + fpusave(PCPU_GET(curpcb)->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -423,7 +579,7 @@ fpudna(void) * the PCB doesn't contain a clean FPU state. Explicitly * load an initial state. */ - fxrstor(&fpu_initialstate); + fpurestore(fpu_initialstate); if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(pcb->pcb_initial_fpucw); if (PCB_USER_FPU(pcb)) @@ -432,7 +588,7 @@ fpudna(void) else set_pcb_flags(pcb, PCB_FPUINITDONE); } else - fxrstor(pcb->pcb_save); + fpurestore(pcb->pcb_save); critical_exit(); } @@ -461,15 +617,16 @@ fpugetregs(struct thread *td) pcb = td->td_pcb; if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { - bcopy(&fpu_initialstate, &pcb->pcb_user_save, - sizeof(fpu_initialstate)); - pcb->pcb_user_save.sv_env.en_cw = pcb->pcb_initial_fpucw; + bcopy(fpu_initialstate, get_pcb_user_save_pcb(pcb), + cpu_max_ext_state_size); + get_pcb_user_save_pcb(pcb)->sv_env.en_cw = + pcb->pcb_initial_fpucw; fpuuserinited(td); return (_MC_FPOWNED_PCB); } critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxsave(&pcb->pcb_user_save); + fpusave(get_pcb_user_save_pcb(pcb)); critical_exit(); return (_MC_FPOWNED_FPU); } else { @@ -491,25 +648,78 @@ fpuuserinited(struct thread *td) set_pcb_flags(pcb, PCB_FPUINITDONE); } +int +fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size) +{ + struct xstate_hdr *hdr, *ehdr; + size_t len, max_len; + uint64_t bv; + + /* XXXKIB should we clear all extended state in xstate_bv instead ? */ + if (xfpustate == NULL) + return (0); + if (!use_xsave) + return (EOPNOTSUPP); + + len = xfpustate_size; + if (len < sizeof(struct xstate_hdr)) + return (EINVAL); + max_len = cpu_max_ext_state_size - sizeof(struct savefpu); + if (len > max_len) + return (EINVAL); + + ehdr = (struct xstate_hdr *)xfpustate; + bv = ehdr->xstate_bv; + + /* + * Avoid #gp. + */ + if (bv & ~xsave_mask) + return (EINVAL); + if ((bv & (XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE)) != + (XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE)) + return (EINVAL); + + hdr = (struct xstate_hdr *)(get_pcb_user_save_td(td) + 1); + + hdr->xstate_bv = bv; + bcopy(xfpustate + sizeof(struct xstate_hdr), + (char *)(hdr + 1), len - sizeof(struct xstate_hdr)); + + return (0); +} + /* * Set the state of the FPU. */ -void -fpusetregs(struct thread *td, struct savefpu *addr) +int +fpusetregs(struct thread *td, struct savefpu *addr, char *xfpustate, + size_t xfpustate_size) { struct pcb *pcb; + int error; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxrstor(addr); + error = fpusetxstate(td, xfpustate, xfpustate_size); + if (error != 0) { + critical_exit(); + return (error); + } + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurestore(get_pcb_user_save_td(td)); critical_exit(); set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); } else { critical_exit(); - bcopy(addr, &td->td_pcb->pcb_user_save, sizeof(*addr)); + error = fpusetxstate(td, xfpustate, xfpustate_size); + if (error != 0) + return (error); + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); fpuuserinited(td); } + return (0); } /* @@ -599,20 +809,62 @@ static devclass_t fpupnp_devclass; DRIVER_MODULE(fpupnp, acpi, fpupnp_driver, fpupnp_devclass, 0, 0); #endif /* DEV_ISA */ +static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", + "Kernel contexts for FPU state"); + +#define FPU_KERN_CTX_FPUINITDONE 0x01 + +struct fpu_kern_ctx { + struct savefpu *prev; + uint32_t flags; + char hwstate1[]; +}; + +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + struct fpu_kern_ctx *res; + size_t sz; + + sz = sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + + cpu_max_ext_state_size; + res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ? + M_NOWAIT : M_WAITOK) | M_ZERO); + return (res); +} + +void +fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) +{ + + /* XXXKIB clear the memory ? */ + free(ctx, M_FPUKERN_CTX); +} + +static struct savefpu * +fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx) +{ + vm_offset_t p; + + p = (vm_offset_t)&ctx->hwstate1; + p = roundup2(p, XSAVE_AREA_ALIGN); + return ((struct savefpu *)p); +} + int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; pcb = td->td_pcb; - KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == &pcb->pcb_user_save, - ("mangled pcb_save")); + KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == + get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = 0; if ((pcb->pcb_flags & PCB_FPUINITDONE) != 0) ctx->flags |= FPU_KERN_CTX_FPUINITDONE; fpuexit(td); ctx->prev = pcb->pcb_save; - pcb->pcb_save = &ctx->hwstate; + pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); return (0); @@ -629,7 +881,7 @@ fpu_kern_leave(struct thread *td, struct fpudrop(); critical_exit(); pcb->pcb_save = ctx->prev; - if (pcb->pcb_save == &pcb->pcb_user_save) { + if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) { set_pcb_flags(pcb, PCB_FPUINITDONE); clear_pcb_flags(pcb, PCB_KERNFPU); @@ -653,7 +905,8 @@ fpu_kern_thread(u_int flags) pcb = PCPU_GET(curpcb); KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); - KASSERT(pcb->pcb_save == &pcb->pcb_user_save, ("mangled pcb_save")); + KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), + ("mangled pcb_save")); KASSERT(PCB_USER_FPU(pcb), ("recursive call")); set_pcb_flags(pcb, PCB_KERNFPU); Modified: stable/8/sys/amd64/amd64/genassym.c ============================================================================== --- stable/8/sys/amd64/amd64/genassym.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/genassym.c Wed Jun 13 15:25:52 2012 (r237009) @@ -156,7 +156,7 @@ ASSYM(PCB_GS32SD, offsetof(struct pcb, p ASSYM(PCB_TSSP, offsetof(struct pcb, pcb_tssp)); ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save)); ASSYM(PCB_SAVEFPU_SIZE, sizeof(struct savefpu)); -ASSYM(PCB_USERFPU, offsetof(struct pcb, pcb_user_save)); +ASSYM(PCB_USERFPU, sizeof(struct pcb)); ASSYM(PCB_SIZE, sizeof(struct pcb)); ASSYM(PCB_FULL_IRET, PCB_FULL_IRET); ASSYM(PCB_DBREGS, PCB_DBREGS); Modified: stable/8/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/initcpu.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/initcpu.c Wed Jun 13 15:25:52 2012 (r237009) @@ -72,6 +72,7 @@ u_int cpu_vendor_id; /* CPU vendor ID * u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; +u_int cpu_max_ext_state_size; SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, &via_feature_rng, 0, "VIA C3/C7 RNG feature available in CPU"); Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/machdep.c Wed Jun 13 15:25:52 2012 (r237009) @@ -149,8 +149,10 @@ extern void panicifcpuunsupported(void); #define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) static void cpu_startup(void *); -static void get_fpcontext(struct thread *td, mcontext_t *mcp); -static int set_fpcontext(struct thread *td, const mcontext_t *mcp); +static void get_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpusave, size_t xfpusave_len); +static int set_fpcontext(struct thread *td, const mcontext_t *mcp, + char *xfpustate, size_t xfpustate_len); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); #ifdef DDB @@ -305,6 +307,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, struct sigacts *psp; char *sp; struct trapframe *regs; + char *xfpusave; + size_t xfpusave_len; int sig; int oonstack; @@ -318,6 +322,14 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); + if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { + xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); + xfpusave = __builtin_alloca(xfpusave_len); + } else { + xfpusave_len = 0; + xfpusave = NULL; + } + /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -327,7 +339,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - get_fpcontext(td, &sf.sf_uc.uc_mcontext); + get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); fpstate_drop(td); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; @@ -338,13 +350,18 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { - sp = td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - sizeof(struct sigframe); + sp = td->td_sigstk.ss_sp + td->td_sigstk.ss_size; #if defined(COMPAT_43) td->td_sigstk.ss_flags |= SS_ONSTACK; #endif } else - sp = (char *)regs->tf_rsp - sizeof(struct sigframe) - 128; + sp = (char *)regs->tf_rsp - 128; + if (xfpusave != NULL) { + sp -= xfpusave_len; + sp = (char *)((unsigned long)sp & ~0x3Ful); + sf.sf_uc.uc_mcontext.mc_xfpustate = (register_t)sp; + } + sp -= sizeof(struct sigframe); /* Align to 16 bytes. */ sfp = (struct sigframe *)((unsigned long)sp & ~0xFul); @@ -377,7 +394,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, /* * Copy the sigframe out to the user's stack. */ - if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { + if (copyout(&sf, sfp, sizeof(*sfp)) != 0 || + (xfpusave != NULL && copyout(xfpusave, + (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) + != 0)) { #ifdef DEBUG printf("process %ld has trashed its stack\n", (long)p->p_pid); #endif @@ -422,6 +442,8 @@ sigreturn(td, uap) struct proc *p; struct trapframe *regs; ucontext_t *ucp; + char *xfpustate; + size_t xfpustate_len; long rflags; int cs, error, ret; ksiginfo_t ksi; @@ -480,7 +502,28 @@ sigreturn(td, uap) return (EINVAL); } - ret = set_fpcontext(td, &ucp->uc_mcontext); + if ((uc.uc_mcontext.mc_flags & _MC_HASFPXSTATE) != 0) { + xfpustate_len = uc.uc_mcontext.mc_xfpustate_len; + if (xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) { + uprintf("pid %d (%s): sigreturn xfpusave_len = 0x%zx\n", + p->p_pid, td->td_name, xfpustate_len); + return (EINVAL); + } + xfpustate = __builtin_alloca(xfpustate_len); + error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, + xfpustate, xfpustate_len); + if (error != 0) { + uprintf( + "pid %d (%s): sigreturn copying xfpustate failed\n", + p->p_pid, td->td_name); + return (error); + } + } else { + xfpustate = NULL; + xfpustate_len = 0; + } + ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", p->p_pid, td->td_name, ret); @@ -1543,6 +1586,7 @@ hammer_time(u_int64_t modulep, u_int64_t int gsel_tss, x; struct pcpu *pc; struct nmi_pcpu *np; + struct xstate_hdr *xhdr; u_int64_t msr; char *env; size_t kstack0_sz; @@ -1552,7 +1596,6 @@ hammer_time(u_int64_t modulep, u_int64_t kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; bzero((void *)thread0.td_kstack, kstack0_sz); physfree += kstack0_sz; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack + kstack0_sz) - 1; /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 17:45:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86A4F106564A; Wed, 13 Jun 2012 17:45:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 710A18FC08; Wed, 13 Jun 2012 17:45:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DHjd17039231; Wed, 13 Jun 2012 17:45:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DHjdaA039229; Wed, 13 Jun 2012 17:45:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131745.q5DHjdaA039229@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 17:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237014 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:45:39 -0000 Author: jhb Date: Wed Jun 13 17:45:38 2012 New Revision: 237014 URL: http://svn.freebsd.org/changeset/base/237014 Log: Restore 229262 which was accidentally reverted in a prior change: Implement BUS_ADD_CHILD() for the isab(4) driver. Submitted by: fabient Modified: stable/8/sys/dev/pci/isa_pci.c Modified: stable/8/sys/dev/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Wed Jun 13 17:18:16 2012 (r237013) +++ stable/8/sys/dev/pci/isa_pci.c Wed Jun 13 17:45:38 2012 (r237014) @@ -57,6 +57,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), From owner-svn-src-stable-8@FreeBSD.ORG Wed Jun 13 20:34:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41C41065703; Wed, 13 Jun 2012 20:34:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id DD17F8FC0A; Wed, 13 Jun 2012 20:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DKYECv047212; Wed, 13 Jun 2012 20:34:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DKYEwA047210; Wed, 13 Jun 2012 20:34:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206132034.q5DKYEwA047210@svn.freebsd.org> From: Alexander Motin Date: Wed, 13 Jun 2012 20:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237024 - stable/8/lib/libc/arm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 20:34:15 -0000 Author: mav Date: Wed Jun 13 20:34:14 2012 New Revision: 237024 URL: http://svn.freebsd.org/changeset/base/237024 Log: MFC r230188i (by das): Correct some bugs that resulted from arm/_fpmath.h being blindly copied from the x86 version, which has a completely different long double format. Modified: stable/8/lib/libc/arm/_fpmath.h Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/arm/_fpmath.h ============================================================================== --- stable/8/lib/libc/arm/_fpmath.h Wed Jun 13 20:31:30 2012 (r237023) +++ stable/8/lib/libc/arm/_fpmath.h Wed Jun 13 20:34:14 2012 (r237024) @@ -55,9 +55,10 @@ union IEEEl2bits { }; #define LDBL_NBIT 0 +#define LDBL_IMPLICIT_NBIT #define mask_nbit_l(u) ((void)0) -#define LDBL_MANH_SIZE 32 +#define LDBL_MANH_SIZE 20 #define LDBL_MANL_SIZE 32 #define LDBL_TO_ARRAY32(u, a) do { \ From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 06:55:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 984C91065847; Thu, 14 Jun 2012 06:55:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 33BBC8FC14; Thu, 14 Jun 2012 06:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6tHH4076733; Thu, 14 Jun 2012 06:55:17 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6tHeK076731; Thu, 14 Jun 2012 06:55:17 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206140655.q5E6tHeK076731@svn.freebsd.org> From: Eitan Adler Date: Thu, 14 Jun 2012 06:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237050 - stable/8/usr.sbin/mptutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:55:17 -0000 Author: eadler Date: Thu Jun 14 06:55:16 2012 New Revision: 237050 URL: http://svn.freebsd.org/changeset/base/237050 Log: MFC r236287: add missing variable declaration when DEBUG is defined forgotten in r215046 PR: bin/166404 Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/mptutil/mpt_show.c Directory Properties: stable/8/usr.sbin/mptutil/ (props changed) Modified: stable/8/usr.sbin/mptutil/mpt_show.c ============================================================================== --- stable/8/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:54:48 2012 (r237049) +++ stable/8/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:55:16 2012 (r237050) @@ -538,7 +538,7 @@ show_physdisks(int ac, char **av) { CONFIG_PAGE_RAID_PHYS_DISK_0 *pinfo; U16 IOCStatus; - int fd, i; + int error, fd, i; if (ac != 1) { warnx("show drives: extra arguments"); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 11:21:22 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35BF81065675; Thu, 14 Jun 2012 11:21:22 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 207628FC1F; Thu, 14 Jun 2012 11:21:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EBLLCi090971; Thu, 14 Jun 2012 11:21:21 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EBLLZ3090968; Thu, 14 Jun 2012 11:21:21 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201206141121.q5EBLLZ3090968@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 14 Jun 2012 11:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237059 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 11:21:22 -0000 Author: pluknet Date: Thu Jun 14 11:21:21 2012 New Revision: 237059 URL: http://svn.freebsd.org/changeset/base/237059 Log: MFC r234188,r234463,r234465: - Update the swi_add prototype after struct ithd was split up into struct intr_event and struct intr_thread. [1] - Update the rest of struct ithd references. - net_ih and softclock_ih cookies have gone away. - Document swi_remove(9). PR: docs/166864 [1] Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/swi.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Thu Jun 14 11:20:22 2012 (r237058) +++ stable/8/share/man/man9/Makefile Thu Jun 14 11:21:21 2012 (r237059) @@ -1206,6 +1206,7 @@ MLINKS+=store.9 subyte.9 \ store.9 suword32.9 \ store.9 suword64.9 MLINKS+=swi.9 swi_add.9 \ + swi.9 swi_remove.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_destroy.9 \ Modified: stable/8/share/man/man9/swi.9 ============================================================================== --- stable/8/share/man/man9/swi.9 Thu Jun 14 11:20:22 2012 (r237058) +++ stable/8/share/man/man9/swi.9 Thu Jun 14 11:21:21 2012 (r237059) @@ -24,25 +24,24 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2000 +.Dd April 19, 2012 .Dt SWI 9 .Os .Sh NAME .Nm swi_add , +.Nm swi_remove , .Nm swi_sched .Nd register and schedule software interrupt handlers .Sh SYNOPSIS .In sys/param.h .In sys/bus.h .In sys/interrupt.h -.Vt "extern struct ithd *tty_ithd" ; -.Vt "extern struct ithd *clk_ithd" ; -.Vt "extern void *net_ih" ; -.Vt "extern void *softclock_ih" ; +.Vt "extern struct intr_event *tty_intr_event" ; +.Vt "extern struct intr_event *clk_intr_event" ; .Vt "extern void *vm_ih" ; .Ft int .Fo swi_add -.Fa "struct ithd **ithdp" +.Fa "struct intr_event **eventp" .Fa "const char *name" .Fa "driver_intr_t handler" .Fa "void *arg" @@ -50,6 +49,8 @@ .Fa "enum intr_type flags" .Fa "void **cookiep" .Fc +.Ft int +.Fn swi_remove "void *cookie" .Ft void .Fn swi_sched "void *cookie" "int flags" .Sh DESCRIPTION @@ -67,20 +68,21 @@ time, and that they can be run via a lig .Pp The .Fn swi_add -function is used to register a new software interrupt handler. +function is used to add a new software interrupt handler to a specified +interrupt event. The -.Fa ithdp +.Fa eventp argument is an optional pointer to a -.Vt struct ithd +.Vt struct intr_event pointer. -If this argument points to an existing software interrupt thread, then this -handler will be attached to that thread. -Otherwise a new thread will be created, and if -.Fa ithdp +If this argument points to an existing event that holds a list of +interrupt handlers, then this handler will be attached to that event. +Otherwise a new event will be created, and if +.Fa eventp is not .Dv NULL , then the pointer at that address to will be modified to point to the -newly created thread. +newly created event. The .Fa name argument is used to associate a name with a specific handler. @@ -99,7 +101,7 @@ The .Fa pri value specifies the priority of this interrupt handler relative to other software interrupt handlers. -If an interrupt thread is created, then this value is used as the vector, +If an interrupt event is created, then this value is used as the vector, and the .Fa flags argument is used to specify the attributes of a handler such as @@ -113,6 +115,14 @@ This cookie will be set to a value that and is used to schedule the handler for execution later on. .Pp The +.Fn swi_remove +function is used to teardown an interrupt handler pointed to by the +.Fa cookie +argument. +It detaches the interrupt handler from the associated interrupt event +and frees its memory. +.Pp +The .Fn swi_sched function is used to schedule an interrupt handler and its associated thread to run. @@ -140,30 +150,29 @@ in earlier versions of .El .Pp The -.Va tty_ithd +.Va tty_intr_event and -.Va clk_ithd -variables contain pointers to the software interrupt threads for the tty and +.Va clk_intr_event +variables contain pointers to the software interrupt handlers for the tty and clock software interrupts, respectively. -.Va tty_ithd +.Va tty_intr_event is used to hang tty software interrupt handlers off of the same thread. -.Va clk_ithd +.Va clk_intr_event is used to hang delayed handlers off of the clock software interrupt thread so that the functionality of .Fn setdelayed can be obtained in conjunction with .Dv SWI_DELAY . The -.Va net_ih , -.Va softclock_ih , -and .Va vm_ih -handler cookies are used to schedule software interrupt threads to run for the -networking stack, clock interrupt, and VM subsystem respectively. +handler cookie is used to schedule software interrupt threads to run for the +VM subsystem. .Sh RETURN VALUES The .Fn swi_add -function returns zero on success and non-zero on failure. +and +.Fn swi_remove +functions return zero on success and non-zero on failure. .Sh ERRORS The .Fn swi_add @@ -185,7 +194,7 @@ or .Dv INTR_FAST . .It Bq Er EINVAL The -.Fa ithdp +.Fa eventp argument points to a hardware interrupt thread. .It Bq Er EINVAL Either of the @@ -197,11 +206,22 @@ arguments are .It Bq Er EINVAL The .Dv INTR_EXCL -flag is specified and the interrupt thread pointed to by -.Fa ithdp -already has at least one handler, or the interrupt thread already has an +flag is specified and the interrupt event pointed to by +.Fa eventp +already has at least one handler, or the interrupt event already has an exclusive handler. .El +.Pp +The +.Fn swi_remove +function will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +A software interrupt handler pointed to by +.Fa cookie +is +.Dv NULL . +.El .Sh SEE ALSO .Xr ithread 9 , .Xr taskqueue 9 @@ -222,6 +242,10 @@ and .Fn schedsoft* functions which date back to at least .Bx 4.4 . +The +.Fn swi_remove +function first appeared in +.Fx 6.1 . .Sh BUGS Most of the global variables described in this manual page should not be global, or at the very least should not be declared in From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 19:55:22 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3A84106566C; Thu, 14 Jun 2012 19:55:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CDAF28FC0A; Thu, 14 Jun 2012 19:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EJtMG5015468; Thu, 14 Jun 2012 19:55:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EJtMpX015466; Thu, 14 Jun 2012 19:55:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206141955.q5EJtMpX015466@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 19:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237092 - stable/8/sys/boot/ofw/libofw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 19:55:23 -0000 Author: marius Date: Thu Jun 14 19:55:22 2012 New Revision: 237092 URL: http://svn.freebsd.org/changeset/base/237092 Log: MFC: r236579 The workaround added in r151650 for handling firmwares that don't allow a single device to be opened multiple times concurrently unfortunately isn't sufficient with ZFS. This is due to the fact, that ZFS may open different partitions of a single device simultaneously. So the best we can do in this case is to cache the lastly used device path and close and open devices in ofwd_strategy() as needed. PR: 165025 Submitted by: Gavin Mu Modified: stable/8/sys/boot/ofw/libofw/ofw_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- stable/8/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:55:19 2012 (r237091) +++ stable/8/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:55:22 2012 (r237092) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); */ #include -#include #include @@ -43,8 +42,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" static int ofwd_init(void); -static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); +static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); static int ofwd_open(struct open_file *f, ...); static int ofwd_close(struct open_file *f); static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -61,120 +60,109 @@ struct devsw ofwdisk = { ofwd_print }; -struct opened_dev { - ihandle_t handle; - u_int count; - SLIST_ENTRY(opened_dev) link; -}; - -SLIST_HEAD(, opened_dev) opened_devs = SLIST_HEAD_INITIALIZER(opened_devs); +/* + * We're not guaranteed to be able to open a device more than once and there + * is no OFW standard method to determine whether a device is already opened. + * Opening a device multiple times simultaneously happens to work with most + * OFW block device drivers but triggers a trap with at least the driver for + * the on-board controllers of Sun Fire V100 and Ultra 1. Upper layers and MI + * code expect to be able to open a device more than once however. Given that + * different partitions of the same device might be opened at the same time as + * done by ZFS, we can't generally just keep track of the opened devices and + * reuse the instance handle when asked to open an already opened device. So + * the best we can do is to cache the lastly used device path and close and + * open devices in ofwd_strategy() as needed. + */ +static struct ofw_devdesc *kdp; static int ofwd_init(void) { - return 0; + return (0); } static int -ofwd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, - size_t *rsize) +ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata; daddr_t pos; int n; + if (dp != kdp) { + if (kdp != NULL) { +#if !defined(__powerpc__) + OF_close(kdp->d_handle); +#endif + kdp = NULL; + } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) + return (ENOENT); + kdp = dp; + } + pos = dblk * 512; do { if (OF_seek(dp->d_handle, pos) < 0) - return EIO; + return (EIO); n = OF_read(dp->d_handle, buf, size); if (n < 0 && n != -2) - return EIO; + return (EIO); } while (n == -2); *rsize = size; - return 0; + return (0); } static int ofwd_open(struct open_file *f, ...) { - char path[256]; struct ofw_devdesc *dp; - struct opened_dev *odp; va_list vl; va_start(vl, f); dp = va_arg(vl, struct ofw_devdesc *); va_end(vl); - /* - * We're not guaranteed to be able to open a device more than once - * simultaneously and there is no OFW standard method to determine - * whether a device is already opened. Opening a device more than - * once happens to work with most OFW block device drivers but - * triggers a trap with at least the driver for the on-board SCSI - * controller in Sun Ultra 1. Upper layers and MI code expect to - * be able to open a device more than once however. As a workaround - * keep track of the opened devices and reuse the instance handle - * when asked to open an already opened device. - */ - SLIST_FOREACH(odp, &opened_devs, link) { - if (OF_instance_to_path(odp->handle, path, sizeof(path)) == -1) - continue; - if (strcmp(path, dp->d_path) == 0) { - odp->count++; - dp->d_handle = odp->handle; - return 0; + + if (dp != kdp) { + if (kdp != NULL) { + OF_close(kdp->d_handle); + kdp = NULL; } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) { + printf("%s: Could not open %s\n", __func__, + dp->d_path); + return (ENOENT); + } + kdp = dp; } - odp = malloc(sizeof(struct opened_dev)); - if (odp == NULL) { - printf("ofwd_open: malloc failed\n"); - return ENOMEM; - } - if ((odp->handle = OF_open(dp->d_path)) == -1) { - printf("ofwd_open: Could not open %s\n", dp->d_path); - free(odp); - return ENOENT; - } - odp->count = 1; - SLIST_INSERT_HEAD(&opened_devs, odp, link); - dp->d_handle = odp->handle; - return 0; + return (0); } static int ofwd_close(struct open_file *f) { struct ofw_devdesc *dev = f->f_devdata; - struct opened_dev *odp; - SLIST_FOREACH(odp, &opened_devs, link) { - if (odp->handle == dev->d_handle) { - odp->count--; - if (odp->count == 0) { - SLIST_REMOVE(&opened_devs, odp, opened_dev, - link); - #if !defined(__powerpc__) - OF_close(odp->handle); - #endif - free(odp); - } - break; - } + if (dev == kdp) { +#if !defined(__powerpc__) + OF_close(dev->d_handle); +#endif + kdp = NULL; } - return 0; + return (0); } static int -ofwd_ioctl(struct open_file *f, u_long cmd, void *data) +ofwd_ioctl(struct open_file *f __unused, u_long cmd __unused, + void *data __unused) { return (EINVAL); } static void -ofwd_print(int verbose) +ofwd_print(int verbose __unused) { } From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 20:02:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9533D1065676; Thu, 14 Jun 2012 20:02:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 800D38FC14; Thu, 14 Jun 2012 20:02:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK2txA016008; Thu, 14 Jun 2012 20:02:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK2tZb016000; Thu, 14 Jun 2012 20:02:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142002.q5EK2tZb016000@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237094 - stable/8/sys/arm/at91 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:02:55 -0000 Author: marius Date: Thu Jun 14 20:02:54 2012 New Revision: 237094 URL: http://svn.freebsd.org/changeset/base/237094 Log: MFC: r225882 Remove pointless semicolons after label Modified: stable/8/sys/arm/at91/at91_mci.c stable/8/sys/arm/at91/at91_pio.c stable/8/sys/arm/at91/at91_rtc.c stable/8/sys/arm/at91/at91_spi.c stable/8/sys/arm/at91/at91_ssc.c stable/8/sys/arm/at91/at91_twi.c stable/8/sys/arm/at91/uart_dev_at91usart.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/arm/at91/at91_mci.c ============================================================================== --- stable/8/sys/arm/at91/at91_mci.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_mci.c Thu Jun 14 20:02:54 2012 (r237094) @@ -211,7 +211,7 @@ at91_mci_attach(device_t dev) child = device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); err = bus_generic_attach(dev); -out:; +out: if (err) at91_mci_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_pio.c ============================================================================== --- stable/8/sys/arm/at91/at91_pio.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_pio.c Thu Jun 14 20:02:54 2012 (r237094) @@ -162,7 +162,7 @@ at91_pio_attach(device_t dev) goto out; } sc->cdev->si_drv1 = sc; -out:; +out: if (err) at91_pio_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_rtc.c ============================================================================== --- stable/8/sys/arm/at91/at91_rtc.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_rtc.c Thu Jun 14 20:02:54 2012 (r237094) @@ -118,7 +118,7 @@ at91_rtc_attach(device_t dev) goto out; } clock_register(dev, 1000000); -out:; +out: if (err) at91_rtc_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_spi.c ============================================================================== --- stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:54 2012 (r237094) @@ -134,7 +134,7 @@ at91_spi_attach(device_t dev) device_add_child(dev, "spibus", -1); bus_generic_attach(dev); -out:; +out: if (err) at91_spi_deactivate(dev); return (err); @@ -259,7 +259,7 @@ at91_spi_transfer(device_t dev, device_t for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (err); -out:; +out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (EIO); Modified: stable/8/sys/arm/at91/at91_ssc.c ============================================================================== --- stable/8/sys/arm/at91/at91_ssc.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_ssc.c Thu Jun 14 20:02:54 2012 (r237094) @@ -150,7 +150,7 @@ at91_ssc_attach(device_t dev) WR4(sc, SSC_TFMR, 0x1f | SSC_TFMR_DATDEF | SSC_TFMR_MSFBF | SSC_TFMR_FSOS_NEG_PULSE); -out:; +out: if (err) at91_ssc_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_twi.c ============================================================================== --- stable/8/sys/arm/at91/at91_twi.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_twi.c Thu Jun 14 20:02:54 2012 (r237094) @@ -140,7 +140,7 @@ at91_twi_attach(device_t dev) device_printf(dev, "could not allocate iicbus instance\n"); /* probe and attach the iicbus */ bus_generic_attach(dev); -out:; +out: if (err) at91_twi_deactivate(dev); return (err); @@ -369,7 +369,7 @@ at91_twi_transfer(device_t dev, struct i if ((err = at91_twi_wait(sc, TWI_SR_TXCOMP))) break; } -out:; +out: if (err) { WR4(sc, TWI_CR, TWI_CR_SWRST); WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS); Modified: stable/8/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/8/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 20:02:54 2012 (r237094) @@ -412,7 +412,7 @@ at91_usart_bus_attach(struct uart_softc } WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK); #ifndef SKYEYE_WORKAROUNDS -errout:; +errout: // XXX bad return (err); #else From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 20:05:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 764701065670; Thu, 14 Jun 2012 20:05:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 211188FC1B; Thu, 14 Jun 2012 20:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK5Dkr016226; Thu, 14 Jun 2012 20:05:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK5DhQ016223; Thu, 14 Jun 2012 20:05:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142005.q5EK5DhQ016223@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237096 - stable/8/sys/arm/at91 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:05:13 -0000 Author: marius Date: Thu Jun 14 20:05:12 2012 New Revision: 237096 URL: http://svn.freebsd.org/changeset/base/237096 Log: MFC: r236495 - Prepend the device description with "AT91" to reflect its nature. [1] - Move DMA tag and map creature to at91_spi_activate() where the other resource allocation also lives. [1] - Flesh out at91_spi_deactivate(). [1] - Work around the "Software Reset must be Written Twice" erratum. - For now, run the bus at the slowest speed possible in order to work around data corruption on transit even seen with 9 MHz on ETHERNUT5 (15 MHz maximum) and AT45DB321D (20 MHz maximum). This also serves as a poor man's work-around for the "NPCSx rises if no data data is to be transmitted" erratum of RM9200. Being able to use the appropriate bus speed would require: 1) Adding a proper work-around for the RM9200 bug consisting of taking the chip select control away from the SPI peripheral and managing it directly as a GPIO line. 2) Taking the maximum frequencies supported by the actual board and the slave devices into account and basing the whole thing on the master clock instead of hardcoding a divisor as previously done. 3) Fixing the above mentioned data corruption. - KASSERT that TX/RX command and data sizes match on transfers. - Introduce a mutex ensuring that only one child device is running a SPI transfer at a time. [1] - Add preliminary, #ifdef'ed out support for setting the chip select. [1] - Use the RX instead of the TX commando size when setting up the RX side of a transfer. - For controllers having SPI_SR_TXEMPTY, i.e. !RM9200, also wait for the completion of the TX part of transfers before stopping the whole thing again. - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1, partially] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] Modified: stable/8/sys/arm/at91/at91_spi.c stable/8/sys/arm/at91/at91_spireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/arm/at91/at91_spi.c ============================================================================== --- stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:05:12 2012 (r237095) +++ stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:05:12 2012 (r237096) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2011-2012 Ian Lepore. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,17 +33,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include +#include + #include #include #include +#include #include + #include "spibus_if.h" struct at91_spi_softc @@ -50,29 +56,39 @@ struct at91_spi_softc void *intrhand; /* Interrupt handle */ struct resource *irq_res; /* IRQ resource */ struct resource *mem_res; /* Memory resource */ - bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ - int rxdone; + struct sx xfer_mtx; /* Enforce one transfer at a time */ + uint32_t xfer_mask; /* Bits to wait on for completion */ + uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; +#define CS_TO_MR(cs) ((~(1 << (cs)) & 0x0f) << 16) + static inline uint32_t RD4(struct at91_spi_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + + return (bus_read_4(sc->mem_res, off)); } static inline void WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val) { + bus_write_4(sc->mem_res, off, val); } /* bus entry points */ -static int at91_spi_probe(device_t dev); static int at91_spi_attach(device_t dev); static int at91_spi_detach(device_t dev); +static int at91_spi_probe(device_t dev); +static int at91_spi_transfer(device_t dev, device_t child, + struct spi_command *cmd); /* helper routines */ +static void at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); static int at91_spi_activate(device_t dev); static void at91_spi_deactivate(device_t dev); static void at91_spi_intr(void *arg); @@ -80,43 +96,64 @@ static void at91_spi_intr(void *arg); static int at91_spi_probe(device_t dev) { - device_set_desc(dev, "SPI"); + + device_set_desc(dev, "AT91 SPI"); return (0); } static int at91_spi_attach(device_t dev) { - struct at91_spi_softc *sc = device_get_softc(dev); - int err, i; + struct at91_spi_softc *sc; + int err; + uint32_t csr; + + sc = device_get_softc(dev); sc->dev = dev; + sx_init(&sc->xfer_mtx, device_get_nameunit(dev)); + + /* + * Allocate resources. + */ err = at91_spi_activate(dev); if (err) goto out; /* - * Allocate DMA tags and maps + * Set up the hardware. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, - 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); - if (err != 0) - goto out; - for (i = 0; i < 4; i++) { - err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); - if (err != 0) - goto out; - } - // reset the SPI + sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); + WR4(sc, SPI_CR, SPI_CR_SWRST); + /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); WR4(sc, SPI_IDR, 0xffffffff); WR4(sc, SPI_MR, (0xf << 24) | SPI_MR_MSTR | SPI_MR_MODFDIS | - (0xE << 16)); + CS_TO_MR(0)); + + /* + * For now, run the bus at the slowest speed possible as otherwise we + * may encounter data corruption on transmit as seen with ETHERNUT5 + * and AT45DB321D even though both board and slave device can take + * more. + * This also serves as a work-around for the "NPCSx rises if no data + * data is to be transmitted" erratum. The ideal workaround for the + * latter is to take the chip select control away from the peripheral + * and manage it directly as a GPIO line. The easy solution is to + * slow down the bus so dramatically that it just never gets starved + * as may be seen when the OCHI controller is running and consuming + * memory and APB bandwidth. + * Also, currently we lack a way for lettting both the board and the + * slave devices take their maximum supported SPI clocks into account. + */ + csr = SPI_CSR_CPOL | (4 << 16) | (0xff << 8); + WR4(sc, SPI_CSR0, csr); + WR4(sc, SPI_CSR1, csr); + WR4(sc, SPI_CSR2, csr); + WR4(sc, SPI_CSR3, csr); - WR4(sc, SPI_CSR0, SPI_CSR_CPOL | (4 << 16) | (2 << 8)); WR4(sc, SPI_CR, SPI_CR_SPIEN); WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS); @@ -143,6 +180,7 @@ out: static int at91_spi_detach(device_t dev) { + return (EBUSY); /* XXX */ } @@ -150,26 +188,41 @@ static int at91_spi_activate(device_t dev) { struct at91_spi_softc *sc; - int rid, err = ENOMEM; + int err, i, rid; sc = device_get_softc(dev); + err = ENOMEM; + rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) - goto errout; + goto out; + rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (sc->irq_res == NULL) - goto errout; + goto out; err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, at91_spi_intr, sc, &sc->intrhand); if (err != 0) - goto errout; - return (0); -errout: - at91_spi_deactivate(dev); + goto out; + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2048, 1, + 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); + if (err != 0) + goto out; + + for (i = 0; i < 4; i++) { + err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); + if (err != 0) + goto out; + } +out: + if (err != 0) + at91_spi_deactivate(dev); return (err); } @@ -177,26 +230,37 @@ static void at91_spi_deactivate(device_t dev) { struct at91_spi_softc *sc; + int i; sc = device_get_softc(dev); + bus_generic_detach(dev); + + for (i = 0; i < 4; i++) + if (sc->map[i]) + bus_dmamap_destroy(sc->dmatag, sc->map[i]); + + if (sc->dmatag) + bus_dma_tag_destroy(sc->dmatag); + if (sc->intrhand) bus_teardown_intr(dev, sc->irq_res, sc->intrhand); - sc->intrhand = 0; - bus_generic_detach(sc->dev); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(sc->mem_res), sc->mem_res); - sc->mem_res = 0; + sc->intrhand = NULL; if (sc->irq_res) bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res), sc->irq_res); - sc->irq_res = 0; - return; + sc->irq_res = NULL; + + if (sc->mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; } static void -at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs __unused, + int error) { + if (error != 0) return; *(bus_addr_t *)arg = segs[0].ds_addr; @@ -206,80 +270,133 @@ static int at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) { struct at91_spi_softc *sc; - int i, j, rxdone, err, mode[4]; bus_addr_t addr; + int err, i, j, mode[4]; + uint32_t mask; + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("%s: TX/RX command sizes should be equal", __func__)); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("%s: TX/RX data sizes should be equal", __func__)); sc = device_get_softc(dev); - WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); i = 0; - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + sx_xlock(&sc->xfer_mtx); + + /* + * Disable transfers while we set things up. + */ + WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); + +#ifdef SPI_CHIPSEL_SUPPORT + if (cmd->cs < 0 || cmd->cs > 3) { + device_printf(dev, + "Invalid chip select %d requested by %s\n", cmd->cs, + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#ifdef SPI_CHIP_SELECT_HIGH_SUPPORT + if (at91_is_rm92() && cmd->cs == 0 && + (cmd->flags & SPI_CHIP_SELECT_HIGH) != 0) { + device_printf(dev, + "Invalid chip select high requested by %s\n", + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#endif + WR4(sc, SPI_MR, (RD4(sc, SPI_MR) & ~0x000f0000) | CS_TO_MR(cmd->cs)); +#endif + + /* + * Set up the TX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, + cmd->tx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_TPR, addr); WR4(sc, PDC_TCR, cmd->tx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; if (cmd->tx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->tx_data, cmd->tx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_TNPR, addr); WR4(sc, PDC_TNCR, cmd->tx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; } - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + /* + * Set up the RX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, + cmd->rx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_RPR, addr); - WR4(sc, PDC_RCR, cmd->tx_cmd_sz); + WR4(sc, PDC_RCR, cmd->rx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; if (cmd->rx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->rx_data, cmd->rx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_RNPR, addr); WR4(sc, PDC_RNCR, cmd->rx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; } - WR4(sc, SPI_IER, SPI_SR_ENDRX); + + /* + * Start the transfer, wait for it to complete. + */ + sc->xfer_done = 0; + mask = sc->xfer_mask; + WR4(sc, SPI_IER, mask); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); + do + err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); + while (sc->xfer_done != mask && err != EINTR); - rxdone = sc->rxdone; - do { - err = tsleep(&sc->rxdone, PCATCH | PZERO, "spi", hz); - } while (rxdone == sc->rxdone && err != EINTR); + /* + * Stop the transfer and clean things up. + */ WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); - if (err == 0) { - for (j = 0; j < i; j++) + if (err == 0) + for (j = 0; j < i; j++) bus_dmamap_sync(sc->dmatag, sc->map[j], mode[j]); - } - for (j = 0; j < i; j++) - bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (err); out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (EIO); + + sx_xunlock(&sc->xfer_mtx); + + return (err); } static void at91_spi_intr(void *arg) { - struct at91_spi_softc *sc = (struct at91_spi_softc*)arg; - uint32_t sr; + struct at91_spi_softc *sc; + uint32_t mask, sr; + sc = (struct at91_spi_softc*)arg; + + mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if (sr & SPI_SR_ENDRX) { - sc->rxdone++; - WR4(sc, SPI_IDR, SPI_SR_ENDRX); - wakeup(&sc->rxdone); + if ((sr & mask) != 0) { + sc->xfer_done |= sr & mask; + WR4(sc, SPI_IDR, mask); + wakeup(&sc->xfer_done); } - if (sr & ~SPI_SR_ENDRX) { + if ((sr & ~mask) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~SPI_SR_ENDRX); + WR4(sc, SPI_IDR, sr & ~mask); } } @@ -293,7 +410,8 @@ static device_method_t at91_spi_methods[ /* spibus interface */ DEVMETHOD(spibus_transfer, at91_spi_transfer), - { 0, 0 } + + DEVMETHOD_END }; static driver_t at91_spi_driver = { @@ -302,4 +420,5 @@ static driver_t at91_spi_driver = { sizeof(struct at91_spi_softc), }; -DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, 0, 0); +DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, NULL, + NULL); Modified: stable/8/sys/arm/at91/at91_spireg.h ============================================================================== --- stable/8/sys/arm/at91/at91_spireg.h Thu Jun 14 20:05:12 2012 (r237095) +++ stable/8/sys/arm/at91/at91_spireg.h Thu Jun 14 20:05:12 2012 (r237096) @@ -54,6 +54,8 @@ #define SPI_SR_ENDTX 0x00020 #define SPI_SR_RXBUFF 0x00040 #define SPI_SR_TXBUFE 0x00080 +#define SPI_SR_NSSR 0x00100 +#define SPI_SR_TXEMPTY 0x00200 #define SPI_SR_SPIENS 0x10000 #define SPI_IER 0x14 /* IER: Interrupt Enable Regsiter */ #define SPI_IDR 0x18 /* IDR: Interrupt Disable Regsiter */ From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 21:36:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CAC2106567D; Thu, 14 Jun 2012 21:36:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 64AB98FC14; Thu, 14 Jun 2012 21:36:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELaHOj022351; Thu, 14 Jun 2012 21:36:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELaHv8022348; Thu, 14 Jun 2012 21:36:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206142136.q5ELaHv8022348@svn.freebsd.org> From: Andrew Thompson Date: Thu, 14 Jun 2012 21:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237104 - in stable/8/sys: net netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:36:17 -0000 Author: thompsa Date: Thu Jun 14 21:36:16 2012 New Revision: 237104 URL: http://svn.freebsd.org/changeset/base/237104 Log: MFC r236916 Fix a panic I introduced in r234487, the bridge softc pointer is set to null early in the detach so rearrange things not to explode. Reported by: David Roffiaen, Gustau Perez Querol Modified: stable/8/sys/net/if_bridge.c stable/8/sys/netinet/ip_carp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Thu Jun 14 21:35:20 2012 (r237103) +++ stable/8/sys/net/if_bridge.c Thu Jun 14 21:36:16 2012 (r237104) @@ -334,6 +334,7 @@ static int bridge_ip6_checkbasic(struct static int bridge_fragment(struct ifnet *, struct mbuf *, struct ether_header *, int, struct llc *); static void bridge_linkstate(struct ifnet *ifp); +static void bridge_linkcheck(struct bridge_softc *sc); extern void (*bridge_linkstate_p)(struct ifnet *ifp); @@ -964,6 +965,7 @@ bridge_delete_member(struct bridge_softc EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } + bridge_linkcheck(sc); bridge_mutecaps(sc); /* recalcuate now this interface is removed */ bridge_rtdelete(sc, ifs, IFBF_FLUSHALL); KASSERT(bif->bif_addrcnt == 0, @@ -993,7 +995,6 @@ bridge_delete_member(struct bridge_softc bridge_set_ifcap(sc, bif, bif->bif_savedcaps); } bstp_destroy(&bif->bif_stp); /* prepare to free */ - bridge_linkstate(ifs); BRIDGE_LOCK(sc); free(bif, M_DEVBUF); } @@ -1092,18 +1093,17 @@ bridge_ioctl_add(struct bridge_softc *sc /* Set interface capabilities to the intersection set of all members */ bridge_mutecaps(sc); + bridge_linkcheck(sc); - BRIDGE_UNLOCK(sc); - /* Update the linkstate for the bridge */ - bridge_linkstate(ifs); /* Place the interface into promiscuous mode */ switch (ifs->if_type) { case IFT_ETHER: case IFT_L2VLAN: + BRIDGE_UNLOCK(sc); error = ifpromisc(ifs, 1); + BRIDGE_LOCK(sc); break; } - BRIDGE_LOCK(sc); if (error) bridge_delete_member(sc, bif, 0); out: @@ -3485,8 +3485,7 @@ static void bridge_linkstate(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; - struct bridge_iflist *bif, *bif2; - int new_link, hasls; + struct bridge_iflist *bif; BRIDGE_LOCK(sc); bif = bridge_lookup_member_if(sc, ifp); @@ -3494,13 +3493,26 @@ bridge_linkstate(struct ifnet *ifp) BRIDGE_UNLOCK(sc); return; } + bridge_linkcheck(sc); + BRIDGE_UNLOCK(sc); + + bstp_linkstate(&bif->bif_stp); +} + +static void +bridge_linkcheck(struct bridge_softc *sc) +{ + struct bridge_iflist *bif; + int new_link, hasls; + + BRIDGE_LOCK_ASSERT(sc); new_link = LINK_STATE_DOWN; hasls = 0; /* Our link is considered up if at least one of our ports is active */ - LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) { - if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE) + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE) hasls++; - if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) { + if (bif->bif_ifp->if_link_state == LINK_STATE_UP) { new_link = LINK_STATE_UP; break; } @@ -3510,8 +3522,4 @@ bridge_linkstate(struct ifnet *ifp) new_link = LINK_STATE_UP; } if_link_state_change(sc->sc_ifp, new_link); - BRIDGE_UNLOCK(sc); - - bstp_linkstate(&bif->bif_stp); } - Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:35:20 2012 (r237103) +++ stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:36:16 2012 (r237104) @@ -100,6 +100,7 @@ struct carp_softc { #ifdef INET6 struct in6_ifaddr *sc_ia6; /* primary iface address v6 */ struct ip6_moptions sc_im6o; + struct in6_ifaddr *sc_llia; #endif /* INET6 */ TAILQ_ENTRY(carp_softc) sc_list; @@ -1239,6 +1240,16 @@ carp_iamatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { + if (IN6_ARE_ADDR_EQUAL(taddr, + &vh->sc_llia->ia_addr.sin6_addr) && + (SC2IFP(vh)->if_flags & IFF_UP) && + (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && + vh->sc_state == MASTER) { + ifa = &vh->sc_llia->ia_addr; + ifa_ref(ifa); + CARP_UNLOCK(cif); + return (ifa); + } IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1270,6 +1281,28 @@ carp_macmatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { + if (IN6_ARE_ADDR_EQUAL(taddr, + sc->sc_llia->ia_addr.sin6_addr) && + (SC2IFP(sc)->if_flags & IFF_UP) && + (SC2IFP(sc)->if_drv_flags & IFF_DRV_RUNNING) && + sc->sc_state == MASTER) { + struct ifnet *ifp = SC2IFP(sc); + mtag = m_tag_get(PACKET_TAG_CARP, + sizeof(struct ifnet *), M_NOWAIT); + if (mtag == NULL) { + /* better a bit than nothing */ + IF_ADDR_RUNLOCK(SC2IFP(sc)); + CARP_UNLOCK(cif); + return (IF_LLADDR(sc->sc_ifp)); + } + bcopy(&ifp, (caddr_t)(mtag + 1), + sizeof(struct ifnet *)); + m_tag_prepend(m, mtag); + + IF_ADDR_RUNLOCK(SC2IFP(sc)); + CARP_UNLOCK(cif); + return (IF_LLADDR(sc->sc_ifp)); + } IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1749,6 +1782,33 @@ carp_set_addr6(struct carp_softc *sc, st goto cleanup; im6o->im6o_membership[1] = in6m; im6o->im6o_num_memberships++; + + /* Add link local */ + bzero(&ifra, sizeof(ifra)); + ifra.ifra_addr.sin6_family = AF_INET6; + ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); + ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; + if ((error = in6_get_hw_ifid(sc->sc_ifp, NULL, &ifra.ifra_addr.sin6_addr)) != 0) + goto cleanup; + if ((error = in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL))) + goto cleanup; + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_prefixmask.sin6_family = AF_INET6; + ifra.ifra_prefixmask.sin6_addr = in6mask64; + /* link-local addresses should NEVER expire. */ + ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; + + if ((error = in6_update_ifa(ifp, &ifra, NULL, + IN6_IFAUPDATE_DADDELAY)) != 0) + goto cleanup; + sc->sc_llia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr); + if (sc->sc_llia == NULL) { + error = ESRCH; + goto cleanup; + } + ifa_free(&sc->sc_llia->ia_ifa); } if (!ifp->if_carp) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Jun 14 21:40:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3346B1065672; Thu, 14 Jun 2012 21:40:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 142298FC0C; Thu, 14 Jun 2012 21:40:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELeEJx022580; Thu, 14 Jun 2012 21:40:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELeE6l022578; Thu, 14 Jun 2012 21:40:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206142140.q5ELeE6l022578@svn.freebsd.org> From: Andrew Thompson Date: Thu, 14 Jun 2012 21:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237105 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:40:15 -0000 Author: thompsa Date: Thu Jun 14 21:40:14 2012 New Revision: 237105 URL: http://svn.freebsd.org/changeset/base/237105 Log: Revert an inintended change in r237104 Modified: stable/8/sys/netinet/ip_carp.c Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:36:16 2012 (r237104) +++ stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:40:14 2012 (r237105) @@ -100,7 +100,6 @@ struct carp_softc { #ifdef INET6 struct in6_ifaddr *sc_ia6; /* primary iface address v6 */ struct ip6_moptions sc_im6o; - struct in6_ifaddr *sc_llia; #endif /* INET6 */ TAILQ_ENTRY(carp_softc) sc_list; @@ -1240,16 +1239,6 @@ carp_iamatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { - if (IN6_ARE_ADDR_EQUAL(taddr, - &vh->sc_llia->ia_addr.sin6_addr) && - (SC2IFP(vh)->if_flags & IFF_UP) && - (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && - vh->sc_state == MASTER) { - ifa = &vh->sc_llia->ia_addr; - ifa_ref(ifa); - CARP_UNLOCK(cif); - return (ifa); - } IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1281,28 +1270,6 @@ carp_macmatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { - if (IN6_ARE_ADDR_EQUAL(taddr, - sc->sc_llia->ia_addr.sin6_addr) && - (SC2IFP(sc)->if_flags & IFF_UP) && - (SC2IFP(sc)->if_drv_flags & IFF_DRV_RUNNING) && - sc->sc_state == MASTER) { - struct ifnet *ifp = SC2IFP(sc); - mtag = m_tag_get(PACKET_TAG_CARP, - sizeof(struct ifnet *), M_NOWAIT); - if (mtag == NULL) { - /* better a bit than nothing */ - IF_ADDR_RUNLOCK(SC2IFP(sc)); - CARP_UNLOCK(cif); - return (IF_LLADDR(sc->sc_ifp)); - } - bcopy(&ifp, (caddr_t)(mtag + 1), - sizeof(struct ifnet *)); - m_tag_prepend(m, mtag); - - IF_ADDR_RUNLOCK(SC2IFP(sc)); - CARP_UNLOCK(cif); - return (IF_LLADDR(sc->sc_ifp)); - } IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1782,33 +1749,6 @@ carp_set_addr6(struct carp_softc *sc, st goto cleanup; im6o->im6o_membership[1] = in6m; im6o->im6o_num_memberships++; - - /* Add link local */ - bzero(&ifra, sizeof(ifra)); - ifra.ifra_addr.sin6_family = AF_INET6; - ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); - ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; - if ((error = in6_get_hw_ifid(sc->sc_ifp, NULL, &ifra.ifra_addr.sin6_addr)) != 0) - goto cleanup; - if ((error = in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL))) - goto cleanup; - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_prefixmask.sin6_family = AF_INET6; - ifra.ifra_prefixmask.sin6_addr = in6mask64; - /* link-local addresses should NEVER expire. */ - ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; - ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; - - if ((error = in6_update_ifa(ifp, &ifra, NULL, - IN6_IFAUPDATE_DADDELAY)) != 0) - goto cleanup; - sc->sc_llia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr); - if (sc->sc_llia == NULL) { - error = ESRCH; - goto cleanup; - } - ifa_free(&sc->sc_llia->ia_ifa); } if (!ifp->if_carp) { From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 15 06:14:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A0AF1065675; Fri, 15 Jun 2012 06:14:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8481D8FC08; Fri, 15 Jun 2012 06:14:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F6EUlh047485; Fri, 15 Jun 2012 06:14:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F6EUqa047483; Fri, 15 Jun 2012 06:14:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206150614.q5F6EUqa047483@svn.freebsd.org> From: Alexander Motin Date: Fri, 15 Jun 2012 06:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237114 - stable/8/sys/dev/ahci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 06:14:30 -0000 Author: mav Date: Fri Jun 15 06:14:29 2012 New Revision: 237114 URL: http://svn.freebsd.org/changeset/base/237114 Log: MFC r236737: Add IDs for Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers. Marvell 88SE9230 was confirmed to work, the rest two are just guessed. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Fri Jun 15 06:13:12 2012 (r237113) +++ stable/8/sys/dev/ahci/ahci.c Fri Jun 15 06:14:29 2012 (r237114) @@ -201,6 +201,9 @@ static struct { {0x91281b4b, 0x00, "Marvell 88SE9128", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, {0x91721b4b, 0x00, "Marvell 88SE9172", AHCI_Q_NOBSYRES}, {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, + {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92351b4b, 0x00, "Marvell 88SE9235", AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 15 07:14:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE14E1065701; Fri, 15 Jun 2012 07:14:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B92828FC1A; Fri, 15 Jun 2012 07:14:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7EhUn050253; Fri, 15 Jun 2012 07:14:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7Eh0P050250; Fri, 15 Jun 2012 07:14:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206150714.q5F7Eh0P050250@svn.freebsd.org> From: Martin Matuska Date: Fri, 15 Jun 2012 07:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237117 - stable/8/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:14:43 -0000 Author: mm Date: Fri Jun 15 07:14:43 2012 New Revision: 237117 URL: http://svn.freebsd.org/changeset/base/237117 Log: MFC r236960: Document the -v flag for zpool list. PR: 168970 Suggested by: Marcelo Araujo Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 07:14:16 2012 (r237116) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 07:14:43 2012 (r237117) @@ -1301,6 +1301,8 @@ reports are printed. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl v +Show more detailed information. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 07:14:16 2012 (r237116) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 07:14:43 2012 (r237117) @@ -234,7 +234,7 @@ get_usage(zpool_help_t idx) { case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-H] [-o property[,...]] " + return (gettext("\tlist [-Hv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 15 17:01:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A991065781; Fri, 15 Jun 2012 17:01:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F2BD48FC0A; Fri, 15 Jun 2012 17:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FH1Cpa093390; Fri, 15 Jun 2012 17:01:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FH1C3n093388; Fri, 15 Jun 2012 17:01:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206151701.q5FH1C3n093388@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 17:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237138 - stable/8/sys/arm/at91 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 17:01:13 -0000 Author: imp Date: Fri Jun 15 17:01:12 2012 New Revision: 237138 URL: http://svn.freebsd.org/changeset/base/237138 Log: Add a band-aide for MFCs: at91_is_rm92 is always true in 8 until SAM9 support is MFC'd. The recent change to spi now references this, so bring it in as a forward compatability. Modified: stable/8/sys/arm/at91/at91var.h Modified: stable/8/sys/arm/at91/at91var.h ============================================================================== --- stable/8/sys/arm/at91/at91var.h Fri Jun 15 16:50:32 2012 (r237137) +++ stable/8/sys/arm/at91/at91var.h Fri Jun 15 17:01:12 2012 (r237138) @@ -45,4 +45,6 @@ struct at91_ivar { extern uint32_t at91_master_clock; +#define at91_is_rm92() (1) /* Only support AT91RM9200 atm -- helps with MFCs */ + #endif /* _AT91VAR_H_ */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 15 20:27:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3B51065670; Fri, 15 Jun 2012 20:27:16 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73E6B8FC14; Fri, 15 Jun 2012 20:27:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FKRG25002110; Fri, 15 Jun 2012 20:27:16 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FKRGXW002108; Fri, 15 Jun 2012 20:27:16 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206152027.q5FKRGXW002108@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 15 Jun 2012 20:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237145 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 20:27:17 -0000 Author: trociny Date: Fri Jun 15 20:27:15 2012 New Revision: 237145 URL: http://svn.freebsd.org/changeset/base/237145 Log: MFC 236724, 236725: MFC 236724: Add VIMAGE support to if_tap. PR: kern/152047, kern/158686 Submitted by: Daan Vreeken MFC 236725: Sort includes. Submitted by: Daan Vreeken Modified: stable/8/sys/net/if_tap.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/net/if_tap.c ============================================================================== --- stable/8/sys/net/if_tap.c Fri Jun 15 20:25:44 2012 (r237144) +++ stable/8/sys/net/if_tap.c Fri Jun 15 20:27:15 2012 (r237145) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -64,8 +65,9 @@ #include #include #include -#include #include +#include +#include #include @@ -214,6 +216,7 @@ tap_destroy(struct tap_softc *tp) KASSERT(!(tp->tap_flags & TAP_OPEN), ("%s flags is out of sync", ifp->if_xname)); + CURVNET_SET(ifp->if_vnet); seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); @@ -222,6 +225,7 @@ tap_destroy(struct tap_softc *tp) mtx_destroy(&tp->tap_mtx); free(tp, M_TAP); + CURVNET_RESTORE(); } static void @@ -363,6 +367,7 @@ tapclone(void *arg, struct ucred *cred, if (unit == -1) append_unit = 1; + CURVNET_SET(CRED_TO_VNET(cred)); /* find any existing device, or allocate new unit number */ i = clone_create(&tapclones, &tap_cdevsw, &unit, dev, extra); if (i) { @@ -381,6 +386,7 @@ tapclone(void *arg, struct ucred *cred, } if_clone_create(name, namelen, NULL); + CURVNET_RESTORE(); } /* tapclone */ @@ -521,6 +527,7 @@ tapclose(struct cdev *dev, int foo, int /* junk all pending output */ mtx_lock(&tp->tap_mtx); + CURVNET_SET(ifp->if_vnet); IF_DRAIN(&ifp->if_snd); /* @@ -544,6 +551,8 @@ tapclose(struct cdev *dev, int foo, int } if_link_state_change(ifp, LINK_STATE_DOWN); + CURVNET_RESTORE(); + funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); @@ -945,7 +954,9 @@ tapwrite(struct cdev *dev, struct uio *u } /* Pass packet up to parent. */ + CURVNET_SET(ifp->if_vnet); (*ifp->if_input)(ifp, m); + CURVNET_RESTORE(); ifp->if_ipackets ++; /* ibytes are counted in parent */ return (0); From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 15 22:56:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 466F01065694; Fri, 15 Jun 2012 22:56:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F6A38FC15; Fri, 15 Jun 2012 22:56:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FMuTa6008384; Fri, 15 Jun 2012 22:56:29 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FMuSsK008382; Fri, 15 Jun 2012 22:56:28 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201206152256.q5FMuSsK008382@svn.freebsd.org> From: Glen Barber Date: Fri, 15 Jun 2012 22:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237149 - stable/8/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 22:56:29 -0000 Author: gjb (doc committer) Date: Fri Jun 15 22:56:28 2012 New Revision: 237149 URL: http://svn.freebsd.org/changeset/base/237149 Log: MFC r236776, r236777: r236776: Fix a typo: s/deafult/default r236777: Clean up trailing whitespace. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 22:56:15 2012 (r237148) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 22:56:28 2012 (r237149) @@ -189,7 +189,7 @@ for information on managing datasets. A .Qq virtual device .Pq No vdev -describes a single device or a collection of devices organized according to +describes a single device or a collection of devices organized according to certain performance and fault characteristics. The following virtual devices are supported: .Bl -tag @@ -237,7 +237,7 @@ A group can have single-, double- , or triple parity, meaning that the .No raidz group can sustain one, two, or three failures, respectively, without -losing any data. The +losing any data. The .Sy raidz1 No vdev type specifies a single-parity .No raidz @@ -287,7 +287,7 @@ writes are load-balanced between devices .No raidz .No vdev types are not supported for the intent log. For more information, -see the +see the .Qq Sx Intent Log section. .It Sy cache @@ -309,13 +309,13 @@ A pool can have any number of virtual de (known as .Qq root .No vdev Ns s). -Data is dynamically distributed across all top-level devices to balance data +Data is dynamically distributed across all top-level devices to balance data among devices. As new virtual devices are added, .Tn ZFS automatically places data on the newly available devices. .Pp Virtual devices are specified one at a time on the command line, separated by -whitespace. The keywords +whitespace. The keywords .Qq mirror and .Qq raidz @@ -428,7 +428,7 @@ allows devices to be associated with poo .Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot -spares, specify a +spares, specify a .Qq spare .No vdev with any number of devices. For example, @@ -458,7 +458,7 @@ pools. .Pp Spares cannot replace log devices. .Ss Intent Log -The +The .Tn ZFS Intent Log .Pq Tn ZIL @@ -582,7 +582,7 @@ the typical paths are not valid. .Sy altroot is not a persistent property. It is valid only while the system is up. Setting -.Sy altroot +.Sy altroot defaults to using .Cm cachefile=none , though this may be overridden using an explicit setting. @@ -627,9 +627,9 @@ This property can also be referred to by .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to .Qq Cm off , -device replacement must be initiated by the administrator by using the +device replacement must be initiated by the administrator by using the .Qq Nm Cm replace -command. If set to +command. If set to .Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is @@ -650,13 +650,13 @@ pool configuration in a different locati .Qq Nm Cm import Fl c . Setting it to the special value .Qq Cm none -creates a temporary pool that is never cached, and the special value +creates a temporary pool that is never cached, and the special value .Cm '' (empty string) uses the default location. .It Sy dedupditto Ns = Ns Ar number Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block -is automatically stored. Deafult setting is +is automatically stored. Default setting is .Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset @@ -861,7 +861,7 @@ root dataset cannot be mounted. This can option. .Bl -tag -width indent .It Fl f -Forces use of +Forces use of .Ar vdev Ns s, even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. @@ -897,7 +897,7 @@ or .Qq Cm altroot Ns Pa /pool if .Sy altroot -is specified. The mount point must be an absolute path, +is specified. The mount point must be an absolute path, .Qq Cm legacy , or .Qq Cm none . @@ -1234,7 +1234,7 @@ seconds until .Sy Ctrl-C is pressed. If no .Ar pools -are specified, statistics for every pool in the system is shown. If +are specified, statistics for every pool in the system is shown. If .Ar count is specified, the command exits after .Ar count @@ -1292,7 +1292,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count @@ -1398,7 +1398,7 @@ This is equivalent to attaching waiting for it to resilver, and then detaching .Ar old_device . .Pp -The size of +The size of .Ar new_device must be greater than or equal to the minimum size of all the devices in a mirror or @@ -1409,7 +1409,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1496,12 +1496,12 @@ unless overridden by a device specificat .Pp When using a .Ar device -argument, +argument, .Cm split -includes the specified device(s) in a new pool and, should any devices remain +includes the specified device(s) in a new pool and, should any devices remain unspecified, assigns the last device in each mirror .No vdev -to that pool, as it does normally. If you are uncertain about the outcome of a +to that pool, as it does normally. If you are uncertain about the outcome of a .Cm split command, use the .Fl n @@ -1554,7 +1554,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count