From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 01:43:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C29B8106568C; Sun, 16 Aug 2009 01:43:08 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15BF8FC41; Sun, 16 Aug 2009 01:43:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7G1h8qW096544; Sun, 16 Aug 2009 01:43:08 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7G1h8JK096540; Sun, 16 Aug 2009 01:43:08 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908160143.n7G1h8JK096540@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 01:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196268 - head/sys/ia64/ia64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 01:43:09 -0000 Author: marcel Date: Sun Aug 16 01:43:08 2009 New Revision: 196268 URL: http://svn.freebsd.org/changeset/base/196268 Log: Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be sparse, which causes a kernel assert. Approved by: re (kensmith) Modified: head/sys/ia64/ia64/genassym.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/mp_machdep.c Modified: head/sys/ia64/ia64/genassym.c ============================================================================== --- head/sys/ia64/ia64/genassym.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/genassym.c Sun Aug 16 01:43:08 2009 (r196268) @@ -91,7 +91,6 @@ ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_current_pmap)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -424,7 +424,11 @@ void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { - pcpu->pc_acpi_id = cpuid; + /* + * Set pc_acpi_id to "uninitialized". + * See sys/dev/acpica/acpi_cpu.c + */ + pcpu->pc_acpi_id = 0xffffffff; } void Modified: head/sys/ia64/ia64/mp_machdep.c ============================================================================== --- head/sys/ia64/ia64/mp_machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/mp_machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -208,31 +208,25 @@ cpu_mp_add(u_int acpiid, u_int apicid, u struct pcpu *pc; u_int64_t lid; void *dpcpu; - - /* Ignore any processor numbers outside our range */ - if (acpiid > mp_maxid) - return; - - KASSERT((all_cpus & (1UL << acpiid)) == 0, - ("%s: cpu%d already in CPU map", __func__, acpiid)); + u_int cpuid; lid = LID_SAPIC_SET(apicid, apiceid); + cpuid = ((ia64_get_lid() & LID_SAPIC_MASK) == lid) ? 0 : smp_cpus++; - if ((ia64_get_lid() & LID_SAPIC_MASK) == lid) { - KASSERT(acpiid == 0, - ("%s: the BSP must be cpu0", __func__)); - } + KASSERT((all_cpus & (1UL << cpuid)) == 0, + ("%s: cpu%d already in CPU map", __func__, acpiid)); - if (acpiid != 0) { + if (cpuid != 0) { pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); + pcpu_init(pc, cpuid, sizeof(*pc)); dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); - pcpu_init(pc, acpiid, sizeof(*pc)); - dpcpu_init(dpcpu, acpiid); + dpcpu_init(dpcpu, cpuid); } else pc = pcpup; + pc->pc_acpi_id = acpiid; pc->pc_lid = lid; - all_cpus |= (1UL << acpiid); + all_cpus |= (1UL << cpuid); } void @@ -244,8 +238,8 @@ cpu_mp_announce() for (i = 0; i <= mp_maxid; i++) { pc = pcpu_find(i); if (pc != NULL) { - printf("cpu%d: SAPIC Id=%x, SAPIC Eid=%x", i, - LID_SAPIC_ID(pc->pc_lid), + printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", + i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_lid), LID_SAPIC_EID(pc->pc_lid)); if (i == 0) printf(" (BSP)\n"); @@ -305,7 +299,9 @@ cpu_mp_unleash(void *dummy) SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; if (pc->pc_awake) { - kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid); + kproc_create(ia64_store_mca_state, + (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, + "mca %u", pc->pc_cpuid); smp_cpus++; } } From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 01:48:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95C91106568C; Sun, 16 Aug 2009 01:48:46 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 846CC8FC4B; Sun, 16 Aug 2009 01:48:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7G1mkbI096712; Sun, 16 Aug 2009 01:48:46 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7G1mkmE096710; Sun, 16 Aug 2009 01:48:46 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908160148.n7G1mkmE096710@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 01:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196269 - head/sys/cddl/contrib/opensolaris/common/nvpair X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 01:48:46 -0000 Author: marcel Date: Sun Aug 16 01:48:46 2009 New Revision: 196269 URL: http://svn.freebsd.org/changeset/base/196269 Log: Fix misalignment in nvpair_native_embedded() caused by the compiler replacing the bzero(). See also revision 195627, which fixed the misalignment in nvpair_native_embedded_array(). Approved by: re (kensmith) Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:43:08 2009 (r196268) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 01:48:46 2009 (r196269) @@ -2523,14 +2523,15 @@ nvpair_native_embedded(nvstream_t *nvs, { if (nvs->nvs_op == NVS_OP_ENCODE) { nvs_native_t *native = (nvs_native_t *)nvs->nvs_private; - nvlist_t *packed = (void *) + char *packed = (void *) (native->n_curr - nvp->nvp_size + NVP_VALOFF(nvp)); /* * Null out the pointer that is meaningless in the packed * structure. The address may not be aligned, so we have * to use bzero. */ - bzero(&packed->nvl_priv, sizeof (packed->nvl_priv)); + bzero(packed + offsetof(nvlist_t, nvl_priv), + sizeof(((nvlist_t *)NULL)->nvl_priv)); } return (nvs_embedded(nvs, EMBEDDED_NVL(nvp))); From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 02:12:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3682A106568E; Sun, 16 Aug 2009 02:12:14 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21D138FC68; Sun, 16 Aug 2009 02:12:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7G2CE4g097283; Sun, 16 Aug 2009 02:12:14 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7G2CDUn097279; Sun, 16 Aug 2009 02:12:13 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908160212.n7G2CDUn097279@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 02:12: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: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 02:12:14 -0000 Author: marcel Date: Sun Aug 16 02:12:13 2009 New Revision: 196270 URL: http://svn.freebsd.org/changeset/base/196270 Log: MFC rev 196268: Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be sparse, which causes a kernel assert. Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/ia64/ia64/genassym.c stable/8/sys/ia64/ia64/machdep.c stable/8/sys/ia64/ia64/mp_machdep.c stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/ia64/ia64/genassym.c ============================================================================== --- stable/8/sys/ia64/ia64/genassym.c Sun Aug 16 01:48:46 2009 (r196269) +++ stable/8/sys/ia64/ia64/genassym.c Sun Aug 16 02:12:13 2009 (r196270) @@ -91,7 +91,6 @@ ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_current_pmap)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); Modified: stable/8/sys/ia64/ia64/machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/machdep.c Sun Aug 16 01:48:46 2009 (r196269) +++ stable/8/sys/ia64/ia64/machdep.c Sun Aug 16 02:12:13 2009 (r196270) @@ -424,7 +424,11 @@ void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { - pcpu->pc_acpi_id = cpuid; + /* + * Set pc_acpi_id to "uninitialized". + * See sys/dev/acpica/acpi_cpu.c + */ + pcpu->pc_acpi_id = 0xffffffff; } void Modified: stable/8/sys/ia64/ia64/mp_machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/mp_machdep.c Sun Aug 16 01:48:46 2009 (r196269) +++ stable/8/sys/ia64/ia64/mp_machdep.c Sun Aug 16 02:12:13 2009 (r196270) @@ -208,31 +208,25 @@ cpu_mp_add(u_int acpiid, u_int apicid, u struct pcpu *pc; u_int64_t lid; void *dpcpu; - - /* Ignore any processor numbers outside our range */ - if (acpiid > mp_maxid) - return; - - KASSERT((all_cpus & (1UL << acpiid)) == 0, - ("%s: cpu%d already in CPU map", __func__, acpiid)); + u_int cpuid; lid = LID_SAPIC_SET(apicid, apiceid); + cpuid = ((ia64_get_lid() & LID_SAPIC_MASK) == lid) ? 0 : smp_cpus++; - if ((ia64_get_lid() & LID_SAPIC_MASK) == lid) { - KASSERT(acpiid == 0, - ("%s: the BSP must be cpu0", __func__)); - } + KASSERT((all_cpus & (1UL << cpuid)) == 0, + ("%s: cpu%d already in CPU map", __func__, acpiid)); - if (acpiid != 0) { + if (cpuid != 0) { pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); + pcpu_init(pc, cpuid, sizeof(*pc)); dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); - pcpu_init(pc, acpiid, sizeof(*pc)); - dpcpu_init(dpcpu, acpiid); + dpcpu_init(dpcpu, cpuid); } else pc = pcpup; + pc->pc_acpi_id = acpiid; pc->pc_lid = lid; - all_cpus |= (1UL << acpiid); + all_cpus |= (1UL << cpuid); } void @@ -244,8 +238,8 @@ cpu_mp_announce() for (i = 0; i <= mp_maxid; i++) { pc = pcpu_find(i); if (pc != NULL) { - printf("cpu%d: SAPIC Id=%x, SAPIC Eid=%x", i, - LID_SAPIC_ID(pc->pc_lid), + printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", + i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_lid), LID_SAPIC_EID(pc->pc_lid)); if (i == 0) printf(" (BSP)\n"); @@ -305,7 +299,9 @@ cpu_mp_unleash(void *dummy) SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; if (pc->pc_awake) { - kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid); + kproc_create(ia64_store_mca_state, + (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, + "mca %u", pc->pc_cpuid); smp_cpus++; } } From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 02:19:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC6EA106568C; Sun, 16 Aug 2009 02:19:18 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f219.google.com (mail-bw0-f219.google.com [209.85.218.219]) by mx1.freebsd.org (Postfix) with ESMTP id 049708FC43; Sun, 16 Aug 2009 02:19:16 +0000 (UTC) Received: by bwz19 with SMTP id 19so2380089bwz.37 for ; Sat, 15 Aug 2009 19:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=IEzwM9Es4Q14+gPS2GYjGaOAtnvCIphyP5mMuTGCBw4=; b=VXWyGmgL516B6ko7y1q+NUVSdJAFLsQHRsOhE2ZzYVFIBBtqZFj4ksr49rxNRUVFYx lPbQpVcuiBMTpwg08YXxIM5lgTSA9952HpFYRxYiQHWYVSWvrghfN2h8etrAXCqht4Lo 08EWH12qjFmqnGWvnDkaCiJkKrLfrsCaPPcPQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Ze21RsCy77rfrI8fRmUzE3TUihYcX8Z2NSog3Gx0Z4986uVcVim/NREtlFhPkKEtjK pYPGx0XK/zlUZc2LJ1AVKZ72qy1svABZQCrP9iOerMXD3M6OY850/nkVXLEl5G3SWSg9 EIEiAJ9CR90ZZFc7+G7OmdXQ2bNJmYtoUpGjo= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.105.9 with SMTP id r9mr698006fao.66.1250389155982; Sat, 15 Aug 2009 19:19:15 -0700 (PDT) In-Reply-To: <200908160212.n7G2CDUn097279@svn.freebsd.org> References: <200908160212.n7G2CDUn097279@svn.freebsd.org> Date: Sun, 16 Aug 2009 04:19:15 +0200 X-Google-Sender-Auth: a00a604c471cfe58 Message-ID: <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> From: Attilio Rao To: Marcel Moolenaar Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 02:19:18 -0000 2009/8/16 Marcel Moolenaar : > Author: marcel > Date: Sun Aug 16 02:12:13 2009 > New Revision: 196270 > URL: http://svn.freebsd.org/changeset/base/196270 > > Log: > MFC rev 196268: > Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be > sparse, which causes a kernel assert. Can you be a bit more precise? What kernel assert? Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 02:21:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1CEF106568C; Sun, 16 Aug 2009 02:21:24 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C05F38FC41; Sun, 16 Aug 2009 02:21:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7G2LOlX097587; Sun, 16 Aug 2009 02:21:24 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7G2LOE2097585; Sun, 16 Aug 2009 02:21:24 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908160221.n7G2LOE2097585@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 02:21: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: r196271 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/common/nvpair contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xe... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 02:21:25 -0000 Author: marcel Date: Sun Aug 16 02:21:24 2009 New Revision: 196271 URL: http://svn.freebsd.org/changeset/base/196271 Log: MFC revision 196269: Fix misalignment in nvpair_native_embedded() caused by the compiler replacing the bzero(). Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 02:12:13 2009 (r196270) +++ stable/8/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c Sun Aug 16 02:21:24 2009 (r196271) @@ -2523,14 +2523,15 @@ nvpair_native_embedded(nvstream_t *nvs, { if (nvs->nvs_op == NVS_OP_ENCODE) { nvs_native_t *native = (nvs_native_t *)nvs->nvs_private; - nvlist_t *packed = (void *) + char *packed = (void *) (native->n_curr - nvp->nvp_size + NVP_VALOFF(nvp)); /* * Null out the pointer that is meaningless in the packed * structure. The address may not be aligned, so we have * to use bzero. */ - bzero(&packed->nvl_priv, sizeof (packed->nvl_priv)); + bzero(packed + offsetof(nvlist_t, nvl_priv), + sizeof(((nvlist_t *)NULL)->nvl_priv)); } return (nvs_embedded(nvs, EMBEDDED_NVL(nvp))); From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 02:43:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96420106568B; Sun, 16 Aug 2009 02:43:42 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout027.mac.com (asmtpout027.mac.com [17.148.16.102]) by mx1.freebsd.org (Postfix) with ESMTP id 7ACF68FC41; Sun, 16 Aug 2009 02:43:42 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed Received: from macbook-pro.lan.xcllnt.net ([75.101.29.67]) by asmtp027.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KOG005EK7KTSPB0@asmtp027.mac.com>; Sat, 15 Aug 2009 19:43:42 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> Date: Sat, 15 Aug 2009 19:42:26 -0700 Message-id: References: <200908160212.n7G2CDUn097279@svn.freebsd.org> <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> To: Attilio Rao X-Mailer: Apple Mail (2.1074) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 02:43:42 -0000 On Aug 15, 2009, at 7:19 PM, Attilio Rao wrote: > 2009/8/16 Marcel Moolenaar : >> Author: marcel >> Date: Sun Aug 16 02:12:13 2009 >> New Revision: 196270 >> URL: http://svn.freebsd.org/changeset/base/196270 >> >> Log: >> MFC rev 196268: >> Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be >> sparse, which causes a kernel assert. > > Can you be a bit more precise? > What kernel assert? In subr_smp.c, function smp_topo(): panic("Built bad topology at %p. CPU mask 0x%X != 0x%X", top, top->cg_mask, all_cpus); See also: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=506001+0+archive/2009/freebsd-current/20090719.freebsd-current http://docs.freebsd.org/cgi/getmsg.cgi?fetch=626164+0+archive/2009/freebsd-current/20090719.freebsd-current FYI, -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 09:41:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3898B106568E; Sun, 16 Aug 2009 09:41:26 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f219.google.com (mail-bw0-f219.google.com [209.85.218.219]) by mx1.freebsd.org (Postfix) with ESMTP id E2A1C8FC55; Sun, 16 Aug 2009 09:41:24 +0000 (UTC) Received: by bwz19 with SMTP id 19so2510895bwz.37 for ; Sun, 16 Aug 2009 02:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=6WhWCXC8T+KoFsQQ+coev4ivW4Akb/wqV2Sack4I72I=; b=Q5fH5+mgOXEKAUfhkeT4nEeW3onGuAPjhr/OUUiqbEsbry02in+Aa++c1MwrFOT8QK yF1rEdNJMyr5EyRbHGzauxd0A8KEEVRirtUqF2tigtCO0EFXF5pPOBi7ZHA6PeGWEfLF /WyH7g3lUhr7KhKSXWLKe8oS8b8Srjliv8ky4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=AZfnfyS4TWGgM/fVMgSQeDVfhDqf9kKTK8JnyHRX10pWSyvXMKauhcxMSyCM5MRr3e msuDas7kA1HzlsqS9w65jnwl1dvqMvEnDNIV+iLsUq2lwbWNUA9SXIMSvZoNspTSDLAf VX6tWX7kifbUkszcDmihcjf2ExYcU03kL36xw= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.105.16 with SMTP id r16mr740804fao.30.1250415683736; Sun, 16 Aug 2009 02:41:23 -0700 (PDT) In-Reply-To: References: <200908160212.n7G2CDUn097279@svn.freebsd.org> <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> Date: Sun, 16 Aug 2009 11:41:23 +0200 X-Google-Sender-Auth: 754e99a3b99db538 Message-ID: <3bbf2fe10908160241x64555c15oe185d429908f7131@mail.gmail.com> From: Attilio Rao To: Marcel Moolenaar Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 09:41:26 -0000 2009/8/16 Marcel Moolenaar : > > On Aug 15, 2009, at 7:19 PM, Attilio Rao wrote: > >> 2009/8/16 Marcel Moolenaar : >>> >>> Author: marcel >>> Date: Sun Aug 16 02:12:13 2009 >>> New Revision: 196270 >>> URL: http://svn.freebsd.org/changeset/base/196270 >>> >>> Log: >>> MFC rev 196268: >>> Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be >>> sparse, which causes a kernel assert. >> >> Can you be a bit more precise? >> What kernel assert? > > In subr_smp.c, function smp_topo(): > panic("Built bad topology at %p. CPU mask 0x%X != 0x%X", > top, top->cg_mask, all_cpus); > > See also: > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=506001+0+archive/2009/freebsd-current/20090719.freebsd-current > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=626164+0+archive/2009/freebsd-current/20090719.freebsd-current lThat's very interesting. That probabilly means we will end without any sparse CPUs IDs on all architectures? That would be very important because we could cut things like CPU_ABSENT() and rearrange things in a very different way. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 10:11:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47F56106568B; Sun, 16 Aug 2009 10:11:34 +0000 (UTC) (envelope-from rink@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3726C8FC51; Sun, 16 Aug 2009 10:11:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GABYvk010922; Sun, 16 Aug 2009 10:11:34 GMT (envelope-from rink@svn.freebsd.org) Received: (from rink@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GABY5F010920; Sun, 16 Aug 2009 10:11:34 GMT (envelope-from rink@svn.freebsd.org) Message-Id: <200908161011.n7GABY5F010920@svn.freebsd.org> From: Rink Springer Date: Sun, 16 Aug 2009 10:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196272 - head/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 10:11:34 -0000 Author: rink Date: Sun Aug 16 10:11:33 2009 New Revision: 196272 URL: http://svn.freebsd.org/changeset/base/196272 Log: Prevent sysinstall from needlessly waiting for confirmation when using an USB device in non-interactive mode. If there are no USB devices, sysinstall gives an error messages, and if there is >1, it'll ask which one is to be used. This change allows a non-interactive install from USB media to succeed without any user interaction if there is exactly one USB disk device in the system it can use. Submitted by: Daniel O'Connor < doconnorat gsoft dot com dot au > Reviewed by: randi Approved by: re (rwatson) Modified: head/usr.sbin/sysinstall/media.c Modified: head/usr.sbin/sysinstall/media.c ============================================================================== --- head/usr.sbin/sysinstall/media.c Sun Aug 16 02:21:24 2009 (r196271) +++ head/usr.sbin/sysinstall/media.c Sun Aug 16 10:11:33 2009 (r196272) @@ -262,7 +262,8 @@ mediaSetUSB(dialogMenuItem *self) mediaDevice = devs[0]; if (mediaDevice) mediaDevice->private = NULL; - msgConfirm("Using USB device: %s", mediaDevice->name); + if (!variable_get(VAR_NONINTERACTIVE)) + msgConfirm("Using USB device: %s", mediaDevice->name); return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 10:25:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D855B106568B; Sun, 16 Aug 2009 10:25:58 +0000 (UTC) (envelope-from rink@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6B2E8FC43; Sun, 16 Aug 2009 10:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GAPwtH013234; Sun, 16 Aug 2009 10:25:58 GMT (envelope-from rink@svn.freebsd.org) Received: (from rink@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GAPwMY013232; Sun, 16 Aug 2009 10:25:58 GMT (envelope-from rink@svn.freebsd.org) Message-Id: <200908161025.n7GAPwMY013232@svn.freebsd.org> From: Rink Springer Date: Sun, 16 Aug 2009 10:25:58 +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: r196273 - stable/8/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 10:25:59 -0000 Author: rink Date: Sun Aug 16 10:25:58 2009 New Revision: 196273 URL: http://svn.freebsd.org/changeset/base/196273 Log: MFC r196272 Prevent sysinstall from needlessly waiting for confirmation when using an USB device in non-interactive mode. If there are no USB devices, sysinstall gives an error messages, and if there is >1, it'll ask which one is to be used. This change allows a non-interactive install from USB media to succeed without any user interaction if there is exactly one USB disk device in the system it can use. Submitted by: Daniel O'Connor < doconnorat gsoft dot com dot au > Reviewed by: randi Approved by: re (rwatson) Modified: stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/sysinstall/media.c Modified: stable/8/usr.sbin/sysinstall/media.c ============================================================================== --- stable/8/usr.sbin/sysinstall/media.c Sun Aug 16 10:11:33 2009 (r196272) +++ stable/8/usr.sbin/sysinstall/media.c Sun Aug 16 10:25:58 2009 (r196273) @@ -262,7 +262,8 @@ mediaSetUSB(dialogMenuItem *self) mediaDevice = devs[0]; if (mediaDevice) mediaDevice->private = NULL; - msgConfirm("Using USB device: %s", mediaDevice->name); + if (!variable_get(VAR_NONINTERACTIVE)) + msgConfirm("Using USB device: %s", mediaDevice->name); return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 12:34:17 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A84AD106564A; Sun, 16 Aug 2009 12:34:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 252038FC52; Sun, 16 Aug 2009 12:34:16 +0000 (UTC) Received: from c122-107-127-137.carlnfd1.nsw.optusnet.com.au (c122-107-127-137.carlnfd1.nsw.optusnet.com.au [122.107.127.137]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7GCYDJi005427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 16 Aug 2009 22:34:14 +1000 Date: Sun, 16 Aug 2009 22:34:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Marcel Moolenaar In-Reply-To: <200908160221.n7G2LOE2097585@svn.freebsd.org> Message-ID: <20090816220319.W32412@delplex.bde.org> References: <200908160221.n7G2LOE2097585@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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: r196271 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/common/nvpair contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xe... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 12:34:17 -0000 On Sun, 16 Aug 2009, Marcel Moolenaar wrote: > MFC revision 196269: > Fix misalignment in nvpair_native_embedded() caused by the compiler > replacing the bzero(). How can it replace bzero() with -ffreestanding, which implies -fbuiltin and guarantees that should be stronger not to use library functions? (gcc.info is poorly worded, so the stronger guarantees are actually weaker.) > Modified: > stable/8/sys/ (props changed) > stable/8/sys/amd64/include/xen/ (props changed) > ... Still has too many props. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 14:13:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70170106568B; Sun, 16 Aug 2009 14:13:56 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45DE98FC41; Sun, 16 Aug 2009 14:13:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GEDuk4018865; Sun, 16 Aug 2009 14:13:56 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GEDuYN018862; Sun, 16 Aug 2009 14:13:56 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200908161413.n7GEDuYN018862@svn.freebsd.org> From: Andrew Thompson Date: Sun, 16 Aug 2009 14:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196274 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 14:13:56 -0000 Author: thompsa Date: Sun Aug 16 14:13:55 2009 New Revision: 196274 URL: http://svn.freebsd.org/changeset/base/196274 Log: Change the usb workers from kernel processes to threads, this is mostly a cosmetic change to reduce cruft in the proc table. Also change the idle wait message to `-` like how taskqueues are. Reviewed by: julian Approved by: re (kib) Modified: head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_process.h Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Sun Aug 16 10:25:58 2009 (r196273) +++ head/sys/dev/usb/usb_process.c Sun Aug 16 14:13:55 2009 (r196274) @@ -63,10 +63,12 @@ #endif #if (__FreeBSD_version >= 800000) +static struct proc *usbproc; #define USB_THREAD_CREATE(f, s, p, ...) \ - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) -#define USB_THREAD_SUSPEND(p) kproc_suspend(p,0) -#define USB_THREAD_EXIT(err) kproc_exit(err) + kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ + 0, "usb", __VA_ARGS__) +#define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) +#define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) @@ -207,8 +209,8 @@ usb_proc_create(struct usb_process *up, TAILQ_INIT(&up->up_qhead); - cv_init(&up->up_cv, "wmsg"); - cv_init(&up->up_drain, "dmsg"); + cv_init(&up->up_cv, "-"); + cv_init(&up->up_drain, "usbdrain"); if (USB_THREAD_CREATE(&usb_process, up, &up->up_ptr, pmesg)) { Modified: head/sys/dev/usb/usb_process.h ============================================================================== --- head/sys/dev/usb/usb_process.h Sun Aug 16 10:25:58 2009 (r196273) +++ head/sys/dev/usb/usb_process.h Sun Aug 16 14:13:55 2009 (r196274) @@ -49,7 +49,11 @@ struct usb_process { struct cv up_cv; struct cv up_drain; +#if (__FreeBSD_version >= 800000) + struct thread *up_ptr; +#else struct proc *up_ptr; +#endif struct thread *up_curtd; struct mtx *up_mtx; From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 14:17:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E6C1106568B; Sun, 16 Aug 2009 14:17:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8347C8FC15; Sun, 16 Aug 2009 14:17:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GEHljw019090; Sun, 16 Aug 2009 14:17:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GEHl7W019087; Sun, 16 Aug 2009 14:17:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200908161417.n7GEHl7W019087@svn.freebsd.org> From: Andrew Thompson Date: Sun, 16 Aug 2009 14:17:47 +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: r196275 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/usb dev/xen/netfront dev/xen/xenpci modules/dtrace/dtnfsclient... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 14:17:47 -0000 Author: thompsa Date: Sun Aug 16 14:17:47 2009 New Revision: 196275 URL: http://svn.freebsd.org/changeset/base/196275 Log: MFC r196274 Change the usb workers from kernel processes to threads, this is mostly a cosmetic change to reduce cruft in the proc table. Also change the idle wait message to `-` like how taskqueues are. Reviewed by: julian Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/usb/usb_process.c stable/8/sys/dev/usb/usb_process.h stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Sun Aug 16 14:13:55 2009 (r196274) +++ stable/8/sys/dev/usb/usb_process.c Sun Aug 16 14:17:47 2009 (r196275) @@ -63,10 +63,12 @@ #endif #if (__FreeBSD_version >= 800000) +static struct proc *usbproc; #define USB_THREAD_CREATE(f, s, p, ...) \ - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) -#define USB_THREAD_SUSPEND(p) kproc_suspend(p,0) -#define USB_THREAD_EXIT(err) kproc_exit(err) + kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ + 0, "usb", __VA_ARGS__) +#define USB_THREAD_SUSPEND(p) kthread_suspend(p,0) +#define USB_THREAD_EXIT(err) kthread_exit() #else #define USB_THREAD_CREATE(f, s, p, ...) \ kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) @@ -207,8 +209,8 @@ usb_proc_create(struct usb_process *up, TAILQ_INIT(&up->up_qhead); - cv_init(&up->up_cv, "wmsg"); - cv_init(&up->up_drain, "dmsg"); + cv_init(&up->up_cv, "-"); + cv_init(&up->up_drain, "usbdrain"); if (USB_THREAD_CREATE(&usb_process, up, &up->up_ptr, pmesg)) { Modified: stable/8/sys/dev/usb/usb_process.h ============================================================================== --- stable/8/sys/dev/usb/usb_process.h Sun Aug 16 14:13:55 2009 (r196274) +++ stable/8/sys/dev/usb/usb_process.h Sun Aug 16 14:17:47 2009 (r196275) @@ -49,7 +49,11 @@ struct usb_process { struct cv up_cv; struct cv up_drain; +#if (__FreeBSD_version >= 800000) + struct thread *up_ptr; +#else struct proc *up_ptr; +#endif struct thread *up_curtd; struct mtx *up_mtx; From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 15:20:35 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28C6E106568D; Sun, 16 Aug 2009 15:20:35 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout029.mac.com (asmtpout029.mac.com [17.148.16.104]) by mx1.freebsd.org (Postfix) with ESMTP id 0C5CC8FC4D; Sun, 16 Aug 2009 15:20:34 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes Received: from macbook-pro.lan.xcllnt.net ([75.101.29.67]) by asmtp029.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KOH0091R6M9IJ90@asmtp029.mac.com>; Sun, 16 Aug 2009 08:20:34 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <20090816220319.W32412@delplex.bde.org> Date: Sun, 16 Aug 2009 08:20:33 -0700 Message-id: <0997BA81-4982-467A-AB0B-7A1233B82665@mac.com> References: <200908160221.n7G2LOE2097585@svn.freebsd.org> <20090816220319.W32412@delplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1074) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, Marcel Moolenaar , svn-src-stable-8@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196271 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/common/nvpair contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xe... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 15:20:35 -0000 On Aug 16, 2009, at 5:34 AM, Bruce Evans wrote: > On Sun, 16 Aug 2009, Marcel Moolenaar wrote: > >> MFC revision 196269: >> Fix misalignment in nvpair_native_embedded() caused by the compiler >> replacing the bzero(). > > How can it replace bzero() with -ffreestanding, which implies - > fbuiltin > and guarantees that should be stronger not to use library functions? > (gcc.info is poorly worded, so the stronger guarantees are actually > weaker.) -ffreestanding applies to the kernel only. This code is shared between kernel and userspace and the misalignment is in userspace. -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 15:32:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929B2106568B; Sun, 16 Aug 2009 15:32:15 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout025.mac.com (asmtpout025.mac.com [17.148.16.100]) by mx1.freebsd.org (Postfix) with ESMTP id 745518FC4D; Sun, 16 Aug 2009 15:32:15 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed Received: from macbook-pro.lan.xcllnt.net ([75.101.29.67]) by asmtp025.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KOH00KFB75P4N10@asmtp025.mac.com>; Sun, 16 Aug 2009 08:32:15 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <3bbf2fe10908160241x64555c15oe185d429908f7131@mail.gmail.com> Date: Sun, 16 Aug 2009 08:32:12 -0700 Message-id: <90894806-263A-4BB5-AA5E-704EB24A6A0B@mac.com> References: <200908160212.n7G2CDUn097279@svn.freebsd.org> <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> <3bbf2fe10908160241x64555c15oe185d429908f7131@mail.gmail.com> To: Attilio Rao X-Mailer: Apple Mail (2.1074) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 15:32:15 -0000 On Aug 16, 2009, at 2:41 AM, Attilio Rao wrote: > 2009/8/16 Marcel Moolenaar : >> >> On Aug 15, 2009, at 7:19 PM, Attilio Rao wrote: >> >>> 2009/8/16 Marcel Moolenaar : >>>> >>>> Author: marcel >>>> Date: Sun Aug 16 02:12:13 2009 >>>> New Revision: 196270 >>>> URL: http://svn.freebsd.org/changeset/base/196270 >>>> >>>> Log: >>>> MFC rev 196268: >>>> Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be >>>> sparse, which causes a kernel assert. >>> >>> Can you be a bit more precise? >>> What kernel assert? >> >> In subr_smp.c, function smp_topo(): >> panic("Built bad topology at %p. CPU mask 0x%X != 0x%X", >> top, top->cg_mask, all_cpus); >> >> See also: >> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=506001+0+archive/2009/freebsd-current/20090719.freebsd-current >> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=626164+0+archive/2009/freebsd-current/20090719.freebsd-current > > lThat's very interesting. That probabilly means we will end without > any sparse CPUs IDs on all architectures? Yes. It also means that hot-swap CPUs are impossible to support for reasons that are unrelated to the technical problems of managing the appearance and disappearance of CPUs. -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 19:55:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0213106568B; Sun, 16 Aug 2009 19:55:53 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF7B98FC43; Sun, 16 Aug 2009 19:55:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GJtrP6030130; Sun, 16 Aug 2009 19:55:53 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GJtrTR030129; Sun, 16 Aug 2009 19:55:53 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908161955.n7GJtrTR030129@svn.freebsd.org> From: Ed Schouten Date: Sun, 16 Aug 2009 19:55:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196276 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 19:55:54 -0000 Author: ed Date: Sun Aug 16 19:55:53 2009 New Revision: 196276 URL: http://svn.freebsd.org/changeset/base/196276 Log: Fix small style regression introduced by the MPSAFE newbus code. Approved by: re (rwatson) Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sun Aug 16 14:17:47 2009 (r196275) +++ head/sys/kern/subr_bus.c Sun Aug 16 19:55:53 2009 (r196276) @@ -4131,7 +4131,7 @@ driver_module_handler(module_t mod, int return (ENOMEM); } - switch (what) { + switch (what) { case MOD_LOAD: if (dmd->dmd_chainevh) error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 20:33:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0286A106568B; Sun, 16 Aug 2009 20:33:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2DC28FC15; Sun, 16 Aug 2009 20:33:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GKXGrF031002; Sun, 16 Aug 2009 20:33:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GKXGQU031000; Sun, 16 Aug 2009 20:33:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908162033.n7GKXGQU031000@svn.freebsd.org> From: Ed Schouten Date: Sun, 16 Aug 2009 20:33: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: r196277 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci kern modules/dtrace/dtnfsclient mo... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 20:33:17 -0000 Author: ed Date: Sun Aug 16 20:33:16 2009 New Revision: 196277 URL: http://svn.freebsd.org/changeset/base/196277 Log: MFC r196276: Fix small style regression introduced by the MPSAFE newbus code. Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/subr_bus.c stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Sun Aug 16 19:55:53 2009 (r196276) +++ stable/8/sys/kern/subr_bus.c Sun Aug 16 20:33:16 2009 (r196277) @@ -4131,7 +4131,7 @@ driver_module_handler(module_t mod, int return (ENOMEM); } - switch (what) { + switch (what) { case MOD_LOAD: if (dmd->dmd_chainevh) error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 21:27:35 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6680A106568B; Sun, 16 Aug 2009 21:27:35 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 559678FC4B; Sun, 16 Aug 2009 21:27:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GLRZig032524; Sun, 16 Aug 2009 21:27:35 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GLRZl5032522; Sun, 16 Aug 2009 21:27:35 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908162127.n7GLRZl5032522@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 21:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196278 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 21:27:35 -0000 Author: marcel Date: Sun Aug 16 21:27:35 2009 New Revision: 196278 URL: http://svn.freebsd.org/changeset/base/196278 Log: Emit a proper error message instead of dumping core when 1) GEOM_PART does not exist in the kernel, and 2) the GEOM in question does not exist. Additionally abort in case of programming errors that result in neither the class nor geom not being present in the gctl request. Submitted by: "Andrey V. Elsukov" Approved by: re (kib) Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Sun Aug 16 20:33:16 2009 (r196277) +++ head/sbin/geom/class/part/geom_part.c Sun Aug 16 21:27:35 2009 (r196278) @@ -274,8 +274,18 @@ gpart_autofill(struct gctl_req *req) error = geom_gettree(&mesh); if (error) return (error); - cp = find_class(&mesh, gctl_get_ascii(req, "class")); - gp = find_geom(cp, gctl_get_ascii(req, "geom")); + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + cp = find_class(&mesh, s); + if (cp == NULL) + errx(EXIT_FAILURE, "Class %s not found.", s); + s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); + gp = find_geom(cp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); first = atoll(find_geomcfg(gp, "first")); last = atoll(find_geomcfg(gp, "last")); grade = ~0ULL; @@ -536,6 +546,8 @@ gpart_write_partcode(struct gctl_req *re errx(EXIT_FAILURE, "Class %s not found.", s); } s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); From owner-svn-src-all@FreeBSD.ORG Sun Aug 16 21:32:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 726EB106564A; Sun, 16 Aug 2009 21:32:12 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60A3A8FC67; Sun, 16 Aug 2009 21:32:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7GLWCbV032671; Sun, 16 Aug 2009 21:32:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7GLWCGm032669; Sun, 16 Aug 2009 21:32:12 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908162132.n7GLWCGm032669@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 16 Aug 2009 21:32: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: r196279 - in stable/8/sbin/geom: . class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2009 21:32:12 -0000 Author: marcel Date: Sun Aug 16 21:32:12 2009 New Revision: 196279 URL: http://svn.freebsd.org/changeset/base/196279 Log: MFC change 196278: Emit a proper error message instead of dumping core when 1) GEOM_PART does not exist in the kernel, and 2) the GEOM in question does not exist. Additionally abort in case of programming errors that result in neither the class nor geom not being present in the gctl request. Approved by: re (kib) Modified: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/geom_part.c Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Sun Aug 16 21:27:35 2009 (r196278) +++ stable/8/sbin/geom/class/part/geom_part.c Sun Aug 16 21:32:12 2009 (r196279) @@ -274,8 +274,18 @@ gpart_autofill(struct gctl_req *req) error = geom_gettree(&mesh); if (error) return (error); - cp = find_class(&mesh, gctl_get_ascii(req, "class")); - gp = find_geom(cp, gctl_get_ascii(req, "geom")); + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + cp = find_class(&mesh, s); + if (cp == NULL) + errx(EXIT_FAILURE, "Class %s not found.", s); + s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); + gp = find_geom(cp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); first = atoll(find_geomcfg(gp, "first")); last = atoll(find_geomcfg(gp, "last")); grade = ~0ULL; @@ -536,6 +546,8 @@ gpart_write_partcode(struct gctl_req *re errx(EXIT_FAILURE, "Class %s not found.", s); } s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 06:05:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51FD31065672; Mon, 17 Aug 2009 06:05:56 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F3188FC5A; Mon, 17 Aug 2009 06:05:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H65tDL049135; Mon, 17 Aug 2009 06:05:55 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H65thw049134; Mon, 17 Aug 2009 06:05:55 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170605.n7H65thw049134@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 06:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196280 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 06:05:56 -0000 Author: scottl Date: Mon Aug 17 06:05:55 2009 New Revision: 196280 URL: http://svn.freebsd.org/changeset/base/196280 Log: Move mfiutil.1 to mfiutil.8 for consistency. Remove superfulous README. Approved by: re Added: head/usr.sbin/mfiutil/mfiutil.8 (props changed) - copied unchanged from r196279, head/usr.sbin/mfiutil/mfiutil.1 Deleted: head/usr.sbin/mfiutil/README head/usr.sbin/mfiutil/mfiutil.1 Modified: head/usr.sbin/mfiutil/Makefile Modified: head/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Sun Aug 16 21:32:12 2009 (r196279) +++ head/usr.sbin/mfiutil/Makefile Mon Aug 17 06:05:55 2009 (r196280) @@ -3,6 +3,7 @@ PROG= mfiutil SRCS= mfiutil.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c mfi_flash.c \ mfi_patrol.c mfi_show.c mfi_volume.c +MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime WARNS?=3 Copied: head/usr.sbin/mfiutil/mfiutil.8 (from r196279, head/usr.sbin/mfiutil/mfiutil.1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280, copy of r196279, head/usr.sbin/mfiutil/mfiutil.1) @@ -0,0 +1,574 @@ +.\" Copyright (c) 2008, 2009 Yahoo!, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 17, 2008 +.Dt MFIUTIL 1 +.Os +.Sh NAME +.Nm mfiutil +.Nd Utility for managing LSI MegaRAID SAS controllers +.Sh SYNOPSIS +.Nm +.Cm version +.Nm +.Op Fl u Ar unit +.Cm show adapter +.Nm +.Op Fl u Ar unit +.Cm show battery +.Nm +.Op Fl u Ar unit +.Cm show config +.Nm +.Op Fl u Ar unit +.Cm show drives +.Nm +.Op Fl u Ar unit +.Cm show events +.Op Fl c Ar class +.Op Fl l Ar locale +.Op Fl n Ar count +.Op Fl v +.Op Ar start Op Ar stop +.Nm +.Op Fl u Ar unit +.Cm show firmware +.Nm +.Op Fl u Ar unit +.Cm show logstate +.Nm +.Op Fl u Ar unit +.Cm show patrol +.Nm +.Op Fl u Ar unit +.Cm show volumes +.Nm +.Op Fl u Ar unit +.Cm fail Ar drive +.Nm +.Op Fl u Ar unit +.Cm good Ar drive +.Nm +.Op Fl u Ar unit +.Cm rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm drive progress Ar drive +.Nm +.Op Fl u Ar unit +.Cm drive clear Ar drive Brq "start | stop" +.Nm +.Op Fl u Ar unit +.Cm start rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm abort rebuild Ar drive +.Nm +.Op Fl u Ar unit +.Cm locate Ar drive Brq "on | off" +.Nm +.Op Fl u Ar unit +.Cm cache Ar volume Op Ar setting Op Ar value +.Nm +.Op Fl u Ar unit +.Cm name Ar volume Ar name +.Nm +.Op Fl u Ar unit +.Cm volume progress Ar volume +.Nm +.Op Fl u Ar unit +.Cm clear +.Nm +.Op Fl u Ar unit +.Cm create Ar type +.Op Fl v +.Op Fl s Ar stripe_size +.Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Op Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Nm +.Op Fl u Ar unit +.Cm delete Ar volume +.Nm +.Op Fl u Ar unit +.Cm add Ar drive Op Ar volume +.Nm +.Op Fl u Ar unit +.Cm remove Ar drive +.Nm +.Op Fl u Ar unit +.Cm start patrol +.Nm +.Op Fl u Ar unit +.Cm stop patrol +.Nm +.Op Fl u Ar unit +.Cm patrol Ar command Op Ar interval Op Ar start +.Nm +.Op Fl u Ar unit +.Cm flash Ar file +.Sh DESCRIPTION +The +.Nm +utility can be used to display or modify various parameters on LSI +MegaRAID SAS RAID controllers. +Each invocation of +.Nm +consists of zero or more global options followed by a command. +Commands may support additional optional or required arguments after the +command. +.Pp +Currently one global option is supported: +.Bl -tag -width indent +.It Fl u Ar unit +.Ar unit +specifies the unit of the controller to work with. +If no unit is specified, +then unit 0 is used. +.El +.Pp +Volumes may be specified in two forms. +First, +a volume may be identified by its target ID. +Second, +on the volume may be specified by the corresponding +.Em mfidX +device, +such as +.Em mfid0 . +Note that this second method only works on OS versions +.Dv 6.2-YAHOO-20070510 +and later. +.Pp +Drives may be specified in two forms. +First, +a drive may be identified by its device ID. +The device ID for configured drives can be found in +.Cm show config . +Second, +a drive may be identified by its location as +.Sm off +.Op E Ar xx Ns \&: +.Li S Ns Ar yy +.Sm on +where +.Ar xx +is the enclosure +and +.Ar yy +is the slot for each drive as displayed in +.Cm show drives . +.Pp +The +.Nm +utility supports several different groups of commands. +The first group of commands provide information about the controller, +the volumes it manages, and the drives it controls. +The second group of commands are used to manage the physical drives +attached to the controller. +The third group of commands are used to manage the logical volumes +managed by the controller. +The fourth group of commands are used to manage the drive configuration for +the controller. +The fifth group of commands are used to manage controller-wide operations. +.Pp +The informational commands include: +.Bl -tag -width indent +.It Cm version +Displays the version of +.Nm . +.It Cm show adapter +Displays information about the RAID controller such as the model number. +.It Cm show battery +Displays information about the battery from the battery backup unit. +.It Cm show config +Displays the volume and drive configuration for the controller. +Each array is listed along with the physical drives the array is built from. +Each volume is listed along with the arrays that the volume spans. +If any hot spare drives are configured, then they are listed as well. +.It Cm show drives +Lists all of the physical drives attached to the controller. +.It Xo Cm show events +.Op Fl c Ar class +.Op Fl l Ar locale +.Op Fl n Ar count +.Op Fl v +.Op Ar start Op Ar stop +.Xc +Display entries from the controller's event log. +The controller maintains a circular buffer of events. +Each event is tagged with a class and locale. +.Pp +The +.Ar class +parameter limits the output to entries at the specified class or higher. +The default class is +.Dq warn . +The available classes from lowest priority to highest are: +.Bl -tag -width -indent +.It Cm debug +Debug messages. +.It Cm progress +Periodic progress updates for long-running operations such as background +initializations, array rebuilds, or patrol reads. +.It Cm info +Informational messages such as drive insertions and volume creations. +.It Cm warn +Indicates that some component may be close to failing. +.It Cm crit +A component has failed, but no data is lost. +For example, a volume becoming degraded due to a drive failure. +.It Cm fatal +A component has failed resulting in data loss. +.It Cm dead +The controller itself has died. +.El +.Pp +The +.Ar locale +parameter limits the output to entries for the specified part of the controller. +The default locale is +.Dq all . +The available locales are +.Dq volume , +.Dq drive , +.Dq enclousure , +.Dq battery , +.Dq sas , +.Dq controller , +.Dq config , +.Dq cluster , +and +.Dq all . +.Pp +The +.Ar count +parameter is a debugging aid that specifies the number of events to fetch from +the controller for each low-level request. +The default is 15 events. +.Pp +By default, matching event log entries from the previous shutdown up to the +present are displayed. This range can be adjusted via the +.Ar start +and +.Ar stop +parameters. +Each of these parameters can either be specified as a log entry number or as +one of the following aliases: +.Bl -tag -width -indent +.It Cm newest +The newest entry in the event log. +.It Cm oldest +The oldest entry in the event log. +.It Cm clear +The first entry since the event log was cleared. +.It Cm shutdown +The entry in the event log corresponding to the last time the controller was +cleanly shut down. +.It Cm boot +The entry in the event log corresponding to the most recent boot. +.El +.It Cm show firmware +Lists all of the firmware images present on the controller. +.It Cm show logstate +Display the various sequence numbers associated with the event log. +.It Cm show patrol +Display the status of the controller's patrol read operation. +.It Cm show volumes +Lists all of the logical volumes managed by the controller. +.El +.Pp +The physical drive management commands include: +.Bl -tag -width indent +.It Cm fail Ar drive +Mark +.Ar drive +as failed. +.Ar Drive +must be an online drive that is part of an array. +.It Cm good Ar drive +Mark +.Ar drive +as an unconfigured good drive. +.Ar Drive +must not be part of an existing array. +.It Cm rebuild Ar drive +Mark a failed +.Ar drive +that is still part of an array as a good drive suitable for a rebuild. +The firmware should kick off an array rebuild on its own if a failed drive +is marked as a rebuild drive. +.It Cm drive progress Ar drive +Report the current progress and estimated completion time of drive operations +such as rebuilds or patrol reads. +.It Cm drive clear Ar drive Brq "start | stop" +Start or stop the writing of all 0x00 characters to a drive. +.It Cm start rebuild Ar drive +Manually start a rebuild on +.Ar drive . +.It Cm abort rebuild Ar drive +Abort an in-progress rebuild operation on +.Ar drive . +It can be resumed with the +.Cm start rebuild +command. +.It Cm locate Ar drive Brq "on | off" +Change the state of the external LED associated with +.Ar drive . +.El +.Pp +The logical volume management commands include: +.Bl -tag -width indent +.It Cm cache Ar volume Op Ar setting Op Ar value +If no +.Ar setting +argument is supplied, then the current cache policy for +.Ar volume +is displayed; +otherwise, +the cache policy for +.Ar volume +is modified. +The optional +.Ar setting +argument can be one of the following values: +.Bl -tag -width indent +.It Cm enable +Enable caching for both read and write I/O operations. +.It Cm disable +Disable caching for both read and write I/O operations. +.It Cm reads +Enable caching only for read I/O operations. +.It Cm writes +Enable caching only for write I/O operations. +.It Cm write-back +Use write-back policy for cached writes. +.It Cm write-through +Use write-through policy for cached writes. +.It Cm read-ahead Op Ar value +Set the read ahead policy for cached reads. +The +.Ar value +argument can be set to either +.Dq none , +.Dq adaptive , +or +.Dq always . +.It Cm write-cache Op Ar value +Control the write caches on the physical drives backing +.Ar volume . +The +.Ar value +argument can be set to either +.Dq disable , +.Dq enable , +or +.Dq default . +.Pp +In general this setting should be left disabled to avoid data loss when the +physical drives lose power. +The battery backup of the RAID controller does not save data in the write +caches of the physical drives. +.El +.It Cm name Ar volume Ar name +Sets the name of +.Ar volume +to +.Ar name . +.It Cm volume progress Ar volume +Report the current progress and estimated completion time of volume operations +such as consistency checks and initializations. +.El +.Pp +The configuration commands include: +.Bl -tag -width indent +.It Cm clear +Delete the entire configuration including all volumes, arrays, and spares. +.It Xo Cm create Ar type +.Op Fl v +.Op Fl s Ar stripe_size +.Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Op Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." +.Xc +Create a new volume. +The +.Ar type +specifies the type of volume to create. +Currently supported types include: +.Bl -tag -width indent +.It Cm jbod +Creates a RAID0 volume for each drive specified. +Each drive must be specified as a separate argument. +.It Cm raid0 +Creates one RAID0 volume spanning the drives listed in the single drive list. +.It Cm raid1 +Creates one RAID1 volume spanning the drives listed in the single drive list. +.It Cm raid5 +Creates one RAID5 volume spanning the drives listed in the single drive list. +.It Cm raid6 +Creates one RAID6 volume spanning the drives listed in the single drive list. +.It Cm raid10 +Creates one RAID10 volume spanning multiple RAID1 arrays. +The drives for each RAID1 array are specified as a single drive list. +.It Cm raid50 +Creates one RAID50 volume spanning multiple RAID5 arrays. +The drives for each RAID5 array are specified as a single drive list. +.It Cm raid60 +Creates one RAID60 volume spanning multiple RAID6 arrays. +The drives for each RAID6 array are specified as a single drive list. +.It Cm concat +Creates a single volume by concatenating all of the drives in the single drive +list. +.El +.Pp +.Sy Note: +Not all volume types are supported by all controllers. +.Pp +If the +.Fl v +flag is specified after +.Ar type , +then more verbose output will be enabled. +Currently this just provides notification as drives are added to arrays and +arrays to volumes when building the configuration. +.Pp +The +.Fl s +.Ar stripe_size +parameter allows the stripe size of the array to be set. +By default a stripe size of 64K is used. +Valid values are 512 through 1M, though the MFI firmware may reject some +values. +.It Cm delete Ar volume +Delete the volume +.Ar volume . +.It Cm add Ar drive Op Ar volume +Mark +.Ar drive +as a hot spare. +.Ar Drive +must be in the unconfigured good state. +If +.Ar volume +is specified, +then the hot spare will be dedicated to arrays backing that volume. +Otherwise, +.Ar drive +will be used as a global hot spare backing all arrays for this controller. +Note that +.Ar drive +must be as large as the smallest drive in all of the arrays it is going to +back. +.It Cm remove Ar drive +Remove the hot spare +.Ar drive +from service. +It will be placed in the unconfigured good state. +.El +.Pp +The controller management commands include: +.Bl -tag -width indent +.It Cm patrol Ar command Op Ar interval Op Ar start +Set the patrol read operation mode. +The +.Ar command +argument can be one of the following values: +.Bl -tag -width indent +.It Cm disable +Disable patrol reads. +.It Cm auto +Enable periodic patrol reads initiated by the firmware. +The optional +.Ar interval +argument specifies the interval in seconds between patrol reads. +If patrol reads should be run continously, +then +.Ar interval +should consist of the word +.Dq continuously . +The optional +.Ar start +argument specifies a non-negative, relative start time for the next patrol read. +If an interval or start time is not specified, +then the existing setting will be used. +.It Cm manual +Enable manual patrol reads that are only initiated by the user. +.El +.It Cm start patrol +Start a patrol read operation. +.It Cm stop patrol +Stop a currently running patrol read operation. +.It Cm flash Ar file +Updates the flash on the controller with the firmware stored in +.Ar file . +A reboot is required for the new firmware to take effect. +.El +.Sh EXAMPLES +Configure the cache for volume mfid0 to cache only writes: +.Pp +.Dl Nm Cm cache mfid0 writes +.Dl Nm Cm cache mfid0 write-back +.Pp +Create a RAID5 array spanning the first four disks in the second enclosure: +.Pp +.Dl Nm Cm create raid5 e1:s0,e1:s1,e1:s2,e1:s4 +.Pp +Configure the first three disks on a controller as JBOD: +.Pp +.Dl Nm Cm create jbod 0 1 2 +.Pp +Create a RAID10 volume that spans two arrays each of which contains two disks +from two different enclosures: +.Pp +.Dl Nm Cm create raid10 e1:s0,e1:s1 e2:s0,e2:s1 +.Pp +Add drive with the device ID of 4 as a global hot spare: +.Pp +.Dl Nm Cm add 4 +.Pp +Add the drive in slot 2 in the main chassis as a hot spare for volume mfid0: +.Pp +.Dl Nm Cm add s2 mfid0 +.Pp +Configure the adapter to run periodic patrol reads once a week with the first +patrol read starting in 5 minutes: +.Pp +.Dl Nm Cm patrol auto 604800 300 +.Pp +.Sh SEE ALSO +.Xr mfi 4 +.Sh BUGS +On 64-bit OS versions +.Dv 6.2-YAHOO-20070514 +and earlier, +the +.Xr mfi 4 +driver does not properly report firmware errors to 32-bit versions of +.Nm . +As a result, +some commands may fail even though they do not report any errors. From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 06:11:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DFCD106568E; Mon, 17 Aug 2009 06:11:30 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DD168FC59; Mon, 17 Aug 2009 06:11:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H6BUw2049300; Mon, 17 Aug 2009 06:11:30 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H6BUif049298; Mon, 17 Aug 2009 06:11:30 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170611.n7H6BUif049298@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 06:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196281 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 06:11:30 -0000 Author: scottl Date: Mon Aug 17 06:11:30 2009 New Revision: 196281 URL: http://svn.freebsd.org/changeset/base/196281 Log: Update the man page for FreeBSD 8.0 Approved by: re Modified: head/usr.sbin/mfiutil/mfiutil.8 Modified: head/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:11:30 2009 (r196281) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2008 +.Dd August 16, 2009 .Dt MFIUTIL 1 .Os .Sh NAME @@ -161,9 +161,6 @@ on the volume may be specified by the co device, such as .Em mfid0 . -Note that this second method only works on OS versions -.Dv 6.2-YAHOO-20070510 -and later. .Pp Drives may be specified in two forms. First, @@ -562,13 +559,8 @@ patrol read starting in 5 minutes: .Pp .Sh SEE ALSO .Xr mfi 4 -.Sh BUGS -On 64-bit OS versions -.Dv 6.2-YAHOO-20070514 -and earlier, -the -.Xr mfi 4 -driver does not properly report firmware errors to 32-bit versions of -.Nm . -As a result, -some commands may fail even though they do not report any errors. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 06:15:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51F1E1065693; Mon, 17 Aug 2009 06:15:10 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2725B8FC3F; Mon, 17 Aug 2009 06:15:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H6F8A1049410; Mon, 17 Aug 2009 06:15:08 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H6F8n8049408; Mon, 17 Aug 2009 06:15:08 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170615.n7H6F8n8049408@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 06:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196282 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 06:15:10 -0000 Author: scottl Date: Mon Aug 17 06:15:08 2009 New Revision: 196282 URL: http://svn.freebsd.org/changeset/base/196282 Log: Update the man page for manual section 8 Approved by: re Modified: head/usr.sbin/mfiutil/mfiutil.8 Modified: head/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:11:30 2009 (r196281) +++ head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:15:08 2009 (r196282) @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" .Dd August 16, 2009 -.Dt MFIUTIL 1 +.Dt MFIUTIL 8 .Os .Sh NAME .Nm mfiutil From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 06:15:44 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C8E4106568C; Mon, 17 Aug 2009 06:15:44 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6FC8FC45; Mon, 17 Aug 2009 06:15:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H6FibC049465; Mon, 17 Aug 2009 06:15:44 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H6FitA049463; Mon, 17 Aug 2009 06:15:44 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170615.n7H6FitA049463@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 06:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196283 - head/usr.sbin/mptutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 06:15:44 -0000 Author: scottl Date: Mon Aug 17 06:15:44 2009 New Revision: 196283 URL: http://svn.freebsd.org/changeset/base/196283 Log: Update the mptutil man page for FreeBSD 8.0 Approved by: re Modified: head/usr.sbin/mptutil/mptutil.8 Modified: head/usr.sbin/mptutil/mptutil.8 ============================================================================== --- head/usr.sbin/mptutil/mptutil.8 Mon Aug 17 06:15:08 2009 (r196282) +++ head/usr.sbin/mptutil/mptutil.8 Mon Aug 17 06:15:44 2009 (r196283) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2008 +.Dd August 16, 2009 .Dt MPTUTIL 8 .Os .Sh NAME @@ -349,8 +349,6 @@ as a global hot spare: .Sh SEE ALSO .Xr mpt 4 .Sh BUGS -Deleting volumes usually provokes a kernel crash in OS versions older than -.Dv 6.3-YAHOO-20080722 . .Pp The handling of spare drives appears to be unreliable. The @@ -381,3 +379,8 @@ configurations may not work reliably. .Pp Drive configuration commands result in an excessive flood of messages on the console. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 06:21:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 144E0106564A; Mon, 17 Aug 2009 06:21:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 030258FC16; Mon, 17 Aug 2009 06:21:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H6LMaF049678; Mon, 17 Aug 2009 06:21:22 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H6LMB5049675; Mon, 17 Aug 2009 06:21:22 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170621.n7H6LMB5049675@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 06:21: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: r196284 - stable/8/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 06:21:23 -0000 Author: scottl Date: Mon Aug 17 06:21:22 2009 New Revision: 196284 URL: http://svn.freebsd.org/changeset/base/196284 Log: Merge r196200. Add firmware definitions needed by mfiutil Approved by: re Modified: stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/mfi/mfi_ioctl.h stable/8/sys/dev/mfi/mfireg.h Modified: stable/8/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- stable/8/sys/dev/mfi/mfi_ioctl.h Mon Aug 17 06:15:44 2009 (r196283) +++ stable/8/sys/dev/mfi/mfi_ioctl.h Mon Aug 17 06:21:22 2009 (r196284) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */ struct iovec32 { u_int32_t iov_base; Modified: stable/8/sys/dev/mfi/mfireg.h ============================================================================== --- stable/8/sys/dev/mfi/mfireg.h Mon Aug 17 06:15:44 2009 (r196283) +++ stable/8/sys/dev/mfi/mfireg.h Mon Aug 17 06:21:22 2009 (r196284) @@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$"); #define MFI_ODCR0 0xa0 /* outbound doorbell clear register0 */ #define MFI_OSP0 0xb0 /* outbound scratch pad0 */ #define MFI_1078_EIM 0x80000004 /* 1078 enable intrrupt mask */ -#define MFI_RMI 0x2 /* reply message interrupt */ +#define MFI_RMI 0x2 /* reply message interrupt */ #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ @@ -151,15 +151,41 @@ typedef enum { MFI_DCMD_CTRL_EVENT_GETINFO = 0x01040100, MFI_DCMD_CTRL_EVENT_GET = 0x01040300, MFI_DCMD_CTRL_EVENT_WAIT = 0x01040500, + MFI_DCMD_PR_GET_STATUS = 0x01070100, + MFI_DCMD_PR_GET_PROPERTIES = 0x01070200, + MFI_DCMD_PR_SET_PROPERTIES = 0x01070300, + MFI_DCMD_PR_START = 0x01070400, + MFI_DCMD_PR_STOP = 0x01070500, + MFI_DCMD_TIME_SECS_GET = 0x01080201, + MFI_DCMD_FLASH_FW_OPEN = 0x010f0100, + MFI_DCMD_FLASH_FW_DOWNLOAD = 0x010f0200, + MFI_DCMD_FLASH_FW_FLASH = 0x010f0300, + MFI_DCMD_FLASH_FW_CLOSE = 0x010f0400, + MFI_DCMD_PD_GET_LIST = 0x02010000, + MFI_DCMD_PD_GET_INFO = 0x02020000, + MFI_DCMD_PD_STATE_SET = 0x02030100, + MFI_DCMD_PD_REBUILD_START = 0x02040100, + MFI_DCMD_PD_REBUILD_ABORT = 0x02040200, + MFI_DCMD_PD_CLEAR_START = 0x02050100, + MFI_DCMD_PD_CLEAR_ABORT = 0x02050200, + MFI_DCMD_PD_GET_PROGRESS = 0x02060000, + MFI_DCMD_PD_LOCATE_START = 0x02070100, + MFI_DCMD_PD_LOCATE_STOP = 0x02070200, MFI_DCMD_LD_GET_LIST = 0x03010000, MFI_DCMD_LD_GET_INFO = 0x03020000, MFI_DCMD_LD_GET_PROP = 0x03030000, MFI_DCMD_LD_SET_PROP = 0x03040000, + MFI_DCMD_LD_INIT_START = 0x03060100, MFI_DCMD_LD_DELETE = 0x03090000, MFI_DCMD_CFG_READ = 0x04010000, MFI_DCMD_CFG_ADD = 0x04020000, MFI_DCMD_CFG_CLEAR = 0x04030000, + MFI_DCMD_CFG_MAKE_SPARE = 0x04040000, + MFI_DCMD_CFG_REMOVE_SPARE = 0x04050000, MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, + MFI_DCMD_BBU_GET_STATUS = 0x05010000, + MFI_DCMD_BBU_GET_CAPACITY_INFO =0x05020000, + MFI_DCMD_BBU_GET_DESIGN_INFO = 0x05030000, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 @@ -245,6 +271,9 @@ typedef enum { MFI_STAT_RESERVATION_IN_PROGRESS, MFI_STAT_I2C_ERRORS_DETECTED, MFI_STAT_PCI_ERRORS_DETECTED, + MFI_STAT_DIAG_FAILED, + MFI_STAT_BOOT_MSG_PENDING, + MFI_STAT_FOREIGN_CONFIG_INCOMPLETE, MFI_STAT_INVALID_STATUS = 0xFF } mfi_status_t; @@ -303,6 +332,17 @@ typedef enum { MR_LD_CACHE_ALLOW_WRITE_CACHE = 0x20, MR_LD_CACHE_ALLOW_READ_CACHE = 0x40 } mfi_ld_cache; +#define MR_LD_CACHE_MASK 0x7f + +#define MR_LD_CACHE_POLICY_READ_AHEAD_NONE 0 +#define MR_LD_CACHE_POLICY_READ_AHEAD_ALWAYS MR_LD_CACHE_READ_AHEAD +#define MR_LD_CACHE_POLICY_READ_AHEAD_ADAPTIVE \ + (MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE) +#define MR_LD_CACHE_POLICY_WRITE_THROUGH 0 +#define MR_LD_CACHE_POLICY_WRITE_BACK MR_LD_CACHE_WRITE_BACK +#define MR_LD_CACHE_POLICY_IO_CACHED \ + (MR_LD_CACHE_ALLOW_WRITE_CACHE | MR_LD_CACHE_ALLOW_READ_CACHE) +#define MR_LD_CACHE_POLICY_IO_DIRECT 0 typedef enum { MR_PD_CACHE_UNCHANGED = 0, @@ -320,6 +360,7 @@ typedef enum { #define MFI_DEFAULT_ID -1 #define MFI_MAX_LUN 8 #define MFI_MAX_LD 64 +#define MFI_MAX_PD 256 #define MFI_FRAME_SIZE 64 #define MFI_MBOX_SIZE 12 @@ -866,12 +907,10 @@ union mfi_pd_ddf_type { } __packed; struct mfi_pd_progress { - struct { - uint32_t rbld : 1; - uint32_t patrol : 1; - uint32_t clear : 1; - uint32_t reserved: 29; - } active; + uint32_t active; +#define MFI_PD_PROGRESS_REBUILD (1<<0) +#define MFI_PD_PROGRESS_PATROL (1<<1) +#define MFI_PD_PROGRESS_CLEAR (1<<2) struct mfi_progress rbld; struct mfi_progress patrol; struct mfi_progress clear; @@ -890,8 +929,8 @@ struct mfi_pd_info { uint32_t other_err_count; uint32_t pred_fail_count; uint32_t last_pred_fail_event_seq_num; - uint16_t fw_state; - uint8_t disable_for_removal; + uint16_t fw_state; /* MFI_PD_STATE_* */ + uint8_t disabled_for_removal; uint8_t link_speed; union mfi_pd_ddf_type state; struct { @@ -918,7 +957,7 @@ struct mfi_pd_address { uint16_t encl_device_id; uint8_t encl_index; uint8_t slot_number; - uint8_t scsi_dev_type; + uint8_t scsi_dev_type; /* 0 = disk */ uint8_t connect_port_bitmap; uint64_t sas_addr[2]; } __packed; @@ -926,12 +965,19 @@ struct mfi_pd_address { struct mfi_pd_list { uint32_t size; uint32_t count; - uint8_t data; - /* - struct mfi_pd_address addr[]; - */ + struct mfi_pd_address addr[0]; } __packed; +enum mfi_pd_state { + MFI_PD_STATE_UNCONFIGURED_GOOD = 0x00, + MFI_PD_STATE_UNCONFIGURED_BAD = 0x01, + MFI_PD_STATE_HOT_SPARE = 0x02, + MFI_PD_STATE_OFFLINE = 0x10, + MFI_PD_STATE_FAILED = 0x11, + MFI_PD_STATE_REBUILD = 0x14, + MFI_PD_STATE_ONLINE = 0x18 +}; + union mfi_ld_ref { struct { uint8_t target_id; @@ -986,6 +1032,9 @@ struct mfi_ld_params { uint8_t span_depth; uint8_t state; uint8_t init_state; +#define MFI_LD_PARAMS_INIT_NO 0 +#define MFI_LD_PARAMS_INIT_QUICK 1 +#define MFI_LD_PARAMS_INIT_FULL 2 uint8_t is_consistent; uint8_t reserved[23]; } __packed; @@ -995,7 +1044,7 @@ struct mfi_ld_progress { #define MFI_LD_PROGRESS_CC (1<<0) #define MFI_LD_PROGRESS_BGI (1<<1) #define MFI_LD_PROGRESS_FGI (1<<2) -#define MFI_LD_PORGRESS_RECON (1<<3) +#define MFI_LD_PROGRESS_RECON (1<<3) struct mfi_progress cc; struct mfi_progress bgi; struct mfi_progress fgi; @@ -1028,26 +1077,18 @@ struct mfi_ld_info { uint8_t reserved2[16]; } __packed; -union mfi_spare_type { - struct { - uint8_t is_dedicate :1; - uint8_t is_revertable :1; - uint8_t is_encl_affinity :1; - uint8_t reserved :5; - } v; - uint8_t type; -} __packed; - #define MAX_ARRAYS 16 struct mfi_spare { union mfi_pd_ref ref; - union mfi_spare_type spare_type; + uint8_t spare_type; +#define MFI_SPARE_DEDICATED (1 << 0) +#define MFI_SPARE_REVERTIBLE (1 << 1) +#define MFI_SPARE_ENCL_AFFINITY (1 << 2) uint8_t reserved[2]; uint8_t array_count; - uint16_t array_refd[MAX_ARRAYS]; + uint16_t array_ref[MAX_ARRAYS]; } __packed; -#define MAX_ROW_SIZE 32 struct mfi_array { uint64_t size; uint8_t num_drives; @@ -1055,13 +1096,13 @@ struct mfi_array { uint16_t array_ref; uint8_t pad[20]; struct { - union mfi_pd_ref ref; - uint16_t fw_state; + union mfi_pd_ref ref; /* 0xffff == missing drive */ + uint16_t fw_state; /* MFI_PD_STATE_* */ struct { uint8_t pd; uint8_t slot; } encl; - } pd[MAX_ROW_SIZE]; + } pd[0]; } __packed; struct mfi_config_data { @@ -1073,13 +1114,117 @@ struct mfi_config_data { uint16_t spares_count; uint16_t spares_size; uint8_t reserved[16]; - uint8_t data; - /* - struct mfi_array array[]; - struct mfi_ld_config ld[]; - struct mfi_spare spare[]; - */ -} __packed; + struct mfi_array array[0]; + struct mfi_ld_config ld[0]; + struct mfi_spare spare[0]; +} __packed; + +struct mfi_bbu_capacity_info { + uint16_t relative_charge; + uint16_t absolute_charge; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint16_t run_time_to_empty; + uint16_t average_time_to_empty; + uint16_t average_time_to_full; + uint16_t cycle_count; + uint16_t max_error; + uint16_t remaining_capacity_alarm; + uint16_t remaining_time_alarm; + uint8_t reserved[26]; +} __packed; + +struct mfi_bbu_design_info { + uint32_t mfg_date; + uint16_t design_capacity; + uint16_t design_voltage; + uint16_t spec_info; + uint16_t serial_number; + uint16_t pack_stat_config; + uint8_t mfg_name[12]; + uint8_t device_name[8]; + uint8_t device_chemistry[8]; + uint8_t mfg_data[8]; + uint8_t reserved[17]; +} __packed; + +struct mfi_ibbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_system_state; + uint16_t charger_system_ctrl; + uint16_t charging_current; + uint16_t absolute_charge; + uint16_t max_error; + uint8_t reserved[18]; +} __packed; + +struct mfi_bbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_status; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint8_t is_SOH_good; + uint8_t reserved[21]; +} __packed; + +union mfi_bbu_status_detail { + struct mfi_ibbu_state ibbu; + struct mfi_bbu_state bbu; +}; + +struct mfi_bbu_status { + uint8_t battery_type; +#define MFI_BBU_TYPE_NONE 0 +#define MFI_BBU_TYPE_IBBU 1 +#define MFI_BBU_TYPE_BBU 2 + uint8_t reserved; + uint16_t voltage; + int16_t current; + uint16_t temperature; + uint32_t fw_status; +#define MFI_BBU_STATE_PACK_MISSING (1 << 0) +#define MFI_BBU_STATE_VOLTAGE_LOW (1 << 1) +#define MFI_BBU_STATE_TEMPERATURE_HIGH (1 << 2) +#define MFI_BBU_STATE_CHARGE_ACTIVE (1 << 0) +#define MFI_BBU_STATE_DISCHARGE_ACTIVE (1 << 0) + uint8_t pad[20]; + union mfi_bbu_status_detail detail; +} __packed; + +enum mfi_pr_state { + MFI_PR_STATE_STOPPED = 0, + MFI_PR_STATE_READY = 1, + MFI_PR_STATE_ACTIVE = 2, + MFI_PR_STATE_ABORTED = 0xff +}; + +struct mfi_pr_status { + uint32_t num_iteration; + uint8_t state; + uint8_t num_pd_done; + uint8_t reserved[10]; +}; + +enum mfi_pr_opmode { + MFI_PR_OPMODE_AUTO = 0, + MFI_PR_OPMODE_MANUAL = 1, + MFI_PR_OPMODE_DISABLED = 2 +}; + +struct mfi_pr_properties { + uint8_t op_mode; + uint8_t max_pd; + uint8_t reserved; + uint8_t exclude_ld_count; + uint16_t excluded_ld[MFI_MAX_LD]; + uint8_t cur_pd_map[MFI_MAX_PD / 8]; + uint8_t last_pd_map[MFI_MAX_PD / 8]; + uint32_t next_exec; + uint32_t exec_freq; + uint32_t clear_freq; +}; #define MFI_SCSI_MAX_TARGETS 128 #define MFI_SCSI_MAX_LUNS 8 From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 07:25:13 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40F3D106568C; Mon, 17 Aug 2009 07:25:13 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E5F68FC3F; Mon, 17 Aug 2009 07:25:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H7PDMJ052047; Mon, 17 Aug 2009 07:25:13 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H7PDgP052042; Mon, 17 Aug 2009 07:25:13 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170725.n7H7PDgP052042@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 07:25: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: r196285 - in stable/8/usr.sbin: . arp dumpcis iostat jls makefs makefs/ffs mfiutil ntp pstat sysinstall zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 07:25:13 -0000 Author: scottl Date: Mon Aug 17 07:25:12 2009 New Revision: 196285 URL: http://svn.freebsd.org/changeset/base/196285 Log: Merge mfiutil Approved by: re Added: stable/8/usr.sbin/mfiutil/ - copied from r196200, head/usr.sbin/mfiutil/ stable/8/usr.sbin/mfiutil/mfiutil.8 (contents, props changed) - copied, changed from r196280, head/usr.sbin/mfiutil/mfiutil.8 Modified: stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/Makefile stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mfiutil/Makefile stable/8/usr.sbin/mfiutil/README (props changed) stable/8/usr.sbin/mfiutil/mfi_drive.c stable/8/usr.sbin/mfiutil/mfiutil.1 (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/usr.sbin/Makefile ============================================================================== --- stable/8/usr.sbin/Makefile Mon Aug 17 06:21:22 2009 (r196284) +++ stable/8/usr.sbin/Makefile Mon Aug 17 07:25:12 2009 (r196285) @@ -94,6 +94,7 @@ SUBDIR= ${_ac} \ manctl \ memcontrol \ mergemaster \ + mfiutil \ mixer \ ${_mld6query} \ mlxcontrol \ Modified: stable/8/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Thu Aug 13 23:18:45 2009 (r196200) +++ stable/8/usr.sbin/mfiutil/Makefile Mon Aug 17 07:25:12 2009 (r196285) @@ -3,6 +3,7 @@ PROG= mfiutil SRCS= mfiutil.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c mfi_flash.c \ mfi_patrol.c mfi_show.c mfi_volume.c +MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime WARNS?=3 Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Thu Aug 13 23:18:45 2009 (r196200) +++ stable/8/usr.sbin/mfiutil/mfi_drive.c Mon Aug 17 07:25:12 2009 (r196285) @@ -75,8 +75,9 @@ int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id) { struct mfi_pd_list *list; - long val; uint8_t encl, slot; + long val; + u_int i; char *cp; /* Look for a raw device id first. */ @@ -117,15 +118,15 @@ mfi_lookup_drive(int fd, char *drive, ui return (errno); } - for (val = 0; val < list->count; val++) { - if (list->addr[val].scsi_dev_type != 0) + for (i = 0; i < list->count; i++) { + if (list->addr[i].scsi_dev_type != 0) continue; if (((encl == 0xff && - list->addr[val].encl_device_id == 0xffff) || - list->addr[val].encl_index == encl) && - list->addr[val].slot_number == slot) { - *device_id = list->addr[val].device_id; + list->addr[i].encl_device_id == 0xffff) || + list->addr[i].encl_index == encl) && + list->addr[i].slot_number == slot) { + *device_id = list->addr[i].device_id; free(list); return (0); } Copied and modified: stable/8/usr.sbin/mfiutil/mfiutil.8 (from r196280, head/usr.sbin/mfiutil/mfiutil.8) ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280, copy source) +++ stable/8/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 07:25:12 2009 (r196285) @@ -27,8 +27,8 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2008 -.Dt MFIUTIL 1 +.Dd August 16, 2009 +.Dt MFIUTIL 8 .Os .Sh NAME .Nm mfiutil @@ -161,9 +161,6 @@ on the volume may be specified by the co device, such as .Em mfid0 . -Note that this second method only works on OS versions -.Dv 6.2-YAHOO-20070510 -and later. .Pp Drives may be specified in two forms. First, @@ -562,13 +559,8 @@ patrol read starting in 5 minutes: .Pp .Sh SEE ALSO .Xr mfi 4 -.Sh BUGS -On 64-bit OS versions -.Dv 6.2-YAHOO-20070514 -and earlier, -the -.Xr mfi 4 -driver does not properly report firmware errors to 32-bit versions of -.Nm . -As a result, -some commands may fail even though they do not report any errors. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 07:30:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F520106568B; Mon, 17 Aug 2009 07:30:09 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33A948FC69; Mon, 17 Aug 2009 07:30:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H7U9YT052380; Mon, 17 Aug 2009 07:30:09 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H7U9BQ052377; Mon, 17 Aug 2009 07:30:09 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908170730.n7H7U9BQ052377@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 07:30:09 +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: r196286 - in stable/8/usr.sbin: . arp dumpcis iostat jls makefs makefs/ffs mfiutil mptutil ntp pstat sysinstall zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 07:30:09 -0000 Author: scottl Date: Mon Aug 17 07:30:08 2009 New Revision: 196286 URL: http://svn.freebsd.org/changeset/base/196286 Log: Merge mptutil Approved by: re Added: stable/8/usr.sbin/mptutil/ - copied from r196212, head/usr.sbin/mptutil/ Modified: stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/Makefile stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mfiutil/README (props changed) stable/8/usr.sbin/mfiutil/mfiutil.1 (props changed) stable/8/usr.sbin/mfiutil/mfiutil.8 (props changed) stable/8/usr.sbin/mptutil/mptutil.8 stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/usr.sbin/Makefile ============================================================================== --- stable/8/usr.sbin/Makefile Mon Aug 17 07:25:12 2009 (r196285) +++ stable/8/usr.sbin/Makefile Mon Aug 17 07:30:08 2009 (r196286) @@ -104,6 +104,7 @@ SUBDIR= ${_ac} \ ${_mount_smbfs} \ ${_moused} \ ${_mptable} \ + mptutil \ mtest \ mtree \ ${_named} \ Modified: stable/8/usr.sbin/mptutil/mptutil.8 ============================================================================== --- head/usr.sbin/mptutil/mptutil.8 Fri Aug 14 13:13:12 2009 (r196212) +++ stable/8/usr.sbin/mptutil/mptutil.8 Mon Aug 17 07:30:08 2009 (r196286) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2008 +.Dd August 16, 2009 .Dt MPTUTIL 8 .Os .Sh NAME @@ -349,8 +349,6 @@ as a global hot spare: .Sh SEE ALSO .Xr mpt 4 .Sh BUGS -Deleting volumes usually provokes a kernel crash in OS versions older than -.Dv 6.3-YAHOO-20080722 . .Pp The handling of spare drives appears to be unreliable. The @@ -381,3 +379,8 @@ configurations may not work reliably. .Pp Drive configuration commands result in an excessive flood of messages on the console. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 07:38:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E0A106568D; Mon, 17 Aug 2009 07:38:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC18B8FC45; Mon, 17 Aug 2009 07:38:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H7cl1o052647; Mon, 17 Aug 2009 07:38:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H7clLd052645; Mon, 17 Aug 2009 07:38:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170738.n7H7clLd052645@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 07:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196287 - head/sbin/umount X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 07:38:48 -0000 Author: pjd Date: Mon Aug 17 07:38:47 2009 New Revision: 196287 URL: http://svn.freebsd.org/changeset/base/196287 Log: Be more precise how to get fsids - 'mount -v' doesn't show fsids unless is run by root. Approved by: re (kib) Modified: head/sbin/umount/umount.8 Modified: head/sbin/umount/umount.8 ============================================================================== --- head/sbin/umount/umount.8 Mon Aug 17 07:30:08 2009 (r196286) +++ head/sbin/umount/umount.8 Mon Aug 17 07:38:47 2009 (r196287) @@ -57,7 +57,8 @@ device or remote node (rhost:path), the or by the file system ID .Ar fsid as reported by -.Dq mount -v . +.Dq mount -v +when run by root. .Pp The options are as follows: .Bl -tag -width indent From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 07:46:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DCAF106568E; Mon, 17 Aug 2009 07:46:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D1408FC62; Mon, 17 Aug 2009 07:46:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H7kubn052941; Mon, 17 Aug 2009 07:46:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H7kuCd052939; Mon, 17 Aug 2009 07:46:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170746.n7H7kuCd052939@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 07:46:56 +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: r196288 - stable/8/sbin/umount X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 07:46:56 -0000 Author: pjd Date: Mon Aug 17 07:46:55 2009 New Revision: 196288 URL: http://svn.freebsd.org/changeset/base/196288 Log: MFC r196287: Be more precise how to get fsids - 'mount -v' doesn't show fsids unless is run by root. Approved by: re (kib) Modified: stable/8/sbin/umount/ (props changed) stable/8/sbin/umount/umount.8 Modified: stable/8/sbin/umount/umount.8 ============================================================================== --- stable/8/sbin/umount/umount.8 Mon Aug 17 07:38:47 2009 (r196287) +++ stable/8/sbin/umount/umount.8 Mon Aug 17 07:46:55 2009 (r196288) @@ -57,7 +57,8 @@ device or remote node (rhost:path), the or by the file system ID .Ar fsid as reported by -.Dq mount -v . +.Dq mount -v +when run by root. .Pp The options are as follows: .Bl -tag -width indent From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:03:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65965106568E; Mon, 17 Aug 2009 08:03:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 547718FC43; Mon, 17 Aug 2009 08:03:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H832EZ053651; Mon, 17 Aug 2009 08:03:02 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H832IY053649; Mon, 17 Aug 2009 08:03:02 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170803.n7H832IY053649@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196289 - in head: cddl/lib/libnvpair sys/cddl/compat/opensolaris/rpc sys/cddl/contrib/opensolaris/uts/common/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:03:02 -0000 Author: pjd Date: Mon Aug 17 08:03:02 2009 New Revision: 196289 URL: http://svn.freebsd.org/changeset/base/196289 Log: Remove files that are no longer used. Discussed with: kmacy Approved by: re (kib) Deleted: head/sys/cddl/compat/opensolaris/rpc/xdr.h head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h Modified: head/cddl/lib/libnvpair/Makefile Modified: head/cddl/lib/libnvpair/Makefile ============================================================================== --- head/cddl/lib/libnvpair/Makefile Mon Aug 17 07:46:55 2009 (r196288) +++ head/cddl/lib/libnvpair/Makefile Mon Aug 17 08:03:02 2009 (r196289) @@ -13,5 +13,6 @@ SRCS= libnvpair.c \ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${.CURDIR}/../../../sys .include From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:09:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1D4E1065695; Mon, 17 Aug 2009 08:09:46 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54568FC59; Mon, 17 Aug 2009 08:09:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H89kB4053946; Mon, 17 Aug 2009 08:09:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H89kHl053944; Mon, 17 Aug 2009 08:09:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170809.n7H89kHl053944@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:09:46 +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: r196290 - in stable/8: cddl/lib/libnvpair sys sys/amd64/include/xen sys/cddl/compat/opensolaris/rpc sys/cddl/contrib/opensolaris sys/cddl/contrib/opensolaris/uts/common/rpc sys/contrib/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:09:46 -0000 Author: pjd Date: Mon Aug 17 08:09:46 2009 New Revision: 196290 URL: http://svn.freebsd.org/changeset/base/196290 Log: MFC r196289: Remove files that are no longer used. Discussed with: kmacy Approved by: re (kib) Deleted: stable/8/sys/cddl/compat/opensolaris/rpc/xdr.h stable/8/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c stable/8/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c stable/8/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c stable/8/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h Modified: stable/8/cddl/lib/libnvpair/ (props changed) stable/8/cddl/lib/libnvpair/Makefile stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/cddl/lib/libnvpair/Makefile ============================================================================== --- stable/8/cddl/lib/libnvpair/Makefile Mon Aug 17 08:03:02 2009 (r196289) +++ stable/8/cddl/lib/libnvpair/Makefile Mon Aug 17 08:09:46 2009 (r196290) @@ -13,5 +13,6 @@ SRCS= libnvpair.c \ CFLAGS+= -I${.CURDIR}/../../../cddl/compat/opensolaris/include CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris CFLAGS+= -I${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common +CFLAGS+= -I${.CURDIR}/../../../sys .include From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:36:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64FF9106568C; Mon, 17 Aug 2009 08:36:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 546168FC43; Mon, 17 Aug 2009 08:36:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H8afgK054581; Mon, 17 Aug 2009 08:36:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H8afxO054579; Mon, 17 Aug 2009 08:36:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170836.n7H8afxO054579@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196291 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:36:41 -0000 Author: pjd Date: Mon Aug 17 08:36:41 2009 New Revision: 196291 URL: http://svn.freebsd.org/changeset/base/196291 Log: - Fix a race where /dev/zfs control device is created before ZFS is fully initialized. Also destroy /dev/zfs before doing other deinitializations. - Initialization through taskq is no longer needed and there is a race where one of the zpool/zfs command loads zfs.ko and tries to do some work immediately, but /dev/zfs is not there yet. Reported by: pav Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:09:46 2009 (r196290) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:36:41 2009 (r196291) @@ -3056,44 +3056,35 @@ zfsdev_fini(void) destroy_dev(zfsdev); } -static struct task zfs_start_task; static struct root_hold_token *zfs_root_token; - uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; -static void -zfs_start(void *context __unused, int pending __unused) -{ - - zfsdev_init(); - spa_init(FREAD | FWRITE); - zfs_init(); - zvol_init(); - - tsd_create(&zfs_fsyncer_key, NULL); - tsd_create(&rrw_tsd_key, NULL); - - printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); - root_mount_rel(zfs_root_token); -} - static int zfs_modevent(module_t mod, int type, void *unused __unused) { - int error; + int error = 0; - error = EOPNOTSUPP; switch (type) { case MOD_LOAD: zfs_root_token = root_mount_hold("ZFS"); printf("WARNING: ZFS is considered to be an experimental " "feature in FreeBSD.\n"); - TASK_INIT(&zfs_start_task, 0, zfs_start, NULL); - taskqueue_enqueue(taskqueue_thread, &zfs_start_task); + mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); - error = 0; + + spa_init(FREAD | FWRITE); + zfs_init(); + zvol_init(); + + tsd_create(&zfs_fsyncer_key, NULL); + tsd_create(&rrw_tsd_key, NULL); + + printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); + root_mount_rel(zfs_root_token); + + zfsdev_init(); break; case MOD_UNLOAD: if (spa_busy() || zfs_busy() || zvol_busy() || @@ -3101,14 +3092,19 @@ zfs_modevent(module_t mod, int type, voi error = EBUSY; break; } + + zfsdev_fini(); zvol_fini(); zfs_fini(); spa_fini(); - zfsdev_fini(); + tsd_destroy(&zfs_fsyncer_key); tsd_destroy(&rrw_tsd_key); + mutex_destroy(&zfs_share_lock); - error = 0; + break; + default: + error = EOPNOTSUPP; break; } return (error); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:38:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46B12106568F; Mon, 17 Aug 2009 08:38:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32F168FC45; Mon, 17 Aug 2009 08:38:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H8cgeV054664; Mon, 17 Aug 2009 08:38:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H8cgF1054662; Mon, 17 Aug 2009 08:38:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170838.n7H8cgF1054662@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:38:42 +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: r196292 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:38:42 -0000 Author: pjd Date: Mon Aug 17 08:38:41 2009 New Revision: 196292 URL: http://svn.freebsd.org/changeset/base/196292 Log: MFC r196291: - Fix a race where /dev/zfs control device is created before ZFS is fully initialized. Also destroy /dev/zfs before doing other deinitializations. - Initialization through taskq is no longer needed and there is a race where one of the zpool/zfs command loads zfs.ko and tries to do some work immediately, but /dev/zfs is not there yet. Reported by: pav Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:36:41 2009 (r196291) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Aug 17 08:38:41 2009 (r196292) @@ -3056,44 +3056,35 @@ zfsdev_fini(void) destroy_dev(zfsdev); } -static struct task zfs_start_task; static struct root_hold_token *zfs_root_token; - uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; -static void -zfs_start(void *context __unused, int pending __unused) -{ - - zfsdev_init(); - spa_init(FREAD | FWRITE); - zfs_init(); - zvol_init(); - - tsd_create(&zfs_fsyncer_key, NULL); - tsd_create(&rrw_tsd_key, NULL); - - printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); - root_mount_rel(zfs_root_token); -} - static int zfs_modevent(module_t mod, int type, void *unused __unused) { - int error; + int error = 0; - error = EOPNOTSUPP; switch (type) { case MOD_LOAD: zfs_root_token = root_mount_hold("ZFS"); printf("WARNING: ZFS is considered to be an experimental " "feature in FreeBSD.\n"); - TASK_INIT(&zfs_start_task, 0, zfs_start, NULL); - taskqueue_enqueue(taskqueue_thread, &zfs_start_task); + mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); - error = 0; + + spa_init(FREAD | FWRITE); + zfs_init(); + zvol_init(); + + tsd_create(&zfs_fsyncer_key, NULL); + tsd_create(&rrw_tsd_key, NULL); + + printf("ZFS storage pool version " SPA_VERSION_STRING "\n"); + root_mount_rel(zfs_root_token); + + zfsdev_init(); break; case MOD_UNLOAD: if (spa_busy() || zfs_busy() || zvol_busy() || @@ -3101,14 +3092,19 @@ zfs_modevent(module_t mod, int type, voi error = EBUSY; break; } + + zfsdev_fini(); zvol_fini(); zfs_fini(); spa_fini(); - zfsdev_fini(); + tsd_destroy(&zfs_fsyncer_key); tsd_destroy(&rrw_tsd_key); + mutex_destroy(&zfs_share_lock); - error = 0; + break; + default: + error = EOPNOTSUPP; break; } return (error); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:42:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80167106568D; Mon, 17 Aug 2009 08:42:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 702088FC61; Mon, 17 Aug 2009 08:42:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H8gYtk054779; Mon, 17 Aug 2009 08:42:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H8gYo5054777; Mon, 17 Aug 2009 08:42:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170842.n7H8gYo5054777@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196293 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:42:34 -0000 Author: pjd Date: Mon Aug 17 08:42:34 2009 New Revision: 196293 URL: http://svn.freebsd.org/changeset/base/196293 Log: Because taskqueue_run() can drop tq_mutex, we need to check if the TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a wakeup. Approved by: re (kib) Modified: head/sys/kern/subr_taskqueue.c Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Mon Aug 17 08:38:41 2009 (r196292) +++ head/sys/kern/subr_taskqueue.c Mon Aug 17 08:42:34 2009 (r196293) @@ -401,6 +401,13 @@ taskqueue_thread_loop(void *arg) TQ_LOCK(tq); while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { taskqueue_run(tq); + /* + * Because taskqueue_run() can drop tq_mutex, we need to + * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the + * meantime, which means we missed a wakeup. + */ + if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) + break; TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 08:46:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA589106568D; Mon, 17 Aug 2009 08:46:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D90C8FC45; Mon, 17 Aug 2009 08:46:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H8klYq055030; Mon, 17 Aug 2009 08:46:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H8kliY055028; Mon, 17 Aug 2009 08:46:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170846.n7H8kliY055028@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 08:46:47 +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: r196294 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfront dev/xen/xenpci kern modules/dtrace/dtnfsc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 08:46:47 -0000 Author: pjd Date: Mon Aug 17 08:46:47 2009 New Revision: 196294 URL: http://svn.freebsd.org/changeset/base/196294 Log: MFC r196293: Because taskqueue_run() can drop tq_mutex, we need to check if the TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a wakeup. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/subr_taskqueue.c stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/kern/subr_taskqueue.c ============================================================================== --- stable/8/sys/kern/subr_taskqueue.c Mon Aug 17 08:42:34 2009 (r196293) +++ stable/8/sys/kern/subr_taskqueue.c Mon Aug 17 08:46:47 2009 (r196294) @@ -401,6 +401,13 @@ taskqueue_thread_loop(void *arg) TQ_LOCK(tq); while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { taskqueue_run(tq); + /* + * Because taskqueue_run() can drop tq_mutex, we need to + * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the + * meantime, which means we missed a wakeup. + */ + if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0) + break; TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:01:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8598D106568B; Mon, 17 Aug 2009 09:01:20 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 712128FC41; Mon, 17 Aug 2009 09:01:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H91KHo055697; Mon, 17 Aug 2009 09:01:20 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H91KeH055689; Mon, 17 Aug 2009 09:01:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170901.n7H91KeH055689@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:01:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196295 - in head: share/man/man9 sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys sys/cddl/contrib/opensolaris/uts/co... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:01:20 -0000 Author: pjd Date: Mon Aug 17 09:01:20 2009 New Revision: 196295 URL: http://svn.freebsd.org/changeset/base/196295 Log: Remove OpenSolaris taskq port (it performs very poorly in our kernel) and replace it with wrappers around our taskqueue(9). To make it possible implement taskqueue_member() function which returns 1 if the given thread was created by the given taskqueue. Approved by: re (kib) Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h (contents, props changed) Deleted: head/sys/cddl/compat/opensolaris/sys/taskq.h head/sys/cddl/compat/opensolaris/sys/taskq_impl.h head/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c Modified: head/share/man/man9/taskqueue.9 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/kern/subr_taskqueue.c head/sys/modules/zfs/Makefile head/sys/sys/taskqueue.h Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Aug 17 08:46:47 2009 (r196294) +++ head/share/man/man9/taskqueue.9 Mon Aug 17 09:01:20 2009 (r196295) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd August 17, 2009 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -71,6 +71,8 @@ struct task { .Fn taskqueue_run_fast "struct taskqueue *queue" .Ft void .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" +.Ft int +.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context" .Fn TASKQUEUE_DECLARE "name" .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" @@ -182,6 +184,18 @@ There is no guarantee that the task will enqueued after call to .Fn taskqueue_drain . .Pp +The +.Fn taskqueue_member +function returns +.No 1 +is the given thread +.Fa td +is part of the given taskqeueue +.Fa queue +and +.No 0 +otherwise. +.Pp A convenience macro, .Fn TASK_INIT "task" "priority" "func" "context" is provided to initialise a Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Aug 17 09:01:20 2009 (r196295) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2009 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static uma_zone_t taskq_zone; + +struct ostask { + struct task ost_task; + task_func_t *ost_func; + void *ost_arg; +}; + +taskq_t *system_taskq = NULL; + +static void +system_taskq_init(void *arg) +{ + + system_taskq = (taskq_t *)taskqueue_thread; + taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask), + NULL, NULL, NULL, NULL, 0, 0); +} +SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL); + +static void +system_taskq_fini(void *arg) +{ + + uma_zdestroy(taskq_zone); +} +SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); + +taskq_t * +taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, + int maxalloc __unused, uint_t flags) +{ + taskq_t *tq; + + if ((flags & TASKQ_THREADS_CPU_PCT) != 0) { + /* TODO: Calculate number od threads. */ + printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__); + } + + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, + &tq->tq_queue); + (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, name); + + return ((taskq_t *)tq); +} + +void +taskq_destroy(taskq_t *tq) +{ + + taskqueue_free(tq->tq_queue); + kmem_free(tq, sizeof(*tq)); +} + +int +taskq_member(taskq_t *tq, kthread_t *thread) +{ + + return (taskqueue_member(tq->tq_queue, thread)); +} + +static void +taskq_run(void *arg, int pending __unused) +{ + struct ostask *task = arg; + + task->ost_func(task->ost_arg); + + uma_zfree(taskq_zone, task); +} + +taskqid_t +taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) +{ + struct ostask *task; + int mflag; + + if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP) + mflag = M_WAITOK; + else + mflag = M_NOWAIT; + + task = uma_zalloc(taskq_zone, mflag); + if (task == NULL) + return (0); + + task->ost_func = func; + task->ost_arg = arg; + + TASK_INIT(&task->ost_task, 0, taskq_run, task); + taskqueue_enqueue(tq->tq_queue, &task->ost_task); + + return ((taskqid_t)(void *)task); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 09:01:20 2009 (r196295) @@ -49,6 +49,7 @@ extern "C" { #include #include #include +#include #include #include #include Added: head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Mon Aug 17 09:01:20 2009 (r196295) @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_TASKQ_H +#define _SYS_TASKQ_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TASKQ_NAMELEN 31 + +struct taskqueue; +struct taskq { + struct taskqueue *tq_queue; +}; + +typedef struct taskq taskq_t; +typedef uintptr_t taskqid_t; +typedef void (task_func_t)(void *); + +/* + * Public flags for taskq_create(): bit range 0-15 + */ +#define TASKQ_PREPOPULATE 0x0001 /* Prepopulate with threads and data */ +#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ +#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ +#define TASKQ_THREADS_CPU_PCT 0x0008 /* number of threads as % of ncpu */ + +/* + * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as + * KM_SLEEP/KM_NOSLEEP. + */ +#define TQ_SLEEP 0x00 /* Can block for memory */ +#define TQ_NOSLEEP 0x01 /* cannot block for memory; may fail */ +#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ +#define TQ_NOALLOC 0x04 /* cannot allocate memory; may fail */ + +#ifdef _KERNEL + +extern taskq_t *system_taskq; + +extern void taskq_init(void); +extern void taskq_mp_init(void); + +extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, + int, uint_t); +extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void nulltask(void *); +extern void taskq_destroy(taskq_t *); +extern void taskq_wait(taskq_t *); +extern void taskq_suspend(taskq_t *); +extern int taskq_suspended(taskq_t *); +extern void taskq_resume(taskq_t *); +extern int taskq_member(taskq_t *, kthread_t *); + +#endif /* _KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TASKQ_H */ Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/kern/subr_taskqueue.c Mon Aug 17 09:01:20 2009 (r196295) @@ -472,3 +472,23 @@ taskqueue_fast_run(void *dummy) TASKQUEUE_FAST_DEFINE(fast, taskqueue_fast_enqueue, NULL, swi_add(NULL, "Fast task queue", taskqueue_fast_run, NULL, SWI_TQ_FAST, INTR_MPSAFE, &taskqueue_fast_ih)); + +int +taskqueue_member(struct taskqueue *queue, struct thread *td) +{ + int i, j, ret = 0; + + TQ_LOCK(queue); + for (i = 0, j = 0; ; i++) { + if (queue->tq_threads[i] == NULL) + continue; + if (queue->tq_threads[i] == td) { + ret = 1; + break; + } + if (++j >= queue->tq_tcount) + break; + } + TQ_UNLOCK(queue); + return (ret); +} Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/modules/zfs/Makefile Mon Aug 17 09:01:20 2009 (r196295) @@ -23,6 +23,7 @@ SRCS+= opensolaris_kstat.c SRCS+= opensolaris_lookup.c SRCS+= opensolaris_policy.c SRCS+= opensolaris_string.c +SRCS+= opensolaris_taskq.c SRCS+= opensolaris_vfs.c SRCS+= opensolaris_zone.c @@ -42,7 +43,6 @@ SRCS+= vnode.c SRCS+= callb.c SRCS+= list.c SRCS+= nvpair_alloc_system.c -SRCS+= taskq.c .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Mon Aug 17 08:46:47 2009 (r196294) +++ head/sys/sys/taskqueue.h Mon Aug 17 09:01:20 2009 (r196295) @@ -37,6 +37,7 @@ #include struct taskqueue; +struct thread; /* * A notification callback function which is called from @@ -60,6 +61,7 @@ void taskqueue_free(struct taskqueue *qu void taskqueue_run(struct taskqueue *queue); void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); +int taskqueue_member(struct taskqueue *queue, struct thread *td); /* * Functions for dedicated thread taskqueues From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:03:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07FF2106568B; Mon, 17 Aug 2009 09:03:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6E368FC55; Mon, 17 Aug 2009 09:03:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H93lkK055855; Mon, 17 Aug 2009 09:03:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H93lEp055847; Mon, 17 Aug 2009 09:03:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170903.n7H93lEp055847@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:03:47 +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: r196296 - in stable/8: share/man/man9 sys sys/amd64/include/xen sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris sys/cddl/contrib/opensolari... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:03:48 -0000 Author: pjd Date: Mon Aug 17 09:03:47 2009 New Revision: 196296 URL: http://svn.freebsd.org/changeset/base/196296 Log: MFC r196295: Remove OpenSolaris taskq port (it performs very poorly in our kernel) and replace it with wrappers around our taskqueue(9). To make it possible implement taskqueue_member() function which returns 1 if the given thread was created by the given taskqueue. Approved by: re (kib) Added: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c - copied unchanged from r196295, head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h - copied unchanged from r196295, head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Deleted: stable/8/sys/cddl/compat/opensolaris/sys/taskq.h stable/8/sys/cddl/compat/opensolaris/sys/taskq_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c Modified: stable/8/share/man/man9/ (props changed) stable/8/share/man/man9/taskqueue.9 stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/subr_taskqueue.c stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/modules/zfs/Makefile stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/sys/taskqueue.h stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/share/man/man9/taskqueue.9 ============================================================================== --- stable/8/share/man/man9/taskqueue.9 Mon Aug 17 09:01:20 2009 (r196295) +++ stable/8/share/man/man9/taskqueue.9 Mon Aug 17 09:03:47 2009 (r196296) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd August 17, 2009 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -71,6 +71,8 @@ struct task { .Fn taskqueue_run_fast "struct taskqueue *queue" .Ft void .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" +.Ft int +.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context" .Fn TASKQUEUE_DECLARE "name" .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" @@ -182,6 +184,18 @@ There is no guarantee that the task will enqueued after call to .Fn taskqueue_drain . .Pp +The +.Fn taskqueue_member +function returns +.No 1 +is the given thread +.Fa td +is part of the given taskqeueue +.Fa queue +and +.No 0 +otherwise. +.Pp A convenience macro, .Fn TASK_INIT "task" "priority" "func" "context" is provided to initialise a Copied: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c (from r196295, head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c Mon Aug 17 09:03:47 2009 (r196296, copy of r196295, head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2009 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static uma_zone_t taskq_zone; + +struct ostask { + struct task ost_task; + task_func_t *ost_func; + void *ost_arg; +}; + +taskq_t *system_taskq = NULL; + +static void +system_taskq_init(void *arg) +{ + + system_taskq = (taskq_t *)taskqueue_thread; + taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask), + NULL, NULL, NULL, NULL, 0, 0); +} +SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, NULL); + +static void +system_taskq_fini(void *arg) +{ + + uma_zdestroy(taskq_zone); +} +SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_fini, NULL); + +taskq_t * +taskq_create(const char *name, int nthreads, pri_t pri, int minalloc __unused, + int maxalloc __unused, uint_t flags) +{ + taskq_t *tq; + + if ((flags & TASKQ_THREADS_CPU_PCT) != 0) { + /* TODO: Calculate number od threads. */ + printf("%s: TASKQ_THREADS_CPU_PCT\n", __func__); + } + + tq = kmem_alloc(sizeof(*tq), KM_SLEEP); + tq->tq_queue = taskqueue_create(name, M_WAITOK, taskqueue_thread_enqueue, + &tq->tq_queue); + (void) taskqueue_start_threads(&tq->tq_queue, nthreads, pri, name); + + return ((taskq_t *)tq); +} + +void +taskq_destroy(taskq_t *tq) +{ + + taskqueue_free(tq->tq_queue); + kmem_free(tq, sizeof(*tq)); +} + +int +taskq_member(taskq_t *tq, kthread_t *thread) +{ + + return (taskqueue_member(tq->tq_queue, thread)); +} + +static void +taskq_run(void *arg, int pending __unused) +{ + struct ostask *task = arg; + + task->ost_func(task->ost_arg); + + uma_zfree(taskq_zone, task); +} + +taskqid_t +taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags) +{ + struct ostask *task; + int mflag; + + if ((flags & (TQ_SLEEP | TQ_NOQUEUE)) == TQ_SLEEP) + mflag = M_WAITOK; + else + mflag = M_NOWAIT; + + task = uma_zalloc(taskq_zone, mflag); + if (task == NULL) + return (0); + + task->ost_func = func; + task->ost_arg = arg; + + TASK_INIT(&task->ost_task, 0, taskq_run, task); + taskqueue_enqueue(tq->tq_queue, &task->ost_task); + + return ((taskqid_t)(void *)task); +} Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 09:01:20 2009 (r196295) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h Mon Aug 17 09:03:47 2009 (r196296) @@ -49,6 +49,7 @@ extern "C" { #include #include #include +#include #include #include #include Copied: stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h (from r196295, head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h Mon Aug 17 09:03:47 2009 (r196296, copy of r196295, head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h) @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_TASKQ_H +#define _SYS_TASKQ_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define TASKQ_NAMELEN 31 + +struct taskqueue; +struct taskq { + struct taskqueue *tq_queue; +}; + +typedef struct taskq taskq_t; +typedef uintptr_t taskqid_t; +typedef void (task_func_t)(void *); + +/* + * Public flags for taskq_create(): bit range 0-15 + */ +#define TASKQ_PREPOPULATE 0x0001 /* Prepopulate with threads and data */ +#define TASKQ_CPR_SAFE 0x0002 /* Use CPR safe protocol */ +#define TASKQ_DYNAMIC 0x0004 /* Use dynamic thread scheduling */ +#define TASKQ_THREADS_CPU_PCT 0x0008 /* number of threads as % of ncpu */ + +/* + * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as + * KM_SLEEP/KM_NOSLEEP. + */ +#define TQ_SLEEP 0x00 /* Can block for memory */ +#define TQ_NOSLEEP 0x01 /* cannot block for memory; may fail */ +#define TQ_NOQUEUE 0x02 /* Do not enqueue if can't dispatch */ +#define TQ_NOALLOC 0x04 /* cannot allocate memory; may fail */ + +#ifdef _KERNEL + +extern taskq_t *system_taskq; + +extern void taskq_init(void); +extern void taskq_mp_init(void); + +extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t); +extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int, + int, uint_t); +extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t); +extern void nulltask(void *); +extern void taskq_destroy(taskq_t *); +extern void taskq_wait(taskq_t *); +extern void taskq_suspend(taskq_t *); +extern int taskq_suspended(taskq_t *); +extern void taskq_resume(taskq_t *); +extern int taskq_member(taskq_t *, kthread_t *); + +#endif /* _KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TASKQ_H */ Modified: stable/8/sys/kern/subr_taskqueue.c ============================================================================== --- stable/8/sys/kern/subr_taskqueue.c Mon Aug 17 09:01:20 2009 (r196295) +++ stable/8/sys/kern/subr_taskqueue.c Mon Aug 17 09:03:47 2009 (r196296) @@ -472,3 +472,23 @@ taskqueue_fast_run(void *dummy) TASKQUEUE_FAST_DEFINE(fast, taskqueue_fast_enqueue, NULL, swi_add(NULL, "Fast task queue", taskqueue_fast_run, NULL, SWI_TQ_FAST, INTR_MPSAFE, &taskqueue_fast_ih)); + +int +taskqueue_member(struct taskqueue *queue, struct thread *td) +{ + int i, j, ret = 0; + + TQ_LOCK(queue); + for (i = 0, j = 0; ; i++) { + if (queue->tq_threads[i] == NULL) + continue; + if (queue->tq_threads[i] == td) { + ret = 1; + break; + } + if (++j >= queue->tq_tcount) + break; + } + TQ_UNLOCK(queue); + return (ret); +} Modified: stable/8/sys/modules/zfs/Makefile ============================================================================== --- stable/8/sys/modules/zfs/Makefile Mon Aug 17 09:01:20 2009 (r196295) +++ stable/8/sys/modules/zfs/Makefile Mon Aug 17 09:03:47 2009 (r196296) @@ -23,6 +23,7 @@ SRCS+= opensolaris_kstat.c SRCS+= opensolaris_lookup.c SRCS+= opensolaris_policy.c SRCS+= opensolaris_string.c +SRCS+= opensolaris_taskq.c SRCS+= opensolaris_vfs.c SRCS+= opensolaris_zone.c @@ -42,7 +43,6 @@ SRCS+= vnode.c SRCS+= callb.c SRCS+= list.c SRCS+= nvpair_alloc_system.c -SRCS+= taskq.c .PATH: ${SUNW}/uts/common/zmod SRCS+= adler32.c Modified: stable/8/sys/sys/taskqueue.h ============================================================================== --- stable/8/sys/sys/taskqueue.h Mon Aug 17 09:01:20 2009 (r196295) +++ stable/8/sys/sys/taskqueue.h Mon Aug 17 09:03:47 2009 (r196296) @@ -37,6 +37,7 @@ #include struct taskqueue; +struct thread; /* * A notification callback function which is called from @@ -60,6 +61,7 @@ void taskqueue_free(struct taskqueue *qu void taskqueue_run(struct taskqueue *queue); void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); +int taskqueue_member(struct taskqueue *queue, struct thread *td); /* * Functions for dedicated thread taskqueues From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:13:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F4A9106568B; Mon, 17 Aug 2009 09:13:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E5A18FC43; Mon, 17 Aug 2009 09:13:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9DM8H056383; Mon, 17 Aug 2009 09:13:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9DMAl056381; Mon, 17 Aug 2009 09:13:22 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170913.n7H9DMAl056381@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196297 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:13:22 -0000 Author: pjd Date: Mon Aug 17 09:13:22 2009 New Revision: 196297 URL: http://svn.freebsd.org/changeset/base/196297 Log: Fix panic in zfs recv code. The last vnode (mountpoint's vnode) can have 0 usecount. Reported by: Thomas Backman Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:03:47 2009 (r196296) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:13:22 2009 (r196297) @@ -917,7 +917,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea for (zp = list_head(&zfsvfs->z_all_znodes); zp != NULL; zp = list_next(&zfsvfs->z_all_znodes, zp)) if (zp->z_dbuf) { - ASSERT(ZTOV(zp)->v_count > 0); + ASSERT(ZTOV(zp)->v_count >= 0); zfs_znode_dmu_fini(zp); } mutex_exit(&zfsvfs->z_znodes_lock); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:14:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FE3F106568E; Mon, 17 Aug 2009 09:14:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C3928FC3F; Mon, 17 Aug 2009 09:14:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9Ewnd056501; Mon, 17 Aug 2009 09:14:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9Ewo8056499; Mon, 17 Aug 2009 09:14:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170914.n7H9Ewo8056499@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:14:58 +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: r196298 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:14:58 -0000 Author: pjd Date: Mon Aug 17 09:14:58 2009 New Revision: 196298 URL: http://svn.freebsd.org/changeset/base/196298 Log: MFC r196297: Fix panic in zfs recv code. The last vnode (mountpoint's vnode) can have 0 usecount. Reported by: Thomas Backman Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:13:22 2009 (r196297) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Aug 17 09:14:58 2009 (r196298) @@ -917,7 +917,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea for (zp = list_head(&zfsvfs->z_all_znodes); zp != NULL; zp = list_next(&zfsvfs->z_all_znodes, zp)) if (zp->z_dbuf) { - ASSERT(ZTOV(zp)->v_count > 0); + ASSERT(ZTOV(zp)->v_count >= 0); zfs_znode_dmu_fini(zp); } mutex_exit(&zfsvfs->z_znodes_lock); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:21:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D0FA1065693; Mon, 17 Aug 2009 09:21:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0358FC61; Mon, 17 Aug 2009 09:21:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9LeN2056793; Mon, 17 Aug 2009 09:21:40 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9Ld8c056791; Mon, 17 Aug 2009 09:21:39 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170921.n7H9Ld8c056791@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196299 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:21:40 -0000 Author: pjd Date: Mon Aug 17 09:21:39 2009 New Revision: 196299 URL: http://svn.freebsd.org/changeset/base/196299 Log: - We need to recycle vnode instead of freeing znode. Submitted by: avg - Add missing vnode interlock unlock. - Remove redundant znode locking. Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:14:58 2009 (r196298) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:21:39 2009 (r196299) @@ -3709,12 +3709,11 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - mutex_enter(&zp->z_lock); VI_LOCK(vp); vp->v_count = 0; /* count arrives as 1 */ - mutex_exit(&zp->z_lock); + VI_UNLOCK(vp); + vrecycle(vp, curthread); rw_exit(&zfsvfs->z_teardown_inactive_lock); - zfs_znode_free(zp); return; } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:23:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33D131065692; Mon, 17 Aug 2009 09:23:28 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 072BD8FC6B; Mon, 17 Aug 2009 09:23:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9NR63056906; Mon, 17 Aug 2009 09:23:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9NR7t056904; Mon, 17 Aug 2009 09:23:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170923.n7H9NR7t056904@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:23: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: r196300 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:23:28 -0000 Author: pjd Date: Mon Aug 17 09:23:27 2009 New Revision: 196300 URL: http://svn.freebsd.org/changeset/base/196300 Log: MFC r196299: - We need to recycle vnode instead of freeing znode. Submitted by: avg - Add missing vnode interlock unlock. - Remove redundant znode locking. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:21:39 2009 (r196299) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:23:27 2009 (r196300) @@ -3709,12 +3709,11 @@ zfs_inactive(vnode_t *vp, cred_t *cr, ca * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - mutex_enter(&zp->z_lock); VI_LOCK(vp); vp->v_count = 0; /* count arrives as 1 */ - mutex_exit(&zp->z_lock); + VI_UNLOCK(vp); + vrecycle(vp, curthread); rw_exit(&zfsvfs->z_teardown_inactive_lock); - zfs_znode_free(zp); return; } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:25:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81A0F106568D; Mon, 17 Aug 2009 09:25:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7073F8FC69; Mon, 17 Aug 2009 09:25:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9PcQ1056986; Mon, 17 Aug 2009 09:25:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9PcS2056984; Mon, 17 Aug 2009 09:25:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170925.n7H9PcS2056984@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196301 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:25:38 -0000 Author: pjd Date: Mon Aug 17 09:25:37 2009 New Revision: 196301 URL: http://svn.freebsd.org/changeset/base/196301 Log: If z_buf is NULL, we should free znode immediately. Noticed by: avg Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:23:27 2009 (r196300) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:25:37 2009 (r196301) @@ -4350,7 +4350,6 @@ zfs_freebsd_reclaim(ap) { vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); - zfsvfs_t *zfsvfs; ASSERT(zp != NULL); @@ -4360,13 +4359,18 @@ zfs_freebsd_reclaim(ap) vnode_destroy_vobject(vp); mutex_enter(&zp->z_lock); - ASSERT(zp->z_phys); + ASSERT(zp->z_phys != NULL); ZTOV(zp) = NULL; - if (!zp->z_unlinked) { + mutex_exit(&zp->z_lock); + + if (zp->z_unlinked) + ; /* Do nothing. */ + else if (zp->z_dbuf == NULL) + zfs_znode_free(zp); + else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ { + zfsvfs_t *zfsvfs = zp->z_zfsvfs; int locked; - zfsvfs = zp->z_zfsvfs; - mutex_exit(&zp->z_lock); locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 : ZFS_OBJ_HOLD_TRYENTER(zfsvfs, zp->z_id); if (locked == 0) { @@ -4382,8 +4386,6 @@ zfs_freebsd_reclaim(ap) ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); zfs_znode_free(zp); } - } else { - mutex_exit(&zp->z_lock); } VI_LOCK(vp); vp->v_data = NULL; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:27:11 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DFEF106568E; Mon, 17 Aug 2009 09:27:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 009E68FC51; Mon, 17 Aug 2009 09:27:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9RAIJ057067; Mon, 17 Aug 2009 09:27:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9RAlx057065; Mon, 17 Aug 2009 09:27:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170927.n7H9RAlx057065@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:27:10 +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: r196302 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:27:11 -0000 Author: pjd Date: Mon Aug 17 09:27:10 2009 New Revision: 196302 URL: http://svn.freebsd.org/changeset/base/196302 Log: MFC r196301: If z_buf is NULL, we should free znode immediately. Noticed by: avg Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:25:37 2009 (r196301) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:27:10 2009 (r196302) @@ -4350,7 +4350,6 @@ zfs_freebsd_reclaim(ap) { vnode_t *vp = ap->a_vp; znode_t *zp = VTOZ(vp); - zfsvfs_t *zfsvfs; ASSERT(zp != NULL); @@ -4360,13 +4359,18 @@ zfs_freebsd_reclaim(ap) vnode_destroy_vobject(vp); mutex_enter(&zp->z_lock); - ASSERT(zp->z_phys); + ASSERT(zp->z_phys != NULL); ZTOV(zp) = NULL; - if (!zp->z_unlinked) { + mutex_exit(&zp->z_lock); + + if (zp->z_unlinked) + ; /* Do nothing. */ + else if (zp->z_dbuf == NULL) + zfs_znode_free(zp); + else /* if (!zp->z_unlinked && zp->z_dbuf != NULL) */ { + zfsvfs_t *zfsvfs = zp->z_zfsvfs; int locked; - zfsvfs = zp->z_zfsvfs; - mutex_exit(&zp->z_lock); locked = MUTEX_HELD(ZFS_OBJ_MUTEX(zfsvfs, zp->z_id)) ? 2 : ZFS_OBJ_HOLD_TRYENTER(zfsvfs, zp->z_id); if (locked == 0) { @@ -4382,8 +4386,6 @@ zfs_freebsd_reclaim(ap) ZFS_OBJ_HOLD_EXIT(zfsvfs, zp->z_id); zfs_znode_free(zp); } - } else { - mutex_exit(&zp->z_lock); } VI_LOCK(vp); vp->v_data = NULL; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:28:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A72DC106568B; Mon, 17 Aug 2009 09:28:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95FD48FC45; Mon, 17 Aug 2009 09:28:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9SFbx057121; Mon, 17 Aug 2009 09:28:15 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9SFWm057119; Mon, 17 Aug 2009 09:28:15 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170928.n7H9SFWm057119@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196303 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:28:15 -0000 Author: pjd Date: Mon Aug 17 09:28:15 2009 New Revision: 196303 URL: http://svn.freebsd.org/changeset/base/196303 Log: - Reduce z_teardown_lock lock scope a bit. - The error variable is int, not bool. - Convert spaces to tabs where needed. Approved by: re (kib) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:27:10 2009 (r196302) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:28:15 2009 (r196303) @@ -4529,9 +4529,9 @@ vop_getextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } @@ -4597,9 +4597,9 @@ vop_deleteextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); @@ -4712,7 +4712,7 @@ vop_listextattr { error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VREAD); - if (error) + if (error != 0) return (error); error = zfs_create_attrname(ap->a_attrnamespace, "", attrprefix, @@ -4729,13 +4729,13 @@ vop_listextattr { error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td, LOOKUP_XATTR); if (error != 0) { + ZFS_EXIT(zfsvfs); /* * ENOATTR means that the EA directory does not yet exist, * i.e. there are no extended attributes there. */ if (error == ENOATTR) error = 0; - ZFS_EXIT(zfsvfs); return (error); } @@ -4825,10 +4825,10 @@ zfs_freebsd_getacl(ap) return (error); error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt); - if (vsecattr.vsa_aclentp != NULL) - kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); + if (vsecattr.vsa_aclentp != NULL) + kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); - return (error); + return (error); } int From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:30:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7EF1106568E; Mon, 17 Aug 2009 09:30:31 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3E358FC64; Mon, 17 Aug 2009 09:30:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9UVBx057218; Mon, 17 Aug 2009 09:30:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9UVZB057216; Mon, 17 Aug 2009 09:30:31 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170930.n7H9UVZB057216@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:30:31 +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: r196304 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:30:32 -0000 Author: pjd Date: Mon Aug 17 09:30:31 2009 New Revision: 196304 URL: http://svn.freebsd.org/changeset/base/196304 Log: MFC r196303: - Reduce z_teardown_lock lock scope a bit. - The error variable is int, not bool. - Convert spaces to tabs where needed. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:28:15 2009 (r196303) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:30:31 2009 (r196304) @@ -4529,9 +4529,9 @@ vop_getextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } @@ -4597,9 +4597,9 @@ vop_deleteextattr { vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { + ZFS_EXIT(zfsvfs); if (error == ENOENT) error = ENOATTR; - ZFS_EXIT(zfsvfs); return (error); } error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); @@ -4712,7 +4712,7 @@ vop_listextattr { error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, ap->a_cred, ap->a_td, VREAD); - if (error) + if (error != 0) return (error); error = zfs_create_attrname(ap->a_attrnamespace, "", attrprefix, @@ -4729,13 +4729,13 @@ vop_listextattr { error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td, LOOKUP_XATTR); if (error != 0) { + ZFS_EXIT(zfsvfs); /* * ENOATTR means that the EA directory does not yet exist, * i.e. there are no extended attributes there. */ if (error == ENOATTR) error = 0; - ZFS_EXIT(zfsvfs); return (error); } @@ -4825,10 +4825,10 @@ zfs_freebsd_getacl(ap) return (error); error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt); - if (vsecattr.vsa_aclentp != NULL) - kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); + if (vsecattr.vsa_aclentp != NULL) + kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); - return (error); + return (error); } int From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:34:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF3201065694; Mon, 17 Aug 2009 09:34:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE06B8FC62; Mon, 17 Aug 2009 09:34:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9Y0TI057327; Mon, 17 Aug 2009 09:34:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9Y0SV057325; Mon, 17 Aug 2009 09:34:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170934.n7H9Y0SV057325@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196305 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:34:00 -0000 Author: pjd Date: Mon Aug 17 09:34:00 2009 New Revision: 196305 URL: http://svn.freebsd.org/changeset/base/196305 Log: Fix receive when dataset has no / in its name. Submitted by: James R. Van Artsdalen Approved by: re (kib) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:30:31 2009 (r196304) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:34:00 2009 (r196305) @@ -1126,7 +1126,7 @@ again: uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + char *fsname, *stream_fsname, *p1, *p2; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -1295,10 +1295,11 @@ again: "parentfromsnap", &stream_parent_fromsnap_guid)); /* check for rename */ + p1 = strrchr(fsname, '/'); + p2 = strrchr(stream_fsname, '/'); if ((stream_parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) || - strcmp(strrchr(fsname, '/'), - strrchr(stream_fsname, '/')) != 0) { + (p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0)) { nvlist_t *parent; char tryname[ZFS_MAXNAMELEN]; @@ -1317,7 +1318,7 @@ again: VERIFY(0 == nvlist_lookup_string(parent, "name", &pname)); (void) snprintf(tryname, sizeof (tryname), - "%s%s", pname, strrchr(stream_fsname, '/')); + "%s%s", pname, p2 != NULL ? p2 : ""); } else { tryname[0] = '\0'; if (flags.verbose) { From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:42:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99511106568C; Mon, 17 Aug 2009 09:42:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52D478FC15; Mon, 17 Aug 2009 09:42:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9gYVE057525; Mon, 17 Aug 2009 09:42:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9gYPN057523; Mon, 17 Aug 2009 09:42:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170942.n7H9gYPN057523@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:42:34 +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: r196306 - in stable/8/cddl/contrib/opensolaris: . lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:42:34 -0000 Author: pjd Date: Mon Aug 17 09:42:34 2009 New Revision: 196306 URL: http://svn.freebsd.org/changeset/base/196306 Log: MFC r196305: Fix receive when dataset has no / in its name. Submitted by: James R. Van Artsdalen Approved by: re (kib) Modified: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:34:00 2009 (r196305) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Mon Aug 17 09:42:34 2009 (r196306) @@ -1126,7 +1126,7 @@ again: uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + char *fsname, *stream_fsname, *p1, *p2; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -1295,10 +1295,11 @@ again: "parentfromsnap", &stream_parent_fromsnap_guid)); /* check for rename */ + p1 = strrchr(fsname, '/'); + p2 = strrchr(stream_fsname, '/'); if ((stream_parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) || - strcmp(strrchr(fsname, '/'), - strrchr(stream_fsname, '/')) != 0) { + (p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0)) { nvlist_t *parent; char tryname[ZFS_MAXNAMELEN]; @@ -1317,7 +1318,7 @@ again: VERIFY(0 == nvlist_lookup_string(parent, "name", &pname)); (void) snprintf(tryname, sizeof (tryname), - "%s%s", pname, strrchr(stream_fsname, '/')); + "%s%s", pname, p2 != NULL ? p2 : ""); } else { tryname[0] = '\0'; if (flags.verbose) { From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:48:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5BD4106568E; Mon, 17 Aug 2009 09:48:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B13508FC60; Mon, 17 Aug 2009 09:48:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9mYgX057693; Mon, 17 Aug 2009 09:48:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9mY9H057685; Mon, 17 Aug 2009 09:48:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170948.n7H9mY9H057685@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196307 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys contrib/opensolaris/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:48:34 -0000 Author: pjd Date: Mon Aug 17 09:48:34 2009 New Revision: 196307 URL: http://svn.freebsd.org/changeset/base/196307 Log: Manage asynchronous vnode release just like Solaris. Discussed with: kmacy Approved by: re (kib) Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) @@ -75,7 +75,6 @@ vn_is_readonly(vnode_t *vp) #define VN_HOLD(v) vref(v) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VN_RELE_ASYNC(v, tq) vn_rele_async(v, tq); #define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:48:34 2009 (r196307) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,12 +36,10 @@ * contributors. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include +#include #include /* Extensible attribute (xva) routines. */ @@ -74,15 +72,12 @@ xva_getxoptattr(xvattr_t *xvap) return (xoap); } -static STAILQ_HEAD(, vnode) vn_rele_async_list; -static struct mtx vn_rele_async_lock; -static struct cv vn_rele_async_cv; -static int vn_rele_list_length; -static int vn_rele_async_thread_exit; - -typedef struct { - struct vnode *stqe_next; -} vnode_link_t; +static void +vn_rele_inactive(vnode_t *vp) +{ + + vrele(vp); +} /* * Like vn_rele() except if we are going to call VOP_INACTIVE() then do it @@ -95,117 +90,16 @@ typedef struct { * This is because taskqs throttle back allocation if too many are created. */ void -vn_rele_async(vnode_t *vp, taskq_t *taskq /* unused */) +vn_rele_async(vnode_t *vp, taskq_t *taskq) { - - KASSERT(vp != NULL, ("vrele: null vp")); - VFS_ASSERT_GIANT(vp->v_mount); + VERIFY(vp->v_count > 0); VI_LOCK(vp); - - if (vp->v_usecount > 1 || ((vp->v_iflag & VI_DOINGINACT) && - vp->v_usecount == 1)) { - vp->v_usecount--; - vdropl(vp); - return; - } - if (vp->v_usecount != 1) { -#ifdef DIAGNOSTIC - vprint("vrele: negative ref count", vp); -#endif + if (vp->v_count == 1 && !(vp->v_iflag & VI_DOINGINACT)) { VI_UNLOCK(vp); - panic("vrele: negative ref cnt"); - } - /* - * We are exiting - */ - if (vn_rele_async_thread_exit != 0) { - vrele(vp); + VERIFY(taskq_dispatch((taskq_t *)taskq, + (task_func_t *)vn_rele_inactive, vp, TQ_SLEEP) != 0); return; } - - mtx_lock(&vn_rele_async_lock); - - /* STAILQ_INSERT_TAIL */ - (*(vnode_link_t *)&vp->v_cstart).stqe_next = NULL; - *vn_rele_async_list.stqh_last = vp; - vn_rele_async_list.stqh_last = - &((vnode_link_t *)&vp->v_cstart)->stqe_next; - - /****************************************/ - vn_rele_list_length++; - if ((vn_rele_list_length % 100) == 0) - cv_signal(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - VI_UNLOCK(vp); -} - -static void -vn_rele_async_init(void *arg) -{ - - mtx_init(&vn_rele_async_lock, "valock", NULL, MTX_DEF); - STAILQ_INIT(&vn_rele_async_list); - - /* cv_init(&vn_rele_async_cv, "vacv"); */ - vn_rele_async_cv.cv_description = "vacv"; - vn_rele_async_cv.cv_waiters = 0; -} - -void -vn_rele_async_fini(void) -{ - - mtx_lock(&vn_rele_async_lock); - vn_rele_async_thread_exit = 1; - cv_signal(&vn_rele_async_cv); - while (vn_rele_async_thread_exit != 0) - cv_wait(&vn_rele_async_cv, &vn_rele_async_lock); - mtx_unlock(&vn_rele_async_lock); - mtx_destroy(&vn_rele_async_lock); -} - - -static void -vn_rele_async_cleaner(void) -{ - STAILQ_HEAD(, vnode) vn_tmp_list; - struct vnode *curvnode; - - STAILQ_INIT(&vn_tmp_list); - mtx_lock(&vn_rele_async_lock); - while (vn_rele_async_thread_exit == 0) { - STAILQ_CONCAT(&vn_tmp_list, &vn_rele_async_list); - vn_rele_list_length = 0; - mtx_unlock(&vn_rele_async_lock); - - while (!STAILQ_EMPTY(&vn_tmp_list)) { - curvnode = STAILQ_FIRST(&vn_tmp_list); - - /* STAILQ_REMOVE_HEAD */ - STAILQ_FIRST(&vn_tmp_list) = - ((vnode_link_t *)&curvnode->v_cstart)->stqe_next; - if (STAILQ_FIRST(&vn_tmp_list) == NULL) - vn_tmp_list.stqh_last = &STAILQ_FIRST(&vn_tmp_list); - /***********************/ - vrele(curvnode); - } - mtx_lock(&vn_rele_async_lock); - if (vn_rele_list_length == 0) - cv_timedwait(&vn_rele_async_cv, &vn_rele_async_lock, - hz/10); - } - - vn_rele_async_thread_exit = 0; - cv_broadcast(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - thread_exit(); + vp->v_usecount--; + vdropl(vp); } - -static struct proc *vn_rele_async_proc; -static struct kproc_desc up_kp = { - "vaclean", - vn_rele_async_cleaner, - &vn_rele_async_proc -}; -SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp); -SYSINIT(vn_rele_async_setup, SI_SUB_VFS, SI_ORDER_FIRST, vn_rele_async_init, NULL); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:48:34 2009 (r196307) @@ -1199,9 +1199,6 @@ dmu_init(void) void dmu_fini(void) { -#ifdef _KERNEL - vn_rele_async_fini(); -#endif arc_fini(); dnode_fini(); dbuf_fini(); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:48:34 2009 (r196307) @@ -91,6 +91,9 @@ dsl_pool_open_impl(spa_t *spa, uint64_t mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&dp->dp_scrub_cancel_lock, NULL, MUTEX_DEFAULT, NULL); + dp->dp_vnrele_taskq = taskq_create("zfs_vn_rele_taskq", 1, minclsyspri, + 1, 4, 0); + return (dp); } @@ -228,6 +231,7 @@ dsl_pool_close(dsl_pool_t *dp) rw_destroy(&dp->dp_config_rwlock); mutex_destroy(&dp->dp_lock); mutex_destroy(&dp->dp_scrub_cancel_lock); + taskq_destroy(dp->dp_vnrele_taskq); kmem_free(dp, sizeof (dsl_pool_t)); } @@ -611,3 +615,9 @@ dsl_pool_create_origin(dsl_pool_t *dp, d dsl_dataset_rele(ds, FTAG); rw_exit(&dp->dp_config_rwlock); } + +taskq_t * +dsl_pool_vnrele_taskq(dsl_pool_t *dp) +{ + return (dp->dp_vnrele_taskq); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:48:34 2009 (r196307) @@ -57,6 +57,7 @@ typedef struct dsl_pool { struct dsl_dir *dp_mos_dir; struct dsl_dataset *dp_origin_snap; uint64_t dp_root_dir_obj; + struct taskq *dp_vnrele_taskq; /* No lock needed - sync context only */ blkptr_t dp_meta_rootbp; @@ -119,6 +120,8 @@ int dsl_pool_scrub_clean(dsl_pool_t *dp) void dsl_pool_scrub_sync(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_scrub_restart(dsl_pool_t *dp); +taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp); + #ifdef __cplusplus } #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:48:34 2009 (r196307) @@ -924,6 +924,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) zgd_t *zgd = (zgd_t *)vzgd; rl_t *rl = zgd->zgd_rl; vnode_t *vp = ZTOV(rl->r_zp); + objset_t *os = rl->r_zp->z_zfsvfs->z_os; int vfslocked; vfslocked = VFS_LOCK_GIANT(vp->v_vfsp); @@ -933,7 +934,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(vp, NULL); + VN_RELE_ASYNC(vp, dsl_pool_vnrele_taskq(dmu_objset_pool(os))); zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); kmem_free(zgd, sizeof (zgd_t)); VFS_UNLOCK_GIANT(vfslocked); @@ -968,8 +969,8 @@ zfs_get_data(void *arg, lr_write_t *lr, * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); - + VN_RELE_ASYNC(ZTOV(zp), + dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (ENOENT); } @@ -1045,7 +1046,7 @@ out: * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); + VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (error); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:42:34 2009 (r196306) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) @@ -354,6 +354,11 @@ typedef struct caller_context { } caller_context_t; /* + * Structure tags for function prototypes, defined elsewhere. + */ +struct taskq; + +/* * Flags for VOP_LOOKUP * * Defined in file.h, but also possible, FIGNORECASE @@ -370,6 +375,13 @@ typedef struct caller_context { #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ /* + * Public vnode manipulation functions. + */ +#ifdef _KERNEL + +void vn_rele_async(struct vnode *vp, struct taskq *taskq); + +/* * Extensible vnode attribute (xva) routines: * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t @@ -377,10 +389,12 @@ typedef struct caller_context { void xva_init(xvattr_t *); xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ -struct taskq; -void vn_rele_async(struct vnode *vp, struct taskq *taskq); -void vn_rele_async_fini(void); - +#define VN_RELE_ASYNC(vp, taskq) { \ + vn_rele_async(vp, taskq); \ +} + +#endif /* _KERNEL */ + /* * Flags to VOP_SETATTR/VOP_GETATTR. */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 09:55:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 191F01065672; Mon, 17 Aug 2009 09:55:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 040958FC64; Mon, 17 Aug 2009 09:55:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9tw6n057983; Mon, 17 Aug 2009 09:55:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7H9twFY057975; Mon, 17 Aug 2009 09:55:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908170955.n7H9twFY057975@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 09:55:58 +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: r196308 - in stable/8/sys: . amd64/include/xen cddl/compat/opensolaris/sys cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs cddl/contrib/opensolaris/uts/common/fs/zfs cdd... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:55:59 -0000 Author: pjd Date: Mon Aug 17 09:55:58 2009 New Revision: 196308 URL: http://svn.freebsd.org/changeset/base/196308 Log: MFC r196307: Manage asynchronous vnode release just like Solaris. Discussed with: kmacy Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/compat/opensolaris/sys/vnode.h stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/compat/opensolaris/sys/vnode.h Mon Aug 17 09:55:58 2009 (r196308) @@ -75,7 +75,6 @@ vn_is_readonly(vnode_t *vp) #define VN_HOLD(v) vref(v) #define VN_RELE(v) vrele(v) #define VN_URELE(v) vput(v) -#define VN_RELE_ASYNC(v, tq) vn_rele_async(v, tq); #define VOP_REALVP(vp, vpp, ct) (*(vpp) = (vp), 0) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Mon Aug 17 09:55:58 2009 (r196308) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,12 +36,10 @@ * contributors. */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include +#include #include /* Extensible attribute (xva) routines. */ @@ -74,15 +72,12 @@ xva_getxoptattr(xvattr_t *xvap) return (xoap); } -static STAILQ_HEAD(, vnode) vn_rele_async_list; -static struct mtx vn_rele_async_lock; -static struct cv vn_rele_async_cv; -static int vn_rele_list_length; -static int vn_rele_async_thread_exit; - -typedef struct { - struct vnode *stqe_next; -} vnode_link_t; +static void +vn_rele_inactive(vnode_t *vp) +{ + + vrele(vp); +} /* * Like vn_rele() except if we are going to call VOP_INACTIVE() then do it @@ -95,117 +90,16 @@ typedef struct { * This is because taskqs throttle back allocation if too many are created. */ void -vn_rele_async(vnode_t *vp, taskq_t *taskq /* unused */) +vn_rele_async(vnode_t *vp, taskq_t *taskq) { - - KASSERT(vp != NULL, ("vrele: null vp")); - VFS_ASSERT_GIANT(vp->v_mount); + VERIFY(vp->v_count > 0); VI_LOCK(vp); - - if (vp->v_usecount > 1 || ((vp->v_iflag & VI_DOINGINACT) && - vp->v_usecount == 1)) { - vp->v_usecount--; - vdropl(vp); - return; - } - if (vp->v_usecount != 1) { -#ifdef DIAGNOSTIC - vprint("vrele: negative ref count", vp); -#endif + if (vp->v_count == 1 && !(vp->v_iflag & VI_DOINGINACT)) { VI_UNLOCK(vp); - panic("vrele: negative ref cnt"); - } - /* - * We are exiting - */ - if (vn_rele_async_thread_exit != 0) { - vrele(vp); + VERIFY(taskq_dispatch((taskq_t *)taskq, + (task_func_t *)vn_rele_inactive, vp, TQ_SLEEP) != 0); return; } - - mtx_lock(&vn_rele_async_lock); - - /* STAILQ_INSERT_TAIL */ - (*(vnode_link_t *)&vp->v_cstart).stqe_next = NULL; - *vn_rele_async_list.stqh_last = vp; - vn_rele_async_list.stqh_last = - &((vnode_link_t *)&vp->v_cstart)->stqe_next; - - /****************************************/ - vn_rele_list_length++; - if ((vn_rele_list_length % 100) == 0) - cv_signal(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - VI_UNLOCK(vp); -} - -static void -vn_rele_async_init(void *arg) -{ - - mtx_init(&vn_rele_async_lock, "valock", NULL, MTX_DEF); - STAILQ_INIT(&vn_rele_async_list); - - /* cv_init(&vn_rele_async_cv, "vacv"); */ - vn_rele_async_cv.cv_description = "vacv"; - vn_rele_async_cv.cv_waiters = 0; -} - -void -vn_rele_async_fini(void) -{ - - mtx_lock(&vn_rele_async_lock); - vn_rele_async_thread_exit = 1; - cv_signal(&vn_rele_async_cv); - while (vn_rele_async_thread_exit != 0) - cv_wait(&vn_rele_async_cv, &vn_rele_async_lock); - mtx_unlock(&vn_rele_async_lock); - mtx_destroy(&vn_rele_async_lock); -} - - -static void -vn_rele_async_cleaner(void) -{ - STAILQ_HEAD(, vnode) vn_tmp_list; - struct vnode *curvnode; - - STAILQ_INIT(&vn_tmp_list); - mtx_lock(&vn_rele_async_lock); - while (vn_rele_async_thread_exit == 0) { - STAILQ_CONCAT(&vn_tmp_list, &vn_rele_async_list); - vn_rele_list_length = 0; - mtx_unlock(&vn_rele_async_lock); - - while (!STAILQ_EMPTY(&vn_tmp_list)) { - curvnode = STAILQ_FIRST(&vn_tmp_list); - - /* STAILQ_REMOVE_HEAD */ - STAILQ_FIRST(&vn_tmp_list) = - ((vnode_link_t *)&curvnode->v_cstart)->stqe_next; - if (STAILQ_FIRST(&vn_tmp_list) == NULL) - vn_tmp_list.stqh_last = &STAILQ_FIRST(&vn_tmp_list); - /***********************/ - vrele(curvnode); - } - mtx_lock(&vn_rele_async_lock); - if (vn_rele_list_length == 0) - cv_timedwait(&vn_rele_async_cv, &vn_rele_async_lock, - hz/10); - } - - vn_rele_async_thread_exit = 0; - cv_broadcast(&vn_rele_async_cv); - mtx_unlock(&vn_rele_async_lock); - thread_exit(); + vp->v_usecount--; + vdropl(vp); } - -static struct proc *vn_rele_async_proc; -static struct kproc_desc up_kp = { - "vaclean", - vn_rele_async_cleaner, - &vn_rele_async_proc -}; -SYSINIT(vaclean, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp); -SYSINIT(vn_rele_async_setup, SI_SUB_VFS, SI_ORDER_FIRST, vn_rele_async_init, NULL); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Aug 17 09:55:58 2009 (r196308) @@ -1199,9 +1199,6 @@ dmu_init(void) void dmu_fini(void) { -#ifdef _KERNEL - vn_rele_async_fini(); -#endif arc_fini(); dnode_fini(); dbuf_fini(); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Mon Aug 17 09:55:58 2009 (r196308) @@ -91,6 +91,9 @@ dsl_pool_open_impl(spa_t *spa, uint64_t mutex_init(&dp->dp_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&dp->dp_scrub_cancel_lock, NULL, MUTEX_DEFAULT, NULL); + dp->dp_vnrele_taskq = taskq_create("zfs_vn_rele_taskq", 1, minclsyspri, + 1, 4, 0); + return (dp); } @@ -228,6 +231,7 @@ dsl_pool_close(dsl_pool_t *dp) rw_destroy(&dp->dp_config_rwlock); mutex_destroy(&dp->dp_lock); mutex_destroy(&dp->dp_scrub_cancel_lock); + taskq_destroy(dp->dp_vnrele_taskq); kmem_free(dp, sizeof (dsl_pool_t)); } @@ -611,3 +615,9 @@ dsl_pool_create_origin(dsl_pool_t *dp, d dsl_dataset_rele(ds, FTAG); rw_exit(&dp->dp_config_rwlock); } + +taskq_t * +dsl_pool_vnrele_taskq(dsl_pool_t *dp) +{ + return (dp->dp_vnrele_taskq); +} Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h Mon Aug 17 09:55:58 2009 (r196308) @@ -57,6 +57,7 @@ typedef struct dsl_pool { struct dsl_dir *dp_mos_dir; struct dsl_dataset *dp_origin_snap; uint64_t dp_root_dir_obj; + struct taskq *dp_vnrele_taskq; /* No lock needed - sync context only */ blkptr_t dp_meta_rootbp; @@ -119,6 +120,8 @@ int dsl_pool_scrub_clean(dsl_pool_t *dp) void dsl_pool_scrub_sync(dsl_pool_t *dp, dmu_tx_t *tx); void dsl_pool_scrub_restart(dsl_pool_t *dp); +taskq_t *dsl_pool_vnrele_taskq(dsl_pool_t *dp); + #ifdef __cplusplus } #endif Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 17 09:55:58 2009 (r196308) @@ -924,6 +924,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) zgd_t *zgd = (zgd_t *)vzgd; rl_t *rl = zgd->zgd_rl; vnode_t *vp = ZTOV(rl->r_zp); + objset_t *os = rl->r_zp->z_zfsvfs->z_os; int vfslocked; vfslocked = VFS_LOCK_GIANT(vp->v_vfsp); @@ -933,7 +934,7 @@ zfs_get_done(dmu_buf_t *db, void *vzgd) * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(vp, NULL); + VN_RELE_ASYNC(vp, dsl_pool_vnrele_taskq(dmu_objset_pool(os))); zil_add_block(zgd->zgd_zilog, zgd->zgd_bp); kmem_free(zgd, sizeof (zgd_t)); VFS_UNLOCK_GIANT(vfslocked); @@ -968,8 +969,8 @@ zfs_get_data(void *arg, lr_write_t *lr, * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); - + VN_RELE_ASYNC(ZTOV(zp), + dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (ENOENT); } @@ -1045,7 +1046,7 @@ out: * Release the vnode asynchronously as we currently have the * txg stopped from syncing. */ - VN_RELE_ASYNC(ZTOV(zp), NULL); + VN_RELE_ASYNC(ZTOV(zp), dsl_pool_vnrele_taskq(dmu_objset_pool(os))); return (error); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:48:34 2009 (r196307) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h Mon Aug 17 09:55:58 2009 (r196308) @@ -354,6 +354,11 @@ typedef struct caller_context { } caller_context_t; /* + * Structure tags for function prototypes, defined elsewhere. + */ +struct taskq; + +/* * Flags for VOP_LOOKUP * * Defined in file.h, but also possible, FIGNORECASE @@ -370,6 +375,13 @@ typedef struct caller_context { #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ /* + * Public vnode manipulation functions. + */ +#ifdef _KERNEL + +void vn_rele_async(struct vnode *vp, struct taskq *taskq); + +/* * Extensible vnode attribute (xva) routines: * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t @@ -377,10 +389,12 @@ typedef struct caller_context { void xva_init(xvattr_t *); xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ -struct taskq; -void vn_rele_async(struct vnode *vp, struct taskq *taskq); -void vn_rele_async_fini(void); - +#define VN_RELE_ASYNC(vp, taskq) { \ + vn_rele_async(vp, taskq); \ +} + +#endif /* _KERNEL */ + /* * Flags to VOP_SETATTR/VOP_GETATTR. */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 10:00:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE6A106568B; Mon, 17 Aug 2009 10:00:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 198D58FC15; Mon, 17 Aug 2009 10:00:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HA0I8P058151; Mon, 17 Aug 2009 10:00:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HA0Iau058149; Mon, 17 Aug 2009 10:00:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908171000.n7HA0Iau058149@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 10:00:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196309 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 10:00:19 -0000 Author: pjd Date: Mon Aug 17 10:00:18 2009 New Revision: 196309 URL: http://svn.freebsd.org/changeset/base/196309 Log: getcwd() (when __getcwd() fails) works by stating current directory, going up (..), calling readdir and looking for previous directory inode. In case of .zfs/ directory this doesn't work, because .zfs/ is hidden by default, so it won't be visible in readdir output. Fix this by implementing VPTOCNP for snapshot directories, so __getcwd() doesn't fail and getcwd() doesn't have to use readdir method. This fixes /bin/pwd from within .zfs/snapshot//. Suggested by: kib Approved by: re (rwatson) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 09:55:58 2009 (r196308) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 10:00:18 2009 (r196309) @@ -1195,6 +1195,48 @@ zfsctl_snapshot_lookup(ap) return (error); } +static int +zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) +{ + zfsvfs_t *zfsvfs = ap->a_vp->v_vfsp->vfs_data; + vnode_t *dvp, *vp; + zfsctl_snapdir_t *sdp; + zfs_snapentry_t *sep; + int error; + + ASSERT(zfsvfs->z_ctldir != NULL); + error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", &dvp, + NULL, 0, NULL, kcred, NULL, NULL, NULL); + if (error != 0) + return (error); + sdp = dvp->v_data; + + mutex_enter(&sdp->sd_lock); + sep = avl_first(&sdp->sd_snaps); + while (sep != NULL) { + vp = sep->se_root; + if (vp == ap->a_vp) + break; + sep = AVL_NEXT(&sdp->sd_snaps, sep); + } + if (sep == NULL) { + mutex_exit(&sdp->sd_lock); + error = ENOENT; + } else { + size_t len; + + len = strlen(sep->se_name); + *ap->a_buflen -= len; + bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); + mutex_exit(&sdp->sd_lock); + vhold(dvp); + *ap->a_vpp = dvp; + } + VN_RELE(dvp); + + return (error); +} + /* * These VP's should never see the light of day. They should always * be covered. @@ -1206,6 +1248,7 @@ static struct vop_vector zfsctl_ops_snap .vop_reclaim = zfsctl_common_reclaim, .vop_getattr = zfsctl_snapshot_getattr, .vop_fid = zfsctl_snapshot_fid, + .vop_vptocnp = zfsctl_snapshot_vptocnp, }; int From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 10:02:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E74106568C; Mon, 17 Aug 2009 10:02:32 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 127028FC55; Mon, 17 Aug 2009 10:02:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HA2Ve6058243; Mon, 17 Aug 2009 10:02:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HA2VPr058241; Mon, 17 Aug 2009 10:02:31 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908171002.n7HA2VPr058241@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 10:02:31 +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: r196310 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 10:02:32 -0000 Author: pjd Date: Mon Aug 17 10:02:31 2009 New Revision: 196310 URL: http://svn.freebsd.org/changeset/base/196310 Log: MFC r196309: getcwd() (when __getcwd() fails) works by stating current directory, going up (..), calling readdir and looking for previous directory inode. In case of .zfs/ directory this doesn't work, because .zfs/ is hidden by default, so it won't be visible in readdir output. Fix this by implementing VPTOCNP for snapshot directories, so __getcwd() doesn't fail and getcwd() doesn't have to use readdir method. This fixes /bin/pwd from within .zfs/snapshot//. Suggested by: kib Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 10:00:18 2009 (r196309) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Aug 17 10:02:31 2009 (r196310) @@ -1195,6 +1195,48 @@ zfsctl_snapshot_lookup(ap) return (error); } +static int +zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) +{ + zfsvfs_t *zfsvfs = ap->a_vp->v_vfsp->vfs_data; + vnode_t *dvp, *vp; + zfsctl_snapdir_t *sdp; + zfs_snapentry_t *sep; + int error; + + ASSERT(zfsvfs->z_ctldir != NULL); + error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", &dvp, + NULL, 0, NULL, kcred, NULL, NULL, NULL); + if (error != 0) + return (error); + sdp = dvp->v_data; + + mutex_enter(&sdp->sd_lock); + sep = avl_first(&sdp->sd_snaps); + while (sep != NULL) { + vp = sep->se_root; + if (vp == ap->a_vp) + break; + sep = AVL_NEXT(&sdp->sd_snaps, sep); + } + if (sep == NULL) { + mutex_exit(&sdp->sd_lock); + error = ENOENT; + } else { + size_t len; + + len = strlen(sep->se_name); + *ap->a_buflen -= len; + bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); + mutex_exit(&sdp->sd_lock); + vhold(dvp); + *ap->a_vpp = dvp; + } + VN_RELE(dvp); + + return (error); +} + /* * These VP's should never see the light of day. They should always * be covered. @@ -1206,6 +1248,7 @@ static struct vop_vector zfsctl_ops_snap .vop_reclaim = zfsctl_common_reclaim, .vop_getattr = zfsctl_snapshot_getattr, .vop_fid = zfsctl_snapshot_fid, + .vop_vptocnp = zfsctl_snapshot_vptocnp, }; int From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 10:20:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C64DD106568C; Mon, 17 Aug 2009 10:20:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B58CF8FC65; Mon, 17 Aug 2009 10:20:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HAKM62058617; Mon, 17 Aug 2009 10:20:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HAKMDU058615; Mon, 17 Aug 2009 10:20:22 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908171020.n7HAKMDU058615@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 10:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196311 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 10:20:22 -0000 Author: pjd Date: Mon Aug 17 10:20:22 2009 New Revision: 196311 URL: http://svn.freebsd.org/changeset/base/196311 Log: Correct typo in the previous commit. Noticed by: pluknet Approved by: re (kib, implicit) Modified: head/share/man/man9/taskqueue.9 Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Aug 17 10:02:31 2009 (r196310) +++ head/share/man/man9/taskqueue.9 Mon Aug 17 10:20:22 2009 (r196311) @@ -188,7 +188,7 @@ The .Fn taskqueue_member function returns .No 1 -is the given thread +if the given thread .Fa td is part of the given taskqeueue .Fa queue From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 10:21:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69DBA106568E; Mon, 17 Aug 2009 10:21:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 585E78FC52; Mon, 17 Aug 2009 10:21:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HALbqJ058687; Mon, 17 Aug 2009 10:21:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HALb89058685; Mon, 17 Aug 2009 10:21:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908171021.n7HALb89058685@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 17 Aug 2009 10:21:37 +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: r196312 - stable/8/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 10:21:38 -0000 Author: pjd Date: Mon Aug 17 10:21:37 2009 New Revision: 196312 URL: http://svn.freebsd.org/changeset/base/196312 Log: MFC r196311: Correct typo in the previous commit. Noticed by: pluknet Approved by: re (kib, implicit) Modified: stable/8/share/man/man9/ (props changed) stable/8/share/man/man9/taskqueue.9 Modified: stable/8/share/man/man9/taskqueue.9 ============================================================================== --- stable/8/share/man/man9/taskqueue.9 Mon Aug 17 10:20:22 2009 (r196311) +++ stable/8/share/man/man9/taskqueue.9 Mon Aug 17 10:21:37 2009 (r196312) @@ -188,7 +188,7 @@ The .Fn taskqueue_member function returns .No 1 -is the given thread +if the given thread .Fa td is part of the given taskqeueue .Fa queue From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 12:57:57 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD821065672; Mon, 17 Aug 2009 12:57:57 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B48E8FC45; Mon, 17 Aug 2009 12:57:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HCvv3Z078167; Mon, 17 Aug 2009 12:57:57 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HCvveb078164; Mon, 17 Aug 2009 12:57:57 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200908171257.n7HCvveb078164@svn.freebsd.org> From: Rui Paulo Date: Mon, 17 Aug 2009 12:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196316 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 12:57:57 -0000 Author: rpaulo Date: Mon Aug 17 12:57:57 2009 New Revision: 196316 URL: http://svn.freebsd.org/changeset/base/196316 Log: Fix a typo in ifdef mesh support. This would make mesh unworkable if TDMA support was compiled out. Approved by: re (kib) Modified: head/sys/net80211/ieee80211_input.c Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Mon Aug 17 12:37:06 2009 (r196315) +++ head/sys/net80211/ieee80211_input.c Mon Aug 17 12:57:57 2009 (r196316) @@ -524,7 +524,7 @@ ieee80211_parse_beacon(struct ieee80211_ case IEEE80211_ELEMID_HTINFO: scan->htinfo = frm; break; -#ifdef IEEE80211_SUPPORT_TDMA +#ifdef IEEE80211_SUPPORT_MESH case IEEE80211_ELEMID_MESHID: scan->meshid = frm; break; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 13:00:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F9AB10656C0; Mon, 17 Aug 2009 13:00:32 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 622258FC6D; Mon, 17 Aug 2009 13:00:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HD0WGH078295; Mon, 17 Aug 2009 13:00:32 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HD0WGe078293; Mon, 17 Aug 2009 13:00:32 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200908171300.n7HD0WGe078293@svn.freebsd.org> From: Rui Paulo Date: Mon, 17 Aug 2009 13:00: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: r196317 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfront dev/xen/xenpci modules/dtrace/dtnfsclient... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 13:00:32 -0000 Author: rpaulo Date: Mon Aug 17 13:00:32 2009 New Revision: 196317 URL: http://svn.freebsd.org/changeset/base/196317 Log: MFC r196316: Fix a typo in ifdef mesh support. This would make mesh unworkable if TDMA support was compiled out. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/net80211/ieee80211_input.c stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/net80211/ieee80211_input.c ============================================================================== --- stable/8/sys/net80211/ieee80211_input.c Mon Aug 17 12:57:57 2009 (r196316) +++ stable/8/sys/net80211/ieee80211_input.c Mon Aug 17 13:00:32 2009 (r196317) @@ -524,7 +524,7 @@ ieee80211_parse_beacon(struct ieee80211_ case IEEE80211_ELEMID_HTINFO: scan->htinfo = frm; break; -#ifdef IEEE80211_SUPPORT_TDMA +#ifdef IEEE80211_SUPPORT_MESH case IEEE80211_ELEMID_MESHID: scan->meshid = frm; break; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 13:27:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D7FE106568D; Mon, 17 Aug 2009 13:27:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C9A68FC68; Mon, 17 Aug 2009 13:27:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HDRuM0078879; Mon, 17 Aug 2009 13:27:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HDRuxs078877; Mon, 17 Aug 2009 13:27:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200908171327.n7HDRuxs078877@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Aug 2009 13:27:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196318 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 13:27:56 -0000 Author: kib Date: Mon Aug 17 13:27:55 2009 New Revision: 196318 URL: http://svn.freebsd.org/changeset/base/196318 Log: Correct a critical accounting error in pmap_demote_pde(). Specifically, when pmap_demote_pde() allocates a page table page to implement a user-space demotion, it must increment the pmap's resident page count. Not doing so, can lead to an underflow during address space termination that causes pmap_remove() to exit prematurely, before it has destroyed all of the mappings within the specified range. The ultimate effect or symptom of this error is an assertion failure in vm_page_free_toq() because the page being freed is still mapped. This error is only possible when superpage promotion is enabled. Thus, it only affects FreeBSD versions greater than 7.2. Tested by: pho, alc Reviewed by: alc Approved by: re (rwatson) MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Aug 17 13:00:32 2009 (r196317) +++ head/sys/amd64/amd64/pmap.c Mon Aug 17 13:27:55 2009 (r196318) @@ -2261,6 +2261,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t " in pmap %p", va, pmap); return (FALSE); } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 13:32:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3850106568E; Mon, 17 Aug 2009 13:32:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8655B8FC61; Mon, 17 Aug 2009 13:32:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HDWuIB079049; Mon, 17 Aug 2009 13:32:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HDWueA079047; Mon, 17 Aug 2009 13:32:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200908171332.n7HDWueA079047@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Aug 2009 13:32:56 +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: r196319 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfront dev/xen/xenpci modules/dtrace... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 13:32:56 -0000 Author: kib Date: Mon Aug 17 13:32:56 2009 New Revision: 196319 URL: http://svn.freebsd.org/changeset/base/196319 Log: MFC r196318: Correct accounting error when allocating a a page table page to implement a user-space demotion. Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Mon Aug 17 13:27:55 2009 (r196318) +++ stable/8/sys/amd64/amd64/pmap.c Mon Aug 17 13:32:56 2009 (r196319) @@ -2261,6 +2261,8 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t " in pmap %p", va, pmap); return (FALSE); } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 13:51:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38DC9106568B; Mon, 17 Aug 2009 13:51:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2528B8FC67; Mon, 17 Aug 2009 13:51:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HDp4RL079478; Mon, 17 Aug 2009 13:51:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HDp46a079477; Mon, 17 Aug 2009 13:51:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171351.n7HDp46a079477@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 13:51: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: r196320 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci modules/dtrace/dtnfsclient modules... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 13:51:04 -0000 Author: jhb Date: Mon Aug 17 13:51:03 2009 New Revision: 196320 URL: http://svn.freebsd.org/changeset/base/196320 Log: Stow my time machine and note that r196223 is an MFC of r196224. Pointy hat to: jhb Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ata/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/netipx/spx_reass.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 13:51:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32858106568C; Mon, 17 Aug 2009 13:51:20 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 212DE8FC3F; Mon, 17 Aug 2009 13:51:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HDpK4K079518; Mon, 17 Aug 2009 13:51:20 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HDpKk4079515; Mon, 17 Aug 2009 13:51:20 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200908171351.n7HDpKk4079515@svn.freebsd.org> From: Scott Long Date: Mon, 17 Aug 2009 13:51:19 +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: r196321 - in stable/8: etc etc/mtree include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 13:51:20 -0000 Author: scottl Date: Mon Aug 17 13:51:19 2009 New Revision: 196321 URL: http://svn.freebsd.org/changeset/base/196321 Log: Merge files missed in r196285. SVN is simply horrible. Sorry for the tree breakage. Approved by: re Modified: stable/8/etc/ (props changed) stable/8/etc/mtree/BSD.include.dist stable/8/include/ (props changed) stable/8/include/Makefile Modified: stable/8/etc/mtree/BSD.include.dist ============================================================================== --- stable/8/etc/mtree/BSD.include.dist Mon Aug 17 13:51:03 2009 (r196320) +++ stable/8/etc/mtree/BSD.include.dist Mon Aug 17 13:51:19 2009 (r196321) @@ -104,6 +104,8 @@ .. lmc .. + mfi + .. mpt mpilib .. Modified: stable/8/include/Makefile ============================================================================== --- stable/8/include/Makefile Mon Aug 17 13:51:03 2009 (r196320) +++ stable/8/include/Makefile Mon Aug 17 13:51:19 2009 (r196321) @@ -40,7 +40,7 @@ LDIRS= bsm cam geom net net80211 netatal LSUBDIRS= cam/ata cam/scsi \ dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ - dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \ + dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 14:11:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68AAA106568E; Mon, 17 Aug 2009 14:11:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 34CFE8FC15; Mon, 17 Aug 2009 14:11:49 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D9F1A46B29; Mon, 17 Aug 2009 10:11:48 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 1DBCF8A01B; Mon, 17 Aug 2009 10:11:48 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Date: Mon, 17 Aug 2009 08:10:30 -0400 User-Agent: KMail/1.9.7 References: <200908160212.n7G2CDUn097279@svn.freebsd.org> <3bbf2fe10908151919s17752057y53dd32fb02a857bb@mail.gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908170810.31444.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 17 Aug 2009 10:11:48 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Marcel Moolenaar , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Attilio Rao , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/xen/netfront dev/xen/xenpci ia64/ia64 modules/dtrace/dtnfsclie... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 14:11:49 -0000 On Saturday 15 August 2009 10:42:26 pm Marcel Moolenaar wrote: > > On Aug 15, 2009, at 7:19 PM, Attilio Rao wrote: > > > 2009/8/16 Marcel Moolenaar : > >> Author: marcel > >> Date: Sun Aug 16 02:12:13 2009 > >> New Revision: 196270 > >> URL: http://svn.freebsd.org/changeset/base/196270 > >> > >> Log: > >> MFC rev 196268: > >> Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be > >> sparse, which causes a kernel assert. > > > > Can you be a bit more precise? > > What kernel assert? > > In subr_smp.c, function smp_topo(): > panic("Built bad topology at %p. CPU mask 0x%X != 0x%X", > top, top->cg_mask, all_cpus); > > See also: > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=506001+0+archive/2009/freebsd-current/20090719.freebsd-current > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=626164+0+archive/2009/freebsd-current/20090719.freebsd-current Gah, I'd rather fix the topology code to work properly in that case. :-/ -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 14:38:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC8C71065696; Mon, 17 Aug 2009 14:38:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAEBD8FC55; Mon, 17 Aug 2009 14:38:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HEcxwg080552; Mon, 17 Aug 2009 14:38:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HEcxLr080551; Mon, 17 Aug 2009 14:38:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171438.n7HEcxLr080551@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 14:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196322 - in head/sys: dev/cxgb modules/dtrace/dtnfsclient modules/ip6_mroute_mod modules/ipmi/ipmi_linux netinet/ipfw xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 14:38:59 -0000 Author: jhb Date: Mon Aug 17 14:38:59 2009 New Revision: 196322 URL: http://svn.freebsd.org/changeset/base/196322 Log: Purge mergeinfo in sys/ that is either empty or a subset of the parent mergeinfo on sys/ itself. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/cxgb/ (props changed) head/sys/modules/dtrace/dtnfsclient/ (props changed) head/sys/modules/ip6_mroute_mod/ (props changed) head/sys/modules/ipmi/ipmi_linux/ (props changed) head/sys/netinet/ipfw/ip_dummynet.c (props changed) head/sys/netinet/ipfw/ip_fw2.c (props changed) head/sys/netinet/ipfw/ip_fw_nat.c (props changed) head/sys/netinet/ipfw/ip_fw_pfil.c (props changed) head/sys/xen/evtchn.h (props changed) head/sys/xen/hypervisor.h (props changed) head/sys/xen/xen_intr.h (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 14:42:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2973106568D; Mon, 17 Aug 2009 14:42:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B01C78FC43; Mon, 17 Aug 2009 14:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HEgf8x080721; Mon, 17 Aug 2009 14:42:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HEgf32080720; Mon, 17 Aug 2009 14:42:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171442.n7HEgf32080720@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 14:42:41 +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: r196323 - in stable/8/sys: dev/cxgb modules/dtrace/dtnfsclient modules/ip6_mroute_mod modules/ipmi/ipmi_linux netinet/ipfw xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 14:42:41 -0000 Author: jhb Date: Mon Aug 17 14:42:41 2009 New Revision: 196323 URL: http://svn.freebsd.org/changeset/base/196323 Log: MFC: Purge mergeinfo in sys/ that is either empty or a subset of the parent mergeinfo on sys/ itself. Approved by: re (mergeinfo blanket) Modified: stable/8/sys/dev/cxgb/ (props changed) stable/8/sys/modules/dtrace/dtnfsclient/ (props changed) stable/8/sys/modules/ip6_mroute_mod/ (props changed) stable/8/sys/modules/ipmi/ipmi_linux/ (props changed) stable/8/sys/netinet/ipfw/ip_dummynet.c (props changed) stable/8/sys/netinet/ipfw/ip_fw2.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_nat.c (props changed) stable/8/sys/netinet/ipfw/ip_fw_pfil.c (props changed) stable/8/sys/xen/evtchn.h (props changed) stable/8/sys/xen/hypervisor.h (props changed) stable/8/sys/xen/xen_intr.h (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 14:53:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D8AD1065690; Mon, 17 Aug 2009 14:53:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8C598FC79; Mon, 17 Aug 2009 14:53:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HErKP4081048; Mon, 17 Aug 2009 14:53:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HErK7V081047; Mon, 17 Aug 2009 14:53:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171453.n7HErK7V081047@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 14:53:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196324 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 14:53:21 -0000 Author: jhb Date: Mon Aug 17 14:53:20 2009 New Revision: 196324 URL: http://svn.freebsd.org/changeset/base/196324 Log: Remove bogus mergeinfo claiming that change 185357 from head/sys was merged into head/sys/dev/ata. The mergeinfo was added as a side effect of another change and not as part of a merge. The rest of the mergeinfo on dev/ata was a valid subset of the parent mergeinfo on sys/. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/ata/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 14:53:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A251D10656A4; Mon, 17 Aug 2009 14:53:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 777868FC67; Mon, 17 Aug 2009 14:53:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HErx2O081104; Mon, 17 Aug 2009 14:53:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HErxd6081103; Mon, 17 Aug 2009 14:53:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171453.n7HErxd6081103@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 14:53:59 +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: r196325 - stable/8/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 14:53:59 -0000 Author: jhb Date: Mon Aug 17 14:53:59 2009 New Revision: 196325 URL: http://svn.freebsd.org/changeset/base/196325 Log: MFC: Remove bogus mergeinfo claiming that change 185357 from head/sys was merged into head/sys/dev/ata. Approved by: re (mergeinfo blanket) Modified: stable/8/sys/dev/ata/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:19:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67A54106568F; Mon, 17 Aug 2009 15:19:03 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5753C8FC57; Mon, 17 Aug 2009 15:19:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFJ3tJ081729; Mon, 17 Aug 2009 15:19:03 GMT (envelope-from jhay@svn.freebsd.org) Received: (from jhay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFJ351081727; Mon, 17 Aug 2009 15:19:03 GMT (envelope-from jhay@svn.freebsd.org) Message-Id: <200908171519.n7HFJ351081727@svn.freebsd.org> From: John Hay Date: Mon, 17 Aug 2009 15:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196326 - head/sys/boot/i386/gptboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:19:03 -0000 Author: jhay Date: Mon Aug 17 15:19:03 2009 New Revision: 196326 URL: http://svn.freebsd.org/changeset/base/196326 Log: Fix parse() so that the partition to boot (load /boot/loader) from can be set. The syntax as printed in main() is used: 0:ad(0p3)/boot/loader Reviewed by: jhb Approved by: re (kib) Modified: head/sys/boot/i386/gptboot/gptboot.c Modified: head/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- head/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 14:53:59 2009 (r196325) +++ head/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 15:19:03 2009 (r196326) @@ -466,16 +466,13 @@ parse(void) dsk.type = i; arg += 3; dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) + if (arg[1] != 'p' || dsk.unit > 9) return -1; arg += 2; - dsk.part = -1; - if (arg[1] == ',') { - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) - return -1; - arg += 2; - } + dsk.part = *arg - '0'; + if (dsk.part < 1 || dsk.part > 9) + return -1; + arg++; if (arg[0] != ')') return -1; arg++; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:36:13 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41BC51065690; Mon, 17 Aug 2009 15:36:13 +0000 (UTC) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 042598FC55; Mon, 17 Aug 2009 15:36:12 +0000 (UTC) Received: from ice.local ([10.0.0.115]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n7HFaCIm011848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 17 Aug 2009 08:36:12 -0700 (PDT) (envelope-from sam@errno.com) Message-ID: <4A8978EC.101@errno.com> Date: Mon, 17 Aug 2009 08:36:12 -0700 From: Sam Leffler User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <200908170842.n7H8gYo5054777@svn.freebsd.org> In-Reply-To: <200908170842.n7H8gYo5054777@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-DCC--Metrics: ebb.errno.com; whitelist Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196293 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:36:13 -0000 Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Aug 17 08:42:34 2009 > New Revision: 196293 > URL: http://svn.freebsd.org/changeset/base/196293 > > Log: > Because taskqueue_run() can drop tq_mutex, we need to check if the > TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a > wakeup. So this would leave a task q thread running? Can you describe the scenario that demonstrated this problem? Sam From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:39:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8338F1065693; Mon, 17 Aug 2009 15:39:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 598018FC6B; Mon, 17 Aug 2009 15:39:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFdjXL082197; Mon, 17 Aug 2009 15:39:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFdjXD082196; Mon, 17 Aug 2009 15:39:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171539.n7HFdjXD082196@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 15:39:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196327 - in head/sys/dev/xen: netfront xenpci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:39:45 -0000 Author: jhb Date: Mon Aug 17 15:39:45 2009 New Revision: 196327 URL: http://svn.freebsd.org/changeset/base/196327 Log: - Remove self-referential mergeinfo from xen/netfront and xen/xenpci that claims those directories were merged into themselves. - Remove mergeinfo on xen/xenpci that claims the stable/7 xenpci was merged into head. Approved by: re (mergeinfo blanket) Modified: head/sys/dev/xen/netfront/ (props changed) head/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:39:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27155106568E; Mon, 17 Aug 2009 15:39:48 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13B958FC55; Mon, 17 Aug 2009 15:39:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFdlbu082232; Mon, 17 Aug 2009 15:39:47 GMT (envelope-from jhay@svn.freebsd.org) Received: (from jhay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFdlW1082230; Mon, 17 Aug 2009 15:39:47 GMT (envelope-from jhay@svn.freebsd.org) Message-Id: <200908171539.n7HFdlW1082230@svn.freebsd.org> From: John Hay Date: Mon, 17 Aug 2009 15:39:47 +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: r196328 - in stable/8/sys: . amd64/include/xen boot/i386/gptboot cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/netfront dev/xen/xenpci netipx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:39:48 -0000 Author: jhay Date: Mon Aug 17 15:39:47 2009 New Revision: 196328 URL: http://svn.freebsd.org/changeset/base/196328 Log: MFC: 196326 Fix parse() so that the partition to boot (load /boot/loader) from can be set. The syntax as printed in main() is used: 0:ad(0p3)/boot/loader Reviewed by: jhb Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/i386/gptboot/gptboot.c 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/mfi/ (props changed) stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netipx/spx_reass.c (props changed) Modified: stable/8/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- stable/8/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 15:39:45 2009 (r196327) +++ stable/8/sys/boot/i386/gptboot/gptboot.c Mon Aug 17 15:39:47 2009 (r196328) @@ -466,16 +466,13 @@ parse(void) dsk.type = i; arg += 3; dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) + if (arg[1] != 'p' || dsk.unit > 9) return -1; arg += 2; - dsk.part = -1; - if (arg[1] == ',') { - dsk.part = *arg - '0'; - if (dsk.part < 1 || dsk.part > 9) - return -1; - arg += 2; - } + dsk.part = *arg - '0'; + if (dsk.part < 1 || dsk.part > 9) + return -1; + arg++; if (arg[0] != ')') return -1; arg++; From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:42:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34B94106568B; Mon, 17 Aug 2009 15:42:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8FC78FC41; Mon, 17 Aug 2009 15:42:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFgtIL082343; Mon, 17 Aug 2009 15:42:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFgtXQ082342; Mon, 17 Aug 2009 15:42:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171542.n7HFgtXQ082342@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 15:42: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: r196329 - in stable/8/sys/dev/xen: netfront xenpci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:42:56 -0000 Author: jhb Date: Mon Aug 17 15:42:55 2009 New Revision: 196329 URL: http://svn.freebsd.org/changeset/base/196329 Log: - Remove self-referential mergeinfo from xen/netfront and xen/xenpci that claims those directories were merged into themselves. - Remove mergeinfo on xen/xenpci that claims the stable/7 xenpci was merged into head. Approved by: re (mergeinfo blanket) Modified: stable/8/sys/dev/xen/netfront/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:50:11 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE0B10656BF; Mon, 17 Aug 2009 15:50:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00C128FC15; Mon, 17 Aug 2009 15:50:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFoAPG082556; Mon, 17 Aug 2009 15:50:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFoAK1082555; Mon, 17 Aug 2009 15:50:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171550.n7HFoAK1082555@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 15:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196330 - head/sys/netipx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:50:11 -0000 Author: jhb Date: Mon Aug 17 15:50:10 2009 New Revision: 196330 URL: http://svn.freebsd.org/changeset/base/196330 Log: Remove the spx_usrreq.c mergeinfo from spx_reass.c. Future changes to spx_usrreq.c won't be merged to spx_reass.c which is what this would help with. Approved by: re (blanket mergeinfo), rwatson Modified: head/sys/netipx/spx_reass.c (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 15:51:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 779481065690; Mon, 17 Aug 2009 15:51:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CC038FC5B; Mon, 17 Aug 2009 15:51:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HFpV3v082643; Mon, 17 Aug 2009 15:51:31 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HFpVqK082642; Mon, 17 Aug 2009 15:51:31 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171551.n7HFpVqK082642@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 15:51:31 +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: r196331 - stable/8/sys/netipx X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 15:51:31 -0000 Author: jhb Date: Mon Aug 17 15:51:31 2009 New Revision: 196331 URL: http://svn.freebsd.org/changeset/base/196331 Log: Remove the spx_usrreq.c mergeinfo from spx_reass.c. Future changes to spx_usrreq.c won't be merged to spx_reass.c which is what this would help with. Approved by: re (mergeinfo blanket), rwatson Modified: stable/8/sys/netipx/spx_reass.c (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:12:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3145B1065672; Mon, 17 Aug 2009 16:12:29 +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 203918FC51; Mon, 17 Aug 2009 16:12:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HGCTMX083165; Mon, 17 Aug 2009 16:12:29 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HGCTIL083163; Mon, 17 Aug 2009 16:12:29 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200908171612.n7HGCTIL083163@svn.freebsd.org> From: Rick Macklem Date: Mon, 17 Aug 2009 16:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196332 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:12:29 -0000 Author: rmacklem Date: Mon Aug 17 16:12:28 2009 New Revision: 196332 URL: http://svn.freebsd.org/changeset/base/196332 Log: Apply the same patch as r196205 for nfs_upgrade_lock() and nfs_downgrade_lock() to the experimental nfs client. Approved by: re (kensmith), kib (mentor) Modified: head/sys/fs/nfsclient/nfs_clsubs.c Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 15:51:31 2009 (r196331) +++ head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 16:12:28 2009 (r196332) @@ -129,28 +129,25 @@ int ncl_upgrade_vnlock(struct vnode *vp) { int old_lock; - - if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Upgrade to exclusive lock, this might block */ - vn_lock(vp, LK_UPGRADE | LK_RETRY); - } else { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - } + + ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock"); + old_lock = VOP_ISLOCKED(vp); + if (old_lock != LK_EXCLUSIVE) { + KASSERT(old_lock == LK_SHARED, + ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); + /* Upgrade to exclusive lock, this might block */ + vn_lock(vp, LK_UPGRADE | LK_RETRY); } - return old_lock; + return (old_lock); } void ncl_downgrade_vnlock(struct vnode *vp, int old_lock) { if (old_lock != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Downgrade from exclusive lock, this might block */ - vn_lock(vp, LK_DOWNGRADE); - } else { - VOP_UNLOCK(vp, 0); - } + KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); + /* Downgrade from exclusive lock. */ + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); } } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:16:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9F231065691; Mon, 17 Aug 2009 16:16:46 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 993058FC43; Mon, 17 Aug 2009 16:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HGGk3F083379; Mon, 17 Aug 2009 16:16:46 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HGGkwc083377; Mon, 17 Aug 2009 16:16:46 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908171616.n7HGGkwc083377@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 17 Aug 2009 16:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196333 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:16:46 -0000 Author: marcel Date: Mon Aug 17 16:16:46 2009 New Revision: 196333 URL: http://svn.freebsd.org/changeset/base/196333 Log: The start of the EFI GPT partition in the PMBR can always be represented by CHS addressing. Don't define these fields as 0xff, but rather define them correctly. This prevents boot problems on PCs where GPT is being used. PR: 115406 Submitted by: Kent Hauser Approved by: re (kib) Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Mon Aug 17 16:12:28 2009 (r196332) +++ head/sys/geom/part/g_part_gpt.c Mon Aug 17 16:16:46 2009 (r196333) @@ -409,9 +409,9 @@ g_part_gpt_create(struct g_part_table *b last = (pp->mediasize / pp->sectorsize) - 1; le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); - table->mbr[DOSPARTOFF + 1] = 0xff; /* shd */ - table->mbr[DOSPARTOFF + 2] = 0xff; /* ssect */ - table->mbr[DOSPARTOFF + 3] = 0xff; /* scyl */ + table->mbr[DOSPARTOFF + 1] = 0x01; /* shd */ + table->mbr[DOSPARTOFF + 2] = 0x01; /* ssect */ + table->mbr[DOSPARTOFF + 3] = 0x00; /* scyl */ table->mbr[DOSPARTOFF + 4] = 0xee; /* typ */ table->mbr[DOSPARTOFF + 5] = 0xff; /* ehd */ table->mbr[DOSPARTOFF + 6] = 0xff; /* esect */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:17:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D08D2106568B; Mon, 17 Aug 2009 16:17:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF3858FC57; Mon, 17 Aug 2009 16:17:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HGHL1m083438; Mon, 17 Aug 2009 16:17:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HGHLJs083432; Mon, 17 Aug 2009 16:17:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200908171617.n7HGHLJs083432@svn.freebsd.org> From: Attilio Rao Date: Mon, 17 Aug 2009 16:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196334 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:17:21 -0000 Author: attilio Date: Mon Aug 17 16:17:21 2009 New Revision: 196334 URL: http://svn.freebsd.org/changeset/base/196334 Log: * Change the scope of the ASSERT_ATOMIC_LOAD() from a generic check to a pointer-fetching specific operation check. Consequently, rename the operation ASSERT_ATOMIC_LOAD_PTR(). * Fix the implementation of ASSERT_ATOMIC_LOAD_PTR() by checking directly alignment on the word boundry, for all the given specific architectures. That's a bit too strict for some common case, but it assures safety. * Add a comment explaining the scope of the macro * Add a new stub in the lockmgr specific implementation Tested by: marcel (initial version), marius Reviewed by: rwatson, jhb (comment specific review) Approved by: re (kib) Modified: head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/sys/systm.h Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_lock.c Mon Aug 17 16:17:21 2009 (r196334) @@ -334,6 +334,9 @@ lockinit(struct lock *lk, int pri, const int iflags; MPASS((flags & ~LK_INIT_MASK) == 0); + ASSERT_ATOMIC_LOAD_PTR(lk->lk_lock, + ("%s: lockmgr not aligned for %s: %p", __func__, wmesg, + &lk->lk_lock)); iflags = LO_SLEEPABLE | LO_UPGRADABLE; if (flags & LK_CANRECURSE) Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_mutex.c Mon Aug 17 16:17:21 2009 (r196334) @@ -783,8 +783,9 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); - ASSERT_ATOMIC_LOAD(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p", - __func__, name, &m->mtx_lock)); + ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, + ("%s: mtx_lock not aligned for %s: %p", __func__, name, + &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_rwlock.c Mon Aug 17 16:17:21 2009 (r196334) @@ -174,8 +174,9 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); - ASSERT_ATOMIC_LOAD(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p", - __func__, name, &rw->rw_lock)); + ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, + ("%s: rw_lock not aligned for %s: %p", __func__, name, + &rw->rw_lock)); flags = LO_UPGRADABLE; if (opts & RW_DUPOK) Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/kern/kern_sx.c Mon Aug 17 16:17:21 2009 (r196334) @@ -205,8 +205,9 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_NOADAPTIVE)) == 0); - ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", - __func__, description, &sx->sx_lock)); + ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, + ("%s: sx_lock not aligned for %s: %p", __func__, description, + &sx->sx_lock)); flags = LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Aug 17 16:16:46 2009 (r196333) +++ head/sys/sys/systm.h Mon Aug 17 16:17:21 2009 (r196334) @@ -89,9 +89,16 @@ extern int maxusers; /* system tune hin #define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] #endif -#define ASSERT_ATOMIC_LOAD(var,msg) \ - KASSERT(sizeof(var) <= sizeof(uintptr_t) && \ - ALIGN(&(var)) == (uintptr_t)&(var), msg) +/* + * Assert that a pointer can be loaded from memory atomically. + * + * This assertion enforces stronger alignment than necessary. For example, + * on some architectures, atomicity for unaligned loads will depend on + * whether or not the load spans multiple cache lines. + */ +#define ASSERT_ATOMIC_LOAD_PTR(var, msg) \ + KASSERT(sizeof(var) == sizeof(void *) && \ + ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) /* * XXX the hints declarations are even more misplaced than most declarations From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:24:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D7E0106568B; Mon, 17 Aug 2009 16:24:51 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 775698FC3D; Mon, 17 Aug 2009 16:24:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HGOppp083682; Mon, 17 Aug 2009 16:24:51 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HGOpmQ083680; Mon, 17 Aug 2009 16:24:51 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200908171624.n7HGOpmQ083680@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 17 Aug 2009 16:24:51 +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: r196335 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/xenpci geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:24:51 -0000 Author: marcel Date: Mon Aug 17 16:24:50 2009 New Revision: 196335 URL: http://svn.freebsd.org/changeset/base/196335 Log: MFC rev 196333: The start of the EFI GPT partition in the PMBR can always be represented by CHS addressing. Don't define these fields as 0xff, but rather define them correctly. This prevents boot problems on PCs where GPT is being used. PR: 115406 Submitted by: Kent Hauser Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/mfi/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/part/g_part_gpt.c Modified: stable/8/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/8/sys/geom/part/g_part_gpt.c Mon Aug 17 16:17:21 2009 (r196334) +++ stable/8/sys/geom/part/g_part_gpt.c Mon Aug 17 16:24:50 2009 (r196335) @@ -409,9 +409,9 @@ g_part_gpt_create(struct g_part_table *b last = (pp->mediasize / pp->sectorsize) - 1; le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); - table->mbr[DOSPARTOFF + 1] = 0xff; /* shd */ - table->mbr[DOSPARTOFF + 2] = 0xff; /* ssect */ - table->mbr[DOSPARTOFF + 3] = 0xff; /* scyl */ + table->mbr[DOSPARTOFF + 1] = 0x01; /* shd */ + table->mbr[DOSPARTOFF + 2] = 0x01; /* ssect */ + table->mbr[DOSPARTOFF + 3] = 0x00; /* scyl */ table->mbr[DOSPARTOFF + 4] = 0xee; /* typ */ table->mbr[DOSPARTOFF + 5] = 0xff; /* ehd */ table->mbr[DOSPARTOFF + 6] = 0xff; /* esect */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:33:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9D91106564A; Mon, 17 Aug 2009 16:33:53 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5DBB8FC16; Mon, 17 Aug 2009 16:33:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HGXrKL083935; Mon, 17 Aug 2009 16:33:53 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HGXrAK083929; Mon, 17 Aug 2009 16:33:53 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200908171633.n7HGXrAK083929@svn.freebsd.org> From: Attilio Rao Date: Mon, 17 Aug 2009 16:33: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: r196336 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/xenpci kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:33:53 -0000 Author: attilio Date: Mon Aug 17 16:33:53 2009 New Revision: 196336 URL: http://svn.freebsd.org/changeset/base/196336 Log: MFC r196334: * Change the scope of the ASSERT_ATOMIC_LOAD() from a generic check to a pointer-fetching specific operation check. Consequently, rename the operation ASSERT_ATOMIC_LOAD_PTR(). * Fix the implementation of ASSERT_ATOMIC_LOAD_PTR() by checking directly alignment on the word boundry, for all the given specific architectures. That's a bit too strict for some common case, but it assures safety. * Add a comment explaining the scope of the macro * Add a new stub in the lockmgr specific implementation Tested by: marcel (initial version), marius Reviewed by: rwatson, jhb (comment specific review) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/mfi/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/kern_lock.c stable/8/sys/kern/kern_mutex.c stable/8/sys/kern/kern_rwlock.c stable/8/sys/kern/kern_sx.c stable/8/sys/sys/systm.h Modified: stable/8/sys/kern/kern_lock.c ============================================================================== --- stable/8/sys/kern/kern_lock.c Mon Aug 17 16:24:50 2009 (r196335) +++ stable/8/sys/kern/kern_lock.c Mon Aug 17 16:33:53 2009 (r196336) @@ -334,6 +334,9 @@ lockinit(struct lock *lk, int pri, const int iflags; MPASS((flags & ~LK_INIT_MASK) == 0); + ASSERT_ATOMIC_LOAD_PTR(lk->lk_lock, + ("%s: lockmgr not aligned for %s: %p", __func__, wmesg, + &lk->lk_lock)); iflags = LO_SLEEPABLE | LO_UPGRADABLE; if (flags & LK_CANRECURSE) Modified: stable/8/sys/kern/kern_mutex.c ============================================================================== --- stable/8/sys/kern/kern_mutex.c Mon Aug 17 16:24:50 2009 (r196335) +++ stable/8/sys/kern/kern_mutex.c Mon Aug 17 16:33:53 2009 (r196336) @@ -783,8 +783,9 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); - ASSERT_ATOMIC_LOAD(m->mtx_lock, ("%s: mtx_lock not aligned for %s: %p", - __func__, name, &m->mtx_lock)); + ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, + ("%s: mtx_lock not aligned for %s: %p", __func__, name, + &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: stable/8/sys/kern/kern_rwlock.c ============================================================================== --- stable/8/sys/kern/kern_rwlock.c Mon Aug 17 16:24:50 2009 (r196335) +++ stable/8/sys/kern/kern_rwlock.c Mon Aug 17 16:33:53 2009 (r196336) @@ -174,8 +174,9 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); - ASSERT_ATOMIC_LOAD(rw->rw_lock, ("%s: rw_lock not aligned for %s: %p", - __func__, name, &rw->rw_lock)); + ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, + ("%s: rw_lock not aligned for %s: %p", __func__, name, + &rw->rw_lock)); flags = LO_UPGRADABLE; if (opts & RW_DUPOK) Modified: stable/8/sys/kern/kern_sx.c ============================================================================== --- stable/8/sys/kern/kern_sx.c Mon Aug 17 16:24:50 2009 (r196335) +++ stable/8/sys/kern/kern_sx.c Mon Aug 17 16:33:53 2009 (r196336) @@ -205,8 +205,9 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_NOADAPTIVE)) == 0); - ASSERT_ATOMIC_LOAD(sx->sx_lock, ("%s: sx_lock not aligned for %s: %p", - __func__, description, &sx->sx_lock)); + ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, + ("%s: sx_lock not aligned for %s: %p", __func__, description, + &sx->sx_lock)); flags = LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Mon Aug 17 16:24:50 2009 (r196335) +++ stable/8/sys/sys/systm.h Mon Aug 17 16:33:53 2009 (r196336) @@ -89,9 +89,16 @@ extern int maxusers; /* system tune hin #define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] #endif -#define ASSERT_ATOMIC_LOAD(var,msg) \ - KASSERT(sizeof(var) <= sizeof(uintptr_t) && \ - ALIGN(&(var)) == (uintptr_t)&(var), msg) +/* + * Assert that a pointer can be loaded from memory atomically. + * + * This assertion enforces stronger alignment than necessary. For example, + * on some architectures, atomicity for unaligned loads will depend on + * whether or not the load spans multiple cache lines. + */ +#define ASSERT_ATOMIC_LOAD_PTR(var, msg) \ + KASSERT(sizeof(var) == sizeof(void *) && \ + ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) /* * XXX the hints declarations are even more misplaced than most declarations From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:47:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87CD8106568D; Mon, 17 Aug 2009 16:47:00 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout030.mac.com (asmtpout030.mac.com [17.148.16.105]) by mx1.freebsd.org (Postfix) with ESMTP id 715BE8FC61; Mon, 17 Aug 2009 16:47:00 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp030.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KOJ008365ABGE40@asmtp030.mac.com>; Mon, 17 Aug 2009 09:47:00 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <200908171617.n7HGHLJs083432@svn.freebsd.org> Date: Mon, 17 Aug 2009 09:46:58 -0700 Message-id: References: <200908171617.n7HGHLJs083432@svn.freebsd.org> To: Attilio Rao X-Mailer: Apple Mail (2.1074) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196334 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:47:00 -0000 On Aug 17, 2009, at 9:17 AM, Attilio Rao wrote: > Log: > * Change the scope of the ASSERT_ATOMIC_LOAD() from a generic check > to > a pointer-fetching specific operation check. Consequently, rename > the > operation ASSERT_ATOMIC_LOAD_PTR(). Thanks for sticking with it and driving it to conclusion. -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:48:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 575C910656F0; Mon, 17 Aug 2009 16:48:07 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from mail-bw0-f219.google.com (mail-bw0-f219.google.com [209.85.218.219]) by mx1.freebsd.org (Postfix) with ESMTP id AEA1C8FC69; Mon, 17 Aug 2009 16:48:06 +0000 (UTC) Received: by bwz19 with SMTP id 19so3268126bwz.37 for ; Mon, 17 Aug 2009 09:48:05 -0700 (PDT) Received: by 10.103.86.22 with SMTP id o22mr1368264mul.102.1250526291862; Mon, 17 Aug 2009 09:24:51 -0700 (PDT) Received: from ?192.168.0.103? (93-46-213-181.ip109.fastwebnet.it [93.46.213.181]) by mx.google.com with ESMTPS id u26sm19799229mug.21.2009.08.17.09.24.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Aug 2009 09:24:50 -0700 (PDT) Message-Id: From: Andrew Thompson To: "pjd@freebsd.org" In-Reply-To: <200908161413.n7GEDuYN018862@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (iPod Mail 7A341) Date: Mon, 17 Aug 2009 18:22:32 +0200 References: <200908161413.n7GEDuYN018862@svn.freebsd.org> X-Mailer: iPod Mail (7A341) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r196274 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:48:07 -0000 On 16/08/2009, at 16:13, Andrew Thompson wrote: > Author: thompsa > Date: Sun Aug 16 14:13:55 2009 > New Revision: 196274 > URL: http://svn.freebsd.org/changeset/base/196274 > > Log: > Change the usb workers from kernel processes to threads, this is > mostly a > cosmetic change to reduce cruft in the proc table. > > Modified: head/sys/dev/usb/usb_process.c > === > === > === > ===================================================================== > --- head/sys/dev/usb/usb_process.c Sun Aug 16 10:25:58 2009 > (r196273) > +++ head/sys/dev/usb/usb_process.c Sun Aug 16 14:13:55 2009 > (r196274) > @@ -63,10 +63,12 @@ > #endif > > #if (__FreeBSD_version >= 800000) > +static struct proc *usbproc; > #define USB_THREAD_CREATE(f, s, p, ...) \ > - kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__) > + kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ > + 0, "usb", __VA_ARGS__) This could also be a nice tidyup for zfs which creates quite a few procs. cheers, Andrew From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 16:56:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B690A106568F; Mon, 17 Aug 2009 16:56:24 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id 6B6378FC55; Mon, 17 Aug 2009 16:56:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id 4DD7B6D423; Mon, 17 Aug 2009 18:58:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T+bgdGQEIi2r; Mon, 17 Aug 2009 18:58:24 +0200 (CEST) Received: by mx1.rink.nu (Postfix, from userid 1000) id 8A7AF6D41E; Mon, 17 Aug 2009 18:58:24 +0200 (CEST) Date: Mon, 17 Aug 2009 18:58:24 +0200 From: Rink Springer To: Marcel Moolenaar Message-ID: <20090817165824.GA91509@rink.nu> References: <200908171624.n7HGOpmQ083680@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908171624.n7HGOpmQ083680@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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: r196335 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/xenpci geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 16:56:24 -0000 On Mon, Aug 17, 2009 at 04:24:51PM +0000, Marcel Moolenaar wrote: > Log: > MFC rev 196333: > The start of the EFI GPT partition in the PMBR can always be represented > by CHS addressing. Don't define these fields as 0xff, but rather define > them correctly. This prevents boot problems on PCs where GPT is being > used. Thanks! I had this on my todo (got bitten by it some time ago) but forgot all about it; thanks for fixing it. -- Rink P.W. Springer - http://rink.nu "Beauty often seduces us on the road to truth." - Dr. Wilson From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 17:09:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50DB3106568B; Mon, 17 Aug 2009 17:09:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 400608FC41; Mon, 17 Aug 2009 17:09:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HH9FUE084711; Mon, 17 Aug 2009 17:09:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HH9Fa7084709; Mon, 17 Aug 2009 17:09:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171709.n7HH9Fa7084709@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 17:09:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196337 - head/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 17:09:15 -0000 Author: jhb Date: Mon Aug 17 17:09:14 2009 New Revision: 196337 URL: http://svn.freebsd.org/changeset/base/196337 Log: Document the newly added SVNCMDARGS, SVNROOT, and SVNBRANCH variables. Approved by: re (kib) Modified: head/share/man/man7/release.7 Modified: head/share/man/man7/release.7 ============================================================================== --- head/share/man/man7/release.7 Mon Aug 17 16:33:53 2009 (r196336) +++ head/share/man/man7/release.7 Mon Aug 17 17:09:14 2009 (r196337) @@ -390,6 +390,35 @@ of the CVS tree .It Va SEPARATE_LIVEFS Store the live file system on its own CD-ROM image rather than placing it on the first disc. +.It Va SVNCMDARGS +Additional arguments for svn +.Ic checkout +and +.Ic switch +commands. +.It Va SVNROOT +The location of the FreeBSD SVN source repository. +If this variable is set, +then the source tree will be extracted using Subversion rather than +CVS. +.It Va SVNBRANCH +The branch to check out from a SVN source repository. +It is specified as a path such as +.Pa head +or +.Pa stable/7 . +If this variable is not set, +then the branch that corresponds to the current value of +.Va RELEASETAG +will be used. +If neither +.Va SVNBRANCH +nor +.Va RELEASETAG +are set, +then the +.Pa head +branch will be used. .It Va TARGET_ARCH The target machine processor architecture. This is analogous to the From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 17:13:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C24E106568D; Mon, 17 Aug 2009 17:13:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A50C8FC61; Mon, 17 Aug 2009 17:13:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HHDHiW084873; Mon, 17 Aug 2009 17:13:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HHDHMZ084871; Mon, 17 Aug 2009 17:13:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171713.n7HHDHMZ084871@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 17:13: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: r196338 - stable/8/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 17:13:17 -0000 Author: jhb Date: Mon Aug 17 17:13:17 2009 New Revision: 196338 URL: http://svn.freebsd.org/changeset/base/196338 Log: MFC 196337: Document the newly added SVNCMDARGS, SVNROOT, and SVNBRANCH variables. Approved by: re (kib) Modified: stable/8/share/man/man7/ (props changed) stable/8/share/man/man7/release.7 Modified: stable/8/share/man/man7/release.7 ============================================================================== --- stable/8/share/man/man7/release.7 Mon Aug 17 17:09:14 2009 (r196337) +++ stable/8/share/man/man7/release.7 Mon Aug 17 17:13:17 2009 (r196338) @@ -390,6 +390,35 @@ of the CVS tree .It Va SEPARATE_LIVEFS Store the live file system on its own CD-ROM image rather than placing it on the first disc. +.It Va SVNCMDARGS +Additional arguments for svn +.Ic checkout +and +.Ic switch +commands. +.It Va SVNROOT +The location of the FreeBSD SVN source repository. +If this variable is set, +then the source tree will be extracted using Subversion rather than +CVS. +.It Va SVNBRANCH +The branch to check out from a SVN source repository. +It is specified as a path such as +.Pa head +or +.Pa stable/7 . +If this variable is not set, +then the branch that corresponds to the current value of +.Va RELEASETAG +will be used. +If neither +.Va SVNBRANCH +nor +.Va RELEASETAG +are set, +then the +.Pa head +branch will be used. .It Va TARGET_ARCH The target machine processor architecture. This is analogous to the From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 17:31:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E77106564A; Mon, 17 Aug 2009 17:31:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21D8E8FC55; Mon, 17 Aug 2009 17:31:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HHVhSk085279; Mon, 17 Aug 2009 17:31:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HHVg1h085276; Mon, 17 Aug 2009 17:31:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171731.n7HHVg1h085276@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 17:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196339 - stable/7/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 17:31:43 -0000 Author: jhb Date: Mon Aug 17 17:31:42 2009 New Revision: 196339 URL: http://svn.freebsd.org/changeset/base/196339 Log: MFC 196147: Fix references to the kernel distributions to use the correct names (uppercase). Modified: stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/sysinstall/install.c stable/7/usr.sbin/sysinstall/sysinstall.8 Modified: stable/7/usr.sbin/sysinstall/install.c ============================================================================== --- stable/7/usr.sbin/sysinstall/install.c Mon Aug 17 17:13:17 2009 (r196338) +++ stable/7/usr.sbin/sysinstall/install.c Mon Aug 17 17:31:42 2009 (r196339) @@ -903,7 +903,7 @@ installFixupKernel(dialogMenuItem *self, if (RunningAsInit) { /* * Install something as /boot/kernel. Prefer SMP - * over generic--this should handle the case where + * over GENERIC--this should handle the case where * both SMP and GENERIC are installed (otherwise we * select the one kernel that was installed). * Modified: stable/7/usr.sbin/sysinstall/sysinstall.8 ============================================================================== --- stable/7/usr.sbin/sysinstall/sysinstall.8 Mon Aug 17 17:13:17 2009 (r196338) +++ stable/7/usr.sbin/sysinstall/sysinstall.8 Mon Aug 17 17:31:42 2009 (r196339) @@ -411,9 +411,9 @@ Possible distribution values are: .Bl -tag -width indentxx .It Li base The base binary distribution. -.It Li generic +.It Li GENERIC The GENERIC kernel. -.It Li smp +.It Li SMP A kernel suitable for multiple processor systems. .It Li doc Miscellaneous documentation From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 18:02:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F47E106568C; Mon, 17 Aug 2009 18:02:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 130578FC43; Mon, 17 Aug 2009 18:02:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HI2kAK086023; Mon, 17 Aug 2009 18:02:46 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HI2kkN086020; Mon, 17 Aug 2009 18:02:46 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200908171802.n7HI2kkN086020@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 17 Aug 2009 18:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196340 - in stable/7/sys: . contrib/pf net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 18:02:47 -0000 Author: jkim Date: Mon Aug 17 18:02:46 2009 New Revision: 196340 URL: http://svn.freebsd.org/changeset/base/196340 Log: MFC: (partial) r196150 Always embed pointer to BPF JIT function in BPF descriptor to avoid inconsistency when opt_bpf.h is not included. Note: bpf_buffer.c and bpf_zerocopy.c do not exist on stable/7. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/net/bpf.c stable/7/sys/net/bpfdesc.h Modified: stable/7/sys/net/bpf.c ============================================================================== --- stable/7/sys/net/bpf.c Mon Aug 17 17:31:42 2009 (r196339) +++ stable/7/sys/net/bpf.c Mon Aug 17 18:02:46 2009 (r196340) @@ -1288,6 +1288,9 @@ void bpf_tap(struct bpf_if *bp, u_char *pkt, u_int pktlen) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int slen; int gottime; struct timeval tv; @@ -1298,8 +1301,9 @@ bpf_tap(struct bpf_if *bp, u_char *pkt, BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL) - slen = (*(d->bd_bfilter->func))(pkt, pktlen, pktlen); + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; + if (bf != NULL) + slen = (*(bf->func))(pkt, pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, pkt, pktlen, pktlen); @@ -1354,6 +1358,9 @@ void bpf_mtap(struct bpf_if *bp, struct mbuf *m) { struct bpf_d *d; +#ifdef BPF_JITTER + bpf_jit_filter *bf; +#endif u_int pktlen, slen; int gottime; struct timeval tv; @@ -1375,11 +1382,10 @@ bpf_mtap(struct bpf_if *bp, struct mbuf BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER + bf = bpf_jitter_enable != 0 ? d->bd_bfilter : NULL; /* XXX We cannot handle multiple mbufs. */ - if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL && - m->m_next == NULL) - slen = (*(d->bd_bfilter->func))(mtod(m, u_char *), - pktlen, pktlen); + if (bf != NULL && m->m_next == NULL) + slen = (*(bf->func))(mtod(m, u_char *), pktlen, pktlen); else #endif slen = bpf_filter(d->bd_rfilter, (u_char *)m, pktlen, 0); Modified: stable/7/sys/net/bpfdesc.h ============================================================================== --- stable/7/sys/net/bpfdesc.h Mon Aug 17 17:31:42 2009 (r196339) +++ stable/7/sys/net/bpfdesc.h Mon Aug 17 18:02:46 2009 (r196340) @@ -71,9 +71,7 @@ struct bpf_d { u_long bd_rtout; /* Read timeout in 'ticks' */ struct bpf_insn *bd_rfilter; /* read filter code */ struct bpf_insn *bd_wfilter; /* write filter code */ -#ifdef BPF_JITTER - bpf_jit_filter *bd_bfilter; /* binary filter code */ -#endif + void *bd_bfilter; /* binary filter code */ u_long bd_rcount; /* number of packets received */ u_long bd_dcount; /* number of packets dropped */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 18:11:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53DBE106568B; Mon, 17 Aug 2009 18:11:51 +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 2667E8FC59; Mon, 17 Aug 2009 18:11:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HIBooY086374; Mon, 17 Aug 2009 18:11:50 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HIBoOI086372; Mon, 17 Aug 2009 18:11:50 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200908171811.n7HIBoOI086372@svn.freebsd.org> From: Rick Macklem Date: Mon, 17 Aug 2009 18:11:50 +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: r196341 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/xenpci fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 18:11:51 -0000 Author: rmacklem Date: Mon Aug 17 18:11:50 2009 New Revision: 196341 URL: http://svn.freebsd.org/changeset/base/196341 Log: MFC r196332: Apply the same patch as r196205 for nfs_upgrade_lock() and nfs_downgrade_lock() to the experimental nfs client. Approved by: re (kensmith), kib (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/mfi/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/fs/nfsclient/nfs_clsubs.c Modified: stable/8/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 18:02:46 2009 (r196340) +++ stable/8/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 18:11:50 2009 (r196341) @@ -129,28 +129,25 @@ int ncl_upgrade_vnlock(struct vnode *vp) { int old_lock; - - if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Upgrade to exclusive lock, this might block */ - vn_lock(vp, LK_UPGRADE | LK_RETRY); - } else { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - } + + ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock"); + old_lock = VOP_ISLOCKED(vp); + if (old_lock != LK_EXCLUSIVE) { + KASSERT(old_lock == LK_SHARED, + ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock)); + /* Upgrade to exclusive lock, this might block */ + vn_lock(vp, LK_UPGRADE | LK_RETRY); } - return old_lock; + return (old_lock); } void ncl_downgrade_vnlock(struct vnode *vp, int old_lock) { if (old_lock != LK_EXCLUSIVE) { - if (old_lock == LK_SHARED) { - /* Downgrade from exclusive lock, this might block */ - vn_lock(vp, LK_DOWNGRADE); - } else { - VOP_UNLOCK(vp, 0); - } + KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock)); + /* Downgrade from exclusive lock. */ + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); } } From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 19:09:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CDC106568E; Mon, 17 Aug 2009 19:09:28 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6803A8FC55; Mon, 17 Aug 2009 19:09:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HJ9SL6087649; Mon, 17 Aug 2009 19:09:28 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HJ9SqX087647; Mon, 17 Aug 2009 19:09:28 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200908171909.n7HJ9SqX087647@svn.freebsd.org> From: Kip Macy Date: Mon, 17 Aug 2009 19:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196342 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 19:09:28 -0000 Author: kmacy Date: Mon Aug 17 19:09:28 2009 New Revision: 196342 URL: http://svn.freebsd.org/changeset/base/196342 Log: fix netboot issue by disabling flowtable lookups until initialization has been run Reviewed by: rwatson@ Approved by: re@ Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Aug 17 18:11:50 2009 (r196341) +++ head/sys/net/flowtable.c Mon Aug 17 19:09:28 2009 (r196342) @@ -203,6 +203,7 @@ static VNET_DEFINE(int, flowtable_udp_ex static VNET_DEFINE(int, flowtable_fin_wait_expire) = FIN_WAIT_IDLE; static VNET_DEFINE(int, flowtable_tcp_expire) = TCP_IDLE; static VNET_DEFINE(int, flowtable_nmbflows) = 4096; +static VNET_DEFINE(int, flowtable_ready) = 0; #define V_flowtable_enable VNET(flowtable_enable) #define V_flowtable_hits VNET(flowtable_hits) @@ -217,6 +218,7 @@ static VNET_DEFINE(int, flowtable_nmbflo #define V_flowtable_fin_wait_expire VNET(flowtable_fin_wait_expire) #define V_flowtable_tcp_expire VNET(flowtable_tcp_expire) #define V_flowtable_nmbflows VNET(flowtable_nmbflows) +#define V_flowtable_ready VNET(flowtable_ready) SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, @@ -345,7 +347,7 @@ ipv4_flow_lookup_hash_internal(struct mb struct udphdr *uh; struct sctphdr *sh; - if (V_flowtable_enable == 0) + if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) return (0); key[1] = key[0] = 0; @@ -799,6 +801,7 @@ flowtable_init(const void *unused __unus NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); + V_flowtable_ready = 1; } VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 19:10:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58174106568C; Mon, 17 Aug 2009 19:10:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 452F78FC62; Mon, 17 Aug 2009 19:10:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HJANWB087709; Mon, 17 Aug 2009 19:10:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HJANpD087708; Mon, 17 Aug 2009 19:10:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908171910.n7HJANpD087708@svn.freebsd.org> From: John Baldwin Date: Mon, 17 Aug 2009 19:10:23 +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: r196343 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/mfi dev/xen/xenpci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 19:10:23 -0000 Author: jhb Date: Mon Aug 17 19:10:23 2009 New Revision: 196343 URL: http://svn.freebsd.org/changeset/base/196343 Log: Propogate the mergeinfo for 196200 up to sys/. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/mfi/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 20:06:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6A57106568E; Mon, 17 Aug 2009 20:06:00 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3C298FC3F; Mon, 17 Aug 2009 20:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HK60Je089039; Mon, 17 Aug 2009 20:06:00 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HK60WZ089037; Mon, 17 Aug 2009 20:06:00 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200908172006.n7HK60WZ089037@svn.freebsd.org> From: Kip Macy Date: Mon, 17 Aug 2009 20:06:00 +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: r196344 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 20:06:02 -0000 Author: kmacy Date: Mon Aug 17 20:06:00 2009 New Revision: 196344 URL: http://svn.freebsd.org/changeset/base/196344 Log: fix netboot issue by disabling flowtable lookups until initialization has been run + mergeinfo garbage Reviewed by: rwatson@ Approved by: re@ Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/net/flowtable.c Modified: stable/8/sys/net/flowtable.c ============================================================================== --- stable/8/sys/net/flowtable.c Mon Aug 17 19:10:23 2009 (r196343) +++ stable/8/sys/net/flowtable.c Mon Aug 17 20:06:00 2009 (r196344) @@ -203,6 +203,7 @@ static VNET_DEFINE(int, flowtable_udp_ex static VNET_DEFINE(int, flowtable_fin_wait_expire) = FIN_WAIT_IDLE; static VNET_DEFINE(int, flowtable_tcp_expire) = TCP_IDLE; static VNET_DEFINE(int, flowtable_nmbflows) = 4096; +static VNET_DEFINE(int, flowtable_ready) = 0; #define V_flowtable_enable VNET(flowtable_enable) #define V_flowtable_hits VNET(flowtable_hits) @@ -217,6 +218,7 @@ static VNET_DEFINE(int, flowtable_nmbflo #define V_flowtable_fin_wait_expire VNET(flowtable_fin_wait_expire) #define V_flowtable_tcp_expire VNET(flowtable_tcp_expire) #define V_flowtable_nmbflows VNET(flowtable_nmbflows) +#define V_flowtable_ready VNET(flowtable_ready) SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, @@ -345,7 +347,7 @@ ipv4_flow_lookup_hash_internal(struct mb struct udphdr *uh; struct sctphdr *sh; - if (V_flowtable_enable == 0) + if ((V_flowtable_enable == 0) || (V_flowtable_ready == 0)) return (0); key[1] = key[0] = 0; @@ -799,6 +801,7 @@ flowtable_init(const void *unused __unus NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); + V_flowtable_ready = 1; } VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 21:19:51 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5442F10656C8; Mon, 17 Aug 2009 21:19:51 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl [87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8E2DD8FC59; Mon, 17 Aug 2009 21:19:50 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 2C7BE45DF4; Mon, 17 Aug 2009 23:19:49 +0200 (CEST) Received: from localhost (chello087206049004.chello.pl [87.206.49.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 030BF45CAC; Mon, 17 Aug 2009 23:19:43 +0200 (CEST) Date: Mon, 17 Aug 2009 23:19:46 +0200 From: Pawel Jakub Dawidek To: Sam Leffler Message-ID: <20090817211945.GC2298@garage.freebsd.pl> References: <200908170842.n7H8gYo5054777@svn.freebsd.org> <4A8978EC.101@errno.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zCKi3GIZzVBPywwA" Content-Disposition: inline In-Reply-To: <4A8978EC.101@errno.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196293 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 21:19:51 -0000 --zCKi3GIZzVBPywwA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 17, 2009 at 08:36:12AM -0700, Sam Leffler wrote: > Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Aug 17 08:42:34 2009 > >New Revision: 196293 > >URL: http://svn.freebsd.org/changeset/base/196293 > > > >Log: > > Because taskqueue_run() can drop tq_mutex, we need to check if the > > TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we=20 > > missed a > > wakeup. >=20 > So this would leave a task q thread running? [...] Sleeping infinitely to be precise. > [...] Can you describe the=20 > scenario that demonstrated this problem? Once I moved ZFS from taskq ported from OpenSolaris to wrapper around our taskqueue(9), the deadlock was easy to trigger (I experienced it by testing with fsstress). --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --zCKi3GIZzVBPywwA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKiclxForvXbEpPzQRAh0LAKCcS7z/9M9nZtLkDizI8IRWCoF08QCg5y2f 423irYfVn6XnBNHBemNhm10= =Vbc5 -----END PGP SIGNATURE----- --zCKi3GIZzVBPywwA-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 17 23:50:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67C75106568B; Mon, 17 Aug 2009 23:50:15 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57D808FC57; Mon, 17 Aug 2009 23:50:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HNoFRI097024; Mon, 17 Aug 2009 23:50:15 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HNoFa9097021; Mon, 17 Aug 2009 23:50:15 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200908172350.n7HNoFa9097021@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 17 Aug 2009 23:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196350 - vendor/tzdata/dist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 23:50:15 -0000 Author: edwin Date: Mon Aug 17 23:50:15 2009 New Revision: 196350 URL: http://svn.freebsd.org/changeset/base/196350 Log: Vendor import of tzdata2009l: - Egypt will go to Wintertime on 21 August 2009 - Heads up for a possible DST in Samoa Obtained from: ftp://elsie.nci.nih.gov/pub/ Modified: vendor/tzdata/dist/africa vendor/tzdata/dist/australasia Modified: vendor/tzdata/dist/africa ============================================================================== --- vendor/tzdata/dist/africa Mon Aug 17 21:23:53 2009 (r196349) +++ vendor/tzdata/dist/africa Mon Aug 17 23:50:15 2009 (r196350) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: vendor/tzdata/dist/australasia
==============================================================================
--- vendor/tzdata/dist/australasia	Mon Aug 17 21:23:53 2009	(r196349)
+++ vendor/tzdata/dist/australasia	Mon Aug 17 23:50:15 2009	(r196350)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-all@FreeBSD.ORG  Mon Aug 17 23:50:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 516BF1065692;
	Mon, 17 Aug 2009 23:50:58 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 28EF88FC51;
	Mon, 17 Aug 2009 23:50:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7HNow52097073;
	Mon, 17 Aug 2009 23:50:58 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7HNow8P097072;
	Mon, 17 Aug 2009 23:50:58 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908172350.n7HNow8P097072@svn.freebsd.org>
From: Edwin Groothuis 
Date: Mon, 17 Aug 2009 23:50:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196351 - vendor/tzdata/tzdata2009l
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 17 Aug 2009 23:50:58 -0000

Author: edwin
Date: Mon Aug 17 23:50:57 2009
New Revision: 196351
URL: http://svn.freebsd.org/changeset/base/196351

Log:
  Tag of tzdata2009l

Added:
  vendor/tzdata/tzdata2009l/
     - copied from r196350, vendor/tzdata/dist/

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 08:46:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DB86106568E;
	Tue, 18 Aug 2009 08:46:55 +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 51CB98FC64;
	Tue, 18 Aug 2009 08:46:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7I8ktE1009139;
	Tue, 18 Aug 2009 08:46:55 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7I8kt18009137;
	Tue, 18 Aug 2009 08:46:55 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200908180846.n7I8kt18009137@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 18 Aug 2009 08:46:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196352 - in head/sys: cam dev/iscsi/initiator dev/ppbus
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 08:46:55 -0000

Author: mav
Date: Tue Aug 18 08:46:54 2009
New Revision: 196352
URL: http://svn.freebsd.org/changeset/base/196352

Log:
  Fix iSCSI initiator and vpo driver operation, broken by CAM changes.
  
  Reviewed by:	scottl, Danny Braniss
  Approved by:	re (rwatson)

Modified:
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_xpt.c
  head/sys/dev/iscsi/initiator/isc_cam.c
  head/sys/dev/ppbus/vpo.c

Modified: head/sys/cam/cam_ccb.h
==============================================================================
--- head/sys/cam/cam_ccb.h	Mon Aug 17 23:50:57 2009	(r196351)
+++ head/sys/cam/cam_ccb.h	Tue Aug 18 08:46:54 2009	(r196352)
@@ -243,6 +243,7 @@ typedef enum {
 	XPORT_ATA,	/* AT Attachment */
 	XPORT_SAS,	/* Serial Attached SCSI */
 	XPORT_SATA,	/* Serial AT Attachment */
+	XPORT_ISCSI,	/* iSCSI */
 } cam_xport;
 
 #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1)

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Mon Aug 17 23:50:57 2009	(r196351)
+++ head/sys/cam/cam_xpt.c	Tue Aug 18 08:46:54 2009	(r196352)
@@ -3803,6 +3803,8 @@ xpt_bus_register(struct cam_sim *sim, de
 		case XPORT_SAS:
 		case XPORT_FC:
 		case XPORT_USB:
+		case XPORT_ISCSI:
+		case XPORT_PPB:
 			new_bus->xport = scsi_get_xport();
 			break;
 		case XPORT_ATA:

Modified: head/sys/dev/iscsi/initiator/isc_cam.c
==============================================================================
--- head/sys/dev/iscsi/initiator/isc_cam.c	Mon Aug 17 23:50:57 2009	(r196351)
+++ head/sys/dev/iscsi/initiator/isc_cam.c	Tue Aug 18 08:46:54 2009	(r196352)
@@ -190,6 +190,8 @@ _inq(struct cam_sim *sim, union ccb *ccb
      strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
      strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
      cpi->unit_number = cam_sim_unit(sim);
+     cpi->transport = XPORT_ISCSI;
+     cpi->transport_version = 0;
      cpi->ccb_h.status = CAM_REQ_CMP;
 }
 

Modified: head/sys/dev/ppbus/vpo.c
==============================================================================
--- head/sys/dev/ppbus/vpo.c	Mon Aug 17 23:50:57 2009	(r196351)
+++ head/sys/dev/ppbus/vpo.c	Tue Aug 18 08:46:54 2009	(r196352)
@@ -427,6 +427,8 @@ vpo_action(struct cam_sim *sim, union cc
 		strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
 		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
+		cpi->transport = XPORT_PPB;
+		cpi->transport_version = 0;
 
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 09:27:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9DB54106568D;
	Tue, 18 Aug 2009 09:27:17 +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 8B7858FC59;
	Tue, 18 Aug 2009 09:27:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7I9RH7k010245;
	Tue, 18 Aug 2009 09:27:17 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7I9RHOn010243;
	Tue, 18 Aug 2009 09:27:17 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200908180927.n7I9RHOn010243@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 18 Aug 2009 09:27:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196353 - head/sys/cam/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 09:27:17 -0000

Author: mav
Date: Tue Aug 18 09:27:17 2009
New Revision: 196353
URL: http://svn.freebsd.org/changeset/base/196353

Log:
  Fix copy/paste bug, that requests data read during ATA device probe sequence
  for ATA_SETFEATURES/ATA_SF_SETXFER command which by definition transfers no
  data. Most of controllers are irrelevant to this bug, but some nVidia's
  doesn't.
  
  Tested on:	current@
  Approved by:	re (kib)

Modified:
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Tue Aug 18 08:46:54 2009	(r196352)
+++ head/sys/cam/ata/ata_xpt.c	Tue Aug 18 09:27:17 2009	(r196353)
@@ -370,10 +370,10 @@ probestart(struct cam_periph *periph, un
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,
-		      /*flags*/CAM_DIR_IN,
-		      MSG_SIMPLE_Q_TAG,
-		      /*data_ptr*/(u_int8_t *)ident_buf,
-		      /*dxfer_len*/sizeof(struct ata_params),
+		      /*flags*/CAM_DIR_NONE,
+		      0,
+		      /*data_ptr*/NULL,
+		      /*dxfer_len*/0,
 		      30 * 1000);
 		ata_36bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
 		    ata_max_mode(ident_buf, ATA_UDMA6, ATA_UDMA6));

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 09:31:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1D1C7106568B;
	Tue, 18 Aug 2009 09:31:01 +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 082C58FC43;
	Tue, 18 Aug 2009 09:31:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7I9V0EH010415;
	Tue, 18 Aug 2009 09:31:00 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7I9V0JN010410;
	Tue, 18 Aug 2009 09:31:00 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200908180931.n7I9V0JN010410@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 18 Aug 2009 09:31:00 +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: r196354 - in stable/8/sys: . amd64/include/xen cam
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/iscsi/initiator dev/ppbus dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 09:31:01 -0000

Author: mav
Date: Tue Aug 18 09:31:00 2009
New Revision: 196354
URL: http://svn.freebsd.org/changeset/base/196354

Log:
  MFC r196352:
  Fix iSCSI initiator and vpo driver operation, broken by CAM changes.
  
  Reviewed by:	scottl, Danny Braniss
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/cam_ccb.h
  stable/8/sys/cam/cam_xpt.c
  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/iscsi/initiator/isc_cam.c
  stable/8/sys/dev/ppbus/vpo.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/cam_ccb.h
==============================================================================
--- stable/8/sys/cam/cam_ccb.h	Tue Aug 18 09:27:17 2009	(r196353)
+++ stable/8/sys/cam/cam_ccb.h	Tue Aug 18 09:31:00 2009	(r196354)
@@ -243,6 +243,7 @@ typedef enum {
 	XPORT_ATA,	/* AT Attachment */
 	XPORT_SAS,	/* Serial Attached SCSI */
 	XPORT_SATA,	/* Serial AT Attachment */
+	XPORT_ISCSI,	/* iSCSI */
 } cam_xport;
 
 #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1)

Modified: stable/8/sys/cam/cam_xpt.c
==============================================================================
--- stable/8/sys/cam/cam_xpt.c	Tue Aug 18 09:27:17 2009	(r196353)
+++ stable/8/sys/cam/cam_xpt.c	Tue Aug 18 09:31:00 2009	(r196354)
@@ -3803,6 +3803,8 @@ xpt_bus_register(struct cam_sim *sim, de
 		case XPORT_SAS:
 		case XPORT_FC:
 		case XPORT_USB:
+		case XPORT_ISCSI:
+		case XPORT_PPB:
 			new_bus->xport = scsi_get_xport();
 			break;
 		case XPORT_ATA:

Modified: stable/8/sys/dev/iscsi/initiator/isc_cam.c
==============================================================================
--- stable/8/sys/dev/iscsi/initiator/isc_cam.c	Tue Aug 18 09:27:17 2009	(r196353)
+++ stable/8/sys/dev/iscsi/initiator/isc_cam.c	Tue Aug 18 09:31:00 2009	(r196354)
@@ -190,6 +190,8 @@ _inq(struct cam_sim *sim, union ccb *ccb
      strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
      strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
      cpi->unit_number = cam_sim_unit(sim);
+     cpi->transport = XPORT_ISCSI;
+     cpi->transport_version = 0;
      cpi->ccb_h.status = CAM_REQ_CMP;
 }
 

Modified: stable/8/sys/dev/ppbus/vpo.c
==============================================================================
--- stable/8/sys/dev/ppbus/vpo.c	Tue Aug 18 09:27:17 2009	(r196353)
+++ stable/8/sys/dev/ppbus/vpo.c	Tue Aug 18 09:31:00 2009	(r196354)
@@ -427,6 +427,8 @@ vpo_action(struct cam_sim *sim, union cc
 		strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
 		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
+		cpi->transport = XPORT_PPB;
+		cpi->transport_version = 0;
 
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 09:36:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6BE99106568E;
	Tue, 18 Aug 2009 09:36:25 +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 57B448FC45;
	Tue, 18 Aug 2009 09:36:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7I9aPtD010602;
	Tue, 18 Aug 2009 09:36:25 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7I9aPcA010600;
	Tue, 18 Aug 2009 09:36:25 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200908180936.n7I9aPcA010600@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 18 Aug 2009 09:36:25 +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: r196355 - in stable/8/sys: . amd64/include/xen cam/ata
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 09:36:25 -0000

Author: mav
Date: Tue Aug 18 09:36:25 2009
New Revision: 196355
URL: http://svn.freebsd.org/changeset/base/196355

Log:
  Fix copy/paste bug, that requests data read during ATA device probe sequence
  for ATA_SETFEATURES/ATA_SF_SETXFER command which by definition transfers no
  data. Most of controllers are irrelevant to this bug, but some nVidia's
  doesn't.
  
  Tested on:      current@
  Approved by:    re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/ata/ata_xpt.c
  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/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/ata/ata_xpt.c
==============================================================================
--- stable/8/sys/cam/ata/ata_xpt.c	Tue Aug 18 09:31:00 2009	(r196354)
+++ stable/8/sys/cam/ata/ata_xpt.c	Tue Aug 18 09:36:25 2009	(r196355)
@@ -370,10 +370,10 @@ probestart(struct cam_periph *periph, un
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,
-		      /*flags*/CAM_DIR_IN,
-		      MSG_SIMPLE_Q_TAG,
-		      /*data_ptr*/(u_int8_t *)ident_buf,
-		      /*dxfer_len*/sizeof(struct ata_params),
+		      /*flags*/CAM_DIR_NONE,
+		      0,
+		      /*data_ptr*/NULL,
+		      /*dxfer_len*/0,
 		      30 * 1000);
 		ata_36bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
 		    ata_max_mode(ident_buf, ATA_UDMA6, ATA_UDMA6));

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 12:24:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A5A81065693;
	Tue, 18 Aug 2009 12:24:27 +0000 (UTC)
	(envelope-from trhodes@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B0668FC45;
	Tue, 18 Aug 2009 12:24:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7ICORc5017318;
	Tue, 18 Aug 2009 12:24:27 GMT (envelope-from trhodes@svn.freebsd.org)
Received: (from trhodes@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7ICORhF017316;
	Tue, 18 Aug 2009 12:24:27 GMT (envelope-from trhodes@svn.freebsd.org)
Message-Id: <200908181224.n7ICORhF017316@svn.freebsd.org>
From: Tom Rhodes 
Date: Tue, 18 Aug 2009 12:24:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196356 - head/share/man/man7
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 12:24:27 -0000

Author: trhodes
Date: Tue Aug 18 12:24:27 2009
New Revision: 196356
URL: http://svn.freebsd.org/changeset/base/196356

Log:
  Document MAKE_DVD and xref svn in ports.
  
  Approved by:	re@ (kib)

Modified:
  head/share/man/man7/release.7

Modified: head/share/man/man7/release.7
==============================================================================
--- head/share/man/man7/release.7	Tue Aug 18 09:36:25 2009	(r196355)
+++ head/share/man/man7/release.7	Tue Aug 18 12:24:27 2009	(r196356)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2006
+.Dd August 17, 2009
 .Dt RELEASE 7
 .Os
 .Sh NAME
@@ -332,6 +332,10 @@ patch file.
 A script that will be run in the
 .Xr chroot 8
 environment immediately after any local patches are applied.
+.It Va MAKE_DVD
+If defined, build a bootable ISO DVD image in the CD-ROM
+stage directory.
+This option may not be available for all architectures.
 .It Va MAKE_ISOS
 If defined, bootable ISO CD-ROM images will be created from the
 contents of the CD-ROM stage directory.
@@ -503,6 +507,7 @@ make release CHROOTDIR=/local3/release B
 .Xr install 1 ,
 .Xr make 1 ,
 .Xr patch 1 ,
+.Xr svn 1 Pq Pa ports/devel/subversion-freebsd ,
 .Xr uname 1 ,
 .Xr md 4 ,
 .Xr make.conf 5 ,
@@ -540,7 +545,7 @@ effort was spent getting
 into a shape where it could at least automate most of the tediousness
 of building a release in a sterile environment.
 .Pp
-With its almost 1000 revisions spread over multiple branches, the
+At near 1000 revisions spread over multiple branches, the
 .Xr cvs 1
 log of
 .Pa src/release/Makefile

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 13:51:52 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 020D0106568B;
	Tue, 18 Aug 2009 13:51:52 +0000 (UTC)
	(envelope-from trhodes@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E5F3C8FC43;
	Tue, 18 Aug 2009 13:51:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IDppxQ019048;
	Tue, 18 Aug 2009 13:51:51 GMT (envelope-from trhodes@svn.freebsd.org)
Received: (from trhodes@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IDppQX019046;
	Tue, 18 Aug 2009 13:51:51 GMT (envelope-from trhodes@svn.freebsd.org)
Message-Id: <200908181351.n7IDppQX019046@svn.freebsd.org>
From: Tom Rhodes 
Date: Tue, 18 Aug 2009 13:51:51 +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: r196357 - stable/8/share/man/man7
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 13:51:52 -0000

Author: trhodes
Date: Tue Aug 18 13:51:51 2009
New Revision: 196357
URL: http://svn.freebsd.org/changeset/base/196357

Log:
  MFC rev 196356:
  
    Document MAKE_DVD and xref svn in ports.
  
    Approved by:	re@ (kib)

Modified:
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man7/release.7

Modified: stable/8/share/man/man7/release.7
==============================================================================
--- stable/8/share/man/man7/release.7	Tue Aug 18 12:24:27 2009	(r196356)
+++ stable/8/share/man/man7/release.7	Tue Aug 18 13:51:51 2009	(r196357)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2006
+.Dd August 17, 2009
 .Dt RELEASE 7
 .Os
 .Sh NAME
@@ -332,6 +332,10 @@ patch file.
 A script that will be run in the
 .Xr chroot 8
 environment immediately after any local patches are applied.
+.It Va MAKE_DVD
+If defined, build a bootable ISO DVD image in the CD-ROM
+stage directory.
+This option may not be available for all architectures.
 .It Va MAKE_ISOS
 If defined, bootable ISO CD-ROM images will be created from the
 contents of the CD-ROM stage directory.
@@ -503,6 +507,7 @@ make release CHROOTDIR=/local3/release B
 .Xr install 1 ,
 .Xr make 1 ,
 .Xr patch 1 ,
+.Xr svn 1 Pq Pa ports/devel/subversion-freebsd ,
 .Xr uname 1 ,
 .Xr md 4 ,
 .Xr make.conf 5 ,
@@ -540,7 +545,7 @@ effort was spent getting
 into a shape where it could at least automate most of the tediousness
 of building a release in a sterile environment.
 .Pp
-With its almost 1000 revisions spread over multiple branches, the
+At near 1000 revisions spread over multiple branches, the
 .Xr cvs 1
 log of
 .Pa src/release/Makefile

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 13:55:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BADC6106568F;
	Tue, 18 Aug 2009 13:55:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A91348FC41;
	Tue, 18 Aug 2009 13:55:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IDtmc7019169;
	Tue, 18 Aug 2009 13:55:48 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IDtmqT019165;
	Tue, 18 Aug 2009 13:55:48 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200908181355.n7IDtmqT019165@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Tue, 18 Aug 2009 13:55:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 13:55:48 -0000

Author: pjd
Date: Tue Aug 18 13:55:48 2009
New Revision: 196358
URL: http://svn.freebsd.org/changeset/base/196358

Log:
  Remove unused taskqueue_find() function.
  
  Reviewed by:	dfr
  Approved by:	re (kib)

Modified:
  head/share/man/man9/taskqueue.9
  head/sys/kern/subr_taskqueue.c
  head/sys/sys/taskqueue.h

Modified: head/share/man/man9/taskqueue.9
==============================================================================
--- head/share/man/man9/taskqueue.9	Tue Aug 18 13:51:51 2009	(r196357)
+++ head/share/man/man9/taskqueue.9	Tue Aug 18 13:55:48 2009	(r196358)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 17, 2009
+.Dd August 18, 2009
 .Dt TASKQUEUE 9
 .Os
 .Sh NAME
@@ -59,8 +59,6 @@ struct task {
 .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
 .Ft void
 .Fn taskqueue_free "struct taskqueue *queue"
-.Ft struct taskqueue *
-.Fn taskqueue_find "const char *name"
 .Ft int
 .Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
 .Ft int
@@ -115,16 +113,10 @@ should be used in place of
 .Pp
 The function
 .Fn taskqueue_free
-should be used to remove the queue from the global list of queues
-and free the memory used by the queue.
+should be used to free the memory used by the queue.
 Any tasks that are on the queue will be executed at this time after
 which the thread servicing the queue will be signaled that it should exit.
 .Pp
-The system maintains a list of all queues which can be searched using
-.Fn taskqueue_find .
-The first queue whose name matches is returned, otherwise
-.Dv NULL .
-.Pp
 To add a task to the list of tasks queued on a taskqueue, call
 .Fn taskqueue_enqueue
 with pointers to the queue and task.

Modified: head/sys/kern/subr_taskqueue.c
==============================================================================
--- head/sys/kern/subr_taskqueue.c	Tue Aug 18 13:51:51 2009	(r196357)
+++ head/sys/kern/subr_taskqueue.c	Tue Aug 18 13:55:48 2009	(r196358)
@@ -45,11 +45,8 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
 static void	*taskqueue_giant_ih;
 static void	*taskqueue_ih;
-static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues;
-static struct mtx taskqueue_queues_mutex;
 
 struct taskqueue {
-	STAILQ_ENTRY(taskqueue)	tq_link;
 	STAILQ_HEAD(, task)	tq_queue;
 	const char		*tq_name;
 	taskqueue_enqueue_fn	tq_enqueue;
@@ -84,8 +81,6 @@ TQ_UNLOCK(struct taskqueue *tq)
 		mtx_unlock(&tq->tq_mutex);
 }
 
-static void	init_taskqueue_list(void *data);
-
 static __inline int
 TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm,
     int t)
@@ -95,16 +90,6 @@ TQ_SLEEP(struct taskqueue *tq, void *p, 
 	return (msleep(p, m, pri, wm, t));
 }
 
-static void
-init_taskqueue_list(void *data __unused)
-{
-
-	mtx_init(&taskqueue_queues_mutex, "taskqueue list", NULL, MTX_DEF);
-	STAILQ_INIT(&taskqueue_queues);
-}
-SYSINIT(taskqueue_list, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_taskqueue_list,
-    NULL);
-
 static struct taskqueue *
 _taskqueue_create(const char *name, int mflags,
 		 taskqueue_enqueue_fn enqueue, void *context,
@@ -124,10 +109,6 @@ _taskqueue_create(const char *name, int 
 	queue->tq_flags |= TQ_FLAGS_ACTIVE;
 	mtx_init(&queue->tq_mutex, mtxname, NULL, mtxflags);
 
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_INSERT_TAIL(&taskqueue_queues, queue, tq_link);
-	mtx_unlock(&taskqueue_queues_mutex);
-
 	return queue;
 }
 
@@ -156,10 +137,6 @@ void
 taskqueue_free(struct taskqueue *queue)
 {
 
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_REMOVE(&taskqueue_queues, queue, taskqueue, tq_link);
-	mtx_unlock(&taskqueue_queues_mutex);
-
 	TQ_LOCK(queue);
 	queue->tq_flags &= ~TQ_FLAGS_ACTIVE;
 	taskqueue_run(queue);
@@ -169,26 +146,6 @@ taskqueue_free(struct taskqueue *queue)
 	free(queue, M_TASKQUEUE);
 }
 
-/*
- * Returns with the taskqueue locked.
- */
-struct taskqueue *
-taskqueue_find(const char *name)
-{
-	struct taskqueue *queue;
-
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_FOREACH(queue, &taskqueue_queues, tq_link) {
-		if (strcmp(queue->tq_name, name) == 0) {
-			TQ_LOCK(queue);
-			mtx_unlock(&taskqueue_queues_mutex);
-			return queue;
-		}
-	}
-	mtx_unlock(&taskqueue_queues_mutex);
-	return NULL;
-}
-
 int
 taskqueue_enqueue(struct taskqueue *queue, struct task *task)
 {

Modified: head/sys/sys/taskqueue.h
==============================================================================
--- head/sys/sys/taskqueue.h	Tue Aug 18 13:51:51 2009	(r196357)
+++ head/sys/sys/taskqueue.h	Tue Aug 18 13:55:48 2009	(r196358)
@@ -48,7 +48,6 @@ struct thread;
  */
 typedef void (*taskqueue_enqueue_fn)(void *context);
 
-struct proc;
 struct taskqueue *taskqueue_create(const char *name, int mflags,
 				    taskqueue_enqueue_fn enqueue,
 				    void *context);
@@ -56,7 +55,6 @@ int	taskqueue_start_threads(struct taskq
 				const char *name, ...) __printflike(4, 5);
 int	taskqueue_enqueue(struct taskqueue *queue, struct task *task);
 void	taskqueue_drain(struct taskqueue *queue, struct task *task);
-struct taskqueue *taskqueue_find(const char *name);
 void	taskqueue_free(struct taskqueue *queue);
 void	taskqueue_run(struct taskqueue *queue);
 void	taskqueue_block(struct taskqueue *queue);

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 14:00:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 365F5106568C;
	Tue, 18 Aug 2009 14:00:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 239648FC57;
	Tue, 18 Aug 2009 14:00:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IE0Qg2019371;
	Tue, 18 Aug 2009 14:00:26 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IE0Qlj019367;
	Tue, 18 Aug 2009 14:00:26 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200908181400.n7IE0Qlj019367@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Tue, 18 Aug 2009 14:00:25 +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: r196359 - in stable/8: share/man/man9 sys
	sys/amd64/include/xen sys/cddl/contrib/opensolaris
	sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci
	sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 14:00:26 -0000

Author: pjd
Date: Tue Aug 18 14:00:25 2009
New Revision: 196359
URL: http://svn.freebsd.org/changeset/base/196359

Log:
  MFC r196358:
  
  Remove unused taskqueue_find() function.
  
  Reviewed by:	dfr
  Approved by:	re (kib)

Modified:
  stable/8/share/man/man9/   (props changed)
  stable/8/share/man/man9/taskqueue.9
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/kern/subr_taskqueue.c
  stable/8/sys/sys/taskqueue.h

Modified: stable/8/share/man/man9/taskqueue.9
==============================================================================
--- stable/8/share/man/man9/taskqueue.9	Tue Aug 18 13:55:48 2009	(r196358)
+++ stable/8/share/man/man9/taskqueue.9	Tue Aug 18 14:00:25 2009	(r196359)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 17, 2009
+.Dd August 18, 2009
 .Dt TASKQUEUE 9
 .Os
 .Sh NAME
@@ -59,8 +59,6 @@ struct task {
 .Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
 .Ft void
 .Fn taskqueue_free "struct taskqueue *queue"
-.Ft struct taskqueue *
-.Fn taskqueue_find "const char *name"
 .Ft int
 .Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
 .Ft int
@@ -115,16 +113,10 @@ should be used in place of
 .Pp
 The function
 .Fn taskqueue_free
-should be used to remove the queue from the global list of queues
-and free the memory used by the queue.
+should be used to free the memory used by the queue.
 Any tasks that are on the queue will be executed at this time after
 which the thread servicing the queue will be signaled that it should exit.
 .Pp
-The system maintains a list of all queues which can be searched using
-.Fn taskqueue_find .
-The first queue whose name matches is returned, otherwise
-.Dv NULL .
-.Pp
 To add a task to the list of tasks queued on a taskqueue, call
 .Fn taskqueue_enqueue
 with pointers to the queue and task.

Modified: stable/8/sys/kern/subr_taskqueue.c
==============================================================================
--- stable/8/sys/kern/subr_taskqueue.c	Tue Aug 18 13:55:48 2009	(r196358)
+++ stable/8/sys/kern/subr_taskqueue.c	Tue Aug 18 14:00:25 2009	(r196359)
@@ -45,11 +45,8 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
 static void	*taskqueue_giant_ih;
 static void	*taskqueue_ih;
-static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues;
-static struct mtx taskqueue_queues_mutex;
 
 struct taskqueue {
-	STAILQ_ENTRY(taskqueue)	tq_link;
 	STAILQ_HEAD(, task)	tq_queue;
 	const char		*tq_name;
 	taskqueue_enqueue_fn	tq_enqueue;
@@ -84,8 +81,6 @@ TQ_UNLOCK(struct taskqueue *tq)
 		mtx_unlock(&tq->tq_mutex);
 }
 
-static void	init_taskqueue_list(void *data);
-
 static __inline int
 TQ_SLEEP(struct taskqueue *tq, void *p, struct mtx *m, int pri, const char *wm,
     int t)
@@ -95,16 +90,6 @@ TQ_SLEEP(struct taskqueue *tq, void *p, 
 	return (msleep(p, m, pri, wm, t));
 }
 
-static void
-init_taskqueue_list(void *data __unused)
-{
-
-	mtx_init(&taskqueue_queues_mutex, "taskqueue list", NULL, MTX_DEF);
-	STAILQ_INIT(&taskqueue_queues);
-}
-SYSINIT(taskqueue_list, SI_SUB_INTRINSIC, SI_ORDER_ANY, init_taskqueue_list,
-    NULL);
-
 static struct taskqueue *
 _taskqueue_create(const char *name, int mflags,
 		 taskqueue_enqueue_fn enqueue, void *context,
@@ -124,10 +109,6 @@ _taskqueue_create(const char *name, int 
 	queue->tq_flags |= TQ_FLAGS_ACTIVE;
 	mtx_init(&queue->tq_mutex, mtxname, NULL, mtxflags);
 
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_INSERT_TAIL(&taskqueue_queues, queue, tq_link);
-	mtx_unlock(&taskqueue_queues_mutex);
-
 	return queue;
 }
 
@@ -156,10 +137,6 @@ void
 taskqueue_free(struct taskqueue *queue)
 {
 
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_REMOVE(&taskqueue_queues, queue, taskqueue, tq_link);
-	mtx_unlock(&taskqueue_queues_mutex);
-
 	TQ_LOCK(queue);
 	queue->tq_flags &= ~TQ_FLAGS_ACTIVE;
 	taskqueue_run(queue);
@@ -169,26 +146,6 @@ taskqueue_free(struct taskqueue *queue)
 	free(queue, M_TASKQUEUE);
 }
 
-/*
- * Returns with the taskqueue locked.
- */
-struct taskqueue *
-taskqueue_find(const char *name)
-{
-	struct taskqueue *queue;
-
-	mtx_lock(&taskqueue_queues_mutex);
-	STAILQ_FOREACH(queue, &taskqueue_queues, tq_link) {
-		if (strcmp(queue->tq_name, name) == 0) {
-			TQ_LOCK(queue);
-			mtx_unlock(&taskqueue_queues_mutex);
-			return queue;
-		}
-	}
-	mtx_unlock(&taskqueue_queues_mutex);
-	return NULL;
-}
-
 int
 taskqueue_enqueue(struct taskqueue *queue, struct task *task)
 {

Modified: stable/8/sys/sys/taskqueue.h
==============================================================================
--- stable/8/sys/sys/taskqueue.h	Tue Aug 18 13:55:48 2009	(r196358)
+++ stable/8/sys/sys/taskqueue.h	Tue Aug 18 14:00:25 2009	(r196359)
@@ -48,7 +48,6 @@ struct thread;
  */
 typedef void (*taskqueue_enqueue_fn)(void *context);
 
-struct proc;
 struct taskqueue *taskqueue_create(const char *name, int mflags,
 				    taskqueue_enqueue_fn enqueue,
 				    void *context);
@@ -56,7 +55,6 @@ int	taskqueue_start_threads(struct taskq
 				const char *name, ...) __printflike(4, 5);
 int	taskqueue_enqueue(struct taskqueue *queue, struct task *task);
 void	taskqueue_drain(struct taskqueue *queue, struct task *task);
-struct taskqueue *taskqueue_find(const char *name);
 void	taskqueue_free(struct taskqueue *queue);
 void	taskqueue_run(struct taskqueue *queue);
 void	taskqueue_block(struct taskqueue *queue);

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 15:21:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FAE0106568B;
	Tue, 18 Aug 2009 15:21:12 +0000 (UTC)
	(envelope-from pjd@garage.freebsd.pl)
Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl
	[87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 051048FC41;
	Tue, 18 Aug 2009 15:21:11 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id 6845145CDD; Tue, 18 Aug 2009 17:21:09 +0200 (CEST)
Received: from localhost (pjd-w.wheel.pl [10.0.1.1])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id B5BCF45684;
	Tue, 18 Aug 2009 17:21:04 +0200 (CEST)
Date: Tue, 18 Aug 2009 17:21:07 +0200
From: Pawel Jakub Dawidek 
To: Scott Long 
Message-ID: <20090818152107.GE1738@garage.freebsd.pl>
References: <200908132318.n7DNIjvO015601@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="kA1LkgxZ0NN7Mz3A"
Content-Disposition: inline
In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 8.0-CURRENT i386
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 
	autolearn=ham version=3.0.4
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi
	usr.sbin usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 15:21:12 -0000


--kA1LkgxZ0NN7Mz3A
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Aug 13, 2009 at 11:18:45PM +0000, Scott Long wrote:
> Author: scottl
> Date: Thu Aug 13 23:18:45 2009
> New Revision: 196200
> URL: http://svn.freebsd.org/changeset/base/196200
[...]
> --- head/etc/mtree/BSD.include.dist	Thu Aug 13 19:47:13 2009	(r196199)
> +++ head/etc/mtree/BSD.include.dist	Thu Aug 13 23:18:45 2009	(r196200)
> @@ -104,6 +104,8 @@
>          ..
>          lmc
>          ..
> +	mfi
> +	..

You should use spaces, not tab here.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--kA1LkgxZ0NN7Mz3A
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKisbjForvXbEpPzQRAqPaAJwKdm0ffuJ1oiOQk1X31GlqPpJxRQCg6suv
+bdY90Nhwc6GxQkmuprW6Cw=
=+O5E
-----END PGP SIGNATURE-----

--kA1LkgxZ0NN7Mz3A--

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 15:26:12 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E200106568B;
	Tue, 18 Aug 2009 15:26:12 +0000 (UTC) (envelope-from sam@errno.com)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id 56E628FC45;
	Tue, 18 Aug 2009 15:26:12 +0000 (UTC)
Received: from ice.local ([10.0.0.115]) (authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n7IFQBjK019763
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 18 Aug 2009 08:26:11 -0700 (PDT) (envelope-from sam@errno.com)
Message-ID: <4A8AC814.2070804@errno.com>
Date: Tue, 18 Aug 2009 08:26:12 -0700
From: Sam Leffler 
User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605)
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
In-Reply-To: <200908181355.n7IDtmqT019165@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC--Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 15:26:12 -0000

Pawel Jakub Dawidek wrote:
> Author: pjd
> Date: Tue Aug 18 13:55:48 2009
> New Revision: 196358
> URL: http://svn.freebsd.org/changeset/base/196358
> 
> Log:
>   Remove unused taskqueue_find() function.
>   
>   Reviewed by:	dfr
>   Approved by:	re (kib)

I don't understand why this should be removed (let alone during a code 
freeze).  I can think of several uses for this function including a ddb 
cmd that takes a taskq name and dumps it's contents.  The overhead of 
maintaining the global list appears minimal.

	Sam

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:13:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E30D51065692;
	Tue, 18 Aug 2009 16:13:59 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CBA338FC55;
	Tue, 18 Aug 2009 16:13:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGDxLx022014;
	Tue, 18 Aug 2009 16:13:59 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGDxSQ021986;
	Tue, 18 Aug 2009 16:13:59 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181613.n7IGDxSQ021986@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:13:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196360 - vendor-sys/pf/dist/net
	vendor-sys/pf/dist/netinet vendor/pf/dist/authpf
	vendor/pf/dist/ftp-proxy vendor/pf/dist/libevent
	vendor/pf/dist/man vendor/pf/dist/pfctl vendor/pf/dist...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:14:00 -0000

Author: mlaier
Date: Tue Aug 18 16:13:59 2009
New Revision: 196360
URL: http://svn.freebsd.org/changeset/base/196360

Log:
  eri@ wants to start on porting the latest pf in his user space so we can
  finally have a new version in 9.0.  Import pf as of OPENBSD_4_5_BASE to help
  with that.

Added:
  vendor/pf/dist/man/pflow.4
Modified:
  vendor/pf/dist/authpf/Makefile
  vendor/pf/dist/authpf/authpf.8
  vendor/pf/dist/authpf/authpf.c
  vendor/pf/dist/authpf/pathnames.h
  vendor/pf/dist/ftp-proxy/Makefile
  vendor/pf/dist/ftp-proxy/filter.c
  vendor/pf/dist/ftp-proxy/filter.h
  vendor/pf/dist/ftp-proxy/ftp-proxy.8
  vendor/pf/dist/ftp-proxy/ftp-proxy.c
  vendor/pf/dist/libevent/buffer.c
  vendor/pf/dist/libevent/evbuffer.c
  vendor/pf/dist/libevent/event-internal.h
  vendor/pf/dist/libevent/event.c
  vendor/pf/dist/libevent/event.h
  vendor/pf/dist/libevent/evsignal.h
  vendor/pf/dist/libevent/kqueue.c
  vendor/pf/dist/libevent/log.c
  vendor/pf/dist/libevent/log.h
  vendor/pf/dist/libevent/poll.c
  vendor/pf/dist/libevent/select.c
  vendor/pf/dist/libevent/signal.c
  vendor/pf/dist/man/pf.4
  vendor/pf/dist/man/pf.conf.5
  vendor/pf/dist/man/pf.os.5
  vendor/pf/dist/man/pflog.4
  vendor/pf/dist/man/pfsync.4
  vendor/pf/dist/pfctl/Makefile
  vendor/pf/dist/pfctl/parse.y
  vendor/pf/dist/pfctl/pf_print_state.c
  vendor/pf/dist/pfctl/pfctl.8
  vendor/pf/dist/pfctl/pfctl.c
  vendor/pf/dist/pfctl/pfctl.h
  vendor/pf/dist/pfctl/pfctl_altq.c
  vendor/pf/dist/pfctl/pfctl_optimize.c
  vendor/pf/dist/pfctl/pfctl_osfp.c
  vendor/pf/dist/pfctl/pfctl_parser.c
  vendor/pf/dist/pfctl/pfctl_parser.h
  vendor/pf/dist/pfctl/pfctl_qstats.c
  vendor/pf/dist/pfctl/pfctl_radix.c
  vendor/pf/dist/pfctl/pfctl_table.c
  vendor/pf/dist/pflogd/Makefile
  vendor/pf/dist/pflogd/pflogd.8
  vendor/pf/dist/pflogd/pflogd.c
  vendor/pf/dist/pflogd/pflogd.h
  vendor/pf/dist/pflogd/privsep.c
  vendor/pf/dist/pflogd/privsep_fdpass.c
  vendor/pf/dist/tftp-proxy/Makefile
  vendor/pf/dist/tftp-proxy/filter.c
  vendor/pf/dist/tftp-proxy/filter.h
  vendor/pf/dist/tftp-proxy/tftp-proxy.8
  vendor/pf/dist/tftp-proxy/tftp-proxy.c

Changes in other areas also in this revision:
Added:
  vendor-sys/pf/dist/net/if_pflow.c
  vendor-sys/pf/dist/net/if_pflow.h
  vendor-sys/pf/dist/net/pf_lb.c
Modified:
  vendor-sys/pf/dist/net/if_pflog.c
  vendor-sys/pf/dist/net/if_pflog.h
  vendor-sys/pf/dist/net/if_pfsync.c
  vendor-sys/pf/dist/net/if_pfsync.h
  vendor-sys/pf/dist/net/pf.c
  vendor-sys/pf/dist/net/pf_if.c
  vendor-sys/pf/dist/net/pf_ioctl.c
  vendor-sys/pf/dist/net/pf_norm.c
  vendor-sys/pf/dist/net/pf_osfp.c
  vendor-sys/pf/dist/net/pf_ruleset.c
  vendor-sys/pf/dist/net/pf_table.c
  vendor-sys/pf/dist/net/pfvar.h
  vendor-sys/pf/dist/netinet/in4_cksum.c

Modified: vendor/pf/dist/authpf/Makefile
==============================================================================
--- vendor/pf/dist/authpf/Makefile	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/authpf/Makefile	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-#	$OpenBSD: Makefile,v 1.13 2008/02/14 01:49:17 mcbride Exp $
+#	$OpenBSD: Makefile,v 1.12 2004/04/25 19:24:52 deraadt Exp $
 
 PROG=	authpf
 MAN=	authpf.8

Modified: vendor/pf/dist/authpf/authpf.8
==============================================================================
--- vendor/pf/dist/authpf/authpf.8	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/authpf/authpf.8	Tue Aug 18 16:13:59 2009	(r196360)
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: February 14 2008 $
+.Dd $Mdocdate: March 18 2008 $
 .Dt AUTHPF 8
 .Os
 .Sh NAME
@@ -202,6 +202,9 @@ It is also possible to configure
 to only allow specific users access.
 This is done by listing their login names, one per line, in
 .Pa /etc/authpf/authpf.allow .
+A group of users can also be indicated by prepending "%" to the group name,
+and all members of a login class can be indicated by prepending "@" to the
+login class name.
 If "*" is found on a line, then all usernames match.
 If
 .Nm
@@ -314,7 +317,8 @@ They have a
 wireless network which they would like to protect from unauthorized use.
 To accomplish this, they create the file
 .Pa /etc/authpf/authpf.allow
-which lists their login ids, one per line.
+which lists their login ids, group prepended with "%", or login class
+prepended with "@", one per line.
 At this point, even if eve could authenticate to
 .Xr sshd 8 ,
 she would not be allowed to use the gateway.

Modified: vendor/pf/dist/authpf/authpf.c
==============================================================================
--- vendor/pf/dist/authpf/authpf.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/authpf/authpf.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: authpf.c,v 1.107 2008/02/14 01:49:17 mcbride Exp $	*/
+/*	$OpenBSD: authpf.c,v 1.111 2009/01/10 17:17:32 todd Exp $	*/
 
 /*
  * Copyright (C) 1998 - 2007 Bob Beck (beck@openbsd.org).
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -43,7 +44,7 @@
 
 static int	read_config(FILE *);
 static void	print_message(char *);
-static int	allowed_luser(char *);
+static int	allowed_luser(struct passwd *);
 static int	check_luser(char *, char *);
 static int	remove_stale_rulesets(void);
 static int	recursive_ruleset_purge(char *, char *);
@@ -58,6 +59,7 @@ char	tablename[PF_TABLE_NAME_SIZE] = "au
 int	user_ip = 1;	/* controls whether $user_ip is set */
 
 FILE	*pidfp;
+int	pidfd = -1;
 char	 luser[MAXLOGNAME];	/* username */
 char	 ipsrc[256];		/* ip as a string */
 char	 pidfile[MAXPATHLEN];	/* we save pid in this file. */
@@ -78,7 +80,7 @@ extern char *__progname;	/* program name
 int
 main(int argc, char *argv[])
 {
-	int		 lockcnt = 0, n, pidfd;
+	int		 lockcnt = 0, n;
 	FILE		*config;
 	struct in6_addr	 ina;
 	struct passwd	*pw;
@@ -93,7 +95,7 @@ main(int argc, char *argv[])
 
 	config = fopen(PATH_CONFFILE, "r");
 	if (config == NULL) {
-		syslog(LOG_ERR, "can not open %s (%m)", PATH_CONFFILE);
+		syslog(LOG_ERR, "cannot open %s (%m)", PATH_CONFFILE);
 		exit(1);
 	}
 
@@ -186,6 +188,14 @@ main(int argc, char *argv[])
 		goto die;
 	}
 
+	signal(SIGTERM, need_death);
+	signal(SIGINT, need_death);
+	signal(SIGALRM, need_death);
+	signal(SIGPIPE, need_death);
+	signal(SIGHUP, need_death);
+	signal(SIGQUIT, need_death);
+	signal(SIGTSTP, need_death);
+
 	/*
 	 * If someone else is already using this ip, then this person
 	 * wants to switch users - so kill the old process and exit
@@ -239,15 +249,17 @@ main(int argc, char *argv[])
 		}
 
 		/*
-		 * we try to kill the previous process and acquire the lock
+		 * We try to kill the previous process and acquire the lock
 		 * for 10 seconds, trying once a second. if we can't after
-		 * 10 attempts we log an error and give up
+		 * 10 attempts we log an error and give up.
 		 */
-		if (++lockcnt > 10) {
-			syslog(LOG_ERR, "cannot kill previous authpf (pid %d)",
-			    otherpid);
+		if (want_death || ++lockcnt > 10) {
+			if (!want_death)
+				syslog(LOG_ERR, "cannot kill previous authpf (pid %d)",
+				    otherpid);
 			fclose(pidfp);
 			pidfp = NULL;
+			pidfd = -1;
 			goto dogdeath;
 		}
 		sleep(1);
@@ -258,6 +270,7 @@ main(int argc, char *argv[])
 		 */
 		fclose(pidfp);
 		pidfp = NULL;
+		pidfd = -1;
 	} while (1);
 	
 	/* whack the group list */
@@ -275,7 +288,7 @@ main(int argc, char *argv[])
 	}
 	openlog("authpf", LOG_PID | LOG_NDELAY, LOG_DAEMON);
 
-	if (!check_luser(PATH_BAN_DIR, luser) || !allowed_luser(luser)) {
+	if (!check_luser(PATH_BAN_DIR, luser) || !allowed_luser(pw)) {
 		syslog(LOG_INFO, "user %s prohibited", luser);
 		do_death(0);
 	}
@@ -306,13 +319,6 @@ main(int argc, char *argv[])
 		do_death(0);
 	}
 
-	signal(SIGTERM, need_death);
-	signal(SIGINT, need_death);
-	signal(SIGALRM, need_death);
-	signal(SIGPIPE, need_death);
-	signal(SIGHUP, need_death);
-	signal(SIGQUIT, need_death);
-	signal(SIGTSTP, need_death);
 	while (1) {
 		printf("\r\nHello %s. ", luser);
 		printf("You are authenticated from host \"%s\"\r\n", ipsrc);
@@ -434,6 +440,7 @@ print_message(char *filename)
  * allowed_luser checks to see if user "luser" is allowed to
  * use this gateway by virtue of being listed in an allowed
  * users file, namely /etc/authpf/authpf.allow .
+ * Users may be listed by , %, or @.
  *
  * If /etc/authpf/authpf.allow does not exist, then we assume that
  * all users who are allowed in by sshd(8) are permitted to
@@ -442,7 +449,7 @@ print_message(char *filename)
  * the session terminates in the same manner as being banned.
  */
 static int
-allowed_luser(char *luser)
+allowed_luser(struct passwd *pw)
 {
 	char	*buf, *lbuf;
 	int	 matched;
@@ -474,8 +481,14 @@ allowed_luser(char *luser)
 		 * "public" gateway, such as it is, so let
 		 * everyone use it.
 		 */
+		int gl_init = 0, ngroups = NGROUPS + 1;
+		gid_t groups[NGROUPS + 1];
+
 		lbuf = NULL;
+		matched = 0;
+
 		while ((buf = fgetln(f, &len))) {
+			
 			if (buf[len - 1] == '\n')
 				buf[len - 1] = '\0';
 			else {
@@ -486,7 +499,40 @@ allowed_luser(char *luser)
 				buf = lbuf;
 			}
 
-			matched = strcmp(luser, buf) == 0 || strcmp("*", buf) == 0;
+			if (buf[0] == '@') {
+				/* check login class */
+				if (strcmp(pw->pw_class, buf + 1) == 0)
+					matched++;
+			} else if (buf[0] == '%') {
+				/* check group membership */
+				int cnt; 
+				struct group *group;
+
+				if ((group = getgrnam(buf + 1)) == NULL) {
+					syslog(LOG_ERR,
+					    "invalid group '%s' in %s (%s)",
+					    buf + 1, PATH_ALLOWFILE,
+				 	    strerror(errno));
+					return (0);
+				}
+
+				if (!gl_init) {
+					(void) getgrouplist(pw->pw_name,
+					    pw->pw_gid, groups, &ngroups);
+					gl_init++;
+				}
+			
+				for ( cnt = 0; cnt < ngroups; cnt++) {
+					if (group->gr_gid == groups[cnt]) {
+						matched++;
+						break;
+					}
+				}
+			} else {
+				/* check username and wildcard */
+				matched = strcmp(pw->pw_name, buf) == 0 ||
+				    strcmp("*", buf) == 0;
+			}
 
 			if (lbuf != NULL) {
 				free(lbuf);
@@ -494,10 +540,10 @@ allowed_luser(char *luser)
 			}
 
 			if (matched)
-				return (1); /* matched an allowed username */
+				return (1); /* matched an allowed user/group */
 		}
 		syslog(LOG_INFO, "denied access to %s: not listed in %s",
-		    luser, PATH_ALLOWFILE);
+		    pw->pw_name, PATH_ALLOWFILE);
 
 		/* reuse buf */
 		buf = "\n\nSorry, you are not allowed to use this facility!\n";
@@ -878,7 +924,7 @@ do_death(int active)
 			authpf_kill_states();
 		}
 	}
-	if (pidfile[0] && (pidfp != NULL))
+	if (pidfile[0] && pidfd != -1)
 		if (unlink(pidfile) == -1)
 			syslog(LOG_ERR, "cannot unlink %s (%m)", pidfile);
 	exit(ret);

Modified: vendor/pf/dist/authpf/pathnames.h
==============================================================================
--- vendor/pf/dist/authpf/pathnames.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/authpf/pathnames.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pathnames.h,v 1.8 2008/02/14 01:49:17 mcbride Exp $	*/
+/*	$OpenBSD: pathnames.h,v 1.7 2004/04/25 18:40:42 beck Exp $	*/
 
 /*
  * Copyright (C) 2002 Chris Kuethe (ckuethe@ualberta.ca)

Modified: vendor/pf/dist/ftp-proxy/Makefile
==============================================================================
--- vendor/pf/dist/ftp-proxy/Makefile	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/ftp-proxy/Makefile	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-#	$OpenBSD: Makefile,v 1.3 2006/11/26 11:31:13 deraadt Exp $
+#	$OpenBSD: Makefile,v 1.2 2005/06/07 14:12:07 camield Exp $
 
 PROG=	ftp-proxy
 SRCS=	ftp-proxy.c filter.c

Modified: vendor/pf/dist/ftp-proxy/filter.c
==============================================================================
--- vendor/pf/dist/ftp-proxy/filter.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/ftp-proxy/filter.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: filter.c,v 1.8 2008/06/13 07:25:26 claudio Exp $ */
+/*	$OpenBSD: filter.c,v 1.7 2008/02/26 18:52:53 henning Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Camiel Dobbelaar, 

Modified: vendor/pf/dist/ftp-proxy/filter.h
==============================================================================
--- vendor/pf/dist/ftp-proxy/filter.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/ftp-proxy/filter.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: filter.h,v 1.4 2007/08/01 09:31:41 henning Exp $ */
+/*	$OpenBSD: filter.h,v 1.3 2005/06/07 14:12:07 camield Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Camiel Dobbelaar, 

Modified: vendor/pf/dist/ftp-proxy/ftp-proxy.8
==============================================================================
--- vendor/pf/dist/ftp-proxy/ftp-proxy.8	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/ftp-proxy/ftp-proxy.8	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: ftp-proxy.8,v 1.11 2008/02/26 18:52:53 henning Exp $
+.\"	$OpenBSD: ftp-proxy.8,v 1.10 2007/08/01 15:45:41 jmc Exp $
 .\"
 .\" Copyright (c) 2004, 2005 Camiel Dobbelaar, 
 .\"

Modified: vendor/pf/dist/ftp-proxy/ftp-proxy.c
==============================================================================
--- vendor/pf/dist/ftp-proxy/ftp-proxy.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/ftp-proxy/ftp-proxy.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: ftp-proxy.c,v 1.19 2008/06/13 07:25:26 claudio Exp $ */
+/*	$OpenBSD: ftp-proxy.c,v 1.18 2008/04/22 02:22:22 joel Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Camiel Dobbelaar, 

Modified: vendor/pf/dist/libevent/buffer.c
==============================================================================
--- vendor/pf/dist/libevent/buffer.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/buffer.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: buffer.c,v 1.14 2007/03/19 15:12:49 millert Exp $	*/
+
 /*
  * Copyright (c) 2002, 2003 Niels Provos 
  * All rights reserved.
@@ -62,7 +64,7 @@ struct evbuffer *
 evbuffer_new(void)
 {
 	struct evbuffer *buffer;
-	
+
 	buffer = calloc(1, sizeof(struct evbuffer));
 
 	return (buffer);
@@ -76,7 +78,7 @@ evbuffer_free(struct evbuffer *buffer)
 	free(buffer);
 }
 
-/* 
+/*
  * This is a destructive add.  The data from one buffer moves into
  * the other buffer.
  */
@@ -104,16 +106,16 @@ evbuffer_add_buffer(struct evbuffer *out
 		SWAP(outbuf, inbuf);
 		SWAP(inbuf, &tmp);
 
-		/* 
+		/*
 		 * Optimization comes with a price; we need to notify the
 		 * buffer if necessary of the changes. oldoff is the amount
-		 * of data that we transfered from inbuf to outbuf
+		 * of data that we transferred from inbuf to outbuf
 		 */
 		if (inbuf->off != oldoff && inbuf->cb != NULL)
 			(*inbuf->cb)(inbuf, oldoff, inbuf->off, inbuf->cbarg);
 		if (oldoff && outbuf->cb != NULL)
 			(*outbuf->cb)(outbuf, 0, oldoff, outbuf->cbarg);
-		
+
 		return (0);
 	}
 
@@ -196,7 +198,7 @@ evbuffer_remove(struct evbuffer *buf, vo
 
 	memcpy(data, buf->buffer, nread);
 	evbuffer_drain(buf, nread);
-	
+
 	return (nread);
 }
 
@@ -371,7 +373,7 @@ evbuffer_read(struct evbuffer *buf, int 
 		if (n < EVBUFFER_MAX_READ)
 			n = EVBUFFER_MAX_READ;
 	}
-#endif	
+#endif
 	if (howmuch < 0 || howmuch > n)
 		howmuch = n;
 

Modified: vendor/pf/dist/libevent/evbuffer.c
==============================================================================
--- vendor/pf/dist/libevent/evbuffer.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/evbuffer.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: evbuffer.c,v 1.10 2007/03/19 15:12:49 millert Exp $	*/
+
 /*
  * Copyright (c) 2002-2004 Niels Provos 
  * All rights reserved.
@@ -64,7 +66,7 @@ bufferevent_add(struct event *ev, int ti
 	return (event_add(ev, ptv));
 }
 
-/* 
+/*
  * This callback is executed when the size of the input buffer changes.
  * We use it to apply back pressure on the reading side.
  */
@@ -73,7 +75,7 @@ void
 bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now,
     void *arg) {
 	struct bufferevent *bufev = arg;
-	/* 
+	/*
 	 * If we are below the watermark then reschedule reading if it's
 	 * still enabled.
 	 */
@@ -288,7 +290,7 @@ bufferevent_free(struct bufferevent *buf
  */
 
 int
-bufferevent_write(struct bufferevent *bufev, void *data, size_t size)
+bufferevent_write(struct bufferevent *bufev, const void *data, size_t size)
 {
 	int res;
 

Modified: vendor/pf/dist/libevent/event-internal.h
==============================================================================
--- vendor/pf/dist/libevent/event-internal.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/event-internal.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: event-internal.h,v 1.4 2007/03/19 15:12:49 millert Exp $	*/
+
 /*
  * Copyright (c) 2000-2004 Niels Provos 
  * All rights reserved.

Modified: vendor/pf/dist/libevent/event.c
==============================================================================
--- vendor/pf/dist/libevent/event.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/event.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: event.c,v 1.18 2008/05/02 06:09:11 brad Exp $	*/
+
 /*
  * Copyright (c) 2000-2004 Niels Provos 
  * All rights reserved.
@@ -38,7 +40,7 @@
 #include 
 #ifdef HAVE_SYS_TIME_H
 #include 
-#else 
+#else
 #include 
 #endif
 #include 
@@ -180,7 +182,7 @@ RB_PROTOTYPE(event_tree, event, ev_timeo
 RB_GENERATE(event_tree, event, ev_timeout_node, compare);
 
 
-void *
+struct event_base *
 event_init(void)
 {
 	int i;
@@ -194,13 +196,13 @@ event_init(void)
 
 	detect_monotonic();
 	gettime(&base->event_tv);
-	
+
 	RB_INIT(&base->timetree);
 	TAILQ_INIT(&base->eventqueue);
 	TAILQ_INIT(&base->sig.signalqueue);
 	base->sig.ev_signal_pair[0] = -1;
 	base->sig.ev_signal_pair[1] = -1;
-	
+
 	base->evbase = NULL;
 	for (i = 0; eventops[i] && !base->evbase; i++) {
 		base->evsel = eventops[i];
@@ -321,7 +323,7 @@ event_process_active(struct event_base *
 
 	for (ev = TAILQ_FIRST(activeq); ev; ev = TAILQ_FIRST(activeq)) {
 		event_queue_remove(base, ev, EVLIST_ACTIVE);
-		
+
 		/* Allows deletes to work */
 		ncalls = ev->ev_ncalls;
 		ev->ev_pncalls = &ncalls;
@@ -430,7 +432,7 @@ event_base_loop(struct event_base *base,
 			 */
 			timerclear(&tv);
 		}
-		
+
 		/* If we have no events, we just exit */
 		if (!event_haveevents(base)) {
 			event_debug(("%s: no events registered.", __func__));
@@ -439,7 +441,6 @@ event_base_loop(struct event_base *base,
 
 		res = evsel->dispatch(base, evbase, tv_p);
 
-
 		if (res == -1)
 			return (-1);
 
@@ -652,7 +653,7 @@ event_add(struct event *ev, struct timev
 				/* Abort loop */
 				*ev->ev_pncalls = 0;
 			}
-			
+
 			event_queue_remove(base, ev, EVLIST_ACTIVE);
 		}
 
@@ -913,10 +914,10 @@ event_queue_insert(struct event_base *ba
 const char *
 event_get_version(void)
 {
-	return (VERSION);
+	return (LIBEVENT_VERSION);
 }
 
-/* 
+/*
  * No thread-safe interface needed - the information should be the same
  * for all threads.
  */

Modified: vendor/pf/dist/libevent/event.h
==============================================================================
--- vendor/pf/dist/libevent/event.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/event.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: event.h,v 1.19 2008/05/02 06:09:11 brad Exp $	*/
+
 /*
  * Copyright (c) 2000-2004 Niels Provos 
  * All rights reserved.
@@ -43,6 +45,8 @@ typedef unsigned char u_char;
 typedef unsigned short u_short;
 #endif
 
+#define LIBEVENT_VERSION	"1.3e"
+
 #define EVLIST_TIMEOUT	0x01
 #define EVLIST_INSERTED	0x02
 #define EVLIST_SIGNAL	0x04
@@ -141,7 +145,7 @@ struct eventop {
 	void (*dealloc)(struct event_base *, void *);
 };
 
-void *event_init(void);
+struct event_base *event_init(void);
 int event_dispatch(void);
 int event_base_dispatch(struct event_base *);
 void event_base_free(struct event_base *);
@@ -169,12 +173,6 @@ int event_base_loopexit(struct event_bas
 #define evtimer_pending(ev, tv)		event_pending(ev, EV_TIMEOUT, tv)
 #define evtimer_initialized(ev)		((ev)->ev_flags & EVLIST_INIT)
 
-#define timeout_add(ev, tv)		event_add(ev, tv)
-#define timeout_set(ev, cb, arg)	event_set(ev, -1, 0, cb, arg)
-#define timeout_del(ev)			event_del(ev)
-#define timeout_pending(ev, tv)		event_pending(ev, EV_TIMEOUT, tv)
-#define timeout_initialized(ev)		((ev)->ev_flags & EVLIST_INIT)
-
 #define signal_add(ev, tv)		event_add(ev, tv)
 #define signal_set(ev, x, cb, arg)	\
 	event_set(ev, x, EV_SIGNAL|EV_PERSIST, cb, arg)
@@ -264,7 +262,8 @@ struct bufferevent *bufferevent_new(int 
 int bufferevent_base_set(struct event_base *base, struct bufferevent *bufev);
 int bufferevent_priority_set(struct bufferevent *bufev, int pri);
 void bufferevent_free(struct bufferevent *bufev);
-int bufferevent_write(struct bufferevent *bufev, void *data, size_t size);
+int bufferevent_write(struct bufferevent *bufev,
+    const void *data, size_t size);
 int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf);
 size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
 int bufferevent_enable(struct bufferevent *bufev, short event);
@@ -292,7 +291,7 @@ int evbuffer_read(struct evbuffer *, int
 u_char *evbuffer_find(struct evbuffer *, const u_char *, size_t);
 void evbuffer_setcb(struct evbuffer *, void (*)(struct evbuffer *, size_t, size_t, void *), void *);
 
-/* 
+/*
  * Marshaling tagged data - We assume that all tags are inserted in their
  * numeric order - so that unknown tags will always be higher than the
  * known ones - and we can just ignore the end of an event buffer.

Modified: vendor/pf/dist/libevent/evsignal.h
==============================================================================
--- vendor/pf/dist/libevent/evsignal.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/evsignal.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: evsignal.h,v 1.2 2004/04/28 06:53:12 brad Exp $	*/
+
 /*
  * Copyright 2000-2002 Niels Provos 
  * All rights reserved.

Modified: vendor/pf/dist/libevent/kqueue.c
==============================================================================
--- vendor/pf/dist/libevent/kqueue.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/kqueue.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: kqueue.c,v 1.5 2002/07/10 14:41:31 art Exp $	*/
+/*	$OpenBSD: kqueue.c,v 1.23 2007/09/02 15:19:18 deraadt Exp $	*/
 
 /*
  * Copyright 2000-2002 Niels Provos 
@@ -97,14 +97,14 @@ kq_init(struct event_base *base)
 	struct kqop *kqueueop;
 
 	/* Disable kqueue when this environment variable is set */
-	if (getenv("EVENT_NOKQUEUE"))
+	if (!issetugid() && getenv("EVENT_NOKQUEUE"))
 		return (NULL);
 
 	if (!(kqueueop = calloc(1, sizeof(struct kqop))))
 		return (NULL);
 
 	/* Initalize the kernel queue */
-	
+
 	if ((kq = kqueue()) == -1) {
 		event_warn("kqueue");
 		free (kqueueop);
@@ -114,12 +114,12 @@ kq_init(struct event_base *base)
 	kqueueop->kq = kq;
 
 	/* Initalize fields */
-	kqueueop->changes = malloc(NEVENT * sizeof(struct kevent));
+	kqueueop->changes = calloc(NEVENT, sizeof(struct kevent));
 	if (kqueueop->changes == NULL) {
 		free (kqueueop);
 		return (NULL);
 	}
-	kqueueop->events = malloc(NEVENT * sizeof(struct kevent));
+	kqueueop->events = calloc(NEVENT, sizeof(struct kevent));
 	if (kqueueop->events == NULL) {
 		free (kqueueop->changes);
 		free (kqueueop);
@@ -131,7 +131,7 @@ kq_init(struct event_base *base)
 	kqueueop->changes[0].ident = -1;
 	kqueueop->changes[0].filter = EVFILT_READ;
 	kqueueop->changes[0].flags = EV_ADD;
-	/* 
+	/*
 	 * If kqueue works, then kevent will succeed, and it will
 	 * stick an error in events[0].  If kqueue is broken, then
 	 * kevent will fail.
@@ -195,7 +195,7 @@ kq_insert(struct kqop *kqop, struct keve
 	memcpy(&kqop->changes[kqop->nchanges++], kev, sizeof(struct kevent));
 
 	event_debug(("%s: fd %d %s%s",
-		 __func__, kev->ident, 
+		 __func__, kev->ident,
 		 kev->filter == EVFILT_READ ? "EVFILT_READ" : "EVFILT_WRITE",
 		 kev->flags == EV_DELETE ? " (del)" : ""));
 
@@ -241,7 +241,7 @@ kq_dispatch(struct event_base *base, voi
 		int which = 0;
 
 		if (events[i].flags & EV_ERROR) {
-			/* 
+			/*
 			 * Error messages that can happen, when a delete fails.
 			 *   EBADF happens when the file discriptor has been
 			 *   closed,
@@ -301,7 +301,7 @@ kq_add(void *arg, struct event *ev)
 		if (!(ev->ev_events & EV_PERSIST))
 			kev.flags |= EV_ONESHOT;
 		kev.udata = PTR_TO_UDATA(ev);
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 
@@ -324,7 +324,7 @@ kq_add(void *arg, struct event *ev)
 		if (!(ev->ev_events & EV_PERSIST))
 			kev.flags |= EV_ONESHOT;
 		kev.udata = PTR_TO_UDATA(ev);
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 
@@ -339,7 +339,7 @@ kq_add(void *arg, struct event *ev)
 		if (!(ev->ev_events & EV_PERSIST))
 			kev.flags |= EV_ONESHOT;
 		kev.udata = PTR_TO_UDATA(ev);
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 
@@ -365,7 +365,7 @@ kq_del(void *arg, struct event *ev)
 		kev.ident = nsignal;
 		kev.filter = EVFILT_SIGNAL;
 		kev.flags = EV_DELETE;
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 
@@ -381,7 +381,7 @@ kq_del(void *arg, struct event *ev)
 		kev.ident = ev->ev_fd;
 		kev.filter = EVFILT_READ;
 		kev.flags = EV_DELETE;
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 
@@ -393,7 +393,7 @@ kq_del(void *arg, struct event *ev)
 		kev.ident = ev->ev_fd;
 		kev.filter = EVFILT_WRITE;
 		kev.flags = EV_DELETE;
-		
+
 		if (kq_insert(kqop, &kev) == -1)
 			return (-1);
 

Modified: vendor/pf/dist/libevent/log.c
==============================================================================
--- vendor/pf/dist/libevent/log.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/log.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: err.c,v 1.2 2002/06/25 15:50:15 mickey Exp $	*/
+/*	$OpenBSD: log.c,v 1.4 2005/05/04 03:17:48 brad Exp $	*/
 
 /*
  * log.c
@@ -102,7 +102,7 @@ void
 event_err(int eval, const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_ERR, errno, fmt, ap);
 	va_end(ap);
@@ -113,7 +113,7 @@ void
 event_warn(const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_WARN, errno, fmt, ap);
 	va_end(ap);
@@ -123,7 +123,7 @@ void
 event_errx(int eval, const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_ERR, -1, fmt, ap);
 	va_end(ap);
@@ -134,7 +134,7 @@ void
 event_warnx(const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_WARN, -1, fmt, ap);
 	va_end(ap);
@@ -144,7 +144,7 @@ void
 event_msgx(const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_MSG, -1, fmt, ap);
 	va_end(ap);
@@ -154,7 +154,7 @@ void
 _event_debugx(const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	_warn_helper(_EVENT_LOG_DEBUG, -1, fmt, ap);
 	va_end(ap);

Modified: vendor/pf/dist/libevent/log.h
==============================================================================
--- vendor/pf/dist/libevent/log.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/log.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,3 +1,5 @@
+/*	$OpenBSD: log.h,v 1.4 2007/03/19 15:12:49 millert Exp $	*/
+
 /*
  * Copyright (c) 2000-2004 Niels Provos 
  * All rights reserved.

Modified: vendor/pf/dist/libevent/poll.c
==============================================================================
--- vendor/pf/dist/libevent/poll.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/poll.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: poll.c,v 1.2 2002/06/25 15:50:15 mickey Exp $	*/
+/*	$OpenBSD: poll.c,v 1.13 2006/11/26 15:24:34 brad Exp $	*/
 
 /*
  * Copyright 2000-2003 Niels Provos 
@@ -89,7 +89,7 @@ poll_init(struct event_base *base)
 	struct pollop *pollop;
 
 	/* Disable poll when this environment variable is set */
-	if (getenv("EVENT_NOPOLL"))
+	if (!issetugid() && getenv("EVENT_NOPOLL"))
 		return (NULL);
 
 	if (!(pollop = calloc(1, sizeof(struct pollop))))
@@ -179,6 +179,7 @@ poll_dispatch(struct event_base *base, v
 	for (i = 0; i < nfds; i++) {
 		int what = pop->event_set[i].revents;
 		struct event *r_ev = NULL, *w_ev = NULL;
+
 		if (!what)
 			continue;
 
@@ -356,7 +357,7 @@ poll_del(void *arg, struct event *ev)
 
 	--pop->nfds;
 	if (i != pop->nfds) {
-		/* 
+		/*
 		 * Shift the last pollfd down into the now-unoccupied
 		 * position.
 		 */

Modified: vendor/pf/dist/libevent/select.c
==============================================================================
--- vendor/pf/dist/libevent/select.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/select.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: select.c,v 1.2 2002/06/25 15:50:15 mickey Exp $	*/
+/*	$OpenBSD: select.c,v 1.13 2007/03/19 15:12:49 millert Exp $	*/
 
 /*
  * Copyright 2000-2002 Niels Provos 
@@ -96,7 +96,7 @@ select_init(struct event_base *base)
 	struct selectop *sop;
 
 	/* Disable select when this environment variable is set */
-	if (getenv("EVENT_NOSELECT"))
+	if (!issetugid() && getenv("EVENT_NOSELECT"))
 		return (NULL);
 
 	if (!(sop = calloc(1, sizeof(struct selectop))))

Modified: vendor/pf/dist/libevent/signal.c
==============================================================================
--- vendor/pf/dist/libevent/signal.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/libevent/signal.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: select.c,v 1.2 2002/06/25 15:50:15 mickey Exp $	*/
+/*	$OpenBSD: signal.c,v 1.11 2007/03/19 15:12:49 millert Exp $	*/
 
 /*
  * Copyright 2000-2002 Niels Provos 
@@ -85,7 +85,7 @@ evsignal_cb(int fd, short what, void *ar
 void
 evsignal_init(struct event_base *base)
 {
-	/* 
+	/*
 	 * Our signal handler is going to write to one end of the socket
 	 * pair to wake up our event loop.  The event loop then scans for
 	 * signals that got delivered.

Modified: vendor/pf/dist/man/pf.4
==============================================================================
--- vendor/pf/dist/man/pf.4	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/man/pf.4	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: pf.4,v 1.60 2007/12/02 12:08:04 pascoe Exp $
+.\"	$OpenBSD: pf.4,v 1.61 2008/09/04 13:50:37 jmc Exp $
 .\"
 .\" Copyright (C) 2001, Kjell Wooding.  All rights reserved.
 .\"
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: September 4 2008 $
 .Dt PF 4
 .Os
 .Sh NAME
@@ -1050,12 +1050,14 @@ internal interface description.
 The filtering process is the same as for
 .Dv DIOCIGETIFACES .
 .Bd -literal
-#define PFI_IFLAG_SKIP		0x0100	/* skip filtering on interface */
+#define PFI_IFLAG_SKIP	0x0100	/* skip filtering on interface */
 .Ed
 .It Dv DIOCCLRIFFLAG Fa "struct pfioc_iface *io"
 Works as
 .Dv DIOCSETIFFLAG
 above but clears the flags.
+.It Dv DIOCKILLSRCNODES Fa "struct pfioc_iface *io"
+Explicitly remove source tracking nodes.
 .El
 .Sh FILES
 .Bl -tag -width /dev/pf -compact
@@ -1133,6 +1135,7 @@ main(int argc, char *argv[])
 .Xr ioctl 2 ,
 .Xr bridge 4 ,
 .Xr pflog 4 ,
+.Xr pflow 4 ,
 .Xr pfsync 4 ,
 .Xr pfctl 8 ,
 .Xr altq 9

Modified: vendor/pf/dist/man/pf.conf.5
==============================================================================
--- vendor/pf/dist/man/pf.conf.5	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/man/pf.conf.5	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: pf.conf.5,v 1.402 2008/06/11 07:21:00 jmc Exp $
+.\"	$OpenBSD: pf.conf.5,v 1.405 2008/10/02 12:36:32 henning Exp $
 .\"
 .\" Copyright (c) 2002, Daniel Hartmeier
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd $Mdocdate: June 10 2008 $
+.Dd $Mdocdate: October 2 2008 $
 .Dt PF.CONF 5
 .Os
 .Sh NAME
@@ -517,6 +517,16 @@ For example:
 .Bd -literal -offset indent
 set state-policy if-bound
 .Ed
+.It Ar set state-defaults
+The
+.Ar state-defaults
+option sets the state options for states created from rules
+without an explicit
+.Ar keep state .
+For example:
+.Bd -literal -offset indent
+set state-defaults pflow, no-sync
+.Ed
 .It Ar set hostid
 The 32-bit
 .Ar hostid
@@ -901,7 +911,7 @@ Defines a list of subqueues to create on
 .El
 .Pp
 In the following example, the interface dc0
-should queue up to 5 Mbit/s in four second-level queues using
+should queue up to 5Mbps in four second-level queues using
 Class Based Queueing.
 Those four queues will be shown in a later example.
 .Bd -literal -offset indent
@@ -1488,7 +1498,7 @@ Translates to the network(s) attached to
 .It Ar :broadcast
 Translates to the interface's broadcast address(es).
 .It Ar :peer
-Translates to the point to point interface's peer address(es).
+Translates to the point-to-point interface's peer address(es).
 .It Ar :0
 Do not include interface aliases.
 .El
@@ -2098,6 +2108,10 @@ easier.
 This is intended to be used in situations where one does not see all
 packets of a connection, e.g. in asymmetric routing situations.
 Cannot be used with modulate or synproxy state.
+.It Ar pflow
+States created by this rule are exported on the
+.Xr pflow 4
+interface.
 .El
 .Pp
 Multiple options can be specified, separated by commas:
@@ -2821,6 +2835,7 @@ option         = "set" ( [ "timeout" ( t
                  [ "loginterface" ( interface-name | "none" ) ] |
                  [ "block-policy" ( "drop" | "return" ) ] |
                  [ "state-policy" ( "if-bound" | "floating" ) ]
+                 [ "state-defaults" state-opts ]
                  [ "require-order" ( "yes" | "no" ) ]
                  [ "fingerprints" filename ] |
                  [ "skip on" ifspec ] |
@@ -2963,7 +2978,7 @@ tos            = ( "lowdelay" | "through
                  [ "0x" ] number )
 
 state-opts     = state-opt [ [ "," ] state-opts ]
-state-opt      = ( "max" number | "no-sync" | timeout | sloppy |
+state-opt      = ( "max" number | "no-sync" | timeout | "sloppy" | "pflow" |
                  "source-track" [ ( "rule" | "global" ) ] |
                  "max-src-nodes" number | "max-src-states" number |
                  "max-src-conn" number |
@@ -3026,6 +3041,7 @@ Service name database.
 .Xr ip 4 ,
 .Xr ip6 4 ,
 .Xr pf 4 ,
+.Xr pflow 4 ,
 .Xr pfsync 4 ,
 .Xr route 4 ,
 .Xr tcp 4 ,

Modified: vendor/pf/dist/man/pf.os.5
==============================================================================
--- vendor/pf/dist/man/pf.os.5	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/man/pf.os.5	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: pf.os.5,v 1.8 2007/05/31 19:19:58 jmc Exp $
+.\"	$OpenBSD: pf.os.5,v 1.7 2005/11/16 20:07:18 stevesk Exp $
 .\"
 .\" Copyright (c) 2003 Mike Frantzen 
 .\"

Modified: vendor/pf/dist/man/pflog.4
==============================================================================
--- vendor/pf/dist/man/pflog.4	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor/pf/dist/man/pflog.4	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-.\"	$OpenBSD: pflog.4,v 1.10 2007/05/31 19:19:51 jmc Exp $
+.\"	$OpenBSD: pflog.4,v 1.9 2006/10/25 12:51:31 jmc Exp $
 .\"
 .\" Copyright (c) 2001 Tobias Weingartner
 .\" All rights reserved.

Added: vendor/pf/dist/man/pflow.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/pf/dist/man/pflow.4	Tue Aug 18 16:13:59 2009	(r196360)
@@ -0,0 +1,113 @@
+.\" $OpenBSD: pflow.4,v 1.8 2008/10/28 16:55:37 gollo Exp $
+.\"
+.\" Copyright (c) 2008 Henning Brauer 
+.\" Copyright (c) 2008 Joerg Goltermann 
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALLWARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BELIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISINGOUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: October 28 2008 $
+.Dt PFLOW 4
+.Os
+.Sh NAME
+.Nm pflow
+.Nd kernel interface for pflow data export
+.Sh SYNOPSIS
+.Cd "pseudo-device pflow"
+.Sh DESCRIPTION
+The

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:14:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04DAA106568B;
	Tue, 18 Aug 2009 16:14:00 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E19328FC62;
	Tue, 18 Aug 2009 16:13:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGDxfM022025;
	Tue, 18 Aug 2009 16:13:59 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGDxYr022018;
	Tue, 18 Aug 2009 16:13:59 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181613.n7IGDxYr022018@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:13:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196360 - vendor-sys/pf/dist/net
	vendor-sys/pf/dist/netinet vendor/pf/dist/authpf
	vendor/pf/dist/ftp-proxy vendor/pf/dist/libevent
	vendor/pf/dist/man vendor/pf/dist/pfctl vendor/pf/dist...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:14:00 -0000

Author: mlaier
Date: Tue Aug 18 16:13:59 2009
New Revision: 196360
URL: http://svn.freebsd.org/changeset/base/196360

Log:
  eri@ wants to start on porting the latest pf in his user space so we can
  finally have a new version in 9.0.  Import pf as of OPENBSD_4_5_BASE to help
  with that.

Added:
  vendor-sys/pf/dist/net/if_pflow.c
  vendor-sys/pf/dist/net/if_pflow.h
  vendor-sys/pf/dist/net/pf_lb.c
Modified:
  vendor-sys/pf/dist/net/if_pflog.c
  vendor-sys/pf/dist/net/if_pflog.h
  vendor-sys/pf/dist/net/if_pfsync.c
  vendor-sys/pf/dist/net/if_pfsync.h
  vendor-sys/pf/dist/net/pf.c
  vendor-sys/pf/dist/net/pf_if.c
  vendor-sys/pf/dist/net/pf_ioctl.c
  vendor-sys/pf/dist/net/pf_norm.c
  vendor-sys/pf/dist/net/pf_osfp.c
  vendor-sys/pf/dist/net/pf_ruleset.c
  vendor-sys/pf/dist/net/pf_table.c
  vendor-sys/pf/dist/net/pfvar.h
  vendor-sys/pf/dist/netinet/in4_cksum.c

Changes in other areas also in this revision:
Added:
  vendor/pf/dist/man/pflow.4
Modified:
  vendor/pf/dist/authpf/Makefile
  vendor/pf/dist/authpf/authpf.8
  vendor/pf/dist/authpf/authpf.c
  vendor/pf/dist/authpf/pathnames.h
  vendor/pf/dist/ftp-proxy/Makefile
  vendor/pf/dist/ftp-proxy/filter.c
  vendor/pf/dist/ftp-proxy/filter.h
  vendor/pf/dist/ftp-proxy/ftp-proxy.8
  vendor/pf/dist/ftp-proxy/ftp-proxy.c
  vendor/pf/dist/libevent/buffer.c
  vendor/pf/dist/libevent/evbuffer.c
  vendor/pf/dist/libevent/event-internal.h
  vendor/pf/dist/libevent/event.c
  vendor/pf/dist/libevent/event.h
  vendor/pf/dist/libevent/evsignal.h
  vendor/pf/dist/libevent/kqueue.c
  vendor/pf/dist/libevent/log.c
  vendor/pf/dist/libevent/log.h
  vendor/pf/dist/libevent/poll.c
  vendor/pf/dist/libevent/select.c
  vendor/pf/dist/libevent/signal.c
  vendor/pf/dist/man/pf.4
  vendor/pf/dist/man/pf.conf.5
  vendor/pf/dist/man/pf.os.5
  vendor/pf/dist/man/pflog.4
  vendor/pf/dist/man/pfsync.4
  vendor/pf/dist/pfctl/Makefile
  vendor/pf/dist/pfctl/parse.y
  vendor/pf/dist/pfctl/pf_print_state.c
  vendor/pf/dist/pfctl/pfctl.8
  vendor/pf/dist/pfctl/pfctl.c
  vendor/pf/dist/pfctl/pfctl.h
  vendor/pf/dist/pfctl/pfctl_altq.c
  vendor/pf/dist/pfctl/pfctl_optimize.c
  vendor/pf/dist/pfctl/pfctl_osfp.c
  vendor/pf/dist/pfctl/pfctl_parser.c
  vendor/pf/dist/pfctl/pfctl_parser.h
  vendor/pf/dist/pfctl/pfctl_qstats.c
  vendor/pf/dist/pfctl/pfctl_radix.c
  vendor/pf/dist/pfctl/pfctl_table.c
  vendor/pf/dist/pflogd/Makefile
  vendor/pf/dist/pflogd/pflogd.8
  vendor/pf/dist/pflogd/pflogd.c
  vendor/pf/dist/pflogd/pflogd.h
  vendor/pf/dist/pflogd/privsep.c
  vendor/pf/dist/pflogd/privsep_fdpass.c
  vendor/pf/dist/tftp-proxy/Makefile
  vendor/pf/dist/tftp-proxy/filter.c
  vendor/pf/dist/tftp-proxy/filter.h
  vendor/pf/dist/tftp-proxy/tftp-proxy.8
  vendor/pf/dist/tftp-proxy/tftp-proxy.c

Modified: vendor-sys/pf/dist/net/if_pflog.c
==============================================================================
--- vendor-sys/pf/dist/net/if_pflog.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor-sys/pf/dist/net/if_pflog.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_pflog.c,v 1.27 2007/12/20 02:53:02 brad Exp $	*/
+/*	$OpenBSD: if_pflog.c,v 1.26 2007/10/18 21:58:18 mpf Exp $	*/
 /*
  * The authors of this code are John Ioannidis (ji@tla.org),
  * Angelos D. Keromytis (kermit@csd.uch.gr) and 

Modified: vendor-sys/pf/dist/net/if_pflog.h
==============================================================================
--- vendor-sys/pf/dist/net/if_pflog.h	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor-sys/pf/dist/net/if_pflog.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.h,v 1.14 2006/10/25 11:27:01 henning Exp $ */
+/* $OpenBSD: if_pflog.h,v 1.13 2006/10/23 12:46:09 henning Exp $ */
 /*
  * Copyright 2001 Niels Provos 
  * All rights reserved.

Added: vendor-sys/pf/dist/net/if_pflow.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor-sys/pf/dist/net/if_pflow.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -0,0 +1,621 @@
+/*	$OpenBSD: if_pflow.c,v 1.9 2009/01/03 21:47:32 gollo Exp $	*/
+
+/*
+ * Copyright (c) 2008 Henning Brauer 
+ * Copyright (c) 2008 Joerg Goltermann 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef INET
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#endif /* INET */
+
+#include 
+#include 
+
+#include "bpfilter.h"
+#include "pflow.h"
+
+#define PFLOW_MINMTU	\
+    (sizeof(struct pflow_header) + sizeof(struct pflow_flow))
+
+#ifdef PFLOWDEBUG
+#define DPRINTF(x)	do { printf x ; } while (0)
+#else
+#define DPRINTF(x)
+#endif
+
+SLIST_HEAD(, pflow_softc) pflowif_list;
+struct pflowstats	 pflowstats;
+
+void	pflowattach(int);
+int	pflow_clone_create(struct if_clone *, int);
+int	pflow_clone_destroy(struct ifnet *);
+void	pflow_setmtu(struct pflow_softc *, int);
+int	pflowoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
+	    struct rtentry *);
+int	pflowioctl(struct ifnet *, u_long, caddr_t);
+void	pflowstart(struct ifnet *);
+
+struct mbuf *pflow_get_mbuf(struct pflow_softc *);
+int	pflow_sendout(struct pflow_softc *);
+int	pflow_sendout_mbuf(struct pflow_softc *, struct mbuf *);
+void	pflow_timeout(void *);
+void	copy_flow_data(struct pflow_flow *, struct pflow_flow *,
+	struct pf_state *, int, int);
+int	pflow_pack_flow(struct pf_state *, struct pflow_softc *);
+int	pflow_get_dynport(void);
+int	export_pflow_if(struct pf_state*, struct pflow_softc *);
+int	copy_flow_to_m(struct pflow_flow *flow, struct pflow_softc *sc);
+
+struct if_clone	pflow_cloner =
+    IF_CLONE_INITIALIZER("pflow", pflow_clone_create,
+    pflow_clone_destroy);
+
+/* from in_pcb.c */
+extern int ipport_hifirstauto;
+extern int ipport_hilastauto;
+
+/* from kern/kern_clock.c; incremented each clock tick. */
+extern int ticks;
+
+void
+pflowattach(int npflow)
+{
+	SLIST_INIT(&pflowif_list);
+	if_clone_attach(&pflow_cloner);
+}
+
+int
+pflow_clone_create(struct if_clone *ifc, int unit)
+{
+	struct ifnet		*ifp;
+	struct pflow_softc	*pflowif;
+
+	if ((pflowif = malloc(sizeof(*pflowif),
+	    M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
+		return (ENOMEM);
+
+	pflowif->sc_sender_ip.s_addr = INADDR_ANY;
+	pflowif->sc_sender_port = pflow_get_dynport();
+
+	pflowif->sc_imo.imo_membership = malloc(
+	    (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS,
+	    M_WAITOK|M_ZERO);
+	pflowif->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
+	pflowif->sc_receiver_ip.s_addr = 0;
+	pflowif->sc_receiver_port = 0;
+	pflowif->sc_sender_ip.s_addr = INADDR_ANY;
+	pflowif->sc_sender_port = pflow_get_dynport();
+	ifp = &pflowif->sc_if;
+	snprintf(ifp->if_xname, sizeof ifp->if_xname, "pflow%d", unit);
+	ifp->if_softc = pflowif;
+	ifp->if_ioctl = pflowioctl;
+	ifp->if_output = pflowoutput;
+	ifp->if_start = pflowstart;
+	ifp->if_type = IFT_PFLOW;
+	ifp->if_snd.ifq_maxlen = ifqmaxlen;
+	ifp->if_hdrlen = PFLOW_HDRLEN;
+	ifp->if_flags = IFF_UP;
+	ifp->if_flags &= ~IFF_RUNNING;	/* not running, need receiver */
+	pflow_setmtu(pflowif, ETHERMTU);
+	timeout_set(&pflowif->sc_tmo, pflow_timeout, pflowif);
+	if_attach(ifp);
+	if_alloc_sadl(ifp);
+
+#if NBPFILTER > 0
+	bpfattach(&pflowif->sc_if.if_bpf, ifp, DLT_RAW, 0);
+#endif
+
+	/* Insert into list of pflows */
+	SLIST_INSERT_HEAD(&pflowif_list, pflowif, sc_next);
+	return (0);
+}
+
+int
+pflow_clone_destroy(struct ifnet *ifp)
+{
+	struct pflow_softc	*sc = ifp->if_softc;
+	int			 s;
+
+	s = splnet();
+	pflow_sendout(sc);
+#if NBPFILTER > 0
+	bpfdetach(ifp);
+#endif
+	if_detach(ifp);
+	SLIST_REMOVE(&pflowif_list, sc, pflow_softc, sc_next);
+	free(sc->sc_imo.imo_membership, M_IPMOPTS);
+	free(sc, M_DEVBUF);
+	splx(s);
+	return (0);
+}
+
+/*
+ * Start output on the pflow interface.
+ */
+void
+pflowstart(struct ifnet *ifp)
+{
+	struct mbuf	*m;
+	int		 s;
+
+	for (;;) {
+		s = splnet();
+		IF_DROP(&ifp->if_snd);
+		IF_DEQUEUE(&ifp->if_snd, m);
+		splx(s);
+
+		if (m == NULL)
+			return;
+		m_freem(m);
+	}
+}
+
+int
+pflowoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
+	struct rtentry *rt)
+{
+	m_freem(m);
+	return (0);
+}
+
+/* ARGSUSED */
+int
+pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+{
+	struct proc		*p = curproc;
+	struct pflow_softc	*sc = ifp->if_softc;
+	struct ifreq		*ifr = (struct ifreq *)data;
+	struct pflowreq		 pflowr;
+	int			 s, error;
+
+	switch (cmd) {
+	case SIOCSIFADDR:
+	case SIOCAIFADDR:
+	case SIOCSIFDSTADDR:
+	case SIOCSIFFLAGS:
+		if ((ifp->if_flags & IFF_UP) &&
+		    sc->sc_receiver_ip.s_addr != 0 &&
+		    sc->sc_receiver_port != 0) {
+			ifp->if_flags |= IFF_RUNNING;
+			sc->sc_gcounter=pflowstats.pflow_flows;
+		} else
+			ifp->if_flags &= ~IFF_RUNNING;
+		break;
+	case SIOCSIFMTU:
+		if (ifr->ifr_mtu < PFLOW_MINMTU)
+			return (EINVAL);
+		if (ifr->ifr_mtu > MCLBYTES)
+			ifr->ifr_mtu = MCLBYTES;
+		s = splnet();
+		if (ifr->ifr_mtu < ifp->if_mtu)
+			pflow_sendout(sc);
+		pflow_setmtu(sc, ifr->ifr_mtu);
+		splx(s);
+		break;
+
+	case SIOCGETPFLOW:
+		bzero(&pflowr, sizeof(pflowr));
+
+		pflowr.sender_ip = sc->sc_sender_ip;
+		pflowr.receiver_ip = sc->sc_receiver_ip;
+		pflowr.receiver_port = sc->sc_receiver_port;
+
+		if ((error = copyout(&pflowr, ifr->ifr_data,
+		    sizeof(pflowr))))
+			return (error);
+		break;
+
+	case SIOCSETPFLOW:
+		if ((error = suser(p, p->p_acflag)) != 0)
+			return (error);
+		if ((error = copyin(ifr->ifr_data, &pflowr,
+		    sizeof(pflowr))))
+			return (error);
+
+		s = splnet();
+		pflow_sendout(sc);
+		splx(s);
+
+		if (pflowr.addrmask & PFLOW_MASK_DSTIP)
+			sc->sc_receiver_ip = pflowr.receiver_ip;
+		if (pflowr.addrmask & PFLOW_MASK_DSTPRT)
+			sc->sc_receiver_port = pflowr.receiver_port;
+		if (pflowr.addrmask & PFLOW_MASK_SRCIP)
+			sc->sc_sender_ip.s_addr = pflowr.sender_ip.s_addr;
+
+		if ((ifp->if_flags & IFF_UP) &&
+		    sc->sc_receiver_ip.s_addr != 0 &&
+		    sc->sc_receiver_port != 0) {
+			ifp->if_flags |= IFF_RUNNING;
+			sc->sc_gcounter=pflowstats.pflow_flows;
+		} else
+			ifp->if_flags &= ~IFF_RUNNING;
+
+		break;
+
+	default:
+		return (ENOTTY);
+	}
+	return (0);
+}
+
+void
+pflow_setmtu(struct pflow_softc *sc, int mtu_req)
+{
+	int	mtu;
+
+	if (sc->sc_pflow_ifp && sc->sc_pflow_ifp->if_mtu < mtu_req)
+		mtu = sc->sc_pflow_ifp->if_mtu;
+	else
+		mtu = mtu_req;
+
+	sc->sc_maxcount = (mtu - sizeof(struct pflow_header) -
+	    sizeof (struct udpiphdr)) / sizeof(struct pflow_flow);
+	if (sc->sc_maxcount > PFLOW_MAXFLOWS)
+	    sc->sc_maxcount = PFLOW_MAXFLOWS;
+	sc->sc_if.if_mtu = sizeof(struct pflow_header) +
+	    sizeof (struct udpiphdr) + 
+	    sc->sc_maxcount * sizeof(struct pflow_flow);
+}
+
+struct mbuf *
+pflow_get_mbuf(struct pflow_softc *sc)
+{
+	struct pflow_header	 h;
+	struct mbuf		*m;
+
+	MGETHDR(m, M_DONTWAIT, MT_DATA);
+	if (m == NULL) {
+		pflowstats.pflow_onomem++;
+		return (NULL);
+	}
+
+	MCLGET(m, M_DONTWAIT);
+	if ((m->m_flags & M_EXT) == 0) {
+		m_free(m);
+		pflowstats.pflow_onomem++;
+		return (NULL);
+	}
+
+	m->m_len = m->m_pkthdr.len = 0;
+	m->m_pkthdr.rcvif = NULL;
+
+	/* populate pflow_header */
+	h.reserved1 = 0;
+	h.reserved2 = 0;
+	h.count = 0;
+	h.version = htons(PFLOW_VERSION);
+	h.flow_sequence = htonl(sc->sc_gcounter);
+	h.engine_type = PFLOW_ENGINE_TYPE;
+	h.engine_id = PFLOW_ENGINE_ID;
+	m_copyback(m, 0, PFLOW_HDRLEN, &h);
+
+	sc->sc_count = 0;
+	timeout_add_sec(&sc->sc_tmo, PFLOW_TIMEOUT);
+	return (m);
+}
+
+void
+copy_flow_data(struct pflow_flow *flow1, struct pflow_flow *flow2,
+    struct pf_state *st, int src, int dst)
+{
+	struct pf_state_key	*sk = st->key[PF_SK_WIRE];
+
+	flow1->src_ip = flow2->dest_ip = sk->addr[src].v4.s_addr;
+	flow1->src_port = flow2->dest_port = sk->port[src];
+	flow1->dest_ip = flow2->src_ip = sk->addr[dst].v4.s_addr;
+	flow1->dest_port = flow2->src_port = sk->port[dst];
+
+	flow1->dest_as = flow2->src_as =
+	    flow1->src_as = flow2->dest_as = 0;
+	flow1->if_index_out = flow2->if_index_in =
+	    flow1->if_index_in = flow2->if_index_out = 0;
+	flow1->dest_mask = flow2->src_mask =
+	    flow1->src_mask = flow2->dest_mask = 0;
+
+	flow1->flow_packets = htonl(st->packets[0]);
+	flow2->flow_packets = htonl(st->packets[1]);
+	flow1->flow_octets = htonl(st->bytes[0]);
+	flow2->flow_octets = htonl(st->bytes[1]);
+
+	flow1->flow_start = flow2->flow_start = htonl(st->creation * 1000);
+	flow1->flow_finish = flow2->flow_finish = htonl(time_second * 1000);
+	flow1->tcp_flags = flow2->tcp_flags = 0;
+	flow1->protocol = flow2->protocol = sk->proto;
+	flow1->tos = flow2->tos = st->rule.ptr->tos;
+}
+
+int
+export_pflow(struct pf_state *st)
+{
+	struct pflow_softc	*sc = NULL;
+	struct pf_state_key	*sk = st->key[PF_SK_WIRE];
+
+	if (sk->af != AF_INET)
+		return (0);
+
+	SLIST_FOREACH(sc, &pflowif_list, sc_next) {
+		export_pflow_if(st, sc);
+	}
+
+	return (0);
+}
+
+int
+export_pflow_if(struct pf_state *st, struct pflow_softc *sc)
+{
+	struct pf_state		 pfs_copy;
+	struct ifnet		*ifp = &sc->sc_if;
+	u_int64_t		 bytes[2];
+	int			 ret = 0;
+
+	if (!(ifp->if_flags & IFF_RUNNING))
+		return (0);
+
+	if ((st->bytes[0] < (u_int64_t)PFLOW_MAXBYTES)
+	    && (st->bytes[1] < (u_int64_t)PFLOW_MAXBYTES))
+		return (pflow_pack_flow(st, sc));
+
+	/* flow > PFLOW_MAXBYTES need special handling */
+	bcopy(st, &pfs_copy, sizeof(pfs_copy));
+	bytes[0] = pfs_copy.bytes[0];
+	bytes[1] = pfs_copy.bytes[1];
+
+	while (bytes[0] > PFLOW_MAXBYTES) {
+		pfs_copy.bytes[0] = PFLOW_MAXBYTES;
+		pfs_copy.bytes[1] = 0;
+
+		if ((ret = pflow_pack_flow(&pfs_copy, sc)) != 0)
+			return (ret);
+		if ((bytes[0] - PFLOW_MAXBYTES) > 0)
+			bytes[0] -= PFLOW_MAXBYTES;
+	}
+
+	while (bytes[1] > (u_int64_t)PFLOW_MAXBYTES) {
+		pfs_copy.bytes[1] = PFLOW_MAXBYTES;
+		pfs_copy.bytes[0] = 0;
+
+		if ((ret = pflow_pack_flow(&pfs_copy, sc)) != 0)
+			return (ret);
+		if ((bytes[1] - PFLOW_MAXBYTES) > 0)
+			bytes[1] -= PFLOW_MAXBYTES;
+	}
+
+	pfs_copy.bytes[0] = bytes[0];
+	pfs_copy.bytes[1] = bytes[1];
+
+	return (pflow_pack_flow(&pfs_copy, sc));
+}
+
+int
+copy_flow_to_m(struct pflow_flow *flow, struct pflow_softc *sc)
+{
+	int		s, ret = 0;
+
+	s = splnet();
+	if (sc->sc_mbuf == NULL) {
+		if ((sc->sc_mbuf = pflow_get_mbuf(sc)) == NULL) {
+			splx(s);
+			return (ENOBUFS);
+		}
+	}
+	m_copyback(sc->sc_mbuf, PFLOW_HDRLEN +
+	    (sc->sc_count * sizeof (struct pflow_flow)),
+	    sizeof (struct pflow_flow), flow);
+
+	if (pflowstats.pflow_flows == sc->sc_gcounter)
+		pflowstats.pflow_flows++;
+	sc->sc_gcounter++;
+	sc->sc_count++;
+
+	if (sc->sc_count >= sc->sc_maxcount)
+		ret = pflow_sendout(sc);
+
+	splx(s);
+	return(ret);
+}
+
+int
+pflow_pack_flow(struct pf_state *st, struct pflow_softc *sc)
+{
+	struct pflow_flow	 flow1;
+	struct pflow_flow	 flow2;
+	int			 ret = 0;
+
+	bzero(&flow1, sizeof(flow1));
+	bzero(&flow2, sizeof(flow2));
+
+	if (st->direction == PF_OUT)
+		copy_flow_data(&flow1, &flow2, st, 1, 0);
+	else
+		copy_flow_data(&flow1, &flow2, st, 0, 1);
+
+	if (st->bytes[0] != 0) /* first flow from state */
+		ret = copy_flow_to_m(&flow1, sc);
+
+	if (st->bytes[1] != 0) /* second flow from state */
+		ret = copy_flow_to_m(&flow2, sc);
+
+	return (ret);
+}
+
+void
+pflow_timeout(void *v)
+{
+	struct pflow_softc	*sc = v;
+	int			 s;
+
+	s = splnet();
+	pflow_sendout(sc);
+	splx(s);
+}
+
+/* This must be called in splnet() */
+int
+pflow_sendout(struct pflow_softc *sc)
+{
+	struct mbuf		*m = sc->sc_mbuf;
+	struct pflow_header	*h;
+	struct ifnet		*ifp = &sc->sc_if;
+
+	timeout_del(&sc->sc_tmo);
+
+	if (m == NULL)
+		return (0);
+
+	sc->sc_mbuf = NULL;
+	if (!(ifp->if_flags & IFF_RUNNING)) {
+		m_freem(m);
+		return (0);
+	}
+
+	pflowstats.pflow_packets++;
+	h = mtod(m, struct pflow_header *);
+	h->count = htons(sc->sc_count);
+
+	/* populate pflow_header */
+	h->uptime_ms = htonl(time_uptime * 1000);
+	h->time_sec = htonl(time_second);
+	h->time_nanosec = htonl(ticks);
+
+	return (pflow_sendout_mbuf(sc, m));
+}
+
+int
+pflow_sendout_mbuf(struct pflow_softc *sc, struct mbuf *m)
+{
+	struct udpiphdr	*ui;
+	u_int16_t	 len = m->m_pkthdr.len;
+	struct ifnet	*ifp = &sc->sc_if;
+	struct ip	*ip;
+	int		 err;
+
+	/* UDP Header*/
+	M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT);
+	if (m == NULL) {
+		pflowstats.pflow_onomem++;
+		return (ENOBUFS);
+	}
+
+	ui = mtod(m, struct udpiphdr *);
+	ui->ui_pr = IPPROTO_UDP;
+	ui->ui_src = sc->sc_sender_ip;
+	ui->ui_sport = sc->sc_sender_port;
+	ui->ui_dst = sc->sc_receiver_ip;
+	ui->ui_dport = sc->sc_receiver_port;
+	ui->ui_ulen = htons(sizeof (struct udphdr) + len);
+
+	ip = (struct ip *)ui;
+	ip->ip_v = IPVERSION;
+	ip->ip_hl = sizeof(struct ip) >> 2;
+	ip->ip_id = htons(ip_randomid());
+	ip->ip_off = htons(IP_DF);
+	ip->ip_tos = IPTOS_LOWDELAY;
+	ip->ip_ttl = IPDEFTTL;
+	ip->ip_len = htons(sizeof (struct udpiphdr) + len);
+
+	/*
+	 * Compute the pseudo-header checksum; defer further checksumming
+	 * until ip_output() or hardware (if it exists).
+	 */
+	m->m_pkthdr.csum_flags |= M_UDPV4_CSUM_OUT;
+	ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,
+	    ui->ui_dst.s_addr, htons(len + sizeof(struct udphdr) +
+	    IPPROTO_UDP));
+
+#if NBPFILTER > 0
+	if (ifp->if_bpf) {
+		ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
+		bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
+	}
+#endif
+
+	sc->sc_if.if_opackets++;
+	sc->sc_if.if_obytes += m->m_pkthdr.len;
+
+	if ((err = ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL))) {
+		pflowstats.pflow_oerrors++;
+		sc->sc_if.if_oerrors++;
+	}
+	return (err);
+}
+
+int
+pflow_get_dynport(void)
+{
+	u_int16_t	tmp, low, high, cut;
+
+	low = ipport_hifirstauto;     /* sysctl */
+	high = ipport_hilastauto;
+
+	cut = arc4random_uniform(1 + high - low) + low;
+
+	for (tmp = cut; tmp <= high; ++(tmp)) {
+		if (!in_baddynamic(tmp, IPPROTO_UDP))
+			return (htons(tmp));
+	}
+
+	for (tmp = cut - 1; tmp >= low; --(tmp)) {
+		if (!in_baddynamic(tmp, IPPROTO_UDP))
+			return (htons(tmp));
+	}
+
+	return (htons(ipport_hilastauto)); /* XXX */
+}
+
+int
+pflow_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
+    void *newp, size_t newlen)
+{
+	if (namelen != 1)
+		return (ENOTDIR);
+
+	switch (name[0]) {
+	case NET_PFLOW_STATS:
+		if (newp != NULL)
+			return (EPERM);
+		return (sysctl_struct(oldp, oldlenp, newp, newlen,
+		    &pflowstats, sizeof(pflowstats)));
+	default:
+		return (EOPNOTSUPP);
+	}
+	return (0);
+}

Added: vendor-sys/pf/dist/net/if_pflow.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor-sys/pf/dist/net/if_pflow.h	Tue Aug 18 16:13:59 2009	(r196360)
@@ -0,0 +1,120 @@
+/*	$OpenBSD: if_pflow.h,v 1.4 2009/01/03 21:47:32 gollo Exp $	*/
+
+/*
+ * Copyright (c) 2008 Henning Brauer 
+ * Copyright (c) 2008 Joerg Goltermann 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NET_IF_PFLOW_H_
+#define _NET_IF_PFLOW_H_
+
+#define PFLOW_ID_LEN	sizeof(u_int64_t)
+
+#define PFLOW_MAXFLOWS 30
+#define PFLOW_VERSION 5
+#define PFLOW_ENGINE_TYPE 42
+#define PFLOW_ENGINE_ID 42
+#define PFLOW_MAXBYTES 0xffffffff
+#define PFLOW_TIMEOUT 30
+
+struct pflow_flow {
+	u_int32_t	src_ip;
+	u_int32_t	dest_ip;
+	u_int32_t	nexthop_ip;
+	u_int16_t	if_index_in;
+	u_int16_t	if_index_out;
+	u_int32_t	flow_packets;
+	u_int32_t	flow_octets;
+	u_int32_t	flow_start;
+	u_int32_t	flow_finish;
+	u_int16_t	src_port;
+	u_int16_t	dest_port;
+	u_int8_t	pad1;
+	u_int8_t	tcp_flags;
+	u_int8_t	protocol;
+	u_int8_t	tos;
+	u_int16_t	src_as;
+	u_int16_t	dest_as;
+	u_int8_t	src_mask;
+	u_int8_t	dest_mask;
+	u_int16_t	pad2;
+} __packed;
+
+#ifdef _KERNEL
+
+extern int pflow_ok;
+
+struct pflow_softc {
+	struct ifnet		 sc_if;
+	struct ifnet		*sc_pflow_ifp;
+
+	unsigned int		 sc_count;
+	unsigned int		 sc_maxcount;
+	u_int64_t		 sc_gcounter;
+	struct ip_moptions	 sc_imo;
+	struct timeout		 sc_tmo;
+	struct in_addr		 sc_sender_ip;
+	u_int16_t		 sc_sender_port;
+	struct in_addr		 sc_receiver_ip;
+	u_int16_t		 sc_receiver_port;
+	struct mbuf		*sc_mbuf;	/* current cumulative mbuf */
+	SLIST_ENTRY(pflow_softc) sc_next;
+};
+
+extern struct pflow_softc	*pflowif;
+
+#endif /* _KERNEL */
+
+struct pflow_header {
+	u_int16_t	version;
+	u_int16_t	count;
+	u_int32_t	uptime_ms;
+	u_int32_t	time_sec;
+	u_int32_t	time_nanosec;
+	u_int32_t	flow_sequence;
+	u_int8_t	engine_type;
+	u_int8_t	engine_id;
+	u_int8_t	reserved1;
+	u_int8_t	reserved2;
+} __packed;
+
+#define PFLOW_HDRLEN sizeof(struct pflow_header)
+
+struct pflowstats {
+	u_int64_t	pflow_flows;
+	u_int64_t	pflow_packets;
+	u_int64_t	pflow_onomem;
+	u_int64_t	pflow_oerrors;
+};
+
+/*
+ * Configuration structure for SIOCSETPFLOW SIOCGETPFLOW
+ */
+struct pflowreq {
+	struct in_addr		sender_ip;
+	struct in_addr		receiver_ip;
+	u_int16_t		receiver_port;
+	u_int16_t		addrmask;
+#define PFLOW_MASK_SRCIP	0x01
+#define PFLOW_MASK_DSTIP	0x02
+#define PFLOW_MASK_DSTPRT	0x04
+};
+
+#ifdef _KERNEL
+int export_pflow(struct pf_state *);
+int pflow_sysctl(int *, u_int,  void *, size_t *, void *, size_t);
+#endif /* _KERNEL */
+
+#endif /* _NET_IF_PFLOW_H_ */

Modified: vendor-sys/pf/dist/net/if_pfsync.c
==============================================================================
--- vendor-sys/pf/dist/net/if_pfsync.c	Tue Aug 18 14:00:25 2009	(r196359)
+++ vendor-sys/pf/dist/net/if_pfsync.c	Tue Aug 18 16:13:59 2009	(r196360)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: if_pfsync.c,v 1.98 2008/06/29 08:42:15 mcbride Exp $	*/
+/*	$OpenBSD: if_pfsync.c,v 1.110 2009/02/24 05:39:19 dlg Exp $	*/
 
 /*
  * Copyright (c) 2002 Michael Shalayeff
@@ -26,6 +26,21 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Copyright (c) 2009 David Gwynne 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
 
 #include 
 #include 
@@ -37,16 +52,17 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #ifdef	INET
 #include 
@@ -70,15 +86,132 @@
 #include "bpfilter.h"
 #include "pfsync.h"
 
-#define PFSYNC_MINMTU	\
-    (sizeof(struct pfsync_header) + sizeof(struct pf_state))
+#define PFSYNC_MINPKT ( \
+	sizeof(struct ip) + \
+	sizeof(struct pfsync_header) + \
+	sizeof(struct pfsync_subheader) + \
+	sizeof(struct pfsync_eof))
 
-#ifdef PFSYNCDEBUG
-#define DPRINTF(x)    do { if (pfsyncdebug) printf x ; } while (0)
-int pfsyncdebug;
-#else
-#define DPRINTF(x)
-#endif
+struct pfsync_pkt {
+	struct ip *ip;
+	struct in_addr src;
+	u_int8_t flags;
+};
+
+int	pfsync_input_hmac(struct mbuf *, int);
+
+int	pfsync_upd_tcp(struct pf_state *, struct pfsync_state_peer *,
+	    struct pfsync_state_peer *);
+
+int	pfsync_in_clr(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_ins(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_iack(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_upd(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_upd_c(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_ureq(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_del(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_del_c(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_bus(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_tdb(struct pfsync_pkt *, struct mbuf *, int, int);
+int	pfsync_in_eof(struct pfsync_pkt *, struct mbuf *, int, int);
+
+int	pfsync_in_error(struct pfsync_pkt *, struct mbuf *, int, int);
+
+int	(*pfsync_acts[])(struct pfsync_pkt *, struct mbuf *, int, int) = {
+	pfsync_in_clr,			/* PFSYNC_ACT_CLR */
+	pfsync_in_ins,			/* PFSYNC_ACT_INS */
+	pfsync_in_iack,			/* PFSYNC_ACT_INS_ACK */
+	pfsync_in_upd,			/* PFSYNC_ACT_UPD */
+	pfsync_in_upd_c,		/* PFSYNC_ACT_UPD_C */
+	pfsync_in_ureq,			/* PFSYNC_ACT_UPD_REQ */
+	pfsync_in_del,			/* PFSYNC_ACT_DEL */
+	pfsync_in_del_c,		/* PFSYNC_ACT_DEL_C */
+	pfsync_in_error,		/* PFSYNC_ACT_INS_F */
+	pfsync_in_error,		/* PFSYNC_ACT_DEL_F */
+	pfsync_in_bus,			/* PFSYNC_ACT_BUS */
+	pfsync_in_tdb,			/* PFSYNC_ACT_TDB */
+	pfsync_in_eof			/* PFSYNC_ACT_EOF */
+};
+
+struct pfsync_q {
+	int		(*write)(struct pf_state *, struct mbuf *, int);
+	size_t		len;
+	u_int8_t	action;
+};
+
+/* we have one of these for every PFSYNC_S_ */
+int	pfsync_out_state(struct pf_state *, struct mbuf *, int);
+int	pfsync_out_iack(struct pf_state *, struct mbuf *, int);
+int	pfsync_out_upd_c(struct pf_state *, struct mbuf *, int);
+int	pfsync_out_del(struct pf_state *, struct mbuf *, int);
+
+struct pfsync_q pfsync_qs[] = {
+	{ pfsync_out_state, sizeof(struct pfsync_state),   PFSYNC_ACT_INS },
+	{ pfsync_out_iack,  sizeof(struct pfsync_ins_ack), PFSYNC_ACT_INS_ACK },
+	{ pfsync_out_state, sizeof(struct pfsync_state),   PFSYNC_ACT_UPD },
+	{ pfsync_out_upd_c, sizeof(struct pfsync_upd_c),   PFSYNC_ACT_UPD_C },
+	{ pfsync_out_del,   sizeof(struct pfsync_del_c),   PFSYNC_ACT_DEL_C }
+};
+
+void	pfsync_q_ins(struct pf_state *, int);
+void	pfsync_q_del(struct pf_state *);
+
+struct pfsync_upd_req_item {
+	TAILQ_ENTRY(pfsync_upd_req_item)	ur_entry;
+	struct pfsync_upd_req			ur_msg;
+};
+TAILQ_HEAD(pfsync_upd_reqs, pfsync_upd_req_item);
+
+struct pfsync_deferral {
+	TAILQ_ENTRY(pfsync_deferral)		 pd_entry;
+	struct pf_state				*pd_st;
+	struct mbuf				*pd_m;
+	struct timeout				 pd_tmo;
+};
+TAILQ_HEAD(pfsync_deferrals, pfsync_deferral);
+
+#define PFSYNC_PLSIZE	MAX(sizeof(struct pfsync_upd_req_item), \
+			    sizeof(struct pfsync_deferral))
+
+int	pfsync_out_tdb(struct tdb *, struct mbuf *, int);
+
+struct pfsync_softc {
+	struct ifnet		 sc_if;
+	struct ifnet		*sc_sync_if;
+
+	struct pool		 sc_pool;
+
+	struct ip_moptions	 sc_imo;
+
+	struct in_addr		 sc_sync_peer;
+	u_int8_t		 sc_maxupdates;
+
+	struct ip		 sc_template;
+
+	struct pf_state_queue	 sc_qs[PFSYNC_S_COUNT];
+	size_t			 sc_len;
+
+	struct pfsync_upd_reqs	 sc_upd_req_list;
+
+	struct pfsync_deferrals	 sc_deferrals;
+	u_int			 sc_deferred;
+
+	void			*sc_plus;
+	size_t			 sc_pluslen;
+
+	u_int32_t		 sc_ureq_sent;
+	int			 sc_bulk_tries;
+	struct timeout		 sc_bulkfail_tmo;
+
+	u_int32_t		 sc_ureq_received;
+	struct pf_state		*sc_bulk_next;
+	struct pf_state		*sc_bulk_last;
+	struct timeout		 sc_bulk_tmo;
+
+	TAILQ_HEAD(, tdb)	 sc_tdb_q;
+
+	struct timeout		 sc_tmo;
+};
 
 struct pfsync_softc	*pfsyncif = NULL;
 struct pfsyncstats	 pfsyncstats;
@@ -86,7 +219,6 @@ struct pfsyncstats	 pfsyncstats;
 void	pfsyncattach(int);
 int	pfsync_clone_create(struct if_clone *, int);
 int	pfsync_clone_destroy(struct ifnet *);
-void	pfsync_setmtu(struct pfsync_softc *, int);
 int	pfsync_alloc_scrub_memory(struct pfsync_state_peer *,
 	    struct pf_state_peer *);
 void	pfsync_update_net_tdb(struct pfsync_tdb *);
@@ -95,17 +227,31 @@ int	pfsyncoutput(struct ifnet *, struct 
 int	pfsyncioctl(struct ifnet *, u_long, caddr_t);
 void	pfsyncstart(struct ifnet *);
 
-struct mbuf *pfsync_get_mbuf(struct pfsync_softc *, u_int8_t, void **);
-int	pfsync_request_update(struct pfsync_state_upd *, struct in_addr *);
-int	pfsync_sendout(struct pfsync_softc *);
+struct mbuf *pfsync_if_dequeue(struct ifnet *);
+struct mbuf *pfsync_get_mbuf(struct pfsync_softc *);
+
+void	pfsync_deferred(struct pf_state *, int);
+void	pfsync_undefer(struct pfsync_deferral *, int);
+void	pfsync_defer_tmo(void *);
+
+void	pfsync_request_update(u_int32_t, u_int64_t);
+void	pfsync_update_state_req(struct pf_state *);
+
+void	pfsync_drop(struct pfsync_softc *);
+void	pfsync_sendout(void);
+void	pfsync_send_plus(void *, size_t);
 int	pfsync_tdb_sendout(struct pfsync_softc *);
 int	pfsync_sendout_mbuf(struct pfsync_softc *, struct mbuf *);
 void	pfsync_timeout(void *);
 void	pfsync_tdb_timeout(void *);
 void	pfsync_send_bus(struct pfsync_softc *, u_int8_t);
+
+void	pfsync_bulk_start(void);
+void	pfsync_bulk_status(u_int8_t);
 void	pfsync_bulk_update(void *);
-void	pfsync_bulkfail(void *);
+void	pfsync_bulk_fail(void *);
 
+#define PFSYNC_MAX_BULKTRIES	12
 int	pfsync_sync_ok;
 
 struct if_clone	pfsync_cloner =
@@ -119,46 +265,52 @@ pfsyncattach(int npfsync)
 int
 pfsync_clone_create(struct if_clone *ifc, int unit)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:16:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE8FD106568E;
	Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8201A8FC52;
	Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGGmTh022133;
	Tue, 18 Aug 2009 16:16:48 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGGm11022132;
	Tue, 18 Aug 2009 16:16:48 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181616.n7IGGm11022132@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196361 - vendor-sys/pf/4.5 vendor/pf/4.5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:16:48 -0000

Author: mlaier
Date: Tue Aug 18 16:16:48 2009
New Revision: 196361
URL: http://svn.freebsd.org/changeset/base/196361

Log:
  Tag for pf 4.5

Added:
  vendor/pf/4.5/
     - copied from r196360, vendor/pf/dist/

Changes in other areas also in this revision:
Added:
  vendor-sys/pf/4.5/
     - copied from r196360, vendor-sys/pf/dist/

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:16:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE5951065690;
	Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A17268FC55;
	Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGGmDo022138;
	Tue, 18 Aug 2009 16:16:48 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGGmae022137;
	Tue, 18 Aug 2009 16:16:48 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181616.n7IGGmae022137@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:16:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196361 - vendor-sys/pf/4.5 vendor/pf/4.5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:16:48 -0000

Author: mlaier
Date: Tue Aug 18 16:16:48 2009
New Revision: 196361
URL: http://svn.freebsd.org/changeset/base/196361

Log:
  Tag for pf 4.5

Added:
  vendor-sys/pf/4.5/
     - copied from r196360, vendor-sys/pf/dist/

Changes in other areas also in this revision:
Added:
  vendor/pf/4.5/
     - copied from r196360, vendor/pf/dist/

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:21:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DCA8106568D;
	Tue, 18 Aug 2009 16:21:08 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A8578FC60;
	Tue, 18 Aug 2009 16:21:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGL8lZ022261;
	Tue, 18 Aug 2009 16:21:08 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGL8LU022259;
	Tue, 18 Aug 2009 16:21:08 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181621.n7IGL8LU022259@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:21:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196362 - vendor-sys/pf/dist/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:21:08 -0000

Author: mlaier
Date: Tue Aug 18 16:21:07 2009
New Revision: 196362
URL: http://svn.freebsd.org/changeset/base/196362

Log:
  Import 4.5-002 fix

Modified:
  vendor-sys/pf/dist/net/pf.c

Modified: vendor-sys/pf/dist/net/pf.c
==============================================================================
--- vendor-sys/pf/dist/net/pf.c	Tue Aug 18 16:16:48 2009	(r196361)
+++ vendor-sys/pf/dist/net/pf.c	Tue Aug 18 16:21:07 2009	(r196362)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pf.c,v 1.633 2009/02/16 00:31:25 dlg Exp $ */
+/*	$OpenBSD: pf.c,v 1.634 2009/02/27 12:37:45 henning Exp $ */
 
 /*
  * Copyright (c) 2001 Daniel Hartmeier
@@ -5243,6 +5243,15 @@ pf_test(int dir, struct ifnet *ifp, stru
 		break;
 	}
 
+#ifdef INET6
+	case IPPROTO_ICMPV6: {
+		action = PF_DROP;
+		DPFPRINTF(PF_DEBUG_MISC,
+		    ("pf: dropping IPv4 packet with ICMPv6 payload\n"));
+		goto done;
+	}
+#endif
+
 	default:
 		action = pf_test_state_other(&s, dir, kif, m, &pd);
 		if (action == PF_PASS) {
@@ -5597,6 +5606,13 @@ pf_test6(int dir, struct ifnet *ifp, str
 		break;
 	}
 
+	case IPPROTO_ICMP: {
+		action = PF_DROP;
+		DPFPRINTF(PF_DEBUG_MISC,
+		    ("pf: dropping IPv6 packet with ICMPv4 payload\n"));
+		goto done;
+	}
+
 	case IPPROTO_ICMPV6: {
 		struct icmp6_hdr	ih;
 

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 16:23:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02A6E106568D;
	Tue, 18 Aug 2009 16:23:10 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA7718FC57;
	Tue, 18 Aug 2009 16:23:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IGN9xv022348;
	Tue, 18 Aug 2009 16:23:09 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IGN9PT022347;
	Tue, 18 Aug 2009 16:23:09 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908181623.n7IGN9PT022347@svn.freebsd.org>
From: Max Laier 
Date: Tue, 18 Aug 2009 16:23:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor-sys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196363 - vendor-sys/pf/4.5.002
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 16:23:10 -0000

Author: mlaier
Date: Tue Aug 18 16:23:09 2009
New Revision: 196363
URL: http://svn.freebsd.org/changeset/base/196363

Log:
  Tag for pf 4.5.002 (named after OpenBSD errata numbering)

Added:
  vendor-sys/pf/4.5.002/
     - copied from r196362, vendor-sys/pf/dist/

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 18:06:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7226106568D;
	Tue, 18 Aug 2009 18:06:19 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from mail-fx0-f205.google.com (mail-fx0-f205.google.com
	[209.85.220.205])
	by mx1.freebsd.org (Postfix) with ESMTP id C86778FC15;
	Tue, 18 Aug 2009 18:06:18 +0000 (UTC)
Received: by fxm1 with SMTP id 1so2994805fxm.7
	for ; Tue, 18 Aug 2009 11:06:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:date:x-google-sender-auth:message-id:subject:from:to:cc
	:content-type:content-transfer-encoding;
	bh=4V7vCwtuuG7eBIlew+dJ3Xev9Kk64X+RKI00D0ibqGE=;
	b=xG4P/cgEE92AIyHm0U9sfsv9tC1pRnhrtfN2OR4uirl1zW3RDamhNi63ZH+n3SrtRZ
	oGXNGnB9YQHcGlVk5+XwOYuzx+Lz5zC6m3IsrITA4k+TrgvmVttwzEHr15fJuhPnvjvu
	ly0d8Idw6ID2QalIDB6u1Hzs8FafiN9zkic8M=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=UxPJoZrbHZUm+fodSS/WtiZ/tB/mP7shbBi/0mAZMcJXDL93nJdMX5vbQWaK2cWCu7
	pw6ILkTS2Dh3VzYZzN0dgAaME6jACpBORPpA7uBKuX9U1qciUYGe/VtkImi7VXQHIsQh
	RN77EdWSSHaB1InLH5VABei5FqSubeXrysX7Y=
MIME-Version: 1.0
Sender: asmrookie@gmail.com
Received: by 10.223.54.15 with SMTP id o15mr1353745fag.96.1250618777542; Tue, 
	18 Aug 2009 11:06:17 -0700 (PDT)
In-Reply-To: <4A8AC814.2070804@errno.com>
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
Date: Tue, 18 Aug 2009 20:06:17 +0200
X-Google-Sender-Auth: 40894ae4b0256d66
Message-ID: <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
From: Attilio Rao 
To: Sam Leffler 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Pawel Jakub Dawidek 
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 18:06:19 -0000

2009/8/18 Sam Leffler :
> Pawel Jakub Dawidek wrote:
>>
>> Author: pjd
>> Date: Tue Aug 18 13:55:48 2009
>> New Revision: 196358
>> URL: http://svn.freebsd.org/changeset/base/196358
>>
>> Log:
>>  Remove unused taskqueue_find() function.
>>    Reviewed by:  dfr
>>  Approved by:  re (kib)
>
> I don't understand why this should be removed (let alone during a code
> freeze).  I can think of several uses for this function including a ddb cmd
> that takes a taskq name and dumps it's contents.  The overhead of
> maintaining the global list appears minimal.

FWIW, I agree with Sam.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 18:39:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 72D83106564A;
	Tue, 18 Aug 2009 18:39:04 +0000 (UTC)
	(envelope-from pjd@garage.freebsd.pl)
Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl
	[87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id A1B958FC61;
	Tue, 18 Aug 2009 18:39:03 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id ADCB445CAC; Tue, 18 Aug 2009 20:39:01 +0200 (CEST)
Received: from localhost (chello087206049004.chello.pl [87.206.49.4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 52B8A45B36;
	Tue, 18 Aug 2009 20:38:56 +0200 (CEST)
Date: Tue, 18 Aug 2009 20:38:58 +0200
From: Pawel Jakub Dawidek 
To: Attilio Rao 
Message-ID: <20090818183858.GB1794@garage.freebsd.pl>
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="LyciRD1jyfeSSjG0"
Content-Disposition: inline
In-Reply-To: <3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 8.0-CURRENT i386
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL 
	autolearn=no version=3.0.4
Cc: svn-src-head@freebsd.org, Sam Leffler ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 18:39:04 -0000


--LyciRD1jyfeSSjG0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 18, 2009 at 08:06:17PM +0200, Attilio Rao wrote:
> 2009/8/18 Sam Leffler :
> > Pawel Jakub Dawidek wrote:
> >>
> >> Author: pjd
> >> Date: Tue Aug 18 13:55:48 2009
> >> New Revision: 196358
> >> URL: http://svn.freebsd.org/changeset/base/196358
> >>
> >> Log:
> >>  Remove unused taskqueue_find() function.
> >>    Reviewed by:  dfr
> >>  Approved by:  re (kib)
> >
> > I don't understand why this should be removed (let alone during a code
> > freeze).  I can think of several uses for this function including a ddb=
 cmd
> > that takes a taskq name and dumps it's contents.  The overhead of
> > maintaining the global list appears minimal.
>=20
> FWIW, I agree with Sam.

The only use I could think of was exactly what Sam suggested - a DDB
command and that was the only possible use I found.

I decided to propose removal of this KPI, because nobody decided to use
it for more than 9 years now and this is a good thing to remove unused
code, no?

I won't fight for keeping it removed, really. If after 9 years someone
will find it useful I'm all for bringing it back.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--LyciRD1jyfeSSjG0
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKivVCForvXbEpPzQRAoqJAJ4u8fVeJVh08zqneE0sYBzhgpl9AQCfcMQe
QhRMxxmXyuFpva5xdJsNs98=
=xyEE
-----END PGP SIGNATURE-----

--LyciRD1jyfeSSjG0--

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 18:45:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C41FB1065691
	for ; Tue, 18 Aug 2009 18:45:38 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F46B8FC66
	for ; Tue, 18 Aug 2009 18:45:38 +0000 (UTC)
Received: (qmail 11773 invoked by uid 399); 18 Aug 2009 18:45:33 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 18 Aug 2009 18:45:33 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A8AF6C7.5010707@FreeBSD.org>
Date: Tue, 18 Aug 2009 11:45:27 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.22 (X11/20090729)
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
	<20090818183858.GB1794@garage.freebsd.pl>
In-Reply-To: <20090818183858.GB1794@garage.freebsd.pl>
X-Enigmail-Version: 0.95.7
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Attilio Rao , Sam Leffler ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	svn-src-head@freebsd.org
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 18:45:38 -0000

Pawel Jakub Dawidek wrote:

> The only use I could think of was exactly what Sam suggested - a DDB
> command and that was the only possible use I found.
> 
> I decided to propose removal of this KPI, because nobody decided to use
> it for more than 9 years now and this is a good thing to remove unused
> code, no?

Not during a freeze/right before a release, no.


Doug

-- 

    This .signature sanitized for your protection


From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 19:58:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D894106568C;
	Tue, 18 Aug 2009 19:58:50 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B7B98FC67;
	Tue, 18 Aug 2009 19:58:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IJwowM026752;
	Tue, 18 Aug 2009 19:58:50 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IJwnXP026751;
	Tue, 18 Aug 2009 19:58:49 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200908181958.n7IJwnXP026751@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 18 Aug 2009 19:58:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196364 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 19:58:50 -0000

Author: tuexen
Date: Tue Aug 18 19:58:49 2009
New Revision: 196364
URL: http://svn.freebsd.org/changeset/base/196364

Log:
  Fix a crash when using one-to-one stlye socket in non-blocking
  mode and there is no listening server.
  PR: 137795
  Approved by: re, rrs (mentor)
  MFC after:immediately.

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Tue Aug 18 16:23:09 2009	(r196363)
+++ head/sys/netinet/sctp_output.c	Tue Aug 18 19:58:49 2009	(r196364)
@@ -12464,7 +12464,8 @@ sctp_lower_sosend(struct socket *so,
 			error = ENOTCONN;
 			goto out_unlocked;
 		}
-		hold_tcblock = 0;
+		SCTP_TCB_LOCK(stcb);
+		hold_tcblock = 1;
 		SCTP_INP_RUNLOCK(inp);
 		if (addr) {
 			/* Must locate the net structure if addr given */

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:00:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69DF9106568B;
	Tue, 18 Aug 2009 20:00:15 +0000 (UTC)
	(envelope-from pjd@garage.freebsd.pl)
Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl
	[87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 7A1D38FC51;
	Tue, 18 Aug 2009 20:00:13 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id 7AFE145CDD; Tue, 18 Aug 2009 22:00:12 +0200 (CEST)
Received: from localhost (chello087206049004.chello.pl [87.206.49.4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 6627A45B36;
	Tue, 18 Aug 2009 22:00:07 +0200 (CEST)
Date: Tue, 18 Aug 2009 22:00:08 +0200
From: Pawel Jakub Dawidek 
To: Doug Barton 
Message-ID: <20090818200008.GC1794@garage.freebsd.pl>
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
	<20090818183858.GB1794@garage.freebsd.pl>
	<4A8AF6C7.5010707@FreeBSD.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="jy6Sn24JjFx/iggw"
Content-Disposition: inline
In-Reply-To: <4A8AF6C7.5010707@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 8.0-CURRENT i386
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL 
	autolearn=no version=3.0.4
Cc: Attilio Rao , Sam Leffler ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	svn-src-head@freebsd.org
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:00:15 -0000


--jy6Sn24JjFx/iggw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 18, 2009 at 11:45:27AM -0700, Doug Barton wrote:
> Pawel Jakub Dawidek wrote:
>=20
> > The only use I could think of was exactly what Sam suggested - a DDB
> > command and that was the only possible use I found.
> >=20
> > I decided to propose removal of this KPI, because nobody decided to use
> > it for more than 9 years now and this is a good thing to remove unused
> > code, no?
>=20
> Not during a freeze/right before a release, no.

Then when? Between 8.3 and 8.4 when some 3rd party modules start to use it?

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--jy6Sn24JjFx/iggw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKiwhIForvXbEpPzQRAgRfAKDOwNbSwnMU07ahwk9alEUibeHWQQCeMRtl
70to+UyU7c6j7jwEq4I57rQ=
=6mKh
-----END PGP SIGNATURE-----

--jy6Sn24JjFx/iggw--

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:06:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 401C3106568D;
	Tue, 18 Aug 2009 20:06:01 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2BE508FC68;
	Tue, 18 Aug 2009 20:06:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IK602E026956;
	Tue, 18 Aug 2009 20:06:00 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IK605I026954;
	Tue, 18 Aug 2009 20:06:00 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200908182006.n7IK605I026954@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 18 Aug 2009 20:06:00 +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: r196365 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:06:01 -0000

Author: tuexen
Date: Tue Aug 18 20:06:00 2009
New Revision: 196365
URL: http://svn.freebsd.org/changeset/base/196365

Log:
  Fix a panic when using one-to-one style sockets in non-blocking
  mode and there is no listening server.
  PR: 137795
  Approved by: re, rrs (mentor)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/netinet/sctp_output.c

Modified: stable/8/sys/netinet/sctp_output.c
==============================================================================
--- stable/8/sys/netinet/sctp_output.c	Tue Aug 18 19:58:49 2009	(r196364)
+++ stable/8/sys/netinet/sctp_output.c	Tue Aug 18 20:06:00 2009	(r196365)
@@ -12464,7 +12464,8 @@ sctp_lower_sosend(struct socket *so,
 			error = ENOTCONN;
 			goto out_unlocked;
 		}
-		hold_tcblock = 0;
+		SCTP_TCB_LOCK(stcb);
+		hold_tcblock = 1;
 		SCTP_INP_RUNLOCK(inp);
 		if (addr) {
 			/* Must locate the net structure if addr given */

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:14:22 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BCD3B106572F;
	Tue, 18 Aug 2009 20:14:22 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57])
	by mx1.freebsd.org (Postfix) with ESMTP id D6EB98FC15;
	Tue, 18 Aug 2009 20:14:21 +0000 (UTC)
Received: from phobos.local (pooker.samsco.org [168.103.85.57])
	by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n7IKCjuK078183;
	Tue, 18 Aug 2009 14:12:45 -0600 (MDT)
	(envelope-from scottl@samsco.org)
Message-ID: <4A8B0B3C.5060402@samsco.org>
Date: Tue, 18 Aug 2009 14:12:44 -0600
From: Scott Long 
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
	rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
	<20090818183858.GB1794@garage.freebsd.pl>
	<4A8AF6C7.5010707@FreeBSD.org>
	<20090818200008.GC1794@garage.freebsd.pl>
In-Reply-To: <20090818200008.GC1794@garage.freebsd.pl>
X-Enigmail-Version: 0.95.6
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00
	autolearn=ham version=3.1.8
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org
Cc: Doug Barton , svn-src-all@FreeBSD.org,
	Attilio Rao , src-committers@FreeBSD.org,
	svn-src-head@FreeBSD.org, Sam Leffler 
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:14:22 -0000

Pawel Jakub Dawidek wrote:
> On Tue, Aug 18, 2009 at 11:45:27AM -0700, Doug Barton wrote:
>> Pawel Jakub Dawidek wrote:
>>
>>> The only use I could think of was exactly what Sam suggested - a DDB
>>> command and that was the only possible use I found.
>>>
>>> I decided to propose removal of this KPI, because nobody decided to use
>>> it for more than 9 years now and this is a good thing to remove unused
>>> code, no?
>> Not during a freeze/right before a release, no.
> 
> Then when? Between 8.3 and 8.4 when some 3rd party modules start to use it?
> 

Was this code getting in the way of anything?  Why are you so insistent
to ignore advice like this?  Please back this out.  You don't
unilateraly own all APIs that ZFS uses, and I saw no call for discussion
on the taskqueue API.

Scott


From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:20:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05DC31065696;
	Tue, 18 Aug 2009 20:20:16 +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 E7ACF8FC51;
	Tue, 18 Aug 2009 20:20:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IKKFu9027354;
	Tue, 18 Aug 2009 20:20:15 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IKKFtt027352;
	Tue, 18 Aug 2009 20:20:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908182020.n7IKKFtt027352@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 18 Aug 2009 20:20:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196366 - head/sys/dev/mii
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:20:16 -0000

Author: yongari
Date: Tue Aug 18 20:20:15 2009
New Revision: 196366
URL: http://svn.freebsd.org/changeset/base/196366

Log:
  Backout r193289. r193289 restored page select bits to previous
  value instead of blindly resetting it to 0. However, it seems page
  select bits of some 88E1116 PHY is initialized to invalid one such
  that restoring page select bits after programming broke MII
  register access. The correct solution would be reset page select
  bits to 0 in PHY attach stage but it would require more testing.
  Since we're in BETA stage such a change would be dangerous so just
  back it out.
  This change should fix nfe(4) breakage on NVIDIA MCP55.
  
  Reported by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >
  Tested by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >
  Approved by:	re (kib)

Modified:
  head/sys/dev/mii/e1000phy.c

Modified: head/sys/dev/mii/e1000phy.c
==============================================================================
--- head/sys/dev/mii/e1000phy.c	Tue Aug 18 20:06:00 2009	(r196365)
+++ head/sys/dev/mii/e1000phy.c	Tue Aug 18 20:20:15 2009	(r196366)
@@ -240,13 +240,11 @@ e1000phy_reset(struct mii_softc *sc)
 
 		if (esc->mii_model == MII_MODEL_MARVELL_E1116 ||
 		    esc->mii_model == MII_MODEL_MARVELL_E1149) {
-			page = PHY_READ(sc, E1000_EADR);
-			/* Select page 2, MAC specific control register. */
 			PHY_WRITE(sc, E1000_EADR, 2);
 			reg = PHY_READ(sc, E1000_SCR);
 			reg |= E1000_SCR_RGMII_POWER_UP;
 			PHY_WRITE(sc, E1000_SCR, reg);
-			PHY_WRITE(sc, E1000_EADR, page);
+			PHY_WRITE(sc, E1000_EADR, 0);
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:25:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D12B0106568D;
	Tue, 18 Aug 2009 20:25: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 A34908FC3F;
	Tue, 18 Aug 2009 20:25:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IKP2mu027504;
	Tue, 18 Aug 2009 20:25:02 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IKP2Ep027502;
	Tue, 18 Aug 2009 20:25:02 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908182025.n7IKP2Ep027502@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 18 Aug 2009 20:25:02 +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: r196367 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/mii dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:25:02 -0000

Author: yongari
Date: Tue Aug 18 20:25:02 2009
New Revision: 196367
URL: http://svn.freebsd.org/changeset/base/196367

Log:
  MFC r196366:
    Backout r193289. r193289 restored page select bits to previous
    value instead of blindly resetting it to 0. However, it seems page
    select bits of some 88E1116 PHY is initialized to invalid one such
    that restoring page select bits after programming broke MII
    register access. The correct solution would be reset page select
    bits to 0 in PHY attach stage but it would require more testing.
    Since we're in BETA stage such a change would be dangerous so just
    back it out.
    This change should fix nfe(4) breakage on NVIDIA MCP55.
  
    Reported by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >
    Tested by:	Ryan Rogers < webmaster <> doghouserepair dot com >
  		Sam Fourman Jr. < sfourman <> gmail dot com >
    Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/mii/e1000phy.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mii/e1000phy.c
==============================================================================
--- stable/8/sys/dev/mii/e1000phy.c	Tue Aug 18 20:20:15 2009	(r196366)
+++ stable/8/sys/dev/mii/e1000phy.c	Tue Aug 18 20:25:02 2009	(r196367)
@@ -240,13 +240,11 @@ e1000phy_reset(struct mii_softc *sc)
 
 		if (esc->mii_model == MII_MODEL_MARVELL_E1116 ||
 		    esc->mii_model == MII_MODEL_MARVELL_E1149) {
-			page = PHY_READ(sc, E1000_EADR);
-			/* Select page 2, MAC specific control register. */
 			PHY_WRITE(sc, E1000_EADR, 2);
 			reg = PHY_READ(sc, E1000_SCR);
 			reg |= E1000_SCR_RGMII_POWER_UP;
 			PHY_WRITE(sc, E1000_SCR, reg);
-			PHY_WRITE(sc, E1000_EADR, page);
+			PHY_WRITE(sc, E1000_EADR, 0);
 		}
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:28:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 47CE2106568B;
	Tue, 18 Aug 2009 20:28:59 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 346B58FC15;
	Tue, 18 Aug 2009 20:28:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IKSw9C027603;
	Tue, 18 Aug 2009 20:28:58 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IKSwJ9027599;
	Tue, 18 Aug 2009 20:28:58 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200908182028.n7IKSwJ9027599@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 18 Aug 2009 20:28:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196368 - in head/sys: net netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:28:59 -0000

Author: kmacy
Date: Tue Aug 18 20:28:58 2009
New Revision: 196368
URL: http://svn.freebsd.org/changeset/base/196368

Log:
   - change the interface to flowtable_lookup so that we don't rely on
     the mbuf for obtaining the fib index
   - check that a cached flow corresponds to the same fib index as the
     packet for which we are doing the lookup
   - at interface detach time flush any flows referencing stale rtentrys
     associated with the interface that is going away (fixes reported
     panics)
   - reduce the time between cleans in case the cleaner is running at
     the time the eventhandler is called and the wakeup is missed less
     time will elapse before the eventhandler returns
   - separate per-vnet initialization from global initialization
     (pointed out by jeli@)
  
  Reviewed by:	sam@
  Approved by:	re@

Modified:
  head/sys/net/flowtable.c
  head/sys/net/flowtable.h
  head/sys/netinet/ip_output.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Tue Aug 18 20:25:02 2009	(r196367)
+++ head/sys/net/flowtable.c	Tue Aug 18 20:28:58 2009	(r196368)
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "opt_route.h"
 #include "opt_mpath.h"
+#include "opt_ddb.h"
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -36,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include   
 #include 
 #include 
+#include 
 #include 
 #include   
 #include 
@@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 struct ipv4_tuple {
 	uint16_t 	ip_sport;	/* source port */
@@ -94,8 +97,9 @@ union ipv6_flow {
 struct flentry {
 	volatile uint32_t	f_fhash;	/* hash flowing forward */
 	uint16_t		f_flags;	/* flow flags */
-	uint8_t			f_pad;		/* alignment */
+	uint8_t			f_pad;		
 	uint8_t			f_proto;	/* protocol */
+	uint32_t		f_fibnum;	/* fib index */
 	uint32_t		f_uptime;	/* uptime at last access */
 	struct flentry		*f_next;	/* pointer to collision entry */
 	volatile struct rtentry *f_rt;		/* rtentry for flow */
@@ -173,6 +177,10 @@ static VNET_DEFINE(uma_zone_t, flow_ipv6
 #define	V_flow_ipv4_zone	VNET(flow_ipv4_zone)
 #define	V_flow_ipv6_zone	VNET(flow_ipv6_zone)
 
+static struct cv 	flowclean_cv;
+static struct mtx	flowclean_lock;
+static uint32_t		flowclean_cycles;
+
 /*
  * TODO:
  * - Make flowtable stats per-cpu, aggregated at sysctl call time,
@@ -288,10 +296,10 @@ SYSCTL_VNET_PROC(_net_inet_flowtable, OI
 
 #ifndef RADIX_MPATH
 static void
-in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fib)
+in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum)
 {
 
-	rtalloc_ign_fib(ro, 0, fib);
+	rtalloc_ign_fib(ro, 0, fibnum);
 }
 #endif
 
@@ -425,7 +433,7 @@ static bitstr_t *
 flowtable_mask(struct flowtable *ft)
 {
 	bitstr_t *mask;
-	
+
 	if (ft->ft_flags & FL_PCPU)
 		mask = ft->ft_masks[curcpu];
 	else
@@ -501,7 +509,7 @@ flowtable_set_hashkey(struct flentry *fl
 
 static int
 flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key,
-    uint8_t proto, struct route *ro, uint16_t flags)
+    uint8_t proto, uint32_t fibnum, struct route *ro, uint16_t flags)
 {
 	struct flentry *fle, *fletail, *newfle, **flep;
 	int depth;
@@ -564,6 +572,7 @@ skip:
 	fle->f_rt = ro->ro_rt;
 	fle->f_lle = ro->ro_lle;
 	fle->f_fhash = hash;
+	fle->f_fibnum = fibnum;
 	fle->f_uptime = time_uptime;
 	FL_ENTRY_UNLOCK(ft, hash);
 	return (0);
@@ -591,13 +600,13 @@ flowtable_key_equal(struct flentry *fle,
 }
 
 int
-flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro)
+flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum)
 {
 	uint32_t key[9], hash;
 	struct flentry *fle;
 	uint16_t flags;
 	uint8_t proto = 0;
-	int error = 0, fib = 0;
+	int error = 0;
 	struct rtentry *rt;
 	struct llentry *lle;
 
@@ -640,6 +649,7 @@ keycheck:	
 	    && fle->f_fhash == hash
 	    && flowtable_key_equal(fle, key)
 	    && (proto == fle->f_proto)
+	    && (fibnum == fle->f_fibnum)
 	    && (rt->rt_flags & RTF_UP)
 	    && (rt->rt_ifp != NULL)) {
 		V_flowtable_hits++;
@@ -668,10 +678,8 @@ uncached:
 	 * of arpresolve with an rt_check variant that expected to
 	 * receive the route locked
 	 */
-	if (m != NULL)
-		fib = M_GETFIB(m);
 
-	ft->ft_rtalloc(ro, hash, fib);
+	ft->ft_rtalloc(ro, hash, fibnum);
 	if (ro->ro_rt == NULL) 
 		error = ENETUNREACH;
 	else {
@@ -692,7 +700,7 @@ uncached:
 			ro->ro_rt = NULL;
 			return (ENOENT);
 		}
-		error = flowtable_insert(ft, hash, key, proto,
+		error = flowtable_insert(ft, hash, key, proto, fibnum,
 		    ro, flags);
 				
 		if (error) {
@@ -791,35 +799,6 @@ flowtable_alloc(int nentry, int flags)
 	return (ft);
 }
 
-static void
-flowtable_init(const void *unused __unused)
-{
-
-	V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4),
-	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);
-	V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6),
-	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
-	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
-	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
-	V_flowtable_ready = 1;
-}
-
-VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
-    flowtable_init, NULL);
-
-#ifdef VIMAGE
-static void
-flowtable_uninit(const void *unused __unused)
-{
-
-	uma_zdestroy(V_flow_ipv4_zone);
-	uma_zdestroy(V_flow_ipv6_zone);
-}
-
-VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
-    flowtable_uninit, NULL);
-#endif
-
 /*
  * The rest of the code is devoted to garbage collection of expired entries.
  * It is a new additon made necessary by the switch to dynamically allocating
@@ -973,12 +952,30 @@ flowtable_cleaner(void)
 		}
 		VNET_LIST_RUNLOCK();
 
+		flowclean_cycles++;
 		/*
 		 * The 20 second interval between cleaning checks
 		 * is arbitrary
 		 */
-		pause("flowcleanwait", 20*hz);
+		mtx_lock(&flowclean_lock);
+		cv_broadcast(&flowclean_cv);
+		cv_timedwait(&flowclean_cv, &flowclean_lock, 10*hz);
+		mtx_unlock(&flowclean_lock);
+	}
+}
+
+static void
+flowtable_flush(void *unused __unused)
+{
+	uint64_t start;
+	
+	mtx_lock(&flowclean_lock);
+	start = flowclean_cycles;
+	while (start == flowclean_cycles) {
+		cv_broadcast(&flowclean_cv);
+		cv_wait(&flowclean_cv, &flowclean_lock);
 	}
+	mtx_unlock(&flowclean_lock);
 }
 
 static struct kproc_desc flow_kp = {
@@ -988,3 +985,159 @@ static struct kproc_desc flow_kp = {
 };
 SYSINIT(flowcleaner, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start, &flow_kp);
 
+static void
+flowtable_init_vnet(const void *unused __unused)
+{
+
+	V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4),
+	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);
+	V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6),
+	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
+	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
+	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
+}
+VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE,
+    flowtable_init_vnet, NULL);
+
+static void
+flowtable_init(const void *unused __unused)
+{
+
+	cv_init(&flowclean_cv, "flowcleanwait");
+	mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF);
+	EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL,
+	    EVENTHANDLER_PRI_ANY);
+	V_flowtable_ready = 1;
+}
+SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
+    flowtable_init, NULL);
+
+
+#ifdef VIMAGE
+static void
+flowtable_uninit(const void *unused __unused)
+{
+
+	uma_zdestroy(V_flow_ipv4_zone);
+	uma_zdestroy(V_flow_ipv6_zone);
+}
+
+VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
+    flowtable_uninit, NULL);
+#endif
+
+#ifdef DDB
+static bitstr_t *
+flowtable_mask_pcpu(struct flowtable *ft, int cpuid)
+{
+	bitstr_t *mask;
+
+	if (ft->ft_flags & FL_PCPU)
+		mask = ft->ft_masks[cpuid];
+	else
+		mask = ft->ft_masks[0];
+
+	return (mask);
+}
+
+static struct flentry **
+flowtable_entry_pcpu(struct flowtable *ft, uint32_t hash, int cpuid)
+{
+	struct flentry **fle;
+	int index = (hash % ft->ft_size);
+
+	if (ft->ft_flags & FL_PCPU) {
+		fle = &ft->ft_table.pcpu[cpuid][index];
+	} else {
+		fle = &ft->ft_table.global[index];
+	}
+	
+	return (fle);
+}
+
+static void
+flow_show(struct flowtable *ft, struct flentry *fle)
+{
+	int idle_time;
+	int rt_valid;
+
+	idle_time = (int)(time_uptime - fle->f_uptime);
+	rt_valid = fle->f_rt != NULL;
+	db_printf("hash=0x%08x idle_time=%03d rt=%p ifp=%p",
+	    fle->f_fhash, idle_time,
+	    fle->f_rt, rt_valid ? fle->f_rt->rt_ifp : NULL);
+	if (rt_valid && (fle->f_rt->rt_flags & RTF_UP))
+		db_printf(" RTF_UP ");
+	if (fle->f_flags & FL_STALE)
+		db_printf(" FL_STALE ");
+	db_printf("\n");
+}
+
+static void
+flowtable_show(struct flowtable *ft, int cpuid)
+{
+	int curbit = 0;
+	struct flentry *fle,  **flehead;
+	bitstr_t *mask, *tmpmask;
+
+	db_printf("cpu: %d\n", cpuid);
+	mask = flowtable_mask_pcpu(ft, cpuid);
+	tmpmask = ft->ft_tmpmask;
+	memcpy(tmpmask, mask, ft->ft_size/8);
+	/*
+	 * XXX Note to self, bit_ffs operates at the byte level
+	 * and thus adds gratuitous overhead
+	 */
+	bit_ffs(tmpmask, ft->ft_size, &curbit);
+	while (curbit != -1) {
+		if (curbit >= ft->ft_size || curbit < -1) {
+			db_printf("warning: bad curbit value %d \n",
+			    curbit);
+			break;
+		}
+
+		flehead = flowtable_entry_pcpu(ft, curbit, cpuid);
+		fle = *flehead;
+
+		while (fle != NULL) {	
+			flow_show(ft, fle);
+			fle = fle->f_next;
+			continue;
+		}
+		bit_clear(tmpmask, curbit);
+		bit_ffs(tmpmask, ft->ft_size, &curbit);
+	}
+}
+
+static void
+flowtable_show_vnet(void)
+{
+	struct flowtable *ft;
+	int i;
+
+	ft = V_flow_list_head;
+	while (ft != NULL) {
+		if (ft->ft_flags & FL_PCPU) {
+			for (i = 0; i <= mp_maxid; i++) {
+				if (CPU_ABSENT(i))
+					continue;
+				flowtable_show(ft, i);
+			}
+		} else {
+			flowtable_show(ft, 0);
+		}
+		ft = ft->ft_next;
+	}
+}
+
+DB_SHOW_COMMAND(flowtables, db_show_flowtables)
+{
+	VNET_ITERATOR_DECL(vnet_iter);
+
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET(vnet_iter);
+		flowtable_show_vnet();
+		CURVNET_RESTORE();
+	}
+}
+#endif

Modified: head/sys/net/flowtable.h
==============================================================================
--- head/sys/net/flowtable.h	Tue Aug 18 20:25:02 2009	(r196367)
+++ head/sys/net/flowtable.h	Tue Aug 18 20:28:58 2009	(r196368)
@@ -49,7 +49,7 @@ struct flowtable *flowtable_alloc(int ne
  *
  */
 int flowtable_lookup(struct flowtable *ft, struct mbuf *m,
-    struct route *ro);
+    struct route *ro, uint32_t fibnum);
 
 #endif /* _KERNEL */
 #endif

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Tue Aug 18 20:25:02 2009	(r196367)
+++ head/sys/netinet/ip_output.c	Tue Aug 18 20:28:58 2009	(r196368)
@@ -157,7 +157,7 @@ ip_output(struct mbuf *m, struct mbuf *o
 		 * longer than that long for the stability of ro_rt.  The
 		 * flow ID assignment must have happened before this point.
 		 */
-		if (flowtable_lookup(V_ip_ft, m, ro) == 0)
+		if (flowtable_lookup(V_ip_ft, m, ro, M_GETFIB(m)) == 0)
 			nortfree = 1;
 #endif
 	}

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:30:10 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E7B810656BA;
	Tue, 18 Aug 2009 20:30:10 +0000 (UTC)
	(envelope-from pjd@garage.freebsd.pl)
Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl
	[87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 73F2F8FC43;
	Tue, 18 Aug 2009 20:30:09 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id E4BF845E35; Tue, 18 Aug 2009 22:30:07 +0200 (CEST)
Received: from localhost (chello087206049004.chello.pl [87.206.49.4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 2CF6245D8D;
	Tue, 18 Aug 2009 22:30:01 +0200 (CEST)
Date: Tue, 18 Aug 2009 22:30:04 +0200
From: Pawel Jakub Dawidek 
To: Scott Long 
Message-ID: <20090818203004.GF1794@garage.freebsd.pl>
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
	<20090818183858.GB1794@garage.freebsd.pl>
	<4A8AF6C7.5010707@FreeBSD.org>
	<20090818200008.GC1794@garage.freebsd.pl>
	<4A8B0B3C.5060402@samsco.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="1giRMj6yz/+FOIRq"
Content-Disposition: inline
In-Reply-To: <4A8B0B3C.5060402@samsco.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 8.0-CURRENT i386
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL 
	autolearn=no version=3.0.4
Cc: Doug Barton , svn-src-all@FreeBSD.org,
	Attilio Rao , src-committers@FreeBSD.org,
	svn-src-head@FreeBSD.org, Sam Leffler 
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:30:10 -0000


--1giRMj6yz/+FOIRq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 18, 2009 at 02:12:44PM -0600, Scott Long wrote:
> Was this code getting in the way of anything?  Why are you so insistent
> to ignore advice like this?  Please back this out.  You don't
> unilateraly own all APIs that ZFS uses, and I saw no call for discussion
> on the taskqueue API.

1. I don't insist on keeping it removed, as I already stated.
2. I'm not going to back it out (unless requested by re@), I still see
   no use for it. The patch was reviewed by re@ and by the author.
3. This has _NOTHING_ to do with ZFS.

Now, if someone is willing to use this function, eg. by implementing DDB
command that Sam suggested or do _anything_ else useful with it, he is
free to bring it back. If someone wants to bring it back and do nothing
useful with it, then hey, fine by me as well, really.

I see no point to discuss this further.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--1giRMj6yz/+FOIRq
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKiw9MForvXbEpPzQRAkQmAKDkemsvrPhC19YP4vC0fpm9vO7eeACgqDON
3vjYwMfVL/KhJyAKzs/k1dk=
=SnWa
-----END PGP SIGNATURE-----

--1giRMj6yz/+FOIRq--

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:39:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F9B0106568B;
	Tue, 18 Aug 2009 20:39:36 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1B9078FC59;
	Tue, 18 Aug 2009 20:39:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IKdaSK027863;
	Tue, 18 Aug 2009 20:39:36 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IKdZIN027859;
	Tue, 18 Aug 2009 20:39:35 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200908182039.n7IKdZIN027859@svn.freebsd.org>
From: Kip Macy 
Date: Tue, 18 Aug 2009 20:39: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: r196369 - in stable/8/sys: net netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:39:36 -0000

Author: kmacy
Date: Tue Aug 18 20:39:35 2009
New Revision: 196369
URL: http://svn.freebsd.org/changeset/base/196369

Log:
  MFC 196368
    - change the interface to flowtable_lookup so that we don't rely on
      the mbuf for obtaining the fib index
    - check that a cached flow corresponds to the same fib index as the
      packet for which we are doing the lookup
    - at interface detach time flush any flows referencing stale rtentrys
      associated with the interface that is going away (fixes reported
      panics)
    - reduce the time between cleans in case the cleaner is running at
      the time the eventhandler is called and the wakeup is missed less
      time will elapse before the eventhandler returns
    - separate per-vnet initialization from global initialization
      (pointed out by jeli@)
  
  Reviewed by:	sam@
  Approved by:	re@

Modified:
  stable/8/sys/net/flowtable.c
  stable/8/sys/net/flowtable.h
  stable/8/sys/netinet/ip_output.c

Modified: stable/8/sys/net/flowtable.c
==============================================================================
--- stable/8/sys/net/flowtable.c	Tue Aug 18 20:28:58 2009	(r196368)
+++ stable/8/sys/net/flowtable.c	Tue Aug 18 20:39:35 2009	(r196369)
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "opt_route.h"
 #include "opt_mpath.h"
+#include "opt_ddb.h"
 
 #include 
 __FBSDID("$FreeBSD$");
@@ -36,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include   
 #include 
 #include 
+#include 
 #include 
 #include   
 #include 
@@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 struct ipv4_tuple {
 	uint16_t 	ip_sport;	/* source port */
@@ -94,8 +97,9 @@ union ipv6_flow {
 struct flentry {
 	volatile uint32_t	f_fhash;	/* hash flowing forward */
 	uint16_t		f_flags;	/* flow flags */
-	uint8_t			f_pad;		/* alignment */
+	uint8_t			f_pad;		
 	uint8_t			f_proto;	/* protocol */
+	uint32_t		f_fibnum;	/* fib index */
 	uint32_t		f_uptime;	/* uptime at last access */
 	struct flentry		*f_next;	/* pointer to collision entry */
 	volatile struct rtentry *f_rt;		/* rtentry for flow */
@@ -173,6 +177,10 @@ static VNET_DEFINE(uma_zone_t, flow_ipv6
 #define	V_flow_ipv4_zone	VNET(flow_ipv4_zone)
 #define	V_flow_ipv6_zone	VNET(flow_ipv6_zone)
 
+static struct cv 	flowclean_cv;
+static struct mtx	flowclean_lock;
+static uint32_t		flowclean_cycles;
+
 /*
  * TODO:
  * - Make flowtable stats per-cpu, aggregated at sysctl call time,
@@ -288,10 +296,10 @@ SYSCTL_VNET_PROC(_net_inet_flowtable, OI
 
 #ifndef RADIX_MPATH
 static void
-in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fib)
+in_rtalloc_ign_wrapper(struct route *ro, uint32_t hash, u_int fibnum)
 {
 
-	rtalloc_ign_fib(ro, 0, fib);
+	rtalloc_ign_fib(ro, 0, fibnum);
 }
 #endif
 
@@ -425,7 +433,7 @@ static bitstr_t *
 flowtable_mask(struct flowtable *ft)
 {
 	bitstr_t *mask;
-	
+
 	if (ft->ft_flags & FL_PCPU)
 		mask = ft->ft_masks[curcpu];
 	else
@@ -501,7 +509,7 @@ flowtable_set_hashkey(struct flentry *fl
 
 static int
 flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key,
-    uint8_t proto, struct route *ro, uint16_t flags)
+    uint8_t proto, uint32_t fibnum, struct route *ro, uint16_t flags)
 {
 	struct flentry *fle, *fletail, *newfle, **flep;
 	int depth;
@@ -564,6 +572,7 @@ skip:
 	fle->f_rt = ro->ro_rt;
 	fle->f_lle = ro->ro_lle;
 	fle->f_fhash = hash;
+	fle->f_fibnum = fibnum;
 	fle->f_uptime = time_uptime;
 	FL_ENTRY_UNLOCK(ft, hash);
 	return (0);
@@ -591,13 +600,13 @@ flowtable_key_equal(struct flentry *fle,
 }
 
 int
-flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro)
+flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro, uint32_t fibnum)
 {
 	uint32_t key[9], hash;
 	struct flentry *fle;
 	uint16_t flags;
 	uint8_t proto = 0;
-	int error = 0, fib = 0;
+	int error = 0;
 	struct rtentry *rt;
 	struct llentry *lle;
 
@@ -640,6 +649,7 @@ keycheck:	
 	    && fle->f_fhash == hash
 	    && flowtable_key_equal(fle, key)
 	    && (proto == fle->f_proto)
+	    && (fibnum == fle->f_fibnum)
 	    && (rt->rt_flags & RTF_UP)
 	    && (rt->rt_ifp != NULL)) {
 		V_flowtable_hits++;
@@ -668,10 +678,8 @@ uncached:
 	 * of arpresolve with an rt_check variant that expected to
 	 * receive the route locked
 	 */
-	if (m != NULL)
-		fib = M_GETFIB(m);
 
-	ft->ft_rtalloc(ro, hash, fib);
+	ft->ft_rtalloc(ro, hash, fibnum);
 	if (ro->ro_rt == NULL) 
 		error = ENETUNREACH;
 	else {
@@ -692,7 +700,7 @@ uncached:
 			ro->ro_rt = NULL;
 			return (ENOENT);
 		}
-		error = flowtable_insert(ft, hash, key, proto,
+		error = flowtable_insert(ft, hash, key, proto, fibnum,
 		    ro, flags);
 				
 		if (error) {
@@ -791,35 +799,6 @@ flowtable_alloc(int nentry, int flags)
 	return (ft);
 }
 
-static void
-flowtable_init(const void *unused __unused)
-{
-
-	V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4),
-	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);
-	V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6),
-	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
-	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
-	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
-	V_flowtable_ready = 1;
-}
-
-VNET_SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
-    flowtable_init, NULL);
-
-#ifdef VIMAGE
-static void
-flowtable_uninit(const void *unused __unused)
-{
-
-	uma_zdestroy(V_flow_ipv4_zone);
-	uma_zdestroy(V_flow_ipv6_zone);
-}
-
-VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
-    flowtable_uninit, NULL);
-#endif
-
 /*
  * The rest of the code is devoted to garbage collection of expired entries.
  * It is a new additon made necessary by the switch to dynamically allocating
@@ -973,12 +952,30 @@ flowtable_cleaner(void)
 		}
 		VNET_LIST_RUNLOCK();
 
+		flowclean_cycles++;
 		/*
 		 * The 20 second interval between cleaning checks
 		 * is arbitrary
 		 */
-		pause("flowcleanwait", 20*hz);
+		mtx_lock(&flowclean_lock);
+		cv_broadcast(&flowclean_cv);
+		cv_timedwait(&flowclean_cv, &flowclean_lock, 10*hz);
+		mtx_unlock(&flowclean_lock);
+	}
+}
+
+static void
+flowtable_flush(void *unused __unused)
+{
+	uint64_t start;
+	
+	mtx_lock(&flowclean_lock);
+	start = flowclean_cycles;
+	while (start == flowclean_cycles) {
+		cv_broadcast(&flowclean_cv);
+		cv_wait(&flowclean_cv, &flowclean_lock);
 	}
+	mtx_unlock(&flowclean_lock);
 }
 
 static struct kproc_desc flow_kp = {
@@ -988,3 +985,159 @@ static struct kproc_desc flow_kp = {
 };
 SYSINIT(flowcleaner, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start, &flow_kp);
 
+static void
+flowtable_init_vnet(const void *unused __unused)
+{
+
+	V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4),
+	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);
+	V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6),
+	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
+	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
+	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
+}
+VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE,
+    flowtable_init_vnet, NULL);
+
+static void
+flowtable_init(const void *unused __unused)
+{
+
+	cv_init(&flowclean_cv, "flowcleanwait");
+	mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF);
+	EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL,
+	    EVENTHANDLER_PRI_ANY);
+	V_flowtable_ready = 1;
+}
+SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
+    flowtable_init, NULL);
+
+
+#ifdef VIMAGE
+static void
+flowtable_uninit(const void *unused __unused)
+{
+
+	uma_zdestroy(V_flow_ipv4_zone);
+	uma_zdestroy(V_flow_ipv6_zone);
+}
+
+VNET_SYSUNINIT(flowtable_uninit, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
+    flowtable_uninit, NULL);
+#endif
+
+#ifdef DDB
+static bitstr_t *
+flowtable_mask_pcpu(struct flowtable *ft, int cpuid)
+{
+	bitstr_t *mask;
+
+	if (ft->ft_flags & FL_PCPU)
+		mask = ft->ft_masks[cpuid];
+	else
+		mask = ft->ft_masks[0];
+
+	return (mask);
+}
+
+static struct flentry **
+flowtable_entry_pcpu(struct flowtable *ft, uint32_t hash, int cpuid)
+{
+	struct flentry **fle;
+	int index = (hash % ft->ft_size);
+
+	if (ft->ft_flags & FL_PCPU) {
+		fle = &ft->ft_table.pcpu[cpuid][index];
+	} else {
+		fle = &ft->ft_table.global[index];
+	}
+	
+	return (fle);
+}
+
+static void
+flow_show(struct flowtable *ft, struct flentry *fle)
+{
+	int idle_time;
+	int rt_valid;
+
+	idle_time = (int)(time_uptime - fle->f_uptime);
+	rt_valid = fle->f_rt != NULL;
+	db_printf("hash=0x%08x idle_time=%03d rt=%p ifp=%p",
+	    fle->f_fhash, idle_time,
+	    fle->f_rt, rt_valid ? fle->f_rt->rt_ifp : NULL);
+	if (rt_valid && (fle->f_rt->rt_flags & RTF_UP))
+		db_printf(" RTF_UP ");
+	if (fle->f_flags & FL_STALE)
+		db_printf(" FL_STALE ");
+	db_printf("\n");
+}
+
+static void
+flowtable_show(struct flowtable *ft, int cpuid)
+{
+	int curbit = 0;
+	struct flentry *fle,  **flehead;
+	bitstr_t *mask, *tmpmask;
+
+	db_printf("cpu: %d\n", cpuid);
+	mask = flowtable_mask_pcpu(ft, cpuid);
+	tmpmask = ft->ft_tmpmask;
+	memcpy(tmpmask, mask, ft->ft_size/8);
+	/*
+	 * XXX Note to self, bit_ffs operates at the byte level
+	 * and thus adds gratuitous overhead
+	 */
+	bit_ffs(tmpmask, ft->ft_size, &curbit);
+	while (curbit != -1) {
+		if (curbit >= ft->ft_size || curbit < -1) {
+			db_printf("warning: bad curbit value %d \n",
+			    curbit);
+			break;
+		}
+
+		flehead = flowtable_entry_pcpu(ft, curbit, cpuid);
+		fle = *flehead;
+
+		while (fle != NULL) {	
+			flow_show(ft, fle);
+			fle = fle->f_next;
+			continue;
+		}
+		bit_clear(tmpmask, curbit);
+		bit_ffs(tmpmask, ft->ft_size, &curbit);
+	}
+}
+
+static void
+flowtable_show_vnet(void)
+{
+	struct flowtable *ft;
+	int i;
+
+	ft = V_flow_list_head;
+	while (ft != NULL) {
+		if (ft->ft_flags & FL_PCPU) {
+			for (i = 0; i <= mp_maxid; i++) {
+				if (CPU_ABSENT(i))
+					continue;
+				flowtable_show(ft, i);
+			}
+		} else {
+			flowtable_show(ft, 0);
+		}
+		ft = ft->ft_next;
+	}
+}
+
+DB_SHOW_COMMAND(flowtables, db_show_flowtables)
+{
+	VNET_ITERATOR_DECL(vnet_iter);
+
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET(vnet_iter);
+		flowtable_show_vnet();
+		CURVNET_RESTORE();
+	}
+}
+#endif

Modified: stable/8/sys/net/flowtable.h
==============================================================================
--- stable/8/sys/net/flowtable.h	Tue Aug 18 20:28:58 2009	(r196368)
+++ stable/8/sys/net/flowtable.h	Tue Aug 18 20:39:35 2009	(r196369)
@@ -49,7 +49,7 @@ struct flowtable *flowtable_alloc(int ne
  *
  */
 int flowtable_lookup(struct flowtable *ft, struct mbuf *m,
-    struct route *ro);
+    struct route *ro, uint32_t fibnum);
 
 #endif /* _KERNEL */
 #endif

Modified: stable/8/sys/netinet/ip_output.c
==============================================================================
--- stable/8/sys/netinet/ip_output.c	Tue Aug 18 20:28:58 2009	(r196368)
+++ stable/8/sys/netinet/ip_output.c	Tue Aug 18 20:39:35 2009	(r196369)
@@ -157,7 +157,7 @@ ip_output(struct mbuf *m, struct mbuf *o
 		 * longer than that long for the stability of ro_rt.  The
 		 * flow ID assignment must have happened before this point.
 		 */
-		if (flowtable_lookup(V_ip_ft, m, ro) == 0)
+		if (flowtable_lookup(V_ip_ft, m, ro, M_GETFIB(m)) == 0)
 			nortfree = 1;
 #endif
 	}

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 20:55:47 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD6181065693;
	Tue, 18 Aug 2009 20:55:47 +0000 (UTC) (envelope-from sam@errno.com)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A0898FC65;
	Tue, 18 Aug 2009 20:55:47 +0000 (UTC)
Received: from ice.local ([10.0.0.115]) (authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n7IKtkge021823
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 18 Aug 2009 13:55:46 -0700 (PDT) (envelope-from sam@errno.com)
Message-ID: <4A8B1552.6010703@errno.com>
Date: Tue, 18 Aug 2009 13:55:46 -0700
From: Sam Leffler 
User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605)
MIME-Version: 1.0
To: Kip Macy 
References: <200908182028.n7IKSwJ9027599@svn.freebsd.org>
In-Reply-To: <200908182028.n7IKSwJ9027599@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC--Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196368 - in head/sys: net netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 20:55:47 -0000

Kip Macy wrote:
> Author: kmacy
> Date: Tue Aug 18 20:28:58 2009
> New Revision: 196368
> URL: http://svn.freebsd.org/changeset/base/196368
> 
> Log:
>    - change the interface to flowtable_lookup so that we don't rely on
>      the mbuf for obtaining the fib index
>    - check that a cached flow corresponds to the same fib index as the
>      packet for which we are doing the lookup
>    - at interface detach time flush any flows referencing stale rtentrys
>      associated with the interface that is going away (fixes reported
>      panics)
>    - reduce the time between cleans in case the cleaner is running at
>      the time the eventhandler is called and the wakeup is missed less
>      time will elapse before the eventhandler returns
>    - separate per-vnet initialization from global initialization
>      (pointed out by jeli@)

- add ddb "show flowtables" cmd

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 21:07:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A59941065672;
	Tue, 18 Aug 2009 21:07:39 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A0B08FC66;
	Tue, 18 Aug 2009 21:07:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IL7dsS028468;
	Tue, 18 Aug 2009 21:07:39 GMT (envelope-from stas@svn.freebsd.org)
Received: (from stas@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7IL7d3V028466;
	Tue, 18 Aug 2009 21:07:39 GMT (envelope-from stas@svn.freebsd.org)
Message-Id: <200908182107.n7IL7d3V028466@svn.freebsd.org>
From: Stanislav Sedov 
Date: Tue, 18 Aug 2009 21:07:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196370 - head/sys/dev/bge
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 21:07:39 -0000

Author: stas
Date: Tue Aug 18 21:07:39 2009
New Revision: 196370
URL: http://svn.freebsd.org/changeset/base/196370

Log:
  - Do not try to reevaluate current RX production index on each
    loop iteration as it can be updated by the card while we
    process the RX ring forcing us to process RX descriptors
    for which DMA synchronisation operation has not been
    performed.  This fixes the bug when bge(4) drops packets
    under high load.
  
  Discussed with:	yongari, marius
  Approved by:	re (kib)
  MFC after:	1 week

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Tue Aug 18 20:39:35 2009	(r196369)
+++ head/sys/dev/bge/if_bge.c	Tue Aug 18 21:07:39 2009	(r196370)
@@ -3055,12 +3055,14 @@ bge_rxeof(struct bge_softc *sc)
 {
 	struct ifnet *ifp;
 	int rx_npkts = 0, stdcnt = 0, jumbocnt = 0;
+	uint16_t rx_prod, rx_cons;
 
 	BGE_LOCK_ASSERT(sc);
+	rx_cons = sc->bge_rx_saved_considx;
+	rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx;
 
 	/* Nothing to do. */
-	if (sc->bge_rx_saved_considx ==
-	    sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx)
+	if (rx_cons == rx_prod)
 		return (rx_npkts);
 
 	ifp = sc->bge_ifp;
@@ -3073,8 +3075,7 @@ bge_rxeof(struct bge_softc *sc)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTREAD);
 
-	while (sc->bge_rx_saved_considx !=
-	    sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) {
+	while (rx_cons != rx_prod) {
 		struct bge_rx_bd	*cur_rx;
 		uint32_t		rxidx;
 		struct mbuf		*m = NULL;
@@ -3089,11 +3090,10 @@ bge_rxeof(struct bge_softc *sc)
 		}
 #endif
 
-		cur_rx =
-	    &sc->bge_ldata.bge_rx_return_ring[sc->bge_rx_saved_considx];
+		cur_rx = &sc->bge_ldata.bge_rx_return_ring[rx_cons];
 
 		rxidx = cur_rx->bge_idx;
-		BGE_INC(sc->bge_rx_saved_considx, sc->bge_return_ring_cnt);
+		BGE_INC(rx_cons, sc->bge_return_ring_cnt);
 
 		if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING &&
 		    cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
@@ -3207,6 +3207,7 @@ bge_rxeof(struct bge_softc *sc)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE);
 
+	sc->bge_rx_saved_considx = rx_cons;
 	bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx);
 	if (stdcnt)
 		bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);

From owner-svn-src-all@FreeBSD.ORG  Tue Aug 18 21:13:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 00AC5106564A;
	Tue, 18 Aug 2009 21:13:01 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C74168FC61;
	Tue, 18 Aug 2009 21:13:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7ILD0Ua028631;
	Tue, 18 Aug 2009 21:13:00 GMT (envelope-from stas@svn.freebsd.org)
Received: (from stas@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7ILD00Z028629;
	Tue, 18 Aug 2009 21:13:00 GMT (envelope-from stas@svn.freebsd.org)
Message-Id: <200908182113.n7ILD00Z028629@svn.freebsd.org>
From: Stanislav Sedov 
Date: Tue, 18 Aug 2009 21:13:00 +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: r196371 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/bge dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 18 Aug 2009 21:13:01 -0000

Author: stas
Date: Tue Aug 18 21:13:00 2009
New Revision: 196371
URL: http://svn.freebsd.org/changeset/base/196371

Log:
  - MFC r196370.
    Do not try to reevaluate current RX production index on each
    loop iteration as it can be updated by the card while we
    process the RX ring forcing us to process RX descriptors
    for which DMA synchronisation operation has not been
    performed.  This fixes the bug when bge(4) drops packets
    under high load.
  
  Discussed with:	yongari, marius
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/bge/if_bge.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Tue Aug 18 21:07:39 2009	(r196370)
+++ stable/8/sys/dev/bge/if_bge.c	Tue Aug 18 21:13:00 2009	(r196371)
@@ -3055,12 +3055,14 @@ bge_rxeof(struct bge_softc *sc)
 {
 	struct ifnet *ifp;
 	int rx_npkts = 0, stdcnt = 0, jumbocnt = 0;
+	uint16_t rx_prod, rx_cons;
 
 	BGE_LOCK_ASSERT(sc);
+	rx_cons = sc->bge_rx_saved_considx;
+	rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx;
 
 	/* Nothing to do. */
-	if (sc->bge_rx_saved_considx ==
-	    sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx)
+	if (rx_cons == rx_prod)
 		return (rx_npkts);
 
 	ifp = sc->bge_ifp;
@@ -3073,8 +3075,7 @@ bge_rxeof(struct bge_softc *sc)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTREAD);
 
-	while (sc->bge_rx_saved_considx !=
-	    sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx) {
+	while (rx_cons != rx_prod) {
 		struct bge_rx_bd	*cur_rx;
 		uint32_t		rxidx;
 		struct mbuf		*m = NULL;
@@ -3089,11 +3090,10 @@ bge_rxeof(struct bge_softc *sc)
 		}
 #endif
 
-		cur_rx =
-	    &sc->bge_ldata.bge_rx_return_ring[sc->bge_rx_saved_considx];
+		cur_rx = &sc->bge_ldata.bge_rx_return_ring[rx_cons];
 
 		rxidx = cur_rx->bge_idx;
-		BGE_INC(sc->bge_rx_saved_considx, sc->bge_return_ring_cnt);
+		BGE_INC(rx_cons, sc->bge_return_ring_cnt);
 
 		if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING &&
 		    cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
@@ -3207,6 +3207,7 @@ bge_rxeof(struct bge_softc *sc)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
 		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE);
 
+	sc->bge_rx_saved_considx = rx_cons;
 	bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx);
 	if (stdcnt)
 		bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 00:10:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CEF1106568D;
	Wed, 19 Aug 2009 00:10:11 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BE3D8FC55;
	Wed, 19 Aug 2009 00:10:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7J0ABih032192;
	Wed, 19 Aug 2009 00:10:11 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7J0ABEk032189;
	Wed, 19 Aug 2009 00:10:11 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908190010.n7J0ABEk032189@svn.freebsd.org>
From: Max Laier 
Date: Wed, 19 Aug 2009 00:10:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196372 - head/sys/contrib/pf/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 00:10:11 -0000

Author: mlaier
Date: Wed Aug 19 00:10:10 2009
New Revision: 196372
URL: http://svn.freebsd.org/changeset/base/196372

Log:
  If we cannot immediately get the pf_consistency_lock in the purge thread,
  restart the scan after acquiring the lock the hard way.  Otherwise we might
  end up with a dead reference.
  
  Reported by:		pfsense
  Reviewed by:		eri
  Initial patch by:	eri
  Tested by:		pfsense
  Approved by:		re (kib)

Modified:
  head/sys/contrib/pf/net/pf.c
  head/sys/contrib/pf/net/pfvar.h

Modified: head/sys/contrib/pf/net/pf.c
==============================================================================
--- head/sys/contrib/pf/net/pf.c	Tue Aug 18 21:13:00 2009	(r196371)
+++ head/sys/contrib/pf/net/pf.c	Wed Aug 19 00:10:10 2009	(r196372)
@@ -971,6 +971,9 @@ void
 pf_purge_thread(void *v)
 {
 	int nloops = 0, s;
+#ifdef __FreeBSD__
+	int locked;
+#endif
 
 	for (;;) {
 		tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz);
@@ -978,14 +981,19 @@ pf_purge_thread(void *v)
 #ifdef __FreeBSD__
 		sx_slock(&pf_consistency_lock);
 		PF_LOCK();
+		locked = 0;
 
 		if (pf_end_threads) {
-			pf_purge_expired_states(pf_status.states);
+			PF_UNLOCK();
+			sx_sunlock(&pf_consistency_lock);
+			sx_xlock(&pf_consistency_lock);
+			PF_LOCK();
+			pf_purge_expired_states(pf_status.states, 1);
 			pf_purge_expired_fragments();
-			pf_purge_expired_src_nodes(0);
+			pf_purge_expired_src_nodes(1);
 			pf_end_threads++;
 
-			sx_sunlock(&pf_consistency_lock);
+			sx_xunlock(&pf_consistency_lock);
 			PF_UNLOCK();
 			wakeup(pf_purge_thread);
 			kproc_exit(0);
@@ -994,20 +1002,44 @@ pf_purge_thread(void *v)
 		s = splsoftnet();
 
 		/* process a fraction of the state table every second */
+#ifdef __FreeBSD__
+		if(!pf_purge_expired_states(1 + (pf_status.states
+		    / pf_default_rule.timeout[PFTM_INTERVAL]), 0)) {
+			PF_UNLOCK();
+			sx_sunlock(&pf_consistency_lock);
+			sx_xlock(&pf_consistency_lock);
+			PF_LOCK();
+			locked = 1;
+
+			pf_purge_expired_states(1 + (pf_status.states
+			    / pf_default_rule.timeout[PFTM_INTERVAL]), 1);
+		}
+#else
 		pf_purge_expired_states(1 + (pf_status.states
 		    / pf_default_rule.timeout[PFTM_INTERVAL]));
+#endif
 
 		/* purge other expired types every PFTM_INTERVAL seconds */
 		if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) {
 			pf_purge_expired_fragments();
-			pf_purge_expired_src_nodes(0);
+			if (!pf_purge_expired_src_nodes(locked)) {
+				PF_UNLOCK();
+				sx_sunlock(&pf_consistency_lock);
+				sx_xlock(&pf_consistency_lock);
+				PF_LOCK();
+				locked = 1;
+				pf_purge_expired_src_nodes(1);
+			}
 			nloops = 0;
 		}
 
 		splx(s);
 #ifdef __FreeBSD__
 		PF_UNLOCK();
-		sx_sunlock(&pf_consistency_lock);
+		if (locked)
+			sx_xunlock(&pf_consistency_lock);
+		else
+			sx_sunlock(&pf_consistency_lock);
 #endif
 	}
 }
@@ -1056,8 +1088,13 @@ pf_state_expires(const struct pf_state *
 	return (state->expire + timeout);
 }
 
+#ifdef __FreeBSD__
+int
+pf_purge_expired_src_nodes(int waslocked)
+#else
 void
 pf_purge_expired_src_nodes(int waslocked)
+#endif
 {
 	 struct pf_src_node		*cur, *next;
 	 int				 locked = waslocked;
@@ -1068,12 +1105,8 @@ pf_purge_expired_src_nodes(int waslocked
 		 if (cur->states <= 0 && cur->expire <= time_second) {
 			 if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				 rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1100,6 +1133,10 @@ pf_purge_expired_src_nodes(int waslocked
 #else
 		rw_exit_write(&pf_consistency_lock);
 #endif
+
+#ifdef __FreeBSD__
+	return (1);
+#endif
 }
 
 void
@@ -1202,12 +1239,21 @@ pf_free_state(struct pf_state *cur)
 	pf_status.states--;
 }
 
+#ifdef __FreeBSD__
+int
+pf_purge_expired_states(u_int32_t maxcheck, int waslocked)
+#else
 void
 pf_purge_expired_states(u_int32_t maxcheck)
+#endif
 {
 	static struct pf_state	*cur = NULL;
 	struct pf_state		*next;
+#ifdef __FreeBSD__
+	int 			 locked = waslocked;
+#else
 	int 			 locked = 0;
+#endif
 
 	while (maxcheck--) {
 		/* wrap to start of list when we hit the end */
@@ -1224,12 +1270,8 @@ pf_purge_expired_states(u_int32_t maxche
 			/* free unlinked state */
 			if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1241,12 +1283,8 @@ pf_purge_expired_states(u_int32_t maxche
 			pf_unlink_state(cur);
 			if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1257,10 +1295,13 @@ pf_purge_expired_states(u_int32_t maxche
 		cur = next;
 	}
 
-	if (locked)
 #ifdef __FreeBSD__
+	if (!waslocked && locked)
 		sx_downgrade(&pf_consistency_lock);
+
+	return (1);
 #else
+	if (locked)
 		rw_exit_write(&pf_consistency_lock);
 #endif
 }

Modified: head/sys/contrib/pf/net/pfvar.h
==============================================================================
--- head/sys/contrib/pf/net/pfvar.h	Tue Aug 18 21:13:00 2009	(r196371)
+++ head/sys/contrib/pf/net/pfvar.h	Wed Aug 19 00:10:10 2009	(r196372)
@@ -1593,8 +1593,13 @@ extern struct pool		 pf_state_pl, pf_alt
 extern struct pool		 pf_state_scrub_pl;
 #endif
 extern void			 pf_purge_thread(void *);
+#ifdef __FreeBSD__
+extern int			 pf_purge_expired_src_nodes(int);
+extern int			 pf_purge_expired_states(u_int32_t, int);
+#else
 extern void			 pf_purge_expired_src_nodes(int);
 extern void			 pf_purge_expired_states(u_int32_t);
+#endif
 extern void			 pf_unlink_state(struct pf_state *);
 extern void			 pf_free_state(struct pf_state *);
 extern int			 pf_insert_state(struct pfi_kif *,

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 00:17:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F21A6106568B;
	Wed, 19 Aug 2009 00:17:00 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF0828FC52;
	Wed, 19 Aug 2009 00:17:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7J0H03a032373;
	Wed, 19 Aug 2009 00:17:00 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7J0H0iw032370;
	Wed, 19 Aug 2009 00:17:00 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908190017.n7J0H0iw032370@svn.freebsd.org>
From: Max Laier 
Date: Wed, 19 Aug 2009 00:17:00 +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: r196373 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	contrib/pf/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 00:17:01 -0000

Author: mlaier
Date: Wed Aug 19 00:17:00 2009
New Revision: 196373
URL: http://svn.freebsd.org/changeset/base/196373

Log:
  MFC r196372:
    If we cannot immediately get the pf_consistency_lock in the purge thread,
    restart the scan after acquiring the lock the hard way.  Otherwise we
    might end up with a dead reference.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/contrib/pf/net/pf.c
  stable/8/sys/contrib/pf/net/pfvar.h
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/contrib/pf/net/pf.c
==============================================================================
--- stable/8/sys/contrib/pf/net/pf.c	Wed Aug 19 00:10:10 2009	(r196372)
+++ stable/8/sys/contrib/pf/net/pf.c	Wed Aug 19 00:17:00 2009	(r196373)
@@ -971,6 +971,9 @@ void
 pf_purge_thread(void *v)
 {
 	int nloops = 0, s;
+#ifdef __FreeBSD__
+	int locked;
+#endif
 
 	for (;;) {
 		tsleep(pf_purge_thread, PWAIT, "pftm", 1 * hz);
@@ -978,14 +981,19 @@ pf_purge_thread(void *v)
 #ifdef __FreeBSD__
 		sx_slock(&pf_consistency_lock);
 		PF_LOCK();
+		locked = 0;
 
 		if (pf_end_threads) {
-			pf_purge_expired_states(pf_status.states);
+			PF_UNLOCK();
+			sx_sunlock(&pf_consistency_lock);
+			sx_xlock(&pf_consistency_lock);
+			PF_LOCK();
+			pf_purge_expired_states(pf_status.states, 1);
 			pf_purge_expired_fragments();
-			pf_purge_expired_src_nodes(0);
+			pf_purge_expired_src_nodes(1);
 			pf_end_threads++;
 
-			sx_sunlock(&pf_consistency_lock);
+			sx_xunlock(&pf_consistency_lock);
 			PF_UNLOCK();
 			wakeup(pf_purge_thread);
 			kproc_exit(0);
@@ -994,20 +1002,44 @@ pf_purge_thread(void *v)
 		s = splsoftnet();
 
 		/* process a fraction of the state table every second */
+#ifdef __FreeBSD__
+		if(!pf_purge_expired_states(1 + (pf_status.states
+		    / pf_default_rule.timeout[PFTM_INTERVAL]), 0)) {
+			PF_UNLOCK();
+			sx_sunlock(&pf_consistency_lock);
+			sx_xlock(&pf_consistency_lock);
+			PF_LOCK();
+			locked = 1;
+
+			pf_purge_expired_states(1 + (pf_status.states
+			    / pf_default_rule.timeout[PFTM_INTERVAL]), 1);
+		}
+#else
 		pf_purge_expired_states(1 + (pf_status.states
 		    / pf_default_rule.timeout[PFTM_INTERVAL]));
+#endif
 
 		/* purge other expired types every PFTM_INTERVAL seconds */
 		if (++nloops >= pf_default_rule.timeout[PFTM_INTERVAL]) {
 			pf_purge_expired_fragments();
-			pf_purge_expired_src_nodes(0);
+			if (!pf_purge_expired_src_nodes(locked)) {
+				PF_UNLOCK();
+				sx_sunlock(&pf_consistency_lock);
+				sx_xlock(&pf_consistency_lock);
+				PF_LOCK();
+				locked = 1;
+				pf_purge_expired_src_nodes(1);
+			}
 			nloops = 0;
 		}
 
 		splx(s);
 #ifdef __FreeBSD__
 		PF_UNLOCK();
-		sx_sunlock(&pf_consistency_lock);
+		if (locked)
+			sx_xunlock(&pf_consistency_lock);
+		else
+			sx_sunlock(&pf_consistency_lock);
 #endif
 	}
 }
@@ -1056,8 +1088,13 @@ pf_state_expires(const struct pf_state *
 	return (state->expire + timeout);
 }
 
+#ifdef __FreeBSD__
+int
+pf_purge_expired_src_nodes(int waslocked)
+#else
 void
 pf_purge_expired_src_nodes(int waslocked)
+#endif
 {
 	 struct pf_src_node		*cur, *next;
 	 int				 locked = waslocked;
@@ -1068,12 +1105,8 @@ pf_purge_expired_src_nodes(int waslocked
 		 if (cur->states <= 0 && cur->expire <= time_second) {
 			 if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				 rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1100,6 +1133,10 @@ pf_purge_expired_src_nodes(int waslocked
 #else
 		rw_exit_write(&pf_consistency_lock);
 #endif
+
+#ifdef __FreeBSD__
+	return (1);
+#endif
 }
 
 void
@@ -1202,12 +1239,21 @@ pf_free_state(struct pf_state *cur)
 	pf_status.states--;
 }
 
+#ifdef __FreeBSD__
+int
+pf_purge_expired_states(u_int32_t maxcheck, int waslocked)
+#else
 void
 pf_purge_expired_states(u_int32_t maxcheck)
+#endif
 {
 	static struct pf_state	*cur = NULL;
 	struct pf_state		*next;
+#ifdef __FreeBSD__
+	int 			 locked = waslocked;
+#else
 	int 			 locked = 0;
+#endif
 
 	while (maxcheck--) {
 		/* wrap to start of list when we hit the end */
@@ -1224,12 +1270,8 @@ pf_purge_expired_states(u_int32_t maxche
 			/* free unlinked state */
 			if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1241,12 +1283,8 @@ pf_purge_expired_states(u_int32_t maxche
 			pf_unlink_state(cur);
 			if (! locked) {
 #ifdef __FreeBSD__
-				 if (!sx_try_upgrade(&pf_consistency_lock)) {
-					 PF_UNLOCK();
-					 sx_sunlock(&pf_consistency_lock);
-					 sx_xlock(&pf_consistency_lock);
-					 PF_LOCK();
-				 }
+				 if (!sx_try_upgrade(&pf_consistency_lock))
+				 	return (0);
 #else
 				rw_enter_write(&pf_consistency_lock);
 #endif
@@ -1257,10 +1295,13 @@ pf_purge_expired_states(u_int32_t maxche
 		cur = next;
 	}
 
-	if (locked)
 #ifdef __FreeBSD__
+	if (!waslocked && locked)
 		sx_downgrade(&pf_consistency_lock);
+
+	return (1);
 #else
+	if (locked)
 		rw_exit_write(&pf_consistency_lock);
 #endif
 }

Modified: stable/8/sys/contrib/pf/net/pfvar.h
==============================================================================
--- stable/8/sys/contrib/pf/net/pfvar.h	Wed Aug 19 00:10:10 2009	(r196372)
+++ stable/8/sys/contrib/pf/net/pfvar.h	Wed Aug 19 00:17:00 2009	(r196373)
@@ -1593,8 +1593,13 @@ extern struct pool		 pf_state_pl, pf_alt
 extern struct pool		 pf_state_scrub_pl;
 #endif
 extern void			 pf_purge_thread(void *);
+#ifdef __FreeBSD__
+extern int			 pf_purge_expired_src_nodes(int);
+extern int			 pf_purge_expired_states(u_int32_t, int);
+#else
 extern void			 pf_purge_expired_src_nodes(int);
 extern void			 pf_purge_expired_states(u_int32_t);
+#endif
 extern void			 pf_unlink_state(struct pf_state *);
 extern void			 pf_free_state(struct pf_state *);
 extern int			 pf_insert_state(struct pfi_kif *,

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 03:52:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF4B1106568E;
	Wed, 19 Aug 2009 03:52:15 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B5D288FC41;
	Wed, 19 Aug 2009 03:52:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7J3qFUs041013;
	Wed, 19 Aug 2009 03:52:15 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7J3qFKp041012;
	Wed, 19 Aug 2009 03:52:15 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908190352.n7J3qFKp041012@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 19 Aug 2009 03:52:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196374 - head/release/doc/en_US.ISO8859-1/relnotes
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 03:52:16 -0000

Author: edwin
Date: Wed Aug 19 03:52:15 2009
New Revision: 196374
URL: http://svn.freebsd.org/changeset/base/196374

Log:
  - Make note of the update of tzdata from 2008h to 2009j
  - Make note of the update of tzcode from 2004a to 2009h
    Add an extra alert that people who update via source or via
    freebsd-update will have to run the tzsetup(8) utility.
  
  Approved by:	re (Kostik)

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.sgml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml
==============================================================================
--- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Aug 19 00:17:00 2009	(r196373)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Aug 19 03:52:15 2009	(r196374)
@@ -411,6 +411,9 @@
     &man.top.1; now supports a  flag to
       provide per-CPU usage statistics.
 
+    &man.zdump.8; is now working properly on 64 bit architectures.
+      
+
     &man.traceroute.8; now has the ability to print the AS
       number for each hop with the new  switch; a
       new  option allows selecting a particular
@@ -468,8 +471,15 @@
       8.14.1 to 8.14.3.
 
     The timezone database has been updated from
-      the tzdata2008b release to
-      the tzdata2008h release.
+      the tzdata2008h release to
+      the tzdata2009j release.
+
+    The stdtime part of libc, &man.zdump.8 and &man.zic.8
+      have been updated from the tzcode2004a
+      release to the tzcode2009h release.
+      If you have upgraded from source or via the &man.freebsd-update.8,
+      then please run &man.tzsetup.8 to install a new /etc/localtime.
+      
 
     WPA Supplicant has been
       updated from 0.5.8 to 0.5.10.

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 03:58:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F075106568D;
	Wed, 19 Aug 2009 03:58:12 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 64B888FC43;
	Wed, 19 Aug 2009 03:58:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7J3wCDK041178;
	Wed, 19 Aug 2009 03:58:12 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7J3wCff041176;
	Wed, 19 Aug 2009 03:58:12 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908190358.n7J3wCff041176@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 19 Aug 2009 03:58: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: r196375 - in stable/8/release/doc: .
	en_US.ISO8859-1/relnotes
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 03:58:12 -0000

Author: edwin
Date: Wed Aug 19 03:58:12 2009
New Revision: 196375
URL: http://svn.freebsd.org/changeset/base/196375

Log:
  - Make note of the update of tzdata from 2008h to 2009j
  - Make note of the update of tzcode from 2004a to 2009h
    Add an extra alert that people who update via source or via
    freebsd-update will have to run the tzsetup(8) utility.
  
  Approved by:	re (Kostik)

Modified:
  stable/8/release/doc/   (props changed)
  stable/8/release/doc/en_US.ISO8859-1/relnotes/article.sgml

Modified: stable/8/release/doc/en_US.ISO8859-1/relnotes/article.sgml
==============================================================================
--- stable/8/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Aug 19 03:52:15 2009	(r196374)
+++ stable/8/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Aug 19 03:58:12 2009	(r196375)
@@ -411,6 +411,9 @@
     &man.top.1; now supports a  flag to
       provide per-CPU usage statistics.
 
+    &man.zdump.8; is now working properly on 64 bit architectures.
+      
+
     &man.traceroute.8; now has the ability to print the AS
       number for each hop with the new  switch; a
       new  option allows selecting a particular
@@ -468,8 +471,15 @@
       8.14.1 to 8.14.3.
 
     The timezone database has been updated from
-      the tzdata2008b release to
-      the tzdata2008h release.
+      the tzdata2008h release to
+      the tzdata2009j release.
+
+    The stdtime part of libc, &man.zdump.8 and &man.zic.8
+      have been updated from the tzcode2004a
+      release to the tzcode2009h release.
+      If you have upgraded from source or via the &man.freebsd-update.8,
+      then please run &man.tzsetup.8 to install a new /etc/localtime.
+      
 
     WPA Supplicant has been
       updated from 0.5.8 to 0.5.10.

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 09:56:00 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 029B3106564A;
	Wed, 19 Aug 2009 09:56:00 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au
	[211.29.132.182])
	by mx1.freebsd.org (Postfix) with ESMTP id 735A48FC15;
	Wed, 19 Aug 2009 09:55:59 +0000 (UTC)
Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au
	(c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1])
	by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n7J9tpSv006433
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 19 Aug 2009 19:55:52 +1000
Date: Wed, 19 Aug 2009 19:55:50 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Pawel Jakub Dawidek 
In-Reply-To: <20090818183858.GB1794@garage.freebsd.pl>
Message-ID: <20090819194425.S35105@delplex.bde.org>
References: <200908181355.n7IDtmqT019165@svn.freebsd.org>
	<4A8AC814.2070804@errno.com>
	<3bbf2fe10908181106u159934b9ofc4c2a5e4793b692@mail.gmail.com>
	<20090818183858.GB1794@garage.freebsd.pl>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Attilio Rao , Sam Leffler ,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org,
	svn-src-head@FreeBSD.org
Subject: Re: svn commit: r196358 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 09:56:00 -0000

On Tue, 18 Aug 2009, Pawel Jakub Dawidek wrote:

> On Tue, Aug 18, 2009 at 08:06:17PM +0200, Attilio Rao wrote:
>> 2009/8/18 Sam Leffler :
>>> Pawel Jakub Dawidek wrote:
>>>> Log:
>>>>  Remove unused taskqueue_find() function.
>>>>    Reviewed by:  dfr
>>>>  Approved by:  re (kib)
>>>
>>> I don't understand why this should be removed (let alone during a code
>>> freeze).  I can think of several uses for this function including a ddb cmd
>>> that takes a taskq name and dumps it's contents.  The overhead of
>>> maintaining the global list appears minimal.
>>
>> FWIW, I agree with Sam.
>
> The only use I could think of was exactly what Sam suggested - a DDB
> command and that was the only possible use I found.

And ddb cannot call it, since it uses locks unconditionally.

Bruce

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 12:02:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 72F591065691;
	Wed, 19 Aug 2009 12:02:28 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 65F228FC66;
	Wed, 19 Aug 2009 12:02:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JC2Sgl053641;
	Wed, 19 Aug 2009 12:02:28 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JC2STC053639;
	Wed, 19 Aug 2009 12:02:28 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200908191202.n7JC2STC053639@svn.freebsd.org>
From: Michael Tuexen 
Date: Wed, 19 Aug 2009 12:02:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196376 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 12:02:28 -0000

Author: tuexen
Date: Wed Aug 19 12:02:28 2009
New Revision: 196376
URL: http://svn.freebsd.org/changeset/base/196376

Log:
  Fix a bug in the handling of unreliable messages
  which results in stalled associations.
  
  Approved by: re, rrs (mentor)
  MFC after: immediately

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Wed Aug 19 03:58:12 2009	(r196375)
+++ head/sys/netinet/sctputil.c	Wed Aug 19 12:02:28 2009	(r196376)
@@ -4667,8 +4667,10 @@ sctp_release_pr_sctp_chunk(struct sctp_t
 			stcb->asoc.peers_rwnd += tp1->send_size;
 			stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh);
 			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
-			sctp_m_freem(tp1->data);
-			tp1->data = NULL;
+			if (tp1->data) {
+				sctp_m_freem(tp1->data);
+				tp1->data = NULL;
+			}
 			do_wakeup_routine = 1;
 			if (PR_SCTP_BUF_ENABLED(tp1->flags)) {
 				stcb->asoc.sent_queue_cnt_removeable--;
@@ -4715,12 +4717,14 @@ next_on_sent:
 			 */
 			chk = tp1;
 			ret_sz += tp1->book_size;
-			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
 			sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
-			sctp_m_freem(tp1->data);
+			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
+			if (tp1->data) {
+				sctp_m_freem(tp1->data);
+				tp1->data = NULL;
+			}
 			/* No flight involved here book the size to 0 */
 			tp1->book_size = 0;
-			tp1->data = NULL;
 			if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
 				foundeom = 1;
 			}

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 12:12:52 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 09E54106568B;
	Wed, 19 Aug 2009 12:12:52 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D50F28FC45;
	Wed, 19 Aug 2009 12:12:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JCCpDE053891;
	Wed, 19 Aug 2009 12:12:51 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JCCpXN053889;
	Wed, 19 Aug 2009 12:12:51 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200908191212.n7JCCpXN053889@svn.freebsd.org>
From: Michael Tuexen 
Date: Wed, 19 Aug 2009 12:12:51 +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: r196377 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 12:12:52 -0000

Author: tuexen
Date: Wed Aug 19 12:12:51 2009
New Revision: 196377
URL: http://svn.freebsd.org/changeset/base/196377

Log:
  Fix a bug in the handling of unreliable messages which
  results in stalled associations.
  
  Approved by: re, rrs (mentor)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/netinet/sctputil.c

Modified: stable/8/sys/netinet/sctputil.c
==============================================================================
--- stable/8/sys/netinet/sctputil.c	Wed Aug 19 12:02:28 2009	(r196376)
+++ stable/8/sys/netinet/sctputil.c	Wed Aug 19 12:12:51 2009	(r196377)
@@ -4667,8 +4667,10 @@ sctp_release_pr_sctp_chunk(struct sctp_t
 			stcb->asoc.peers_rwnd += tp1->send_size;
 			stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh);
 			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
-			sctp_m_freem(tp1->data);
-			tp1->data = NULL;
+			if (tp1->data) {
+				sctp_m_freem(tp1->data);
+				tp1->data = NULL;
+			}
 			do_wakeup_routine = 1;
 			if (PR_SCTP_BUF_ENABLED(tp1->flags)) {
 				stcb->asoc.sent_queue_cnt_removeable--;
@@ -4715,12 +4717,14 @@ next_on_sent:
 			 */
 			chk = tp1;
 			ret_sz += tp1->book_size;
-			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
 			sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
-			sctp_m_freem(tp1->data);
+			sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, stcb, reason, tp1, so_locked);
+			if (tp1->data) {
+				sctp_m_freem(tp1->data);
+				tp1->data = NULL;
+			}
 			/* No flight involved here book the size to 0 */
 			tp1->book_size = 0;
-			tp1->data = NULL;
 			if (tp1->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
 				foundeom = 1;
 			}

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 14:30:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90DCE10656B1;
	Wed, 19 Aug 2009 14:30:46 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 80E0D8FC62;
	Wed, 19 Aug 2009 14:30:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JEUkDY056765;
	Wed, 19 Aug 2009 14:30:46 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JEUkGt056763;
	Wed, 19 Aug 2009 14:30:46 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908191430.n7JEUkGt056763@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 19 Aug 2009 14:30:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196378 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 14:30:46 -0000

Author: ed
Date: Wed Aug 19 14:30:46 2009
New Revision: 196378
URL: http://svn.freebsd.org/changeset/base/196378

Log:
  Small changes to the warning message generated by pty(4):
  
  - Only print the warning once, instead of filling up the screen.
  - Use the word "legacy" for the pty_warningcnt description, to prevent
    confusion.
  - Use log() instead of printf().
  
  Discussed with:	rwatson, jhb
  Approved by:	re (kib)

Modified:
  head/sys/kern/tty_pty.c

Modified: head/sys/kern/tty_pty.c
==============================================================================
--- head/sys/kern/tty_pty.c	Wed Aug 19 12:12:51 2009	(r196377)
+++ head/sys/kern/tty_pty.c	Wed Aug 19 14:30:46 2009	(r196378)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,10 +48,10 @@ __FBSDID("$FreeBSD$");
  * si_drv1 inside the cdev to mark whether the PTY is in use.
  */
 
-static unsigned int pty_warningcnt = 10;
+static unsigned int pty_warningcnt = 1;
 SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW,
 	&pty_warningcnt, 0,
-	"Warnings that will be triggered upon PTY allocation");
+	"Warnings that will be triggered upon legacy PTY allocation");
 
 static int
 ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp)
@@ -74,7 +75,7 @@ ptydev_fdopen(struct cdev *dev, int ffla
 	/* Raise a warning when a legacy PTY has been allocated. */
 	if (pty_warningcnt > 0) {
 		pty_warningcnt--;
-		printf("pid %d (%s) is using legacy pty devices%s\n", 
+		log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", 
 		    td->td_proc->p_pid, td->td_name,
 		    pty_warningcnt ? "" : " - not logging anymore");
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 14:38:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51A5D1065690;
	Wed, 19 Aug 2009 14:38:44 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2716E8FC77;
	Wed, 19 Aug 2009 14:38:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JEcigv056992;
	Wed, 19 Aug 2009 14:38:44 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JEcigk056990;
	Wed, 19 Aug 2009 14:38:44 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908191438.n7JEcigk056990@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 19 Aug 2009 14:38:44 +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: r196379 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 14:38:44 -0000

Author: ed
Date: Wed Aug 19 14:38:43 2009
New Revision: 196379
URL: http://svn.freebsd.org/changeset/base/196379

Log:
  MFC r196378:
  
    Small changes to the warning message generated by pty(4):
  
    - Only print the warning once, instead of filling up the screen.
    - Use the word "legacy" for the pty_warningcnt description, to prevent
      confusion.
    - Use log() instead of printf().
  
    Discussed with: rwatson, jhb
    Approved by:    re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/kern/tty_pty.c

Modified: stable/8/sys/kern/tty_pty.c
==============================================================================
--- stable/8/sys/kern/tty_pty.c	Wed Aug 19 14:30:46 2009	(r196378)
+++ stable/8/sys/kern/tty_pty.c	Wed Aug 19 14:38:43 2009	(r196379)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -47,10 +48,10 @@ __FBSDID("$FreeBSD$");
  * si_drv1 inside the cdev to mark whether the PTY is in use.
  */
 
-static unsigned int pty_warningcnt = 10;
+static unsigned int pty_warningcnt = 1;
 SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW,
 	&pty_warningcnt, 0,
-	"Warnings that will be triggered upon PTY allocation");
+	"Warnings that will be triggered upon legacy PTY allocation");
 
 static int
 ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp)
@@ -74,7 +75,7 @@ ptydev_fdopen(struct cdev *dev, int ffla
 	/* Raise a warning when a legacy PTY has been allocated. */
 	if (pty_warningcnt > 0) {
 		pty_warningcnt--;
-		printf("pid %d (%s) is using legacy pty devices%s\n", 
+		log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n", 
 		    td->td_proc->p_pid, td->td_name,
 		    pty_warningcnt ? "" : " - not logging anymore");
 	}

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 14:39:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CDCE31065695;
	Wed, 19 Aug 2009 14:39:08 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BEF488FC61;
	Wed, 19 Aug 2009 14:39:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JEd88R057037;
	Wed, 19 Aug 2009 14:39:08 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JEd892057035;
	Wed, 19 Aug 2009 14:39:08 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200908191439.n7JEd892057035@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Wed, 19 Aug 2009 14:39:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196380 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 14:39:08 -0000

Author: raj
Date: Wed Aug 19 14:39:08 2009
New Revision: 196380
URL: http://svn.freebsd.org/changeset/base/196380

Log:
  Fix USB cache sync operations for platforms with non-coherent DMA.
  
  - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device,
    so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we
    cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as
    the low level bus dma sync operation is implementation dependent and we
    cannot assume the required order of operations to be guaranteed.
  
  - usb_pc_cpu_flush() is called before writing to a device, so
    BUS_DMASYNC_PREWRITE should be used.
  
  Submitted by:	Grzegorz Bernacki
  Reviewed by:	HPS, arm@, usb@ ML
  Tested by:	HPS, Mike Tancsa
  Approved by:	re (kib)
  Obtained from:	Semihalf

Modified:
  head/sys/dev/usb/usb_busdma.c

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c	Wed Aug 19 14:38:43 2009	(r196379)
+++ head/sys/dev/usb/usb_busdma.c	Wed Aug 19 14:39:08 2009	(r196380)
@@ -679,8 +679,8 @@ usb_pc_cpu_invalidate(struct usb_page_ca
 		/* nothing has been loaded into this page cache! */
 		return;
 	}
-	bus_dmamap_sync(pc->tag, pc->map,
-	    BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD);
 }
 
 /*------------------------------------------------------------------------*
@@ -693,8 +693,7 @@ usb_pc_cpu_flush(struct usb_page_cache *
 		/* nothing has been loaded into this page cache! */
 		return;
 	}
-	bus_dmamap_sync(pc->tag, pc->map,
-	    BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREWRITE);
 }
 
 /*------------------------------------------------------------------------*

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 14:48:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5412106568D;
	Wed, 19 Aug 2009 14:48:59 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A399E8FC62;
	Wed, 19 Aug 2009 14:48:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JEmxQQ057294;
	Wed, 19 Aug 2009 14:48:59 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JEmxMN057292;
	Wed, 19 Aug 2009 14:48:59 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200908191448.n7JEmxMN057292@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Wed, 19 Aug 2009 14:48:59 +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: r196381 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 14:48:59 -0000

Author: raj
Date: Wed Aug 19 14:48:59 2009
New Revision: 196381
URL: http://svn.freebsd.org/changeset/base/196381

Log:
  MFC r196380
  
  Fix USB cache sync operations for platforms with non-coherent DMA.
  
  - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device,
    so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we
    cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as
    the low level bus dma sync operation is implementation dependent and we
    cannot assume the required order of operations to be guaranteed.
  
  - usb_pc_cpu_flush() is called before writing to a device, so
    BUS_DMASYNC_PREWRITE should be used.
  
  Submitted by:	Grzegorz Bernacki
  Reviewed by:	HPS, arm@, usb@ ML
  Tested by:	HPS, Mike Tancsa
  Approved by:	re (kib)
  Obtained from:	Semihalf

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/usb/usb_busdma.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/8/sys/dev/usb/usb_busdma.c	Wed Aug 19 14:39:08 2009	(r196380)
+++ stable/8/sys/dev/usb/usb_busdma.c	Wed Aug 19 14:48:59 2009	(r196381)
@@ -679,8 +679,8 @@ usb_pc_cpu_invalidate(struct usb_page_ca
 		/* nothing has been loaded into this page cache! */
 		return;
 	}
-	bus_dmamap_sync(pc->tag, pc->map,
-	    BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD);
 }
 
 /*------------------------------------------------------------------------*
@@ -693,8 +693,7 @@ usb_pc_cpu_flush(struct usb_page_cache *
 		/* nothing has been loaded into this page cache! */
 		return;
 	}
-	bus_dmamap_sync(pc->tag, pc->map,
-	    BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREWRITE);
 }
 
 /*------------------------------------------------------------------------*

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 15:17:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BEBA61065672;
	Wed, 19 Aug 2009 15:17:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 799898FC3F;
	Wed, 19 Aug 2009 15:17:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JFHDL2057883;
	Wed, 19 Aug 2009 15:17:13 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JFHDFr057881;
	Wed, 19 Aug 2009 15:17:13 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908191517.n7JFHDFr057881@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 19 Aug 2009 15:17:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196382 - head/contrib/top
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 15:17:13 -0000

Author: jhb
Date: Wed Aug 19 15:17:13 2009
New Revision: 196382
URL: http://svn.freebsd.org/changeset/base/196382

Log:
  Explicitly line up the CPU state labels with the calculated starting column
  that takes into account the width of the largest CPU ID.  On systems with
  > 10 CPUs the labels for the first 10 CPUs were not lined up properly
  otherwise.
  
  Approved by:	re (kib)
  MFC after:	1 week

Modified:
  head/contrib/top/display.c

Modified: head/contrib/top/display.c
==============================================================================
--- head/contrib/top/display.c	Wed Aug 19 14:48:59 2009	(r196381)
+++ head/contrib/top/display.c	Wed Aug 19 15:17:13 2009	(r196382)
@@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     lastline++;
 
     /* now walk thru the names and print the line */
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 	printf("\nCPU %d: ", cpu);
     lastline++;
 
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 15:30:39 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 75ADB106564A;
	Wed, 19 Aug 2009 15:30:39 +0000 (UTC) (envelope-from sam@errno.com)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id 4BACF8FC15;
	Wed, 19 Aug 2009 15:30:39 +0000 (UTC)
Received: from ice.local ([10.0.0.115]) (authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n7JFUcfv027649
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 19 Aug 2009 08:30:38 -0700 (PDT) (envelope-from sam@errno.com)
Message-ID: <4A8C1AA0.20303@errno.com>
Date: Wed, 19 Aug 2009 08:30:40 -0700
From: Sam Leffler 
User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605)
MIME-Version: 1.0
To: Rafal Jaworowski 
References: <200908191439.n7JEd892057035@svn.freebsd.org>
In-Reply-To: <200908191439.n7JEd892057035@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196380 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 15:30:39 -0000

Rafal Jaworowski wrote:
> Author: raj
> Date: Wed Aug 19 14:39:08 2009
> New Revision: 196380
> URL: http://svn.freebsd.org/changeset/base/196380
> 
> Log:
>   Fix USB cache sync operations for platforms with non-coherent DMA.
>   
>   - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device,
>     so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we
>     cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as
>     the low level bus dma sync operation is implementation dependent and we
>     cannot assume the required order of operations to be guaranteed.
>   
>   - usb_pc_cpu_flush() is called before writing to a device, so
>     BUS_DMASYNC_PREWRITE should be used.
>   
>   Submitted by:	Grzegorz Bernacki
>   Reviewed by:	HPS, arm@, usb@ ML
>   Tested by:	HPS, Mike Tancsa
>   Approved by:	re (kib)
>   Obtained from:	Semihalf

Is this different from the patch I tested on Gateworks 2358 boards which 
didn't completely resolve problems?

	Sam

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 15:48:54 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61C99106568D;
	Wed, 19 Aug 2009 15:48:54 +0000 (UTC) (envelope-from sam@errno.com)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id 31FCB8FC70;
	Wed, 19 Aug 2009 15:48:54 +0000 (UTC)
Received: from ice.local ([10.0.0.115]) (authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n7JFmrM6027766
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 19 Aug 2009 08:48:53 -0700 (PDT) (envelope-from sam@errno.com)
Message-ID: <4A8C1EE5.3030103@errno.com>
Date: Wed, 19 Aug 2009 08:48:53 -0700
From: Sam Leffler 
User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605)
MIME-Version: 1.0
To: Rafal Jaworowski 
References: <200908191439.n7JEd892057035@svn.freebsd.org>
	<4A8C1AA0.20303@errno.com>
	<81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com>
In-Reply-To: <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC-sonic.net-Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196380 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 15:48:54 -0000

Rafal Jaworowski wrote:
> 
> On 2009-08-19, at 17:30, Sam Leffler wrote:
> 
>> Rafal Jaworowski wrote:
>>> Author: raj
>>> Date: Wed Aug 19 14:39:08 2009
>>> New Revision: 196380
>>> URL: http://svn.freebsd.org/changeset/base/196380
>>> Log:
>>>  Fix USB cache sync operations for platforms with non-coherent DMA.
>>>    - usb_pc_cpu_invalidate() is called between [consecutive] reads 
>>> from a device,
>>>    so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. 
>>> Note we
>>>    cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC 
>>> flags, as
>>>    the low level bus dma sync operation is implementation dependent 
>>> and we
>>>    cannot assume the required order of operations to be guaranteed.
>>>    - usb_pc_cpu_flush() is called before writing to a device, so
>>>    BUS_DMASYNC_PREWRITE should be used.
>>>    Submitted by:    Grzegorz Bernacki
>>>  Reviewed by:    HPS, arm@, usb@ ML
>>>  Tested by:    HPS, Mike Tancsa
>>>  Approved by:    re (kib)
>>>  Obtained from:    Semihalf
>>
>> Is this different from the patch I tested on Gateworks 2358 boards 
>> which didn't completely resolve problems?
> 
> Hm, not sure what patch you have tested with GW. There was an initial 
> workaround for this problem from late June time frame, and this commit 
> is a refined fix identical to the patch posted 05 Aug to arm@. There 
> were other ARM patches in the meantime involving cache sync, but they 
> were pmap-related.

I'm pretty sure it's the same one and was combined with other changes 
you describe.  Unfortunately reproducing the problem requires an 
out-of-tree driver so we can't be sure whether all issues are resolved 
on the platform.

	Sam

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 15:55:51 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FE9B106568B;
	Wed, 19 Aug 2009 15:55:51 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109])
	by mx1.freebsd.org (Postfix) with ESMTP id B6FAF8FC57;
	Wed, 19 Aug 2009 15:55:50 +0000 (UTC)
Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108])
	by smtp.semihalf.com (Postfix) with ESMTPSA id 1383FC4277;
	Wed, 19 Aug 2009 17:35:10 +0200 (CEST)
Message-Id: <81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com>
From: Rafal Jaworowski 
To: Sam Leffler 
In-Reply-To: <4A8C1AA0.20303@errno.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v935.3)
Date: Wed, 19 Aug 2009 17:37:11 +0200
References: <200908191439.n7JEd892057035@svn.freebsd.org>
	<4A8C1AA0.20303@errno.com>
X-Mailer: Apple Mail (2.935.3)
Cc: svn-src-head@FreeBSD.org, Rafal Jaworowski ,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r196380 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 15:55:51 -0000


On 2009-08-19, at 17:30, Sam Leffler wrote:

> Rafal Jaworowski wrote:
>> Author: raj
>> Date: Wed Aug 19 14:39:08 2009
>> New Revision: 196380
>> URL: http://svn.freebsd.org/changeset/base/196380
>> Log:
>>  Fix USB cache sync operations for platforms with non-coherent DMA.
>>    - usb_pc_cpu_invalidate() is called between [consecutive] reads  
>> from a device,
>>    so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be  
>> used. Note we
>>    cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for  
>> BUS_DMASYNC flags, as
>>    the low level bus dma sync operation is implementation dependent  
>> and we
>>    cannot assume the required order of operations to be guaranteed.
>>    - usb_pc_cpu_flush() is called before writing to a device, so
>>    BUS_DMASYNC_PREWRITE should be used.
>>    Submitted by:	Grzegorz Bernacki
>>  Reviewed by:	HPS, arm@, usb@ ML
>>  Tested by:	HPS, Mike Tancsa
>>  Approved by:	re (kib)
>>  Obtained from:	Semihalf
>
> Is this different from the patch I tested on Gateworks 2358 boards  
> which didn't completely resolve problems?

Hm, not sure what patch you have tested with GW. There was an initial  
workaround for this problem from late June time frame, and this commit  
is a refined fix identical to the patch posted 05 Aug to arm@. There  
were other ARM patches in the meantime involving cache sync, but they  
were pmap-related.

Rafal


From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 16:04:24 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A66B5106568B;
	Wed, 19 Aug 2009 16:04:24 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109])
	by mx1.freebsd.org (Postfix) with ESMTP id 593678FC3F;
	Wed, 19 Aug 2009 16:04:24 +0000 (UTC)
Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108])
	by smtp.semihalf.com (Postfix) with ESMTPSA id 99F89C426C;
	Wed, 19 Aug 2009 18:02:21 +0200 (CEST)
Message-Id: 
From: Rafal Jaworowski 
To: Sam Leffler 
In-Reply-To: <4A8C1EE5.3030103@errno.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v935.3)
Date: Wed, 19 Aug 2009 18:04:22 +0200
References: <200908191439.n7JEd892057035@svn.freebsd.org>
	<4A8C1AA0.20303@errno.com>
	<81BE0575-26B5-4EBE-90D5-4B3DDB42F79F@semihalf.com>
	<4A8C1EE5.3030103@errno.com>
X-Mailer: Apple Mail (2.935.3)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196380 - head/sys/dev/usb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 16:04:24 -0000


On 2009-08-19, at 17:48, Sam Leffler wrote:

>>> Is this different from the patch I tested on Gateworks 2358 boards  
>>> which didn't completely resolve problems?
>> Hm, not sure what patch you have tested with GW. There was an  
>> initial workaround for this problem from late June time frame, and  
>> this commit is a refined fix identical to the patch posted 05 Aug  
>> to arm@. There were other ARM patches in the meantime involving  
>> cache sync, but they were pmap-related.
>
> I'm pretty sure it's the same one and was combined with other  
> changes you describe.  Unfortunately reproducing the problem  
> requires an out-of-tree driver so we can't be sure whether all  
> issues are resolved on the platform.

There could still be other issues with the USB stack: we are observing  
instabilities on some PowerPC machine and EHCI controller, but I don't  
have a detailed scenario yet. The cache sync routines from this commit  
were clearly wrong and the fix helps for failing scenarios we were  
observing on ARM, although in your case it's difficult to say without  
reproducing.

Rafal


From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 16:29:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5401B106568E;
	Wed, 19 Aug 2009 16:29:21 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 262168FC3F;
	Wed, 19 Aug 2009 16:29:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JGTL7r059423;
	Wed, 19 Aug 2009 16:29:21 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JGTLo0059421;
	Wed, 19 Aug 2009 16:29:21 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200908191629.n7JGTLo0059421@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 19 Aug 2009 16:29:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196383 - head/sbin/bsdlabel
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 16:29:21 -0000

Author: marcel
Date: Wed Aug 19 16:29:20 2009
New Revision: 196383
URL: http://svn.freebsd.org/changeset/base/196383

Log:
  Remove the dependency on the kernel -- in particular the gctl request to
  the GEOM_BSD class -- to translate the absolute offsets in the label to
  relative ones. This makes bslabel(8) work correctly with GEOM_PART and
  also when the BSD label is nested under arbitrary partitioning schemes.
  
  Inspired by:	Eygene Ryabinkin 
  Approved by:	re (kib)

Modified:
  head/sbin/bsdlabel/bsdlabel.c

Modified: head/sbin/bsdlabel/bsdlabel.c
==============================================================================
--- head/sbin/bsdlabel/bsdlabel.c	Wed Aug 19 15:17:13 2009	(r196382)
+++ head/sbin/bsdlabel/bsdlabel.c	Wed Aug 19 16:29:20 2009	(r196383)
@@ -118,7 +118,7 @@ static int	installboot;	/* non-zero if w
 static int	allfields;	/* present all fields in edit */
 static char const *xxboot;	/* primary boot */
 
-static off_t mbroffset;
+static uint32_t lba_offset;
 #ifndef LABELSECTOR
 #define LABELSECTOR -1
 #endif
@@ -403,7 +403,7 @@ writelabel(void)
 		readboot();
 	for (i = 0; i < lab.d_npartitions; i++)
 		if (lab.d_partitions[i].p_size)
-			lab.d_partitions[i].p_offset += mbroffset;
+			lab.d_partitions[i].p_offset += lba_offset;
 	bsd_disklabel_le_enc(bootarea + labeloffset + labelsoffset * secsize,
 	    lp);
 	if (alphacksum) {
@@ -479,10 +479,9 @@ get_file_parms(int f)
 static int
 readlabel(int flag)
 {
+	uint32_t lba;
 	int f, i;
 	int error;
-	struct gctl_req *grq;
-	char const *errstr;
 
 	f = open(specname, O_RDONLY);
 	if (f < 0)
@@ -510,22 +509,28 @@ readlabel(int flag)
 
 	if (is_file)
 		return(0);
-	grq = gctl_get_handle();
-	gctl_ro_param(grq, "verb", -1, "read mbroffset");
-	gctl_ro_param(grq, "class", -1, "BSD");
-	gctl_ro_param(grq, "geom", -1, pname);
-	gctl_rw_param(grq, "mbroffset", sizeof(mbroffset), &mbroffset);
-	errstr = gctl_issue(grq);
-	if (errstr != NULL) {
-		mbroffset = 0;
-		gctl_free(grq);
-		return (error);
+
+	/*
+	 * Compensate for absolute block addressing by finding the
+	 * smallest partition offset and if the offset of the 'c'
+	 * partition is equal to that, subtract it from all offsets.
+	 */
+	lba = ~0;
+	for (i = 0; i < lab.d_npartitions; i++) {
+		if (lab.d_partitions[i].p_size)
+			lba = MIN(lba, lab.d_partitions[i].p_offset);
 	}
-	mbroffset /= lab.d_secsize;
-	if (lab.d_partitions[RAW_PART].p_offset == mbroffset)
-		for (i = 0; i < lab.d_npartitions; i++)
+	if (lba != 0 && lab.d_partitions[RAW_PART].p_offset == lba) {
+		for (i = 0; i < lab.d_npartitions; i++) {
 			if (lab.d_partitions[i].p_size)
-				lab.d_partitions[i].p_offset -= mbroffset;
+				lab.d_partitions[i].p_offset -= lba;
+		}
+		/*
+		 * Save the offset so that we can write the label
+		 * back with absolute block addresses.
+		 */
+		lba_offset = lba;
+	}
 	return (error);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 16:40:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25612106568B;
	Wed, 19 Aug 2009 16:40:46 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EAF938FC57;
	Wed, 19 Aug 2009 16:40:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JGej4X059696;
	Wed, 19 Aug 2009 16:40:45 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JGej95059694;
	Wed, 19 Aug 2009 16:40:45 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200908191640.n7JGej95059694@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 19 Aug 2009 16:40: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: r196384 - stable/8/sbin/bsdlabel
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 16:40:46 -0000

Author: marcel
Date: Wed Aug 19 16:40:45 2009
New Revision: 196384
URL: http://svn.freebsd.org/changeset/base/196384

Log:
  MFC change 196383:
   Remove the dependency on the kernel -- in particular the gctl request to
   the GEOM_BSD class -- to translate the absolute offsets in the label to
   relative ones. This makes bslabel(8) work correctly with GEOM_PART and
   also when the BSD label is nested under arbitrary partitioning schemes.
  
  Inspired by:	Eygene Ryabinkin 
  Approved by:	re (kib)

Modified:
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/bsdlabel/bsdlabel.c

Modified: stable/8/sbin/bsdlabel/bsdlabel.c
==============================================================================
--- stable/8/sbin/bsdlabel/bsdlabel.c	Wed Aug 19 16:29:20 2009	(r196383)
+++ stable/8/sbin/bsdlabel/bsdlabel.c	Wed Aug 19 16:40:45 2009	(r196384)
@@ -118,7 +118,7 @@ static int	installboot;	/* non-zero if w
 static int	allfields;	/* present all fields in edit */
 static char const *xxboot;	/* primary boot */
 
-static off_t mbroffset;
+static uint32_t lba_offset;
 #ifndef LABELSECTOR
 #define LABELSECTOR -1
 #endif
@@ -403,7 +403,7 @@ writelabel(void)
 		readboot();
 	for (i = 0; i < lab.d_npartitions; i++)
 		if (lab.d_partitions[i].p_size)
-			lab.d_partitions[i].p_offset += mbroffset;
+			lab.d_partitions[i].p_offset += lba_offset;
 	bsd_disklabel_le_enc(bootarea + labeloffset + labelsoffset * secsize,
 	    lp);
 	if (alphacksum) {
@@ -479,10 +479,9 @@ get_file_parms(int f)
 static int
 readlabel(int flag)
 {
+	uint32_t lba;
 	int f, i;
 	int error;
-	struct gctl_req *grq;
-	char const *errstr;
 
 	f = open(specname, O_RDONLY);
 	if (f < 0)
@@ -510,22 +509,28 @@ readlabel(int flag)
 
 	if (is_file)
 		return(0);
-	grq = gctl_get_handle();
-	gctl_ro_param(grq, "verb", -1, "read mbroffset");
-	gctl_ro_param(grq, "class", -1, "BSD");
-	gctl_ro_param(grq, "geom", -1, pname);
-	gctl_rw_param(grq, "mbroffset", sizeof(mbroffset), &mbroffset);
-	errstr = gctl_issue(grq);
-	if (errstr != NULL) {
-		mbroffset = 0;
-		gctl_free(grq);
-		return (error);
+
+	/*
+	 * Compensate for absolute block addressing by finding the
+	 * smallest partition offset and if the offset of the 'c'
+	 * partition is equal to that, subtract it from all offsets.
+	 */
+	lba = ~0;
+	for (i = 0; i < lab.d_npartitions; i++) {
+		if (lab.d_partitions[i].p_size)
+			lba = MIN(lba, lab.d_partitions[i].p_offset);
 	}
-	mbroffset /= lab.d_secsize;
-	if (lab.d_partitions[RAW_PART].p_offset == mbroffset)
-		for (i = 0; i < lab.d_npartitions; i++)
+	if (lba != 0 && lab.d_partitions[RAW_PART].p_offset == lba) {
+		for (i = 0; i < lab.d_npartitions; i++) {
 			if (lab.d_partitions[i].p_size)
-				lab.d_partitions[i].p_offset -= mbroffset;
+				lab.d_partitions[i].p_offset -= lba;
+		}
+		/*
+		 * Save the offset so that we can write the label
+		 * back with absolute block addresses.
+		 */
+		lba_offset = lba;
+	}
 	return (error);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 17:45:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6775106568F;
	Wed, 19 Aug 2009 17:45:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 90F9B8FC60;
	Wed, 19 Aug 2009 17:45:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JHjxmv061006;
	Wed, 19 Aug 2009 17:45:59 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JHjxKU061005;
	Wed, 19 Aug 2009 17:45:59 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908191745.n7JHjxKU061005@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 19 Aug 2009 17:45:59 +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: r196385 - stable/8/contrib/top
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 17:45:59 -0000

Author: jhb
Date: Wed Aug 19 17:45:58 2009
New Revision: 196385
URL: http://svn.freebsd.org/changeset/base/196385

Log:
  MFC 196382:
  Explicitly line up the CPU state labels with the calculated starting column
  that takes into account the width of the largest CPU ID.  On systems with
  > 10 CPUs the labels for the first 10 CPUs were not lined up properly
  otherwise.
  
  Approved by:	re (kib)

Modified:
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/display.c
  stable/8/contrib/top/install-sh   (props changed)

Modified: stable/8/contrib/top/display.c
==============================================================================
--- stable/8/contrib/top/display.c	Wed Aug 19 16:40:45 2009	(r196384)
+++ stable/8/contrib/top/display.c	Wed Aug 19 17:45:58 2009	(r196385)
@@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     lastline++;
 
     /* now walk thru the names and print the line */
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 	printf("\nCPU %d: ", cpu);
     lastline++;
 
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 17:59:42 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AFB8F106568E;
	Wed, 19 Aug 2009 17:59:42 +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 9AD818FC67;
	Wed, 19 Aug 2009 17:59:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JHxgFj061295;
	Wed, 19 Aug 2009 17:59:42 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JHxfJg061294;
	Wed, 19 Aug 2009 17:59:41 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200908191759.n7JHxfJg061294@svn.freebsd.org>
From: Xin LI 
Date: Wed, 19 Aug 2009 17:59:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196386 - head/sys/dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 17:59:42 -0000

Author: delphij
Date: Wed Aug 19 17:59:41 2009
New Revision: 196386
URL: http://svn.freebsd.org/changeset/base/196386

Log:
  Temporarily enhance em(4) and igb(4) hack to take account for IFF_NOARP.
  Without this changeset there will be no way to prevent these NICs from
  sending ARP, which is harmful in server farms that is configured as
  "Direct Server Return" behind a load balancer.
  
  A better fix would remove the whole hack completely but it would be
  later than 8.0-RELEASE.
  
  Reviewed by:	jfv, yongari
  Approved by:	re (kib)

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Wed Aug 19 17:45:58 2009	(r196385)
+++ head/sys/dev/e1000/if_em.c	Wed Aug 19 17:59:41 2009	(r196386)
@@ -1204,7 +1204,8 @@ em_ioctl(struct ifnet *ifp, u_long comma
 				em_init_locked(adapter);
 				EM_CORE_UNLOCK(adapter);
 			}
-			arp_ifinit(ifp, ifa);
+			if (!(ifp->if_flags & IFF_NOARP))
+				arp_ifinit(ifp, ifa);
 		} else
 #endif
 			error = ether_ioctl(ifp, command, data);

Modified: head/sys/dev/e1000/if_igb.c
==============================================================================
--- head/sys/dev/e1000/if_igb.c	Wed Aug 19 17:45:58 2009	(r196385)
+++ head/sys/dev/e1000/if_igb.c	Wed Aug 19 17:59:41 2009	(r196386)
@@ -952,7 +952,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm
 				igb_init_locked(adapter);
 				IGB_CORE_UNLOCK(adapter);
 			}
-			arp_ifinit(ifp, ifa);
+			if (!(ifp->if_flags & IFF_NOARP))
+				arp_ifinit(ifp, ifa);
 		} else
 #endif
 			error = ether_ioctl(ifp, command, data);

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 18:08:52 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DCDC106568D;
	Wed, 19 Aug 2009 18:08:52 +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 17F918FC72;
	Wed, 19 Aug 2009 18:08:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JI8pVm061611;
	Wed, 19 Aug 2009 18:08:51 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JI8pNM061610;
	Wed, 19 Aug 2009 18:08:51 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200908191808.n7JI8pNM061610@svn.freebsd.org>
From: Xin LI 
Date: Wed, 19 Aug 2009 18:08:51 +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: r196387 - in stable/8/sys: . dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 18:08:52 -0000

Author: delphij
Date: Wed Aug 19 18:08:50 2009
New Revision: 196387
URL: http://svn.freebsd.org/changeset/base/196387

Log:
  MFC r196386:
  
  Temporarily enhance em(4) and igb(4) hack to take account for IFF_NOARP.
  Without this changeset there will be no way to prevent these NICs from
  sending ARP, which is harmful in server farms that is configured as
  "Direct Server Return" behind a load balancer.
  
  A better fix would remove the whole hack completely but it would be
  later than 8.0-RELEASE.
  
  Reviewed by:	jfv, yongari
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/e1000/if_em.c
  stable/8/sys/dev/e1000/if_igb.c

Modified: stable/8/sys/dev/e1000/if_em.c
==============================================================================
--- stable/8/sys/dev/e1000/if_em.c	Wed Aug 19 17:59:41 2009	(r196386)
+++ stable/8/sys/dev/e1000/if_em.c	Wed Aug 19 18:08:50 2009	(r196387)
@@ -1204,7 +1204,8 @@ em_ioctl(struct ifnet *ifp, u_long comma
 				em_init_locked(adapter);
 				EM_CORE_UNLOCK(adapter);
 			}
-			arp_ifinit(ifp, ifa);
+			if (!(ifp->if_flags & IFF_NOARP))
+				arp_ifinit(ifp, ifa);
 		} else
 #endif
 			error = ether_ioctl(ifp, command, data);

Modified: stable/8/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/8/sys/dev/e1000/if_igb.c	Wed Aug 19 17:59:41 2009	(r196386)
+++ stable/8/sys/dev/e1000/if_igb.c	Wed Aug 19 18:08:50 2009	(r196387)
@@ -952,7 +952,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm
 				igb_init_locked(adapter);
 				IGB_CORE_UNLOCK(adapter);
 			}
-			arp_ifinit(ifp, ifa);
+			if (!(ifp->if_flags & IFF_NOARP))
+				arp_ifinit(ifp, ifa);
 		} else
 #endif
 			error = ether_ioctl(ifp, command, data);

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 19:07:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7ED6F106568F;
	Wed, 19 Aug 2009 19:07:08 +0000 (UTC)
	(envelope-from jfvogel@gmail.com)
Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240])
	by mx1.freebsd.org (Postfix) with ESMTP id D1C2A8FC43;
	Wed, 19 Aug 2009 19:07:07 +0000 (UTC)
Received: by an-out-0708.google.com with SMTP id d14so1708421and.13
	for ; Wed, 19 Aug 2009 12:07:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:in-reply-to:references
	:date:message-id:subject:from:to:cc:content-type;
	bh=lSvS1UtKvd4kdsuqWMfsB1FSND4djbuDIeLR3Mk4pA0=;
	b=Udw843J8599KG+A2kYkfvLAU8JinsMPyDLFRWLbHmUgC5Qf1TLTWAzXKjQzJf/qlYP
	bRBNB7LdjoTZccdTx1MJxOZg1UjbmbdZeTBY7AVIR8tQ9ASvr85nP8Vu5cofpykJVCWv
	uLYhnLPjpb4sQSq8fQVvPsPCOL/oY73dfZvTU=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type;
	b=V9UQjmjpgoatKhE03ylABpNbuSn719+1mttvLSfIFOnGqg7M1aXMuslAkJpP64Xyyq
	wd4V4v0n2uxB8EuYmSbwxFG/+0eMupz93LYRllaLAGMFGRSel8tDUEHFJZINfKOxgyD0
	jvW8scc+BNh77cZW3xx5IM1QfCB68hFOdvj7w=
MIME-Version: 1.0
Received: by 10.101.90.3 with SMTP id s3mr7547748anl.23.1250707214359; Wed, 19 
	Aug 2009 11:40:14 -0700 (PDT)
In-Reply-To: <200908191808.n7JI8pNM061610@svn.freebsd.org>
References: <200908191808.n7JI8pNM061610@svn.freebsd.org>
Date: Wed, 19 Aug 2009 11:40:14 -0700
Message-ID: <2a41acea0908191140n7ac726b6x46ae428e3490e0de@mail.gmail.com>
From: Jack Vogel 
To: Xin LI 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Content-Filtered-By: Mailman/MimeDel 2.1.5
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: r196387 - in stable/8/sys: . dev/e1000
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 19:07:08 -0000

Thanks for doing this for me Xin.

Jack


On Wed, Aug 19, 2009 at 11:08 AM, Xin LI  wrote:

> Author: delphij
> Date: Wed Aug 19 18:08:50 2009
> New Revision: 196387
> URL: http://svn.freebsd.org/changeset/base/196387
>
> Log:
>  MFC r196386:
>
>  Temporarily enhance em(4) and igb(4) hack to take account for IFF_NOARP.
>  Without this changeset there will be no way to prevent these NICs from
>  sending ARP, which is harmful in server farms that is configured as
>  "Direct Server Return" behind a load balancer.
>
>  A better fix would remove the whole hack completely but it would be
>  later than 8.0-RELEASE.
>
>  Reviewed by:  jfv, yongari
>  Approved by:  re (kib)
>
> Modified:
>  stable/8/sys/   (props changed)
>  stable/8/sys/dev/e1000/if_em.c
>  stable/8/sys/dev/e1000/if_igb.c
>
> Modified: stable/8/sys/dev/e1000/if_em.c
>
> ==============================================================================
> --- stable/8/sys/dev/e1000/if_em.c      Wed Aug 19 17:59:41 2009
>  (r196386)
> +++ stable/8/sys/dev/e1000/if_em.c      Wed Aug 19 18:08:50 2009
>  (r196387)
> @@ -1204,7 +1204,8 @@ em_ioctl(struct ifnet *ifp, u_long comma
>                                em_init_locked(adapter);
>                                EM_CORE_UNLOCK(adapter);
>                        }
> -                       arp_ifinit(ifp, ifa);
> +                       if (!(ifp->if_flags & IFF_NOARP))
> +                               arp_ifinit(ifp, ifa);
>                } else
>  #endif
>                        error = ether_ioctl(ifp, command, data);
>
> Modified: stable/8/sys/dev/e1000/if_igb.c
>
> ==============================================================================
> --- stable/8/sys/dev/e1000/if_igb.c     Wed Aug 19 17:59:41 2009
>  (r196386)
> +++ stable/8/sys/dev/e1000/if_igb.c     Wed Aug 19 18:08:50 2009
>  (r196387)
> @@ -952,7 +952,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm
>                                igb_init_locked(adapter);
>                                IGB_CORE_UNLOCK(adapter);
>                        }
> -                       arp_ifinit(ifp, ifa);
> +                       if (!(ifp->if_flags & IFF_NOARP))
> +                               arp_ifinit(ifp, ifa);
>                } else
>  #endif
>                        error = ether_ioctl(ifp, command, data);
>

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 20:13:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7ABDB106568B;
	Wed, 19 Aug 2009 20:13:09 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 50B2A8FC6B;
	Wed, 19 Aug 2009 20:13:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JKD9Ie064196;
	Wed, 19 Aug 2009 20:13:09 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JKD9RD064194;
	Wed, 19 Aug 2009 20:13:09 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200908192013.n7JKD9RD064194@svn.freebsd.org>
From: Kip Macy 
Date: Wed, 19 Aug 2009 20:13:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196388 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 20:13:09 -0000

Author: kmacy
Date: Wed Aug 19 20:13:09 2009
New Revision: 196388
URL: http://svn.freebsd.org/changeset/base/196388

Log:
  This change fixes a comment and addresses a complaint by kib@ by
  moving a frequently executed flowtable syslog statement from being
  conditional on bootverbose to conditional on a per-vnet flowtable
  sysctl.
  
  Approved by:	re@

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Wed Aug 19 18:08:50 2009	(r196387)
+++ head/sys/net/flowtable.c	Wed Aug 19 20:13:09 2009	(r196388)
@@ -199,6 +199,7 @@ static uint32_t		flowclean_cycles;
  * - idetach() cleanup for options VIMAGE builds.
  */
 VNET_DEFINE(int, flowtable_enable) = 1;
+static VNET_DEFINE(int, flowtable_debug);
 static VNET_DEFINE(int, flowtable_hits);
 static VNET_DEFINE(int, flowtable_lookups);
 static VNET_DEFINE(int, flowtable_misses);
@@ -214,6 +215,7 @@ static VNET_DEFINE(int, flowtable_nmbflo
 static VNET_DEFINE(int, flowtable_ready) = 0;
 
 #define	V_flowtable_enable		VNET(flowtable_enable)
+#define	V_flowtable_debug		VNET(flowtable_debug)
 #define	V_flowtable_hits		VNET(flowtable_hits)
 #define	V_flowtable_lookups		VNET(flowtable_lookups)
 #define	V_flowtable_misses		VNET(flowtable_misses)
@@ -229,6 +231,8 @@ static VNET_DEFINE(int, flowtable_ready)
 #define	V_flowtable_ready		VNET(flowtable_ready)
 
 SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable");
+SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, debug, CTLFLAG_RW,
+    &VNET_NAME(flowtable_debug), 0, "print debug info.");
 SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW,
     &VNET_NAME(flowtable_enable), 0, "enable flowtable caching.");
 SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD,
@@ -902,7 +906,7 @@ flowtable_free_stale(struct flowtable *f
 		V_flowtable_frees++;
 		fle_free(fle);
 	}
-	if (bootverbose && count)
+	if (V_flowtable_debug && count)
 		log(LOG_DEBUG, "freed %d flow entries\n", count);
 }
 
@@ -954,7 +958,7 @@ flowtable_cleaner(void)
 
 		flowclean_cycles++;
 		/*
-		 * The 20 second interval between cleaning checks
+		 * The 10 second interval between cleaning checks
 		 * is arbitrary
 		 */
 		mtx_lock(&flowclean_lock);

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 20:17:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 257CA1065672;
	Wed, 19 Aug 2009 20:17:37 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED8418FC59;
	Wed, 19 Aug 2009 20:17:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JKHaTZ064341;
	Wed, 19 Aug 2009 20:17:36 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JKHaKL064339;
	Wed, 19 Aug 2009 20:17:36 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200908192017.n7JKHaKL064339@svn.freebsd.org>
From: Kip Macy 
Date: Wed, 19 Aug 2009 20:17:36 +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: r196389 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 20:17:37 -0000

Author: kmacy
Date: Wed Aug 19 20:17:36 2009
New Revision: 196389
URL: http://svn.freebsd.org/changeset/base/196389

Log:
   This change fixes a comment and addresses a complaint by kib@ by
   moving a frequently executed flowtable syslog statement from being
   conditional on bootverbose to conditional on a per-vnet flowtable
   sysctl.
  
  Approved by:	re@

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/net/flowtable.c

Modified: stable/8/sys/net/flowtable.c
==============================================================================
--- stable/8/sys/net/flowtable.c	Wed Aug 19 20:13:09 2009	(r196388)
+++ stable/8/sys/net/flowtable.c	Wed Aug 19 20:17:36 2009	(r196389)
@@ -199,6 +199,7 @@ static uint32_t		flowclean_cycles;
  * - idetach() cleanup for options VIMAGE builds.
  */
 VNET_DEFINE(int, flowtable_enable) = 1;
+static VNET_DEFINE(int, flowtable_debug);
 static VNET_DEFINE(int, flowtable_hits);
 static VNET_DEFINE(int, flowtable_lookups);
 static VNET_DEFINE(int, flowtable_misses);
@@ -214,6 +215,7 @@ static VNET_DEFINE(int, flowtable_nmbflo
 static VNET_DEFINE(int, flowtable_ready) = 0;
 
 #define	V_flowtable_enable		VNET(flowtable_enable)
+#define	V_flowtable_debug		VNET(flowtable_debug)
 #define	V_flowtable_hits		VNET(flowtable_hits)
 #define	V_flowtable_lookups		VNET(flowtable_lookups)
 #define	V_flowtable_misses		VNET(flowtable_misses)
@@ -229,6 +231,8 @@ static VNET_DEFINE(int, flowtable_ready)
 #define	V_flowtable_ready		VNET(flowtable_ready)
 
 SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable");
+SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, debug, CTLFLAG_RW,
+    &VNET_NAME(flowtable_debug), 0, "print debug info.");
 SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW,
     &VNET_NAME(flowtable_enable), 0, "enable flowtable caching.");
 SYSCTL_VNET_INT(_net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD,
@@ -902,7 +906,7 @@ flowtable_free_stale(struct flowtable *f
 		V_flowtable_frees++;
 		fle_free(fle);
 	}
-	if (bootverbose && count)
+	if (V_flowtable_debug && count)
 		log(LOG_DEBUG, "freed %d flow entries\n", count);
 }
 
@@ -954,7 +958,7 @@ flowtable_cleaner(void)
 
 		flowclean_cycles++;
 		/*
-		 * The 20 second interval between cleaning checks
+		 * The 10 second interval between cleaning checks
 		 * is arbitrary
 		 */
 		mtx_lock(&flowclean_lock);

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 20:39:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2432F106568D;
	Wed, 19 Aug 2009 20:39:34 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 148D88FC16;
	Wed, 19 Aug 2009 20:39:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JKdX5F064771;
	Wed, 19 Aug 2009 20:39:33 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JKdXTt064768;
	Wed, 19 Aug 2009 20:39:33 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908192039.n7JKdXTt064768@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 19 Aug 2009 20:39:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196390 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 20:39:34 -0000

Author: ed
Date: Wed Aug 19 20:39:33 2009
New Revision: 196390
URL: http://svn.freebsd.org/changeset/base/196390

Log:
  Make the MacBookPro3,1 hardware boot again.
  
  Tested by:	Patrick Lamaiziere 
  Approved by:	re (kib)

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Wed Aug 19 20:17:36 2009	(r196389)
+++ head/sys/amd64/amd64/machdep.c	Wed Aug 19 20:39:33 2009	(r196390)
@@ -217,6 +217,7 @@ cpu_startup(dummy)
 		    strncmp(sysenv, "MacBook3,1", 10) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
+		    strncmp(sysenv, "MacBookPro3,1", 13) == 0 ||
 		    strncmp(sysenv, "Macmini1,1", 10) == 0) {
 			if (bootverbose)
 				printf("Disabling LEGACY_USB_EN bit on "

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Wed Aug 19 20:17:36 2009	(r196389)
+++ head/sys/i386/i386/machdep.c	Wed Aug 19 20:39:33 2009	(r196390)
@@ -261,6 +261,7 @@ cpu_startup(dummy)
 		    strncmp(sysenv, "MacBook3,1", 10) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
+		    strncmp(sysenv, "MacBookPro3,1", 13) == 0 ||
 		    strncmp(sysenv, "Macmini1,1", 10) == 0) {
 			if (bootverbose)
 				printf("Disabling LEGACY_USB_EN bit on "

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 20:44:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60A0B106568D;
	Wed, 19 Aug 2009 20:44:22 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F0D68FC43;
	Wed, 19 Aug 2009 20:44:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JKiM4T064924;
	Wed, 19 Aug 2009 20:44:22 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JKiMdd064921;
	Wed, 19 Aug 2009 20:44:22 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908192044.n7JKiMdd064921@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 19 Aug 2009 20:44: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: r196391 - in stable/8/sys: . amd64/amd64
	amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica
	contrib/pf dev/xen/xenpci i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 20:44:22 -0000

Author: ed
Date: Wed Aug 19 20:44:22 2009
New Revision: 196391
URL: http://svn.freebsd.org/changeset/base/196391

Log:
  MFC r196390:
  
    Make the MacBookPro3,1 hardware boot again.
  
    Tested by:    Patrick Lamaiziere 
    Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/machdep.c
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/machdep.c

Modified: stable/8/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/machdep.c	Wed Aug 19 20:39:33 2009	(r196390)
+++ stable/8/sys/amd64/amd64/machdep.c	Wed Aug 19 20:44:22 2009	(r196391)
@@ -217,6 +217,7 @@ cpu_startup(dummy)
 		    strncmp(sysenv, "MacBook3,1", 10) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
+		    strncmp(sysenv, "MacBookPro3,1", 13) == 0 ||
 		    strncmp(sysenv, "Macmini1,1", 10) == 0) {
 			if (bootverbose)
 				printf("Disabling LEGACY_USB_EN bit on "

Modified: stable/8/sys/i386/i386/machdep.c
==============================================================================
--- stable/8/sys/i386/i386/machdep.c	Wed Aug 19 20:39:33 2009	(r196390)
+++ stable/8/sys/i386/i386/machdep.c	Wed Aug 19 20:44:22 2009	(r196391)
@@ -261,6 +261,7 @@ cpu_startup(dummy)
 		    strncmp(sysenv, "MacBook3,1", 10) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,1", 13) == 0 ||
 		    strncmp(sysenv, "MacBookPro1,2", 13) == 0 ||
+		    strncmp(sysenv, "MacBookPro3,1", 13) == 0 ||
 		    strncmp(sysenv, "Macmini1,1", 10) == 0) {
 			if (bootverbose)
 				printf("Disabling LEGACY_USB_EN bit on "

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 20:47:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB223106568B;
	Wed, 19 Aug 2009 20:47:31 +0000 (UTC)
	(envelope-from simon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA7458FC57;
	Wed, 19 Aug 2009 20:47:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JKlVRw065024;
	Wed, 19 Aug 2009 20:47:31 GMT (envelope-from simon@svn.freebsd.org)
Received: (from simon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JKlVCE065020;
	Wed, 19 Aug 2009 20:47:31 GMT (envelope-from simon@svn.freebsd.org)
Message-Id: <200908192047.n7JKlVCE065020@svn.freebsd.org>
From: "Simon L. Nielsen" 
Date: Wed, 19 Aug 2009 20:47:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196392 - in head: etc share/man/man5
	usr.sbin/freebsd-update
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 20:47:32 -0000

Author: simon
Date: Wed Aug 19 20:47:31 2009
New Revision: 196392
URL: http://svn.freebsd.org/changeset/base/196392

Log:
  Add support for backing up the old kernel when installing a new kernel
  using freebsd-update.  This applies to using freebsd-update in "upgrade
  mode" and normal freebsd-update on a security branch.
  
  The backup kernel will be written to /boot/kernel.old, if the directory
  does not exist, or the directory was created by freebsd-update in a
  previous backup.  Otherwise freebsd-update will generate a new directory
  name for use by the backup.  By default symbol files are not backed up
  to save diskspace and avoid filling up the root partition.
  
  This feature is fully configurable in the freebsd-update config file,
  but defaults to enabled.
  
  MFC after:	1 week (stable/7)
  Reviewed by:	cperciva
  Approved by:	re (kib)

Modified:
  head/etc/freebsd-update.conf
  head/share/man/man5/freebsd-update.conf.5
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/etc/freebsd-update.conf
==============================================================================
--- head/etc/freebsd-update.conf	Wed Aug 19 20:44:22 2009	(r196391)
+++ head/etc/freebsd-update.conf	Wed Aug 19 20:47:31 2009	(r196392)
@@ -63,3 +63,14 @@ MergeChanges /etc/ /var/named/etc/ /boot
 # which *might* be installed of which FreeBSD Update should figure out
 # which actually are installed and upgrade those (StrictComponents no)?
 # StrictComponents no
+
+# When installing a new kernel perform a backup of the old one first
+# so it is possible to boot the old kernel in case of problems.
+# BackupKernel yes
+
+# If BackupKernel is enabled, the backup kernel is saved to this
+# directory.
+# BackupKernelDir /boot/kernel.old
+
+# When backing up a kernel also back up debug symbol files?
+# BackupKernelSymbolFiles no

Modified: head/share/man/man5/freebsd-update.conf.5
==============================================================================
--- head/share/man/man5/freebsd-update.conf.5	Wed Aug 19 20:44:22 2009	(r196391)
+++ head/share/man/man5/freebsd-update.conf.5	Wed Aug 19 20:47:31 2009	(r196392)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 30, 2006
+.Dd August 19, 2009
 .Dt FREEBSD-UPDATE.CONF 5
 .Os FreeBSD
 .Sh NAME
@@ -48,7 +48,7 @@ error.
 .Pp
 The possible options and their meanings are as follows:
 .Pp
-.Bl -tag -width "KeepModifiedMetadata"
+.Bl -tag -width ".Cm BackupKernelSymbolFiles"
 .It Cm KeyPrint
 The single parameter following this keyword is the SHA256 hash
 of the RSA key which will be trusted to sign updates.
@@ -171,6 +171,54 @@ command is used ("yes"), or merely as a 
 which might be installed, of which
 .Cm freebsd-update
 should identify which in fact are present ("no").
+.It Cm BackupKernel
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will create a backup of the old kernel before installing a new kernel.
+This backup kernel can be used to recover a system where the newly
+installed kernel somehow did not work.
+Note that the backup kernel is not reverted to its original state by
+the
+.Cm freebsd-update
+rollback command.
+.It Cm BackupKernelDir
+This keyword sets the directory which is used to store a backup
+kernel, if the BackupKernel feature is enabled.
+If the directory already exist, and it was not created by
+.Cm freebsd-update ,
+the directory is skipped.
+In the case of the primary directory name not being usable, a number
+starting with
+.Sq 1
+is appended to the directory name.
+Like with the primary directory name, the constructed directory name is
+only used if the path name does not exist, or if the directory was
+previously created by
+.Cm freebsd-update .
+If the constructed directory still exist the appended number is
+incremented with 1 and the directory search process restarted.
+Should the number increment go above 9,
+.Cm freebsd-update
+will abort.
+.It Cm BackupKernelSymbolFiles
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will also backup kernel symbol files, if they exist.
+The kernel symbol files takes up a lot of disk space and are not
+needed for recovery purposes.
+If the symbol files are needed, after recovering a system using the
+backup kernel, the
+.Cm freebsd-update
+rollback command will recreate the symbol files along with the old
+kernel.
 .El
 .Sh FILES
 .Bl -tag -width "/etc/freebsd-update.conf"

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- head/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 20:44:22 2009	(r196391)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 20:47:31 2009	(r196392)
@@ -88,7 +88,7 @@ EOF
 CONFIGOPTIONS="KEYPRINT WORKDIR SERVERNAME MAILTO ALLOWADD ALLOWDELETE
     KEEPMODIFIEDMETADATA COMPONENTS IGNOREPATHS UPDATEIFUNMODIFIED
     BASEDIR VERBOSELEVEL TARGETRELEASE STRICTCOMPONENTS MERGECHANGES
-    IDSIGNOREPATHS"
+    IDSIGNOREPATHS BACKUPKERNEL BACKUPKERNELDIR BACKUPKERNELSYMBOLFILES"
 
 # Set all the configuration options to "".
 nullconfig () {
@@ -308,6 +308,70 @@ config_VerboseLevel () {
 	fi
 }
 
+config_BackupKernel () {
+	if [ -z ${BACKUPKERNEL} ]; then
+		case $1 in
+		[Yy][Ee][Ss])
+			BACKUPKERNEL=yes
+			;;
+		[Nn][Oo])
+			BACKUPKERNEL=no
+			;;
+		*)
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
+config_BackupKernelDir () {
+	if [ -z ${BACKUPKERNELDIR} ]; then
+		if [ -z "$1" ]; then
+			echo "BackupKernelDir set to empty dir"
+			return 1
+		fi
+
+		# We check for some paths which would be extremely odd
+		# to use, but which could cause a lot of problems if
+		# used.
+		case $1 in
+		/|/bin|/boot|/etc|/lib|/libexec|/sbin|/usr|/var)
+			echo "BackupKernelDir set to invalid path $1"
+			return 1
+			;;
+		/*)
+			BACKUPKERNELDIR=$1
+			;;
+		*)
+			echo "BackupKernelDir ($1) is not an absolute path"
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
+config_BackupKernelSymbolFiles () {
+	if [ -z ${BACKUPKERNELSYMBOLFILES} ]; then
+		case $1 in
+		[Yy][Ee][Ss])
+			BACKUPKERNELSYMBOLFILES=yes
+			;;
+		[Nn][Oo])
+			BACKUPKERNELSYMBOLFILES=no
+			;;
+		*)
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
 # Handle one line of configuration
 configline () {
 	if [ $# -eq 0 ]; then
@@ -461,6 +525,9 @@ default_params () {
 	config_BaseDir /
 	config_VerboseLevel stats
 	config_StrictComponents no
+	config_BackupKernel yes
+	config_BackupKernelDir /boot/kernel.old
+	config_BackupKernelSymbolFiles no
 
 	# Merge these defaults into the earlier-configured settings
 	mergeconfig
@@ -665,6 +732,14 @@ install_check_params () {
 		echo "Re-run '$0 fetch'."
 		exit 1
 	fi
+
+	# Figure out what directory contains the running kernel
+	BOOTFILE=`sysctl -n kern.bootfile`
+	KERNELDIR=${BOOTFILE%/kernel}
+	if ! [ -d ${KERNELDIR} ]; then
+		echo "Cannot identify running kernel"
+		exit 1
+	fi
 }
 
 # Perform sanity checks and set some final parameters in
@@ -2494,6 +2569,88 @@ install_unschg () {
 	rm filelist
 }
 
+# Decide which directory name to use for kernel backups.
+backup_kernel_finddir () {
+	CNT=0
+	while true ; do
+		# Pathname does not exist, so it is OK use that name
+		# for backup directory.
+		if [ ! -e $BACKUPKERNELDIR ]; then
+			return 0
+		fi
+
+		# If directory do exist, we only use if it has our
+		# marker file.
+		if [ -d $BACKUPKERNELDIR -a \
+			-e $BACKUPKERNELDIR/.freebsd-update ]; then
+			return 0
+		fi
+
+		# We could not use current directory name, so add counter to
+		# the end and try again.
+		CNT=$((CNT + 1))
+		if [ $CNT -gt 9 ]; then
+			echo "Could not find valid backup dir ($BACKUPKERNELDIR)"
+			exit 1
+		fi
+		BACKUPKERNELDIR="`echo $BACKUPKERNELDIR | sed -Ee 's/[0-9]\$//'`"
+		BACKUPKERNELDIR="${BACKUPKERNELDIR}${CNT}"
+	done
+}
+
+# Backup the current kernel using hardlinks, if not disabled by user.
+# Since we delete all files in the directory used for previous backups
+# we create a marker file called ".freebsd-update" in the directory so
+# we can determine on the next run that the directory was created by
+# freebsd-update and we then do not accidentally remove user files in
+# the unlikely case that the user has created a directory with a
+# conflicting name.
+backup_kernel () {
+	# Only make kernel backup is so configured.
+	if [ $BACKUPKERNEL != yes ]; then
+		return 0
+	fi
+
+	# Decide which directory name to use for kernel backups.
+	backup_kernel_finddir
+
+	# Remove old kernel backup files.  If $BACKUPKERNELDIR was
+	# "not ours", backup_kernel_finddir would have exited, so
+	# deleting the directory content is as safe as we can make it.
+	if [ -d $BACKUPKERNELDIR ]; then
+		rm -f $BACKUPKERNELDIR/*
+	fi
+
+	# Create directory for backup if it doesn't exist.
+	mkdir -p $BACKUPKERNELDIR
+
+	# Mark the directory as having been created by freebsd-update.
+	touch $BACKUPKERNELDIR/.freebsd-update
+	if [ $? -ne 0 ]; then
+		echo "Could not create kernel backup directory"
+		exit 1
+	fi
+
+	# Disable pathname expansion to be sure *.symbols is not
+	# expanded.
+	set -f
+
+	# Use find to ignore symbol files, unless disabled by user.
+	if [ $BACKUPKERNELSYMBOLFILES = yes ]; then
+		FINDFILTER=""
+	else
+		FINDFILTER=-"a ! -name *.symbols"
+	fi
+
+	# Backup all the kernel files using hardlinks.
+	find $KERNELDIR -type f $FINDFILTER | \
+		sed -Ee "s,($KERNELDIR)/?(.*),\1/\2 ${BACKUPKERNELDIR}/\2," | \
+		xargs -n 2 cp -pl
+
+	# Re-enable patchname expansion.
+	set +f
+}
+
 # Install new files
 install_from_index () {
 	# First pass: Do everything apart from setting file flags.  We
@@ -2575,6 +2732,9 @@ install_files () {
 		grep -E '^/boot/' $1/INDEX-OLD > INDEX-OLD
 		grep -E '^/boot/' $1/INDEX-NEW > INDEX-NEW
 
+		# Backup current kernel before installing a new one
+		backup_kernel || return 1
+
 		# Install new files
 		install_from_index INDEX-NEW || return 1
 

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 21:01:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8607F106568C;
	Wed, 19 Aug 2009 21:01:33 +0000 (UTC)
	(envelope-from simon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4040E8FC43;
	Wed, 19 Aug 2009 21:01:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JL1X7T065382;
	Wed, 19 Aug 2009 21:01:33 GMT (envelope-from simon@svn.freebsd.org)
Received: (from simon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JL1Xwe065378;
	Wed, 19 Aug 2009 21:01:33 GMT (envelope-from simon@svn.freebsd.org)
Message-Id: <200908192101.n7JL1Xwe065378@svn.freebsd.org>
From: "Simon L. Nielsen" 
Date: Wed, 19 Aug 2009 21:01:33 +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: r196393 - in stable/8: etc share/man/man5
	usr.sbin/freebsd-update
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 21:01:33 -0000

Author: simon
Date: Wed Aug 19 21:01:32 2009
New Revision: 196393
URL: http://svn.freebsd.org/changeset/base/196393

Log:
  MFC 196392:
  
    Add support for backing up the old kernel when installing a new kernel
    using freebsd-update.  This applies to using freebsd-update in "upgrade
    mode" and normal freebsd-update on a security branch.
  
    The backup kernel will be written to /boot/kernel.old, if the directory
    does not exist, or the directory was created by freebsd-update in a
    previous backup.  Otherwise freebsd-update will generate a new directory
    name for use by the backup.  By default symbol files are not backed up
    to save diskspace and avoid filling up the root partition.
  
    This feature is fully configurable in the freebsd-update config file,
    but defaults to enabled.
  
    Reviewed by:	cperciva
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/freebsd-update.conf
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man5/freebsd-update.conf.5
  stable/8/usr.sbin/freebsd-update/   (props changed)
  stable/8/usr.sbin/freebsd-update/freebsd-update.sh

Modified: stable/8/etc/freebsd-update.conf
==============================================================================
--- stable/8/etc/freebsd-update.conf	Wed Aug 19 20:47:31 2009	(r196392)
+++ stable/8/etc/freebsd-update.conf	Wed Aug 19 21:01:32 2009	(r196393)
@@ -63,3 +63,14 @@ MergeChanges /etc/ /var/named/etc/ /boot
 # which *might* be installed of which FreeBSD Update should figure out
 # which actually are installed and upgrade those (StrictComponents no)?
 # StrictComponents no
+
+# When installing a new kernel perform a backup of the old one first
+# so it is possible to boot the old kernel in case of problems.
+# BackupKernel yes
+
+# If BackupKernel is enabled, the backup kernel is saved to this
+# directory.
+# BackupKernelDir /boot/kernel.old
+
+# When backing up a kernel also back up debug symbol files?
+# BackupKernelSymbolFiles no

Modified: stable/8/share/man/man5/freebsd-update.conf.5
==============================================================================
--- stable/8/share/man/man5/freebsd-update.conf.5	Wed Aug 19 20:47:31 2009	(r196392)
+++ stable/8/share/man/man5/freebsd-update.conf.5	Wed Aug 19 21:01:32 2009	(r196393)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 30, 2006
+.Dd August 19, 2009
 .Dt FREEBSD-UPDATE.CONF 5
 .Os FreeBSD
 .Sh NAME
@@ -48,7 +48,7 @@ error.
 .Pp
 The possible options and their meanings are as follows:
 .Pp
-.Bl -tag -width "KeepModifiedMetadata"
+.Bl -tag -width ".Cm BackupKernelSymbolFiles"
 .It Cm KeyPrint
 The single parameter following this keyword is the SHA256 hash
 of the RSA key which will be trusted to sign updates.
@@ -171,6 +171,54 @@ command is used ("yes"), or merely as a 
 which might be installed, of which
 .Cm freebsd-update
 should identify which in fact are present ("no").
+.It Cm BackupKernel
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will create a backup of the old kernel before installing a new kernel.
+This backup kernel can be used to recover a system where the newly
+installed kernel somehow did not work.
+Note that the backup kernel is not reverted to its original state by
+the
+.Cm freebsd-update
+rollback command.
+.It Cm BackupKernelDir
+This keyword sets the directory which is used to store a backup
+kernel, if the BackupKernel feature is enabled.
+If the directory already exist, and it was not created by
+.Cm freebsd-update ,
+the directory is skipped.
+In the case of the primary directory name not being usable, a number
+starting with
+.Sq 1
+is appended to the directory name.
+Like with the primary directory name, the constructed directory name is
+only used if the path name does not exist, or if the directory was
+previously created by
+.Cm freebsd-update .
+If the constructed directory still exist the appended number is
+incremented with 1 and the directory search process restarted.
+Should the number increment go above 9,
+.Cm freebsd-update
+will abort.
+.It Cm BackupKernelSymbolFiles
+The single parameter following this keyword must be
+.Dq yes
+or
+.Dq no
+and specifies whether
+.Cm freebsd-update
+will also backup kernel symbol files, if they exist.
+The kernel symbol files takes up a lot of disk space and are not
+needed for recovery purposes.
+If the symbol files are needed, after recovering a system using the
+backup kernel, the
+.Cm freebsd-update
+rollback command will recreate the symbol files along with the old
+kernel.
 .El
 .Sh FILES
 .Bl -tag -width "/etc/freebsd-update.conf"

Modified: stable/8/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- stable/8/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 20:47:31 2009	(r196392)
+++ stable/8/usr.sbin/freebsd-update/freebsd-update.sh	Wed Aug 19 21:01:32 2009	(r196393)
@@ -88,7 +88,7 @@ EOF
 CONFIGOPTIONS="KEYPRINT WORKDIR SERVERNAME MAILTO ALLOWADD ALLOWDELETE
     KEEPMODIFIEDMETADATA COMPONENTS IGNOREPATHS UPDATEIFUNMODIFIED
     BASEDIR VERBOSELEVEL TARGETRELEASE STRICTCOMPONENTS MERGECHANGES
-    IDSIGNOREPATHS"
+    IDSIGNOREPATHS BACKUPKERNEL BACKUPKERNELDIR BACKUPKERNELSYMBOLFILES"
 
 # Set all the configuration options to "".
 nullconfig () {
@@ -308,6 +308,70 @@ config_VerboseLevel () {
 	fi
 }
 
+config_BackupKernel () {
+	if [ -z ${BACKUPKERNEL} ]; then
+		case $1 in
+		[Yy][Ee][Ss])
+			BACKUPKERNEL=yes
+			;;
+		[Nn][Oo])
+			BACKUPKERNEL=no
+			;;
+		*)
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
+config_BackupKernelDir () {
+	if [ -z ${BACKUPKERNELDIR} ]; then
+		if [ -z "$1" ]; then
+			echo "BackupKernelDir set to empty dir"
+			return 1
+		fi
+
+		# We check for some paths which would be extremely odd
+		# to use, but which could cause a lot of problems if
+		# used.
+		case $1 in
+		/|/bin|/boot|/etc|/lib|/libexec|/sbin|/usr|/var)
+			echo "BackupKernelDir set to invalid path $1"
+			return 1
+			;;
+		/*)
+			BACKUPKERNELDIR=$1
+			;;
+		*)
+			echo "BackupKernelDir ($1) is not an absolute path"
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
+config_BackupKernelSymbolFiles () {
+	if [ -z ${BACKUPKERNELSYMBOLFILES} ]; then
+		case $1 in
+		[Yy][Ee][Ss])
+			BACKUPKERNELSYMBOLFILES=yes
+			;;
+		[Nn][Oo])
+			BACKUPKERNELSYMBOLFILES=no
+			;;
+		*)
+			return 1
+			;;
+		esac
+	else
+		return 1
+	fi
+}
+
 # Handle one line of configuration
 configline () {
 	if [ $# -eq 0 ]; then
@@ -461,6 +525,9 @@ default_params () {
 	config_BaseDir /
 	config_VerboseLevel stats
 	config_StrictComponents no
+	config_BackupKernel yes
+	config_BackupKernelDir /boot/kernel.old
+	config_BackupKernelSymbolFiles no
 
 	# Merge these defaults into the earlier-configured settings
 	mergeconfig
@@ -665,6 +732,14 @@ install_check_params () {
 		echo "Re-run '$0 fetch'."
 		exit 1
 	fi
+
+	# Figure out what directory contains the running kernel
+	BOOTFILE=`sysctl -n kern.bootfile`
+	KERNELDIR=${BOOTFILE%/kernel}
+	if ! [ -d ${KERNELDIR} ]; then
+		echo "Cannot identify running kernel"
+		exit 1
+	fi
 }
 
 # Perform sanity checks and set some final parameters in
@@ -2494,6 +2569,88 @@ install_unschg () {
 	rm filelist
 }
 
+# Decide which directory name to use for kernel backups.
+backup_kernel_finddir () {
+	CNT=0
+	while true ; do
+		# Pathname does not exist, so it is OK use that name
+		# for backup directory.
+		if [ ! -e $BACKUPKERNELDIR ]; then
+			return 0
+		fi
+
+		# If directory do exist, we only use if it has our
+		# marker file.
+		if [ -d $BACKUPKERNELDIR -a \
+			-e $BACKUPKERNELDIR/.freebsd-update ]; then
+			return 0
+		fi
+
+		# We could not use current directory name, so add counter to
+		# the end and try again.
+		CNT=$((CNT + 1))
+		if [ $CNT -gt 9 ]; then
+			echo "Could not find valid backup dir ($BACKUPKERNELDIR)"
+			exit 1
+		fi
+		BACKUPKERNELDIR="`echo $BACKUPKERNELDIR | sed -Ee 's/[0-9]\$//'`"
+		BACKUPKERNELDIR="${BACKUPKERNELDIR}${CNT}"
+	done
+}
+
+# Backup the current kernel using hardlinks, if not disabled by user.
+# Since we delete all files in the directory used for previous backups
+# we create a marker file called ".freebsd-update" in the directory so
+# we can determine on the next run that the directory was created by
+# freebsd-update and we then do not accidentally remove user files in
+# the unlikely case that the user has created a directory with a
+# conflicting name.
+backup_kernel () {
+	# Only make kernel backup is so configured.
+	if [ $BACKUPKERNEL != yes ]; then
+		return 0
+	fi
+
+	# Decide which directory name to use for kernel backups.
+	backup_kernel_finddir
+
+	# Remove old kernel backup files.  If $BACKUPKERNELDIR was
+	# "not ours", backup_kernel_finddir would have exited, so
+	# deleting the directory content is as safe as we can make it.
+	if [ -d $BACKUPKERNELDIR ]; then
+		rm -f $BACKUPKERNELDIR/*
+	fi
+
+	# Create directory for backup if it doesn't exist.
+	mkdir -p $BACKUPKERNELDIR
+
+	# Mark the directory as having been created by freebsd-update.
+	touch $BACKUPKERNELDIR/.freebsd-update
+	if [ $? -ne 0 ]; then
+		echo "Could not create kernel backup directory"
+		exit 1
+	fi
+
+	# Disable pathname expansion to be sure *.symbols is not
+	# expanded.
+	set -f
+
+	# Use find to ignore symbol files, unless disabled by user.
+	if [ $BACKUPKERNELSYMBOLFILES = yes ]; then
+		FINDFILTER=""
+	else
+		FINDFILTER=-"a ! -name *.symbols"
+	fi
+
+	# Backup all the kernel files using hardlinks.
+	find $KERNELDIR -type f $FINDFILTER | \
+		sed -Ee "s,($KERNELDIR)/?(.*),\1/\2 ${BACKUPKERNELDIR}/\2," | \
+		xargs -n 2 cp -pl
+
+	# Re-enable patchname expansion.
+	set +f
+}
+
 # Install new files
 install_from_index () {
 	# First pass: Do everything apart from setting file flags.  We
@@ -2575,6 +2732,9 @@ install_files () {
 		grep -E '^/boot/' $1/INDEX-OLD > INDEX-OLD
 		grep -E '^/boot/' $1/INDEX-NEW > INDEX-NEW
 
+		# Backup current kernel before installing a new one
+		backup_kernel || return 1
+
 		# Install new files
 		install_from_index INDEX-NEW || return 1
 

From owner-svn-src-all@FreeBSD.ORG  Wed Aug 19 21:33:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3D7B106568E;
	Wed, 19 Aug 2009 21:33:09 +0000 (UTC)
	(envelope-from simon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AAA848FC3F;
	Wed, 19 Aug 2009 21:33:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7JLX90c066006;
	Wed, 19 Aug 2009 21:33:09 GMT (envelope-from simon@svn.freebsd.org)
Received: (from simon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JLX9xX066003;
	Wed, 19 Aug 2009 21:33:09 GMT (envelope-from simon@svn.freebsd.org)
Message-Id: <200908192133.n7JLX9xX066003@svn.freebsd.org>
From: "Simon L. Nielsen" 
Date: Wed, 19 Aug 2009 21:33:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196394 - stable/7/bin/df
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 19 Aug 2009 21:33:10 -0000

Author: simon
Date: Wed Aug 19 21:33:09 2009
New Revision: 196394
URL: http://svn.freebsd.org/changeset/base/196394

Log:
  MFC r193629:
    Make "human-readable" (-H/-h) output also "humanize" inode counts.
    Base 10 is always used for the inode counts as I could not think of any
    reason base 2 inode counts would be useful.
  
    Minor mdoc markup fix to df(1) while here anyway.

Modified:
  stable/7/bin/df/   (props changed)
  stable/7/bin/df/df.1
  stable/7/bin/df/df.c

Modified: stable/7/bin/df/df.1
==============================================================================
--- stable/7/bin/df/df.1	Wed Aug 19 21:01:32 2009	(r196393)
+++ stable/7/bin/df/df.1	Wed Aug 19 21:33:09 2009	(r196394)
@@ -78,15 +78,20 @@ this overrides the
 .Ev BLOCKSIZE
 specification from the environment.
 .It Fl H
-"Human-readable" output.
+.Dq Human-readable
+output.
 Use unit suffixes: Byte, Kilobyte, Megabyte,
 Gigabyte, Terabyte and Petabyte in order to reduce the number of
 digits to four or fewer using base 10 for sizes.
 .It Fl h
-"Human-readable" output.
+.Dq Human-readable
+output.
 Use unit suffixes: Byte, Kilobyte, Megabyte,
 Gigabyte, Terabyte and Petabyte in order to reduce the number of
 digits to four or fewer using base 2 for sizes.
+Inodes statistics, if enabled with
+.Fl i ,
+are always printed in base 10.
 .It Fl i
 Include statistics on the number of free inodes.
 .It Fl k

Modified: stable/7/bin/df/df.c
==============================================================================
--- stable/7/bin/df/df.c	Wed Aug 19 21:01:32 2009	(r196393)
+++ stable/7/bin/df/df.c	Wed Aug 19 21:33:09 2009	(r196394)
@@ -365,6 +365,23 @@ prthumanval(int64_t bytes)
 }
 
 /*
+ * Print an inode count in "human-readable" format.
+ */
+static void
+prthumanvalinode(int64_t bytes)
+{
+	char buf[6];
+	int flags;
+
+	flags = HN_NOSPACE | HN_DECIMAL | HN_DIVISOR_1000;
+
+	humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
+	    bytes, "", HN_AUTOSCALE, flags);
+
+	(void)printf(" %5s", buf);
+}
+
+/*
  * Convert statfs returned file system size into BLOCKSIZE units.
  * Attempts to avoid overflow for large file systems.
  */
@@ -406,8 +423,10 @@ prtstat(struct statfs *sfsp, struct maxw
 		    mwp->mntfrom, "Filesystem", mwp->total, header,
 		    mwp->used, "Used", mwp->avail, "Avail");
 		if (iflag) {
-			mwp->iused = imax(mwp->iused, (int)strlen("  iused"));
-			mwp->ifree = imax(mwp->ifree, (int)strlen("ifree"));
+			mwp->iused = imax(hflag ? 0 : mwp->iused,
+			    (int)strlen("  iused"));
+			mwp->ifree = imax(hflag ? 0 : mwp->ifree,
+			    (int)strlen("ifree"));
 			(void)printf(" %*s %*s %%iused",
 			    mwp->iused - 2, "iused", mwp->ifree, "ifree");
 		}
@@ -431,8 +450,15 @@ prtstat(struct statfs *sfsp, struct maxw
 	if (iflag) {
 		inodes = sfsp->f_files;
 		used = inodes - sfsp->f_ffree;
-		(void)printf(" %*jd %*jd %4.0f%% ", mwp->iused, (intmax_t)used,
-		    mwp->ifree, (intmax_t)sfsp->f_ffree, inodes == 0 ? 100.0 :
+		if (hflag) {
+			(void)printf("  ");
+			prthumanvalinode(used);
+			prthumanvalinode(sfsp->f_ffree);
+		} else {
+			(void)printf(" %*jd %*jd", mwp->iused, (intmax_t)used,
+			    mwp->ifree, (intmax_t)sfsp->f_ffree);
+		}
+		(void)printf(" %4.0f%% ", inodes == 0 ? 100.0 :
 		    (double)used / (double)inodes * 100.0);
 	} else
 		(void)printf("  ");

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 00:05:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E0C4106568E;
	Thu, 20 Aug 2009 00:05:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EA1968FC6B;
	Thu, 20 Aug 2009 00:05:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7K05T2k068955;
	Thu, 20 Aug 2009 00:05:29 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7K05TfY068953;
	Thu, 20 Aug 2009 00:05:29 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200908200005.n7K05TfY068953@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 20 Aug 2009 00:05:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196395 - head/sys/cddl/compat/opensolaris/rpc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 00:05:30 -0000

Author: pjd
Date: Thu Aug 20 00:05:29 2009
New Revision: 196395
URL: http://svn.freebsd.org/changeset/base/196395

Log:
  Our libc doesn't implement control method for XDR (only kernel does) and it
  will always return failure. Fix this by bringing userland implementation of
  xdrmem_control() back. This allow 'zpool import' to work again.
  
  Reported by:	Thomas Backman 
  Reviewed by:	kmacy
  Approved by:	re (kib)

Added:
  head/sys/cddl/compat/opensolaris/rpc/xdr.h   (contents, props changed)

Added: head/sys/cddl/compat/opensolaris/rpc/xdr.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/cddl/compat/opensolaris/rpc/xdr.h	Thu Aug 20 00:05:29 2009	(r196395)
@@ -0,0 +1,70 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part.  Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California  94043
+ */
+
+#ifndef	_OPENSOLARIS_RPC_XDR_H_
+#define	_OPENSOLARIS_RPC_XDR_H_
+
+#include_next 
+
+#ifndef _KERNEL
+
+#include 
+
+/*
+ * Taken from sys/xdr/xdr_mem.c.
+ *
+ * FreeBSD's userland XDR doesn't implement control method (only the kernel),
+ * but OpenSolaris nvpair still depend on it, so we have to implement it here.
+ */
+static __inline bool_t
+xdrmem_control(XDR *xdrs, int request, void *info)
+{
+	xdr_bytesrec *xptr;
+
+	switch (request) {
+	case XDR_GET_BYTES_AVAIL:
+		xptr = (xdr_bytesrec *)info;
+		xptr->xc_is_last_record = TRUE;
+		xptr->xc_num_avail = xdrs->x_handy;
+		return (TRUE);
+	default:
+		assert(!"unexpected request");
+	}
+	return (FALSE);
+}
+
+#undef XDR_CONTROL
+#define	XDR_CONTROL(xdrs, req, op)					\
+	(((xdrs)->x_ops->x_control == NULL) ?				\
+	    xdrmem_control((xdrs), (req), (op)) :			\
+	    (*(xdrs)->x_ops->x_control)(xdrs, req, op))   
+
+#endif	/* !_KERNEL */
+
+#endif	/* !_OPENSOLARIS_RPC_XDR_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 00:08:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62B2B106568D;
	Thu, 20 Aug 2009 00:08:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 51A178FC61;
	Thu, 20 Aug 2009 00:08:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7K08w2X069055;
	Thu, 20 Aug 2009 00:08:58 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7K08w9N069054;
	Thu, 20 Aug 2009 00:08:58 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200908200008.n7K08w9N069054@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Thu, 20 Aug 2009 00:08:58 +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: r196396 - in stable/8/sys: . amd64/include/xen
	cddl/compat/opensolaris/rpc cddl/contrib/opensolaris
	contrib/dev/acpica contrib/pf dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 00:08:58 -0000

Author: pjd
Date: Thu Aug 20 00:08:58 2009
New Revision: 196396
URL: http://svn.freebsd.org/changeset/base/196396

Log:
  MFC r196395:
  
  Our libc doesn't implement control method for XDR (only kernel does) and it
  will always return failure. Fix this by bringing userland implementation of
  xdrmem_control() back. This allow 'zpool import' to work again.
  
  Reported by:	Thomas Backman 
  Reviewed by:	kmacy
  Approved by:	re (kib)

Added:
  stable/8/sys/cddl/compat/opensolaris/rpc/xdr.h
     - copied unchanged from r196395, head/sys/cddl/compat/opensolaris/rpc/xdr.h
Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)

Copied: stable/8/sys/cddl/compat/opensolaris/rpc/xdr.h (from r196395, head/sys/cddl/compat/opensolaris/rpc/xdr.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/cddl/compat/opensolaris/rpc/xdr.h	Thu Aug 20 00:08:58 2009	(r196396, copy of r196395, head/sys/cddl/compat/opensolaris/rpc/xdr.h)
@@ -0,0 +1,70 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part.  Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California  94043
+ */
+
+#ifndef	_OPENSOLARIS_RPC_XDR_H_
+#define	_OPENSOLARIS_RPC_XDR_H_
+
+#include_next 
+
+#ifndef _KERNEL
+
+#include 
+
+/*
+ * Taken from sys/xdr/xdr_mem.c.
+ *
+ * FreeBSD's userland XDR doesn't implement control method (only the kernel),
+ * but OpenSolaris nvpair still depend on it, so we have to implement it here.
+ */
+static __inline bool_t
+xdrmem_control(XDR *xdrs, int request, void *info)
+{
+	xdr_bytesrec *xptr;
+
+	switch (request) {
+	case XDR_GET_BYTES_AVAIL:
+		xptr = (xdr_bytesrec *)info;
+		xptr->xc_is_last_record = TRUE;
+		xptr->xc_num_avail = xdrs->x_handy;
+		return (TRUE);
+	default:
+		assert(!"unexpected request");
+	}
+	return (FALSE);
+}
+
+#undef XDR_CONTROL
+#define	XDR_CONTROL(xdrs, req, op)					\
+	(((xdrs)->x_ops->x_control == NULL) ?				\
+	    xdrmem_control((xdrs), (req), (op)) :			\
+	    (*(xdrs)->x_ops->x_control)(xdrs, req, op))   
+
+#endif	/* !_KERNEL */
+
+#endif	/* !_OPENSOLARIS_RPC_XDR_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 02:33:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F9B4106568C;
	Thu, 20 Aug 2009 02:33:13 +0000 (UTC)
	(envelope-from will@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 005EB8FC60;
	Thu, 20 Aug 2009 02:33:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7K2XCEo071805;
	Thu, 20 Aug 2009 02:33:12 GMT (envelope-from will@svn.freebsd.org)
Received: (from will@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7K2XCfF071803;
	Thu, 20 Aug 2009 02:33:12 GMT (envelope-from will@svn.freebsd.org)
Message-Id: <200908200233.n7K2XCfF071803@svn.freebsd.org>
From: Will Andrews 
Date: Thu, 20 Aug 2009 02:33:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196397 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 02:33:13 -0000

Author: will
Date: Thu Aug 20 02:33:12 2009
New Revision: 196397
URL: http://svn.freebsd.org/changeset/base/196397

Log:
  Fix CARP memory leaks on carp_if's malloc'd using M_CARP.  This occurs when
  CARP tries to free them using M_IFADDR after the last address for a virtual
  host is removed and when detaching from the parent interface.
  
  Reviewed by:	mlaier
  Approved by:	re (kib), ken (mentor)

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==============================================================================
--- head/sys/netinet/ip_carp.c	Thu Aug 20 00:08:58 2009	(r196396)
+++ head/sys/netinet/ip_carp.c	Thu Aug 20 02:33:12 2009	(r196397)
@@ -501,7 +501,7 @@ carpdetach(struct carp_softc *sc, int un
 			ifpromisc(sc->sc_carpdev, 0);
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else if (unlock)
 			CARP_UNLOCK(cif);
 		sc->sc_carpdev = NULL;
@@ -1639,7 +1639,7 @@ carp_del_addr(struct carp_softc *sc, str
 		if (!--cif->vhif_nvrs) {
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else {
 			CARP_UNLOCK(cif);
 		}
@@ -1843,7 +1843,7 @@ carp_del_addr6(struct carp_softc *sc, st
 		if (!--cif->vhif_nvrs) {
 			CARP_LOCK_DESTROY(cif);
 			sc->sc_carpdev->if_carp = NULL;
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else
 			CARP_UNLOCK(cif);
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 02:49:43 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0E2E106568B;
	Thu, 20 Aug 2009 02:49:43 +0000 (UTC)
	(envelope-from will@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F6468FC45;
	Thu, 20 Aug 2009 02:49:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7K2nhh7072202;
	Thu, 20 Aug 2009 02:49:43 GMT (envelope-from will@svn.freebsd.org)
Received: (from will@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7K2nh4E072200;
	Thu, 20 Aug 2009 02:49:43 GMT (envelope-from will@svn.freebsd.org)
Message-Id: <200908200249.n7K2nh4E072200@svn.freebsd.org>
From: Will Andrews 
Date: Thu, 20 Aug 2009 02:49: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: r196398 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 02:49:43 -0000

Author: will
Date: Thu Aug 20 02:49:43 2009
New Revision: 196398
URL: http://svn.freebsd.org/changeset/base/196398

Log:
  MFC r196397 from head:
  
    Fix CARP memory leaks on carp_if's malloc'd using M_CARP.  This occurs when
    CARP tries to free them using M_IFADDR after the last address for a virtual
    host is removed and when detaching from the parent interface.
  
  Approved by:	re (kib), ken (mentor)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/netinet/ip_carp.c

Modified: stable/8/sys/netinet/ip_carp.c
==============================================================================
--- stable/8/sys/netinet/ip_carp.c	Thu Aug 20 02:33:12 2009	(r196397)
+++ stable/8/sys/netinet/ip_carp.c	Thu Aug 20 02:49:43 2009	(r196398)
@@ -501,7 +501,7 @@ carpdetach(struct carp_softc *sc, int un
 			ifpromisc(sc->sc_carpdev, 0);
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else if (unlock)
 			CARP_UNLOCK(cif);
 		sc->sc_carpdev = NULL;
@@ -1639,7 +1639,7 @@ carp_del_addr(struct carp_softc *sc, str
 		if (!--cif->vhif_nvrs) {
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else {
 			CARP_UNLOCK(cif);
 		}
@@ -1843,7 +1843,7 @@ carp_del_addr6(struct carp_softc *sc, st
 		if (!--cif->vhif_nvrs) {
 			CARP_LOCK_DESTROY(cif);
 			sc->sc_carpdev->if_carp = NULL;
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else
 			CARP_UNLOCK(cif);
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 10:57:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 43BF3106568F;
	Thu, 20 Aug 2009 10:57:15 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 18DF38FC74;
	Thu, 20 Aug 2009 10:57:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KAvEfS084141;
	Thu, 20 Aug 2009 10:57:14 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KAvE4d084139;
	Thu, 20 Aug 2009 10:57:14 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200908201057.n7KAvE4d084139@svn.freebsd.org>
From: Andriy Gapon 
Date: Thu, 20 Aug 2009 10:57:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196399 - head/usr.bin/fstat
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 10:57:15 -0000

Author: avg
Date: Thu Aug 20 10:57:14 2009
New Revision: 196399
URL: http://svn.freebsd.org/changeset/base/196399

Log:
  fstat: fix fsid comparison when executed on systems with 64-bit long
  
  This affects only fstat on zfs and devfs, only on 64-bit systems
  and only when fsid is greater than 2^31 - 1.
  When fstat examines a file via stat(2) it takes uint32_t st_dev
  and assigns to (signed) (64-bit) long fsid, this results in
  a positive value.
  When fstat examines opened files it takes int32_t f_fsid.val[0]
  and assigns to (signed) (64-bit) long fsid, this results in
  a negative value.
  So, while initially st_dev and f_fsid.val[0] have the same bit
  values they get promoted to different 64-bit values because
  of the signed-vs-unsigned difference.
  
  A fix is to use "more natural" positive numbers by introducing
  intermediate unsigned cast for f_fsid.val[0].
  
  Reviewed by:	jhb, lulf
  Approved by:	re (kib)
  MFC after:	1 week (to stable/7)

Modified:
  head/usr.bin/fstat/fstat.c
  head/usr.bin/fstat/zfs.c

Modified: head/usr.bin/fstat/fstat.c
==============================================================================
--- head/usr.bin/fstat/fstat.c	Thu Aug 20 02:49:43 2009	(r196398)
+++ head/usr.bin/fstat/fstat.c	Thu Aug 20 10:57:14 2009	(r196399)
@@ -658,7 +658,7 @@ devfs_filestat(struct vnode *vp, struct 
 		    (void *)devfs_dirent.de_vnode, Pid);
 		return 0;
 	}
-	fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0];
+	fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0];
 	fsp->fileid = devfs_dirent.de_inode;
 	fsp->mode = (devfs_dirent.de_mode & ~S_IFMT) | S_IFCHR;
 	fsp->size = 0;

Modified: head/usr.bin/fstat/zfs.c
==============================================================================
--- head/usr.bin/fstat/zfs.c	Thu Aug 20 02:49:43 2009	(r196398)
+++ head/usr.bin/fstat/zfs.c	Thu Aug 20 10:57:14 2009	(r196399)
@@ -117,7 +117,7 @@ zfs_filestat(struct vnode *vp, struct fi
 		goto bad;
 	}
 
-	fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0];
+	fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0];
 	fsp->fileid = *zid;
 	/*
 	 * XXX: Shows up wrong in output, but UFS has this error too. Could

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 11:04:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5CBAD106568E;
	Thu, 20 Aug 2009 11:04:32 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 325FB8FC16;
	Thu, 20 Aug 2009 11:04:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KB4WMd084367;
	Thu, 20 Aug 2009 11:04:32 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KB4WkZ084364;
	Thu, 20 Aug 2009 11:04:32 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200908201104.n7KB4WkZ084364@svn.freebsd.org>
From: Andriy Gapon 
Date: Thu, 20 Aug 2009 11:04: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: r196400 - stable/8/usr.bin/fstat
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 11:04:32 -0000

Author: avg
Date: Thu Aug 20 11:04:31 2009
New Revision: 196400
URL: http://svn.freebsd.org/changeset/base/196400

Log:
  MFC 196399: fstat: fix fsid comparison when executed on systems with 64-bit long
  
  This affects only fstat on zfs and devfs, only on 64-bit systems
  and only when fsid is greater than 2^31 - 1.
  When fstat examines a file via stat(2) it takes uint32_t st_dev
  and assigns to (signed) (64-bit) long fsid, this results in
  a positive value.
  When fstat examines opened files it takes int32_t f_fsid.val[0]
  and assigns to (signed) (64-bit) long fsid, this results in
  a negative value.
  So, while initially st_dev and f_fsid.val[0] have the same bit
  values they get promoted to different 64-bit values because
  of the signed-vs-unsigned difference.
  
  A fix is to use "more natural" positive numbers by introducing
  intermediate unsigned cast for f_fsid.val[0].
  
  Reviewed by:    jhb, lulf
  Approved by:    re (kib)
  MFC after:      1 week (to stable/7)

Modified:
  stable/8/usr.bin/fstat/   (props changed)
  stable/8/usr.bin/fstat/fstat.c
  stable/8/usr.bin/fstat/zfs.c

Modified: stable/8/usr.bin/fstat/fstat.c
==============================================================================
--- stable/8/usr.bin/fstat/fstat.c	Thu Aug 20 10:57:14 2009	(r196399)
+++ stable/8/usr.bin/fstat/fstat.c	Thu Aug 20 11:04:31 2009	(r196400)
@@ -658,7 +658,7 @@ devfs_filestat(struct vnode *vp, struct 
 		    (void *)devfs_dirent.de_vnode, Pid);
 		return 0;
 	}
-	fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0];
+	fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0];
 	fsp->fileid = devfs_dirent.de_inode;
 	fsp->mode = (devfs_dirent.de_mode & ~S_IFMT) | S_IFCHR;
 	fsp->size = 0;

Modified: stable/8/usr.bin/fstat/zfs.c
==============================================================================
--- stable/8/usr.bin/fstat/zfs.c	Thu Aug 20 10:57:14 2009	(r196399)
+++ stable/8/usr.bin/fstat/zfs.c	Thu Aug 20 11:04:31 2009	(r196400)
@@ -117,7 +117,7 @@ zfs_filestat(struct vnode *vp, struct fi
 		goto bad;
 	}
 
-	fsp->fsid = (long)mount.mnt_stat.f_fsid.val[0];
+	fsp->fsid = (long)(uint32_t)mount.mnt_stat.f_fsid.val[0];
 	fsp->fileid = *zid;
 	/*
 	 * XXX: Shows up wrong in output, but UFS has this error too. Could

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 17:16:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3186E106568B;
	Thu, 20 Aug 2009 17:16:14 +0000 (UTC)
	(envelope-from prvs=1476173d24=brian@Awfulhak.org)
Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9])
	by mx1.freebsd.org (Postfix) with ESMTP id D40508FC16;
	Thu, 20 Aug 2009 17:16:13 +0000 (UTC)
Received: from pd6ml1no-ssvc.prod.shaw.ca ([10.0.153.160])
	by pd5mo1no-svcs.prod.shaw.ca with ESMTP; 20 Aug 2009 10:47:47 -0600
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.0 c=1 a=r9TD9u2CHe4A:10
	a=MJPcHhXccCG8eBs0us8XwA==:17 a=6I5d2MoRAAAA:8
	a=MMwg4So0AAAA:8 a=ISM9mAlW1Z4Umi7AIGAA:9
	a=_6IwDxac_XSlGSdX_RZw439HxFkA:4
	a=SV7veod9ZcQA:10 a=WJ3hkfHDukgA:10
Received: from unknown (HELO store.lan.Awfulhak.org) ([70.79.162.198])
	by pd6ml1no-dmz.prod.shaw.ca with ESMTP; 20 Aug 2009 10:47:47 -0600
Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1])
	by localhost (Email Security Appliance) with SMTP id
	BDCEDC43FBC_A8D7E2DB; Thu, 20 Aug 2009 16:47:41 +0000 (GMT)
Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1])
	by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id
	8C068C460F6_A8D7E25F; Thu, 20 Aug 2009 16:47:33 +0000 (GMT)
Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5])
	by gw.Awfulhak.org (8.14.3/8.14.3) with ESMTP id n7KGlb9R013759;
	Thu, 20 Aug 2009 09:47:37 -0700 (PDT)
	(envelope-from brian@Awfulhak.org)
Date: Thu, 20 Aug 2009 09:47:37 -0700
From: Brian Somers 
To: "Simon L. Nielsen" 
Message-ID: <20090820094737.1f9a6121@dev.lan.Awfulhak.org>
In-Reply-To: <200908192047.n7JKlVCE065020@svn.freebsd.org>
References: <200908192047.n7JKlVCE065020@svn.freebsd.org>
X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.5; i386-portbld-freebsd8.0)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196392 - in head: etc share/man/man5
 usr.sbin/freebsd-update
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 17:16:14 -0000

On Wed, 19 Aug 2009 20:47:31 +0000 (UTC) "Simon L. Nielsen"  wrote:
> Author: simon
> Date: Wed Aug 19 20:47:31 2009
> New Revision: 196392
> URL: http://svn.freebsd.org/changeset/base/196392
> 
> Log:
>   Add support for backing up the old kernel when installing a new kernel
>   using freebsd-update.  This applies to using freebsd-update in "upgrade
>   mode" and normal freebsd-update on a security branch.
>   
>   The backup kernel will be written to /boot/kernel.old, if the directory
>   does not exist, or the directory was created by freebsd-update in a
>   previous backup.  Otherwise freebsd-update will generate a new directory
>   name for use by the backup.  By default symbol files are not backed up
>   to save diskspace and avoid filling up the root partition.
>   
>   This feature is fully configurable in the freebsd-update config file,
>   but defaults to enabled.
>   
>   MFC after:	1 week (stable/7)
>   Reviewed by:	cperciva
>   Approved by:	re (kib)

This should really have the same behaviour as ``make installkernel''.
After moving the kernel to kernel.old it should update kern.bootfile and
it should not backup kernel => kernel.old if kern.bootfile already points
at kernel.old.

It's bad if two kernel upgrades without an intervening reboot blow away
your running kernel :(

-- 
Brian Somers                                          
Don't _EVER_ lose your sense of humour !               

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 19:17:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCA051065672;
	Thu, 20 Aug 2009 19:17:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C7DD38FC60;
	Thu, 20 Aug 2009 19:17:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KJHrSR096121;
	Thu, 20 Aug 2009 19:17:53 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KJHrYW096093;
	Thu, 20 Aug 2009 19:17:53 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908201917.n7KJHrYW096093@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 20 Aug 2009 19:17:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196403 - in head/sys: dev/aac dev/acpica dev/adb
	dev/amdtemp dev/amr dev/ata dev/atkbdc dev/bktr dev/drm
	dev/ips dev/mfi dev/mlx dev/mmc dev/pccbb dev/pst dev/rp
	dev/sound/pci/hda dev/...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 19:17:54 -0000

Author: jhb
Date: Thu Aug 20 19:17:53 2009
New Revision: 196403
URL: http://svn.freebsd.org/changeset/base/196403

Log:
  Temporarily revert the new-bus locking for 8.0 release.  It will be
  reintroduced after HEAD is reopened for commits by re@.
  
  Approved by:	re (kib), attilio

Modified:
  head/sys/dev/aac/aac.c
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_battery.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpi_dock.c
  head/sys/dev/acpica/acpi_thermal.c
  head/sys/dev/adb/adb_bus.c
  head/sys/dev/amdtemp/amdtemp.c
  head/sys/dev/amr/amr.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/atkbdc/psm.c
  head/sys/dev/bktr/bktr_os.c
  head/sys/dev/drm/drm_drv.c
  head/sys/dev/ips/ips_pci.c
  head/sys/dev/mfi/mfi.c
  head/sys/dev/mlx/mlx.c
  head/sys/dev/mmc/mmc.c
  head/sys/dev/pccbb/pccbb.c
  head/sys/dev/pst/pst-iop.c
  head/sys/dev/rp/rp.c
  head/sys/dev/sound/pci/hda/hdac.c
  head/sys/dev/twe/twe.c
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_handle_request.c
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/xen/blkback/blkback.c
  head/sys/dev/xen/netback/netback.c
  head/sys/i386/acpica/acpi_machdep.c
  head/sys/i386/bios/smapi.c
  head/sys/i386/bios/smbios.c
  head/sys/i386/bios/vpd.c
  head/sys/kern/subr_bus.c
  head/sys/pc98/cbus/fdc.c
  head/sys/sys/bus.h
  head/sys/xen/xenbus/xenbus_probe.c

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/aac/aac.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -3270,10 +3270,10 @@ aac_handle_aif(struct aac_softc *sc, str
 			while (co != NULL) {
 				if (co->co_found == 0) {
 					mtx_unlock(&sc->aac_io_lock);
-					newbus_xlock();
+					mtx_lock(&Giant);
 					device_delete_child(sc->aac_dev,
 							    co->co_disk);
-					newbus_xunlock();
+					mtx_unlock(&Giant);
 					mtx_lock(&sc->aac_io_lock);
 					co_next = TAILQ_NEXT(co, co_link);
 					mtx_lock(&sc->aac_container_lock);
@@ -3291,9 +3291,9 @@ aac_handle_aif(struct aac_softc *sc, str
 			/* Attach the newly created containers */
 			if (added) {
 				mtx_unlock(&sc->aac_io_lock);
-				newbus_xlock();
+				mtx_lock(&Giant);
 				bus_generic_attach(sc->aac_dev);
-				newbus_xunlock();
+				mtx_unlock(&Giant);
 				mtx_lock(&sc->aac_io_lock);
 			}
 

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/acpica/acpi.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -675,6 +675,8 @@ acpi_suspend(device_t dev)
     device_t child, *devlist;
     int error, i, numdevs, pstate;
 
+    GIANT_REQUIRED;
+
     /* First give child devices a chance to suspend. */
     error = bus_generic_suspend(dev);
     if (error)
@@ -717,6 +719,8 @@ acpi_resume(device_t dev)
     int i, numdevs, error;
     device_t child, *devlist;
 
+    GIANT_REQUIRED;
+
     /*
      * Put all devices in D0 before resuming them.  Call _S0D on each one
      * since some systems expect this.
@@ -741,6 +745,8 @@ static int
 acpi_shutdown(device_t dev)
 {
 
+    GIANT_REQUIRED;
+
     /* Allow children to shutdown first. */
     bus_generic_shutdown(dev);
 
@@ -2528,7 +2534,11 @@ acpi_EnterSleepState(struct acpi_softc *
     thread_unlock(curthread);
 #endif
 
-    newbus_xlock();
+    /*
+     * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
+     * drivers need this.
+     */
+    mtx_lock(&Giant);
 
     slp_state = ACPI_SS_NONE;
 
@@ -2601,7 +2611,7 @@ backout:
     if (slp_state >= ACPI_SS_SLEPT)
 	acpi_enable_fixed_events(sc);
 
-    newbus_xunlock();
+    mtx_unlock(&Giant);
 
 #ifdef SMP
     thread_lock(curthread);

Modified: head/sys/dev/acpica/acpi_battery.c
==============================================================================
--- head/sys/dev/acpica/acpi_battery.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/acpica/acpi_battery.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -329,7 +329,6 @@ acpi_battery_find_dev(u_int logical_unit
 
     dev = NULL;
     found_unit = 0;
-    newbus_slock();
     batt_dc = devclass_find("battery");
     maxunit = devclass_get_maxunit(batt_dc);
     for (i = 0; i < maxunit; i++) {
@@ -341,7 +340,6 @@ acpi_battery_find_dev(u_int logical_unit
 	found_unit++;
 	dev = NULL;
     }
-    newbus_sunlock();
 
     return (dev);
 }
@@ -371,17 +369,13 @@ acpi_battery_ioctl(u_long cmd, caddr_t a
      */
     switch (cmd) {
     case ACPIIO_BATT_GET_UNITS:
-	newbus_slock();
 	*(int *)addr = acpi_battery_get_units();
-	newbus_sunlock();
 	error = 0;
 	break;
     case ACPIIO_BATT_GET_BATTINFO:
 	if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) {
 	    bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo));
-	    newbus_slock();
 	    error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo);
-	    newbus_sunlock();
 	}
 	break;
     case ACPIIO_BATT_GET_BIF:
@@ -422,11 +416,6 @@ acpi_battery_sysctl(SYSCTL_HANDLER_ARGS)
 {
     int val, error;
 
-    /*
-     * Tolerate a race here because newbus lock can't be acquired before
-     * acpi_battery_get_battinfo() as it can create a LOR with the sysctl
-     * lock.
-     */
     acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo);
     val = *(u_int *)oidp->oid_arg1;
     error = sysctl_handle_int(oidp, &val, 0, req);
@@ -438,10 +427,6 @@ acpi_battery_units_sysctl(SYSCTL_HANDLER
 {
     int count, error;
 
-    /*
-     * Tolerate a race here in order to avoid a LOR between sysctl lock
-     * and newbus lock.
-     */
     count = acpi_battery_get_units();
     error = sysctl_handle_int(oidp, &count, 0, req);
     return (error);

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/acpica/acpi_cpu.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -732,9 +732,7 @@ acpi_cpu_startup(void *arg)
     int i;
 
     /* Get set of CPU devices */
-    newbus_slock();
     devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
-    newbus_sunlock();
 
     /*
      * Setup any quirks that might necessary now that we have probed

Modified: head/sys/dev/acpica/acpi_dock.c
==============================================================================
--- head/sys/dev/acpica/acpi_dock.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/acpica/acpi_dock.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -188,12 +188,12 @@ acpi_dock_attach_later(void *context)
 
 	dev = (device_t)context;
 
-	newbus_xlock();
 	if (!device_is_enabled(dev))
 		device_enable(dev);
 
+	mtx_lock(&Giant);
 	device_probe_and_attach(dev);
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 }
 
 static ACPI_STATUS
@@ -299,11 +299,11 @@ acpi_dock_eject_child(ACPI_HANDLE handle
 	    "ejecting device for %s\n", acpi_name(handle));
 
 	dev = acpi_get_device(handle);
-	newbus_xlock();
 	if (dev != NULL && device_is_attached(dev)) {
+		mtx_lock(&Giant);
 		device_detach(dev);
+		mtx_unlock(&Giant);
 	}
-	newbus_xunlock();
 
 	acpi_SetInteger(handle, "_EJ0", 0);
 out:

Modified: head/sys/dev/acpica/acpi_thermal.c
==============================================================================
--- head/sys/dev/acpica/acpi_thermal.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/acpica/acpi_thermal.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -936,8 +936,6 @@ acpi_tz_thread(void *arg)
     sc = NULL;
 
     for (;;) {
-	newbus_slock();
-
 	/* If the number of devices has changed, re-evaluate. */
 	if (devclass_get_count(acpi_tz_devclass) != devcount) {
 	    if (devs != NULL) {
@@ -950,7 +948,6 @@ acpi_tz_thread(void *arg)
 	    for (i = 0; i < devcount; i++)
 		sc[i] = device_get_softc(devs[i]);
 	}
-	newbus_sunlock();
 
 	/* Check for temperature events and act on them. */
 	for (i = 0; i < devcount; i++) {

Modified: head/sys/dev/adb/adb_bus.c
==============================================================================
--- head/sys/dev/adb/adb_bus.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/adb/adb_bus.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -113,7 +113,6 @@ adb_bus_enumerate(void *xdev)
 	uint8_t i, next_free;
 	uint16_t r3;
 
-	newbus_xlock();
 	sc->sc_dev = dev;
 	sc->parent = device_get_parent(dev);
 
@@ -188,7 +187,6 @@ adb_bus_enumerate(void *xdev)
 	}
 
 	bus_generic_attach(dev);
-	newbus_xunlock();
 
 	config_intrhook_disestablish(&sc->enum_hook);
 }

Modified: head/sys/dev/amdtemp/amdtemp.c
==============================================================================
--- head/sys/dev/amdtemp/amdtemp.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/amdtemp/amdtemp.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -269,7 +269,6 @@ amdtemp_intrhook(void *arg)
 	/*
 	 * dev.cpu.N.temperature.
 	 */
-	newbus_xlock();
 	nexus = device_find_child(root_bus, "nexus", 0);
 	acpi = device_find_child(nexus, "acpi", 0);
 
@@ -286,7 +285,6 @@ amdtemp_intrhook(void *arg)
 			    "Max of sensor 0 / 1");
 		}
 	}
-	newbus_xunlock();
 	config_intrhook_disestablish(&sc->sc_ich);
 }
 

Modified: head/sys/dev/amr/amr.c
==============================================================================
--- head/sys/dev/amr/amr.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/amr/amr.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -90,10 +90,6 @@ __FBSDID("$FreeBSD$");
 
 SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters");
 
-/*
- * In order to get rid of Giant, amr_state should be protected by
- * a proper softc lock for the cdev operations.
- */
 static d_open_t         amr_open;
 static d_close_t        amr_close;
 static d_ioctl_t        amr_ioctl;
@@ -316,11 +312,9 @@ amr_startup(void *arg)
 	config_intrhook_disestablish(&sc->amr_ich);
     sc->amr_ich.ich_func = NULL;
 
-    newbus_xlock();
     /* get up-to-date drive information */
     if (amr_query_controller(sc)) {
 	device_printf(sc->amr_dev, "can't scan controller for drives\n");
-	newbus_xunlock();
 	return;
     }
 
@@ -353,7 +347,6 @@ amr_startup(void *arg)
 
     /* interrupts will be enabled before we do anything more */
     sc->amr_state |= AMR_STATE_INTEN;
-    newbus_xunlock();
 
     /*
      * Start the timeout routine.
@@ -441,11 +434,7 @@ static int
 amr_open(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
     int			unit = dev2unit(dev);
-    struct amr_softc	*sc;
-
-    newbus_slock();
-    sc = devclass_get_softc(devclass_find("amr"), unit);
-    newbus_sunlock();
+    struct amr_softc	*sc = devclass_get_softc(devclass_find("amr"), unit);
 
     debug_called(1);
 
@@ -501,11 +490,7 @@ static int
 amr_close(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
     int			unit = dev2unit(dev);
-    struct amr_softc	*sc;
-
-    newbus_slock();
-    sc = devclass_get_softc(devclass_find("amr"), unit);
-    newbus_sunlock();
+    struct amr_softc	*sc = devclass_get_softc(devclass_find("amr"), unit);
 
     debug_called(1);
 
@@ -522,7 +507,6 @@ amr_rescan_drives(struct cdev *dev)
     struct amr_softc	*sc = (struct amr_softc *)dev->si_drv1;
     int			i, error = 0;
 
-    newbus_xlock();
     sc->amr_state |= AMR_STATE_REMAP_LD;
     while (sc->amr_busyslots) {
 	device_printf(sc->amr_dev, "idle controller\n");
@@ -546,7 +530,6 @@ amr_rescan_drives(struct cdev *dev)
 	     sc->amr_drive[i].al_disk = 0;
 	}
     }
-    newbus_xunlock();
 
 shutdown_out:
     amr_startup(sc);
@@ -822,9 +805,7 @@ amr_ioctl(struct cdev *dev, u_long cmd, 
 	    struct amr_linux_ioctl	ali;
 	    int				adapter, error;
 
-	    newbus_slock();
 	    devclass = devclass_find("amr");
-	    newbus_sunlock();
 	    if (devclass == NULL)
 		return (ENOENT);
 

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/ata/ata-all.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 static  d_ioctl_t       ata_ioctl;
 static struct cdevsw ata_cdevsw = {
 	.d_version =    D_VERSION,
+	.d_flags =      D_NEEDGIANT, /* we need this as newbus isn't mpsafe */
 	.d_ioctl =      ata_ioctl,
 	.d_name =       "ata",
 };
@@ -203,9 +204,7 @@ ata_conn_event(void *context, int dummy)
 {
     device_t dev = (device_t)context;
 
-    newbus_xlock();
     ata_reinit(dev);
-    newbus_xunlock();
 }
 
 int
@@ -247,6 +246,7 @@ ata_reinit(device_t dev)
 
     /* reinit the children and delete any that fails */
     if (!device_get_children(dev, &children, &nchildren)) {
+	mtx_lock(&Giant);       /* newbus suckage it needs Giant */
 	for (i = 0; i < nchildren; i++) {
 	    /* did any children go missing ? */
 	    if (children[i] && device_is_attached(children[i]) &&
@@ -269,6 +269,7 @@ ata_reinit(device_t dev)
 	    }
 	}
 	free(children, M_TEMP);
+	mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
     }
 
     /* if we still have a good request put it on the queue again */
@@ -394,7 +395,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
     int *value = (int *)data;
     int i, nchildren, error = ENOTTY;
 
-    newbus_xlock();
     switch (cmd) {
     case IOCATAGMAXCHANNEL:
 	/* In case we have channel 0..n this will return n+1. */
@@ -405,40 +405,32 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
     case IOCATAREINIT:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = ata_reinit(device);
 	break;
 
     case IOCATAATTACH:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = DEVICE_ATTACH(device);
 	break;
 
     case IOCATADETACH:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = DEVICE_DETACH(device);
 	break;
 
     case IOCATADEVICES:
 	if (devices->channel >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, devices->channel)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	bzero(devices->name[0], 32);
 	bzero(&devices->params[0], sizeof(struct ata_params));
 	bzero(devices->name[1], 32);
@@ -473,7 +465,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
 	if (ata_raid_ioctl_func)
 	    error = ata_raid_ioctl_func(cmd, data);
     }
-    newbus_xunlock();
     return error;
 }
 
@@ -581,7 +572,7 @@ ata_boot_attach(void)
     struct ata_channel *ch;
     int ctlr;
 
-    newbus_xlock();
+    mtx_lock(&Giant);       /* newbus suckage it needs Giant */
 
     /* kick of probe and attach on all channels */
     for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) {
@@ -596,7 +587,8 @@ ata_boot_attach(void)
 	free(ata_delayed_attach, M_TEMP);
 	ata_delayed_attach = NULL;
     }
-    newbus_xunlock();
+
+    mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
 }
 
 
@@ -725,6 +717,7 @@ ata_identify(device_t dev)
     if (bootverbose)
 	device_printf(dev, "Identifying devices: %08x\n", ch->devices);
 
+    mtx_lock(&Giant);
     /* Skip existing devices. */
     if (!device_get_children(dev, &children, &nchildren)) {
 	for (i = 0; i < nchildren; i++) {
@@ -736,8 +729,10 @@ ata_identify(device_t dev)
     /* Create new devices. */
     if (bootverbose)
 	device_printf(dev, "New devices: %08x\n", n);
-    if (n == 0)
+    if (n == 0) {
+	mtx_unlock(&Giant);
 	return (0);
+    }
     for (i = 0; i < ATA_PM; ++i) {
 	if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) {
 	    int unit = -1;
@@ -780,6 +775,7 @@ ata_identify(device_t dev)
     }
     bus_generic_probe(dev);
     bus_generic_attach(dev);
+    mtx_unlock(&Giant);
     return 0;
 }
 

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/atkbdc/psm.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -1488,9 +1488,7 @@ psmopen(struct cdev *dev, int flag, int 
 	if (sc->state & PSM_OPEN)
 		return (EBUSY);
 
-	newbus_xlock();
 	device_busy(devclass_get_device(psm_devclass, unit));
-	newbus_xunlock();
 
 	/* Initialize state */
 	sc->mode.level = sc->dflt_mode.level;
@@ -1645,9 +1643,7 @@ psmclose(struct cdev *dev, int flag, int
 	/* close is almost always successful */
 	sc->state &= ~PSM_OPEN;
 	kbdc_lock(sc->kbdc, FALSE);
-	newbus_xlock();
 	device_unbusy(devclass_get_device(psm_devclass, unit));
-	newbus_xunlock();
 	return (0);
 }
 

Modified: head/sys/dev/bktr/bktr_os.c
==============================================================================
--- head/sys/dev/bktr/bktr_os.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/bktr/bktr_os.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -597,9 +597,7 @@ bktr_open( struct cdev *dev, int flags, 
 		return( ENXIO );	
 
 	/* Record that the device is now busy */
-	newbus_xlock();
 	device_busy(devclass_get_device(bktr_devclass, unit)); 
-	newbus_xunlock();
 
 
 	if (bt848_card != -1) {
@@ -670,11 +668,8 @@ bktr_open( struct cdev *dev, int flags, 
 	}
 
 	/* If there was an error opening the device, undo the busy status */
-	if (result != 0) {
-		newbus_xlock();
+	if (result != 0)
 		device_unbusy(devclass_get_device(bktr_devclass, unit)); 
-		newbus_xunlock();
-	}
 	return( result );
 }
 
@@ -694,7 +689,6 @@ bktr_close( struct cdev *dev, int flags,
 	/* Get the device data */
 	bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
 	if (bktr == NULL) {
-
 		/* the device is no longer valid/functioning */
 		return (ENXIO);
 	}
@@ -711,11 +705,10 @@ bktr_close( struct cdev *dev, int flags,
 		break;
 	default:
 		return (ENXIO);
+		break;
 	}
 
-	newbus_xlock();
 	device_unbusy(devclass_get_device(bktr_devclass, unit)); 
-	newbus_xunlock();
 	return( result );
 }
 

Modified: head/sys/dev/drm/drm_drv.c
==============================================================================
--- head/sys/dev/drm/drm_drv.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/drm/drm_drv.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -614,13 +614,11 @@ int drm_open(struct cdev *kdev, int flag
 
 	if (!retcode) {
 		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-		newbus_xlock();
 		DRM_LOCK();
 		device_busy(dev->device);
 		if (!dev->open_count++)
 			retcode = drm_firstopen(dev);
 		DRM_UNLOCK();
-		newbus_xunlock();
 	}
 
 	return retcode;
@@ -634,11 +632,6 @@ void drm_close(void *data)
 
 	DRM_DEBUG("open_count = %d\n", dev->open_count);
 
-	/*
-	 * We require to lock newbus here for handling device_unbusy() and
-	 * avoid a LOR with DRM_LOCK.
-	 */
-	newbus_xlock();
 	DRM_LOCK();
 
 	if (dev->driver->preclose != NULL)
@@ -715,7 +708,6 @@ void drm_close(void *data)
 	}
 
 	DRM_UNLOCK();
-	newbus_xunlock();
 }
 
 /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm.

Modified: head/sys/dev/ips/ips_pci.c
==============================================================================
--- head/sys/dev/ips/ips_pci.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/ips/ips_pci.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -173,12 +173,10 @@ ips_intrhook(void *arg)
 	struct ips_softc *sc = (struct ips_softc *)arg;
 
 	config_intrhook_disestablish(&sc->ips_ich);
-	newbus_xlock();
 	if (ips_adapter_init(sc))
 		ips_pci_free(sc);
 	else
 		sc->configured = 1;
-	newbus_xunlock();
 }
 
 static int ips_pci_free(ips_softc_t *sc)

Modified: head/sys/dev/mfi/mfi.c
==============================================================================
--- head/sys/dev/mfi/mfi.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/mfi/mfi.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -1327,11 +1327,11 @@ mfi_add_ld_complete(struct mfi_command *
 	mfi_release_command(cm);
 
 	mtx_unlock(&sc->mfi_io_lock);
-	newbus_xlock();
+	mtx_lock(&Giant);
 	if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) {
 		device_printf(sc->mfi_dev, "Failed to add logical disk\n");
 		free(ld_info, M_MFIBUF);
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 		mtx_lock(&sc->mfi_io_lock);
 		return;
 	}
@@ -1339,7 +1339,7 @@ mfi_add_ld_complete(struct mfi_command *
 	device_set_ivars(child, ld_info);
 	device_set_desc(child, "MFI Logical Disk");
 	bus_generic_attach(sc->mfi_dev);
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	mtx_lock(&sc->mfi_io_lock);
 }
 
@@ -1805,9 +1805,9 @@ mfi_check_command_post(struct mfi_softc 
 		KASSERT(ld != NULL, ("volume dissappeared"));
 		if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
 			mtx_unlock(&sc->mfi_io_lock);
-			newbus_xlock();
+			mtx_lock(&Giant);
 			device_delete_child(sc->mfi_dev, ld->ld_dev);
-			newbus_xunlock();
+			mtx_unlock(&Giant);
 			mtx_lock(&sc->mfi_io_lock);
 		} else
 			mfi_disk_enable(ld);
@@ -1815,11 +1815,11 @@ mfi_check_command_post(struct mfi_softc 
 	case MFI_DCMD_CFG_CLEAR:
 		if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
 			mtx_unlock(&sc->mfi_io_lock);
-			newbus_xlock();
+			mtx_lock(&Giant);
 			TAILQ_FOREACH_SAFE(ld, &sc->mfi_ld_tqh, ld_link, ldn) {
 				device_delete_child(sc->mfi_dev, ld->ld_dev);
 			}
-			newbus_xunlock();
+			mtx_unlock(&Giant);
 			mtx_lock(&sc->mfi_io_lock);
 		} else {
 			TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link)
@@ -1985,9 +1985,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, 
 
 		adapter = ioc->mfi_adapter_no;
 		if (device_get_unit(sc->mfi_dev) == 0 && adapter != 0) {
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			sc = devclass_get_softc(devclass, adapter);
 		}
 		mtx_lock(&sc->mfi_io_lock);
@@ -2175,9 +2173,7 @@ out:
 			struct mfi_linux_ioc_packet l_ioc;
 			int adapter;
 
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			if (devclass == NULL)
 				return (ENOENT);
 
@@ -2198,9 +2194,7 @@ out:
 			struct mfi_linux_ioc_aen l_aen;
 			int adapter;
 
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			if (devclass == NULL)
 				return (ENOENT);
 

Modified: head/sys/dev/mlx/mlx.c
==============================================================================
--- head/sys/dev/mlx/mlx.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/mlx/mlx.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -772,9 +772,7 @@ mlx_ioctl(struct cdev *dev, u_long cmd, 
 	 * Scan the controller to see whether new drives have appeared.
 	 */
     case MLX_RESCAN_DRIVES:
-	newbus_xlock();
 	mlx_startup(sc);
-	newbus_xunlock();
 	return(0);
 
 	/*

Modified: head/sys/dev/mmc/mmc.c
==============================================================================
--- head/sys/dev/mmc/mmc.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/mmc/mmc.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -1496,9 +1496,7 @@ mmc_delayed_attach(void *xsc)
 {
 	struct mmc_softc *sc = xsc;
 	
-	newbus_xlock();
 	mmc_scan(sc);
-	newbus_xunlock();
 	config_intrhook_disestablish(&sc->config_intrhook);
 }
 

Modified: head/sys/dev/pccbb/pccbb.c
==============================================================================
--- head/sys/dev/pccbb/pccbb.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/pccbb/pccbb.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -464,7 +464,14 @@ cbb_event_thread(void *arg)
 	sc->flags |= CBB_KTHREAD_RUNNING;
 	while ((sc->flags & CBB_KTHREAD_DONE) == 0) {
 		mtx_unlock(&sc->mtx);
-		newbus_xlock();
+		/*
+		 * We take out Giant here because we need it deep,
+		 * down in the bowels of the vm system for mapping the
+		 * memory we need to read the CIS.  In addition, since
+		 * we are adding/deleting devices from the dev tree,
+		 * and that code isn't MP safe, we have to hold Giant.
+		 */
+		mtx_lock(&Giant);
 		status = cbb_get(sc, CBB_SOCKET_STATE);
 		DPRINTF(("Status is 0x%x\n", status));
 		if (!CBB_CARD_PRESENT(status)) {
@@ -490,7 +497,7 @@ cbb_event_thread(void *arg)
 			not_a_card = 0;		/* We know card type */
 			cbb_insert(sc);
 		}
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 
 		/*
 		 * First time through we need to tell mountroot that we're

Modified: head/sys/dev/pst/pst-iop.c
==============================================================================
--- head/sys/dev/pst/pst-iop.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/pst/pst-iop.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -152,9 +152,7 @@ iop_attach(void *arg)
 	    break;
 
 	case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-	    newbus_xlock();
 	    pst_add_raid(sc, &sc->lct[i]);
-	    newbus_xunlock();
 	    break;
 	}
     }

Modified: head/sys/dev/rp/rp.c
==============================================================================
--- head/sys/dev/rp/rp.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/rp/rp.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -903,9 +903,7 @@ rpopen(struct tty *tp)
 		rp_callout_handle = timeout(rp_do_poll, 
 					    (void *)NULL, POLL_INTERVAL);
 
-	newbus_xlock();
 	device_busy(rp->rp_ctlp->dev);
-	newbus_xunlock();
 	return(0);
 }
 
@@ -916,9 +914,7 @@ rpclose(struct tty *tp)
 
 	rp = tty_softc(tp);
 	rphardclose(tp);
-	newbus_xlock();
 	device_unbusy(rp->rp_ctlp->dev);
-	newbus_xunlock();
 }
 
 static void

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/sound/pci/hda/hdac.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -7435,7 +7435,6 @@ hdac_attach2(void *arg)
 		    quirks_on, quirks_off);
 	);
 
-	newbus_xlock();
 	hdac_lock(sc);
 
 	/* Remove ourselves from the config hooks */
@@ -7675,7 +7674,6 @@ hdac_attach2(void *arg)
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO,
 	    "pindump", CTLTYPE_INT | CTLFLAG_RW, sc->dev, sizeof(sc->dev),
 	    sysctl_hdac_pindump, "I", "Dump pin states/data");
-	newbus_xunlock();
 }
 
 /****************************************************************************

Modified: head/sys/dev/twe/twe.c
==============================================================================
--- head/sys/dev/twe/twe.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/twe/twe.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -294,10 +294,8 @@ twe_init(struct twe_softc *sc)
     /*
      * Scan for drives
      */
-    newbus_xlock();
     for (i = 0; i < TWE_MAX_UNITS; i++)
 	twe_add_unit(sc, i);
-    newbus_xunlock();
 
     /*
      * Initialise connection with controller.
@@ -623,15 +621,11 @@ twe_ioctl(struct twe_softc *sc, int ioct
 	break;
 
     case TWEIO_ADD_UNIT:
-	newbus_xlock();
 	error = twe_add_unit(sc, td->td_unit);
-	newbus_xunlock();
 	break;
 
     case TWEIO_DEL_UNIT:
-	newbus_xlock();
 	error = twe_del_unit(sc, td->td_unit);
-	newbus_xunlock();
 	break;
 
 	/* XXX implement ATA PASSTHROUGH */

Modified: head/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- head/sys/dev/usb/controller/usb_controller.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/usb/controller/usb_controller.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -143,7 +143,9 @@ usb_attach(device_t dev)
 	}
 
 	if (usb_post_init_called) {
+		mtx_lock(&Giant);
 		usb_attach_sub(dev, bus);
+		mtx_unlock(&Giant);
 		usb_needs_explore(bus, 1);
 	}
 	return (0);			/* return success */
@@ -226,13 +228,20 @@ usb_bus_explore(struct usb_proc_msg *pm)
 		}
 		USB_BUS_UNLOCK(bus);
 
+		mtx_lock(&Giant);
+
 		/*
 		 * First update the USB power state!
 		 */
 		usb_bus_powerd(bus);
-
-		 /* Explore the Root USB HUB. */
+		/*
+		 * Explore the Root USB HUB. This call can sleep,
+		 * exiting Giant, which is actually Giant.
+		 */
 		(udev->hub->explore) (udev);
+
+		mtx_unlock(&Giant);
+
 		USB_BUS_LOCK(bus);
 	}
 	if (bus->bus_roothold != NULL) {
@@ -260,7 +269,7 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	device_set_softc(dev, NULL);
 	USB_BUS_UNLOCK(bus);
 
-	newbus_xlock();
+	mtx_lock(&Giant);
 
 	/* detach children first */
 	bus_generic_detach(dev);
@@ -272,7 +281,7 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	usb_free_device(udev,
 	    USB_UNCFG_FLAG_FREE_EP0);
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 	/* clear bdev variable last */
 	bus->bdev = NULL;
@@ -341,7 +350,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
 	}
 
 	USB_BUS_UNLOCK(bus);
-	newbus_xlock();
+	mtx_lock(&Giant);		/* XXX not required by USB */
 
 	/* default power_mask value */
 	bus->hw_power_state =
@@ -374,7 +383,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
 		err = USB_ERR_NOMEM;
 	}
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 
 	if (err) {
@@ -463,7 +472,7 @@ usb_post_init(void *arg)
 	int max;
 	int n;
 
-	newbus_xlock();
+	mtx_lock(&Giant);
 
 	usb_devclass_ptr = devclass_find("usbus");
 
@@ -474,8 +483,11 @@ usb_post_init(void *arg)
 			dev = devclass_get_device(dc, n);
 			if (dev && device_is_attached(dev)) {
 				bus = device_get_ivars(dev);
-				if (bus)
+				if (bus) {
+					mtx_lock(&Giant);
 					usb_attach_sub(dev, bus);
+					mtx_unlock(&Giant);
+				}
 			}
 		}
 	} else {
@@ -487,7 +499,7 @@ usb_post_init(void *arg)
 
 	usb_needs_explore_all();
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 }
 
 SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL);

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/usb/input/ukbd.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -745,7 +745,7 @@ ukbd_attach(device_t dev)
 	uint16_t n;
 	uint16_t hid_len;
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
 
 	kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0);
 
@@ -854,6 +854,9 @@ ukbd_attach(device_t dev)
 	if (bootverbose) {
 		genkbd_diag(kbd, bootverbose);
 	}
+	/* lock keyboard mutex */
+
+	mtx_lock(&Giant);
 
 	/* start the keyboard */
 
@@ -876,7 +879,7 @@ ukbd_detach(device_t dev)
 	struct ukbd_softc *sc = device_get_softc(dev);
 	int error;
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
 
 	DPRINTF("\n");
 
@@ -913,8 +916,6 @@ ukbd_detach(device_t dev)
 
 	usb_callout_drain(&sc->sc_callout);
 
-	mtx_unlock(&Giant);
-
 	DPRINTF("%s: disconnected\n",
 	    device_get_nameunit(dev));
 
@@ -926,9 +927,9 @@ ukbd_resume(device_t dev)
 {
 	struct ukbd_softc *sc = device_get_softc(dev);
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
+
 	ukbd_clear_state(&sc->sc_kbd);
-	mtx_unlock(&Giant);
 
 	return (0);
 }

Modified: head/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- head/sys/dev/usb/net/usb_ethernet.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/usb/net/usb_ethernet.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -221,10 +221,10 @@ ue_attach_post_task(struct usb_proc_msg 
 
 	if (ue->ue_methods->ue_mii_upd != NULL && 
 	    ue->ue_methods->ue_mii_sts != NULL) {
-		newbus_xlock();
+		mtx_lock(&Giant);	/* device_xxx() depends on this */
 		error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus,
 		    ue_ifmedia_upd, ue->ue_methods->ue_mii_sts);
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 		if (error) {
 			device_printf(ue->ue_dev, "MII without any PHY\n");
 			goto error;
@@ -279,12 +279,9 @@ uether_ifdetach(struct usb_ether *ue)
 
 		/* detach miibus */
 		if (ue->ue_miibus != NULL) {
-
-			/*
-			 * It is up to the callers to provide the correct
-			 * newbus locking.
-			 */
+			mtx_lock(&Giant);	/* device_xxx() depends on this */
 			device_delete_child(ue->ue_dev, ue->ue_miibus);
+			mtx_unlock(&Giant);
 		}
 
 		/* detach ethernet */

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c	Thu Aug 20 14:20:56 2009	(r196402)
+++ head/sys/dev/usb/usb_compat_linux.c	Thu Aug 20 19:17:53 2009	(r196403)
@@ -215,12 +215,14 @@ usb_linux_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
+	mtx_lock(&Giant);
 	LIST_FOREACH(udrv, &usb_linux_driver_list, linux_driver_list) {
 		if (usb_linux_lookup_id(udrv->id_table, uaa)) {
 			err = 0;
 			break;
 		}
 	}
+	mtx_unlock(&Giant);
 
 	return (err);
 }
@@ -237,7 +239,9 @@ usb_linux_get_usb_driver(struct usb_linu
 {
 	struct usb_driver *udrv;
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 19:23:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A2720106568F;
	Thu, 20 Aug 2009 19:23:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 912668FC64;
	Thu, 20 Aug 2009 19:23:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KJNwkH096367;
	Thu, 20 Aug 2009 19:23:58 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KJNwwc096363;
	Thu, 20 Aug 2009 19:23:58 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908201923.n7KJNwwc096363@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 20 Aug 2009 19:23:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196404 - in head: share/man/man9 sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 19:23:58 -0000

Author: jhb
Date: Thu Aug 20 19:23:58 2009
New Revision: 196404
URL: http://svn.freebsd.org/changeset/base/196404

Log:
  Change the 'resid' parameter to sglist_consume_uio() from an int to a
  size_t to match the recent type change of the uio_resid member of struct
  uio.
  
  Approved by:	re (kib)

Modified:
  head/share/man/man9/sglist.9
  head/sys/kern/subr_sglist.c
  head/sys/sys/sglist.h

Modified: head/share/man/man9/sglist.9
==============================================================================
--- head/share/man/man9/sglist.9	Thu Aug 20 19:17:53 2009	(r196403)
+++ head/share/man/man9/sglist.9	Thu Aug 20 19:23:58 2009	(r196404)
@@ -70,7 +70,7 @@
 .Ft struct sglist *
 .Fn sglist_clone "struct sglist *sg" "int mflags"
 .Ft int
-.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "int resid"
+.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "size_t resid"
 .Ft int
 .Fn sglist_count "void *buf" "size_t len"
 .Ft void

Modified: head/sys/kern/subr_sglist.c
==============================================================================
--- head/sys/kern/subr_sglist.c	Thu Aug 20 19:17:53 2009	(r196403)
+++ head/sys/kern/subr_sglist.c	Thu Aug 20 19:23:58 2009	(r196404)
@@ -315,7 +315,7 @@ sglist_append_uio(struct sglist *sg, str
  * segments, then only the amount that fits is appended.
  */
 int
-sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid)
+sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid)
 {
 	struct iovec *iov;
 	size_t done;

Modified: head/sys/sys/sglist.h
==============================================================================
--- head/sys/sys/sglist.h	Thu Aug 20 19:17:53 2009	(r196403)
+++ head/sys/sys/sglist.h	Thu Aug 20 19:23:58 2009	(r196404)
@@ -91,7 +91,7 @@ int	sglist_append_user(struct sglist *sg
 	    struct thread *td);
 struct sglist *sglist_build(void *buf, size_t len, int mflags);
 struct sglist *sglist_clone(struct sglist *sg, int mflags);
-int	sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid);
+int	sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid);
 int	sglist_count(void *buf, size_t len);
 void	sglist_free(struct sglist *sg);
 int	sglist_join(struct sglist *first, struct sglist *second);

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 20:23:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50149106568B;
	Thu, 20 Aug 2009 20:23:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3A91A8FC52;
	Thu, 20 Aug 2009 20:23:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KKNTrs098433;
	Thu, 20 Aug 2009 20:23:29 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KKNSxU098405;
	Thu, 20 Aug 2009 20:23:28 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908202023.n7KKNSxU098405@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 20 Aug 2009 20:23: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: r196405 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/aac dev/acpica dev/adb dev/amdtemp dev/amr dev/ata
	dev/atkbdc dev/bktr dev/drm ...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 20:23:29 -0000

Author: jhb
Date: Thu Aug 20 20:23:28 2009
New Revision: 196405
URL: http://svn.freebsd.org/changeset/base/196405

Log:
  MFC 196403: Temporarily revert the new-bus locking for 8.0 release.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/aac/aac.c
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/dev/acpica/acpi_battery.c
  stable/8/sys/dev/acpica/acpi_cpu.c
  stable/8/sys/dev/acpica/acpi_dock.c
  stable/8/sys/dev/acpica/acpi_thermal.c
  stable/8/sys/dev/adb/adb_bus.c
  stable/8/sys/dev/amdtemp/amdtemp.c
  stable/8/sys/dev/amr/amr.c
  stable/8/sys/dev/ata/ata-all.c
  stable/8/sys/dev/atkbdc/psm.c
  stable/8/sys/dev/bktr/bktr_os.c
  stable/8/sys/dev/drm/drm_drv.c
  stable/8/sys/dev/ips/ips_pci.c
  stable/8/sys/dev/mfi/mfi.c
  stable/8/sys/dev/mlx/mlx.c
  stable/8/sys/dev/mmc/mmc.c
  stable/8/sys/dev/pccbb/pccbb.c
  stable/8/sys/dev/pst/pst-iop.c
  stable/8/sys/dev/rp/rp.c
  stable/8/sys/dev/sound/pci/hda/hdac.c
  stable/8/sys/dev/twe/twe.c
  stable/8/sys/dev/usb/controller/usb_controller.c
  stable/8/sys/dev/usb/input/ukbd.c
  stable/8/sys/dev/usb/net/usb_ethernet.c
  stable/8/sys/dev/usb/usb_compat_linux.c
  stable/8/sys/dev/usb/usb_dev.c
  stable/8/sys/dev/usb/usb_handle_request.c
  stable/8/sys/dev/usb/usb_hub.c
  stable/8/sys/dev/usb/wlan/if_upgt.c
  stable/8/sys/dev/xen/blkback/blkback.c
  stable/8/sys/dev/xen/netback/netback.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/acpica/acpi_machdep.c
  stable/8/sys/i386/bios/smapi.c
  stable/8/sys/i386/bios/smbios.c
  stable/8/sys/i386/bios/vpd.c
  stable/8/sys/kern/subr_bus.c
  stable/8/sys/pc98/cbus/fdc.c
  stable/8/sys/sys/bus.h
  stable/8/sys/xen/xenbus/xenbus_probe.c

Modified: stable/8/sys/dev/aac/aac.c
==============================================================================
--- stable/8/sys/dev/aac/aac.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/aac/aac.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -3270,10 +3270,10 @@ aac_handle_aif(struct aac_softc *sc, str
 			while (co != NULL) {
 				if (co->co_found == 0) {
 					mtx_unlock(&sc->aac_io_lock);
-					newbus_xlock();
+					mtx_lock(&Giant);
 					device_delete_child(sc->aac_dev,
 							    co->co_disk);
-					newbus_xunlock();
+					mtx_unlock(&Giant);
 					mtx_lock(&sc->aac_io_lock);
 					co_next = TAILQ_NEXT(co, co_link);
 					mtx_lock(&sc->aac_container_lock);
@@ -3291,9 +3291,9 @@ aac_handle_aif(struct aac_softc *sc, str
 			/* Attach the newly created containers */
 			if (added) {
 				mtx_unlock(&sc->aac_io_lock);
-				newbus_xlock();
+				mtx_lock(&Giant);
 				bus_generic_attach(sc->aac_dev);
-				newbus_xunlock();
+				mtx_unlock(&Giant);
 				mtx_lock(&sc->aac_io_lock);
 			}
 

Modified: stable/8/sys/dev/acpica/acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/acpica/acpi.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -675,6 +675,8 @@ acpi_suspend(device_t dev)
     device_t child, *devlist;
     int error, i, numdevs, pstate;
 
+    GIANT_REQUIRED;
+
     /* First give child devices a chance to suspend. */
     error = bus_generic_suspend(dev);
     if (error)
@@ -717,6 +719,8 @@ acpi_resume(device_t dev)
     int i, numdevs, error;
     device_t child, *devlist;
 
+    GIANT_REQUIRED;
+
     /*
      * Put all devices in D0 before resuming them.  Call _S0D on each one
      * since some systems expect this.
@@ -741,6 +745,8 @@ static int
 acpi_shutdown(device_t dev)
 {
 
+    GIANT_REQUIRED;
+
     /* Allow children to shutdown first. */
     bus_generic_shutdown(dev);
 
@@ -2528,7 +2534,11 @@ acpi_EnterSleepState(struct acpi_softc *
     thread_unlock(curthread);
 #endif
 
-    newbus_xlock();
+    /*
+     * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
+     * drivers need this.
+     */
+    mtx_lock(&Giant);
 
     slp_state = ACPI_SS_NONE;
 
@@ -2601,7 +2611,7 @@ backout:
     if (slp_state >= ACPI_SS_SLEPT)
 	acpi_enable_fixed_events(sc);
 
-    newbus_xunlock();
+    mtx_unlock(&Giant);
 
 #ifdef SMP
     thread_lock(curthread);

Modified: stable/8/sys/dev/acpica/acpi_battery.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_battery.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/acpica/acpi_battery.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -329,7 +329,6 @@ acpi_battery_find_dev(u_int logical_unit
 
     dev = NULL;
     found_unit = 0;
-    newbus_slock();
     batt_dc = devclass_find("battery");
     maxunit = devclass_get_maxunit(batt_dc);
     for (i = 0; i < maxunit; i++) {
@@ -341,7 +340,6 @@ acpi_battery_find_dev(u_int logical_unit
 	found_unit++;
 	dev = NULL;
     }
-    newbus_sunlock();
 
     return (dev);
 }
@@ -371,17 +369,13 @@ acpi_battery_ioctl(u_long cmd, caddr_t a
      */
     switch (cmd) {
     case ACPIIO_BATT_GET_UNITS:
-	newbus_slock();
 	*(int *)addr = acpi_battery_get_units();
-	newbus_sunlock();
 	error = 0;
 	break;
     case ACPIIO_BATT_GET_BATTINFO:
 	if (dev != NULL || unit == ACPI_BATTERY_ALL_UNITS) {
 	    bzero(&ioctl_arg->battinfo, sizeof(ioctl_arg->battinfo));
-	    newbus_slock();
 	    error = acpi_battery_get_battinfo(dev, &ioctl_arg->battinfo);
-	    newbus_sunlock();
 	}
 	break;
     case ACPIIO_BATT_GET_BIF:
@@ -422,11 +416,6 @@ acpi_battery_sysctl(SYSCTL_HANDLER_ARGS)
 {
     int val, error;
 
-    /*
-     * Tolerate a race here because newbus lock can't be acquired before
-     * acpi_battery_get_battinfo() as it can create a LOR with the sysctl
-     * lock.
-     */
     acpi_battery_get_battinfo(NULL, &acpi_battery_battinfo);
     val = *(u_int *)oidp->oid_arg1;
     error = sysctl_handle_int(oidp, &val, 0, req);
@@ -438,10 +427,6 @@ acpi_battery_units_sysctl(SYSCTL_HANDLER
 {
     int count, error;
 
-    /*
-     * Tolerate a race here in order to avoid a LOR between sysctl lock
-     * and newbus lock.
-     */
     count = acpi_battery_get_units();
     error = sysctl_handle_int(oidp, &count, 0, req);
     return (error);

Modified: stable/8/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_cpu.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/acpica/acpi_cpu.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -732,9 +732,7 @@ acpi_cpu_startup(void *arg)
     int i;
 
     /* Get set of CPU devices */
-    newbus_slock();
     devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
-    newbus_sunlock();
 
     /*
      * Setup any quirks that might necessary now that we have probed

Modified: stable/8/sys/dev/acpica/acpi_dock.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_dock.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/acpica/acpi_dock.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -188,12 +188,12 @@ acpi_dock_attach_later(void *context)
 
 	dev = (device_t)context;
 
-	newbus_xlock();
 	if (!device_is_enabled(dev))
 		device_enable(dev);
 
+	mtx_lock(&Giant);
 	device_probe_and_attach(dev);
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 }
 
 static ACPI_STATUS
@@ -299,11 +299,11 @@ acpi_dock_eject_child(ACPI_HANDLE handle
 	    "ejecting device for %s\n", acpi_name(handle));
 
 	dev = acpi_get_device(handle);
-	newbus_xlock();
 	if (dev != NULL && device_is_attached(dev)) {
+		mtx_lock(&Giant);
 		device_detach(dev);
+		mtx_unlock(&Giant);
 	}
-	newbus_xunlock();
 
 	acpi_SetInteger(handle, "_EJ0", 0);
 out:

Modified: stable/8/sys/dev/acpica/acpi_thermal.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_thermal.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/acpica/acpi_thermal.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -936,8 +936,6 @@ acpi_tz_thread(void *arg)
     sc = NULL;
 
     for (;;) {
-	newbus_slock();
-
 	/* If the number of devices has changed, re-evaluate. */
 	if (devclass_get_count(acpi_tz_devclass) != devcount) {
 	    if (devs != NULL) {
@@ -950,7 +948,6 @@ acpi_tz_thread(void *arg)
 	    for (i = 0; i < devcount; i++)
 		sc[i] = device_get_softc(devs[i]);
 	}
-	newbus_sunlock();
 
 	/* Check for temperature events and act on them. */
 	for (i = 0; i < devcount; i++) {

Modified: stable/8/sys/dev/adb/adb_bus.c
==============================================================================
--- stable/8/sys/dev/adb/adb_bus.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/adb/adb_bus.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -113,7 +113,6 @@ adb_bus_enumerate(void *xdev)
 	uint8_t i, next_free;
 	uint16_t r3;
 
-	newbus_xlock();
 	sc->sc_dev = dev;
 	sc->parent = device_get_parent(dev);
 
@@ -188,7 +187,6 @@ adb_bus_enumerate(void *xdev)
 	}
 
 	bus_generic_attach(dev);
-	newbus_xunlock();
 
 	config_intrhook_disestablish(&sc->enum_hook);
 }

Modified: stable/8/sys/dev/amdtemp/amdtemp.c
==============================================================================
--- stable/8/sys/dev/amdtemp/amdtemp.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/amdtemp/amdtemp.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -269,7 +269,6 @@ amdtemp_intrhook(void *arg)
 	/*
 	 * dev.cpu.N.temperature.
 	 */
-	newbus_xlock();
 	nexus = device_find_child(root_bus, "nexus", 0);
 	acpi = device_find_child(nexus, "acpi", 0);
 
@@ -286,7 +285,6 @@ amdtemp_intrhook(void *arg)
 			    "Max of sensor 0 / 1");
 		}
 	}
-	newbus_xunlock();
 	config_intrhook_disestablish(&sc->sc_ich);
 }
 

Modified: stable/8/sys/dev/amr/amr.c
==============================================================================
--- stable/8/sys/dev/amr/amr.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/amr/amr.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -90,10 +90,6 @@ __FBSDID("$FreeBSD$");
 
 SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters");
 
-/*
- * In order to get rid of Giant, amr_state should be protected by
- * a proper softc lock for the cdev operations.
- */
 static d_open_t         amr_open;
 static d_close_t        amr_close;
 static d_ioctl_t        amr_ioctl;
@@ -316,11 +312,9 @@ amr_startup(void *arg)
 	config_intrhook_disestablish(&sc->amr_ich);
     sc->amr_ich.ich_func = NULL;
 
-    newbus_xlock();
     /* get up-to-date drive information */
     if (amr_query_controller(sc)) {
 	device_printf(sc->amr_dev, "can't scan controller for drives\n");
-	newbus_xunlock();
 	return;
     }
 
@@ -353,7 +347,6 @@ amr_startup(void *arg)
 
     /* interrupts will be enabled before we do anything more */
     sc->amr_state |= AMR_STATE_INTEN;
-    newbus_xunlock();
 
     /*
      * Start the timeout routine.
@@ -441,11 +434,7 @@ static int
 amr_open(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
     int			unit = dev2unit(dev);
-    struct amr_softc	*sc;
-
-    newbus_slock();
-    sc = devclass_get_softc(devclass_find("amr"), unit);
-    newbus_sunlock();
+    struct amr_softc	*sc = devclass_get_softc(devclass_find("amr"), unit);
 
     debug_called(1);
 
@@ -501,11 +490,7 @@ static int
 amr_close(struct cdev *dev, int flags, int fmt, struct thread *td)
 {
     int			unit = dev2unit(dev);
-    struct amr_softc	*sc;
-
-    newbus_slock();
-    sc = devclass_get_softc(devclass_find("amr"), unit);
-    newbus_sunlock();
+    struct amr_softc	*sc = devclass_get_softc(devclass_find("amr"), unit);
 
     debug_called(1);
 
@@ -522,7 +507,6 @@ amr_rescan_drives(struct cdev *dev)
     struct amr_softc	*sc = (struct amr_softc *)dev->si_drv1;
     int			i, error = 0;
 
-    newbus_xlock();
     sc->amr_state |= AMR_STATE_REMAP_LD;
     while (sc->amr_busyslots) {
 	device_printf(sc->amr_dev, "idle controller\n");
@@ -546,7 +530,6 @@ amr_rescan_drives(struct cdev *dev)
 	     sc->amr_drive[i].al_disk = 0;
 	}
     }
-    newbus_xunlock();
 
 shutdown_out:
     amr_startup(sc);
@@ -822,9 +805,7 @@ amr_ioctl(struct cdev *dev, u_long cmd, 
 	    struct amr_linux_ioctl	ali;
 	    int				adapter, error;
 
-	    newbus_slock();
 	    devclass = devclass_find("amr");
-	    newbus_sunlock();
 	    if (devclass == NULL)
 		return (ENOENT);
 

Modified: stable/8/sys/dev/ata/ata-all.c
==============================================================================
--- stable/8/sys/dev/ata/ata-all.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/ata/ata-all.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 static  d_ioctl_t       ata_ioctl;
 static struct cdevsw ata_cdevsw = {
 	.d_version =    D_VERSION,
+	.d_flags =      D_NEEDGIANT, /* we need this as newbus isn't mpsafe */
 	.d_ioctl =      ata_ioctl,
 	.d_name =       "ata",
 };
@@ -203,9 +204,7 @@ ata_conn_event(void *context, int dummy)
 {
     device_t dev = (device_t)context;
 
-    newbus_xlock();
     ata_reinit(dev);
-    newbus_xunlock();
 }
 
 int
@@ -247,6 +246,7 @@ ata_reinit(device_t dev)
 
     /* reinit the children and delete any that fails */
     if (!device_get_children(dev, &children, &nchildren)) {
+	mtx_lock(&Giant);       /* newbus suckage it needs Giant */
 	for (i = 0; i < nchildren; i++) {
 	    /* did any children go missing ? */
 	    if (children[i] && device_is_attached(children[i]) &&
@@ -269,6 +269,7 @@ ata_reinit(device_t dev)
 	    }
 	}
 	free(children, M_TEMP);
+	mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
     }
 
     /* if we still have a good request put it on the queue again */
@@ -394,7 +395,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
     int *value = (int *)data;
     int i, nchildren, error = ENOTTY;
 
-    newbus_xlock();
     switch (cmd) {
     case IOCATAGMAXCHANNEL:
 	/* In case we have channel 0..n this will return n+1. */
@@ -405,40 +405,32 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
     case IOCATAREINIT:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = ata_reinit(device);
 	break;
 
     case IOCATAATTACH:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = DEVICE_ATTACH(device);
 	break;
 
     case IOCATADETACH:
 	if (*value >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, *value)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	error = DEVICE_DETACH(device);
 	break;
 
     case IOCATADEVICES:
 	if (devices->channel >= devclass_get_maxunit(ata_devclass) ||
 	    !(device = devclass_get_device(ata_devclass, devices->channel)) ||
-	    !device_is_attached(device)) {
-            newbus_xunlock();
+	    !device_is_attached(device))
 	    return ENXIO;
-	}
 	bzero(devices->name[0], 32);
 	bzero(&devices->params[0], sizeof(struct ata_params));
 	bzero(devices->name[1], 32);
@@ -473,7 +465,6 @@ ata_ioctl(struct cdev *dev, u_long cmd, 
 	if (ata_raid_ioctl_func)
 	    error = ata_raid_ioctl_func(cmd, data);
     }
-    newbus_xunlock();
     return error;
 }
 
@@ -581,7 +572,7 @@ ata_boot_attach(void)
     struct ata_channel *ch;
     int ctlr;
 
-    newbus_xlock();
+    mtx_lock(&Giant);       /* newbus suckage it needs Giant */
 
     /* kick of probe and attach on all channels */
     for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) {
@@ -596,7 +587,8 @@ ata_boot_attach(void)
 	free(ata_delayed_attach, M_TEMP);
 	ata_delayed_attach = NULL;
     }
-    newbus_xunlock();
+
+    mtx_unlock(&Giant);     /* newbus suckage dealt with, release Giant */
 }
 
 
@@ -725,6 +717,7 @@ ata_identify(device_t dev)
     if (bootverbose)
 	device_printf(dev, "Identifying devices: %08x\n", ch->devices);
 
+    mtx_lock(&Giant);
     /* Skip existing devices. */
     if (!device_get_children(dev, &children, &nchildren)) {
 	for (i = 0; i < nchildren; i++) {
@@ -736,8 +729,10 @@ ata_identify(device_t dev)
     /* Create new devices. */
     if (bootverbose)
 	device_printf(dev, "New devices: %08x\n", n);
-    if (n == 0)
+    if (n == 0) {
+	mtx_unlock(&Giant);
 	return (0);
+    }
     for (i = 0; i < ATA_PM; ++i) {
 	if (n & (((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << i))) {
 	    int unit = -1;
@@ -780,6 +775,7 @@ ata_identify(device_t dev)
     }
     bus_generic_probe(dev);
     bus_generic_attach(dev);
+    mtx_unlock(&Giant);
     return 0;
 }
 

Modified: stable/8/sys/dev/atkbdc/psm.c
==============================================================================
--- stable/8/sys/dev/atkbdc/psm.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/atkbdc/psm.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -1488,9 +1488,7 @@ psmopen(struct cdev *dev, int flag, int 
 	if (sc->state & PSM_OPEN)
 		return (EBUSY);
 
-	newbus_xlock();
 	device_busy(devclass_get_device(psm_devclass, unit));
-	newbus_xunlock();
 
 	/* Initialize state */
 	sc->mode.level = sc->dflt_mode.level;
@@ -1645,9 +1643,7 @@ psmclose(struct cdev *dev, int flag, int
 	/* close is almost always successful */
 	sc->state &= ~PSM_OPEN;
 	kbdc_lock(sc->kbdc, FALSE);
-	newbus_xlock();
 	device_unbusy(devclass_get_device(psm_devclass, unit));
-	newbus_xunlock();
 	return (0);
 }
 

Modified: stable/8/sys/dev/bktr/bktr_os.c
==============================================================================
--- stable/8/sys/dev/bktr/bktr_os.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/bktr/bktr_os.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -597,9 +597,7 @@ bktr_open( struct cdev *dev, int flags, 
 		return( ENXIO );	
 
 	/* Record that the device is now busy */
-	newbus_xlock();
 	device_busy(devclass_get_device(bktr_devclass, unit)); 
-	newbus_xunlock();
 
 
 	if (bt848_card != -1) {
@@ -670,11 +668,8 @@ bktr_open( struct cdev *dev, int flags, 
 	}
 
 	/* If there was an error opening the device, undo the busy status */
-	if (result != 0) {
-		newbus_xlock();
+	if (result != 0)
 		device_unbusy(devclass_get_device(bktr_devclass, unit)); 
-		newbus_xunlock();
-	}
 	return( result );
 }
 
@@ -694,7 +689,6 @@ bktr_close( struct cdev *dev, int flags,
 	/* Get the device data */
 	bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit);
 	if (bktr == NULL) {
-
 		/* the device is no longer valid/functioning */
 		return (ENXIO);
 	}
@@ -711,11 +705,10 @@ bktr_close( struct cdev *dev, int flags,
 		break;
 	default:
 		return (ENXIO);
+		break;
 	}
 
-	newbus_xlock();
 	device_unbusy(devclass_get_device(bktr_devclass, unit)); 
-	newbus_xunlock();
 	return( result );
 }
 

Modified: stable/8/sys/dev/drm/drm_drv.c
==============================================================================
--- stable/8/sys/dev/drm/drm_drv.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/drm/drm_drv.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -614,13 +614,11 @@ int drm_open(struct cdev *kdev, int flag
 
 	if (!retcode) {
 		atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
-		newbus_xlock();
 		DRM_LOCK();
 		device_busy(dev->device);
 		if (!dev->open_count++)
 			retcode = drm_firstopen(dev);
 		DRM_UNLOCK();
-		newbus_xunlock();
 	}
 
 	return retcode;
@@ -634,11 +632,6 @@ void drm_close(void *data)
 
 	DRM_DEBUG("open_count = %d\n", dev->open_count);
 
-	/*
-	 * We require to lock newbus here for handling device_unbusy() and
-	 * avoid a LOR with DRM_LOCK.
-	 */
-	newbus_xlock();
 	DRM_LOCK();
 
 	if (dev->driver->preclose != NULL)
@@ -715,7 +708,6 @@ void drm_close(void *data)
 	}
 
 	DRM_UNLOCK();
-	newbus_xunlock();
 }
 
 /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm.

Modified: stable/8/sys/dev/ips/ips_pci.c
==============================================================================
--- stable/8/sys/dev/ips/ips_pci.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/ips/ips_pci.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -173,12 +173,10 @@ ips_intrhook(void *arg)
 	struct ips_softc *sc = (struct ips_softc *)arg;
 
 	config_intrhook_disestablish(&sc->ips_ich);
-	newbus_xlock();
 	if (ips_adapter_init(sc))
 		ips_pci_free(sc);
 	else
 		sc->configured = 1;
-	newbus_xunlock();
 }
 
 static int ips_pci_free(ips_softc_t *sc)

Modified: stable/8/sys/dev/mfi/mfi.c
==============================================================================
--- stable/8/sys/dev/mfi/mfi.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/mfi/mfi.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -1327,11 +1327,11 @@ mfi_add_ld_complete(struct mfi_command *
 	mfi_release_command(cm);
 
 	mtx_unlock(&sc->mfi_io_lock);
-	newbus_xlock();
+	mtx_lock(&Giant);
 	if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) {
 		device_printf(sc->mfi_dev, "Failed to add logical disk\n");
 		free(ld_info, M_MFIBUF);
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 		mtx_lock(&sc->mfi_io_lock);
 		return;
 	}
@@ -1339,7 +1339,7 @@ mfi_add_ld_complete(struct mfi_command *
 	device_set_ivars(child, ld_info);
 	device_set_desc(child, "MFI Logical Disk");
 	bus_generic_attach(sc->mfi_dev);
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	mtx_lock(&sc->mfi_io_lock);
 }
 
@@ -1805,9 +1805,9 @@ mfi_check_command_post(struct mfi_softc 
 		KASSERT(ld != NULL, ("volume dissappeared"));
 		if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
 			mtx_unlock(&sc->mfi_io_lock);
-			newbus_xlock();
+			mtx_lock(&Giant);
 			device_delete_child(sc->mfi_dev, ld->ld_dev);
-			newbus_xunlock();
+			mtx_unlock(&Giant);
 			mtx_lock(&sc->mfi_io_lock);
 		} else
 			mfi_disk_enable(ld);
@@ -1815,11 +1815,11 @@ mfi_check_command_post(struct mfi_softc 
 	case MFI_DCMD_CFG_CLEAR:
 		if (cm->cm_frame->header.cmd_status == MFI_STAT_OK) {
 			mtx_unlock(&sc->mfi_io_lock);
-			newbus_xlock();
+			mtx_lock(&Giant);
 			TAILQ_FOREACH_SAFE(ld, &sc->mfi_ld_tqh, ld_link, ldn) {
 				device_delete_child(sc->mfi_dev, ld->ld_dev);
 			}
-			newbus_xunlock();
+			mtx_unlock(&Giant);
 			mtx_lock(&sc->mfi_io_lock);
 		} else {
 			TAILQ_FOREACH(ld, &sc->mfi_ld_tqh, ld_link)
@@ -1985,9 +1985,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, 
 
 		adapter = ioc->mfi_adapter_no;
 		if (device_get_unit(sc->mfi_dev) == 0 && adapter != 0) {
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			sc = devclass_get_softc(devclass, adapter);
 		}
 		mtx_lock(&sc->mfi_io_lock);
@@ -2175,9 +2173,7 @@ out:
 			struct mfi_linux_ioc_packet l_ioc;
 			int adapter;
 
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			if (devclass == NULL)
 				return (ENOENT);
 
@@ -2198,9 +2194,7 @@ out:
 			struct mfi_linux_ioc_aen l_aen;
 			int adapter;
 
-			newbus_slock();
 			devclass = devclass_find("mfi");
-			newbus_sunlock();
 			if (devclass == NULL)
 				return (ENOENT);
 

Modified: stable/8/sys/dev/mlx/mlx.c
==============================================================================
--- stable/8/sys/dev/mlx/mlx.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/mlx/mlx.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -772,9 +772,7 @@ mlx_ioctl(struct cdev *dev, u_long cmd, 
 	 * Scan the controller to see whether new drives have appeared.
 	 */
     case MLX_RESCAN_DRIVES:
-	newbus_xlock();
 	mlx_startup(sc);
-	newbus_xunlock();
 	return(0);
 
 	/*

Modified: stable/8/sys/dev/mmc/mmc.c
==============================================================================
--- stable/8/sys/dev/mmc/mmc.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/mmc/mmc.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -1496,9 +1496,7 @@ mmc_delayed_attach(void *xsc)
 {
 	struct mmc_softc *sc = xsc;
 	
-	newbus_xlock();
 	mmc_scan(sc);
-	newbus_xunlock();
 	config_intrhook_disestablish(&sc->config_intrhook);
 }
 

Modified: stable/8/sys/dev/pccbb/pccbb.c
==============================================================================
--- stable/8/sys/dev/pccbb/pccbb.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/pccbb/pccbb.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -464,7 +464,14 @@ cbb_event_thread(void *arg)
 	sc->flags |= CBB_KTHREAD_RUNNING;
 	while ((sc->flags & CBB_KTHREAD_DONE) == 0) {
 		mtx_unlock(&sc->mtx);
-		newbus_xlock();
+		/*
+		 * We take out Giant here because we need it deep,
+		 * down in the bowels of the vm system for mapping the
+		 * memory we need to read the CIS.  In addition, since
+		 * we are adding/deleting devices from the dev tree,
+		 * and that code isn't MP safe, we have to hold Giant.
+		 */
+		mtx_lock(&Giant);
 		status = cbb_get(sc, CBB_SOCKET_STATE);
 		DPRINTF(("Status is 0x%x\n", status));
 		if (!CBB_CARD_PRESENT(status)) {
@@ -490,7 +497,7 @@ cbb_event_thread(void *arg)
 			not_a_card = 0;		/* We know card type */
 			cbb_insert(sc);
 		}
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 
 		/*
 		 * First time through we need to tell mountroot that we're

Modified: stable/8/sys/dev/pst/pst-iop.c
==============================================================================
--- stable/8/sys/dev/pst/pst-iop.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/pst/pst-iop.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -152,9 +152,7 @@ iop_attach(void *arg)
 	    break;
 
 	case I2O_CLASS_RANDOM_BLOCK_STORAGE:
-	    newbus_xlock();
 	    pst_add_raid(sc, &sc->lct[i]);
-	    newbus_xunlock();
 	    break;
 	}
     }

Modified: stable/8/sys/dev/rp/rp.c
==============================================================================
--- stable/8/sys/dev/rp/rp.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/rp/rp.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -903,9 +903,7 @@ rpopen(struct tty *tp)
 		rp_callout_handle = timeout(rp_do_poll, 
 					    (void *)NULL, POLL_INTERVAL);
 
-	newbus_xlock();
 	device_busy(rp->rp_ctlp->dev);
-	newbus_xunlock();
 	return(0);
 }
 
@@ -916,9 +914,7 @@ rpclose(struct tty *tp)
 
 	rp = tty_softc(tp);
 	rphardclose(tp);
-	newbus_xlock();
 	device_unbusy(rp->rp_ctlp->dev);
-	newbus_xunlock();
 }
 
 static void

Modified: stable/8/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- stable/8/sys/dev/sound/pci/hda/hdac.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/sound/pci/hda/hdac.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -7435,7 +7435,6 @@ hdac_attach2(void *arg)
 		    quirks_on, quirks_off);
 	);
 
-	newbus_xlock();
 	hdac_lock(sc);
 
 	/* Remove ourselves from the config hooks */
@@ -7675,7 +7674,6 @@ hdac_attach2(void *arg)
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), OID_AUTO,
 	    "pindump", CTLTYPE_INT | CTLFLAG_RW, sc->dev, sizeof(sc->dev),
 	    sysctl_hdac_pindump, "I", "Dump pin states/data");
-	newbus_xunlock();
 }
 
 /****************************************************************************

Modified: stable/8/sys/dev/twe/twe.c
==============================================================================
--- stable/8/sys/dev/twe/twe.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/twe/twe.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -294,10 +294,8 @@ twe_init(struct twe_softc *sc)
     /*
      * Scan for drives
      */
-    newbus_xlock();
     for (i = 0; i < TWE_MAX_UNITS; i++)
 	twe_add_unit(sc, i);
-    newbus_xunlock();
 
     /*
      * Initialise connection with controller.
@@ -623,15 +621,11 @@ twe_ioctl(struct twe_softc *sc, int ioct
 	break;
 
     case TWEIO_ADD_UNIT:
-	newbus_xlock();
 	error = twe_add_unit(sc, td->td_unit);
-	newbus_xunlock();
 	break;
 
     case TWEIO_DEL_UNIT:
-	newbus_xlock();
 	error = twe_del_unit(sc, td->td_unit);
-	newbus_xunlock();
 	break;
 
 	/* XXX implement ATA PASSTHROUGH */

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/usb/controller/usb_controller.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -143,7 +143,9 @@ usb_attach(device_t dev)
 	}
 
 	if (usb_post_init_called) {
+		mtx_lock(&Giant);
 		usb_attach_sub(dev, bus);
+		mtx_unlock(&Giant);
 		usb_needs_explore(bus, 1);
 	}
 	return (0);			/* return success */
@@ -226,13 +228,20 @@ usb_bus_explore(struct usb_proc_msg *pm)
 		}
 		USB_BUS_UNLOCK(bus);
 
+		mtx_lock(&Giant);
+
 		/*
 		 * First update the USB power state!
 		 */
 		usb_bus_powerd(bus);
-
-		 /* Explore the Root USB HUB. */
+		/*
+		 * Explore the Root USB HUB. This call can sleep,
+		 * exiting Giant, which is actually Giant.
+		 */
 		(udev->hub->explore) (udev);
+
+		mtx_unlock(&Giant);
+
 		USB_BUS_LOCK(bus);
 	}
 	if (bus->bus_roothold != NULL) {
@@ -260,7 +269,7 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	device_set_softc(dev, NULL);
 	USB_BUS_UNLOCK(bus);
 
-	newbus_xlock();
+	mtx_lock(&Giant);
 
 	/* detach children first */
 	bus_generic_detach(dev);
@@ -272,7 +281,7 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	usb_free_device(udev,
 	    USB_UNCFG_FLAG_FREE_EP0);
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 	/* clear bdev variable last */
 	bus->bdev = NULL;
@@ -341,7 +350,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
 	}
 
 	USB_BUS_UNLOCK(bus);
-	newbus_xlock();
+	mtx_lock(&Giant);		/* XXX not required by USB */
 
 	/* default power_mask value */
 	bus->hw_power_state =
@@ -374,7 +383,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
 		err = USB_ERR_NOMEM;
 	}
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 
 	if (err) {
@@ -463,7 +472,7 @@ usb_post_init(void *arg)
 	int max;
 	int n;
 
-	newbus_xlock();
+	mtx_lock(&Giant);
 
 	usb_devclass_ptr = devclass_find("usbus");
 
@@ -474,8 +483,11 @@ usb_post_init(void *arg)
 			dev = devclass_get_device(dc, n);
 			if (dev && device_is_attached(dev)) {
 				bus = device_get_ivars(dev);
-				if (bus)
+				if (bus) {
+					mtx_lock(&Giant);
 					usb_attach_sub(dev, bus);
+					mtx_unlock(&Giant);
+				}
 			}
 		}
 	} else {
@@ -487,7 +499,7 @@ usb_post_init(void *arg)
 
 	usb_needs_explore_all();
 
-	newbus_xunlock();
+	mtx_unlock(&Giant);
 }
 
 SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL);

Modified: stable/8/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/8/sys/dev/usb/input/ukbd.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/usb/input/ukbd.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -745,7 +745,7 @@ ukbd_attach(device_t dev)
 	uint16_t n;
 	uint16_t hid_len;
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
 
 	kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0);
 
@@ -854,6 +854,9 @@ ukbd_attach(device_t dev)
 	if (bootverbose) {
 		genkbd_diag(kbd, bootverbose);
 	}
+	/* lock keyboard mutex */
+
+	mtx_lock(&Giant);
 
 	/* start the keyboard */
 
@@ -876,7 +879,7 @@ ukbd_detach(device_t dev)
 	struct ukbd_softc *sc = device_get_softc(dev);
 	int error;
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
 
 	DPRINTF("\n");
 
@@ -913,8 +916,6 @@ ukbd_detach(device_t dev)
 
 	usb_callout_drain(&sc->sc_callout);
 
-	mtx_unlock(&Giant);
-
 	DPRINTF("%s: disconnected\n",
 	    device_get_nameunit(dev));
 
@@ -926,9 +927,9 @@ ukbd_resume(device_t dev)
 {
 	struct ukbd_softc *sc = device_get_softc(dev);
 
-	mtx_lock(&Giant);
+	mtx_assert(&Giant, MA_OWNED);
+
 	ukbd_clear_state(&sc->sc_kbd);
-	mtx_unlock(&Giant);
 
 	return (0);
 }

Modified: stable/8/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- stable/8/sys/dev/usb/net/usb_ethernet.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/usb/net/usb_ethernet.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -221,10 +221,10 @@ ue_attach_post_task(struct usb_proc_msg 
 
 	if (ue->ue_methods->ue_mii_upd != NULL && 
 	    ue->ue_methods->ue_mii_sts != NULL) {
-		newbus_xlock();
+		mtx_lock(&Giant);	/* device_xxx() depends on this */
 		error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus,
 		    ue_ifmedia_upd, ue->ue_methods->ue_mii_sts);
-		newbus_xunlock();
+		mtx_unlock(&Giant);
 		if (error) {
 			device_printf(ue->ue_dev, "MII without any PHY\n");
 			goto error;
@@ -279,12 +279,9 @@ uether_ifdetach(struct usb_ether *ue)
 
 		/* detach miibus */
 		if (ue->ue_miibus != NULL) {
-
-			/*
-			 * It is up to the callers to provide the correct
-			 * newbus locking.
-			 */
+			mtx_lock(&Giant);	/* device_xxx() depends on this */
 			device_delete_child(ue->ue_dev, ue->ue_miibus);
+			mtx_unlock(&Giant);
 		}
 
 		/* detach ethernet */

Modified: stable/8/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- stable/8/sys/dev/usb/usb_compat_linux.c	Thu Aug 20 19:23:58 2009	(r196404)
+++ stable/8/sys/dev/usb/usb_compat_linux.c	Thu Aug 20 20:23:28 2009	(r196405)
@@ -215,12 +215,14 @@ usb_linux_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
+	mtx_lock(&Giant);
 	LIST_FOREACH(udrv, &usb_linux_driver_list, linux_driver_list) {
 		if (usb_linux_lookup_id(udrv->id_table, uaa)) {
 			err = 0;
 			break;
 		}
 	}
+	mtx_unlock(&Giant);
 
 	return (err);
 }
@@ -237,7 +239,9 @@ usb_linux_get_usb_driver(struct usb_linu
 {
 	struct usb_driver *udrv;
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 20:53:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 197B8106568C;
	Thu, 20 Aug 2009 20:53:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E01BB8FC16;
	Thu, 20 Aug 2009 20:53:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KKraRr099110;
	Thu, 20 Aug 2009 20:53:36 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KKraKs099106;
	Thu, 20 Aug 2009 20:53:36 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908202053.n7KKraKs099106@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 20 Aug 2009 20:53:36 +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: r196406 - in stable/8: share/man/man9 sys
	sys/amd64/include/xen sys/cddl/contrib/opensolaris
	sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci
	sys/kern sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 20:53:37 -0000

Author: jhb
Date: Thu Aug 20 20:53:36 2009
New Revision: 196406
URL: http://svn.freebsd.org/changeset/base/196406

Log:
  MFC 196404:
  Change the 'resid' parameter to sglist_consume_uio() from an int to a
  size_t to match the recent type change of the uio_resid member of struct
  uio.
  
  Approved by:	re (kib)

Modified:
  stable/8/share/man/man9/   (props changed)
  stable/8/share/man/man9/sglist.9
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/kern/subr_sglist.c
  stable/8/sys/sys/sglist.h

Modified: stable/8/share/man/man9/sglist.9
==============================================================================
--- stable/8/share/man/man9/sglist.9	Thu Aug 20 20:23:28 2009	(r196405)
+++ stable/8/share/man/man9/sglist.9	Thu Aug 20 20:53:36 2009	(r196406)
@@ -70,7 +70,7 @@
 .Ft struct sglist *
 .Fn sglist_clone "struct sglist *sg" "int mflags"
 .Ft int
-.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "int resid"
+.Fn sglist_consume_uio "struct sglist *sg" "struct uio *uio" "size_t resid"
 .Ft int
 .Fn sglist_count "void *buf" "size_t len"
 .Ft void

Modified: stable/8/sys/kern/subr_sglist.c
==============================================================================
--- stable/8/sys/kern/subr_sglist.c	Thu Aug 20 20:23:28 2009	(r196405)
+++ stable/8/sys/kern/subr_sglist.c	Thu Aug 20 20:53:36 2009	(r196406)
@@ -315,7 +315,7 @@ sglist_append_uio(struct sglist *sg, str
  * segments, then only the amount that fits is appended.
  */
 int
-sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid)
+sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid)
 {
 	struct iovec *iov;
 	size_t done;

Modified: stable/8/sys/sys/sglist.h
==============================================================================
--- stable/8/sys/sys/sglist.h	Thu Aug 20 20:23:28 2009	(r196405)
+++ stable/8/sys/sys/sglist.h	Thu Aug 20 20:53:36 2009	(r196406)
@@ -91,7 +91,7 @@ int	sglist_append_user(struct sglist *sg
 	    struct thread *td);
 struct sglist *sglist_build(void *buf, size_t len, int mflags);
 struct sglist *sglist_clone(struct sglist *sg, int mflags);
-int	sglist_consume_uio(struct sglist *sg, struct uio *uio, int resid);
+int	sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid);
 int	sglist_count(void *buf, size_t len);
 void	sglist_free(struct sglist *sg);
 int	sglist_join(struct sglist *first, struct sglist *second);

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 21:14:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21CB61065690;
	Thu, 20 Aug 2009 21:14:53 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0EB6E8FC3D;
	Thu, 20 Aug 2009 21:14:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KLEqF6099613;
	Thu, 20 Aug 2009 21:14:52 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KLEqVU099611;
	Thu, 20 Aug 2009 21:14:52 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908202114.n7KLEqVU099611@svn.freebsd.org>
From: Robert Watson 
Date: Thu, 20 Aug 2009 21:14:52 +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: r196407 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 21:14:53 -0000

Author: rwatson
Date: Thu Aug 20 21:14:52 2009
New Revision: 196407
URL: http://svn.freebsd.org/changeset/base/196407

Log:
  Merge r196263 from head to stable/8:
  
    Remove unused if_rawoutput() macro; it has been unused since at least
    FreeBSD 2.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/net/if_var.h

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h	Thu Aug 20 20:53:36 2009	(r196406)
+++ stable/8/sys/net/if_var.h	Thu Aug 20 21:14:52 2009	(r196407)
@@ -235,7 +235,6 @@ typedef void if_init_f_t(void *);
 #define	if_iqdrops	if_data.ifi_iqdrops
 #define	if_noproto	if_data.ifi_noproto
 #define	if_lastchange	if_data.ifi_lastchange
-#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)NULL)
 
 /* for compatibility with other BSDs */
 #define	if_addrlist	if_addrhead

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 21:29:49 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 990E8106568E;
	Thu, 20 Aug 2009 21:29:49 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 84F908FC57;
	Thu, 20 Aug 2009 21:29:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KLTnmD099973;
	Thu, 20 Aug 2009 21:29:49 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KLTnCi099970;
	Thu, 20 Aug 2009 21:29:49 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908202129.n7KLTnCi099970@svn.freebsd.org>
From: Robert Watson 
Date: Thu, 20 Aug 2009 21:29:49 +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: r196408 - in stable/8: share/man/man4 sys
	sys/amd64/include/xen sys/cddl/contrib/opensolaris
	sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 21:29:49 -0000

Author: rwatson
Date: Thu Aug 20 21:29:49 2009
New Revision: 196408
URL: http://svn.freebsd.org/changeset/base/196408

Log:
  Merge r196267 from head to stable/8:
  
    Rather than fix questionable ifnet list locking in the implementation of
    the kern.polling.enable sysctl, remove the sysctl.  It has been deprecated
    since FreeBSD 6 in favour of per-ifnet polling flags.
  
    Reviewed by:	luigi
  
  Approved by:	re (kib)

Modified:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/polling.4
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_poll.c

Modified: stable/8/share/man/man4/polling.4
==============================================================================
--- stable/8/share/man/man4/polling.4	Thu Aug 20 21:14:52 2009	(r196407)
+++ stable/8/share/man/man4/polling.4	Thu Aug 20 21:29:49 2009	(r196408)
@@ -87,6 +87,16 @@ feature.
 It is turned on and off with help of
 .Xr ifconfig 8
 command.
+.Pp
+The historic
+.Va kern.polling.enable ,
+which enabled polling for all interfaces, can be replaced with the following
+code:
+.Bd -literal
+for i in `ifconfig -l` ;
+  do ifconfig $i polling; # use -polling to disable
+done
+.Ed
 .Ss MIB Variables
 The operation of
 .Nm
@@ -156,15 +166,6 @@ Default is 20.
 How many active devices have registered for
 .Nm .
 .Pp
-.It Va kern.polling.enable
-Legacy MIB, that was used to enable or disable polling globally.
-Currently if set to 1,
-.Nm
-is enabled on all capable interfaces.
-If set to 0,
-.Nm
-is disabled on all interfaces.
-.Pp
 .It Va kern.polling.short_ticks
 .It Va kern.polling.lost_polls
 .It Va kern.polling.pending_polls

Modified: stable/8/sys/kern/kern_poll.c
==============================================================================
--- stable/8/sys/kern/kern_poll.c	Thu Aug 20 21:14:52 2009	(r196407)
+++ stable/8/sys/kern/kern_poll.c	Thu Aug 20 21:29:49 2009	(r196408)
@@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 			/* for NETISR_POLL		*/
 #include 
 
-static int poll_switch(SYSCTL_HANDLER_ARGS);
-
 void hardclock_device_poll(void);	/* hook from hardclock		*/
 
 static struct mtx	poll_mtx;
@@ -230,10 +228,6 @@ static uint32_t poll_handlers; /* next f
 SYSCTL_UINT(_kern_polling, OID_AUTO, handlers, CTLFLAG_RD,
 	&poll_handlers, 0, "Number of registered poll handlers");
 
-static int polling = 0;
-SYSCTL_PROC(_kern_polling, OID_AUTO, enable, CTLTYPE_UINT | CTLFLAG_RW,
-	0, sizeof(int), poll_switch, "I", "Switch polling for all interfaces");
-
 static uint32_t phase;
 SYSCTL_UINT(_kern_polling, OID_AUTO, phase, CTLFLAG_RD,
 	&phase, 0, "Polling phase");
@@ -538,49 +532,6 @@ ether_poll_deregister(struct ifnet *ifp)
 	return (0);
 }
 
-/*
- * Legacy interface for turning polling on all interfaces at one time.
- */
-static int
-poll_switch(SYSCTL_HANDLER_ARGS)
-{
-	struct ifnet *ifp;
-	int error;
-	int val = polling;
-
-	error = sysctl_handle_int(oidp, &val, 0, req);
-	if (error || !req->newptr )
-		return (error);
-
-	if (val == polling)
-		return (0);
-
-	if (val < 0 || val > 1)
-		return (EINVAL);
-
-	polling = val;
-
-	IFNET_RLOCK();
-	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
-		if (ifp->if_capabilities & IFCAP_POLLING) {
-			struct ifreq ifr;
-
-			if (val == 1)
-				ifr.ifr_reqcap =
-				    ifp->if_capenable | IFCAP_POLLING;
-			else
-				ifr.ifr_reqcap =
-				    ifp->if_capenable & ~IFCAP_POLLING;
-			(void) (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t)&ifr);
-		}
-	}
-	IFNET_RUNLOCK();
-
-	log(LOG_ERR, "kern.polling.enable is deprecated. Use ifconfig(8)");
-
-	return (0);
-}
-
 static void
 poll_idle(void)
 {

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 22:39:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5775A106568E;
	Thu, 20 Aug 2009 22:39:20 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 452C18FC6F;
	Thu, 20 Aug 2009 22:39:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KMdKeB001644;
	Thu, 20 Aug 2009 22:39:20 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KMdKhP001640;
	Thu, 20 Aug 2009 22:39:20 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908202239.n7KMdKhP001640@svn.freebsd.org>
From: Marko Zec 
Date: Thu, 20 Aug 2009 22:39:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196409 - head/tools/tools/vimage
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 22:39:20 -0000

Author: zec
Date: Thu Aug 20 22:39:20 2009
New Revision: 196409
URL: http://svn.freebsd.org/changeset/base/196409

Log:
  vimage(8) is a legacy CLI interface for managing jails associated with
  network stack instances, which is provided for compatibility with
  older applications.  This change brings it back to life in a followup
  to the initial conversion of vimage to use the new jail(4)
  userland-kernel API:
  
  - when creating vimages via "vimage -c", by default turn on a few
  options expected by legacy applications, such as allow operations on
  raw sockets, FS mounts etc, and allow jail-related parameters to be
  optionally configured.
  
  - introduce the "-m" modifier which allows for configuring jail
  parameters of existing vimages / vnet-jails.
  
  - make "vimage name command ..." actually work.
  
  - when reassigning ifnets to vnets using "vimage -i", attempt to rename
  the ifnet as "ethXXX" on arrival in the target vnet.  Several legacy
  applications are known to depend heavily on such behavior.
  
  - vimage -l lists only jails associated with vnets.  The output is
  sorted using vimage / jail names as keys.
  
  - vimage -l by default searches only the current level in the jail
  hierarchy.  Recursive listing can be requested via -r switch.
  
  - vimage -l by default prints only jail names on each line, making
  such output suitable for pipelining to other commands.  More verbose
  output can be obtained via -v switch, and even more jail specific
  information will be displayed if -j switch is turned on.
  
  - there's no need to build vimage as statically linked, so update the
  Makefile accordingly.
  
  - update the vimage.8 man page.
  
  Approved by:	re (rwatson), julian (mentor)
  MFC after:	immediately

Modified:
  head/tools/tools/vimage/Makefile
  head/tools/tools/vimage/vimage.8
  head/tools/tools/vimage/vimage.c

Modified: head/tools/tools/vimage/Makefile
==============================================================================
--- head/tools/tools/vimage/Makefile	Thu Aug 20 21:29:49 2009	(r196408)
+++ head/tools/tools/vimage/Makefile	Thu Aug 20 22:39:20 2009	(r196409)
@@ -10,6 +10,5 @@ CFLAGS+= -I../../../sys
 MAN=	vimage.8
 
 BINDIR?=	/usr/sbin
-NO_SHARED?=	YES
 
 .include 

Modified: head/tools/tools/vimage/vimage.8
==============================================================================
--- head/tools/tools/vimage/vimage.8	Thu Aug 20 21:29:49 2009	(r196408)
+++ head/tools/tools/vimage/vimage.8	Thu Aug 20 22:39:20 2009	(r196409)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2002, 2003 Marko Zec 
+.\" Copyright (c) 2002, 2003 Marko Zec 
 .\" Copyright (c) 2009 University of Zagreb
 .\" Copyright (c) 2009 FreeBSD Foundation
 .\"
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2009
+.Dd August 25, 2009
 .Dt VIMAGE 8
 .Os
 .Sh NAME
@@ -35,35 +35,46 @@
 .Nd manage virtual network stacks
 .Sh SYNOPSIS
 .Nm
-.Ar vi_name
-.Op command
-.Nm
-.Fl c
-.Ar vi_name
+.Op Fl c | m
+.Ar vname
+.Op Ar param=value ...
 .Nm
 .Fl d
-.Ar vi_name
+.Ar vname
 .Nm
 .Fl l
-.Op Ar vi_name
+.Op Fl rvj
+.Op Ar vname
 .Nm
 .Fl i
-.Ar vi_name interface
+.Ar vname ifname
+.Op Ar newifname
+.Nm
+.Ar vi_name
+.Op command ...
 .Sh DESCRIPTION
+The
 .Nm
-command is an interm user interface for controlling the virtual network
-stacks in FreeBSD.
+utility is an alternative user interface for controlling virtual network
+stacks in FreeBSD, aimed primarily at supporting legacy applications
+which are not yet converted to using
+.Xr jail 8 ,
+.Xr jexec 8 ,
+and
+.Xr jls 8 .
+.
 .Ss Overview
-A virtual image reprepresents an isolated operating environment with its
-own independent network stack instance.  Every process, socket and network
-interface present in the system is always attached to one, and only one,
-virtual image i.e. virtual network stack instance.
-During the system bootup sequence default virtual image is created to
-which all the configured interfaces and user processes are initially
-assigned.
-Assuming that enough system resources and per virtual image privileges
-are provided, the super-user can create and manage a hierarchy of
-subordinated virtual images. The
+A virtual image or vimage is a jail with its own independent network
+stack instance.  Every process, socket and network interface present
+in the system is always attached to one, and only one, virtual network
+stack instance (vnet).
+During system bootup sequence a default vnet
+is created to which all the configured interfaces and user processes
+are initially attached.
+Assuming that enough system resources are
+are available, a user with sufficient privileges can create and manage
+a hierarchy of subordinated virtual images.
+The
 .Nm
 command allows for creation, deletion and monitoring of virtual images,
 as well as for execution of arbitrary processes in a targeted virtual
@@ -71,59 +82,72 @@ image.
 .Ss Invocation
 If invoked with no modifiers, the
 .Nm
-command spawns a new shell process in virtual image 
-.Ar vi_name .
-If provided, the optional arguments following the virtual image name
-.Ar vi_name
-are interpreted as a standard command line issued at a shell,
-otherwise an interactive shell is started in the target virtual image.
+command spawns a new interactive shell in virtual image 
+.Ar vname .
+If optional additional arguments following
+.Ar vname
+are provided, the first of those will be executed in place of the
+interactive shell, and the rest of the arguments will be passed as
+arguments to the executed command.
 .Pp
-The following parameters are available:
+The following modifiers are available:
 .Bl -tag -width indent
 .It Fl c
 Create a new virtual image named
-.So
-.Ar vi_name
-.Sc .
+.Ar vname .
+Additional arguments, if provided, may be used to specify operating
+parameters different from defaults, in format
+.Ar param=value .
+See
+.Xr jail 8
+for an extensive list of available parameters.
+.It Fl m
+Modify the parameters of a virtual image named
+.Ar vname ,
+using the same syntax as with the -c form of the command.
 .It Fl d
 Delete the virtual image 
-.Ar vi_name .
+.Ar vname .
 No processes and/or sockets should exist in the target virtual image
-in order for the delete request to succeed. Non-loopback interfaces
+in order for the delete request to succeed.  Non-loopback interfaces
 residing in the target virtual image will be reassigned to the virtual
 image's parent.
 .It Fl l
 List the properties and statistics for virtual images one level
 below the current one in the hierarchy. If an optional argument
-.Ar vi_name
+.Ar vname
 is provided, only the information regarding the target virtual image
-.Ar vi_name
+.Ar vname
 is displayed.
-.It Fl lr
-List the properties and statistics for all virtual images in
-the hierarchy of subordinated vimages. If an optional argument
-.Ar vi_name
-is provided, the hierarchy will be traversed at and below the
-.Ar vi_name
-level.
+With the optional
+.Op Ar -r
+switch enabled the list will include all virtual images below the
+current level in the vimage hierarchy.
+Enabling the optional
+.Op Ar -v
+or
+.Op Ar -j
+switches results in a more detailed output.
 .It Fl i
-Move the interface
-.Ar interface
+Move interface
+.Ar ifname
 to the target virtual image
-.Ar vi_name .
-If the value of 
-.Ar vi_name
-argument is
-.So ..
+.Ar vname .
+Interfaces will be automatically renamed to
+.So
+ethXX
 .Sc ,
-the interface is returned to the parent of the current virtual image.
+unless an optional argument specifying the desired interface name
+.Op Ar newifname
+is provided.
 .El
 .Sh EXAMPLES
 Create a new virtual image named 
 .So v1
-.Sc :
+.Sc ,
+which is allowed to create and manage an own subhierarchy of vimages:
 .Pp
-.Dl vimage -c v1
+.Dl vimage -c v1 children.max=100
 .Pp
 Execute the
 .So ifconfig
@@ -137,28 +161,35 @@ Move the interface
 .So vlan0
 .Sc to the virtual image
 .So v1
+.Sc while renaming the interface as
+.So
+ve0
 .Sc :
 .Pp
-.Dl vimage -i v1 vlan0
+.Dl vimage -i v1 vlan0 ve0
 .Pp
 Show the status information for virtual image
 .So v1
 .Sc :
 .Pp
-.Dl vimage -l v1
+.Dl vimage -lv v1
 .Sh DIAGNOSTICS
 The
 .Nm
 command exits 0 on success, and >0 if an error occurs.
 .Sh SEE ALSO
 .Xr jail 8
+.Xr jexec 8
+.Xr jls 8
 .Sh BUGS
-If memory allocation failure occurs during the vimage creation, it will remain
-undetected/ignored in the current implementation, thus latently scheduling
-an almost imminent system crash in the future.
+Deletion of vimages / vnets is known to leak kernel memory and fail at
+stopping various timers, hence may lead to system crashes.
 .Sh AUTHOR
 .An "Marko Zec" Aq zec@fer.hr
 .Sh HISTORY
-The
-.Nm
-facility first appeared as a patch against FreeBSD 4.7-RELEASE in 2002.
+Network stack virtualization framework first appeared as a patchset
+against the FreeBSD 4.7 kernel in 2002, and was maintained outside
+of the main FreeBSD tree.
+As a result of a project sponsored by the FreeBSD Foundation and
+Stiching NLNet, integrated virtualized network stack first appeared
+in FreeBSD 8.0.

Modified: head/tools/tools/vimage/vimage.c
==============================================================================
--- head/tools/tools/vimage/vimage.c	Thu Aug 20 21:29:49 2009	(r196408)
+++ head/tools/tools/vimage/vimage.c	Thu Aug 20 22:39:20 2009	(r196409)
@@ -28,142 +28,294 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#define	VI_CREATE		0x00000001
-#define	VI_DESTROY		0x00000002
-#define	VI_SWITCHTO		0x00000008
-#define	VI_IFACE		0x00000010
-#define	VI_GET			0x00000100
-#define	VI_GETNEXT		0x00000200
+typedef enum {
+	VI_SWITCHTO,
+	VI_CREATE,
+	VI_MODIFY,
+	VI_DESTROY,
+	VI_IFMOVE,
+	VI_GET
+} vi_cmd_t;
+
+typedef struct vimage_status {
+	char name[MAXPATHLEN];		/* Must be first field for strcmp(). */
+	char path[MAXPATHLEN];
+	char hostname[MAXPATHLEN];
+	char domainname[MAXPATHLEN];
+	int jid;
+	int parentjid;
+	int vnet;
+	int childcnt;
+	int childmax;
+	int cpuset;
+	int rawsock;
+	int socket_af;
+	int mount;
+} vstat_t;
+
+#define	VST_SIZE_STEP	1024
+#define	MAXPARAMS	32
+
+static int getjail(vstat_t *, int, int);
+
+static char *invocname;
+
+static void
+usage(void)
+{
 
-static int getjail(char *name, int lastjid, int *vnet);
+	fprintf(stderr,
+	    "usage: %s [-c | -m] vname [param=value ...]\n"
+	    "       %s -d vname\n"
+	    "       %s -l[rvj] [vname]\n"
+	    "       %s -i vname ifname [newifname]\n"
+	    "       %s vname [command ...]\n",
+	    invocname, invocname, invocname, invocname, invocname);
+	exit(1);
+}
 
 int
 main(int argc, char **argv)
 {
-	int s;
-	char *shell;
-	int cmd;
-	int jid, vnet;
+	struct jailparam params[MAXPARAMS];
+	char ifname[IFNAMSIZ];
 	struct ifreq ifreq;
-	char name[MAXHOSTNAMELEN];
-
-	switch (argc) {
-
-	case 1:
-		cmd = 0;
-		break;
-
-	case 2:
-		if (strcmp(argv[1], "-l") == 0)
-			cmd = VI_GETNEXT;
-		else if (strcmp(argv[1], "-lr") == 0)
-			cmd = VI_GETNEXT;
-		else {
-			strcpy(name, argv[1]);
-			cmd = VI_SWITCHTO;
+	vi_cmd_t newcmd, cmd;
+	int recurse = 0;
+	int verbose = 0;
+	int jid, i, s, namelen;
+	int vst_size, vst_last;
+	vstat_t *vst;
+	char *str;
+	char ch;
+
+	invocname = argv[0];
+
+	newcmd = cmd = VI_SWITCHTO; /* Default if no modifiers specified. */
+	while ((ch = getopt(argc, argv, "cdijlmrv")) != -1) {
+		switch (ch) {
+		case 'c':
+			newcmd = VI_CREATE;
+			break;
+		case 'm':
+			newcmd = VI_MODIFY;
+			break;
+		case 'd':
+			newcmd = VI_DESTROY;
+			break;
+		case 'l':
+			newcmd = VI_GET;
+			break;
+		case 'i':
+			newcmd = VI_IFMOVE;
+			break;
+		case 'r':
+			recurse = 1;
+			break;
+		case 'v':
+			verbose++;
+			break;
+		case 'j':
+			verbose = 2;
+			break;
+		default:
+			usage();
 		}
-		break;
-
-	case 3:
-		strcpy(name, argv[2]);
-		if (strcmp(argv[1], "-l") == 0)
-			cmd = VI_GET;
-		if (strcmp(argv[1], "-c") == 0)
-			cmd = VI_CREATE;
-		if (strcmp(argv[1], "-d") == 0)
-			cmd = VI_DESTROY;
-		break;
-
-	default:
-		strcpy(name, argv[2]);
-		if (strcmp(argv[1], "-c") == 0)
-			cmd = VI_CREATE;
-		if (strcmp(argv[1], "-i") == 0)
-			cmd = VI_IFACE;
+		if (cmd == VI_SWITCHTO || cmd == newcmd)
+			cmd = newcmd;
+		else
+			usage();
 	}
+	argc -= optind;
+	argv += optind;
 
-	switch (cmd) {
+	if ((cmd != VI_GET && (argc == 0 || recurse != 0 || verbose != 0)) ||
+	    (cmd == VI_IFMOVE && (argc < 2 || argc > 3)) ||
+	    (cmd == VI_MODIFY && argc < 2) || argc >= MAXPARAMS)
+		usage();
 
+	switch (cmd) {
 	case VI_GET:
-		jid = getjail(name, -1, &vnet);
-		if (jid < 0)
-			goto abort;
-		printf("%d: %s%s\n", jid, name, vnet ? "" : " (no vnet)");
-		exit(0);
-
-	case VI_GETNEXT:
+		vst_last = 0;
+		vst_size = VST_SIZE_STEP;
+		if ((vst = malloc(vst_size * sizeof(*vst))) == NULL)
+			break;
+		if (argc == 1)
+			namelen = strlen(argv[0]);
+		else
+			namelen = 0;
 		jid = 0;
-		while ((jid = getjail(name, jid, &vnet)) > 0)
-			printf("%d: %s%s\n", jid, name,
-			    vnet ? "" : " (no vnet)");
+		while ((jid = getjail(&vst[vst_last], jid, verbose)) > 0) {
+			/* Skip jails which do not own vnets. */
+			if (vst[vst_last].vnet != 1)
+				continue;
+			/* Skip non-matching vnames / hierarchies. */
+			if (namelen &&
+			    ((strlen(vst[vst_last].name) < namelen ||
+			    strncmp(vst[vst_last].name, argv[0], namelen) != 0)
+			    || (strlen(vst[vst_last].name) > namelen &&
+			    vst[vst_last].name[namelen] != '.')))
+				continue;
+			/* Skip any sub-trees if -r not requested. */
+			if (!recurse &&
+			    (strlen(vst[vst_last].name) < namelen ||
+			    strchr(&vst[vst_last].name[namelen], '.') != NULL))
+				continue;
+			/* Grow vst table if necessary. */
+			if (++vst_last == vst_size) {
+				vst_size += VST_SIZE_STEP;
+				vst = realloc(vst, vst_size * sizeof(*vst));
+				if (vst == NULL)
+					break;
+			}
+		}
+		if (vst == NULL)
+			break;
+		/* Sort: the key is the 1st field in *vst, i.e. vimage name. */
+		qsort(vst, vst_last, sizeof(*vst), (void *) strcmp);
+		for (i = 0; i < vst_last; i++) {
+			if (!verbose) {
+				printf("%s\n", vst[i].name);
+				continue;
+			}
+
+			printf("%s:\n", vst[i].name);
+			printf("    Path: %s\n", vst[i].path);
+			printf("    Hostname: %s\n", vst[i].hostname);
+			printf("    Domainname: %s\n", vst[i].domainname);
+			printf("    Children: %d\n", vst[i].childcnt);
+
+			if (verbose < 2)
+				continue;
+
+			printf("    Children limit: %d\n", vst[i].childmax);
+			printf("    CPUsetID: %d\n", vst[i].cpuset);
+			printf("    JID: %d\n", vst[i].jid);
+			printf("    PJID: %d\n", vst[i].parentjid);
+			printf("    Raw sockets allowed: %d\n", vst[i].rawsock);
+			printf("    All AF allowed: %d\n", vst[i].socket_af);
+			printf("    Mount allowed: %d\n", vst[i].mount);
+		}
+		free(vst);
 		exit(0);
 
-	case VI_IFACE:
-		s = socket(AF_INET, SOCK_DGRAM, 0);
-		if (s == -1)
-			goto abort;
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
+	case VI_IFMOVE:
+		if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+			break;
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
 		ifreq.ifr_jid = jid;
-		strncpy(ifreq.ifr_name, argv[3], sizeof(ifreq.ifr_name));
+		strncpy(ifreq.ifr_name, argv[1], sizeof(ifreq.ifr_name));
 		if (ioctl(s, SIOCSIFVNET, (caddr_t)&ifreq) < 0)
-			goto abort;
-		printf("%s@%s\n", ifreq.ifr_name, name);
+			break;
+		close(s);
+		if (argc == 3)
+			snprintf(ifname, sizeof(ifname), "%s", argv[2]);
+		else
+			snprintf(ifname, sizeof(ifname), "eth0");
+		ifreq.ifr_data = ifname;
+		/* Do we need to rename the ifnet? */
+		if (strcmp(ifreq.ifr_name, ifname) != 0) {
+			/* Switch to the context of the target vimage. */
+			if (jail_attach(jid) < 0)
+				break;
+			if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+				break;
+			for (namelen = 0; isalpha(ifname[namelen]); namelen++);
+			i = 0;
+			/* Search for a free ifunit in target vnet.  Unsafe. */
+			while (ioctl(s, SIOCSIFNAME, (caddr_t)&ifreq) < 0) {
+				snprintf(&ifname[namelen],
+				    sizeof(ifname) - namelen, "%d", i);
+				/* Emergency brake. */
+				if (i++ == IF_MAXUNIT)
+					break;
+			}
+		}
+		if (i < IF_MAXUNIT)
+			printf("%s@%s\n", ifname, argv[0]);
+		else
+			printf("%s@%s\n", ifreq.ifr_name, argv[0]);
 		exit(0);
 
 	case VI_CREATE:
-		if (jail_setv(JAIL_CREATE, "name", name, "vnet", NULL,
-		    "host", NULL, "persist", NULL, NULL) < 0)
-			goto abort;
+		if ((jid = jail_setv(JAIL_CREATE,
+		    "name", argv[0],
+		    "vnet", NULL,
+		    "host", NULL,
+		    "persist", NULL,
+		    "allow.raw_sockets", "true",
+		    "allow.socket_af", "true",
+		    "allow.mount", "true",
+		    NULL)) >= 0)
+				break;
+		if (jid < 0)
+			break;
+		if (argc == 1)
+			exit(0);
+		/* Not done yet, proceed to apply non-default parameters. */
+
+	case VI_MODIFY:
+		jailparam_init(¶ms[0], "name");
+		jailparam_import(¶ms[0], argv[0]);
+		for (i = 1; i < argc; i++) {
+			for (str = argv[i]; *str != '=' && *str != 0; str++) {
+				/* Do nothing - search for '=' delimeter. */
+			}
+			if (*str == 0)
+				break;
+			*str++ = 0;
+			if (*str == 0)
+				break;
+			jailparam_init(¶ms[i], argv[i]);
+			jailparam_import(¶ms[i], str);
+		}
+		if (i != argc)
+			break;
+		if (jailparam_set(params, i, JAIL_UPDATE) < 0)
+			break;
+		exit(0);
+
+	case VI_DESTROY:
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
+		if (jail_remove(jid) < 0)
+			break;
 		exit(0);
 
 	case VI_SWITCHTO:
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
 		if (jail_attach(jid) < 0)
-			goto abort;
-
-		if (argc == 2) {
-			printf("Switched to jail %s\n", argv[1]);
-			if ((shell = getenv("SHELL")) == NULL)
-				execlp("/bin/sh", argv[0], NULL);
+			break;
+		if (argc == 1) {
+			printf("Switched to vimage %s\n", argv[0]);
+			if ((str = getenv("SHELL")) == NULL)
+				execlp("/bin/sh", invocname, NULL);
 			else
-				execlp(shell, argv[0], NULL);
+				execlp(str, invocname, NULL);
 		} else 
-			execvp(argv[2], &argv[2]);
+			execvp(argv[1], &argv[1]);
 		break;
 
-	case VI_DESTROY:
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
-		if (jail_remove(jid) < 0)
-			goto abort;
-		exit(0);
-
 	default:
-		fprintf(stderr, "usage: %s [-cdilr] vi_name [args]\n",
-		    argv[0]);
-		exit(1);
+		/* Should be unreachable. */
+		break;
 	}
 
-abort:
 	if (jail_errmsg[0])
 		fprintf(stderr, "Error: %s\n", jail_errmsg);
 	else
@@ -172,27 +324,69 @@ abort:
 }
 
 static int
-getjail(char *name, int lastjid, int *vnet)
+getjail(vstat_t *vs, int lastjid, int verbose)
 {
-	struct jailparam params[3];
-	int jid;
+	struct jailparam params[32];	/* Must be > max(psize). */
+	int psize = 0;
 
-	if (lastjid < 0) {
-		jid = jail_getid(name);
-		if (jid < 0)
-			return (jid);
-		jailparam_init(¶ms[0], "jid");
-		jailparam_import_raw(¶ms[0], &jid, sizeof jid);
-	} else {
-		jailparam_init(¶ms[0], "lastjid");
-		jailparam_import_raw(¶ms[0], &lastjid, sizeof lastjid);
-	}
-	jailparam_init(¶ms[1], "name");
-	jailparam_import_raw(¶ms[1], name, MAXHOSTNAMELEN);
-	name[0] = 0;
-	jailparam_init(¶ms[2], "vnet");
-	jailparam_import_raw(¶ms[2], vnet, sizeof(*vnet));
-	jid = jailparam_get(params, 3, 0);
-	jailparam_free(params, 3);
-	return (jid);
+	bzero(params, sizeof(params));
+	bzero(vs, sizeof(*vs));
+
+	jailparam_init(¶ms[psize], "lastjid");
+	jailparam_import_raw(¶ms[psize++], &lastjid, sizeof lastjid);
+
+	jailparam_init(¶ms[psize], "vnet");
+	jailparam_import_raw(¶ms[psize++], &vs->vnet, sizeof(vs->vnet));
+
+	jailparam_init(¶ms[psize], "name");
+	jailparam_import_raw(¶ms[psize++], &vs->name, sizeof(vs->name));
+
+	if (verbose == 0)
+		goto done;
+
+	jailparam_init(¶ms[psize], "path");
+	jailparam_import_raw(¶ms[psize++], &vs->path, sizeof(vs->path));
+
+	jailparam_init(¶ms[psize], "host.hostname");
+	jailparam_import_raw(¶ms[psize++], &vs->hostname,
+	    sizeof(vs->hostname));
+
+	jailparam_init(¶ms[psize], "host.domainname");
+	jailparam_import_raw(¶ms[psize++], &vs->domainname,
+	    sizeof(vs->domainname));
+
+	jailparam_init(¶ms[psize], "children.cur");
+	jailparam_import_raw(¶ms[psize++], &vs->childcnt,
+	    sizeof(vs->childcnt));
+
+	if (verbose == 1)
+		goto done;
+
+	jailparam_init(¶ms[psize], "children.max");
+	jailparam_import_raw(¶ms[psize++], &vs->childmax,
+	    sizeof(vs->childmax));
+
+	jailparam_init(¶ms[psize], "cpuset.id");
+	jailparam_import_raw(¶ms[psize++], &vs->cpuset,
+	    sizeof(vs->cpuset));
+
+	jailparam_init(¶ms[psize], "parent");
+	jailparam_import_raw(¶ms[psize++], &vs->parentjid,
+	    sizeof(vs->parentjid));
+
+	jailparam_init(¶ms[psize], "allow.raw_sockets");
+	jailparam_import_raw(¶ms[psize++], &vs->rawsock,
+	    sizeof(vs->rawsock));
+
+	jailparam_init(¶ms[psize], "allow.socket_af");
+	jailparam_import_raw(¶ms[psize++], &vs->socket_af,
+	    sizeof(vs->socket_af));
+
+	jailparam_init(¶ms[psize], "allow.mount");
+	jailparam_import_raw(¶ms[psize++], &vs->mount, sizeof(vs->mount));
+
+done:
+	vs->jid = jailparam_get(params, psize, 0);
+	jailparam_free(params, psize);
+	return (vs->jid);
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 22:53:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1609B106568C;
	Thu, 20 Aug 2009 22:53:29 +0000 (UTC)
	(envelope-from peter@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 053CC8FC64;
	Thu, 20 Aug 2009 22:53:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KMrSa8002028;
	Thu, 20 Aug 2009 22:53:28 GMT (envelope-from peter@svn.freebsd.org)
Received: (from peter@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KMrSUs002026;
	Thu, 20 Aug 2009 22:53:28 GMT (envelope-from peter@svn.freebsd.org)
Message-Id: <200908202253.n7KMrSUs002026@svn.freebsd.org>
From: Peter Wemm 
Date: Thu, 20 Aug 2009 22:53:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196410 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 22:53:29 -0000

Author: peter
Date: Thu Aug 20 22:53:28 2009
New Revision: 196410
URL: http://svn.freebsd.org/changeset/base/196410

Log:
  Fix signed comparison bug when ticks goes negative after 24 days of
  uptime.  This causes the tcp time_wait state code to fail to expire
  sockets in timewait state.
  
  Approved by:	re (kensmith)

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==============================================================================
--- head/sys/netinet/tcp_timewait.c	Thu Aug 20 22:39:20 2009	(r196409)
+++ head/sys/netinet/tcp_timewait.c	Thu Aug 20 22:53:28 2009	(r196410)
@@ -603,7 +603,7 @@ tcp_tw_2msl_scan(int reuse)
 	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
 	for (;;) {
 		tw = TAILQ_FIRST(&V_twq_2msl);
-		if (tw == NULL || (!reuse && tw->tw_time > ticks))
+		if (tw == NULL || (!reuse && (tw->tw_time - ticks) > 0))
 			break;
 		INP_WLOCK(tw->tw_inpcb);
 		tcp_twclose(tw, reuse);

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 22:56:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D65F106568B;
	Thu, 20 Aug 2009 22:56:29 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A09D8FC3D;
	Thu, 20 Aug 2009 22:56:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KMuTfx002232;
	Thu, 20 Aug 2009 22:56:29 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KMuTQR002228;
	Thu, 20 Aug 2009 22:56:29 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908202256.n7KMuTQR002228@svn.freebsd.org>
From: Marko Zec 
Date: Thu, 20 Aug 2009 22:56:29 +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: r196411 - stable/8/tools/tools/vimage
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 22:56:29 -0000

Author: zec
Date: Thu Aug 20 22:56:29 2009
New Revision: 196411
URL: http://svn.freebsd.org/changeset/base/196411

Log:
  MFC r196409:
  
    vimage(8) is a legacy CLI interface for managing jails associated with
    network stack instances, which is provided for compatibility with
    older applications.  This change brings it back to life in a followup
    to the initial conversion of vimage to use the new jail(4)
    userland-kernel API:
  
    - when creating vimages via "vimage -c", by default turn on a few
    options expected by legacy applications, such as allow operations on
    raw sockets, FS mounts etc, and allow jail-related parameters to be
    optionally configured.
  
    - introduce the "-m" modifier which allows for configuring jail
    parameters of existing vimages / vnet-jails.
  
    - make "vimage name command ..." actually work.
  
    - when reassigning ifnets to vnets using "vimage -i", attempt to rename
    the ifnet as "ethXXX" on arrival in the target vnet.  Several legacy
    applications are known to depend heavily on such behavior.
  
    - vimage -l lists only jails associated with vnets.  The output is
    sorted using vimage / jail names as keys.
  
    - vimage -l by default searches only the current level in the jail
    hierarchy.  Recursive listing can be requested via -r switch.
  
    - vimage -l by default prints only jail names on each line, making
    such output suitable for pipelining to other commands.  More verbose
    output can be obtained via -v switch, and even more jail specific
    information will be displayed if -j switch is turned on.
  
    - there's no need to build vimage as statically linked, so update the
    Makefile accordingly.
  
    - update the vimage.8 man page.
  
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/tools/tools/vimage/   (props changed)
  stable/8/tools/tools/vimage/Makefile
  stable/8/tools/tools/vimage/vimage.8
  stable/8/tools/tools/vimage/vimage.c

Modified: stable/8/tools/tools/vimage/Makefile
==============================================================================
--- stable/8/tools/tools/vimage/Makefile	Thu Aug 20 22:53:28 2009	(r196410)
+++ stable/8/tools/tools/vimage/Makefile	Thu Aug 20 22:56:29 2009	(r196411)
@@ -10,6 +10,5 @@ CFLAGS+= -I../../../sys
 MAN=	vimage.8
 
 BINDIR?=	/usr/sbin
-NO_SHARED?=	YES
 
 .include 

Modified: stable/8/tools/tools/vimage/vimage.8
==============================================================================
--- stable/8/tools/tools/vimage/vimage.8	Thu Aug 20 22:53:28 2009	(r196410)
+++ stable/8/tools/tools/vimage/vimage.8	Thu Aug 20 22:56:29 2009	(r196411)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2002, 2003 Marko Zec 
+.\" Copyright (c) 2002, 2003 Marko Zec 
 .\" Copyright (c) 2009 University of Zagreb
 .\" Copyright (c) 2009 FreeBSD Foundation
 .\"
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2009
+.Dd August 25, 2009
 .Dt VIMAGE 8
 .Os
 .Sh NAME
@@ -35,35 +35,46 @@
 .Nd manage virtual network stacks
 .Sh SYNOPSIS
 .Nm
-.Ar vi_name
-.Op command
-.Nm
-.Fl c
-.Ar vi_name
+.Op Fl c | m
+.Ar vname
+.Op Ar param=value ...
 .Nm
 .Fl d
-.Ar vi_name
+.Ar vname
 .Nm
 .Fl l
-.Op Ar vi_name
+.Op Fl rvj
+.Op Ar vname
 .Nm
 .Fl i
-.Ar vi_name interface
+.Ar vname ifname
+.Op Ar newifname
+.Nm
+.Ar vi_name
+.Op command ...
 .Sh DESCRIPTION
+The
 .Nm
-command is an interm user interface for controlling the virtual network
-stacks in FreeBSD.
+utility is an alternative user interface for controlling virtual network
+stacks in FreeBSD, aimed primarily at supporting legacy applications
+which are not yet converted to using
+.Xr jail 8 ,
+.Xr jexec 8 ,
+and
+.Xr jls 8 .
+.
 .Ss Overview
-A virtual image reprepresents an isolated operating environment with its
-own independent network stack instance.  Every process, socket and network
-interface present in the system is always attached to one, and only one,
-virtual image i.e. virtual network stack instance.
-During the system bootup sequence default virtual image is created to
-which all the configured interfaces and user processes are initially
-assigned.
-Assuming that enough system resources and per virtual image privileges
-are provided, the super-user can create and manage a hierarchy of
-subordinated virtual images. The
+A virtual image or vimage is a jail with its own independent network
+stack instance.  Every process, socket and network interface present
+in the system is always attached to one, and only one, virtual network
+stack instance (vnet).
+During system bootup sequence a default vnet
+is created to which all the configured interfaces and user processes
+are initially attached.
+Assuming that enough system resources are
+are available, a user with sufficient privileges can create and manage
+a hierarchy of subordinated virtual images.
+The
 .Nm
 command allows for creation, deletion and monitoring of virtual images,
 as well as for execution of arbitrary processes in a targeted virtual
@@ -71,59 +82,72 @@ image.
 .Ss Invocation
 If invoked with no modifiers, the
 .Nm
-command spawns a new shell process in virtual image 
-.Ar vi_name .
-If provided, the optional arguments following the virtual image name
-.Ar vi_name
-are interpreted as a standard command line issued at a shell,
-otherwise an interactive shell is started in the target virtual image.
+command spawns a new interactive shell in virtual image 
+.Ar vname .
+If optional additional arguments following
+.Ar vname
+are provided, the first of those will be executed in place of the
+interactive shell, and the rest of the arguments will be passed as
+arguments to the executed command.
 .Pp
-The following parameters are available:
+The following modifiers are available:
 .Bl -tag -width indent
 .It Fl c
 Create a new virtual image named
-.So
-.Ar vi_name
-.Sc .
+.Ar vname .
+Additional arguments, if provided, may be used to specify operating
+parameters different from defaults, in format
+.Ar param=value .
+See
+.Xr jail 8
+for an extensive list of available parameters.
+.It Fl m
+Modify the parameters of a virtual image named
+.Ar vname ,
+using the same syntax as with the -c form of the command.
 .It Fl d
 Delete the virtual image 
-.Ar vi_name .
+.Ar vname .
 No processes and/or sockets should exist in the target virtual image
-in order for the delete request to succeed. Non-loopback interfaces
+in order for the delete request to succeed.  Non-loopback interfaces
 residing in the target virtual image will be reassigned to the virtual
 image's parent.
 .It Fl l
 List the properties and statistics for virtual images one level
 below the current one in the hierarchy. If an optional argument
-.Ar vi_name
+.Ar vname
 is provided, only the information regarding the target virtual image
-.Ar vi_name
+.Ar vname
 is displayed.
-.It Fl lr
-List the properties and statistics for all virtual images in
-the hierarchy of subordinated vimages. If an optional argument
-.Ar vi_name
-is provided, the hierarchy will be traversed at and below the
-.Ar vi_name
-level.
+With the optional
+.Op Ar -r
+switch enabled the list will include all virtual images below the
+current level in the vimage hierarchy.
+Enabling the optional
+.Op Ar -v
+or
+.Op Ar -j
+switches results in a more detailed output.
 .It Fl i
-Move the interface
-.Ar interface
+Move interface
+.Ar ifname
 to the target virtual image
-.Ar vi_name .
-If the value of 
-.Ar vi_name
-argument is
-.So ..
+.Ar vname .
+Interfaces will be automatically renamed to
+.So
+ethXX
 .Sc ,
-the interface is returned to the parent of the current virtual image.
+unless an optional argument specifying the desired interface name
+.Op Ar newifname
+is provided.
 .El
 .Sh EXAMPLES
 Create a new virtual image named 
 .So v1
-.Sc :
+.Sc ,
+which is allowed to create and manage an own subhierarchy of vimages:
 .Pp
-.Dl vimage -c v1
+.Dl vimage -c v1 children.max=100
 .Pp
 Execute the
 .So ifconfig
@@ -137,28 +161,35 @@ Move the interface
 .So vlan0
 .Sc to the virtual image
 .So v1
+.Sc while renaming the interface as
+.So
+ve0
 .Sc :
 .Pp
-.Dl vimage -i v1 vlan0
+.Dl vimage -i v1 vlan0 ve0
 .Pp
 Show the status information for virtual image
 .So v1
 .Sc :
 .Pp
-.Dl vimage -l v1
+.Dl vimage -lv v1
 .Sh DIAGNOSTICS
 The
 .Nm
 command exits 0 on success, and >0 if an error occurs.
 .Sh SEE ALSO
 .Xr jail 8
+.Xr jexec 8
+.Xr jls 8
 .Sh BUGS
-If memory allocation failure occurs during the vimage creation, it will remain
-undetected/ignored in the current implementation, thus latently scheduling
-an almost imminent system crash in the future.
+Deletion of vimages / vnets is known to leak kernel memory and fail at
+stopping various timers, hence may lead to system crashes.
 .Sh AUTHOR
 .An "Marko Zec" Aq zec@fer.hr
 .Sh HISTORY
-The
-.Nm
-facility first appeared as a patch against FreeBSD 4.7-RELEASE in 2002.
+Network stack virtualization framework first appeared as a patchset
+against the FreeBSD 4.7 kernel in 2002, and was maintained outside
+of the main FreeBSD tree.
+As a result of a project sponsored by the FreeBSD Foundation and
+Stiching NLNet, integrated virtualized network stack first appeared
+in FreeBSD 8.0.

Modified: stable/8/tools/tools/vimage/vimage.c
==============================================================================
--- stable/8/tools/tools/vimage/vimage.c	Thu Aug 20 22:53:28 2009	(r196410)
+++ stable/8/tools/tools/vimage/vimage.c	Thu Aug 20 22:56:29 2009	(r196411)
@@ -28,142 +28,294 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#define	VI_CREATE		0x00000001
-#define	VI_DESTROY		0x00000002
-#define	VI_SWITCHTO		0x00000008
-#define	VI_IFACE		0x00000010
-#define	VI_GET			0x00000100
-#define	VI_GETNEXT		0x00000200
+typedef enum {
+	VI_SWITCHTO,
+	VI_CREATE,
+	VI_MODIFY,
+	VI_DESTROY,
+	VI_IFMOVE,
+	VI_GET
+} vi_cmd_t;
+
+typedef struct vimage_status {
+	char name[MAXPATHLEN];		/* Must be first field for strcmp(). */
+	char path[MAXPATHLEN];
+	char hostname[MAXPATHLEN];
+	char domainname[MAXPATHLEN];
+	int jid;
+	int parentjid;
+	int vnet;
+	int childcnt;
+	int childmax;
+	int cpuset;
+	int rawsock;
+	int socket_af;
+	int mount;
+} vstat_t;
+
+#define	VST_SIZE_STEP	1024
+#define	MAXPARAMS	32
+
+static int getjail(vstat_t *, int, int);
+
+static char *invocname;
+
+static void
+usage(void)
+{
 
-static int getjail(char *name, int lastjid, int *vnet);
+	fprintf(stderr,
+	    "usage: %s [-c | -m] vname [param=value ...]\n"
+	    "       %s -d vname\n"
+	    "       %s -l[rvj] [vname]\n"
+	    "       %s -i vname ifname [newifname]\n"
+	    "       %s vname [command ...]\n",
+	    invocname, invocname, invocname, invocname, invocname);
+	exit(1);
+}
 
 int
 main(int argc, char **argv)
 {
-	int s;
-	char *shell;
-	int cmd;
-	int jid, vnet;
+	struct jailparam params[MAXPARAMS];
+	char ifname[IFNAMSIZ];
 	struct ifreq ifreq;
-	char name[MAXHOSTNAMELEN];
-
-	switch (argc) {
-
-	case 1:
-		cmd = 0;
-		break;
-
-	case 2:
-		if (strcmp(argv[1], "-l") == 0)
-			cmd = VI_GETNEXT;
-		else if (strcmp(argv[1], "-lr") == 0)
-			cmd = VI_GETNEXT;
-		else {
-			strcpy(name, argv[1]);
-			cmd = VI_SWITCHTO;
+	vi_cmd_t newcmd, cmd;
+	int recurse = 0;
+	int verbose = 0;
+	int jid, i, s, namelen;
+	int vst_size, vst_last;
+	vstat_t *vst;
+	char *str;
+	char ch;
+
+	invocname = argv[0];
+
+	newcmd = cmd = VI_SWITCHTO; /* Default if no modifiers specified. */
+	while ((ch = getopt(argc, argv, "cdijlmrv")) != -1) {
+		switch (ch) {
+		case 'c':
+			newcmd = VI_CREATE;
+			break;
+		case 'm':
+			newcmd = VI_MODIFY;
+			break;
+		case 'd':
+			newcmd = VI_DESTROY;
+			break;
+		case 'l':
+			newcmd = VI_GET;
+			break;
+		case 'i':
+			newcmd = VI_IFMOVE;
+			break;
+		case 'r':
+			recurse = 1;
+			break;
+		case 'v':
+			verbose++;
+			break;
+		case 'j':
+			verbose = 2;
+			break;
+		default:
+			usage();
 		}
-		break;
-
-	case 3:
-		strcpy(name, argv[2]);
-		if (strcmp(argv[1], "-l") == 0)
-			cmd = VI_GET;
-		if (strcmp(argv[1], "-c") == 0)
-			cmd = VI_CREATE;
-		if (strcmp(argv[1], "-d") == 0)
-			cmd = VI_DESTROY;
-		break;
-
-	default:
-		strcpy(name, argv[2]);
-		if (strcmp(argv[1], "-c") == 0)
-			cmd = VI_CREATE;
-		if (strcmp(argv[1], "-i") == 0)
-			cmd = VI_IFACE;
+		if (cmd == VI_SWITCHTO || cmd == newcmd)
+			cmd = newcmd;
+		else
+			usage();
 	}
+	argc -= optind;
+	argv += optind;
 
-	switch (cmd) {
+	if ((cmd != VI_GET && (argc == 0 || recurse != 0 || verbose != 0)) ||
+	    (cmd == VI_IFMOVE && (argc < 2 || argc > 3)) ||
+	    (cmd == VI_MODIFY && argc < 2) || argc >= MAXPARAMS)
+		usage();
 
+	switch (cmd) {
 	case VI_GET:
-		jid = getjail(name, -1, &vnet);
-		if (jid < 0)
-			goto abort;
-		printf("%d: %s%s\n", jid, name, vnet ? "" : " (no vnet)");
-		exit(0);
-
-	case VI_GETNEXT:
+		vst_last = 0;
+		vst_size = VST_SIZE_STEP;
+		if ((vst = malloc(vst_size * sizeof(*vst))) == NULL)
+			break;
+		if (argc == 1)
+			namelen = strlen(argv[0]);
+		else
+			namelen = 0;
 		jid = 0;
-		while ((jid = getjail(name, jid, &vnet)) > 0)
-			printf("%d: %s%s\n", jid, name,
-			    vnet ? "" : " (no vnet)");
+		while ((jid = getjail(&vst[vst_last], jid, verbose)) > 0) {
+			/* Skip jails which do not own vnets. */
+			if (vst[vst_last].vnet != 1)
+				continue;
+			/* Skip non-matching vnames / hierarchies. */
+			if (namelen &&
+			    ((strlen(vst[vst_last].name) < namelen ||
+			    strncmp(vst[vst_last].name, argv[0], namelen) != 0)
+			    || (strlen(vst[vst_last].name) > namelen &&
+			    vst[vst_last].name[namelen] != '.')))
+				continue;
+			/* Skip any sub-trees if -r not requested. */
+			if (!recurse &&
+			    (strlen(vst[vst_last].name) < namelen ||
+			    strchr(&vst[vst_last].name[namelen], '.') != NULL))
+				continue;
+			/* Grow vst table if necessary. */
+			if (++vst_last == vst_size) {
+				vst_size += VST_SIZE_STEP;
+				vst = realloc(vst, vst_size * sizeof(*vst));
+				if (vst == NULL)
+					break;
+			}
+		}
+		if (vst == NULL)
+			break;
+		/* Sort: the key is the 1st field in *vst, i.e. vimage name. */
+		qsort(vst, vst_last, sizeof(*vst), (void *) strcmp);
+		for (i = 0; i < vst_last; i++) {
+			if (!verbose) {
+				printf("%s\n", vst[i].name);
+				continue;
+			}
+
+			printf("%s:\n", vst[i].name);
+			printf("    Path: %s\n", vst[i].path);
+			printf("    Hostname: %s\n", vst[i].hostname);
+			printf("    Domainname: %s\n", vst[i].domainname);
+			printf("    Children: %d\n", vst[i].childcnt);
+
+			if (verbose < 2)
+				continue;
+
+			printf("    Children limit: %d\n", vst[i].childmax);
+			printf("    CPUsetID: %d\n", vst[i].cpuset);
+			printf("    JID: %d\n", vst[i].jid);
+			printf("    PJID: %d\n", vst[i].parentjid);
+			printf("    Raw sockets allowed: %d\n", vst[i].rawsock);
+			printf("    All AF allowed: %d\n", vst[i].socket_af);
+			printf("    Mount allowed: %d\n", vst[i].mount);
+		}
+		free(vst);
 		exit(0);
 
-	case VI_IFACE:
-		s = socket(AF_INET, SOCK_DGRAM, 0);
-		if (s == -1)
-			goto abort;
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
+	case VI_IFMOVE:
+		if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+			break;
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
 		ifreq.ifr_jid = jid;
-		strncpy(ifreq.ifr_name, argv[3], sizeof(ifreq.ifr_name));
+		strncpy(ifreq.ifr_name, argv[1], sizeof(ifreq.ifr_name));
 		if (ioctl(s, SIOCSIFVNET, (caddr_t)&ifreq) < 0)
-			goto abort;
-		printf("%s@%s\n", ifreq.ifr_name, name);
+			break;
+		close(s);
+		if (argc == 3)
+			snprintf(ifname, sizeof(ifname), "%s", argv[2]);
+		else
+			snprintf(ifname, sizeof(ifname), "eth0");
+		ifreq.ifr_data = ifname;
+		/* Do we need to rename the ifnet? */
+		if (strcmp(ifreq.ifr_name, ifname) != 0) {
+			/* Switch to the context of the target vimage. */
+			if (jail_attach(jid) < 0)
+				break;
+			if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+				break;
+			for (namelen = 0; isalpha(ifname[namelen]); namelen++);
+			i = 0;
+			/* Search for a free ifunit in target vnet.  Unsafe. */
+			while (ioctl(s, SIOCSIFNAME, (caddr_t)&ifreq) < 0) {
+				snprintf(&ifname[namelen],
+				    sizeof(ifname) - namelen, "%d", i);
+				/* Emergency brake. */
+				if (i++ == IF_MAXUNIT)
+					break;
+			}
+		}
+		if (i < IF_MAXUNIT)
+			printf("%s@%s\n", ifname, argv[0]);
+		else
+			printf("%s@%s\n", ifreq.ifr_name, argv[0]);
 		exit(0);
 
 	case VI_CREATE:
-		if (jail_setv(JAIL_CREATE, "name", name, "vnet", NULL,
-		    "host", NULL, "persist", NULL, NULL) < 0)
-			goto abort;
+		if ((jid = jail_setv(JAIL_CREATE,
+		    "name", argv[0],
+		    "vnet", NULL,
+		    "host", NULL,
+		    "persist", NULL,
+		    "allow.raw_sockets", "true",
+		    "allow.socket_af", "true",
+		    "allow.mount", "true",
+		    NULL)) >= 0)
+				break;
+		if (jid < 0)
+			break;
+		if (argc == 1)
+			exit(0);
+		/* Not done yet, proceed to apply non-default parameters. */
+
+	case VI_MODIFY:
+		jailparam_init(¶ms[0], "name");
+		jailparam_import(¶ms[0], argv[0]);
+		for (i = 1; i < argc; i++) {
+			for (str = argv[i]; *str != '=' && *str != 0; str++) {
+				/* Do nothing - search for '=' delimeter. */
+			}
+			if (*str == 0)
+				break;
+			*str++ = 0;
+			if (*str == 0)
+				break;
+			jailparam_init(¶ms[i], argv[i]);
+			jailparam_import(¶ms[i], str);
+		}
+		if (i != argc)
+			break;
+		if (jailparam_set(params, i, JAIL_UPDATE) < 0)
+			break;
+		exit(0);
+
+	case VI_DESTROY:
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
+		if (jail_remove(jid) < 0)
+			break;
 		exit(0);
 
 	case VI_SWITCHTO:
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
+		if ((jid = jail_getid(argv[0])) < 0)
+			break;
 		if (jail_attach(jid) < 0)
-			goto abort;
-
-		if (argc == 2) {
-			printf("Switched to jail %s\n", argv[1]);
-			if ((shell = getenv("SHELL")) == NULL)
-				execlp("/bin/sh", argv[0], NULL);
+			break;
+		if (argc == 1) {
+			printf("Switched to vimage %s\n", argv[0]);
+			if ((str = getenv("SHELL")) == NULL)
+				execlp("/bin/sh", invocname, NULL);
 			else
-				execlp(shell, argv[0], NULL);
+				execlp(str, invocname, NULL);
 		} else 
-			execvp(argv[2], &argv[2]);
+			execvp(argv[1], &argv[1]);
 		break;
 
-	case VI_DESTROY:
-		jid = jail_getid(name);
-		if (jid < 0)
-			goto abort;
-		if (jail_remove(jid) < 0)
-			goto abort;
-		exit(0);
-
 	default:
-		fprintf(stderr, "usage: %s [-cdilr] vi_name [args]\n",
-		    argv[0]);
-		exit(1);
+		/* Should be unreachable. */
+		break;
 	}
 
-abort:
 	if (jail_errmsg[0])
 		fprintf(stderr, "Error: %s\n", jail_errmsg);
 	else
@@ -172,27 +324,69 @@ abort:
 }
 
 static int
-getjail(char *name, int lastjid, int *vnet)
+getjail(vstat_t *vs, int lastjid, int verbose)
 {
-	struct jailparam params[3];
-	int jid;
+	struct jailparam params[32];	/* Must be > max(psize). */
+	int psize = 0;
 
-	if (lastjid < 0) {
-		jid = jail_getid(name);
-		if (jid < 0)
-			return (jid);
-		jailparam_init(¶ms[0], "jid");
-		jailparam_import_raw(¶ms[0], &jid, sizeof jid);
-	} else {
-		jailparam_init(¶ms[0], "lastjid");
-		jailparam_import_raw(¶ms[0], &lastjid, sizeof lastjid);
-	}
-	jailparam_init(¶ms[1], "name");
-	jailparam_import_raw(¶ms[1], name, MAXHOSTNAMELEN);
-	name[0] = 0;
-	jailparam_init(¶ms[2], "vnet");
-	jailparam_import_raw(¶ms[2], vnet, sizeof(*vnet));
-	jid = jailparam_get(params, 3, 0);
-	jailparam_free(params, 3);
-	return (jid);
+	bzero(params, sizeof(params));
+	bzero(vs, sizeof(*vs));
+
+	jailparam_init(¶ms[psize], "lastjid");
+	jailparam_import_raw(¶ms[psize++], &lastjid, sizeof lastjid);
+
+	jailparam_init(¶ms[psize], "vnet");
+	jailparam_import_raw(¶ms[psize++], &vs->vnet, sizeof(vs->vnet));
+
+	jailparam_init(¶ms[psize], "name");
+	jailparam_import_raw(¶ms[psize++], &vs->name, sizeof(vs->name));
+
+	if (verbose == 0)
+		goto done;
+
+	jailparam_init(¶ms[psize], "path");
+	jailparam_import_raw(¶ms[psize++], &vs->path, sizeof(vs->path));
+
+	jailparam_init(¶ms[psize], "host.hostname");
+	jailparam_import_raw(¶ms[psize++], &vs->hostname,
+	    sizeof(vs->hostname));
+
+	jailparam_init(¶ms[psize], "host.domainname");
+	jailparam_import_raw(¶ms[psize++], &vs->domainname,
+	    sizeof(vs->domainname));
+
+	jailparam_init(¶ms[psize], "children.cur");
+	jailparam_import_raw(¶ms[psize++], &vs->childcnt,
+	    sizeof(vs->childcnt));
+
+	if (verbose == 1)
+		goto done;
+
+	jailparam_init(¶ms[psize], "children.max");
+	jailparam_import_raw(¶ms[psize++], &vs->childmax,
+	    sizeof(vs->childmax));
+
+	jailparam_init(¶ms[psize], "cpuset.id");
+	jailparam_import_raw(¶ms[psize++], &vs->cpuset,
+	    sizeof(vs->cpuset));
+
+	jailparam_init(¶ms[psize], "parent");
+	jailparam_import_raw(¶ms[psize++], &vs->parentjid,
+	    sizeof(vs->parentjid));
+
+	jailparam_init(¶ms[psize], "allow.raw_sockets");
+	jailparam_import_raw(¶ms[psize++], &vs->rawsock,
+	    sizeof(vs->rawsock));
+
+	jailparam_init(¶ms[psize], "allow.socket_af");
+	jailparam_import_raw(¶ms[psize++], &vs->socket_af,
+	    sizeof(vs->socket_af));
+
+	jailparam_init(¶ms[psize], "allow.mount");
+	jailparam_import_raw(¶ms[psize++], &vs->mount, sizeof(vs->mount));
+
+done:
+	vs->jid = jailparam_get(params, psize, 0);
+	jailparam_free(params, psize);
+	return (vs->jid);
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 22:58:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3445E106568B;
	Thu, 20 Aug 2009 22:58:06 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 229D68FC3F;
	Thu, 20 Aug 2009 22:58:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KMw6ij002303;
	Thu, 20 Aug 2009 22:58:06 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KMw5sU002300;
	Thu, 20 Aug 2009 22:58:05 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200908202258.n7KMw5sU002300@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 20 Aug 2009 22:58:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196412 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 22:58:06 -0000

Author: jkim
Date: Thu Aug 20 22:58:05 2009
New Revision: 196412
URL: http://svn.freebsd.org/changeset/base/196412

Log:
  Check whether the SMBIOS reports reasonable amount of memory.  If it is
  less than "avail memory", fall back to Maxmem to avoid user confusion.
  We use SMBIOS information to display "real memory" since r190599 but
  some broken SMBIOS implementation reported only half of actual memory.
  
  Tested by:	bz
  Approved by:	re (kib)

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Thu Aug 20 22:56:29 2009	(r196411)
+++ head/sys/amd64/amd64/machdep.c	Thu Aug 20 22:58:05 2009	(r196412)
@@ -236,19 +236,21 @@ cpu_startup(dummy)
 #ifdef PERFMON
 	perfmon_init();
 #endif
+	realmem = Maxmem;
+
+	/*
+	 * Display physical memory if SMBIOS reports reasonable amount.
+	 */
+	memsize = 0;
 	sysenv = getenv("smbios.memory.enabled");
 	if (sysenv != NULL) {
-		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
 		freeenv(sysenv);
-	} else
-		memsize = 0;
-	if (memsize > 0)
-		printf("real memory  = %ju (%ju MB)\n", memsize << 10,
-		    memsize >> 10);
-	else
-		printf("real memory  = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
-		    ptoa((uintmax_t)Maxmem) / 1048576);
-	realmem = Maxmem;
+	}
+	if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+		memsize = ptoa((uintmax_t)Maxmem);
+	printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);
+
 	/*
 	 * Display any holes after the first chunk of extended memory.
 	 */

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Thu Aug 20 22:56:29 2009	(r196411)
+++ head/sys/i386/i386/machdep.c	Thu Aug 20 22:58:05 2009	(r196412)
@@ -280,19 +280,21 @@ cpu_startup(dummy)
 #ifdef PERFMON
 	perfmon_init();
 #endif
+	realmem = Maxmem;
+
+	/*
+	 * Display physical memory if SMBIOS reports reasonable amount.
+	 */
+	memsize = 0;
 	sysenv = getenv("smbios.memory.enabled");
 	if (sysenv != NULL) {
-		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
 		freeenv(sysenv);
-	} else
-		memsize = 0;
-	if (memsize > 0)
-		printf("real memory  = %ju (%ju MB)\n", memsize << 10,
-		    memsize >> 10);
-	else
-		printf("real memory  = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
-		    ptoa((uintmax_t)Maxmem) / 1048576);
-	realmem = Maxmem;
+	}
+	if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+		memsize = ptoa((uintmax_t)Maxmem);
+	printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);
+
 	/*
 	 * Display any holes after the first chunk of extended memory.
 	 */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 23:04:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE3FC1065690;
	Thu, 20 Aug 2009 23:04:21 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A26068FC55;
	Thu, 20 Aug 2009 23:04:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KN4LP5002520;
	Thu, 20 Aug 2009 23:04:21 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KN4Lck002517;
	Thu, 20 Aug 2009 23:04:21 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200908202304.n7KN4Lck002517@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 20 Aug 2009 23:04: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: r196413 - in stable/8/sys: . amd64/amd64
	amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica
	contrib/pf dev/xen/xenpci i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 23:04:22 -0000

Author: jkim
Date: Thu Aug 20 23:04:21 2009
New Revision: 196413
URL: http://svn.freebsd.org/changeset/base/196413

Log:
  MFC:	r196412
  
  Check whether the SMBIOS reports reasonable amount of memory.  If it is
  less than "avail memory", fall back to Maxmem to avoid user confusion.
  We use SMBIOS information to display "real memory" since r190599 but
  some broken SMBIOS implementation reported only half of actual memory.
  
  Tested by:	bz
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/machdep.c
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/machdep.c

Modified: stable/8/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/machdep.c	Thu Aug 20 22:58:05 2009	(r196412)
+++ stable/8/sys/amd64/amd64/machdep.c	Thu Aug 20 23:04:21 2009	(r196413)
@@ -236,19 +236,21 @@ cpu_startup(dummy)
 #ifdef PERFMON
 	perfmon_init();
 #endif
+	realmem = Maxmem;
+
+	/*
+	 * Display physical memory if SMBIOS reports reasonable amount.
+	 */
+	memsize = 0;
 	sysenv = getenv("smbios.memory.enabled");
 	if (sysenv != NULL) {
-		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
 		freeenv(sysenv);
-	} else
-		memsize = 0;
-	if (memsize > 0)
-		printf("real memory  = %ju (%ju MB)\n", memsize << 10,
-		    memsize >> 10);
-	else
-		printf("real memory  = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
-		    ptoa((uintmax_t)Maxmem) / 1048576);
-	realmem = Maxmem;
+	}
+	if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+		memsize = ptoa((uintmax_t)Maxmem);
+	printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);
+
 	/*
 	 * Display any holes after the first chunk of extended memory.
 	 */

Modified: stable/8/sys/i386/i386/machdep.c
==============================================================================
--- stable/8/sys/i386/i386/machdep.c	Thu Aug 20 22:58:05 2009	(r196412)
+++ stable/8/sys/i386/i386/machdep.c	Thu Aug 20 23:04:21 2009	(r196413)
@@ -280,19 +280,21 @@ cpu_startup(dummy)
 #ifdef PERFMON
 	perfmon_init();
 #endif
+	realmem = Maxmem;
+
+	/*
+	 * Display physical memory if SMBIOS reports reasonable amount.
+	 */
+	memsize = 0;
 	sysenv = getenv("smbios.memory.enabled");
 	if (sysenv != NULL) {
-		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10);
+		memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
 		freeenv(sysenv);
-	} else
-		memsize = 0;
-	if (memsize > 0)
-		printf("real memory  = %ju (%ju MB)\n", memsize << 10,
-		    memsize >> 10);
-	else
-		printf("real memory  = %ju (%ju MB)\n", ptoa((uintmax_t)Maxmem),
-		    ptoa((uintmax_t)Maxmem) / 1048576);
-	realmem = Maxmem;
+	}
+	if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+		memsize = ptoa((uintmax_t)Maxmem);
+	printf("real memory  = %ju (%ju MB)\n", memsize, memsize >> 20);
+
 	/*
 	 * Display any holes after the first chunk of extended memory.
 	 */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 20 23:07:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2E9EB1065691;
	Thu, 20 Aug 2009 23:07:54 +0000 (UTC)
	(envelope-from peter@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BB3E8FC62;
	Thu, 20 Aug 2009 23:07:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7KN7svi002653;
	Thu, 20 Aug 2009 23:07:54 GMT (envelope-from peter@svn.freebsd.org)
Received: (from peter@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7KN7rPC002652;
	Thu, 20 Aug 2009 23:07:54 GMT (envelope-from peter@svn.freebsd.org)
Message-Id: <200908202307.n7KN7rPC002652@svn.freebsd.org>
From: Peter Wemm 
Date: Thu, 20 Aug 2009 23:07: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: r196414 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 20 Aug 2009 23:07:54 -0000

Author: peter
Date: Thu Aug 20 23:07:53 2009
New Revision: 196414
URL: http://svn.freebsd.org/changeset/base/196414

Log:
  MFC rev 196410 - deal with 'ticks' going negative after 24 days of uptime
  with the default 1000hz clock in the timewait expiration code.
  
  Approved by:    re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/netinet/tcp_timewait.c

Modified: stable/8/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/8/sys/netinet/tcp_timewait.c	Thu Aug 20 23:04:21 2009	(r196413)
+++ stable/8/sys/netinet/tcp_timewait.c	Thu Aug 20 23:07:53 2009	(r196414)
@@ -603,7 +603,7 @@ tcp_tw_2msl_scan(int reuse)
 	INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
 	for (;;) {
 		tw = TAILQ_FIRST(&V_twq_2msl);
-		if (tw == NULL || (!reuse && tw->tw_time > ticks))
+		if (tw == NULL || (!reuse && (tw->tw_time - ticks) > 0))
 			break;
 		INP_WLOCK(tw->tw_inpcb);
 		tcp_twclose(tw, reuse);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 01:00:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F168106568B;
	Fri, 21 Aug 2009 01:00:16 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E2BD8FC57;
	Fri, 21 Aug 2009 01:00:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7L10G2P006601;
	Fri, 21 Aug 2009 01:00:16 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7L10GsI006599;
	Fri, 21 Aug 2009 01:00:16 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200908210100.n7L10GsI006599@svn.freebsd.org>
From: Ken Smith 
Date: Fri, 21 Aug 2009 01:00:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196415 - head/sys/dev/hptrr
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 01:00:16 -0000

Author: kensmith
Date: Fri Aug 21 01:00:15 2009
New Revision: 196415
URL: http://svn.freebsd.org/changeset/base/196415

Log:
  Fix a boot hang for hptrr(4) caused by changes introduced in r195534.
  It is necessary to make sure cpi->transport is set for xpt_scan_bus() to
  work properly.
  
  Submitted by: Bernhard Schmidt (scb+freebsd-current  techwires
                 net)
  Reviewed by:  scottl
  Approved by:  re (kib)

Modified:
  head/sys/dev/hptrr/hptrr_osm_bsd.c

Modified: head/sys/dev/hptrr/hptrr_osm_bsd.c
==============================================================================
--- head/sys/dev/hptrr/hptrr_osm_bsd.c	Thu Aug 20 23:07:53 2009	(r196414)
+++ head/sys/dev/hptrr/hptrr_osm_bsd.c	Fri Aug 21 01:00:15 2009	(r196415)
@@ -814,6 +814,10 @@ static void hpt_action(struct cam_sim *s
 		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
 		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		cpi->transport = XPORT_SPI;
+		cpi->transport_version = 2;
+		cpi->protocol = PROTO_SCSI;
+		cpi->protocol_version = SCSI_REV_2;
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		break;
 	}

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 01:12:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7016E106568B;
	Fri, 21 Aug 2009 01:12:06 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5CFD18FC3D;
	Fri, 21 Aug 2009 01:12:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7L1C6Tb006872;
	Fri, 21 Aug 2009 01:12:06 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7L1C6tJ006870;
	Fri, 21 Aug 2009 01:12:06 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200908210112.n7L1C6tJ006870@svn.freebsd.org>
From: Ken Smith 
Date: Fri, 21 Aug 2009 01:12:06 +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: r196416 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/hptrr dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 01:12:06 -0000

Author: kensmith
Date: Fri Aug 21 01:12:06 2009
New Revision: 196416
URL: http://svn.freebsd.org/changeset/base/196416

Log:
  MFC r196415:
  Fix a boot hang for hptrr(4) caused by changes introduced in r195534.
  It is necessary to make sure cpi->transport is set for xpt_scan_bus() to
  work properly.
  
  Submitted by: Bernhard Schmidt (scb+freebsd-current  techwires
                 net)
  Reviewed by:  scottl
  Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/hptrr/hptrr_osm_bsd.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/hptrr/hptrr_osm_bsd.c
==============================================================================
--- stable/8/sys/dev/hptrr/hptrr_osm_bsd.c	Fri Aug 21 01:00:15 2009	(r196415)
+++ stable/8/sys/dev/hptrr/hptrr_osm_bsd.c	Fri Aug 21 01:12:06 2009	(r196416)
@@ -814,6 +814,10 @@ static void hpt_action(struct cam_sim *s
 		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
 		strncpy(cpi->hba_vid, "HPT   ", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+		cpi->transport = XPORT_SPI;
+		cpi->transport_version = 2;
+		cpi->protocol = PROTO_SCSI;
+		cpi->protocol_version = SCSI_REV_2;
 		cpi->ccb_h.status = CAM_REQ_CMP;
 		break;
 	}

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 02:59:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E233E1065698;
	Fri, 21 Aug 2009 02:59:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D0EE58FC64;
	Fri, 21 Aug 2009 02:59:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7L2x7RJ008958;
	Fri, 21 Aug 2009 02:59:07 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7L2x7oc008957;
	Fri, 21 Aug 2009 02:59:07 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908210259.n7L2x7oc008957@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 21 Aug 2009 02:59:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196417 - in head: share/man/man9 sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 02:59:08 -0000

Author: jhb
Date: Fri Aug 21 02:59:07 2009
New Revision: 196417
URL: http://svn.freebsd.org/changeset/base/196417

Log:
  This patch fixes two bugs in sglist(9) and improves robustness of the API via
  better semantics if a request to append an address range to an existing list
  fails.
  - When cloning an sglist, properly set the length in the new sglist instead of
    leaving the new list empty.
  - Properly compute the amount of data added to an sglist via
    _sglist_append_buf().  This allows sglist_consume_uio() to properly update
    uio_resid.
  - When a request to append an address range to a scatter/gather list fails,
    restore the sglist to the state it had at the start of the function call
    instead of resetting it to an empty list.
  
  Requested by:	np (3)
  Approved by:	re (kib)

Modified:
  head/share/man/man9/sglist.9
  head/sys/kern/subr_sglist.c

Modified: head/share/man/man9/sglist.9
==============================================================================
--- head/share/man/man9/sglist.9	Fri Aug 21 01:12:06 2009	(r196416)
+++ head/share/man/man9/sglist.9	Fri Aug 21 02:59:07 2009	(r196417)
@@ -191,6 +191,8 @@ Specifically, the
 family of routines can be used to append the physical address ranges described
 by an object to the end of a scatter/gather list.
 All of these routines return 0 on success or an error on failure.
+If a request to append an address range to a scatter/gather list fails,
+the scatter/gather list will remain unchanged.
 .Pp
 The
 .Nm sglist_append
@@ -445,6 +447,7 @@ There are not enough available segments 
 to append the physical address ranges from
 .Fa second .
 .El
+.Pp
 The
 .Nm sglist_slice
 function returns the following errors on failure:
@@ -470,6 +473,7 @@ list in
 .Fa *slice
 to describe the requested physical address ranges.
 .El
+.Pp
 The
 .Nm sglist_split
 function returns the following errors on failure:

Modified: head/sys/kern/subr_sglist.c
==============================================================================
--- head/sys/kern/subr_sglist.c	Fri Aug 21 01:12:06 2009	(r196416)
+++ head/sys/kern/subr_sglist.c	Fri Aug 21 02:59:07 2009	(r196417)
@@ -48,6 +48,32 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_SGLIST, "sglist", "scatter/gather lists");
 
 /*
+ * Convenience macros to save the state of an sglist so it can be restored
+ * if an append attempt fails.  Since sglist's only grow we only need to
+ * save the current count of segments and the length of the ending segment.
+ * Earlier segments will not be changed by an append, and the only change
+ * that can occur to the ending segment is that it can be extended.
+ */
+struct sgsave {
+	u_short sg_nseg;
+	size_t ss_len;
+};
+
+#define	SGLIST_SAVE(sg, sgsave) do {					\
+	(sgsave).sg_nseg = (sg)->sg_nseg;				\
+	if ((sgsave).sg_nseg > 0)					\
+		(sgsave).ss_len = (sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len; \
+	else								\
+		(sgsave).ss_len = 0;					\
+} while (0)
+
+#define	SGLIST_RESTORE(sg, sgsave) do {					\
+	(sg)->sg_nseg = (sgsave).sg_nseg;				\
+	if ((sgsave).sg_nseg > 0)					\
+		(sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len = (sgsave).ss_len; \
+} while (0)
+
+/*
  * Append a single (paddr, len) to a sglist.  sg is the list and ss is
  * the current segment in the list.  If we run out of segments then
  * EFBIG will be returned.
@@ -62,10 +88,8 @@ _sglist_append_range(struct sglist *sg, 
 	if (ss->ss_paddr + ss->ss_len == paddr)
 		ss->ss_len += len;
 	else {
-		if (sg->sg_nseg == sg->sg_maxseg) {
-			sg->sg_nseg = 0;
+		if (sg->sg_nseg == sg->sg_maxseg)
 			return (EFBIG);
-		}
 		ss++;
 		ss->ss_paddr = paddr;
 		ss->ss_len = len;
@@ -107,26 +131,33 @@ _sglist_append_buf(struct sglist *sg, vo
 		ss->ss_paddr = paddr;
 		ss->ss_len = seglen;
 		sg->sg_nseg = 1;
-		error = 0;
 	} else {
 		ss = &sg->sg_segs[sg->sg_nseg - 1];
 		error = _sglist_append_range(sg, &ss, paddr, seglen);
+		if (error)
+			return (error);
 	}
+	vaddr += seglen;
+	len -= seglen;
+	if (donep)
+		*donep += seglen;
 
-	while (error == 0 && len > seglen) {
-		vaddr += seglen;
-		len -= seglen;
-		if (donep)
-			*donep += seglen;
+	while (len > 0) {
 		seglen = MIN(len, PAGE_SIZE);
 		if (pmap != NULL)
 			paddr = pmap_extract(pmap, vaddr);
 		else
 			paddr = pmap_kextract(vaddr);
 		error = _sglist_append_range(sg, &ss, paddr, seglen);
+		if (error)
+			return (error);
+		vaddr += seglen;
+		len -= seglen;
+		if (donep)
+			*donep += seglen;
 	}
 
-	return (error);
+	return (0);
 }
 
 /*
@@ -195,10 +226,16 @@ sglist_free(struct sglist *sg)
 int
 sglist_append(struct sglist *sg, void *buf, size_t len)
 {
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
-	return (_sglist_append_buf(sg, buf, len, NULL, NULL));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_buf(sg, buf, len, NULL, NULL);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -209,6 +246,8 @@ int
 sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len)
 {
 	struct sglist_seg *ss;
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
@@ -222,7 +261,11 @@ sglist_append_phys(struct sglist *sg, vm
 		return (0);
 	}
 	ss = &sg->sg_segs[sg->sg_nseg - 1];
-	return (_sglist_append_range(sg, &ss, paddr, len));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_range(sg, &ss, paddr, len);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -233,6 +276,7 @@ sglist_append_phys(struct sglist *sg, vm
 int
 sglist_append_mbuf(struct sglist *sg, struct mbuf *m0)
 {
+	struct sgsave save;
 	struct mbuf *m;
 	int error;
 
@@ -240,11 +284,14 @@ sglist_append_mbuf(struct sglist *sg, st
 		return (EINVAL);
 
 	error = 0;
+	SGLIST_SAVE(sg, save);
 	for (m = m0; m != NULL; m = m->m_next) {
 		if (m->m_len > 0) {
 			error = sglist_append(sg, m->m_data, m->m_len);
-			if (error)
+			if (error) {
+				SGLIST_RESTORE(sg, save);
 				return (error);
+			}
 		}
 	}
 	return (0);
@@ -258,11 +305,17 @@ sglist_append_mbuf(struct sglist *sg, st
 int
 sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td)
 {
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
-	return (_sglist_append_buf(sg, buf, len,
-	    vmspace_pmap(td->td_proc->p_vmspace), NULL));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_buf(sg, buf, len,
+	    vmspace_pmap(td->td_proc->p_vmspace), NULL);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -274,6 +327,7 @@ int
 sglist_append_uio(struct sglist *sg, struct uio *uio)
 {
 	struct iovec *iov;
+	struct sgsave save;
 	size_t resid, minlen;
 	pmap_t pmap;
 	int error, i;
@@ -292,6 +346,7 @@ sglist_append_uio(struct sglist *sg, str
 		pmap = NULL;
 
 	error = 0;
+	SGLIST_SAVE(sg, save);
 	for (i = 0; i < uio->uio_iovcnt && resid != 0; i++) {
 		/*
 		 * Now at the first iovec to load.  Load each iovec
@@ -301,8 +356,10 @@ sglist_append_uio(struct sglist *sg, str
 		if (minlen > 0) {
 			error = _sglist_append_buf(sg, iov[i].iov_base, minlen,
 			    pmap, NULL);
-			if (error)
+			if (error) {
+				SGLIST_RESTORE(sg, save);
 				return (error);
+			}
 			resid -= minlen;
 		}
 	}
@@ -397,6 +454,7 @@ sglist_clone(struct sglist *sg, int mfla
 	new = sglist_alloc(sg->sg_maxseg, mflags);
 	if (new == NULL)
 		return (NULL);
+	new->sg_nseg = sg->sg_nseg;
 	bcopy(sg->sg_segs, new->sg_segs, sizeof(struct sglist_seg) *
 	    sg->sg_nseg);
 	return (new);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 03:14:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38A8B106568E;
	Fri, 21 Aug 2009 03:14:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 24DA58FC75;
	Fri, 21 Aug 2009 03:14:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7L3Eef9009629;
	Fri, 21 Aug 2009 03:14:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7L3EeTW009626;
	Fri, 21 Aug 2009 03:14:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908210314.n7L3EeTW009626@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 21 Aug 2009 03:14:40 +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: r196418 - in stable/8: share/man/man9 sys
	sys/amd64/include/xen sys/cddl/contrib/opensolaris
	sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 03:14:40 -0000

Author: jhb
Date: Fri Aug 21 03:14:39 2009
New Revision: 196418
URL: http://svn.freebsd.org/changeset/base/196418

Log:
  MFC 196417:
  This patch fixes two bugs in sglist(9) and improves robustness of the API via
  better semantics if a request to append an address range to an existing list
  fails.
  - When cloning an sglist, properly set the length in the new sglist instead of
    leaving the new list empty.
  - Properly compute the amount of data added to an sglist via
    _sglist_append_buf().  This allows sglist_consume_uio() to properly update
    uio_resid.
  - When a request to append an address range to a scatter/gather list fails,
    restore the sglist to the state it had at the start of the function call
    instead of resetting it to an empty list.
  
  Approved by:	re (kib)

Modified:
  stable/8/share/man/man9/   (props changed)
  stable/8/share/man/man9/sglist.9
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/kern/subr_sglist.c

Modified: stable/8/share/man/man9/sglist.9
==============================================================================
--- stable/8/share/man/man9/sglist.9	Fri Aug 21 02:59:07 2009	(r196417)
+++ stable/8/share/man/man9/sglist.9	Fri Aug 21 03:14:39 2009	(r196418)
@@ -191,6 +191,8 @@ Specifically, the
 family of routines can be used to append the physical address ranges described
 by an object to the end of a scatter/gather list.
 All of these routines return 0 on success or an error on failure.
+If a request to append an address range to a scatter/gather list fails,
+the scatter/gather list will remain unchanged.
 .Pp
 The
 .Nm sglist_append
@@ -445,6 +447,7 @@ There are not enough available segments 
 to append the physical address ranges from
 .Fa second .
 .El
+.Pp
 The
 .Nm sglist_slice
 function returns the following errors on failure:
@@ -470,6 +473,7 @@ list in
 .Fa *slice
 to describe the requested physical address ranges.
 .El
+.Pp
 The
 .Nm sglist_split
 function returns the following errors on failure:

Modified: stable/8/sys/kern/subr_sglist.c
==============================================================================
--- stable/8/sys/kern/subr_sglist.c	Fri Aug 21 02:59:07 2009	(r196417)
+++ stable/8/sys/kern/subr_sglist.c	Fri Aug 21 03:14:39 2009	(r196418)
@@ -48,6 +48,32 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_SGLIST, "sglist", "scatter/gather lists");
 
 /*
+ * Convenience macros to save the state of an sglist so it can be restored
+ * if an append attempt fails.  Since sglist's only grow we only need to
+ * save the current count of segments and the length of the ending segment.
+ * Earlier segments will not be changed by an append, and the only change
+ * that can occur to the ending segment is that it can be extended.
+ */
+struct sgsave {
+	u_short sg_nseg;
+	size_t ss_len;
+};
+
+#define	SGLIST_SAVE(sg, sgsave) do {					\
+	(sgsave).sg_nseg = (sg)->sg_nseg;				\
+	if ((sgsave).sg_nseg > 0)					\
+		(sgsave).ss_len = (sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len; \
+	else								\
+		(sgsave).ss_len = 0;					\
+} while (0)
+
+#define	SGLIST_RESTORE(sg, sgsave) do {					\
+	(sg)->sg_nseg = (sgsave).sg_nseg;				\
+	if ((sgsave).sg_nseg > 0)					\
+		(sg)->sg_segs[(sgsave).sg_nseg - 1].ss_len = (sgsave).ss_len; \
+} while (0)
+
+/*
  * Append a single (paddr, len) to a sglist.  sg is the list and ss is
  * the current segment in the list.  If we run out of segments then
  * EFBIG will be returned.
@@ -62,10 +88,8 @@ _sglist_append_range(struct sglist *sg, 
 	if (ss->ss_paddr + ss->ss_len == paddr)
 		ss->ss_len += len;
 	else {
-		if (sg->sg_nseg == sg->sg_maxseg) {
-			sg->sg_nseg = 0;
+		if (sg->sg_nseg == sg->sg_maxseg)
 			return (EFBIG);
-		}
 		ss++;
 		ss->ss_paddr = paddr;
 		ss->ss_len = len;
@@ -107,26 +131,33 @@ _sglist_append_buf(struct sglist *sg, vo
 		ss->ss_paddr = paddr;
 		ss->ss_len = seglen;
 		sg->sg_nseg = 1;
-		error = 0;
 	} else {
 		ss = &sg->sg_segs[sg->sg_nseg - 1];
 		error = _sglist_append_range(sg, &ss, paddr, seglen);
+		if (error)
+			return (error);
 	}
+	vaddr += seglen;
+	len -= seglen;
+	if (donep)
+		*donep += seglen;
 
-	while (error == 0 && len > seglen) {
-		vaddr += seglen;
-		len -= seglen;
-		if (donep)
-			*donep += seglen;
+	while (len > 0) {
 		seglen = MIN(len, PAGE_SIZE);
 		if (pmap != NULL)
 			paddr = pmap_extract(pmap, vaddr);
 		else
 			paddr = pmap_kextract(vaddr);
 		error = _sglist_append_range(sg, &ss, paddr, seglen);
+		if (error)
+			return (error);
+		vaddr += seglen;
+		len -= seglen;
+		if (donep)
+			*donep += seglen;
 	}
 
-	return (error);
+	return (0);
 }
 
 /*
@@ -195,10 +226,16 @@ sglist_free(struct sglist *sg)
 int
 sglist_append(struct sglist *sg, void *buf, size_t len)
 {
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
-	return (_sglist_append_buf(sg, buf, len, NULL, NULL));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_buf(sg, buf, len, NULL, NULL);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -209,6 +246,8 @@ int
 sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len)
 {
 	struct sglist_seg *ss;
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
@@ -222,7 +261,11 @@ sglist_append_phys(struct sglist *sg, vm
 		return (0);
 	}
 	ss = &sg->sg_segs[sg->sg_nseg - 1];
-	return (_sglist_append_range(sg, &ss, paddr, len));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_range(sg, &ss, paddr, len);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -233,6 +276,7 @@ sglist_append_phys(struct sglist *sg, vm
 int
 sglist_append_mbuf(struct sglist *sg, struct mbuf *m0)
 {
+	struct sgsave save;
 	struct mbuf *m;
 	int error;
 
@@ -240,11 +284,14 @@ sglist_append_mbuf(struct sglist *sg, st
 		return (EINVAL);
 
 	error = 0;
+	SGLIST_SAVE(sg, save);
 	for (m = m0; m != NULL; m = m->m_next) {
 		if (m->m_len > 0) {
 			error = sglist_append(sg, m->m_data, m->m_len);
-			if (error)
+			if (error) {
+				SGLIST_RESTORE(sg, save);
 				return (error);
+			}
 		}
 	}
 	return (0);
@@ -258,11 +305,17 @@ sglist_append_mbuf(struct sglist *sg, st
 int
 sglist_append_user(struct sglist *sg, void *buf, size_t len, struct thread *td)
 {
+	struct sgsave save;
+	int error;
 
 	if (sg->sg_maxseg == 0)
 		return (EINVAL);
-	return (_sglist_append_buf(sg, buf, len,
-	    vmspace_pmap(td->td_proc->p_vmspace), NULL));
+	SGLIST_SAVE(sg, save);
+	error = _sglist_append_buf(sg, buf, len,
+	    vmspace_pmap(td->td_proc->p_vmspace), NULL);
+	if (error)
+		SGLIST_RESTORE(sg, save);
+	return (error);
 }
 
 /*
@@ -274,6 +327,7 @@ int
 sglist_append_uio(struct sglist *sg, struct uio *uio)
 {
 	struct iovec *iov;
+	struct sgsave save;
 	size_t resid, minlen;
 	pmap_t pmap;
 	int error, i;
@@ -292,6 +346,7 @@ sglist_append_uio(struct sglist *sg, str
 		pmap = NULL;
 
 	error = 0;
+	SGLIST_SAVE(sg, save);
 	for (i = 0; i < uio->uio_iovcnt && resid != 0; i++) {
 		/*
 		 * Now at the first iovec to load.  Load each iovec
@@ -301,8 +356,10 @@ sglist_append_uio(struct sglist *sg, str
 		if (minlen > 0) {
 			error = _sglist_append_buf(sg, iov[i].iov_base, minlen,
 			    pmap, NULL);
-			if (error)
+			if (error) {
+				SGLIST_RESTORE(sg, save);
 				return (error);
+			}
 			resid -= minlen;
 		}
 	}
@@ -397,6 +454,7 @@ sglist_clone(struct sglist *sg, int mfla
 	new = sglist_alloc(sg->sg_maxseg, mflags);
 	if (new == NULL)
 		return (NULL);
+	new->sg_nseg = sg->sg_nseg;
 	bcopy(sg->sg_segs, new->sg_segs, sizeof(struct sglist_seg) *
 	    sg->sg_nseg);
 	return (new);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 05:49:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC56A1065690
	for ; Fri, 21 Aug 2009 05:49:17 +0000 (UTC)
	(envelope-from ubm.freebsd@googlemail.com)
Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com
	[209.85.220.210])
	by mx1.freebsd.org (Postfix) with ESMTP id 36BC08FC3D
	for ; Fri, 21 Aug 2009 05:49:17 +0000 (UTC)
Received: by mail-fx0-f210.google.com with SMTP id 6so278203fxm.43
	for ; Thu, 20 Aug 2009 22:49:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=gamma;
	h=domainkey-signature:received:received:date:from:to:subject
	:message-id:in-reply-to:references:x-mailer:mime-version
	:content-type:content-transfer-encoding;
	bh=c+Z49G1PkHBxSrJdp6yia278l1x/oFBPtpxiFhjk5fo=;
	b=mVW3fMwOb+T6TGBAdiopzT2DOHB7pdbh2mkuQbOn3ul4N1NQ6/U8HfFBrcd0kmDUCu
	rw9Lud8l1xExvbngWb0pOfOlU54rN1wgIX/xaIdokD82n5z/zg4h+Bymqq9L2a/THQSu
	Al8cawjIVHe6EYT1k8oqRiTXzdUJvIe9XZW4w=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma;
	h=date:from:to:subject:message-id:in-reply-to:references:x-mailer
	:mime-version:content-type:content-transfer-encoding;
	b=MGkI00S9Bw7y4RwmrCuh1MzFVcQmjY9OYl5lf/lltVcFls8ffzPhXi/2Fi6+4gQVnL
	oqUcc0RlCAltPqr/8bV3O8LNmCU0eBzX0bdorIZAx5UN/lHpSjYhKSFyUhbunccHmsTX
	r73XDXic1pFPQxCaPljwyJ54FDUTjkB+qJrdI=
Received: by 10.204.13.195 with SMTP id d3mr532062bka.135.1250832345533;
	Thu, 20 Aug 2009 22:25:45 -0700 (PDT)
Received: from ubm.mine.nu (e181020234.adsl.alicedsl.de [85.181.20.234])
	by mx.google.com with ESMTPS id p17sm2573922fka.42.2009.08.20.22.25.44
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Thu, 20 Aug 2009 22:25:45 -0700 (PDT)
Date: Fri, 21 Aug 2009 07:25:43 +0200
From: Marc UBM 
To: svn-src-all@freebsd.org
Message-Id: <20090821072543.e5fc23fc.ubm.freebsd@gmail.com>
In-Reply-To: <200908210112.n7L1C6tJ006870@svn.freebsd.org>
References: <200908210112.n7L1C6tJ006870@svn.freebsd.org>
X-Mailer: Sylpheed 2.7.0 (GTK+ 2.16.4; i386-portbld-freebsd8.0)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: svn commit: r196416 - in stable/8/sys: . amd64/include/xen
 cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/hptrr
 dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 05:49:17 -0000

On Fri, 21 Aug 2009 01:12:06 +0000 (UTC)
Ken Smith  wrote:

> Author: kensmith
> Date: Fri Aug 21 01:12:06 2009
> New Revision: 196416
> URL: http://svn.freebsd.org/changeset/base/196416
> 
> Log:
>   MFC r196415:
>   Fix a boot hang for hptrr(4) caused by changes introduced in
> r195534. It is necessary to make sure cpi->transport is set for
> xpt_scan_bus() to work properly.

Yay! :-)

Thanks to all who helped fixing this!

Bye
Marc

-- 
Marc "UBM" Bocklet 

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 09:22:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D17201065697;
	Fri, 21 Aug 2009 09:22:32 +0000 (UTC)
	(envelope-from julian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0B158FC83;
	Fri, 21 Aug 2009 09:22:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7L9MW12017083;
	Fri, 21 Aug 2009 09:22:32 GMT (envelope-from julian@svn.freebsd.org)
Received: (from julian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7L9MWje017082;
	Fri, 21 Aug 2009 09:22:32 GMT (envelope-from julian@svn.freebsd.org)
Message-Id: <200908210922.n7L9MWje017082@svn.freebsd.org>
From: Julian Elischer 
Date: Fri, 21 Aug 2009 09:22:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196419 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 09:22:32 -0000

Author: julian
Date: Fri Aug 21 09:22:32 2009
New Revision: 196419
URL: http://svn.freebsd.org/changeset/base/196419

Log:
  Don't allow access to the internals until it has all been set up.
  Specifically, not until the per-vnet parts have been set up.
  
  Submitted by:	kmacy@
  Reviewed by:	julian@, zec@
  Approved by:	re(rwatson)
  MFC after:	immediately

Modified:
  head/sys/net/flowtable.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Fri Aug 21 03:14:39 2009	(r196418)
+++ head/sys/net/flowtable.c	Fri Aug 21 09:22:32 2009	(r196419)
@@ -999,6 +999,7 @@ flowtable_init_vnet(const void *unused _
 	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
 	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
 	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
+	V_flowtable_ready = 1;
 }
 VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE,
     flowtable_init_vnet, NULL);
@@ -1011,7 +1012,6 @@ flowtable_init(const void *unused __unus
 	mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF);
 	EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL,
 	    EVENTHANDLER_PRI_ANY);
-	V_flowtable_ready = 1;
 }
 SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
     flowtable_init, NULL);
@@ -1022,6 +1022,7 @@ static void
 flowtable_uninit(const void *unused __unused)
 {
 
+	V_flowtable_ready = 0;
 	uma_zdestroy(V_flow_ipv4_zone);
 	uma_zdestroy(V_flow_ipv6_zone);
 }

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 10:05:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8CC2B106568C;
	Fri, 21 Aug 2009 10:05:27 +0000 (UTC)
	(envelope-from julian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7AB748FC66;
	Fri, 21 Aug 2009 10:05:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LA5RKa018023;
	Fri, 21 Aug 2009 10:05:27 GMT (envelope-from julian@svn.freebsd.org)
Received: (from julian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LA5RUu018021;
	Fri, 21 Aug 2009 10:05:27 GMT (envelope-from julian@svn.freebsd.org)
Message-Id: <200908211005.n7LA5RUu018021@svn.freebsd.org>
From: Julian Elischer 
Date: Fri, 21 Aug 2009 10:05: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: r196420 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 10:05:27 -0000

Author: julian
Date: Fri Aug 21 10:05:26 2009
New Revision: 196420
URL: http://svn.freebsd.org/changeset/base/196420

Log:
  MFC r196419:
    Don't allow access to the internals until it has all been set up.
    Specifically, not until the per-vnet parts have been set up.
  
  Submitted by:	kmacy@
  Reviewed by:	julian@, zec@
  Approved by:	re(rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/net/flowtable.c

Modified: stable/8/sys/net/flowtable.c
==============================================================================
--- stable/8/sys/net/flowtable.c	Fri Aug 21 09:22:32 2009	(r196419)
+++ stable/8/sys/net/flowtable.c	Fri Aug 21 10:05:26 2009	(r196420)
@@ -999,6 +999,7 @@ flowtable_init_vnet(const void *unused _
 	    NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET);	
 	uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows);
 	uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows);
+	V_flowtable_ready = 1;
 }
 VNET_SYSINIT(flowtable_init_vnet, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE,
     flowtable_init_vnet, NULL);
@@ -1011,7 +1012,6 @@ flowtable_init(const void *unused __unus
 	mtx_init(&flowclean_lock, "flowclean lock", NULL, MTX_DEF);
 	EVENTHANDLER_REGISTER(ifnet_departure_event, flowtable_flush, NULL,
 	    EVENTHANDLER_PRI_ANY);
-	V_flowtable_ready = 1;
 }
 SYSINIT(flowtable_init, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY,
     flowtable_init, NULL);
@@ -1022,6 +1022,7 @@ static void
 flowtable_uninit(const void *unused __unused)
 {
 
+	V_flowtable_ready = 0;
 	uma_zdestroy(V_flow_ipv4_zone);
 	uma_zdestroy(V_flow_ipv6_zone);
 }

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 11:13:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AAFD106568E;
	Fri, 21 Aug 2009 11:13:57 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B7488FC52;
	Fri, 21 Aug 2009 11:13:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LBDu3Z020899;
	Fri, 21 Aug 2009 11:13:56 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LBDuco020898;
	Fri, 21 Aug 2009 11:13:56 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908211113.n7LBDuco020898@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 21 Aug 2009 11:13:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196421 - head/tools/tools/vimage
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 11:13:57 -0000

Author: zec
Date: Fri Aug 21 11:13:56 2009
New Revision: 196421
URL: http://svn.freebsd.org/changeset/base/196421

Log:
  Bugfix: all requests for creating vnets via vimage -c were always
  reported as failures, even if the actual library / system call
  would succeed, because error message would be reported if the return
  value from jail_setv() call was >= 0, and if not, then if that same
  value was < 0, i.e. always.  The correct behavior is to abort (only)
  if jail_setv() returns < 0.
  
  Approved by:	re (rwatson), julian (mentor)

Modified:
  head/tools/tools/vimage/vimage.c

Modified: head/tools/tools/vimage/vimage.c
==============================================================================
--- head/tools/tools/vimage/vimage.c	Fri Aug 21 10:05:26 2009	(r196420)
+++ head/tools/tools/vimage/vimage.c	Fri Aug 21 11:13:56 2009	(r196421)
@@ -252,7 +252,7 @@ main(int argc, char **argv)
 		exit(0);
 
 	case VI_CREATE:
-		if ((jid = jail_setv(JAIL_CREATE,
+		if (jail_setv(JAIL_CREATE,
 		    "name", argv[0],
 		    "vnet", NULL,
 		    "host", NULL,
@@ -260,9 +260,7 @@ main(int argc, char **argv)
 		    "allow.raw_sockets", "true",
 		    "allow.socket_af", "true",
 		    "allow.mount", "true",
-		    NULL)) >= 0)
-				break;
-		if (jid < 0)
+		    NULL) < 0)
 			break;
 		if (argc == 1)
 			exit(0);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 11:17:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4905106568D;
	Fri, 21 Aug 2009 11:17:25 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C48CA8FC51;
	Fri, 21 Aug 2009 11:17:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LBHPLJ021024;
	Fri, 21 Aug 2009 11:17:25 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LBHPMV021022;
	Fri, 21 Aug 2009 11:17:25 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908211117.n7LBHPMV021022@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 21 Aug 2009 11:17:25 +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: r196422 - stable/8/tools/tools/vimage
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 11:17:25 -0000

Author: zec
Date: Fri Aug 21 11:17:25 2009
New Revision: 196422
URL: http://svn.freebsd.org/changeset/base/196422

Log:
  MFC r196421:
  
    Bugfix: all requests for creating vnets via vimage -c were always
    reported as failures, even if the actual library / system call
    would succeed, because error message would be reported if the return
    value from jail_setv() call was >= 0, and if not, then if that same
    value was < 0, i.e. always.  The correct behavior is to abort (only)
    if jail_setv() returns < 0.
  
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/tools/tools/vimage/   (props changed)
  stable/8/tools/tools/vimage/vimage.c

Modified: stable/8/tools/tools/vimage/vimage.c
==============================================================================
--- stable/8/tools/tools/vimage/vimage.c	Fri Aug 21 11:13:56 2009	(r196421)
+++ stable/8/tools/tools/vimage/vimage.c	Fri Aug 21 11:17:25 2009	(r196422)
@@ -252,7 +252,7 @@ main(int argc, char **argv)
 		exit(0);
 
 	case VI_CREATE:
-		if ((jid = jail_setv(JAIL_CREATE,
+		if (jail_setv(JAIL_CREATE,
 		    "name", argv[0],
 		    "vnet", NULL,
 		    "host", NULL,
@@ -260,9 +260,7 @@ main(int argc, char **argv)
 		    "allow.raw_sockets", "true",
 		    "allow.socket_af", "true",
 		    "allow.mount", "true",
-		    NULL)) >= 0)
-				break;
-		if (jid < 0)
+		    NULL) < 0)
 			break;
 		if (argc == 1)
 			exit(0);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 11:20:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A1511106568D;
	Fri, 21 Aug 2009 11:20:10 +0000 (UTC)
	(envelope-from julian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 90D758FC16;
	Fri, 21 Aug 2009 11:20:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LBKACt021135;
	Fri, 21 Aug 2009 11:20:10 GMT (envelope-from julian@svn.freebsd.org)
Received: (from julian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LBKAjw021131;
	Fri, 21 Aug 2009 11:20:10 GMT (envelope-from julian@svn.freebsd.org)
Message-Id: <200908211120.n7LBKAjw021131@svn.freebsd.org>
From: Julian Elischer 
Date: Fri, 21 Aug 2009 11:20:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196423 - in head/sys/netinet: . ipfw
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 11:20:10 -0000

Author: julian
Date: Fri Aug 21 11:20:10 2009
New Revision: 196423
URL: http://svn.freebsd.org/changeset/base/196423

Log:
  Fix ipfw's initialization functions to get the correct order of evaluation
  to allow vnet and non vnet operation. Move some functions from ip_fw_pfil.c
  to ip_fw2.c and mode to mostly using the SYSINIT and VNET_SYSINIT handlers
  instead of the modevent handler. Correct some spelling errors in comments
  in the affected code. Note this bug fixes a crash in NON VIMAGE kernels when
  ipfw is unloaded.
  
  This patch is a minimal patch for 8.0
  I have a much larger patch that actually fixes the underlying problems
  that will be applied after 8.0
  
  Reviewed by:	zec@, rwatson@, bz@(earlier version)
  Approved by:	re (rwatson)
  MFC after:	Immediatly

Modified:
  head/sys/netinet/ip_fw.h
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_pfil.c

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Fri Aug 21 11:17:25 2009	(r196422)
+++ head/sys/netinet/ip_fw.h	Fri Aug 21 11:20:10 2009	(r196423)
@@ -645,8 +645,10 @@ int ipfw_check_out(void *, struct mbuf *
 
 int ipfw_chk(struct ip_fw_args *);
 
-int ipfw_init(void);
-void ipfw_destroy(void);
+int ipfw_hook(void);
+int ipfw6_hook(void);
+int ipfw_unhook(void);
+int ipfw6_unhook(void);
 #ifdef NOTYET
 void ipfw_nat_destroy(void);
 #endif

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Fri Aug 21 11:17:25 2009	(r196422)
+++ head/sys/netinet/ipfw/ip_fw2.c	Fri Aug 21 11:20:10 2009	(r196423)
@@ -102,6 +102,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static VNET_DEFINE(int, ipfw_vnet_ready) = 0;
+#define	V_ipfw_vnet_ready	VNET(ipfw_vnet_ready)
 /*
  * set_disable contains one bit per set value (0..31).
  * If the bit is set, all rules with the corresponding set
@@ -2237,7 +2239,7 @@ ipfw_chk(struct ip_fw_args *args)
 	/* end of ipv6 variables */
 	int is_ipv4 = 0;
 
-	if (m->m_flags & M_SKIP_FIREWALL)
+	if (m->m_flags & M_SKIP_FIREWALL || (! V_ipfw_vnet_ready))
 		return (IP_FW_PASS);	/* accept */
 
 	dst_ip.s_addr = 0;		/* make sure it is initialized */
@@ -4579,12 +4581,10 @@ done:
 	CURVNET_RESTORE();
 }
 
-
-
 /****************
  * Stuff that must be initialised only on boot or module load
  */
-int
+static int
 ipfw_init(void)
 {
 	int error = 0;
@@ -4623,9 +4623,11 @@ ipfw_init(void)
 		default_to_accept ? "accept" : "deny");
 
 	/*
-	 * Note: V_xxx variables can be accessed here but the iattach()
-     	 * may not have been called yet for the VIMGE case.
-	 * Tuneables will have been processed.
+	 * Note: V_xxx variables can be accessed here but the vnet specific
+	 * initializer may not have been called yet for the VIMAGE case.
+	 * Tuneables will have been processed. We will print out values for
+	 * the default vnet. 
+	 * XXX This should all be rationalized AFTER 8.0
 	 */
 	if (V_fw_verbose == 0)
 		printf("disabled\n");
@@ -4636,6 +4638,20 @@ ipfw_init(void)
 		    V_verbose_limit);
 
 	/*
+	 * Hook us up to pfil.
+	 * Eventually pfil will be per vnet.
+	 */
+	if ((error = ipfw_hook()) != 0) {
+		printf("ipfw_hook() error\n");
+		return (error);
+	}
+#ifdef INET6
+	if ((error = ipfw6_hook()) != 0) {
+		printf("ipfw6_hook() error\n");
+		return (error);
+	}
+#endif
+	/*
 	 * Other things that are only done the first time.
 	 * (now that we a re cuaranteed of success).
 	 */
@@ -4645,8 +4661,8 @@ ipfw_init(void)
 }
 
 /****************
- * Stuff that must be initialised for every instance
- * (including the forst of course).
+ * Stuff that must be initialized for every instance
+ * (including the first of course).
  */
 static int
 vnet_ipfw_init(const void *unused)
@@ -4726,17 +4742,17 @@ vnet_ipfw_init(const void *unused)
 #endif
 
 	/* First set up some values that are compile time options */
+	V_ipfw_vnet_ready = 1;		/* Open for business */
 	return (0);
 }
 
 /**********************
  * Called for the removal of the last instance only on module unload.
  */
-void
+static void
 ipfw_destroy(void)
 {
-	ip_fw_chk_ptr = NULL;
-	ip_fw_ctl_ptr = NULL;
+
 	uma_zdestroy(ipfw_dyn_rule_zone);
 	IPFW_DYN_LOCK_DESTROY();
 	printf("IP firewall unloaded\n");
@@ -4750,7 +4766,9 @@ vnet_ipfw_uninit(const void *unused)
 {
 	struct ip_fw *reap;
 
+	V_ipfw_vnet_ready = 0; /* tell new callers to go away */
 	callout_drain(&V_ipfw_timeout);
+	/* We wait on the wlock here until the last user leaves */
 	IPFW_WLOCK(&V_layer3_chain);
 	flush_tables(&V_layer3_chain);
 	V_layer3_chain.reap = NULL;
@@ -4766,10 +4784,86 @@ vnet_ipfw_uninit(const void *unused)
 	return 0;
 }
 
-VNET_SYSINIT(vnet_ipfw_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
-    vnet_ipfw_init, NULL);
+/*
+ * Module event handler.
+ * In general we have the choice of handling most of these events by the
+ * event handler or by the (VNET_)SYS(UN)INIT handlers. I have chosen to
+ * use the SYSINIT handlers as they are more capable of expressing the
+ * flow of control during module and vnet operations, so this is just
+ * a skeleton. Note there is no SYSINIT equivalent of the module
+ * SHUTDOWN handler, but we don't have anything to do in that case anyhow.
+ */
+static int
+ipfw_modevent(module_t mod, int type, void *unused)
+{
+	int err = 0;
+
+	switch (type) {
+	case MOD_LOAD:
+		/* Called once at module load or
+	 	 * system boot if compiled in. */
+		break;
+	case MOD_UNLOAD:
+		break;
+	case MOD_QUIESCE:
+		/* Yes, the unhooks can return errors, we can safely ignore
+		 * them. Eventually these will be done per jail as they
+		 * shut down. We will wait on each vnet's l3 lock as existing
+		 * callers go away.
+		 */
+		ipfw_unhook();
+#ifdef INET6
+		ipfw6_unhook();
+#endif
+		/* layer2 and other entrypoints still come in this way. */
+		ip_fw_chk_ptr = NULL;
+		ip_fw_ctl_ptr = NULL;
+		/* Called during unload. */
+		break;
+	case MOD_SHUTDOWN:
+		/* Called during system shutdown. */
+		break;
+	default:
+		err = EOPNOTSUPP;
+		break;
+	}
+	return err;
+}
+
+static moduledata_t ipfwmod = {
+	"ipfw",
+	ipfw_modevent,
+	0
+};
 
-VNET_SYSUNINIT(vnet_ipfw_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
-    vnet_ipfw_uninit, NULL);
+/* Define startup order. */
+#define	IPFW_SI_SUB_FIREWALL	SI_SUB_PROTO_IFATTACHDOMAIN
+#define	IPFW_MODEVENT_ORDER	(SI_ORDER_ANY - 255) /* On boot slot in here. */
+#define	IPFW_MODULE_ORDER	(IPFW_MODEVENT_ORDER + 1) /* A little later. */
+#define	IPFW_VNET_ORDER		(IPFW_MODEVENT_ORDER + 2) /* Later still. */
+
+DECLARE_MODULE(ipfw, ipfwmod, IPFW_SI_SUB_FIREWALL, IPFW_MODEVENT_ORDER);
+MODULE_VERSION(ipfw, 2);
+/* should declare some dependencies here */
+
+/*
+ * Starting up. Done in order after ipfwmod() has been called.
+ * VNET_SYSINIT is also called for each existing vnet and each new vnet.
+ */
+SYSINIT(ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
+	    ipfw_init, NULL);
+VNET_SYSINIT(vnet_ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
+	    vnet_ipfw_init, NULL);
+ 
+/*
+ * Closing up shop. These are done in REVERSE ORDER, but still
+ * after ipfwmod() has been called. Not called on reboot.
+ * VNET_SYSUNINIT is also called for each exiting vnet as it exits.
+ * or when the module is unloaded.
+ */
+SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
+	    ipfw_destroy, NULL);
+VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
+	    vnet_ipfw_uninit, NULL);
 
  

Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_pfil.c	Fri Aug 21 11:17:25 2009	(r196422)
+++ head/sys/netinet/ipfw/ip_fw_pfil.c	Fri Aug 21 11:20:10 2009	(r196423)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -441,7 +442,7 @@ nodivert:
 	return 1;
 }
 
-static int
+int
 ipfw_hook(void)
 {
 	struct pfil_head *pfh_inet;
@@ -458,7 +459,7 @@ ipfw_hook(void)
 	return 0;
 }
 
-static int
+int
 ipfw_unhook(void)
 {
 	struct pfil_head *pfh_inet;
@@ -476,7 +477,7 @@ ipfw_unhook(void)
 }
 
 #ifdef INET6
-static int
+int
 ipfw6_hook(void)
 {
 	struct pfil_head *pfh_inet6;
@@ -493,7 +494,7 @@ ipfw6_hook(void)
 	return 0;
 }
 
-static int
+int
 ipfw6_unhook(void)
 {
 	struct pfil_head *pfh_inet6;
@@ -517,6 +518,10 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS)
 	int enable = *(int *)arg1;
 	int error;
 
+#ifdef VIMAGE /* Since enabling is global, only let base do it. */
+	if (! IS_DEFAULT_VNET(curvnet))
+		return (EPERM);
+#endif
 	error = sysctl_handle_int(oidp, &enable, 0, req);
 	if (error)
 		return (error);
@@ -549,50 +554,3 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
-static int
-ipfw_modevent(module_t mod, int type, void *unused)
-{
-	int err = 0;
-
-	switch (type) {
-	case MOD_LOAD:
-		if ((err = ipfw_init()) != 0) {
-			printf("ipfw_init() error\n");
-			break;
-		}
-		if ((err = ipfw_hook()) != 0) {
-			printf("ipfw_hook() error\n");
-			break;
-		}
-#ifdef INET6
-		if ((err = ipfw6_hook()) != 0) {
-			printf("ipfw_hook() error\n");
-			break;
-		}
-#endif
-		break;
-
-	case MOD_UNLOAD:
-		if ((err = ipfw_unhook()) > 0)
-			break;
-#ifdef INET6
-		if ((err = ipfw6_unhook()) > 0)
-			break;
-#endif
-		ipfw_destroy();
-		break;
-
-	default:
-		return EOPNOTSUPP;
-		break;
-	}
-	return err;
-}
-
-static moduledata_t ipfwmod = {
-	"ipfw",
-	ipfw_modevent,
-	0
-};
-DECLARE_MODULE(ipfw, ipfwmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 256);
-MODULE_VERSION(ipfw, 2);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 11:23:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 83EA7106568E;
	Fri, 21 Aug 2009 11:23:29 +0000 (UTC)
	(envelope-from julian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 714A78FC64;
	Fri, 21 Aug 2009 11:23:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LBNTMb021285;
	Fri, 21 Aug 2009 11:23:29 GMT (envelope-from julian@svn.freebsd.org)
Received: (from julian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LBNTkK021281;
	Fri, 21 Aug 2009 11:23:29 GMT (envelope-from julian@svn.freebsd.org)
Message-Id: <200908211123.n7LBNTkK021281@svn.freebsd.org>
From: Julian Elischer 
Date: Fri, 21 Aug 2009 11:23:29 +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: r196424 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet netinet/ipfw
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 11:23:29 -0000

Author: julian
Date: Fri Aug 21 11:23:29 2009
New Revision: 196424
URL: http://svn.freebsd.org/changeset/base/196424

Log:
  MFC r196423
    Fix ipfw's initialization functions to get the correct order of evaluation
    to allow vnet and non vnet operation. Move some functions from ip_fw_pfil.c
    to ip_fw2.c and mode to mostly using the SYSINIT and VNET_SYSINIT handlers
    instead of the modevent handler. Correct some spelling errors in comments
    in the affected code. Note this bug fixes a crash in NON VIMAGE kernels when
    ipfw is unloaded.
  
    This patch is a minimal patch for 8.0
    I have a much larger patch that actually fixes the underlying problems
    that will be applied after 8.0
  
  Reviewed by:	zec@, rwatson@, bz@(earlier version)
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (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/xen/xenpci/   (props changed)
  stable/8/sys/netinet/ip_fw.h
  stable/8/sys/netinet/ipfw/ip_fw2.c
  stable/8/sys/netinet/ipfw/ip_fw_pfil.c

Modified: stable/8/sys/netinet/ip_fw.h
==============================================================================
--- stable/8/sys/netinet/ip_fw.h	Fri Aug 21 11:20:10 2009	(r196423)
+++ stable/8/sys/netinet/ip_fw.h	Fri Aug 21 11:23:29 2009	(r196424)
@@ -645,8 +645,10 @@ int ipfw_check_out(void *, struct mbuf *
 
 int ipfw_chk(struct ip_fw_args *);
 
-int ipfw_init(void);
-void ipfw_destroy(void);
+int ipfw_hook(void);
+int ipfw6_hook(void);
+int ipfw_unhook(void);
+int ipfw6_unhook(void);
 #ifdef NOTYET
 void ipfw_nat_destroy(void);
 #endif

Modified: stable/8/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- stable/8/sys/netinet/ipfw/ip_fw2.c	Fri Aug 21 11:20:10 2009	(r196423)
+++ stable/8/sys/netinet/ipfw/ip_fw2.c	Fri Aug 21 11:23:29 2009	(r196424)
@@ -102,6 +102,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static VNET_DEFINE(int, ipfw_vnet_ready) = 0;
+#define	V_ipfw_vnet_ready	VNET(ipfw_vnet_ready)
 /*
  * set_disable contains one bit per set value (0..31).
  * If the bit is set, all rules with the corresponding set
@@ -2237,7 +2239,7 @@ ipfw_chk(struct ip_fw_args *args)
 	/* end of ipv6 variables */
 	int is_ipv4 = 0;
 
-	if (m->m_flags & M_SKIP_FIREWALL)
+	if (m->m_flags & M_SKIP_FIREWALL || (! V_ipfw_vnet_ready))
 		return (IP_FW_PASS);	/* accept */
 
 	dst_ip.s_addr = 0;		/* make sure it is initialized */
@@ -4579,12 +4581,10 @@ done:
 	CURVNET_RESTORE();
 }
 
-
-
 /****************
  * Stuff that must be initialised only on boot or module load
  */
-int
+static int
 ipfw_init(void)
 {
 	int error = 0;
@@ -4623,9 +4623,11 @@ ipfw_init(void)
 		default_to_accept ? "accept" : "deny");
 
 	/*
-	 * Note: V_xxx variables can be accessed here but the iattach()
-     	 * may not have been called yet for the VIMGE case.
-	 * Tuneables will have been processed.
+	 * Note: V_xxx variables can be accessed here but the vnet specific
+	 * initializer may not have been called yet for the VIMAGE case.
+	 * Tuneables will have been processed. We will print out values for
+	 * the default vnet. 
+	 * XXX This should all be rationalized AFTER 8.0
 	 */
 	if (V_fw_verbose == 0)
 		printf("disabled\n");
@@ -4636,6 +4638,20 @@ ipfw_init(void)
 		    V_verbose_limit);
 
 	/*
+	 * Hook us up to pfil.
+	 * Eventually pfil will be per vnet.
+	 */
+	if ((error = ipfw_hook()) != 0) {
+		printf("ipfw_hook() error\n");
+		return (error);
+	}
+#ifdef INET6
+	if ((error = ipfw6_hook()) != 0) {
+		printf("ipfw6_hook() error\n");
+		return (error);
+	}
+#endif
+	/*
 	 * Other things that are only done the first time.
 	 * (now that we a re cuaranteed of success).
 	 */
@@ -4645,8 +4661,8 @@ ipfw_init(void)
 }
 
 /****************
- * Stuff that must be initialised for every instance
- * (including the forst of course).
+ * Stuff that must be initialized for every instance
+ * (including the first of course).
  */
 static int
 vnet_ipfw_init(const void *unused)
@@ -4726,17 +4742,17 @@ vnet_ipfw_init(const void *unused)
 #endif
 
 	/* First set up some values that are compile time options */
+	V_ipfw_vnet_ready = 1;		/* Open for business */
 	return (0);
 }
 
 /**********************
  * Called for the removal of the last instance only on module unload.
  */
-void
+static void
 ipfw_destroy(void)
 {
-	ip_fw_chk_ptr = NULL;
-	ip_fw_ctl_ptr = NULL;
+
 	uma_zdestroy(ipfw_dyn_rule_zone);
 	IPFW_DYN_LOCK_DESTROY();
 	printf("IP firewall unloaded\n");
@@ -4750,7 +4766,9 @@ vnet_ipfw_uninit(const void *unused)
 {
 	struct ip_fw *reap;
 
+	V_ipfw_vnet_ready = 0; /* tell new callers to go away */
 	callout_drain(&V_ipfw_timeout);
+	/* We wait on the wlock here until the last user leaves */
 	IPFW_WLOCK(&V_layer3_chain);
 	flush_tables(&V_layer3_chain);
 	V_layer3_chain.reap = NULL;
@@ -4766,10 +4784,86 @@ vnet_ipfw_uninit(const void *unused)
 	return 0;
 }
 
-VNET_SYSINIT(vnet_ipfw_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
-    vnet_ipfw_init, NULL);
+/*
+ * Module event handler.
+ * In general we have the choice of handling most of these events by the
+ * event handler or by the (VNET_)SYS(UN)INIT handlers. I have chosen to
+ * use the SYSINIT handlers as they are more capable of expressing the
+ * flow of control during module and vnet operations, so this is just
+ * a skeleton. Note there is no SYSINIT equivalent of the module
+ * SHUTDOWN handler, but we don't have anything to do in that case anyhow.
+ */
+static int
+ipfw_modevent(module_t mod, int type, void *unused)
+{
+	int err = 0;
+
+	switch (type) {
+	case MOD_LOAD:
+		/* Called once at module load or
+	 	 * system boot if compiled in. */
+		break;
+	case MOD_UNLOAD:
+		break;
+	case MOD_QUIESCE:
+		/* Yes, the unhooks can return errors, we can safely ignore
+		 * them. Eventually these will be done per jail as they
+		 * shut down. We will wait on each vnet's l3 lock as existing
+		 * callers go away.
+		 */
+		ipfw_unhook();
+#ifdef INET6
+		ipfw6_unhook();
+#endif
+		/* layer2 and other entrypoints still come in this way. */
+		ip_fw_chk_ptr = NULL;
+		ip_fw_ctl_ptr = NULL;
+		/* Called during unload. */
+		break;
+	case MOD_SHUTDOWN:
+		/* Called during system shutdown. */
+		break;
+	default:
+		err = EOPNOTSUPP;
+		break;
+	}
+	return err;
+}
+
+static moduledata_t ipfwmod = {
+	"ipfw",
+	ipfw_modevent,
+	0
+};
 
-VNET_SYSUNINIT(vnet_ipfw_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 255,
-    vnet_ipfw_uninit, NULL);
+/* Define startup order. */
+#define	IPFW_SI_SUB_FIREWALL	SI_SUB_PROTO_IFATTACHDOMAIN
+#define	IPFW_MODEVENT_ORDER	(SI_ORDER_ANY - 255) /* On boot slot in here. */
+#define	IPFW_MODULE_ORDER	(IPFW_MODEVENT_ORDER + 1) /* A little later. */
+#define	IPFW_VNET_ORDER		(IPFW_MODEVENT_ORDER + 2) /* Later still. */
+
+DECLARE_MODULE(ipfw, ipfwmod, IPFW_SI_SUB_FIREWALL, IPFW_MODEVENT_ORDER);
+MODULE_VERSION(ipfw, 2);
+/* should declare some dependencies here */
+
+/*
+ * Starting up. Done in order after ipfwmod() has been called.
+ * VNET_SYSINIT is also called for each existing vnet and each new vnet.
+ */
+SYSINIT(ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
+	    ipfw_init, NULL);
+VNET_SYSINIT(vnet_ipfw_init, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
+	    vnet_ipfw_init, NULL);
+ 
+/*
+ * Closing up shop. These are done in REVERSE ORDER, but still
+ * after ipfwmod() has been called. Not called on reboot.
+ * VNET_SYSUNINIT is also called for each exiting vnet as it exits.
+ * or when the module is unloaded.
+ */
+SYSUNINIT(ipfw_destroy, IPFW_SI_SUB_FIREWALL, IPFW_MODULE_ORDER,
+	    ipfw_destroy, NULL);
+VNET_SYSUNINIT(vnet_ipfw_uninit, IPFW_SI_SUB_FIREWALL, IPFW_VNET_ORDER,
+	    vnet_ipfw_uninit, NULL);
 
  

Modified: stable/8/sys/netinet/ipfw/ip_fw_pfil.c
==============================================================================
--- stable/8/sys/netinet/ipfw/ip_fw_pfil.c	Fri Aug 21 11:20:10 2009	(r196423)
+++ stable/8/sys/netinet/ipfw/ip_fw_pfil.c	Fri Aug 21 11:23:29 2009	(r196424)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -441,7 +442,7 @@ nodivert:
 	return 1;
 }
 
-static int
+int
 ipfw_hook(void)
 {
 	struct pfil_head *pfh_inet;
@@ -458,7 +459,7 @@ ipfw_hook(void)
 	return 0;
 }
 
-static int
+int
 ipfw_unhook(void)
 {
 	struct pfil_head *pfh_inet;
@@ -476,7 +477,7 @@ ipfw_unhook(void)
 }
 
 #ifdef INET6
-static int
+int
 ipfw6_hook(void)
 {
 	struct pfil_head *pfh_inet6;
@@ -493,7 +494,7 @@ ipfw6_hook(void)
 	return 0;
 }
 
-static int
+int
 ipfw6_unhook(void)
 {
 	struct pfil_head *pfh_inet6;
@@ -517,6 +518,10 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS)
 	int enable = *(int *)arg1;
 	int error;
 
+#ifdef VIMAGE /* Since enabling is global, only let base do it. */
+	if (! IS_DEFAULT_VNET(curvnet))
+		return (EPERM);
+#endif
 	error = sysctl_handle_int(oidp, &enable, 0, req);
 	if (error)
 		return (error);
@@ -549,50 +554,3 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS)
 	return (0);
 }
 
-static int
-ipfw_modevent(module_t mod, int type, void *unused)
-{
-	int err = 0;
-
-	switch (type) {
-	case MOD_LOAD:
-		if ((err = ipfw_init()) != 0) {
-			printf("ipfw_init() error\n");
-			break;
-		}
-		if ((err = ipfw_hook()) != 0) {
-			printf("ipfw_hook() error\n");
-			break;
-		}
-#ifdef INET6
-		if ((err = ipfw6_hook()) != 0) {
-			printf("ipfw_hook() error\n");
-			break;
-		}
-#endif
-		break;
-
-	case MOD_UNLOAD:
-		if ((err = ipfw_unhook()) > 0)
-			break;
-#ifdef INET6
-		if ((err = ipfw6_unhook()) > 0)
-			break;
-#endif
-		ipfw_destroy();
-		break;
-
-	default:
-		return EOPNOTSUPP;
-		break;
-	}
-	return err;
-}
-
-static moduledata_t ipfwmod = {
-	"ipfw",
-	ipfw_modevent,
-	0
-};
-DECLARE_MODULE(ipfw, ipfwmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY - 256);
-MODULE_VERSION(ipfw, 2);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 11:34:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E4A3106568D;
	Fri, 21 Aug 2009 11:34:02 +0000 (UTC)
	(envelope-from julian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 458C78FC52;
	Fri, 21 Aug 2009 11:34:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LBY2Kq021536;
	Fri, 21 Aug 2009 11:34:02 GMT (envelope-from julian@svn.freebsd.org)
Received: (from julian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LBY2DF021534;
	Fri, 21 Aug 2009 11:34:02 GMT (envelope-from julian@svn.freebsd.org)
Message-Id: <200908211134.n7LBY2DF021534@svn.freebsd.org>
From: Julian Elischer 
Date: Fri, 21 Aug 2009 11:34:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-svnadmin@freebsd.org
X-SVN-Group: svnadmin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196425 - svnadmin/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 11:34:02 -0000

Author: julian
Date: Fri Aug 21 11:34:01 2009
New Revision: 196425
URL: http://svn.freebsd.org/changeset/base/196425

Log:
  It's been long enough.
  I hereby let Zec off the leash.
  Look out!

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==============================================================================
--- svnadmin/conf/mentors	Fri Aug 21 11:23:29 2009	(r196424)
+++ svnadmin/conf/mentors	Fri Aug 21 11:34:01 2009	(r196425)
@@ -28,5 +28,4 @@ snb		dwmalone
 sson		gnn
 versus		dds
 will		ken
-zec		julian		Co-mentor: silby
 zml		dfr

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 13:05:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A0DF3106568C;
	Fri, 21 Aug 2009 13:05:59 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 653178FC47;
	Fri, 21 Aug 2009 13:05:59 +0000 (UTC)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id C941E1CD2C; Fri, 21 Aug 2009 15:05:58 +0200 (CEST)
Date: Fri, 21 Aug 2009 15:05:58 +0200
From: Ed Schouten 
To: zec@FreeBSD.org
Message-ID: <20090821130558.GK1292@hoeg.nl>
References: <200908211134.n7LBY2DF021534@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="Pu+9umg0azy3+Jou"
Content-Disposition: inline
In-Reply-To: <200908211134.n7LBY2DF021534@svn.freebsd.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-all@freebsd.org, src-committers@freebsd.org,
	Julian Elischer , svn-src-svnadmin@freebsd.org
Subject: Re: svn commit: r196425 - svnadmin/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 13:05:59 -0000


--Pu+9umg0azy3+Jou
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Julian Elischer  wrote:
>   It's been long enough.
>   I hereby let Zec off the leash.
>   Look out!

Congratulations, Marko!

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--Pu+9umg0azy3+Jou
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkqOm7YACgkQ52SDGA2eCwUQcACeNk4zn7scimTUr1AEP89+vOyk
MhoAnA6OgzkRZXnAT91SqVEEHDczxsZC
=OzMP
-----END PGP SIGNATURE-----

--Pu+9umg0azy3+Jou--

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 21 17:40:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D31B1065672;
	Fri, 21 Aug 2009 17:40:25 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6B19E8FC1F;
	Fri, 21 Aug 2009 17:40:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7LHePjU030886;
	Fri, 21 Aug 2009 17:40:25 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7LHePjf030885;
	Fri, 21 Aug 2009 17:40:25 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200908211740.n7LHePjf030885@svn.freebsd.org>
From: Ken Smith 
Date: Fri, 21 Aug 2009 17:40:25 +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: r196426 - stable/8/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 21 Aug 2009 17:40:25 -0000

Author: kensmith
Date: Fri Aug 21 17:40:24 2009
New Revision: 196426
URL: http://svn.freebsd.org/changeset/base/196426

Log:
  Ready for 8.0-BETA3 builds.
  
  Approved by:	re (implicit)

Modified:
  stable/8/sys/conf/newvers.sh

Modified: stable/8/sys/conf/newvers.sh
==============================================================================
--- stable/8/sys/conf/newvers.sh	Fri Aug 21 11:34:01 2009	(r196425)
+++ stable/8/sys/conf/newvers.sh	Fri Aug 21 17:40:24 2009	(r196426)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="8.0"
-BRANCH="BETA2"
+BRANCH="BETA3"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 22 09:09:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DFF4A106568B;
	Sat, 22 Aug 2009 09:09:44 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CFB038FC0C;
	Sat, 22 Aug 2009 09:09:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7M99iAO049379;
	Sat, 22 Aug 2009 09:09:44 GMT (envelope-from stas@svn.freebsd.org)
Received: (from stas@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7M99iad049377;
	Sat, 22 Aug 2009 09:09:44 GMT (envelope-from stas@svn.freebsd.org)
Message-Id: <200908220909.n7M99iad049377@svn.freebsd.org>
From: Stanislav Sedov 
Date: Sat, 22 Aug 2009 09:09:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196430 - stable/7/usr.sbin/pstat
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 22 Aug 2009 09:09:45 -0000

Author: stas
Date: Sat Aug 22 09:09:44 2009
New Revision: 196430
URL: http://svn.freebsd.org/changeset/base/196430

Log:
  - MFC r196244:
    - Avoid overflowing the swap size counters in human-readable mode
      by introducing the new CONVERT_BLOCKS macro which operates on
      sizes already converted to number of blocks.  With this macro
      it is not longer needed to perform needless multiplication by
      blocksize just to divide on it later in CONVERT macro.

Modified:
  stable/7/usr.sbin/pstat/   (props changed)
  stable/7/usr.sbin/pstat/pstat.c

Modified: stable/7/usr.sbin/pstat/pstat.c
==============================================================================
--- stable/7/usr.sbin/pstat/pstat.c	Sat Aug 22 00:56:47 2009	(r196429)
+++ stable/7/usr.sbin/pstat/pstat.c	Sat Aug 22 09:09:44 2009	(r196430)
@@ -479,6 +479,7 @@ getfiles(char **abuf, size_t *alen)
  */
 
 #define CONVERT(v)	((int64_t)(v) * pagesize / blocksize)
+#define CONVERT_BLOCKS(v)	((int64_t)(v) * pagesize)
 static struct kvm_swap swtot;
 static int nswdev;
 
@@ -511,10 +512,10 @@ print_swap_line(const char *devname, int
 	printf("%-15s %*jd ", devname, hlen, CONVERT(nblks));
 	if (humanflag) {
 		humanize_number(usedbuf, sizeof(usedbuf),
-		    CONVERT(blocksize * bused), "",
+		    CONVERT_BLOCKS(bused), "",
 		    HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
 		humanize_number(availbuf, sizeof(availbuf),
-		    CONVERT(blocksize * bavail), "",
+		    CONVERT_BLOCKS(bavail), "",
 		    HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
 		printf("%8s %8s %5.0f%%\n", usedbuf, availbuf, bpercent);
 	} else {

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 22 09:17:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1FD9F106564A;
	Sat, 22 Aug 2009 09:17:50 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F59A8FC17;
	Sat, 22 Aug 2009 09:17:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7M9HnBa049588;
	Sat, 22 Aug 2009 09:17:49 GMT (envelope-from stas@svn.freebsd.org)
Received: (from stas@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7M9HnSJ049586;
	Sat, 22 Aug 2009 09:17:49 GMT (envelope-from stas@svn.freebsd.org)
Message-Id: <200908220917.n7M9HnSJ049586@svn.freebsd.org>
From: Stanislav Sedov 
Date: Sat, 22 Aug 2009 09:17:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196431 - in stable/7/sys: . arm/at91 contrib/pf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 22 Aug 2009 09:17:50 -0000

Author: stas
Date: Sat Aug 22 09:17:49 2009
New Revision: 196431
URL: http://svn.freebsd.org/changeset/base/196431

Log:
  - MFC r196246:
    - Proprely intialize UART parameters at probe stage, so uart(4)
      will initialize the FIFO memory correctly on attach.  Before
      that this values was intialized in only in at91_usart_bus_attach
      which is called after the uart(4) memory allocation happens.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/arm/at91/uart_dev_at91usart.c
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/arm/at91/uart_dev_at91usart.c
==============================================================================
--- stable/7/sys/arm/at91/uart_dev_at91usart.c	Sat Aug 22 09:09:44 2009	(r196430)
+++ stable/7/sys/arm/at91/uart_dev_at91usart.c	Sat Aug 22 09:17:49 2009	(r196431)
@@ -305,6 +305,10 @@ static kobj_method_t at91_usart_methods[
 int
 at91_usart_bus_probe(struct uart_softc *sc)
 {
+
+	sc->sc_txfifosz = USART_BUFFER_SIZE;
+	sc->sc_rxfifosz = USART_BUFFER_SIZE;
+	sc->sc_hwiflow = 0;
 	return (0);
 }
 
@@ -342,10 +346,6 @@ at91_usart_bus_attach(struct uart_softc 
 		atsc->flags |= HAS_TIMEOUT;
 	WR4(&sc->sc_bas, USART_IDR, 0xffffffff);
 
-	sc->sc_txfifosz = USART_BUFFER_SIZE;
-	sc->sc_rxfifosz = USART_BUFFER_SIZE;
-	sc->sc_hwiflow = 0;
-
 #ifndef SKYEYE_WORKAROUNDS
 	/*
 	 * Allocate DMA tags and maps

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 22 23:44:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7063106568C;
	Sat, 22 Aug 2009 23:44:37 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D44CB8FC0C;
	Sat, 22 Aug 2009 23:44:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7MNibiU040303;
	Sat, 22 Aug 2009 23:44:37 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7MNibQZ040298;
	Sat, 22 Aug 2009 23:44:37 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200908222344.n7MNibQZ040298@svn.freebsd.org>
From: Ken Smith 
Date: Sat, 22 Aug 2009 23:44:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196432 - in head: . gnu/usr.bin/groff/tmac release
	sys/conf sys/sys usr.sbin/pkg_install/add
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 22 Aug 2009 23:44:38 -0000

Author: kensmith
Date: Sat Aug 22 23:44:37 2009
New Revision: 196432
URL: http://svn.freebsd.org/changeset/base/196432

Log:
  Make head 9.0-CURRENT in preparation for lifting code freeze.
  
  Approved by:	re (implicit)

Modified:
  head/UPDATING
  head/gnu/usr.bin/groff/tmac/mdoc.local
  head/release/Makefile
  head/sys/conf/newvers.sh
  head/sys/sys/param.h
  head/usr.sbin/pkg_install/add/main.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/UPDATING	Sat Aug 22 23:44:37 2009	(r196432)
@@ -8,8 +8,8 @@ Items affecting the ports and packages s
 /usr/ports/UPDATING.  Please read that file before running
 portupgrade.
 
-NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW:
-	FreeBSD 8.x has many debugging features turned on, in
+NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW:
+	FreeBSD 9.x has many debugging features turned on, in
 	both the kernel and userland.  These features attempt to detect
 	incorrect use of system primitives, and encourage loud failure
 	through extra sanity checking and fail stop semantics.  They

Modified: head/gnu/usr.bin/groff/tmac/mdoc.local
==============================================================================
--- head/gnu/usr.bin/groff/tmac/mdoc.local	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/gnu/usr.bin/groff/tmac/mdoc.local	Sat Aug 22 23:44:37 2009	(r196432)
@@ -66,13 +66,14 @@
 .ds doc-volume-as-arm      arm
 .
 .\" Default .Os value
-.ds doc-default-operating-system FreeBSD\~8.0
+.ds doc-default-operating-system FreeBSD\~9.0
 .
 .\" FreeBSD releases not found in doc-common
 .ds doc-operating-system-FreeBSD-6.3    6.3
 .ds doc-operating-system-FreeBSD-6.4    6.4
 .ds doc-operating-system-FreeBSD-7.1    7.1
 .ds doc-operating-system-FreeBSD-8.0    8.0
+.ds doc-operating-system-FreeBSD-9.0    9.0
 .
 .\" Definitions not (yet) in doc-syms
 .ds doc-str-St--p1003.1-2008   \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1-2008

Modified: head/release/Makefile
==============================================================================
--- head/release/Makefile	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/release/Makefile	Sat Aug 22 23:44:37 2009	(r196432)
@@ -24,16 +24,16 @@
 # Set these, release builder!
 #
 # Fixed version:
-#BUILDNAME=8.0-CURRENT
+#BUILDNAME=9.0-CURRENT
 #
 # Automatic SNAP versioning:
 DATE != date +%Y%m%d
-BASE = 8.0
+BASE = 9.0
 BUILDNAME?=${BASE}-${DATE}-SNAP
 #
 #CHROOTDIR=/junk/release
 # If this is a -stable snapshot, then set
-#RELEASETAG=RELENG_7
+#RELEASETAG=RELENG_8
 #
 # To test a release with a source tree containing patches and
 # other work. This tree will get copied instead of getting the
@@ -72,7 +72,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP
 #
 # Subversion branch to build for src.  If this is not set then it is
 # automatically computed from RELEASETAG.
-#SVNBRANCH=stable/7
+#SVNBRANCH=stable/8
 #
 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
 # are building an official release.  Otherwise, we are building for

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/sys/conf/newvers.sh	Sat Aug 22 23:44:37 2009	(r196432)
@@ -31,8 +31,8 @@
 # $FreeBSD$
 
 TYPE="FreeBSD"
-REVISION="8.0"
-BRANCH="BETA2"
+REVISION="9.0"
+BRANCH="CURRENT"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/sys/sys/param.h	Sat Aug 22 23:44:37 2009	(r196432)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800107	/* Master, propagated to newvers */
+#define __FreeBSD_version 900000	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

Modified: head/usr.sbin/pkg_install/add/main.c
==============================================================================
--- head/usr.sbin/pkg_install/add/main.c	Sat Aug 22 09:17:49 2009	(r196431)
+++ head/usr.sbin/pkg_install/add/main.c	Sat Aug 22 23:44:37 2009	(r196432)
@@ -82,13 +82,15 @@ struct {
 	{ 700000, 700099, "/packages-7.0-release" },
 	{ 701000, 701099, "/packages-7.1-release" },
 	{ 702000, 702099, "/packages-7.2-release" },
+	{ 800000, 800499, "/packages-8.0-release" },
 	{ 300000, 399000, "/packages-3-stable" },
 	{ 400000, 499000, "/packages-4-stable" },
 	{ 502100, 502128, "/packages-5-current" },
 	{ 503100, 599000, "/packages-5-stable" },
 	{ 600100, 699000, "/packages-6-stable" },
 	{ 700100, 799000, "/packages-7-stable" },
-	{ 800000, 899000, "/packages-8-current" },
+	{ 800000, 899000, "/packages-8-stable" },
+	{ 900000, 999000, "/packages-9-current" },
 	{ 0, 9999999, "/packages-current" },
 	{ 0, 0, NULL }
 };