From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 22 06:00:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCEA106564A; Sun, 22 Jan 2012 06:00: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 01B4B8FC08; Sun, 22 Jan 2012 06:00:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0M60oZN026777; Sun, 22 Jan 2012 06:00:50 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0M60opj026771; Sun, 22 Jan 2012 06:00:50 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201220600.q0M60opj026771@svn.freebsd.org> From: Rick Macklem Date: Sun, 22 Jan 2012 06:00: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: r230448 - in stable/8/sys/fs: nfs nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 06:00:51 -0000 Author: rmacklem Date: Sun Jan 22 06:00:50 2012 New Revision: 230448 URL: http://svn.freebsd.org/changeset/base/230448 Log: MFC: r229802 opt_inet6.h was missing from some files in the new NFS subsystem. The effect of this was, for clients mounted via inet6 addresses, that the DRC cache would never have a hit in the server. It also broke NFSv4 callbacks when an inet6 address was the only one available in the client. This patch fixes the above, plus deletes opt_inet6.h from a couple of files it is not needed for. Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c stable/8/sys/fs/nfs/nfs_commonsubs.c stable/8/sys/fs/nfsclient/nfs_clkrpc.c stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: 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) Modified: stable/8/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfs/nfs_commonkrpc.c Sun Jan 22 06:00:50 2012 (r230448) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); * Socket operations for use by nfs */ -#include "opt_inet6.h" #include "opt_kgssapi.h" #include "opt_nfs.h" Modified: stable/8/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfs/nfs_commonsubs.c Sun Jan 22 06:00:50 2012 (r230448) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); * copy data between mbuf chains and uio lists. */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* Modified: stable/8/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clkrpc.c Sun Jan 22 06:00:50 2012 (r230448) @@ -34,7 +34,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_inet6.h" #include "opt_kgssapi.h" #include Modified: stable/8/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Sun Jan 22 06:00:50 2012 (r230448) @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet6.h" + /* * generally, I don't like #includes inside .h files, but it seems to * be the easiest way to handle the port. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 05:30:29 2012 (r230447) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Sun Jan 22 06:00:50 2012 (r230448) @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); */ #ifndef APPLEKEXT +#include "opt_inet6.h" + #include /* From owner-svn-src-stable-8@FreeBSD.ORG Sun Jan 22 21:25:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E77106564A; Sun, 22 Jan 2012 21:25:47 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D14F98FC08; Sun, 22 Jan 2012 21:25:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0MLPlYt093462; Sun, 22 Jan 2012 21:25:47 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0MLPlDg093459; Sun, 22 Jan 2012 21:25:47 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201201222125.q0MLPlDg093459@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 22 Jan 2012 21:25: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: r230472 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 21:25:48 -0000 Author: gavin Date: Sun Jan 22 21:25:47 2012 New Revision: 230472 URL: http://svn.freebsd.org/changeset/base/230472 Log: Merge r229085 from head: Default to not performing the early-boot memory tests when we detect we are booting inside a VM. There are three reasons to disable this: o It causes the VM host to believe that all the tested pages or RAM are in use. This in turn may force the host to page out pages of RAM belonging to other VMs, or otherwise cause problems with fair resource sharing on the VM cluster. o It adds significant time to the boot process (around 1 second/Gig in testing) o It is unnecessary - the host should have already verified that the memory is functional etc. Note that this simply changes the default when in a VM - it can still be overridden using the hw.memtest.tests tunable. Early MFC requested by: bz Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/i386/i386/machdep.c Directory Properties: 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) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Sun Jan 22 20:26:46 2012 (r230471) +++ stable/8/sys/amd64/amd64/machdep.c Sun Jan 22 21:25:47 2012 (r230472) @@ -1351,10 +1351,13 @@ getmemsize(caddr_t kmdp, u_int64_t first Maxmem = atop(physmem_tunable); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); /* Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Sun Jan 22 20:26:46 2012 (r230471) +++ stable/8/sys/i386/i386/machdep.c Sun Jan 22 21:25:47 2012 (r230472) @@ -2302,10 +2302,13 @@ physmap_done: Maxmem = atop(physmap[physmap_idx + 1]); /* - * By default keep the memtest enabled. Use a general name so that + * By default enable the memory test on real hardware, and disable + * it if we appear to be running in a VM. This avoids touching all + * pages unnecessarily, which doesn't matter on real hardware but is + * bad for shared VM hosts. Use a general name so that * one could eventually do more with the code than just disable it. */ - memtest = 1; + memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1; TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); if (atop(physmap[physmap_idx + 1]) != Maxmem && From owner-svn-src-stable-8@FreeBSD.ORG Mon Jan 23 08:30:18 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 743841065670; Mon, 23 Jan 2012 08:30:18 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 623BC8FC14; Mon, 23 Jan 2012 08:30:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0N8UIUu014694; Mon, 23 Jan 2012 08:30:18 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0N8UIio014691; Mon, 23 Jan 2012 08:30:18 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201230830.q0N8UIio014691@svn.freebsd.org> From: Martin Matuska Date: Mon, 23 Jan 2012 08:30:18 +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: r230477 - in stable/8/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 08:30:18 -0000 Author: mm Date: Mon Jan 23 08:30:17 2012 New Revision: 230477 URL: http://svn.freebsd.org/changeset/base/230477 Log: MFC r230402, r230404: Add accidentially removed copyright lines in r228103 Reported by: pjd Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Jan 23 08:29:58 2012 (r230476) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Mon Jan 23 08:30:17 2012 (r230477) @@ -24,6 +24,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. * Copyright (c) 2011 Martin Matuska . All rights reserved. */ Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jan 23 08:29:58 2012 (r230476) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jan 23 08:30:17 2012 (r230477) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. * All rights reserved. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 24 10:32:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AAAD106564A; Tue, 24 Jan 2012 10:32:03 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 483C78FC1E; Tue, 24 Jan 2012 10:32:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0OAW3wf069138; Tue, 24 Jan 2012 10:32:03 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0OAW30F069136; Tue, 24 Jan 2012 10:32:03 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201241032.q0OAW30F069136@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 24 Jan 2012 10:32:03 +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: r230498 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 10:32:03 -0000 Author: pluknet Date: Tue Jan 24 10:32:02 2012 New Revision: 230498 URL: http://svn.freebsd.org/changeset/base/230498 Log: MFC r230256: Fix the "lock &zrl->zr_mtx already initialized" assertion by initializing the allocated memory before calling mtx_init(9) on mtx pointing to it. Otherwize, random contents of uninitialized memory might occasionally trigger the assertion. Reported by: Pavel Polyakov Reviewed by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Directory Properties: 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) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jan 24 10:28:19 2012 (r230497) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Jan 24 10:32:02 2012 (r230498) @@ -1077,7 +1077,7 @@ dnode_hold_impl(objset_t *os, uint64_t o if (children_dnodes == NULL) { int i; dnode_children_t *winner; - children_dnodes = kmem_alloc(sizeof (dnode_children_t) + + children_dnodes = kmem_zalloc(sizeof (dnode_children_t) + (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP); children_dnodes->dnc_count = epb; dnh = &children_dnodes->dnc_children[0]; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 25 02:22:17 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E2FE106566B; Wed, 25 Jan 2012 02:22:17 +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 0C2CC8FC0A; Wed, 25 Jan 2012 02:22:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0P2MGlp002700; Wed, 25 Jan 2012 02:22:16 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0P2MGq4002698; Wed, 25 Jan 2012 02:22:16 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201250222.q0P2MGq4002698@svn.freebsd.org> From: Rick Macklem Date: Wed, 25 Jan 2012 02:22: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: r230521 - stable/8/sys/fs/nfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 02:22:17 -0000 Author: rmacklem Date: Wed Jan 25 02:22:16 2012 New Revision: 230521 URL: http://svn.freebsd.org/changeset/base/230521 Log: MFC: r229956 jwd@ reported via email that the "CacheSize" field reported by "nfsstat -e -s" would go negative after using the "-z" option to zero out the stats. This patch fixes that by not zeroing out the srvcache_size field for "-z", since it is the size of the cache and not a counter Modified: stable/8/sys/fs/nfs/nfs_commonport.c Directory Properties: 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) Modified: stable/8/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/8/sys/fs/nfs/nfs_commonport.c Wed Jan 25 02:15:40 2012 (r230520) +++ stable/8/sys/fs/nfs/nfs_commonport.c Wed Jan 25 02:22:16 2012 (r230521) @@ -485,7 +485,6 @@ nfssvc_call(struct thread *p, struct nfs newnfsstats.srvcache_nonidemdonehits = 0; newnfsstats.srvcache_misses = 0; newnfsstats.srvcache_tcppeak = 0; - newnfsstats.srvcache_size = 0; newnfsstats.srvclients = 0; newnfsstats.srvopenowners = 0; newnfsstats.srvopens = 0; From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 25 07:14:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76850106564A; Wed, 25 Jan 2012 07:14:24 +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 612FD8FC12; Wed, 25 Jan 2012 07:14:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0P7EOvv012129; Wed, 25 Jan 2012 07:14:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0P7EOIq012127; Wed, 25 Jan 2012 07:14:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201250714.q0P7EOIq012127@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 25 Jan 2012 07:14: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: r230528 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 07:14:24 -0000 Author: kib Date: Wed Jan 25 07:14:23 2012 New Revision: 230528 URL: http://svn.freebsd.org/changeset/base/230528 Log: MFC r230459: Fix typo. Modified: stable/8/sys/sys/elf_common.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/sys/elf_common.h ============================================================================== --- stable/8/sys/sys/elf_common.h Wed Jan 25 07:12:45 2012 (r230527) +++ stable/8/sys/sys/elf_common.h Wed Jan 25 07:14:23 2012 (r230528) @@ -382,7 +382,7 @@ typedef struct { #define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of initialization functions. */ #define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of - terminationfunctions. */ + termination functions. */ #define DT_RUNPATH 29 /* String table offset of a null-terminated library search path string. */ #define DT_FLAGS 30 /* Object specific flag values. */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Jan 25 11:15:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 813F61065675; Wed, 25 Jan 2012 11:15:52 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 615C88FC1A; Wed, 25 Jan 2012 11:15:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0PBFq4a022468; Wed, 25 Jan 2012 11:15:52 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0PBFqMo022466; Wed, 25 Jan 2012 11:15:52 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201201251115.q0PBFqMo022466@svn.freebsd.org> From: Andre Oppermann Date: Wed, 25 Jan 2012 11:15: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: r230534 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2012 11:15:52 -0000 Author: andre Date: Wed Jan 25 11:15:52 2012 New Revision: 230534 URL: http://svn.freebsd.org/changeset/base/230534 Log: MFC r226113 and r228016: Prevent TCP sessions from stalling indefinitely in reassembly when reaching the zone limit of reassembly queue entries. Reviewed by: lstewart Modified: stable/8/sys/netinet/tcp_reass.c Directory Properties: 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) Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Wed Jan 25 10:11:54 2012 (r230533) +++ stable/8/sys/netinet/tcp_reass.c Wed Jan 25 11:15:52 2012 (r230534) @@ -174,7 +174,9 @@ tcp_reass(struct tcpcb *tp, struct tcphd struct tseg_qent *nq; struct tseg_qent *te = NULL; struct socket *so = tp->t_inpcb->inp_socket; + char *s = NULL; int flags; + struct tseg_qent tqs; INP_WLOCK_ASSERT(tp->t_inpcb); @@ -212,19 +214,45 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) { + log(LOG_DEBUG, "%s; %s: queue limit reached, " + "segment dropped\n", s, __func__); + free(s, M_TCPLOG); + } return (0); } /* * Allocate a new queue entry. If we can't, or hit the zone limit * just drop the pkt. + * + * Use a temporary structure on the stack for the missing segment + * when the zone is exhausted. Otherwise we may get stuck. */ te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); if (te == NULL) { - TCPSTAT_INC(tcps_rcvmemdrop); - m_freem(m); - *tlenp = 0; - return (0); + if (th->th_seq != tp->rcv_nxt) { + TCPSTAT_INC(tcps_rcvmemdrop); + m_freem(m); + *tlenp = 0; + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, + NULL))) { + log(LOG_DEBUG, "%s; %s: global zone limit " + "reached, segment dropped\n", s, __func__); + free(s, M_TCPLOG); + } + return (0); + } else { + bzero(&tqs, sizeof(struct tseg_qent)); + te = &tqs; + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, + NULL))) { + log(LOG_DEBUG, + "%s; %s: global zone limit reached, using " + "stack for missing segment\n", s, __func__); + free(s, M_TCPLOG); + } + } } tp->t_segqlen++; @@ -301,6 +329,8 @@ tcp_reass(struct tcpcb *tp, struct tcphd if (p == NULL) { LIST_INSERT_HEAD(&tp->t_segq, te, tqe_q); } else { + KASSERT(te != &tqs, ("%s: temporary stack based entry not " + "first element in queue", __func__)); LIST_INSERT_AFTER(p, te, tqe_q); } @@ -324,7 +354,8 @@ present: m_freem(q->tqe_m); else sbappendstream_locked(&so->so_rcv, q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + if (q != &tqs) + uma_zfree(V_tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 07:42:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E36E6106564A; Thu, 26 Jan 2012 07:42:54 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E72E8FC0C; Thu, 26 Jan 2012 07:42:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q7gsOd070723; Thu, 26 Jan 2012 07:42:54 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q7gsJk070721; Thu, 26 Jan 2012 07:42:54 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260742.q0Q7gsJk070721@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 07:42:54 +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: r230565 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 07:42:55 -0000 Author: ae Date: Thu Jan 26 07:42:54 2012 New Revision: 230565 URL: http://svn.freebsd.org/changeset/base/230565 Log: MFC r215118: Move code for search of existing geom into g_part_find_geom function and use this function instead of g_part_parm_geom in g_part_ctl_create. Modified: stable/8/sys/geom/part/g_part.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Thu Jan 26 07:03:30 2012 (r230564) +++ stable/8/sys/geom/part/g_part.c Thu Jan 26 07:42:54 2012 (r230565) @@ -299,6 +299,17 @@ g_part_new_provider(struct g_geom *gp, s g_error_provider(entry->gpe_pp, 0); } +static struct g_geom* +g_part_find_geom(const char *name) +{ + struct g_geom *gp; + LIST_FOREACH(gp, &g_part_class.geom, geom) { + if (!strcmp(name, gp->name)) + break; + } + return (gp); +} + static int g_part_parm_geom(const char *name, struct g_geom **v) { @@ -306,10 +317,7 @@ g_part_parm_geom(const char *name, struc if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0) name += strlen(_PATH_DEV); - LIST_FOREACH(gp, &g_part_class.geom, geom) { - if (!strcmp(name, gp->name)) - break; - } + gp = g_part_find_geom(name); if (gp == NULL) return (EINVAL); *v = gp; @@ -682,8 +690,8 @@ g_part_ctl_create(struct gctl_req *req, g_topology_assert(); /* Check that there isn't already a g_part geom on the provider. */ - error = g_part_parm_geom(pp->name, &gp); - if (!error) { + gp = g_part_find_geom(pp->name); + if (gp != NULL) { null = gp->softc; if (null->gpt_scheme != &g_part_null_scheme) { gctl_error(req, "%d geom '%s'", EEXIST, pp->name); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 07:51:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78F99106566B; Thu, 26 Jan 2012 07:51:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62D2B8FC12; Thu, 26 Jan 2012 07:51:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q7pqMi071047; Thu, 26 Jan 2012 07:51:52 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q7pqF1071045; Thu, 26 Jan 2012 07:51:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260751.q0Q7pqF1071045@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 07:51: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: r230566 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 07:51:52 -0000 Author: ae Date: Thu Jan 26 07:51:51 2012 New Revision: 230566 URL: http://svn.freebsd.org/changeset/base/230566 Log: MFC r226880 (modified version): Our geom withering function could take some time before geom with its providers and consumers will be destroyed. Before take some actions with a geom, check that it is not destroyed at the moment. Modified: stable/8/sys/geom/part/g_part.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Thu Jan 26 07:42:54 2012 (r230565) +++ stable/8/sys/geom/part/g_part.c Thu Jan 26 07:51:51 2012 (r230566) @@ -320,6 +320,8 @@ g_part_parm_geom(const char *name, struc gp = g_part_find_geom(name); if (gp == NULL) return (EINVAL); + if ((gp->flags & G_GEOM_WITHER) != 0) + return (ENXIO); *v = gp; return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 08:47:31 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8CF8106566C; Thu, 26 Jan 2012 08:47:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83F3F8FC08; Thu, 26 Jan 2012 08:47:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q8lUuL072939; Thu, 26 Jan 2012 08:47:30 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q8lUcm072937; Thu, 26 Jan 2012 08:47:30 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260847.q0Q8lUcm072937@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 08:47:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230567 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 08:47:32 -0000 Author: ae Date: Thu Jan 26 08:47:29 2012 New Revision: 230567 URL: http://svn.freebsd.org/changeset/base/230567 Log: MFC r221788: Add basic metadata integrity check. In case when partition table was probed and read successfull, but it contains invalid values (e.g. overlapped partitions, offset or size is out of bounds), then table will be rejected. MFC r221972: Add a sysctl kern.geom.part.check_integrity for those who has corrupt partition tables and lost an ability to boot after r221788. Also unhide an error message from bootverbose, this would help to easier determine the problem. MFC r221984: Add diagnostic messages for integrity checks. MFC r221992: Make diagnostic messages more specific. With bootverbose print out all inconsistencies of integrity in the partition table, not first found only. MFC r222642: Add diagnostic message about not aligned partitions. Modified: stable/8/sys/geom/part/g_part.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Thu Jan 26 07:51:51 2012 (r230566) +++ stable/8/sys/geom/part/g_part.c Thu Jan 26 08:47:29 2012 (r230567) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -104,6 +105,13 @@ struct g_part_alias_list { { "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP }, }; +SYSCTL_DECL(_kern_geom); +SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0, "GEOM_PART stuff"); +static u_int check_integrity = 1; +TUNABLE_INT("kern.geom.part.check_integrity", &check_integrity); +SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RW, + &check_integrity, 1, "Enable integrity checking"); + /* * The GEOM partitioning class. */ @@ -231,6 +239,123 @@ g_part_geometry(struct g_part_table *tab } } +#define DPRINTF(...) if (bootverbose) { \ + printf("GEOM_PART: " __VA_ARGS__); \ +} + +static int +g_part_check_integrity(struct g_part_table *table, struct g_consumer *cp) +{ + struct g_part_entry *e1, *e2; + struct g_provider *pp; + off_t offset; + int failed; + + failed = 0; + pp = cp->provider; + if (table->gpt_last < table->gpt_first) { + DPRINTF("last LBA is below first LBA: %jd < %jd\n", + (intmax_t)table->gpt_last, (intmax_t)table->gpt_first); + failed++; + } + if (table->gpt_last > pp->mediasize / pp->sectorsize - 1) { + DPRINTF("last LBA extends beyond mediasize: " + "%jd > %jd\n", (intmax_t)table->gpt_last, + (intmax_t)pp->mediasize / pp->sectorsize - 1); + failed++; + } + LIST_FOREACH(e1, &table->gpt_entry, gpe_entry) { + if (e1->gpe_deleted || e1->gpe_internal) + continue; + if (e1->gpe_start < table->gpt_first) { + DPRINTF("partition %d has start offset below first " + "LBA: %jd < %jd\n", e1->gpe_index, + (intmax_t)e1->gpe_start, + (intmax_t)table->gpt_first); + failed++; + } + if (e1->gpe_start > table->gpt_last) { + DPRINTF("partition %d has start offset beyond last " + "LBA: %jd > %jd\n", e1->gpe_index, + (intmax_t)e1->gpe_start, + (intmax_t)table->gpt_last); + failed++; + } + if (e1->gpe_end < e1->gpe_start) { + DPRINTF("partition %d has end offset below start " + "offset: %jd < %jd\n", e1->gpe_index, + (intmax_t)e1->gpe_end, + (intmax_t)e1->gpe_start); + failed++; + } + if (e1->gpe_end > table->gpt_last) { + DPRINTF("partition %d has end offset beyond last " + "LBA: %jd > %jd\n", e1->gpe_index, + (intmax_t)e1->gpe_end, + (intmax_t)table->gpt_last); + failed++; + } + if (pp->stripesize > 0) { + offset = e1->gpe_start * pp->sectorsize; + if (e1->gpe_offset > offset) + offset = e1->gpe_offset; + if ((offset + pp->stripeoffset) % pp->stripesize) { + DPRINTF("partition %d is not aligned on %u " + "bytes\n", e1->gpe_index, pp->stripesize); + /* Don't treat this as a critical failure */ + } + } + e2 = e1; + while ((e2 = LIST_NEXT(e2, gpe_entry)) != NULL) { + if (e2->gpe_deleted || e2->gpe_internal) + continue; + if (e1->gpe_start >= e2->gpe_start && + e1->gpe_start <= e2->gpe_end) { + DPRINTF("partition %d has start offset inside " + "partition %d: start[%d] %jd >= start[%d] " + "%jd <= end[%d] %jd\n", + e1->gpe_index, e2->gpe_index, + e2->gpe_index, (intmax_t)e2->gpe_start, + e1->gpe_index, (intmax_t)e1->gpe_start, + e2->gpe_index, (intmax_t)e2->gpe_end); + failed++; + } + if (e1->gpe_end >= e2->gpe_start && + e1->gpe_end <= e2->gpe_end) { + DPRINTF("partition %d has end offset inside " + "partition %d: start[%d] %jd >= end[%d] " + "%jd <= end[%d] %jd\n", + e1->gpe_index, e2->gpe_index, + e2->gpe_index, (intmax_t)e2->gpe_start, + e1->gpe_index, (intmax_t)e1->gpe_end, + e2->gpe_index, (intmax_t)e2->gpe_end); + failed++; + } + if (e1->gpe_start < e2->gpe_start && + e1->gpe_end > e2->gpe_end) { + DPRINTF("partition %d contains partition %d: " + "start[%d] %jd > start[%d] %jd, end[%d] " + "%jd < end[%d] %jd\n", + e1->gpe_index, e2->gpe_index, + e1->gpe_index, (intmax_t)e1->gpe_start, + e2->gpe_index, (intmax_t)e2->gpe_start, + e2->gpe_index, (intmax_t)e2->gpe_end, + e1->gpe_index, (intmax_t)e1->gpe_end); + failed++; + } + } + } + if (failed != 0) { + printf("GEOM_PART: integrity check failed (%s, %s)\n", + pp->name, table->gpt_scheme->name); + if (check_integrity != 0) + return (EINVAL); + table->gpt_corrupt = 1; + } + return (0); +} +#undef DPRINTF + struct g_part_entry * g_part_new_entry(struct g_part_table *table, int index, quad_t start, quad_t end) @@ -542,7 +667,11 @@ g_part_ctl_add(struct gctl_req *req, str if (gpp->gpp_parms & G_PART_PARM_OUTPUT) { sb = sbuf_new_auto(); G_PART_FULLNAME(table, entry, sb, gp->name); - sbuf_cat(sb, " added\n"); + if (pp->stripesize > 0 && entry->gpe_pp->stripeoffset != 0) + sbuf_printf(sb, " added, but partition is not " + "aligned on %u bytes\n", pp->stripesize); + else + sbuf_cat(sb, " added\n"); sbuf_finish(sb); gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); sbuf_delete(sb); @@ -1243,9 +1372,11 @@ g_part_ctl_undo(struct gctl_req *req, st error = G_PART_READ(table, cp); if (error) goto fail; + error = g_part_check_integrity(table, cp); + if (error) + goto fail; g_topology_lock(); - LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { if (!entry->gpe_internal) g_part_new_provider(gp, table, entry); @@ -1711,6 +1842,9 @@ g_part_taste(struct g_class *mp, struct error = G_PART_READ(table, cp); if (error) goto fail; + error = g_part_check_integrity(table, cp); + if (error) + goto fail; g_topology_lock(); LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 08:51:24 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97334106564A; Thu, 26 Jan 2012 08:51:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8194D8FC14; Thu, 26 Jan 2012 08:51:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q8pOZH073099; Thu, 26 Jan 2012 08:51:24 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q8pO3f073097; Thu, 26 Jan 2012 08:51:24 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260851.q0Q8pO3f073097@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 08:51: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: r230568 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 08:51:24 -0000 Author: ae Date: Thu Jan 26 08:51:23 2012 New Revision: 230568 URL: http://svn.freebsd.org/changeset/base/230568 Log: Disable integrity checks by default. It will warn users about found problems, but will not reject partition tables. This is direct commit to stable/8. Modified: stable/8/sys/geom/part/g_part.c Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Thu Jan 26 08:47:29 2012 (r230567) +++ stable/8/sys/geom/part/g_part.c Thu Jan 26 08:51:23 2012 (r230568) @@ -107,10 +107,10 @@ struct g_part_alias_list { SYSCTL_DECL(_kern_geom); SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0, "GEOM_PART stuff"); -static u_int check_integrity = 1; +static u_int check_integrity = 0; TUNABLE_INT("kern.geom.part.check_integrity", &check_integrity); SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RW, - &check_integrity, 1, "Enable integrity checking"); + &check_integrity, 0, "Enable integrity checking"); /* * The GEOM partitioning class. From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 09:13:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75EE7106566C; Thu, 26 Jan 2012 09:13:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mail.kirov.so-ups.ru (mail.kirov.so-ups.ru [178.74.170.1]) by mx1.freebsd.org (Postfix) with ESMTP id 104C68FC13; Thu, 26 Jan 2012 09:13:29 +0000 (UTC) Received: from kas30pipe.localhost (localhost.kirov.so-ups.ru [127.0.0.1]) by mail.kirov.so-ups.ru (Postfix) with SMTP id 8242FB8024; Thu, 26 Jan 2012 12:58:17 +0400 (MSK) Received: from kirov.so-ups.ru (unknown [172.21.81.1]) by mail.kirov.so-ups.ru (Postfix) with ESMTP id 78273B801F; Thu, 26 Jan 2012 12:58:17 +0400 (MSK) Received: by ns.kirov.so-ups.ru (Postfix, from userid 1010) id 6E0E9B8FA4; Thu, 26 Jan 2012 12:58:17 +0400 (MSK) Received: from [127.0.0.1] (elsukov.kirov.oduur.so [10.118.3.52]) by ns.kirov.so-ups.ru (Postfix) with ESMTP id 34493B8F9E; Thu, 26 Jan 2012 12:58:17 +0400 (MSK) Message-ID: <4F2115A2.2010803@FreeBSD.org> Date: Thu, 26 Jan 2012 12:58:10 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org References: <201201260851.q0Q8pO3f073097@svn.freebsd.org> In-Reply-To: <201201260851.q0Q8pO3f073097@svn.freebsd.org> X-Enigmail-Version: 1.3.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigAC6D67F83E2C0D98DF02A2DC" X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0284], KAS30/Release X-SpamTest-Info: Not protected Cc: Subject: Re: svn commit: r230568 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 09:13:30 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigAC6D67F83E2C0D98DF02A2DC Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On 26.01.2012 12:51, Andrey V. Elsukov wrote: > Author: ae > Date: Thu Jan 26 08:51:23 2012 > New Revision: 230568 > URL: http://svn.freebsd.org/changeset/base/230568 >=20 > Log: > Disable integrity checks by default. It will warn users about found > problems, but will not reject partition tables. Users may discover that their partition tables marked as corrupted. This will prevent modifying tables and write boot code, but probably this behavior should be disabled in 8-STABLE. Any opinions are welcome. --=20 WBR, Andrey V. Elsukov --------------enigAC6D67F83E2C0D98DF02A2DC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJPIRWpAAoJEAHF6gQQyKF6XGIH/2GiDk6veIiE0MYVKze6hXuo xNEQHfatazbEff9q+EJGv81oN/4WqJ3ugvx2d+l/r7Ed6U6mTTtlytbK2xAgRpna GE3kueF7j6Hvc3JkMcNVqGHZPynJRmQG3BdrC0LeqrNmqRtBHnSAn3LU8rneXX+f jJ8LMTj4sEaxwsYtsO3oMRyo2gMV1X9ayZ4944ibW5CPk+UpF5YSlhLdu75xgqWw aEhSZyHMVgdFk2NdEl9UleK4T0dKiVm8Bf3qHIGjWDmYhjbBoxs14U0ZdCQ211is T5WLnaQZTt/H0+zmvvzUfw/PhJmpezTlT5FbP8rp7ayum4Q4zCFi2QRKqbmIDFM= =2T7L -----END PGP SIGNATURE----- --------------enigAC6D67F83E2C0D98DF02A2DC-- From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 09:14:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D0001065673; Thu, 26 Jan 2012 09:14:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2428FC08; Thu, 26 Jan 2012 09:14:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q9Ep09073975; Thu, 26 Jan 2012 09:14:51 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q9Epj9073973; Thu, 26 Jan 2012 09:14:51 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260914.q0Q9Epj9073973@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 09:14: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: r230569 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 09:14:52 -0000 Author: ae Date: Thu Jan 26 09:14:51 2012 New Revision: 230569 URL: http://svn.freebsd.org/changeset/base/230569 Log: MFC r216132 (by ivoras): Add a note about the magic number 20. Actually, 22.75 entries fit in a 512 byte sector but when choosing magic numbers, 20 looks nicer. MFC r223332: Change the way how we update bootcode for BSD scheme. Since the only parameter that we check is size of bootcode, then allow only two sizes: size of boot1 and size of /boot/boot. This partially protects users from losing ability to boot if incorrect bootcode is specified. Modified: stable/8/sys/geom/part/g_part_bsd.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_bsd.c ============================================================================== --- stable/8/sys/geom/part/g_part_bsd.c Thu Jan 26 08:51:23 2012 (r230568) +++ stable/8/sys/geom/part/g_part_bsd.c Thu Jan 26 09:14:51 2012 (r230569) @@ -45,6 +45,11 @@ __FBSDID("$FreeBSD$"); #include "g_part_if.h" +#define BOOT1_SIZE 512 +#define LABEL_SIZE 512 +#define BOOT2_OFF (BOOT1_SIZE + LABEL_SIZE) +#define BOOT2_SIZE (BBSIZE - BOOT2_OFF) + struct g_part_bsd_table { struct g_part_table base; u_char *bbarea; @@ -99,7 +104,7 @@ static struct g_part_scheme g_part_bsd_s sizeof(struct g_part_bsd_table), .gps_entrysz = sizeof(struct g_part_bsd_entry), .gps_minent = 8, - .gps_maxent = 20, + .gps_maxent = 20, /* Only 22 entries fit in 512 byte sectors */ .gps_bootcodesz = BBSIZE, }; G_PART_SCHEME_DECLARE(g_part_bsd); @@ -167,22 +172,16 @@ g_part_bsd_bootcode(struct g_part_table { struct g_part_bsd_table *table; const u_char *codeptr; - size_t hdsz, tlsz; - size_t codesz, tlofs; - hdsz = 512; - tlofs = hdsz + 148 + basetable->gpt_entries * 16; - tlsz = BBSIZE - tlofs; + if (gpp->gpp_codesize != BOOT1_SIZE && gpp->gpp_codesize != BBSIZE) + return (ENODEV); + table = (struct g_part_bsd_table *)basetable; - bzero(table->bbarea, hdsz); - bzero(table->bbarea + tlofs, tlsz); codeptr = gpp->gpp_codeptr; - codesz = MIN(hdsz, gpp->gpp_codesize); - if (codesz > 0) - bcopy(codeptr, table->bbarea, codesz); - codesz = MIN(tlsz, gpp->gpp_codesize - tlofs); - if (codesz > 0) - bcopy(codeptr + tlofs, table->bbarea + tlofs, codesz); + bcopy(codeptr, table->bbarea, BOOT1_SIZE); + if (gpp->gpp_codesize == BBSIZE) + bcopy(codeptr + BOOT2_OFF, table->bbarea + BOOT2_OFF, + BOOT2_SIZE); return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 09:28:10 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5686E106566B; Thu, 26 Jan 2012 09:28:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26D7A8FC17; Thu, 26 Jan 2012 09:28:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q9SAWG074444; Thu, 26 Jan 2012 09:28:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q9SAkJ074442; Thu, 26 Jan 2012 09:28:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260928.q0Q9SAkJ074442@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 09:28: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: r230570 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 09:28:10 -0000 Author: ae Date: Thu Jan 26 09:28:09 2012 New Revision: 230570 URL: http://svn.freebsd.org/changeset/base/230570 Log: MFC r222279: Do not truncate available disk space to the closest track boundary. MFC r222341: Some partitioning tools may have a different opinion about disk geometry and partitions may start from withing the first track. If we found such partitions, then do not reserve space of the first track, only first sector. Modified: stable/8/sys/geom/part/g_part_mbr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_mbr.c ============================================================================== --- stable/8/sys/geom/part/g_part_mbr.c Thu Jan 26 09:14:51 2012 (r230569) +++ stable/8/sys/geom/part/g_part_mbr.c Thu Jan 26 09:28:09 2012 (r230570) @@ -252,15 +252,14 @@ g_part_mbr_create(struct g_part_table *b { struct g_provider *pp; struct g_part_mbr_table *table; - uint32_t msize; pp = gpp->gpp_provider; if (pp->sectorsize < MBRSIZE) return (ENOSPC); - msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); basetable->gpt_first = basetable->gpt_sectors; - basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; + basetable->gpt_last = MIN(pp->mediasize / pp->sectorsize, + UINT32_MAX) - 1; table = (struct g_part_mbr_table *)basetable; le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); @@ -423,12 +422,13 @@ g_part_mbr_read(struct g_part_table *bas struct g_part_mbr_table *table; struct g_part_mbr_entry *entry; u_char *buf, *p; - off_t chs, msize; + off_t chs, msize, first; u_int sectors, heads; int error, index; pp = cp->provider; table = (struct g_part_mbr_table *)basetable; + first = basetable->gpt_sectors; msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); buf = g_read_data(cp, 0L, pp->sectorsize, &error); @@ -461,7 +461,8 @@ g_part_mbr_read(struct g_part_table *bas basetable->gpt_heads = heads; } } - + if (ent.dp_start < first) + first = ent.dp_start; entry = (struct g_part_mbr_entry *)g_part_new_entry(basetable, index + 1, ent.dp_start, ent.dp_start + ent.dp_size - 1); entry->ent = ent; @@ -469,7 +470,10 @@ g_part_mbr_read(struct g_part_table *bas basetable->gpt_entries = NDOSPART; basetable->gpt_first = basetable->gpt_sectors; - basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1; + basetable->gpt_last = msize - 1; + + if (first < basetable->gpt_first) + basetable->gpt_first = 1; g_free(buf); return (0); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 09:56:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C482106566C; Thu, 26 Jan 2012 09:56:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 169C48FC13; Thu, 26 Jan 2012 09:56:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0Q9uTa9075427; Thu, 26 Jan 2012 09:56:29 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0Q9uT7c075425; Thu, 26 Jan 2012 09:56:29 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201260956.q0Q9uT7c075425@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 09: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: r230573 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 09:56:30 -0000 Author: ae Date: Thu Jan 26 09:56:29 2012 New Revision: 230573 URL: http://svn.freebsd.org/changeset/base/230573 Log: MFC r222281: Do not truncate available disk space to the closest track boundary. Modified: stable/8/sys/geom/part/g_part_pc98.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part_pc98.c ============================================================================== --- stable/8/sys/geom/part/g_part_pc98.c Thu Jan 26 09:55:16 2012 (r230572) +++ stable/8/sys/geom/part/g_part_pc98.c Thu Jan 26 09:56:29 2012 (r230573) @@ -220,7 +220,6 @@ g_part_pc98_create(struct g_part_table * { struct g_provider *pp; struct g_part_pc98_table *table; - uint32_t cyl, msize; pp = gpp->gpp_provider; if (pp->sectorsize < SECSIZE || pp->mediasize < 2 * SECSIZE) @@ -228,11 +227,8 @@ g_part_pc98_create(struct g_part_table * if (pp->sectorsize > SECSIZE) return (ENXIO); - cyl = basetable->gpt_heads * basetable->gpt_sectors; - - msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX); - basetable->gpt_first = cyl; - basetable->gpt_last = msize - (msize % cyl) - 1; + basetable->gpt_first = basetable->gpt_heads * basetable->gpt_sectors; + basetable->gpt_last = MIN(pp->mediasize / SECSIZE, UINT32_MAX) - 1; table = (struct g_part_pc98_table *)basetable; le16enc(table->boot + DOSMAGICOFFSET, DOSMAGIC); @@ -453,7 +449,7 @@ g_part_pc98_read(struct g_part_table *ba basetable->gpt_entries = NDOSPART; basetable->gpt_first = cyl; - basetable->gpt_last = msize - (msize % cyl) - 1; + basetable->gpt_last = msize - 1; g_free(buf); return (0); From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 10:33:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28D1F106564A; Thu, 26 Jan 2012 10:33:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06ED48FC14; Thu, 26 Jan 2012 10:33:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0QAXJ4A076763; Thu, 26 Jan 2012 10:33:19 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0QAXJSA076754; Thu, 26 Jan 2012 10:33:19 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201201261033.q0QAXJSA076754@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 26 Jan 2012 10:33: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: r230575 - in stable/8: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 10:33:20 -0000 Author: ae Date: Thu Jan 26 10:33:19 2012 New Revision: 230575 URL: http://svn.freebsd.org/changeset/base/230575 Log: MFC r223666: Add new rule actions "call" and "return" to ipfw. They make possible to organize subroutines with rules. The "call" action saves the current rule number in the internal stack and rules processing continues from the first rule with specified number (similar to skipto action). If later a rule with "return" action is encountered, the processing returns to the first rule with number of "call" rule saved in the stack plus one or higher. Submitted by: Vadim Goncharov Modified: stable/8/sbin/ipfw/ipfw.8 stable/8/sbin/ipfw/ipfw2.c stable/8/sbin/ipfw/ipfw2.h stable/8/sys/netinet/ip_fw.h stable/8/sys/netinet/ip_var.h stable/8/sys/netinet/ipfw/ip_fw2.c stable/8/sys/netinet/ipfw/ip_fw_log.c stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Directory Properties: stable/8/sbin/ipfw/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/sbin/ipfw/ipfw.8 ============================================================================== --- stable/8/sbin/ipfw/ipfw.8 Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sbin/ipfw/ipfw.8 Thu Jan 26 10:33:19 2012 (r230575) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2011 +.Dd June 29, 2011 .Dt IPFW 8 .Os .Sh NAME @@ -818,6 +818,78 @@ skipto, but care should be used, as no d is possible in this case so the rules are always walked to find it, starting from the .Cm skipto . +.It Cm call Ar number | tablearg +The current rule number is saved in the internal stack and +ruleset processing continues with the first rule numbered +.Ar number +or higher. +If later a rule with the +.Cm return +action is encountered, the processing returns to the first rule +with number of this +.Cm call +rule plus one or higher +(the same behaviour as with packets returning from +.Xr divert 4 +socket after a +.Cm divert +action). +This could be used to make somewhat like an assembly language +.Dq subroutine +calls to rules with common checks for different interfaces, etc. +.Pp +Rule with any number could be called, not just forward jumps as with +.Cm skipto . +So, to prevent endless loops in case of mistakes, both +.Cm call +and +.Cm return +actions don't do any jumps and simply go to the next rule if memory +can't be allocated or stack overflowed/undeflowed. +.Pp +Internally stack for rule numbers is implemented using +.Xr mbuf_tags 9 +facility and currently has size of 16 entries. +As mbuf tags are lost when packet leaves the kernel, +.Cm divert +should not be used in subroutines to avoid endless loops +and other undesired effects. +.It Cm return +Takes rule number saved to internal stack by the last +.Cm call +action and returns ruleset processing to the first rule +with number greater than number of corresponding +.Cm call +rule. See description of the +.Cm call +action for more details. +.Pp +Note that +.Cm return +rules usually end a +.Dq subroutine +and thus are unconditional, but +.Nm +command-line utility currently requires every action except +.Cm check-state +to have body. +While it is sometimes useful to return only on some packets, +usually you want to print just +.Dq return +for readability. +A workaround for this is to use new syntax and +.Fl c +switch: +.Pp +.Bd -literal -offset indent +# Add a rule without actual body +ipfw add 2999 return via any + +# List rules without "from any to any" part +ipfw -c list +.Ed +.Pp +This cosmetic annoyance may be fixed in future releases. .It Cm tee Ar port Send a copy of packets matching this rule to the .Xr divert 4 @@ -3240,3 +3312,18 @@ for the respective conversations. To avoid failures of network error detection and path MTU discovery, ICMP error messages may need to be allowed explicitly through static rules. +.Pp +Rules using +.Cm call +and +.Cm return +actions may lead to confusing behaviour if ruleset has mistakes, +and/or interaction with other subsystems (netgraph, dummynet, etc.) is used. +One possible case for this is packet leaving +.Nm +in subroutine on the input pass, while later on output encountering unpaired +.Cm return +first. +As the call stack is kept intact after input pass, packet will suddenly +return to the rule number used on input pass, not on output one. +Order of processing should be checked carefully to avoid such mistakes. Modified: stable/8/sbin/ipfw/ipfw2.c ============================================================================== --- stable/8/sbin/ipfw/ipfw2.c Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sbin/ipfw/ipfw2.c Thu Jan 26 10:33:19 2012 (r230575) @@ -213,6 +213,8 @@ static struct _s_x rule_actions[] = { { "nat", TOK_NAT }, { "reass", TOK_REASS }, { "setfib", TOK_SETFIB }, + { "call", TOK_CALL }, + { "return", TOK_RETURN }, { NULL, 0 } /* terminator */ }; @@ -1126,6 +1128,13 @@ show_ipfw(struct ip_fw *rule, int pcwidt printf("reass"); break; + case O_CALLRETURN: + if (cmd->len & F_NOT) + printf("return"); + else + PRINT_UINT_ARG("call ", cmd->arg1); + break; + default: printf("** unrecognized action %d len %d ", cmd->opcode, cmd->len); @@ -2762,6 +2771,9 @@ ipfw_add(char *av[]) goto chkarg; case TOK_TEE: action->opcode = O_TEE; + goto chkarg; + case TOK_CALL: + action->opcode = O_CALLRETURN; chkarg: if (!av[0]) errx(EX_USAGE, "missing argument for %s", *(av - 1)); @@ -2854,6 +2866,10 @@ chkarg: action->opcode = O_REASS; break; + case TOK_RETURN: + fill_cmd(action, O_CALLRETURN, F_NOT, 0); + break; + default: errx(EX_DATAERR, "invalid action %s\n", av[-1]); } Modified: stable/8/sbin/ipfw/ipfw2.h ============================================================================== --- stable/8/sbin/ipfw/ipfw2.h Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sbin/ipfw/ipfw2.h Thu Jan 26 10:33:19 2012 (r230575) @@ -99,6 +99,8 @@ enum tokens { TOK_CHECKSTATE, TOK_NAT, TOK_REASS, + TOK_CALL, + TOK_RETURN, TOK_ALTQ, TOK_LOG, Modified: stable/8/sys/netinet/ip_fw.h ============================================================================== --- stable/8/sys/netinet/ip_fw.h Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sys/netinet/ip_fw.h Thu Jan 26 10:33:19 2012 (r230575) @@ -57,6 +57,12 @@ #define IP_FW_TABLEARG 65535 /* XXX should use 0 */ /* + * Number of entries in the call stack of the call/return commands. + * Call stack currently is an uint16_t array with rule numbers. + */ +#define IPFW_CALLSTACK_SIZE 16 + +/* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF * instructions), which specify which fields of the packet @@ -193,6 +199,8 @@ enum ipfw_opcodes { /* arguments (4 byt O_SETFIB, /* arg1=FIB number */ O_FIB, /* arg1=FIB desired fib number */ + O_CALLRETURN, /* arg1=called rule number */ + O_LAST_OPCODE /* not an opcode! */ }; Modified: stable/8/sys/netinet/ip_var.h ============================================================================== --- stable/8/sys/netinet/ip_var.h Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sys/netinet/ip_var.h Thu Jan 26 10:33:19 2012 (r230575) @@ -287,6 +287,7 @@ enum { }; #define MTAG_IPFW 1148380143 /* IPFW-tagged cookie */ #define MTAG_IPFW_RULE 1262273568 /* rule reference */ +#define MTAG_IPFW_CALL 1308397630 /* call stack */ struct ip_fw_args; typedef int (*ip_fw_chk_ptr_t)(struct ip_fw_args *args); Modified: stable/8/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw2.c Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sys/netinet/ipfw/ip_fw2.c Thu Jan 26 10:33:19 2012 (r230575) @@ -2030,6 +2030,123 @@ do { \ continue; break; /* not reached */ + case O_CALLRETURN: { + /* + * Implementation of `subroutine' call/return, + * in the stack carried in an mbuf tag. This + * is different from `skipto' in that any call + * address is possible (`skipto' must prevent + * backward jumps to avoid endless loops). + * We have `return' action when F_NOT flag is + * present. The `m_tag_id' field is used as + * stack pointer. + */ + struct m_tag *mtag; + uint16_t jmpto, *stack; + +#define IS_CALL ((cmd->len & F_NOT) == 0) +#define IS_RETURN ((cmd->len & F_NOT) != 0) + /* + * Hand-rolled version of m_tag_locate() with + * wildcard `type'. + * If not already tagged, allocate new tag. + */ + mtag = m_tag_first(m); + while (mtag != NULL) { + if (mtag->m_tag_cookie == + MTAG_IPFW_CALL) + break; + mtag = m_tag_next(m, mtag); + } + if (mtag == NULL && IS_CALL) { + mtag = m_tag_alloc(MTAG_IPFW_CALL, 0, + IPFW_CALLSTACK_SIZE * + sizeof(uint16_t), M_NOWAIT); + if (mtag != NULL) + m_tag_prepend(m, mtag); + } + + /* + * On error both `call' and `return' just + * continue with next rule. + */ + if (IS_RETURN && (mtag == NULL || + mtag->m_tag_id == 0)) { + l = 0; /* exit inner loop */ + break; + } + if (IS_CALL && (mtag == NULL || + mtag->m_tag_id >= IPFW_CALLSTACK_SIZE)) { + printf("ipfw: call stack error, " + "go to next rule\n"); + l = 0; /* exit inner loop */ + break; + } + + f->pcnt++; /* update stats */ + f->bcnt += pktlen; + f->timestamp = time_uptime; + stack = (uint16_t *)(mtag + 1); + + /* + * The `call' action may use cached f_pos + * (in f->next_rule), whose version is written + * in f->next_rule. + * The `return' action, however, doesn't have + * fixed jump address in cmd->arg1 and can't use + * cache. + */ + if (IS_CALL) { + stack[mtag->m_tag_id] = f->rulenum; + mtag->m_tag_id++; + if (cmd->arg1 != IP_FW_TABLEARG && + (uintptr_t)f->x_next == chain->id) { + f_pos = (uintptr_t)f->next_rule; + } else { + jmpto = (cmd->arg1 == + IP_FW_TABLEARG) ? tablearg: + cmd->arg1; + f_pos = ipfw_find_rule(chain, + jmpto, 0); + /* update the cache */ + if (cmd->arg1 != + IP_FW_TABLEARG) { + f->next_rule = + (void *)(uintptr_t) + f_pos; + f->x_next = + (void *)(uintptr_t) + chain->id; + } + } + } else { /* `return' action */ + mtag->m_tag_id--; + jmpto = stack[mtag->m_tag_id] + 1; + f_pos = ipfw_find_rule(chain, jmpto, 0); + } + + /* + * Skip disabled rules, and re-enter + * the inner loop with the correct + * f_pos, f, l and cmd. + * Also clear cmdlen and skip_or + */ + for (; f_pos < chain->n_rules - 1 && + (V_set_disable & + (1 << chain->map[f_pos]->set)); f_pos++) + ; + /* Re-enter the inner loop at the dest rule. */ + f = chain->map[f_pos]; + l = f->cmd_len; + cmd = f->cmd; + cmdlen = 0; + skip_or = 0; + continue; + break; /* NOTREACHED */ + } +#undef IS_CALL +#undef IS_RETURN + case O_REJECT: /* * Drop the packet and send a reject notice Modified: stable/8/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_log.c Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sys/netinet/ipfw/ip_fw_log.c Thu Jan 26 10:33:19 2012 (r230575) @@ -299,6 +299,13 @@ ipfw_log(struct ip_fw *f, u_int hlen, st case O_REASS: action = "Reass"; break; + case O_CALLRETURN: + if (cmd->len & F_NOT) + action = "Return"; + else + snprintf(SNPARGS(action2, 0), "Call %d", + cmd->arg1); + break; default: action = "UNKNOWN"; break; Modified: stable/8/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Thu Jan 26 10:30:50 2012 (r230574) +++ stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Thu Jan 26 10:33:19 2012 (r230575) @@ -746,6 +746,7 @@ check_ipfw_struct(struct ip_fw *rule, in #endif case O_SKIPTO: case O_REASS: + case O_CALLRETURN: check_size: if (cmdlen != F_INSN_SIZE(ipfw_insn)) goto bad_size; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 19:18:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250E61065675; Thu, 26 Jan 2012 19:18:11 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1339E8FC12; Thu, 26 Jan 2012 19:18:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0QJIAJn002290; Thu, 26 Jan 2012 19:18:10 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0QJIAkY002288; Thu, 26 Jan 2012 19:18:10 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201201261918.q0QJIAkY002288@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Thu, 26 Jan 2012 19:18: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: r230596 - stable/8/sys/dev/acpica X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 19:18:11 -0000 Author: dumbbell Date: Thu Jan 26 19:18:10 2012 New Revision: 230596 URL: http://svn.freebsd.org/changeset/base/230596 Log: MFC r227992: Prevent a division by zero with some broken batteries This problem was seen on a laptop with a dead battery. Modified: stable/8/sys/dev/acpica/acpi_battery.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_battery.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_battery.c Thu Jan 26 19:15:13 2012 (r230595) +++ stable/8/sys/dev/acpica/acpi_battery.c Thu Jan 26 19:18:10 2012 (r230596) @@ -205,6 +205,14 @@ acpi_battery_get_battinfo(device_t dev, bif->lfcap = (bif->lfcap * bif->dvol) / 1000; } + /* + * The calculation above may set bif->lfcap to zero. This was + * seen on a laptop with a broken battery. The result of the + * division was rounded to zero. + */ + if (!acpi_battery_bif_valid(bif)) + continue; + /* Calculate percent capacity remaining. */ bi[i].cap = (100 * bst[i].cap) / bif->lfcap; From owner-svn-src-stable-8@FreeBSD.ORG Thu Jan 26 22:01:06 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58900106566B; Thu, 26 Jan 2012 22:01:06 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 448088FC0C; Thu, 26 Jan 2012 22:01:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0QM16gx008331; Thu, 26 Jan 2012 22:01:06 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0QM15Sh008320; Thu, 26 Jan 2012 22:01:05 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201201262201.q0QM15Sh008320@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Thu, 26 Jan 2012 22:01:05 +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: r230603 - in stable/8: sbin/dhclient tools/regression/sbin tools/regression/sbin/dhclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 22:01:06 -0000 Author: dumbbell Date: Thu Jan 26 22:01:05 2012 New Revision: 230603 URL: http://svn.freebsd.org/changeset/base/230603 Log: MFC r228259: Support domain-search in dhclient(8) The "domain-search" option (option 119) allows a DHCP server to publish a list of implicit domain suffixes used during name lookup. This option is described in RFC 3397. For instance, if the domain-search option says: ".example.org .example.com" and one wants to resolve "foobar", the resolver will try: 1. "foobar.example.org" 2. "foobar.example.com" The file /etc/resolv.conf is updated with a "search" directive if the DHCP server provides "domain-search". A regression test suite is included in this patch under tools/regression/sbin/dhclient. PR: bin/151940 Sponsored by: Yakaz (http://www.yakaz.com) MFC r229000: Invalid Domain Search option isn't considered as a fatal error In the original Domain Search option patch, an invalid option value would cause the whole lease to be rejected. However, DHCP servers who emit such an invalid value are more common than I thought. With this new patch, just the option is rejected, not the entire lease. PR: bin/163431 Submitted by: Fabian Keil (earlier version) Reviewed by: Fabian Keil Sponsored by: Yakaz (http://www.yakaz.com) MFC r229001: Adapt testsuite following change in Domain Search error handling In this testsuite, warning() and error() have the same behaviour. PR: bin/163431 Sponsored by: Yakaz (http://www.yakaz.com) Added: stable/8/tools/regression/sbin/dhclient/ - copied from r228259, head/tools/regression/sbin/dhclient/ Modified: stable/8/sbin/dhclient/clparse.c stable/8/sbin/dhclient/dhclient-script stable/8/sbin/dhclient/dhclient.c stable/8/sbin/dhclient/dhcp-options.5 stable/8/sbin/dhclient/dhcp.h stable/8/sbin/dhclient/options.c stable/8/sbin/dhclient/tables.c stable/8/tools/regression/sbin/Makefile stable/8/tools/regression/sbin/dhclient/fake.c Directory Properties: stable/8/sbin/dhclient/ (props changed) stable/8/tools/ (props changed) Modified: stable/8/sbin/dhclient/clparse.c ============================================================================== --- stable/8/sbin/dhclient/clparse.c Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/clparse.c Thu Jan 26 22:01:05 2012 (r230603) @@ -100,6 +100,8 @@ read_client_conf(void) DHO_DOMAIN_NAME_SERVERS; top_level_config.requested_options [top_level_config.requested_option_count++] = DHO_HOST_NAME; + top_level_config.requested_options + [top_level_config.requested_option_count++] = DHO_DOMAIN_SEARCH; if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) { do { Modified: stable/8/sbin/dhclient/dhclient-script ============================================================================== --- stable/8/sbin/dhclient/dhclient-script Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/dhclient-script Thu Jan 26 22:01:05 2012 (r230603) @@ -201,7 +201,9 @@ add_new_resolv_conf() { local tmpres=/var/run/resolv.conf.${interface} rm -f $tmpres - if [ -n "$new_domain_name" ]; then + if [ -n "$new_domain_search" ]; then + echo "search $new_domain_search" >>$tmpres + elif [ -n "$new_domain_name" ]; then echo "search $new_domain_name" >>$tmpres fi Modified: stable/8/sbin/dhclient/dhclient.c ============================================================================== --- stable/8/sbin/dhclient/dhclient.c Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/dhclient.c Thu Jan 26 22:01:05 2012 (r230603) @@ -2368,6 +2368,7 @@ check_option(struct client_lease *l, int } return (1); case DHO_DOMAIN_NAME: + case DHO_DOMAIN_SEARCH: if (!res_hnok(sbuf)) { if (!check_search(sbuf)) { warning("Bogus domain search list %d: %s (%s)", Modified: stable/8/sbin/dhclient/dhcp-options.5 ============================================================================== --- stable/8/sbin/dhclient/dhcp-options.5 Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/dhcp-options.5 Thu Jan 26 22:01:05 2012 (r230603) @@ -265,6 +265,10 @@ character set. .It Ic option domain-name Ar string ; This option specifies the domain name that the client should use when resolving hostnames via the Domain Name System. +.It Ic option domain-search Ar string ; +This option specifies a list of domain names that the client should use +when resolving hostnames via the Domain Name System. This option is +defined in RFC 3397. .It Ic option swap-server Ar ip-address ; This specifies the IP address of the client's swap server. .It Ic option root-path Ar string ; Modified: stable/8/sbin/dhclient/dhcp.h ============================================================================== --- stable/8/sbin/dhclient/dhcp.h Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/dhcp.h Thu Jan 26 22:01:05 2012 (r230603) @@ -169,6 +169,7 @@ struct dhcp_packet { #define DHO_STREETTALK_SERVER 75 #define DHO_STREETTALK_DA_SERVER 76 #define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_DOMAIN_SEARCH 119 #define DHO_CLASSLESS_ROUTES 121 #define DHO_END 255 Modified: stable/8/sbin/dhclient/options.c ============================================================================== --- stable/8/sbin/dhclient/options.c Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/options.c Thu Jan 26 22:01:05 2012 (r230603) @@ -55,6 +55,10 @@ void parse_options(struct packet *); void parse_option_buffer(struct packet *, unsigned char *, int); int store_options(unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int, int); +void expand_domain_search(struct packet *packet); +int find_search_domain_name_len(struct option_data *option, int *offset); +void expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search); /* @@ -94,6 +98,11 @@ parse_options(struct packet *packet) (unsigned char *)packet->raw->sname, sizeof(packet->raw->sname)); } + + /* Expand DHCP Domain Search option. */ + if (packet->options_valid) { + expand_domain_search(packet); + } } /* @@ -194,6 +203,171 @@ parse_option_buffer(struct packet *packe } /* + * Expand DHCP Domain Search option. The value of this option is + * encoded like DNS' list of labels. See: + * RFC 3397 + * RFC 1035 + */ +void +expand_domain_search(struct packet *packet) +{ + int offset, expanded_len, next_domain_len; + struct option_data *option; + unsigned char *domain_search, *cursor; + + if (packet->options[DHO_DOMAIN_SEARCH].data == NULL) + return; + + option = &packet->options[DHO_DOMAIN_SEARCH]; + + /* Compute final expanded length. */ + expanded_len = 0; + offset = 0; + while (offset < option->len) { + next_domain_len = find_search_domain_name_len(option, &offset); + if (next_domain_len < 0) + /* The Domain Search option value is invalid. */ + return; + + /* We add 1 for the space between domain names. */ + expanded_len += next_domain_len + 1; + } + if (expanded_len > 0) + /* Remove 1 for the superfluous trailing space. */ + --expanded_len; + + domain_search = malloc(expanded_len + 1); + if (domain_search == NULL) + error("Can't allocate storage for expanded domain-search\n"); + + offset = 0; + cursor = domain_search; + while (offset < option->len) { + expand_search_domain_name(option, &offset, &cursor); + cursor[0] = ' '; + cursor++; + } + domain_search[expanded_len] = '\0'; + + free(option->data); + option->len = expanded_len; + option->data = domain_search; +} + +int +find_search_domain_name_len(struct option_data *option, int *offset) +{ + int domain_name_len, i, label_len, pointer, pointed_len; + + domain_name_len = 0; + + i = *offset; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + return (domain_name_len); + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + if (i + 1 >= option->len) { + /* The pointer is truncated. */ + warning("Truncated pointer in DHCP Domain " + "Search option."); + return (-1); + } + + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + if (pointer >= *offset) { + /* + * The pointer must indicates a prior + * occurance. + */ + warning("Invalid forward pointer in DHCP " + "Domain Search option compression."); + return (-1); + } + + pointed_len = find_search_domain_name_len(option, + &pointer); + domain_name_len += pointed_len; + + *offset = i + 2; + return (domain_name_len); + } + + if (i + label_len >= option->len) { + warning("Truncated label in DHCP Domain Search " + "option."); + return (-1); + } + + /* + * Update the domain name length with the length of the + * current label, plus a trailing dot ('.'). + */ + domain_name_len += label_len + 1; + + /* Move cursor. */ + i += label_len + 1; + } + + warning("Truncated DHCP Domain Search option."); + + return (-1); +} + +void +expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search) +{ + int i, label_len, pointer; + unsigned char *cursor; + + /* + * This is the same loop than the function above + * (find_search_domain_name_len). Therefore, we remove checks, + * they're already done. Here, we just make the copy. + */ + i = *offset; + cursor = *domain_search; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + *domain_search = cursor; + return; + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + + expand_search_domain_name(option, &pointer, &cursor); + + *offset = i + 2; + *domain_search = cursor; + return; + } + + /* Copy the label found. */ + memcpy(cursor, option->data + i + 1, label_len); + cursor[label_len] = '.'; + + /* Move cursor. */ + i += label_len + 1; + cursor += label_len + 1; + } +} + +/* * cons options into a big buffer, and then split them out into the * three separate buffers if needed. This allows us to cons up a set of * vendor options using the same routine. Modified: stable/8/sbin/dhclient/tables.c ============================================================================== --- stable/8/sbin/dhclient/tables.c Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/sbin/dhclient/tables.c Thu Jan 26 22:01:05 2012 (r230603) @@ -184,7 +184,7 @@ struct option dhcp_options[256] = { { "option-116", "X", &dhcp_universe, 116 }, { "option-117", "X", &dhcp_universe, 117 }, { "option-118", "X", &dhcp_universe, 118 }, - { "option-119", "X", &dhcp_universe, 119 }, + { "domain-search", "t", &dhcp_universe, 119 }, { "option-120", "X", &dhcp_universe, 120 }, { "classless-routes", "BA", &dhcp_universe, 121 }, { "option-122", "X", &dhcp_universe, 122 }, @@ -400,12 +400,13 @@ unsigned char dhcp_option_default_priori DHO_IRC_SERVER, DHO_STREETTALK_SERVER, DHO_STREETTALK_DA_SERVER, + DHO_DOMAIN_SEARCH, /* Presently-undefined options... */ 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, Modified: stable/8/tools/regression/sbin/Makefile ============================================================================== --- stable/8/tools/regression/sbin/Makefile Thu Jan 26 21:43:11 2012 (r230602) +++ stable/8/tools/regression/sbin/Makefile Thu Jan 26 22:01:05 2012 (r230603) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= growfs +SUBDIR= dhclient growfs .include Modified: stable/8/tools/regression/sbin/dhclient/fake.c ============================================================================== --- head/tools/regression/sbin/dhclient/fake.c Sun Dec 4 14:44:31 2011 (r228259) +++ stable/8/tools/regression/sbin/dhclient/fake.c Thu Jan 26 22:01:05 2012 (r230603) @@ -32,7 +32,11 @@ warning(char *fmt, ...) va_end(ap); fprintf(stderr, "\n"); - return ret; + /* + * The original warning() would return "ret" here. We do this to + * check warnings explicitely. + */ + longjmp(env, 1); } int From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 27 07:34:49 2012 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D78CE106564A; Fri, 27 Jan 2012 07:34:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id AA6C08FC08; Fri, 27 Jan 2012 07:34:48 +0000 (UTC) Received: from alph.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q0R7YaT0045389; Fri, 27 Jan 2012 16:34:46 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q0R7YYDL045061; Fri, 27 Jan 2012 16:34:35 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 27 Jan 2012 16:34:16 +0900 (JST) Message-Id: <20120127.163416.2189393622265082144.hrs@allbsd.org> To: ae@FreeBSD.org From: Hiroki Sato In-Reply-To: <4F2115A2.2010803@FreeBSD.org> References: <201201260851.q0Q8pO3f073097@svn.freebsd.org> <4F2115A2.2010803@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.4 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Jan_27_16_34_16_2012_358)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Fri, 27 Jan 2012 16:34:46 +0900 (JST) X-Spam-Status: No, score=-104.6 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, RDNS_NONE, SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org 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: r230568 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2012 07:34:50 -0000 ----Security_Multipart(Fri_Jan_27_16_34_16_2012_358)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Andrey V. Elsukov" wrote in <4F2115A2.2010803@FreeBSD.org>: ae> On 26.01.2012 12:51, Andrey V. Elsukov wrote: ae> > Author: ae ae> > Date: Thu Jan 26 08:51:23 2012 ae> > New Revision: 230568 ae> > URL: http://svn.freebsd.org/changeset/base/230568 ae> > ae> > Log: ae> > Disable integrity checks by default. It will warn users about found ae> > problems, but will not reject partition tables. ae> ae> Users may discover that their partition tables marked as corrupted. ae> This will prevent modifying tables and write boot code, but probably ae> this behavior should be disabled in 8-STABLE. ae> Any opinions are welcome. I also think it is reasonable to disable the check in gpart on 8-STABLE. -- Hiroki ----Security_Multipart(Fri_Jan_27_16_34_16_2012_358)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk8iU3gACgkQTyzT2CeTzy2XrACgsYKhKMvn5EFF3XcAvBxyEuE8 nIEAnRbHy5edklOrJTBWEccBe51lJM5g =V/oW -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Jan_27_16_34_16_2012_358)---- From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 27 07:37:11 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24CF41065670; Fri, 27 Jan 2012 07:37:11 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 131B68FC15; Fri, 27 Jan 2012 07:37:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0R7bAE1028081; Fri, 27 Jan 2012 07:37:10 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0R7bA08028079; Fri, 27 Jan 2012 07:37:10 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201270737.q0R7bA08028079@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 27 Jan 2012 07:37: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: r230608 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Jan 2012 07:37:11 -0000 Author: pluknet Date: Fri Jan 27 07:37:10 2012 New Revision: 230608 URL: http://svn.freebsd.org/changeset/base/230608 Log: MFC r230496: Remove the stale XXX rt_newaddrmsg comment. Modified: stable/8/sys/netinet6/in6.c Directory Properties: 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) Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Fri Jan 27 07:15:14 2012 (r230607) +++ stable/8/sys/netinet6/in6.c Fri Jan 27 07:37:10 2012 (r230608) @@ -1811,10 +1811,6 @@ in6_ifinit(struct ifnet *ifp, struct in6 IF_AFDATA_LOCK(ifp); ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; - - /* XXX QL - * we need to report rt_newaddrmsg - */ ln = lla_lookup(LLTABLE6(ifp), (LLE_CREATE | LLE_IFADDR | LLE_EXCLUSIVE), (struct sockaddr *)&ia->ia_addr); IF_AFDATA_UNLOCK(ifp); From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 02:18:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6597106566B; Sat, 28 Jan 2012 02:18:50 +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 D4CD98FC0A; Sat, 28 Jan 2012 02:18:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0S2IoUc071057; Sat, 28 Jan 2012 02:18:50 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0S2IowX071055; Sat, 28 Jan 2012 02:18:50 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201280218.q0S2IowX071055@svn.freebsd.org> From: Rick Macklem Date: Sat, 28 Jan 2012 02:18: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: r230638 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 02:18:51 -0000 Author: rmacklem Date: Sat Jan 28 02:18:50 2012 New Revision: 230638 URL: http://svn.freebsd.org/changeset/base/230638 Log: MFC: r230100 Tai Horgan reported via email that there were two places in the new NFSv4 server where the code follows the wrong list. Fortunately, for these fairly rare cases, the lc_stateid[] lists are normally empty. This patch fixes the code to follow the correct list. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 01:45:19 2012 (r230637) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Sat Jan 28 02:18:50 2012 (r230638) @@ -315,7 +315,7 @@ nfsrv_setclient(struct nfsrv_descript *n for (i = 0; i < NFSSTATEHASHSIZE; i++) { LIST_NEWHEAD(&new_clp->lc_stateid[i], &clp->lc_stateid[i], ls_hash); - LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_list) + LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash) tstp->ls_clp = new_clp; } LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp, @@ -369,7 +369,7 @@ nfsrv_setclient(struct nfsrv_descript *n for (i = 0; i < NFSSTATEHASHSIZE; i++) { LIST_NEWHEAD(&new_clp->lc_stateid[i], &clp->lc_stateid[i], ls_hash); - LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_list) + LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash) tstp->ls_clp = new_clp; } LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp, From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 19:33:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E920106567A; Sat, 28 Jan 2012 19:33:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 396928FC1B; Sat, 28 Jan 2012 19:33:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SJX2on096190; Sat, 28 Jan 2012 19:33:02 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SJX2qC096188; Sat, 28 Jan 2012 19:33:02 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201281933.q0SJX2qC096188@svn.freebsd.org> From: Eitan Adler Date: Sat, 28 Jan 2012 19:33: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: r230651 - stable/8/sys/boot/forth X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 19:33:03 -0000 Author: eadler Date: Sat Jan 28 19:33:02 2012 New Revision: 230651 URL: http://svn.freebsd.org/changeset/base/230651 Log: MFC r230109: - Document TheDraw splash screens in the default loader.conf Approved by: cperciva Modified: stable/8/sys/boot/forth/loader.conf Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Sat Jan 28 19:32:28 2012 (r230650) +++ stable/8/sys/boot/forth/loader.conf Sat Jan 28 19:33:02 2012 (r230651) @@ -31,9 +31,10 @@ verbose_loading="NO" # Set to YES for v splash_bmp_load="NO" # Set this to YES for bmp splash screen! splash_pcx_load="NO" # Set this to YES for pcx splash screen! +splash_txt_load="NO" # Set this to YES for TheDraw splash screen! vesa_load="NO" # Set this to YES to load the vesa module bitmap_load="NO" # Set this to YES if you want splash screen! -bitmap_name="splash.bmp" # Set this to the name of the bmp or pcx file +bitmap_name="splash.bmp" # Set this to the name of the file bitmap_type="splash_image_data" # and place it on the module_path From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 21:45:21 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B45C10656D2; Sat, 28 Jan 2012 21:45:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E5568FC1C; Sat, 28 Jan 2012 21:45:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SLjLu7099941; Sat, 28 Jan 2012 21:45:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SLjLox099939; Sat, 28 Jan 2012 21:45:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201282145.q0SLjLox099939@svn.freebsd.org> From: Eitan Adler Date: Sat, 28 Jan 2012 21:45: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: r230660 - stable/8/sys/dev/uart X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 21:45:21 -0000 Author: eadler Date: Sat Jan 28 21:45:20 2012 New Revision: 230660 URL: http://svn.freebsd.org/changeset/base/230660 Log: MFC r230327: Add support for Sony Ericsson GC89 EDGE/Wirelles LAN PC Card PR: kern/131933 Approved by: cperciva Modified: stable/8/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_pci.c Sat Jan 28 21:44:51 2012 (r230659) +++ stable/8/sys/dev/uart/uart_bus_pci.c Sat Jan 28 21:45:20 2012 (r230660) @@ -110,6 +110,7 @@ static struct pci_id pci_ns8250_ids[] = 8 * DEFAULT_RCLK }, { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 0x10, 16384000 }, +{ 0x14e4, 0x4344, 0xffff, 0, "Sony Ericsson GC89 PC Card", 0x10}, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, { 0x8086, 0x3b67, 0xffff, 0, "5 Series/3400 Series Chipset KT Controller", From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:13:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33DEB106566C; Sat, 28 Jan 2012 23:13:01 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE808FC0A; Sat, 28 Jan 2012 23:13:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SND0cQ003061; Sat, 28 Jan 2012 23:13:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SND0gb003055; Sat, 28 Jan 2012 23:13:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282313.q0SND0gb003055@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23: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: r230666 - in stable/8/sys: cam conf modules/cam sparc64/include sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:13:01 -0000 Author: marius Date: Sat Jan 28 23:13:00 2012 New Revision: 230666 URL: http://svn.freebsd.org/changeset/base/230666 Log: MFC: r228022, r228026 For sparc64 also adjust the geometry of da(4) driven disks to not overflow the 16-bit cylinders field of the VTOC8 disk label (at around 502GB). The geometry chosen for disks above that limit allows to use disks up to 2TB, which is the limit of the extended VTOC8 format. The geometry used for disks smaller than the 16-bit cylinders limit stays the same as used by cam_calc_geometry(9) for extended translation. Thanks to Hans-Joerg Sirtl for providing hardware for testing this change. Added: stable/8/sys/sparc64/sparc64/cam_machdep.c - copied unchanged from r228022, head/sys/sparc64/sparc64/cam_machdep.c Modified: stable/8/sys/cam/cam_xpt.c stable/8/sys/conf/files.sparc64 stable/8/sys/modules/cam/Makefile stable/8/sys/sparc64/include/md_var.h Directory Properties: 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) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Sat Jan 28 23:12:55 2012 (r230665) +++ stable/8/sys/cam/cam_xpt.c Sat Jan 28 23:13:00 2012 (r230666) @@ -67,7 +67,10 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include /* geometry translation */ #include /* for xpt_print below */ + #include "opt_cam.h" /* @@ -2404,7 +2407,7 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; break; } -#ifdef PC98 +#if defined(PC98) || defined(__sparc64__) /* * In a PC-98 system, geometry translation depens on * the "real" device geometry obtained from mode page 4. @@ -2413,6 +2416,9 @@ xpt_action_default(union ccb *start_ccb) * stored in host memory. If the translation is available * in host memory, use it. If not, rely on the default * translation the device driver performs. + * For sparc64, we may need adjust the geometry of large + * disks in order to fit the limitations of the 16-bit + * fields of the VTOC8 disk label. */ if (scsi_da_bios_params(&start_ccb->ccg) != 0) { start_ccb->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/conf/files.sparc64 ============================================================================== --- stable/8/sys/conf/files.sparc64 Sat Jan 28 23:12:55 2012 (r230665) +++ stable/8/sys/conf/files.sparc64 Sat Jan 28 23:13:00 2012 (r230666) @@ -89,6 +89,7 @@ sparc64/sparc64/ata_machdep.c optional a sparc64/sparc64/autoconf.c standard sparc64/sparc64/bus_machdep.c standard sparc64/sparc64/cache.c standard +sparc64/sparc64/cam_machdep.c optional scbus sparc64/sparc64/cheetah.c standard sparc64/sparc64/clock.c standard sparc64/sparc64/counter.c standard Modified: stable/8/sys/modules/cam/Makefile ============================================================================== --- stable/8/sys/modules/cam/Makefile Sat Jan 28 23:12:55 2012 (r230665) +++ stable/8/sys/modules/cam/Makefile Sat Jan 28 23:13:00 2012 (r230666) @@ -15,8 +15,11 @@ SRCS+= opt_pt.h SRCS+= opt_sa.h SRCS+= opt_ses.h SRCS+= device_if.h bus_if.h vnode_if.h -SRCS+= cam.c cam_periph.c cam_queue.c -SRCS+= cam_sim.c cam_xpt.c +SRCS+= cam.c +.if exists($S/${MACHINE}/${MACHINE}/cam_machdep.c) +SRCS+= cam_machdep.c +.endif +SRCS+= cam_periph.c cam_queue.c cam_sim.c cam_xpt.c SRCS+= scsi_all.c scsi_cd.c scsi_ch.c SRCS+= scsi_da.c SRCS+= scsi_pass.c @@ -30,7 +33,7 @@ SRCS+= ata_all.c SRCS+= ata_xpt.c SRCS+= ata_da.c .if exists($S/${MACHINE}/${MACHINE}/ata_machdep.c) -SRCS+= ata_machdep.c +SRCS+= ata_machdep.c .endif SRCS+= ata_pmp.c Modified: stable/8/sys/sparc64/include/md_var.h ============================================================================== --- stable/8/sys/sparc64/include/md_var.h Sat Jan 28 23:12:55 2012 (r230665) +++ stable/8/sys/sparc64/include/md_var.h Sat Jan 28 23:13:00 2012 (r230666) @@ -65,10 +65,11 @@ extern cpu_block_copy_t *cpu_block_copy; extern cpu_block_zero_t *cpu_block_zero; /* - * Given that the Sun disk label only uses 16-bit fields for cylinders, - * heads and sectors we might need to adjust the geometry of large IDE - * disks. + * Given that the VTOC8 disk label only uses 16-bit fields for cylinders, + * heads and sectors we might need to adjust the geometry of large disks. */ +struct ccb_calc_geometry; +int scsi_da_bios_params(struct ccb_calc_geometry *ccg); struct disk; void sparc64_ata_disk_firmware_geom_adjust(struct disk *disk); #define ata_disk_firmware_geom_adjust(disk) \ Copied: stable/8/sys/sparc64/sparc64/cam_machdep.c (from r228022, head/sys/sparc64/sparc64/cam_machdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/sparc64/sparc64/cam_machdep.c Sat Jan 28 23:13:00 2012 (r230666, copy of r228022, head/sys/sparc64/sparc64/cam_machdep.c) @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2011 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include + +int +scsi_da_bios_params(struct ccb_calc_geometry *ccg) +{ + uint32_t secs_per_cylinder, size_mb; + + /* + * The VTOC8 disk label only uses 16-bit fields for cylinders, heads + * and sectors so the geometry of large disks has to be adjusted. + * We generally use the sizing used by cam_calc_geometry(9), except + * when it would overflow the cylinders, in which case we use 255 + * heads and sectors. This allows disks up to the 2TB limit of the + * extended VTOC8. + * XXX this doesn't match the sizing used by OpenSolaris, as that + * would exceed the 8-bit ccg->heads and ccg->secs_per_track. + */ + if (ccg->block_size == 0) + return (0); + size_mb = (1024L * 1024L) / ccg->block_size; + if (size_mb == 0) + return (0); + size_mb = ccg->volume_size / size_mb; + if (ccg->volume_size > (uint64_t)65535 * 255 * 63) { + ccg->heads = 255; + ccg->secs_per_track = 255; + } else if (size_mb > 1024) { + ccg->heads = 255; + ccg->secs_per_track = 63; + } else { + ccg->heads = 64; + ccg->secs_per_track = 32; + } + secs_per_cylinder = ccg->heads * ccg->secs_per_track; + if (secs_per_cylinder == 0) + return (0); + ccg->cylinders = ccg->volume_size / secs_per_cylinder; + return (1); +} From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:15:05 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65AEA106564A; Sat, 28 Jan 2012 23:15:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 494C88FC16; Sat, 28 Jan 2012 23:15:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNF5Kl003227; Sat, 28 Jan 2012 23:15:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNF5Ii003225; Sat, 28 Jan 2012 23:15:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282315.q0SNF5Ii003225@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:15:05 +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: r230668 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:15:05 -0000 Author: marius Date: Sat Jan 28 23:15:04 2012 New Revision: 230668 URL: http://svn.freebsd.org/changeset/base/230668 Log: MFC: r225886 - Right-justify backslashes as suggested by style(9). - Rename ATOMIC_INC_ULONG to ATOMIC_INC_LONG in order to be consistent with the names of the other macros in this file an adjust accordingly. Modified: stable/8/sys/sparc64/include/asmacros.h Directory Properties: 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) Modified: stable/8/sys/sparc64/include/asmacros.h ============================================================================== --- stable/8/sys/sparc64/include/asmacros.h Sat Jan 28 23:15:02 2012 (r230667) +++ stable/8/sys/sparc64/include/asmacros.h Sat Jan 28 23:15:04 2012 (r230668) @@ -49,98 +49,98 @@ /* * Atomically decrement an integer in memory. */ -#define ATOMIC_DEC_INT(r1, r2, r3) \ - lduw [r1], r2 ; \ -9: sub r2, 1, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ +#define ATOMIC_DEC_INT(r1, r2, r3) \ + lduw [r1], r2 ; \ +9: sub r2, 1, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ mov r3, r2 /* * Atomically increment an integer in memory. */ -#define ATOMIC_INC_INT(r1, r2, r3) \ - lduw [r1], r2 ; \ -9: add r2, 1, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ +#define ATOMIC_INC_INT(r1, r2, r3) \ + lduw [r1], r2 ; \ +9: add r2, 1, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ mov r3, r2 /* - * Atomically increment an u_long in memory. + * Atomically increment a long in memory. */ -#define ATOMIC_INC_ULONG(r1, r2, r3) \ - ldx [r1], r2 ; \ -9: add r2, 1, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ +#define ATOMIC_INC_LONG(r1, r2, r3) \ + ldx [r1], r2 ; \ +9: add r2, 1, r3 ; \ + casxa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ mov r3, r2 /* * Atomically clear a number of bits of an integer in memory. */ -#define ATOMIC_CLEAR_INT(r1, r2, r3, bits) \ - lduw [r1], r2 ; \ -9: andn r2, bits, r3 ; \ - casa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ +#define ATOMIC_CLEAR_INT(r1, r2, r3, bits) \ + lduw [r1], r2 ; \ +9: andn r2, bits, r3 ; \ + casa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ mov r3, r2 /* - * Atomically clear a number of bits of an u_long in memory. + * Atomically clear a number of bits of a long in memory. */ -#define ATOMIC_CLEAR_LONG(r1, r2, r3, bits) \ - ldx [r1], r2 ; \ -9: andn r2, bits, r3 ; \ - casxa [r1] ASI_N, r2, r3 ; \ - cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ +#define ATOMIC_CLEAR_LONG(r1, r2, r3, bits) \ + ldx [r1], r2 ; \ +9: andn r2, bits, r3 ; \ + casxa [r1] ASI_N, r2, r3 ; \ + cmp r2, r3 ; \ + bne,pn %icc, 9b ; \ mov r3, r2 #define PCPU(member) PCPU_REG + PC_ ## member -#define PCPU_ADDR(member, reg) \ +#define PCPU_ADDR(member, reg) \ add PCPU_REG, PC_ ## member, reg -#define DEBUGGER() \ +#define DEBUGGER() \ ta %xcc, 1 -#define PANIC(msg, r1) \ - .sect .rodata ; \ -9: .asciz msg ; \ - .previous ; \ - SET(9b, r1, %o0) ; \ - call panic ; \ +#define PANIC(msg, r1) \ + .sect .rodata ; \ +9: .asciz msg ; \ + .previous ; \ + SET(9b, r1, %o0) ; \ + call panic ; \ nop #ifdef INVARIANTS -#define KASSERT(r1, msg) \ - brnz,pt r1, 8f ; \ - nop ; \ - PANIC(msg, r1) ; \ +#define KASSERT(r1, msg) \ + brnz,pt r1, 8f ; \ + nop ; \ + PANIC(msg, r1) ; \ 8: #else #define KASSERT(r1, msg) #endif -#define PUTS(msg, r1) \ - .sect .rodata ; \ -9: .asciz msg ; \ - .previous ; \ - SET(9b, r1, %o0) ; \ - call printf ; \ +#define PUTS(msg, r1) \ + .sect .rodata ; \ +9: .asciz msg ; \ + .previous ; \ + SET(9b, r1, %o0) ; \ + call printf ; \ nop #define _ALIGN_DATA .align 8 -#define DATA(name) \ - .data ; \ - _ALIGN_DATA ; \ - .globl name ; \ - .type name, @object ; \ +#define DATA(name) \ + .data ; \ + _ALIGN_DATA ; \ + .globl name ; \ + .type name, @object ; \ name: #define EMPTY From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:16:49 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7C861065674; Sat, 28 Jan 2012 23:16:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9369D8FC22; Sat, 28 Jan 2012 23:16:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNGnop003421; Sat, 28 Jan 2012 23:16:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNGnG6003419; Sat, 28 Jan 2012 23:16:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282316.q0SNGnG6003419@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:16: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: r230670 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:16:49 -0000 Author: marius Date: Sat Jan 28 23:16:49 2012 New Revision: 230670 URL: http://svn.freebsd.org/changeset/base/230670 Log: MFC: r225887 Use the extended integer condition code when comparing 64-bit values. Given that ATOMIC_INC_LONG currently is unused this happened to not be fatal. Modified: stable/8/sys/sparc64/include/asmacros.h Directory Properties: 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) Modified: stable/8/sys/sparc64/include/asmacros.h ============================================================================== --- stable/8/sys/sparc64/include/asmacros.h Sat Jan 28 23:16:47 2012 (r230669) +++ stable/8/sys/sparc64/include/asmacros.h Sat Jan 28 23:16:49 2012 (r230670) @@ -76,7 +76,7 @@ 9: add r2, 1, r3 ; \ casxa [r1] ASI_N, r2, r3 ; \ cmp r2, r3 ; \ - bne,pn %icc, 9b ; \ + bne,pn %xcc, 9b ; \ mov r3, r2 /* From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:18:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA4FE1065673; Sat, 28 Jan 2012 23:18:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A472F8FC0A; Sat, 28 Jan 2012 23:18:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNI2IR003552; Sat, 28 Jan 2012 23:18:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNI2nt003550; Sat, 28 Jan 2012 23:18:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282318.q0SNI2nt003550@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:18: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: r230672 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:18:02 -0000 Author: marius Date: Sat Jan 28 23:18:02 2012 New Revision: 230672 URL: http://svn.freebsd.org/changeset/base/230672 Log: MFC: r225888 Add a comment about why contrary to what once would think running all of userland with total store order actually is appropriate. Modified: stable/8/sys/sparc64/sparc64/machdep.c Directory Properties: 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) Modified: stable/8/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/machdep.c Sat Jan 28 23:17:58 2012 (r230671) +++ stable/8/sys/sparc64/sparc64/machdep.c Sat Jan 28 23:18:02 2012 (r230672) @@ -1014,6 +1014,10 @@ exec_setregs(struct thread *td, u_long e tf->tf_out[6] = sp - SPOFF - sizeof(struct frame); tf->tf_tnpc = entry + 4; tf->tf_tpc = entry; + /* + * While we could adhere to the memory model indicated in the ELF + * header, it turns out that just always using TSO performs best. + */ tf->tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_MM_TSO; td->td_retval[0] = tf->tf_out[0]; From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:24:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3A92106566B; Sat, 28 Jan 2012 23:24:08 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C33658FC16; Sat, 28 Jan 2012 23:24:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNO80i003863; Sat, 28 Jan 2012 23:24:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNO8a3003861; Sat, 28 Jan 2012 23:24:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282324.q0SNO8a3003861@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:24:08 +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: r230674 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:24:09 -0000 Author: marius Date: Sat Jan 28 23:24:08 2012 New Revision: 230674 URL: http://svn.freebsd.org/changeset/base/230674 Log: MFC: r225889, r228222 In total store which we use for running the kernel and all of the userland atomic operations behave as if they were followed by a CPU memory barrier so there's no need to include ones in the acquire variants of atomic(9) and it's sufficient to just use include compiler memory barriers to satisfy the requirements of atomic(9). Removing the CPU memory barriers results in a small performance improvement, specifically this is sufficient to compensate the performance loss seen in the worldstone benchmark seen when using SCHED_ULE instead of SCHED_4BSD. This change is inspired by Linux even more radically doing the equivalent thing some time ago. Thanks go to Peter Jeremy for additional testing. Modified: stable/8/sys/sparc64/include/atomic.h Directory Properties: 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) Modified: stable/8/sys/sparc64/include/atomic.h ============================================================================== --- stable/8/sys/sparc64/include/atomic.h Sat Jan 28 23:24:03 2012 (r230673) +++ stable/8/sys/sparc64/include/atomic.h Sat Jan 28 23:24:08 2012 (r230674) @@ -74,12 +74,16 @@ * * the return value of cas is used to avoid the extra reload. * - * The memory barriers provided by the acq and rel variants are intended - * to be sufficient for use of relaxed memory ordering. Due to the - * suggested assembly syntax of the membar operands containing a # - * character, they cannot be used in macros. The cmask and mmask bits + * We only include a memory barrier in the rel variants as in total store + * order which we use for running the kernel and all of the userland atomic + * loads and stores behave as if the were followed by a membar with a mask + * of #LoadLoad | #LoadStore | #StoreStore. In order to be also sufficient + * for use of relaxed memory ordering, the atomic_cas() in the acq variants + * additionally would have to be followed by a membar #LoadLoad | #LoadStore. + * Due to the suggested assembly syntax of the membar operands containing a + * # character, they cannot be used in macros. The cmask and mmask bits thus * are hard coded in machine/cpufunc.h and used here through macros. - * Hopefully sun will choose not to change the bit numbers. + * Hopefully the bit numbers won't change in the future. */ #define itype(sz) uint ## sz ## _t @@ -93,7 +97,7 @@ #define atomic_cas_acq(p, e, s, sz) ({ \ itype(sz) v; \ v = atomic_cas(p, e, s, sz); \ - membar(LoadLoad | LoadStore); \ + __asm __volatile("" : : : "memory"); \ v; \ }) @@ -118,7 +122,7 @@ #define atomic_op_acq(p, op, v, sz) ({ \ itype(sz) t; \ t = atomic_op(p, op, v, sz); \ - membar(LoadLoad | LoadStore); \ + __asm __volatile("" : : : "memory"); \ t; \ }) @@ -135,7 +139,7 @@ #define atomic_load_acq(p, sz) ({ \ itype(sz) v; \ v = atomic_load(p, sz); \ - membar(LoadLoad | LoadStore); \ + __asm __volatile("" : : : "memory"); \ v; \ }) From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:25:32 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D9E7106564A; Sat, 28 Jan 2012 23:25:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 063858FC08; Sat, 28 Jan 2012 23:25:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNPV37004000; Sat, 28 Jan 2012 23:25:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNPV98003998; Sat, 28 Jan 2012 23:25:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282325.q0SNPV98003998@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:25: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: r230676 - stable/8/sys/sparc64/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:25:32 -0000 Author: marius Date: Sat Jan 28 23:25:31 2012 New Revision: 230676 URL: http://svn.freebsd.org/changeset/base/230676 Log: MFC: r225890 - Add protective parentheses to macros as far as possible. - Move {r,w,}mb() to the top of this file where they live on most of the other architectures. Modified: stable/8/sys/sparc64/include/atomic.h Directory Properties: 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) Modified: stable/8/sys/sparc64/include/atomic.h ============================================================================== --- stable/8/sys/sparc64/include/atomic.h Sat Jan 28 23:25:28 2012 (r230675) +++ stable/8/sys/sparc64/include/atomic.h Sat Jan 28 23:25:31 2012 (r230676) @@ -33,6 +33,10 @@ #include +#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") +#define wmb() mb() +#define rmb() mb() + /* Userland needs different ASI's. */ #ifdef _KERNEL #define __ASI_ATOMIC ASI_N @@ -40,10 +44,6 @@ #define __ASI_ATOMIC ASI_P #endif -#define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") -#define wmb() mb() -#define rmb() mb() - /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and multiple processors. See atomic(9) for details. @@ -88,15 +88,15 @@ #define itype(sz) uint ## sz ## _t -#define atomic_cas_32(p, e, s) casa(p, e, s, __ASI_ATOMIC) -#define atomic_cas_64(p, e, s) casxa(p, e, s, __ASI_ATOMIC) +#define atomic_cas_32(p, e, s) casa((p), (e), (s), __ASI_ATOMIC) +#define atomic_cas_64(p, e, s) casxa((p), (e), (s), __ASI_ATOMIC) #define atomic_cas(p, e, s, sz) \ - atomic_cas_ ## sz(p, e, s) + atomic_cas_ ## sz((p), (e), (s)) #define atomic_cas_acq(p, e, s, sz) ({ \ itype(sz) v; \ - v = atomic_cas(p, e, s, sz); \ + v = atomic_cas((p), (e), (s), sz); \ __asm __volatile("" : : : "memory"); \ v; \ }) @@ -104,15 +104,15 @@ #define atomic_cas_rel(p, e, s, sz) ({ \ itype(sz) v; \ membar(LoadStore | StoreStore); \ - v = atomic_cas(p, e, s, sz); \ + v = atomic_cas((p), (e), (s), sz); \ v; \ }) #define atomic_op(p, op, v, sz) ({ \ itype(sz) e, r, s; \ - for (e = *(volatile itype(sz) *)p;; e = r) { \ - s = e op v; \ - r = atomic_cas_ ## sz(p, e, s); \ + for (e = *(volatile itype(sz) *)(p);; e = r) { \ + s = e op (v); \ + r = atomic_cas_ ## sz((p), e, s); \ if (r == e) \ break; \ } \ @@ -121,7 +121,7 @@ #define atomic_op_acq(p, op, v, sz) ({ \ itype(sz) t; \ - t = atomic_op(p, op, v, sz); \ + t = atomic_op((p), op, (v), sz); \ __asm __volatile("" : : : "memory"); \ t; \ }) @@ -129,24 +129,24 @@ #define atomic_op_rel(p, op, v, sz) ({ \ itype(sz) t; \ membar(LoadStore | StoreStore); \ - t = atomic_op(p, op, v, sz); \ + t = atomic_op((p), op, (v), sz); \ t; \ }) #define atomic_load(p, sz) \ - atomic_cas(p, 0, 0, sz) + atomic_cas((p), 0, 0, sz) #define atomic_load_acq(p, sz) ({ \ itype(sz) v; \ - v = atomic_load(p, sz); \ + v = atomic_load((p), sz); \ __asm __volatile("" : : : "memory"); \ v; \ }) #define atomic_load_clear(p, sz) ({ \ itype(sz) e, r; \ - for (e = *(volatile itype(sz) *)p;; e = r) { \ - r = atomic_cas(p, e, 0, sz); \ + for (e = *(volatile itype(sz) *)(p);; e = r) { \ + r = atomic_cas((p), e, 0, sz); \ if (r == e) \ break; \ } \ @@ -155,8 +155,8 @@ #define atomic_store(p, v, sz) do { \ itype(sz) e, r; \ - for (e = *(volatile itype(sz) *)p;; e = r) { \ - r = atomic_cas(p, e, v, sz); \ + for (e = *(volatile itype(sz) *)(p);; e = r) { \ + r = atomic_cas((p), e, (v), sz); \ if (r == e) \ break; \ } \ @@ -164,7 +164,7 @@ #define atomic_store_rel(p, v, sz) do { \ membar(LoadStore | StoreStore); \ - atomic_store(p, v, sz); \ + atomic_store((p), (v), sz); \ } while (0) #define ATOMIC_GEN(name, ptype, vtype, atype, sz) \ @@ -172,109 +172,109 @@ static __inline vtype \ atomic_add_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op(p, +, v, sz)); \ + return ((vtype)atomic_op((p), +, (v), sz)); \ } \ static __inline vtype \ atomic_add_acq_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_acq(p, +, v, sz)); \ + return ((vtype)atomic_op_acq((p), +, (v), sz)); \ } \ static __inline vtype \ atomic_add_rel_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_rel(p, +, v, sz)); \ + return ((vtype)atomic_op_rel((p), +, (v), sz)); \ } \ \ static __inline vtype \ atomic_clear_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op(p, &, ~v, sz)); \ + return ((vtype)atomic_op((p), &, ~(v), sz)); \ } \ static __inline vtype \ atomic_clear_acq_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_acq(p, &, ~v, sz)); \ + return ((vtype)atomic_op_acq((p), &, ~(v), sz)); \ } \ static __inline vtype \ atomic_clear_rel_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_rel(p, &, ~v, sz)); \ + return ((vtype)atomic_op_rel((p), &, ~(v), sz)); \ } \ \ static __inline int \ atomic_cmpset_ ## name(volatile ptype p, vtype e, vtype s) \ { \ - return (((vtype)atomic_cas(p, e, s, sz)) == e); \ + return (((vtype)atomic_cas((p), (e), (s), sz)) == (e)); \ } \ static __inline int \ atomic_cmpset_acq_ ## name(volatile ptype p, vtype e, vtype s) \ { \ - return (((vtype)atomic_cas_acq(p, e, s, sz)) == e); \ + return (((vtype)atomic_cas_acq((p), (e), (s), sz)) == (e)); \ } \ static __inline int \ atomic_cmpset_rel_ ## name(volatile ptype p, vtype e, vtype s) \ { \ - return (((vtype)atomic_cas_rel(p, e, s, sz)) == e); \ + return (((vtype)atomic_cas_rel((p), (e), (s), sz)) == (e)); \ } \ \ static __inline vtype \ atomic_load_ ## name(volatile ptype p) \ { \ - return ((vtype)atomic_cas(p, 0, 0, sz)); \ + return ((vtype)atomic_cas((p), 0, 0, sz)); \ } \ static __inline vtype \ atomic_load_acq_ ## name(volatile ptype p) \ { \ - return ((vtype)atomic_cas_acq(p, 0, 0, sz)); \ + return ((vtype)atomic_cas_acq((p), 0, 0, sz)); \ } \ \ static __inline vtype \ atomic_readandclear_ ## name(volatile ptype p) \ { \ - return ((vtype)atomic_load_clear(p, sz)); \ + return ((vtype)atomic_load_clear((p), sz)); \ } \ \ static __inline vtype \ atomic_set_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op(p, |, v, sz)); \ + return ((vtype)atomic_op((p), |, (v), sz)); \ } \ static __inline vtype \ atomic_set_acq_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_acq(p, |, v, sz)); \ + return ((vtype)atomic_op_acq((p), |, (v), sz)); \ } \ static __inline vtype \ atomic_set_rel_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_rel(p, |, v, sz)); \ + return ((vtype)atomic_op_rel((p), |, (v), sz)); \ } \ \ static __inline vtype \ atomic_subtract_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op(p, -, v, sz)); \ + return ((vtype)atomic_op((p), -, (v), sz)); \ } \ static __inline vtype \ atomic_subtract_acq_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_acq(p, -, v, sz)); \ + return ((vtype)atomic_op_acq((p), -, (v), sz)); \ } \ static __inline vtype \ atomic_subtract_rel_ ## name(volatile ptype p, atype v) \ { \ - return ((vtype)atomic_op_rel(p, -, v, sz)); \ + return ((vtype)atomic_op_rel((p), -, (v), sz)); \ } \ \ static __inline void \ atomic_store_ ## name(volatile ptype p, vtype v) \ { \ - atomic_store(p, v, sz); \ + atomic_store((p), (v), sz); \ } \ static __inline void \ atomic_store_rel_ ## name(volatile ptype p, vtype v) \ { \ - atomic_store_rel(p, v, sz); \ + atomic_store_rel((p), (v), sz); \ } ATOMIC_GEN(int, u_int *, u_int, u_int, 32); From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:26:56 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D87B1065673; Sat, 28 Jan 2012 23:26:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67AB28FC0A; Sat, 28 Jan 2012 23:26:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNQuWV004145; Sat, 28 Jan 2012 23:26:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNQug5004143; Sat, 28 Jan 2012 23:26:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282326.q0SNQug5004143@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:26: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: r230678 - stable/8/sys/sparc64/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:26:56 -0000 Author: marius Date: Sat Jan 28 23:26:55 2012 New Revision: 230678 URL: http://svn.freebsd.org/changeset/base/230678 Log: MFC: r225891 Re-reading the Schizo errata suggests that it's actually tolerable to also use the streaming buffer of pre version 5/revision 2.3 hardware as long as we stay away from context flushes (which iommu(4) so far doesn't take advantage of). OpenSolaris does the same. Modified: stable/8/sys/sparc64/pci/schizo.c Directory Properties: 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) Modified: stable/8/sys/sparc64/pci/schizo.c ============================================================================== --- stable/8/sys/sparc64/pci/schizo.c Sat Jan 28 23:26:50 2012 (r230677) +++ stable/8/sys/sparc64/pci/schizo.c Sat Jan 28 23:26:55 2012 (r230678) @@ -501,7 +501,8 @@ schizo_attach(device_t dev) * Set up the IOMMU. Schizo, Tomatillo and XMITS all have * one per PBM. Schizo and XMITS additionally have a streaming * buffer, in Schizo version < 5 (i.e. revision < 2.3) it's - * affected by several errata and basically unusable though. + * affected by several errata though. However, except for context + * flushes, taking advantage of it should be okay even with those. */ memcpy(&sc->sc_dma_methods, &iommu_dma_methods, sizeof(sc->sc_dma_methods)); @@ -509,8 +510,7 @@ schizo_attach(device_t dev) sc->sc_is.sis_is.is_flags = IOMMU_PRESERVE_PROM; sc->sc_is.sis_is.is_pmaxaddr = IOMMU_MAXADDR(STX_IOMMU_BITS); sc->sc_is.sis_is.is_sb[0] = sc->sc_is.sis_is.is_sb[1] = 0; - if (OF_getproplen(node, "no-streaming-cache") < 0 && - !(sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver < 5)) + if (OF_getproplen(node, "no-streaming-cache") < 0) sc->sc_is.sis_is.is_sb[0] = STX_PCI_STRBUF; #define TSBCASE(x) \ From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:33:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 145DD106566B; Sat, 28 Jan 2012 23:33:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F297B8FC17; Sat, 28 Jan 2012 23:33:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNXrTa004525; Sat, 28 Jan 2012 23:33:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNXraS004523; Sat, 28 Jan 2012 23:33:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282333.q0SNXraS004523@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23: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: r230681 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:33:54 -0000 Author: marius Date: Sat Jan 28 23:33:53 2012 New Revision: 230681 URL: http://svn.freebsd.org/changeset/base/230681 Log: MFC: r225899 Also allocate space for the PIL counters. Given that no machine actually uses IV_MAX interrupt vectors this wasn't a problem in practice though. Modified: stable/8/sys/sparc64/sparc64/exception.S Directory Properties: 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) Modified: stable/8/sys/sparc64/sparc64/exception.S ============================================================================== --- stable/8/sys/sparc64/sparc64/exception.S Sat Jan 28 23:33:50 2012 (r230680) +++ stable/8/sys/sparc64/sparc64/exception.S Sat Jan 28 23:33:53 2012 (r230681) @@ -373,11 +373,11 @@ END(rsf_fatal) _ALIGN_DATA .globl intrnames, eintrnames intrnames: - .space IV_MAX * (MAXCOMLEN + 1) + .space (IV_MAX + PIL_MAX) * (MAXCOMLEN + 1) eintrnames: .globl intrcnt, eintrcnt intrcnt: - .space IV_MAX * 8 + .space (IV_MAX + PIL_MAX) * 8 eintrcnt: .text From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:37:06 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 375F6106564A; Sat, 28 Jan 2012 23:37:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 21D448FC13; Sat, 28 Jan 2012 23:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNb5nV004770; Sat, 28 Jan 2012 23:37:05 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNb59n004768; Sat, 28 Jan 2012 23:37:05 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282337.q0SNb59n004768@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:37:05 +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: r230684 - stable/8/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:37:06 -0000 Author: marius Date: Sat Jan 28 23:37:05 2012 New Revision: 230684 URL: http://svn.freebsd.org/changeset/base/230684 Log: MFC: r225901 Remove obsolete macros. Modified: stable/8/sys/sparc64/sparc64/pmap.c Directory Properties: 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) Modified: stable/8/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/pmap.c Sat Jan 28 23:37:04 2012 (r230683) +++ stable/8/sys/sparc64/sparc64/pmap.c Sat Jan 28 23:37:05 2012 (r230684) @@ -100,12 +100,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define PMAP_DEBUG - -#ifndef PMAP_SHPGPERPROC -#define PMAP_SHPGPERPROC 200 -#endif - /* XXX */ #include "opt_sched.h" #ifndef SCHED_4BSD From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:45:32 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FA6C106564A; Sat, 28 Jan 2012 23:45:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67DB58FC12; Sat, 28 Jan 2012 23:45:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNjWDA005129; Sat, 28 Jan 2012 23:45:32 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNjWCN005121; Sat, 28 Jan 2012 23:45:32 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282345.q0SNjWCN005121@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:45: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: r230685 - in stable/8/sys: conf dev/uart sparc64/conf sparc64/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:45:32 -0000 Author: marius Date: Sat Jan 28 23:45:31 2012 New Revision: 230685 URL: http://svn.freebsd.org/changeset/base/230685 Log: MFC: r206451, r206453 Add sbbc(4), a driver for the BootBus controller found in Serengeti and StarCat systems which provides time-of-day services for both as well as console service for Serengeti, i.e. Sun Fire V1280. While the latter is described with a device type of serial in the OFW device tree, it isn't actually an UART. Nevertheless the console service is handled by uart(4) as this allowed to re-use quite a bit of MD and MI code. Actually, this idea is stolen from Linux which interfaces the sun4v hypervisor console with the Linux counterpart of uart(4). Added: stable/8/sys/sparc64/pci/sbbc.c - copied, changed from r206451, head/sys/sparc64/pci/sbbc.c Modified: stable/8/sys/conf/files.sparc64 stable/8/sys/dev/uart/uart.h stable/8/sys/dev/uart/uart_cpu_sparc64.c stable/8/sys/sparc64/conf/GENERIC stable/8/sys/sparc64/conf/NOTES Directory Properties: 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) Modified: stable/8/sys/conf/files.sparc64 ============================================================================== --- stable/8/sys/conf/files.sparc64 Sat Jan 28 23:37:05 2012 (r230684) +++ stable/8/sys/conf/files.sparc64 Sat Jan 28 23:45:31 2012 (r230685) @@ -81,6 +81,7 @@ sparc64/pci/ofw_pcib_subr.c optional pci sparc64/pci/ofw_pcibus.c optional pci sparc64/pci/ofw_pci_if.m optional pci sparc64/pci/psycho.c optional pci +sparc64/pci/sbbc.c optional uart sbbc sparc64/pci/schizo.c optional pci sparc64/sbus/dma_sbus.c optional sbus sparc64/sbus/sbus.c optional sbus Modified: stable/8/sys/dev/uart/uart.h ============================================================================== --- stable/8/sys/dev/uart/uart.h Sat Jan 28 23:37:05 2012 (r230684) +++ stable/8/sys/dev/uart/uart.h Sat Jan 28 23:45:31 2012 (r230685) @@ -67,6 +67,7 @@ struct uart_class; extern struct uart_class uart_ns8250_class __attribute__((weak)); extern struct uart_class uart_quicc_class __attribute__((weak)); extern struct uart_class uart_sab82532_class __attribute__((weak)); +extern struct uart_class uart_sbbc_class __attribute__((weak)); extern struct uart_class uart_z8530_class __attribute__((weak)); #ifdef PC98 Modified: stable/8/sys/dev/uart/uart_cpu_sparc64.c ============================================================================== --- stable/8/sys/dev/uart/uart_cpu_sparc64.c Sat Jan 28 23:37:05 2012 (r230684) +++ stable/8/sys/dev/uart/uart_cpu_sparc64.c Sat Jan 28 23:45:31 2012 (r230685) @@ -133,6 +133,14 @@ uart_cpu_getdev_console(phandle_t option return (-1); if (strcmp(buf, "serial") != 0) return (-1); + /* For a Serengeti console device point to the bootbus controller. */ + if (OF_getprop(input, "name", buf, sizeof(buf)) > 0 && + !strcmp(buf, "sgcn")) { + if ((chosen = OF_finddevice("/chosen")) == -1) + return (-1); + if (OF_getprop(chosen, "iosram", &input, sizeof(input)) == -1) + return (-1); + } return (input); } @@ -259,6 +267,9 @@ uart_cpu_getdev(int devtype, struct uart !strcmp(compat, "su16552")) { class = &uart_ns8250_class; di->bas.chan = 0; + } else if (!strcmp(compat, "sgsbbc")) { + class = &uart_sbbc_class; + di->bas.chan = 0; } if (class == NULL) return (ENXIO); Modified: stable/8/sys/sparc64/conf/GENERIC ============================================================================== --- stable/8/sys/sparc64/conf/GENERIC Sat Jan 28 23:37:05 2012 (r230684) +++ stable/8/sys/sparc64/conf/GENERIC Sat Jan 28 23:45:31 2012 (r230685) @@ -146,6 +146,9 @@ device mk48txx # Mostek MK48Txx clocks device rtc # rtc (really a front-end for the MC146818) device mc146818 # Motorola MC146818 and compatible clocks device epic # Sun Fire V215/V245 LEDs +device sbbc # Sun BootBus controller (time-of-day clock for + # Serengeti and StarCat, console for Serengeti, + # requires device uart) # Serial (COM) ports device puc # Multi-channel uarts Modified: stable/8/sys/sparc64/conf/NOTES ============================================================================== --- stable/8/sys/sparc64/conf/NOTES Sat Jan 28 23:37:05 2012 (r230684) +++ stable/8/sys/sparc64/conf/NOTES Sat Jan 28 23:45:31 2012 (r230685) @@ -37,6 +37,7 @@ device eeprom # eeprom (really a front device mk48txx # Mostek MK48Txx clocks device rtc # rtc (really a front-end for the MC146818) device mc146818 # Motorola MC146818 and compatible clocks +device sbbc # Sun BootBus controller # # Optional devices: Copied and modified: stable/8/sys/sparc64/pci/sbbc.c (from r206451, head/sys/sparc64/pci/sbbc.c) ============================================================================== --- head/sys/sparc64/pci/sbbc.c Sat Apr 10 11:52:12 2010 (r206451, copy source) +++ stable/8/sys/sparc64/pci/sbbc.c Sat Jan 28 23:45:31 2012 (r230685) @@ -1,5 +1,5 @@ /* $OpenBSD: sbbc.c,v 1.7 2009/11/09 17:53:39 nicm Exp $ */ -/* +/*- * Copyright (c) 2008 Mark Kettenis * * Permission to use, copy, modify, and distribute this software for any From owner-svn-src-stable-8@FreeBSD.ORG Sat Jan 28 23:46:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58CA4106564A; Sat, 28 Jan 2012 23:46:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 378B08FC08; Sat, 28 Jan 2012 23:46:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0SNkbrF005215; Sat, 28 Jan 2012 23:46:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0SNkb26005212; Sat, 28 Jan 2012 23:46:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201282346.q0SNkb26005212@svn.freebsd.org> From: Marius Strobl Date: Sat, 28 Jan 2012 23:46: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: r230686 - in stable/8/sys: conf sparc64/sparc64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 23:46:37 -0000 Author: marius Date: Sat Jan 28 23:46:36 2012 New Revision: 230686 URL: http://svn.freebsd.org/changeset/base/230686 Log: MFC: r203845 Add ssm(4), which serves as a glue device allowing devices beneath the scalable shared memory node, which is used in large UltraSPARC III based machines to group snooping-coherency domains together, like schizo(4) to be treated like nexus(4) children. Added: stable/8/sys/sparc64/sparc64/ssm.c - copied unchanged from r203845, head/sys/sparc64/sparc64/ssm.c Modified: stable/8/sys/conf/files.sparc64 Directory Properties: 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) Modified: stable/8/sys/conf/files.sparc64 ============================================================================== --- stable/8/sys/conf/files.sparc64 Sat Jan 28 23:45:31 2012 (r230685) +++ stable/8/sys/conf/files.sparc64 Sat Jan 28 23:46:36 2012 (r230686) @@ -128,6 +128,7 @@ sparc64/sparc64/rwindow.c standard sparc64/sparc64/sc_machdep.c optional sc sparc64/sparc64/schppm.c standard sparc64/sparc64/spitfire.c standard +sparc64/sparc64/ssm.c standard sparc64/sparc64/stack_machdep.c optional ddb | stack sparc64/sparc64/support.S standard \ compile-with "${NORMAL_S} -mcpu=ultrasparc" Copied: stable/8/sys/sparc64/sparc64/ssm.c (from r203845, head/sys/sparc64/sparc64/ssm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/sparc64/sparc64/ssm.c Sat Jan 28 23:46:36 2012 (r230686, copy of r203845, head/sys/sparc64/sparc64/ssm.c) @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2010 Marius Strobl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Glue allowing devices beneath the scalable shared memory node to be + * treated like nexus(4) children + */ + +#include +#include +#include +#include +#include + +#include + +#include + +static device_probe_t ssm_probe; + +static device_method_t ssm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ssm_probe), + + /* Bus interface */ + + /* ofw_bus interface */ + + KOBJMETHOD_END +}; + +static devclass_t ssm_devclass; + +DEFINE_CLASS_1(ssm, ssm_driver, ssm_methods, 1 /* no softc */, nexus_driver); +EARLY_DRIVER_MODULE(ssm, nexus, ssm_driver, ssm_devclass, 0, 0, BUS_PASS_BUS); +MODULE_DEPEND(ssm, nexus, 1, 1, 1); +MODULE_VERSION(ssm, 1); + +static int +ssm_probe(device_t dev) +{ + + if (strcmp(ofw_bus_get_name(dev), "ssm") == 0) { + device_set_desc(dev, "Scalable Shared Memory"); + return (BUS_PROBE_DEFAULT); + } + return (ENXIO); +}