From owner-svn-src-stable-9@FreeBSD.ORG Sun Aug 26 05:20:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D797106566B; Sun, 26 Aug 2012 05:20:33 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 182BC8FC08; Sun, 26 Aug 2012 05:20:33 +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 q7Q5KWaL067047; Sun, 26 Aug 2012 05:20:32 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7Q5KWIt067044; Sun, 26 Aug 2012 05:20:32 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201208260520.q7Q5KWIt067044@svn.freebsd.org> From: "Andrey A. Chernov" Date: Sun, 26 Aug 2012 05:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239708 - stable/9/contrib/openresolv X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Aug 2012 05:20:33 -0000 Author: ache Date: Sun Aug 26 05:20:32 2012 New Revision: 239708 URL: http://svn.freebsd.org/changeset/base/239708 Log: MFC r239477 According to resolvconf.conf(5) manpage and sources, there is no 'nameservers' option which used in examples in resolvconf.conf(5), it spelled 'name_servers', so fix examples. Modified: stable/9/contrib/openresolv/resolvconf.conf.5.in Directory Properties: stable/9/contrib/openresolv/ (props changed) Modified: stable/9/contrib/openresolv/resolvconf.conf.5.in ============================================================================== --- stable/9/contrib/openresolv/resolvconf.conf.5.in Sun Aug 26 05:11:52 2012 (r239707) +++ stable/9/contrib/openresolv/resolvconf.conf.5.in Sun Aug 26 05:20:32 2012 (r239708) @@ -113,7 +113,7 @@ This file tells dnsmasq which nameserver This file tells dnsmasq which nameservers to use for global lookups. .Pp Example resolvconf.conf for dnsmasq: -.D1 nameservers=127.0.0.1 +.D1 name_servers=127.0.0.1 .D1 dnsmasq_conf=/etc/dnsmasq-conf.conf .D1 dnsmasq_resolv=/etc/dnsmasq-resolv.conf .Pp @@ -129,7 +129,7 @@ Include this file in the named global sc This file tells named which nameservers to use for specific domains. .Pp Example resolvconf.conf for named: -.D1 nameservers=127.0.0.1 +.D1 name_servers=127.0.0.1 .D1 named_options=/etc/named-options.conf .D1 named_zones=/etc/named-zones.conf .Pp @@ -152,7 +152,7 @@ If this variable is not set then it's wr .Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: -.D1 nameservers=127.0.0.1 +.D1 name_servers=127.0.0.1 .D1 pdnsd_conf=/etc/pdnsd.conf .D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf .Pp @@ -171,7 +171,7 @@ Example pdnsd.conf: This file tells unbound about specific and global nameservers. .Pp Example resolvconf.conf for unbound: -.D1 nameservers=127.0.0.1 +.D1 name_servers=127.0.0.1 .D1 unbound_conf=/etc/unbound-resolvconf.conf .Pp Example unbound.conf: From owner-svn-src-stable-9@FreeBSD.ORG Sun Aug 26 10:30:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D33F106564A; Sun, 26 Aug 2012 10:30:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF818FC14; Sun, 26 Aug 2012 10:30: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 q7QAU1rE007187; Sun, 26 Aug 2012 10:30:01 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7QAU1bl007184; Sun, 26 Aug 2012 10:30:01 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208261030.q7QAU1bl007184@svn.freebsd.org> From: Dimitry Andric Date: Sun, 26 Aug 2012 10:30:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239711 - in stable/9: lib/clang usr.bin/clang X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Aug 2012 10:30:02 -0000 Author: dim Date: Sun Aug 26 10:30:01 2012 New Revision: 239711 URL: http://svn.freebsd.org/changeset/base/239711 Log: MFC r239614: Sprinkle a bit of style.Makefile(5) across various clang Makefiles. No functional changes. Modified: stable/9/lib/clang/clang.build.mk stable/9/lib/clang/clang.lib.mk stable/9/usr.bin/clang/clang.prog.mk Directory Properties: stable/9/lib/clang/ (props changed) stable/9/usr.bin/clang/ (props changed) Modified: stable/9/lib/clang/clang.build.mk ============================================================================== --- stable/9/lib/clang/clang.build.mk Sun Aug 26 09:54:11 2012 (r239710) +++ stable/9/lib/clang/clang.build.mk Sun Aug 26 10:30:01 2012 (r239711) @@ -1,39 +1,39 @@ # $FreeBSD$ -CLANG_SRCS=${LLVM_SRCS}/tools/clang +CLANG_SRCS= ${LLVM_SRCS}/tools/clang -CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \ - -I${LLVM_SRCS}/${SRCDIR} ${INCDIR:C/^/-I${LLVM_SRCS}\//} -I. \ - -I${LLVM_SRCS}/../../lib/clang/include \ - -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ - -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG +CFLAGS+= -I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \ + -I${LLVM_SRCS}/${SRCDIR} ${INCDIR:C/^/-I${LLVM_SRCS}\//} -I. \ + -I${LLVM_SRCS}/../../lib/clang/include \ + -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ + -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG # Correct for gcc miscompilation when compiling on PPC with -O2 .if ${MACHINE_CPUARCH} == "powerpc" -CFLAGS+= -O1 -mminimal-toc +CFLAGS+= -O1 -mminimal-toc .endif TARGET_ARCH?= ${MACHINE_ARCH} CFLAGS+=-DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd9.0\" .ifndef LLVM_REQUIRES_EH -CXXFLAGS+=-fno-exceptions +CXXFLAGS+= -fno-exceptions .else # If the library or program requires EH, it also requires RTTI. LLVM_REQUIRES_RTTI= .endif .ifndef LLVM_REQUIRES_RTTI -CXXFLAGS+=-fno-rtti +CXXFLAGS+= -fno-rtti .endif -CFLAGS+=-DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" +CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" .PATH: ${LLVM_SRCS}/${SRCDIR} -TBLGEN?=tblgen -CLANG_TBLGEN?=clang-tblgen -TBLINC+=-I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target +TBLGEN?= tblgen +CLANG_TBLGEN?= clang-tblgen +TBLINC+= -I ${LLVM_SRCS}/include -I ${LLVM_SRCS}/lib/Target Intrinsics.inc.h: ${LLVM_SRCS}/include/llvm/Intrinsics.td ${TBLGEN} -I ${LLVM_SRCS}/lib/VMCore ${TBLINC} -gen-intrinsic \ Modified: stable/9/lib/clang/clang.lib.mk ============================================================================== --- stable/9/lib/clang/clang.lib.mk Sun Aug 26 09:54:11 2012 (r239710) +++ stable/9/lib/clang/clang.lib.mk Sun Aug 26 10:30:01 2012 (r239711) @@ -1,6 +1,6 @@ # $FreeBSD$ -LLVM_SRCS=${.CURDIR}/../../../contrib/llvm +LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm .include "clang.build.mk" Modified: stable/9/usr.bin/clang/clang.prog.mk ============================================================================== --- stable/9/usr.bin/clang/clang.prog.mk Sun Aug 26 09:54:11 2012 (r239710) +++ stable/9/usr.bin/clang/clang.prog.mk Sun Aug 26 10:30:01 2012 (r239711) @@ -1,14 +1,14 @@ # $FreeBSD$ -LLVM_SRCS=${.CURDIR}/../../../contrib/llvm +LLVM_SRCS= ${.CURDIR}/../../../contrib/llvm .include "../../lib/clang/clang.build.mk" .for lib in ${LIBDEPS} -DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a -LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a +DPADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a +LDADD+= ${.OBJDIR}/../../../lib/clang/lib${lib}/lib${lib}.a .endfor -BINDIR?=/usr/bin +BINDIR?= /usr/bin .include From owner-svn-src-stable-9@FreeBSD.ORG Sun Aug 26 12:07:24 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B76A106564A; Sun, 26 Aug 2012 12:07:24 +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 266388FC0C; Sun, 26 Aug 2012 12:07: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 q7QC7O43019562; Sun, 26 Aug 2012 12:07:24 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7QC7NtI019560; Sun, 26 Aug 2012 12:07:23 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201208261207.q7QC7NtI019560@svn.freebsd.org> From: Sergey Kandaurov Date: Sun, 26 Aug 2012 12:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239714 - stable/9/sbin/camcontrol X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Aug 2012 12:07:24 -0000 Author: pluknet Date: Sun Aug 26 12:07:23 2012 New Revision: 239714 URL: http://svn.freebsd.org/changeset/base/239714 Log: MFC r239468: Avoid segfault in the 'smpphylist' subcommand. Modified: stable/9/sbin/camcontrol/camcontrol.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/9/sbin/camcontrol/camcontrol.c Sun Aug 26 10:40:13 2012 (r239713) +++ stable/9/sbin/camcontrol/camcontrol.c Sun Aug 26 12:07:23 2012 (r239714) @@ -5458,6 +5458,7 @@ smpphylist(struct cam_device *device, in bzero(&(&ccb->ccb_h)[1], sizeof(union ccb) - sizeof(struct ccb_hdr)); + STAILQ_INIT(&devlist.dev_queue); rgrequest = malloc(sizeof(*rgrequest)); if (rgrequest == NULL) { @@ -5526,7 +5527,6 @@ smpphylist(struct cam_device *device, in goto bailout; } - STAILQ_INIT(&devlist.dev_queue); devlist.path_id = device->path_id; retval = buildbusdevlist(&devlist); From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 02:56:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F714106564A; Mon, 27 Aug 2012 02:56:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A79F8FC0C; Mon, 27 Aug 2012 02:56:58 +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 q7R2uw19028054; Mon, 27 Aug 2012 02:56:58 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7R2uwqI028050; Mon, 27 Aug 2012 02:56:58 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201208270256.q7R2uwqI028050@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Mon, 27 Aug 2012 02:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239717 - stable/9/sys/fs/ext2fs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 02:56:58 -0000 Author: pfg Date: Mon Aug 27 02:56:58 2012 New Revision: 239717 URL: http://svn.freebsd.org/changeset/base/239717 Log: MFC r239636: Add some basic definitions for a future htree implementation. Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h stable/9/sys/fs/ext2fs/ext2fs.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_dinode.h Sun Aug 26 20:22:43 2012 (r239716) +++ stable/9/sys/fs/ext2fs/ext2_dinode.h Mon Aug 27 02:56:58 2012 (r239717) @@ -57,10 +57,12 @@ #define EXT2_COMPR 0x00000004 /* Compress file */ #define EXT2_SYNC 0x00000008 /* Synchronous updates */ #define EXT2_IMMUTABLE 0x00000010 /* Immutable file */ -#define EXT2_APPEND 0x00000020 /* writes to file may only append */ +#define EXT2_APPEND 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP 0x00000040 /* do not dump file */ #define EXT2_NOATIME 0x00000080 /* do not update atime */ +#define EXT2_HTREE 0x00001000 /* HTree-indexed directory */ + /* * Definitions for nanosecond timestamps. * Ext3 inode versioning, 2006-12-13. Modified: stable/9/sys/fs/ext2fs/ext2fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2fs.h Sun Aug 26 20:22:43 2012 (r239716) +++ stable/9/sys/fs/ext2fs/ext2fs.h Mon Aug 27 02:56:58 2012 (r239717) @@ -210,6 +210,7 @@ struct m_ext2fs { #define EXT2F_COMPAT_PREALLOC 0x0001 #define EXT2F_COMPAT_HASJOURNAL 0x0004 #define EXT2F_COMPAT_RESIZE 0x0010 +#define EXT2F_COMPAT_HTREE 0x0020 #define EXT2F_ROCOMPAT_SPARSESUPER 0x0001 #define EXT2F_ROCOMPAT_LARGEFILE 0x0002 From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 12:40:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6ED106566C; Mon, 27 Aug 2012 12:40:41 +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 5D1BF8FC15; Mon, 27 Aug 2012 12:40:41 +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 q7RCef8F097368; Mon, 27 Aug 2012 12:40:41 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RCefJT097356; Mon, 27 Aug 2012 12:40:41 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208271240.q7RCefJT097356@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 27 Aug 2012 12:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239725 - in stable/9: share/man/man4 sys/dev/usb sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 12:40:41 -0000 Author: gavin Date: Mon Aug 27 12:40:40 2012 New Revision: 239725 URL: http://svn.freebsd.org/changeset/base/239725 Log: Merge r238766, r238774 from head: Update the list of devices supported by uplcom. Although this only adds one device (support for Motorola cables), this syncronises us with: OpenBSD src/sys/dev/usb/uplcom.c 1.56 NetBSD src/sys/dev/usb/uplcom.c 1.73 Linux kernel.org HEAD Modified: stable/9/share/man/man4/uplcom.4 stable/9/sys/dev/usb/serial/uplcom.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/share/man/man4/uplcom.4 ============================================================================== --- stable/9/share/man/man4/uplcom.4 Mon Aug 27 11:59:04 2012 (r239724) +++ stable/9/share/man/man4/uplcom.4 Mon Aug 27 12:40:40 2012 (r239725) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 11, 2011 +.Dd July 25, 2012 .Dt UPLCOM 4 .Os .Sh NAME @@ -116,6 +116,8 @@ Microsoft Palm 700WX .It Mobile Action MA-620 Infrared Adapter .It +Motorola Cables +.It Nokia CA-42 Cable .It OTI DKU-5 cable Modified: stable/9/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uplcom.c Mon Aug 27 11:59:04 2012 (r239724) +++ stable/9/sys/dev/usb/serial/uplcom.c Mon Aug 27 12:40:40 2012 (r239725) @@ -279,6 +279,7 @@ static const STRUCT_USB_HOST_ID uplcom_d UPLCOM_DEV(PROLIFIC, DCU11), /* DCU-11 Phone Cable */ UPLCOM_DEV(PROLIFIC, HCR331), /* HCR331 Card Reader */ UPLCOM_DEV(PROLIFIC, MICROMAX_610U), /* Micromax 610U modem */ + UPLCOM_DEV(PROLIFIC, MOTOROLA), /* Motorola cable */ UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ UPLCOM_DEV(PROLIFIC, PL2303), /* Generic adapter */ UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Mon Aug 27 11:59:04 2012 (r239724) +++ stable/9/sys/dev/usb/usbdevs Mon Aug 27 12:40:40 2012 (r239725) @@ -2646,6 +2646,7 @@ product PRIMAX HP_RH304AA 0x4d17 HP RH30 /* Prolific products */ product PROLIFIC PL2301 0x0000 PL2301 Host-Host interface product PROLIFIC PL2302 0x0001 PL2302 Host-Host interface +product PROLIFIC MOTOROLA 0x0307 Motorola Cable product PROLIFIC RSAQ2 0x04bb PL2303 Serial (IODATA USB-RSAQ2) product PROLIFIC ALLTRONIX_GPRS 0x0609 Alltronix ACM003U00 modem product PROLIFIC ALDIGA_AL11U 0x0611 AlDiga AL-11U modem From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 12:58:55 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 34941106564A; Mon, 27 Aug 2012 12:58:55 +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 ECDEC8FC1A; Mon, 27 Aug 2012 12:58: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 q7RCwst4099775; Mon, 27 Aug 2012 12:58:54 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RCws1X099772; Mon, 27 Aug 2012 12:58:54 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208271258.q7RCws1X099772@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 27 Aug 2012 12:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239727 - stable/9/share/misc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 12:58:55 -0000 Author: gavin Date: Mon Aug 27 12:58:54 2012 New Revision: 239727 URL: http://svn.freebsd.org/changeset/base/239727 Log: Merge r236101, r236102 from head: Update to reflect various src and doc commit bits taken into safekeeping. Modified: stable/9/share/misc/committers-doc.dot stable/9/share/misc/committers-src.dot Directory Properties: stable/9/share/misc/ (props changed) Modified: stable/9/share/misc/committers-doc.dot ============================================================================== --- stable/9/share/misc/committers-doc.dot Mon Aug 27 12:45:41 2012 (r239726) +++ stable/9/share/misc/committers-doc.dot Mon Aug 27 12:58:54 2012 (r239727) @@ -32,15 +32,19 @@ node [color=grey62, style=filled, bgcolo ache [label="Andrey Chernov\nache@FreeBSD.org\n1997/06/13\n2010/12/11"] bmah [label="Bruce A. Mah\nbmah@FreeBSD.org\n2000/08/22\n2009/09/13"] bvs [label="Vitaly Bogdanov\nbvs@FreeBSD.org\n2005/10/03\n2010/12/11"] +ceri [label="Ceri Davies\nceri@FreeBSD.org\n2002/03/17\n2012/02/29"] den [label="Denis Peplin\nden@FreeBSD.org\n2003/09/13\n2009/07/09"] garys [label="Gary W. Swearingen\ngarys@FreeBSD.org\n2005/08/21\n2008/03/02"] jcamou [label="Jesus R. Camou\njcamou@FreeBSD.org\n2005/03/02\n2008/12/20"] jesusr [label="Jesus Rodriguez Cuesta\njesusr@FreeBSD.org\n1998/12/10\n2010/12/11"] jim [label="Jim Mock\njim@FreeBSD.org\n1999/08/11\n2003/12/15"] josef [label="Josef El-Rayes\njosef@FreeBSD.org\n2004/01/15\n2008/03/29"] +marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03\n2012/04/25"] mheinen [label="Martin Heinen\nmheinen@FreeBSD.org\n2002/10/04\n2006/04/26"] +murray [label="Murray Stokely\nmurray@FreeBSD.org\n2000/04/05\n2012/04/25"] nik [label="Nik Clayton\nnik@FreeBSD.org\n1998/02/26\n2008/12/20"] pgj [label="Gabor Pali\npgj@FreeBSD.org\n2008/04/21\n2010/12/01"] +roam [label="Peter Pentchev\nroam@FreeBSD.org\n2003/02/14\n2012/02/29"] node [color=lightblue2, style=filled, bgcolor=black]; @@ -51,7 +55,6 @@ bcr [label="Benedict Reuschling\nbcr@Fre blackend [label="Marc Fonvieille\nblackend@FreeBSD.org\n2002/06/16"] brd [label="Brad Davis\nbrd@FreeBSD.org\n2005/06/01"] brueffer [label="Christian Brueffer\nbrueffer@FreeBSD.org\n2003/01/13"] -ceri [label="Ceri Davies\nceri@FreeBSD.org\n2002/03/17"] chinsan [label="Chinsan Huang\nchinsan@FreeBSD.org\n2006/09/20"] danger [label="Daniel Gerzo\ndanger@FreeBSD.org\n2006/08/20"] delphij [label="Xin Li\ndelphij@FreeBSD.org\n2004/09/14"] @@ -66,15 +69,12 @@ keramida [label="Giorgos Keramidas\nkera linimon [label="Mark Linimon\nlinimon@FreeBSD.org\n2004/03/31"] loader [label="Fukang Chen\nloader@FreeBSD.org\n2007/07/30"] manolis [label="Manolis Kiagias\nmanolis@FreeBSD.org\n2008/05/24"] -marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03"] marck [label="Dmitry Morozovsky\nmarck@FreeBSD.org\n2004/08/10"] maxim [label="Maxim Konovalov\nmaxim@FreeBSD.org\n2002/02/07"] miwi [label="Martin Wilke\nmiwi@FreeBSD.org\n2007/10/26"] -murray [label="Murray Stokely\nmurray@FreeBSD.org\n2000/04/05"] pav [label="Pav Lucistnik\npav@FreeBSD.org\n2005/08/12"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2004/10/16"] rene [label="Rene Ladan\nrene@FreeBSD.org\n2008/11/03"] -roam [label="Peter Pentchev\nroam@FreeBSD.org\n2003/02/14"] ryusuke [label="Ryusuke Suzuki\nryusuke@FreeBSD.org\n2009/12/21"] simon [label="Simon L. Nielsen\nsimon@FreeBSD.org\n2003/07/20"] taras [label="Taras Korenko\ntaras@FreeBSD.org\n2010/06/25"] Modified: stable/9/share/misc/committers-src.dot ============================================================================== --- stable/9/share/misc/committers-src.dot Mon Aug 27 12:45:41 2012 (r239726) +++ stable/9/share/misc/committers-src.dot Mon Aug 27 12:58:54 2012 (r239727) @@ -39,6 +39,7 @@ billf [label="Bill Fumerola\nbillf@FreeB bmah [label="Bruce A. Mah\nbmah@FreeBSD.org\n2002/01/29\n2009/09/13"] bmilekic [label="Bosko Milekic\nbmilekic@FreeBSD.org\n2000/09/21\n2008/11/10"] bushman [label="Michael Bushkov\nbushman@FreeBSD.org\n2007/03/10\n2010/04/29"] +ceri [label="Ceri Davies\nceri@FreeBSD.org\n2006/11/07\n2012/03/07"] cjc [label="Crist J. Clark\ncjc@FreeBSD.org\n2001/06/01\n2006/12/29"] dds [label="Diomidis Spinellis\ndds@FreeBSD.org\n2003/06/20\n2010/09/22"] dhartmei [label="Daniel Hartmeier\ndhartmei@FreeBSD.org\n2004/04/06\n2008/12/08"] @@ -58,18 +59,22 @@ jtc [label="J.T. Conklin\njtc@FreeBSD.or kbyanc [label="Kelly Yancey\nkbyanc@FreeBSD.org\n2000/07/11\n2006/07/25"] keichii [label="Michael Wu\nkeichii@FreeBSD.org\n2001/03/07\n2006/04/28"] linimon [label="Mark Linimon\nlinimon@FreeBSD.org\n2006/09/30\n2008/05/04"] +lulf [label="Ulf Lilleengen\nlulf@FreeBSD.org\n2007/10/24\n2012/01/19"] mb [label="Maxim Bolotin\nmb@FreeBSD.org\n2000/04/06\n2003/03/08"] marks [label="Mark Santcroos\nmarks@FreeBSD.org\n2004/03/18\n2008/09/29"] mike [label="Mike Barcroft\nmike@FreeBSD.org\n2001/07/17\n2006/04/28"] msmith [label="Mike Smith\nmsmith@FreeBSD.org\n????/??/??\n2003/12/15"] murray [label="Murray Stokely\nmurray@FreeBSD.org\n2000/04/05\n2010/07/25"] +mux [label="Maxime Henrion\nmux@FreeBSD.org\n2002/03/03\n2011/06/22"] nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/12\n2003/12/15"] njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] +randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20\n2012/05/10"] rgrimes [label="Rod Grimes\nrgrimes@FreeBSD.org\n1993/06/12\n2003/03/08"] rink [label="Rink Springer\nrink@FreeBSD.org\n2006/01/16\n2010/11/04"] robert [label="Robert Drehmel\nrobert@FreeBSD.org\n2001/08/23\n2006/05/13"] +rmh [label="Robert Millan\nrmh@FreeBSD.org\n2011/09/18"] rpaulo [label="Rui Paulo\nrpaulo@FreeBSD.org\n2007/09/25\n2010/12/03"] sah [label="Sam Hopkins\nsah@FreeBSD.org\n2004/12/15\n2008/11/10"] shafeeq [label="Shafeeq Sinnamohideen\nshafeeq@FreeBSD.org\n2000/06/19\n2006/04/06"] @@ -81,6 +86,7 @@ tmm [label="Thomas Moestl\ntmm@FreeBSD.o toshi [label="Toshihiko Arai\ntoshi@FreeBSD.org\n2000/07/06\n2003/03/08"] tshiozak [label="Takuya SHIOZAKI\ntshiozak@FreeBSD.org\n2001/04/25\n2003/03/08"] uch [label="UCHIYAMA Yasushi\nuch@FreeBSD.org\n2000/06/21\n2002/04/24"] +yar [label="Yar Tikhiy\nyar@FreeBSD.org\n2001/03/25\n2012/05/23"] node [color=lightblue2, style=filled, bgcolor=black]; @@ -110,7 +116,6 @@ brueffer [label="Christian Brueffer\nbru bruno [label="Bruno Ducrot\nbruno@FreeBSD.org\n2005/07/18"] bschmidt [label="Bernhard Schmidt\nbschmidt@FreeBSD.org\n2010/02/06"] bz [label="Bjoern A. Zeeb\nbz@FreeBSD.org\n2004/07/27"] -ceri [label="Ceri Davies\nceri@FreeBSD.org\n2006/11/07"] cognet [label="Olivier Houchard\ncognet@FreeBSD.org\n2002/10/09"] cokane [label="Coleman Kane\ncokane@FreeBSD.org\n2000/06/19"] cperciva [label="Colin Percival\ncperciva@FreeBSD.org\n2004/01/20"] @@ -174,7 +179,6 @@ kib [label="Konstantin Belousov\nkib@Fre kmacy [label="Kip Macy\nkmacy@FreeBSD.org\n2005/06/01"] le [label="Lukas Ertl\nle@FreeBSD.org\n2004/02/02"] lstewart [label="Lawrence Stewart\nlstewart@FreeBSD.org\n2008/10/06"] -lulf [label="Ulf Lilleengen\nlulf@FreeBSD.org\n2007/10/24"] marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03"] marius [label="Marius Strobl\nmarius@FreeBSD.org\n2004/04/17"] markm [label="Mark Murray\nmarkm@FreeBSD.org\n199?/??/??"] @@ -187,7 +191,6 @@ mdodd [label="Matthew N. Dodd\nmdodd@Fre mjacob [label="Matt Jacob\nmjacob@FreeBSD.org\n1997/08/13"] mlaier [label="Max Laier\nmlaier@FreeBSD.org\n2004/02/10"] mr [label="Michael Reifenberger\nmr@FreeBSD.org\n2001/09/30"] -mux [label="Maxime Henrion\nmux@FreeBSD.org\n2002/03/03"] neel [label="Neel Natu\nneel@FreeBSD.org\n2009/09/20"] netchild [label="Alexander Leidinger\nnetchild@FreeBSD.org\n2005/03/31"] nork [label="Norikatsu Shigemura\nnork@FreeBSD.org\n2009/06/09"] @@ -197,7 +200,7 @@ obrien [label="David E. O'Brien\nobrien@ olli [label="Oliver Fromme\nolli@FreeBSD.org\n2008/02/14"] peadar [label="Peter Edwards\npeadar@FreeBSD.org\n2004/03/08"] peter [label="Peter Wemm\npeter@FreeBSD.org\n????/??/??"] -philip [label="Philip Paeps\nphilip@FreBSD.org\n2004/01/21"] +philip [label="Philip Paeps\nphilip@FreeBSD.org\n2004/01/21"] phk [label="Poul-Henning Kamp\nphk@FreeBSD.org\n1994/02/21"] pho [label="Peter Holm\npho@FreeBSD.org\n2008/11/16"] pjd [label="Pawel Jakub Dawidek\npjd@FreeBSD.org\n2004/02/02"] @@ -205,14 +208,15 @@ pluknet [label="Sergey Kandaurov\nplukne ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2007/01/31"] -randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20"] ray [label="Aleksandr Rybalko\nray@FreeBSD.org\n2011/05/25"] rdivacky [label="Roman Divacky\nrdivacky@FreeBSD.org\n2008/03/13"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2007/02/23"] rik [label="Roman Kurakin\nrik@FreeBSD.org\n2003/12/18"] rmacklem [label="Rick Macklem\nrmacklem@FreeBSD.org\n2009/03/27"] +rmh [label="Robert Millan\nrmh@FreeBSD.org\n2011/09/18"] rnoland [label="Robert Noland\nrnoland@FreeBSD.org\n2008/09/15"] roberto [label="Ollivier Robert\nroberto@FreeBSD.org\n1995/02/22"] +rpaulo [label="Rui Paulo\nrpaulo@FreeBSD.org\n2007/09/25"] rrs [label="Randall R Stewart\nrrs@FreeBSD.org\n2007/02/08"] rse [label="Ralf S. Engelschall\nrse@FreeBSD.org\n1997/07/31"] rstone [label="Ryan Stone\nrstone@FreeBSD.org\n2010/04/19"] @@ -249,7 +253,6 @@ wes [label="Wes Peters\nwes@FreeBSD.org\ wilko [label="Wilko Bulte\nwilko@FreeBSD.org\n2000/01/13"] wollman [label="Garrett Wollman\nwollman@FreeBSD.org\n????/??/??"] wsalamon [label="Wayne Salamon\nwsalamon@FreeBSD.org\n2005/06/25"] -yar [label="Yar Tikhiy\nyar@FreeBSD.org\n2001/03/25"] yongari [label="Pyun YongHyeon\nyongari@FreeBSD.org\n2004/08/01"] zack [label="Zack Kirsch\nzack@FreeBSD.org\n2010/11/05"] zec [label="Marko Zec\nzec@FreeBSD.org\n2008/06/22"] From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 13:04:46 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64A59106566B; Mon, 27 Aug 2012 13:04:46 +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 4EB738FC08; Mon, 27 Aug 2012 13:04:46 +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 q7RD4khp000633; Mon, 27 Aug 2012 13:04:46 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RD4kLx000631; Mon, 27 Aug 2012 13:04:46 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208271304.q7RD4kLx000631@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 27 Aug 2012 13:04:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239728 - stable/9/share/misc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 13:04:46 -0000 Author: gavin Date: Mon Aug 27 13:04:45 2012 New Revision: 239728 URL: http://svn.freebsd.org/changeset/base/239728 Log: Merge r238396 from head: Update to reflect new core team. Modified: stable/9/share/misc/organization.dot Directory Properties: stable/9/share/misc/ (props changed) Modified: stable/9/share/misc/organization.dot ============================================================================== --- stable/9/share/misc/organization.dot Mon Aug 27 12:58:54 2012 (r239727) +++ stable/9/share/misc/organization.dot Mon Aug 27 13:04:45 2012 (r239728) @@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"] # Development teams go here alphabetically sorted -core [label="Core Team\ncore@FreeBSD.org\nwilko, brooks, keramida, imp,\ngnn, wes, hrs, murray,\nrwatson"] +core [label="Core Team\ncore@FreeBSD.org\ntabthorpe, gavin, jhb, kib,\ntheraven, attilio, hrs,\npeter, miwi"] coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\njoel"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nnik, blackend, hrs,\nkeramida"] From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 14:44:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 26BAD10657AD; Mon, 27 Aug 2012 14:44:41 +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 EBCBB8FC22; Mon, 27 Aug 2012 14:44:40 +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 q7REiegY012374; Mon, 27 Aug 2012 14:44:40 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7REiehL012372; Mon, 27 Aug 2012 14:44:40 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208271444.q7REiehL012372@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 27 Aug 2012 14:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239732 - stable/9/sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 14:44:41 -0000 Author: gavin Date: Mon Aug 27 14:44:40 2012 New Revision: 239732 URL: http://svn.freebsd.org/changeset/base/239732 Log: Merge r238778 from head: The baud rate on CP1201/2/3 devices can be set in one of two ways: - The USLCOM_SET_BAUD_DIV command (0x01) - The USLCOM_SET_BAUD_RATE command (0x13) Devices based on the CP1204 will only accept the latter command, and ignore the former. As the latter command works on all chips that this driver supports, switch to always using it. A slight confusion here is that the previously used command was incorrectly named USLCOM_BAUD_RATE - even though we no longer use it, rename it to USLCOM_SET_BAUD_DIV to closer match the name used in the datasheet. This change reflects a similar change made in the Linux driver, which was submitted by preston.fick at silabs.com, and has been tested on all of the uslcom(4) devices I have to hand. Modified: stable/9/sys/dev/usb/serial/uslcom.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/serial/uslcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uslcom.c Mon Aug 27 13:50:01 2012 (r239731) +++ stable/9/sys/dev/usb/serial/uslcom.c Mon Aug 27 14:44:40 2012 (r239732) @@ -70,12 +70,13 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb /* Request codes */ #define USLCOM_UART 0x00 -#define USLCOM_BAUD_RATE 0x01 +#define USLCOM_SET_BAUD_DIV 0x01 #define USLCOM_DATA 0x03 #define USLCOM_BREAK 0x05 #define USLCOM_CTRL 0x07 #define USLCOM_RCTRL 0x08 #define USLCOM_SET_FLOWCTRL 0x13 +#define USLCOM_SET_BAUD_RATE 0x1e #define USLCOM_VENDOR_SPECIFIC 0xff /* USLCOM_UART values */ @@ -92,8 +93,8 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb #define USLCOM_CTRL_RI 0x0040 #define USLCOM_CTRL_DCD 0x0080 -/* USLCOM_BAUD_RATE values */ -#define USLCOM_BAUD_REF 0x384000 +/* USLCOM_SET_BAUD_DIV values */ +#define USLCOM_BAUD_REF 3686400 /* 3.6864 MHz */ /* USLCOM_DATA values */ #define USLCOM_STOP_BITS_1 0x00 @@ -511,19 +512,20 @@ uslcom_param(struct ucom_softc *ucom, st { struct uslcom_softc *sc = ucom->sc_parent; struct usb_device_request req; - uint32_t flowctrl[4]; + uint32_t baudrate, flowctrl[4]; uint16_t data; DPRINTF("\n"); + baudrate = t->c_ospeed; req.bmRequestType = USLCOM_WRITE; - req.bRequest = USLCOM_BAUD_RATE; - USETW(req.wValue, USLCOM_BAUD_REF / t->c_ospeed); + req.bRequest = USLCOM_SET_BAUD_RATE; + USETW(req.wValue, 0); USETW(req.wIndex, USLCOM_PORT_NO); - USETW(req.wLength, 0); + USETW(req.wLength, sizeof(baudrate)); - if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, - &req, NULL, 0, 1000)) { + if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, + &req, &baudrate, 0, 1000)) { DPRINTF("Set baudrate failed (ignored)\n"); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 15:47:47 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6946C1065670; Mon, 27 Aug 2012 15:47:47 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51CB78FC1C; Mon, 27 Aug 2012 15:47: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 q7RFllQ4019536; Mon, 27 Aug 2012 15:47:47 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RFllPq019528; Mon, 27 Aug 2012 15:47:47 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208271547.q7RFllPq019528@svn.freebsd.org> From: Jim Harris Date: Mon, 27 Aug 2012 15:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239734 - in stable/9/sys/dev/isci: . scil X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 15:47:47 -0000 Author: jimharris Date: Mon Aug 27 15:47:46 2012 New Revision: 239734 URL: http://svn.freebsd.org/changeset/base/239734 Log: MFC r239545, r239665: Fix/add support for SCSI UNMAP to ATA DSM translation. This addresses kernel panic observed when sending SCSI UNMAP commands to SATA disks attached to isci(4). 1) Flesh out callback routines to allocate/free buffers needed for translating SCSI UNMAP data to ATA DSM data. 2) Add controller-level pool for storing buffers previously allocated for UNMAP translation, to lessen chance of no buffer available under memory pressure. 3) Ensure driver properly handles case where buffer pool is empty and contigmalloc returns NULL. 4) Clear freeze bit in isci_remote_device_release_lun_queue() before calling xpt_release_devq to ensure that any ccbs which immediately start during the call to xpt_release_devq() see an accurate picture of the frozen_lun_mask. This code path is extensively exercised when tagged read/write commands mix with non-tagged DSM commands. Sponsored by: Intel Modified: stable/9/sys/dev/isci/isci.c stable/9/sys/dev/isci/isci.h stable/9/sys/dev/isci/isci_controller.c stable/9/sys/dev/isci/isci_remote_device.c stable/9/sys/dev/isci/scil/sati_unmap.c stable/9/sys/dev/isci/scil/scif_sas_sati_binding.h stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/isci/isci.c ============================================================================== --- stable/9/sys/dev/isci/isci.c Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/isci.c Mon Aug 27 15:47:46 2012 (r239734) @@ -185,6 +185,7 @@ isci_detach(device_t device) for (i = 0; i < isci->controller_count; i++) { struct ISCI_CONTROLLER *controller = &isci->controllers[i]; SCI_STATUS status; + void *unmap_buffer; if (controller->scif_controller_handle != NULL) { scic_controller_disable_interrupts( @@ -218,6 +219,13 @@ isci_detach(device_t device) if (controller->remote_device_memory != NULL) free(controller->remote_device_memory, M_ISCI); + + while (1) { + sci_pool_get(controller->unmap_buffer_pool, unmap_buffer); + if (unmap_buffer == NULL) + break; + contigfree(unmap_buffer, PAGE_SIZE, M_ISCI); + } } /* The SCIF controllers have been stopped, so we can now Modified: stable/9/sys/dev/isci/isci.h ============================================================================== --- stable/9/sys/dev/isci/isci.h Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/isci.h Mon Aug 27 15:47:46 2012 (r239734) @@ -175,6 +175,7 @@ struct ISCI_CONTROLLER SCI_POOL_CREATE(remote_device_pool, struct ISCI_REMOTE_DEVICE *, SCI_MAX_REMOTE_DEVICES); SCI_POOL_CREATE(request_pool, struct ISCI_REQUEST *, SCI_MAX_IO_REQUESTS); SCI_POOL_CREATE(timer_pool, struct ISCI_TIMER *, SCI_MAX_TIMERS); + SCI_POOL_CREATE(unmap_buffer_pool, void *, SCI_MAX_REMOTE_DEVICES); }; struct ISCI_REQUEST Modified: stable/9/sys/dev/isci/isci_controller.c ============================================================================== --- stable/9/sys/dev/isci/isci_controller.c Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/isci_controller.c Mon Aug 27 15:47:46 2012 (r239734) @@ -145,6 +145,14 @@ void scif_cb_controller_stop_complete(SC isci_controller->is_started = FALSE; } +static void +isci_single_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) +{ + SCI_PHYSICAL_ADDRESS *phys_addr = arg; + + *phys_addr = seg[0].ds_addr; +} + /** * @brief This method will be invoked to allocate memory dynamically. * @@ -159,7 +167,29 @@ void scif_cb_controller_stop_complete(SC void scif_cb_controller_allocate_memory(SCI_CONTROLLER_HANDLE_T controller, SCI_PHYSICAL_MEMORY_DESCRIPTOR_T *mde) { + struct ISCI_CONTROLLER *isci_controller = (struct ISCI_CONTROLLER *) + sci_object_get_association(controller); + /* + * Note this routine is only used for buffers needed to translate + * SCSI UNMAP commands to ATA DSM commands for SATA disks. + * + * We first try to pull a buffer from the controller's pool, and only + * call contigmalloc if one isn't there. + */ + if (!sci_pool_empty(isci_controller->unmap_buffer_pool)) { + sci_pool_get(isci_controller->unmap_buffer_pool, + mde->virtual_address); + } else + mde->virtual_address = contigmalloc(PAGE_SIZE, + M_ISCI, M_NOWAIT, 0, BUS_SPACE_MAXADDR, + mde->constant_memory_alignment, 0); + + if (mde->virtual_address != NULL) + bus_dmamap_load(isci_controller->buffer_dma_tag, + NULL, mde->virtual_address, PAGE_SIZE, + isci_single_map, &mde->physical_address, + BUS_DMA_NOWAIT); } /** @@ -176,7 +206,16 @@ void scif_cb_controller_allocate_memory( void scif_cb_controller_free_memory(SCI_CONTROLLER_HANDLE_T controller, SCI_PHYSICAL_MEMORY_DESCRIPTOR_T * mde) { + struct ISCI_CONTROLLER *isci_controller = (struct ISCI_CONTROLLER *) + sci_object_get_association(controller); + /* + * Put the buffer back into the controller's buffer pool, rather + * than invoking configfree. This helps reduce chance we won't + * have buffers available when system is under memory pressure. + */ + sci_pool_put(isci_controller->unmap_buffer_pool, + mde->virtual_address); } void isci_controller_construct(struct ISCI_CONTROLLER *controller, @@ -228,6 +267,8 @@ void isci_controller_construct(struct IS for ( int i = 0; i < SCI_MAX_TIMERS; i++ ) { sci_pool_put(controller->timer_pool, timer++); } + + sci_pool_initialize(controller->unmap_buffer_pool); } SCI_STATUS isci_controller_initialize(struct ISCI_CONTROLLER *controller) Modified: stable/9/sys/dev/isci/isci_remote_device.c ============================================================================== --- stable/9/sys/dev/isci/isci_remote_device.c Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/isci_remote_device.c Mon Aug 27 15:47:46 2012 (r239734) @@ -278,12 +278,12 @@ isci_remote_device_release_lun_queue(str if (remote_device->frozen_lun_mask & (1 << lun)) { struct cam_path *path; + remote_device->frozen_lun_mask &= ~(1 << lun); xpt_create_path(&path, xpt_periph, cam_sim_path(remote_device->domain->controller->sim), remote_device->index, lun); xpt_release_devq(path, 1, TRUE); xpt_free_path(path); - remote_device->frozen_lun_mask &= ~(1 << lun); } } Modified: stable/9/sys/dev/isci/scil/sati_unmap.c ============================================================================== --- stable/9/sys/dev/isci/scil/sati_unmap.c Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/scil/sati_unmap.c Mon Aug 27 15:47:46 2012 (r239734) @@ -335,8 +335,8 @@ SATI_STATUS sati_unmap_initial_processin sati_scsi_sense_data_construct( sequence, scsi_io, - SCSI_STATUS_CHECK_CONDITION, - SCSI_SENSE_ABORTED_COMMAND, + SCSI_STATUS_BUSY, + SCSI_SENSE_NO_SENSE, SCSI_ASC_NO_ADDITIONAL_SENSE, SCSI_ASCQ_NO_ADDITIONAL_SENSE ); Modified: stable/9/sys/dev/isci/scil/scif_sas_sati_binding.h ============================================================================== --- stable/9/sys/dev/isci/scil/scif_sas_sati_binding.h Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/scil/scif_sas_sati_binding.h Mon Aug 27 15:47:46 2012 (r239734) @@ -183,22 +183,16 @@ extern "C" { { \ SCIF_SAS_REQUEST_T* fw_request = (SCIF_SAS_REQUEST_T*)scsi_io; \ SCI_PHYSICAL_MEMORY_DESCRIPTOR_T mde; \ - SCI_PHYSICAL_ADDRESS phys_addr; \ mde.virtual_address = NULL; \ - sci_cb_make_physical_address(mde.physical_address, 0, 0); \ sci_base_mde_construct( \ &mde, 4, length, SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS \ ); \ scif_cb_controller_allocate_memory( \ fw_request->device->domain->controller, &mde \ ); \ - scic_cb_io_request_get_physical_address(fw_request->device->domain->controller, \ - NULL, \ - mde.virtual_address, \ - &phys_addr); \ *(virt_address) = mde.virtual_address; \ - *(phys_address_low) = sci_cb_physical_address_lower(phys_addr); \ - *(phys_address_high) = sci_cb_physical_address_upper(phys_addr); \ + *(phys_address_low) = sci_cb_physical_address_lower(mde.physical_address); \ + *(phys_address_high) = sci_cb_physical_address_upper(mde.physical_address); \ } #define sati_cb_free_dma_buffer(scsi_io, virt_address) \ @@ -206,7 +200,6 @@ extern "C" { SCIF_SAS_REQUEST_T* fw_request = (SCIF_SAS_REQUEST_T*)scsi_io; \ SCI_PHYSICAL_MEMORY_DESCRIPTOR_T mde; \ mde.virtual_address = virt_address; \ - sci_cb_make_physical_address(mde.physical_address, 0, 0); \ sci_base_mde_construct( \ &mde, 4, 0, SCI_MDE_ATTRIBUTE_PHYSICALLY_CONTIGUOUS \ ); \ Modified: stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c ============================================================================== --- stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c Mon Aug 27 14:51:26 2012 (r239733) +++ stable/9/sys/dev/isci/scil/scif_sas_stp_io_request.c Mon Aug 27 15:47:46 2012 (r239734) @@ -171,6 +171,8 @@ SCI_STATUS scif_sas_stp_io_request_const ); } + sati_sequence_terminate(&fw_io->parent.stp.sequence, fw_io, fw_io); + return SCI_SUCCESS; } /** From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 15:57:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E300F106566B; Mon, 27 Aug 2012 15:57:33 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDB088FC25; Mon, 27 Aug 2012 15:57:33 +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 q7RFvX7E020802; Mon, 27 Aug 2012 15:57:33 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RFvX09020800; Mon, 27 Aug 2012 15:57:33 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208271557.q7RFvX09020800@svn.freebsd.org> From: Jim Harris Date: Mon, 27 Aug 2012 15:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239737 - stable/9/sys/cam/scsi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 15:57:34 -0000 Author: jimharris Date: Mon Aug 27 15:57:33 2012 New Revision: 239737 URL: http://svn.freebsd.org/changeset/base/239737 Log: MFC r239655: Fix scsi_da's BIO_DELETE->SCSI_UNMAP translation to use correct local variable when determining various sizes related to SCSI UNMAP block descriptor lists. Sponsored by: Intel Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Mon Aug 27 15:54:51 2012 (r239736) +++ stable/9/sys/cam/scsi/scsi_da.c Mon Aug 27 15:57:33 2012 (r239737) @@ -1788,8 +1788,8 @@ dastart(struct cam_periph *periph, union softc->params.secsize > softc->unmap_max_lba) break; } while (1); - scsi_ulto2b(count * 16 + 6, &buf[0]); - scsi_ulto2b(count * 16, &buf[2]); + scsi_ulto2b(ranges * 16 + 6, &buf[0]); + scsi_ulto2b(ranges * 16, &buf[2]); scsi_unmap(&start_ccb->csio, /*retries*/da_retry_count, @@ -1797,7 +1797,7 @@ dastart(struct cam_periph *periph, union /*tag_action*/MSG_SIMPLE_Q_TAG, /*byte2*/0, /*data_ptr*/ buf, - /*dxfer_len*/ count * 16 + 8, + /*dxfer_len*/ ranges * 16 + 8, /*sense_len*/SSD_FULL_SIZE, da_default_timeout * 1000); start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 19:37:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA286106564A; Mon, 27 Aug 2012 19:37:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0B818FC16; Mon, 27 Aug 2012 19:37: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 q7RJb2jq046394; Mon, 27 Aug 2012 19:37:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RJb2FU046374; Mon, 27 Aug 2012 19:37:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208271937.q7RJb2FU046374@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Aug 2012 19:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239748 - in stable/9/sys: amd64/conf conf i386/conf modules/mlx4 modules/mlx4ib modules/mlxen modules/mthca ofed/drivers/infiniband/core ofed/drivers/infiniband/ulp/ipoib ofed/drivers/... X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 19:37:03 -0000 Author: jhb Date: Mon Aug 27 19:37:02 2012 New Revision: 239748 URL: http://svn.freebsd.org/changeset/base/239748 Log: MFC 233040,233198,233870,234183: Add OFED and the associated options and drivers to x86 LINT builds: - Fix build with INET6 disabled. - Fix build of OFED bits with debugging options enabled. - Fix build on i386. - Mark 'sdp' as requiring 'inet'. - Always include "opt_inet.h" and "opt_inet6.h" and modify the IB driver Makefiles to honor WITH/WITHOUT_INET/INET6/_SUPPORT options to determine what should be enabled during a module build. - Fix the mlxen(4) driver and the core IB code to compile without if INET is disabled (including when both INET and INET6 are disabled). Modified: stable/9/sys/amd64/conf/NOTES stable/9/sys/conf/files stable/9/sys/i386/conf/NOTES stable/9/sys/modules/mlx4/Makefile stable/9/sys/modules/mlx4ib/Makefile stable/9/sys/modules/mlxen/Makefile stable/9/sys/modules/mthca/Makefile stable/9/sys/ofed/drivers/infiniband/core/addr.c stable/9/sys/ofed/drivers/infiniband/core/cma.c stable/9/sys/ofed/drivers/infiniband/core/fmr_pool.c stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c stable/9/sys/ofed/drivers/net/mlx4/en_frag.c stable/9/sys/ofed/drivers/net/mlx4/en_rx.c stable/9/sys/ofed/include/linux/in.h stable/9/sys/ofed/include/linux/in6.h stable/9/sys/ofed/include/net/ip.h stable/9/sys/ofed/include/net/ipv6.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/conf/NOTES ============================================================================== --- stable/9/sys/amd64/conf/NOTES Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/amd64/conf/NOTES Mon Aug 27 19:37:02 2012 (r239748) @@ -90,6 +90,19 @@ options DEVICE_POLLING options BPF_JITTER +# OpenFabrics Enterprise Distribution (Infiniband). +options OFED +options OFED_DEBUG_INIT + +# Sockets Direct Protocol +options SDP +options SDP_DEBUG + +# IP over Inifiband +options IPOIB +options IPOIB_DEBUG +options IPOIB_CM + ##################################################################### # CLOCK OPTIONS @@ -290,6 +303,9 @@ options DRM_DEBUG # Include debug print # Requires the iwi firmware module # iwn: Intel Wireless WiFi Link 4965/1000/5000/6000 802.11 network adapters # Requires the iwn firmware module +# mlx4ib: Mellanox ConnectX HCA InfiniBand +# mlxen: Mellanox ConnectX HCA Ethernet +# mthca: Mellanox HCA InfiniBand # mwl: Marvell 88W8363 IEEE 802.11 adapter # Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) @@ -305,6 +321,9 @@ options ED_SIC device ipw # Intel 2100 wireless NICs. device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. device iwn # Intel 4965/1000/5000/6000 wireless NICs. +device mlx4ib # Mellanox ConnectX HCA InfiniBand +device mlxen # Mellanox ConnectX HCA Ethernet +device mthca # Mellanox HCA InfiniBand device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/conf/files Mon Aug 27 19:37:02 2012 (r239748) @@ -3077,19 +3077,19 @@ ofed/drivers/infiniband/ulp/ipoib/ipoib_ # no-depend \ # compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" -ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" Modified: stable/9/sys/i386/conf/NOTES ============================================================================== --- stable/9/sys/i386/conf/NOTES Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/i386/conf/NOTES Mon Aug 27 19:37:02 2012 (r239748) @@ -260,6 +260,19 @@ options DEVICE_POLLING options BPF_JITTER +# OpenFabrics Enterprise Distribution (Infiniband). +options OFED +options OFED_DEBUG_INIT + +# Sockets Direct Protocol +options SDP +options SDP_DEBUG + +# IP over Inifiband +options IPOIB +options IPOIB_DEBUG +options IPOIB_CM + ##################################################################### # CLOCK OPTIONS @@ -561,6 +574,9 @@ hint.mse.0.irq="5" # Requires the iwi firmware module # iwn: Intel Wireless WiFi Link 4965AGN 802.11 network adapters # Requires the iwn firmware module +# mlx4ib: Mellanox ConnectX HCA InfiniBand +# mlxen: Mellanox ConnectX HCA Ethernet +# mthca: Mellanox HCA InfiniBand # mwl: Marvell 88W8363 IEEE 802.11 adapter # Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) @@ -605,6 +621,9 @@ hint.le.0.at="isa" hint.le.0.port="0x280" hint.le.0.irq="10" hint.le.0.drq="0" +device mlx4ib # Mellanox ConnectX HCA InfiniBand +device mlxen # Mellanox ConnectX HCA Ethernet +device mthca # Mellanox HCA InfiniBand device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking Modified: stable/9/sys/modules/mlx4/Makefile ============================================================================== --- stable/9/sys/modules/mlx4/Makefile Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/modules/mlx4/Makefile Mon Aug 27 19:37:02 2012 (r239748) @@ -1,13 +1,28 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/net/mlx4 + +.include + KMOD = mlx4 SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= alloc.c catas.c cmd.c cq.c eq.c fw.c icm.c intf.c main.c mcg.c mr.c SRCS+= pd.c port.c profile.c qp.c reset.c sense.c srq.c xrcd.c +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../ofed/drivers/net/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ -CFLAGS+= -DINET6 + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include Modified: stable/9/sys/modules/mlx4ib/Makefile ============================================================================== --- stable/9/sys/modules/mlx4ib/Makefile Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/modules/mlx4ib/Makefile Mon Aug 27 19:37:02 2012 (r239748) @@ -1,10 +1,26 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/infiniband/hw/mlx4 + +.include + KMOD = mlx4ib SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= ah.c cq.c doorbell.c mad.c main.c mr.c qp.c srq.c wc.c +SRCS+= opt_inet.h opt_inet6.h + +CFLAGS+= -I${.CURDIR}/../../ofed/include/ + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include Modified: stable/9/sys/modules/mlxen/Makefile ============================================================================== --- stable/9/sys/modules/mlxen/Makefile Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/modules/mlxen/Makefile Mon Aug 27 19:37:02 2012 (r239748) @@ -1,12 +1,27 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/net/mlx4 + +.include + KMOD = mlxen SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS += en_cq.c en_frag.c en_main.c en_netdev.c en_port.c en_resources.c SRCS += en_rx.c en_tx.c +SRCS += opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../ofed/drivers/net/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ -CFLAGS+= -DINET6 + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include Modified: stable/9/sys/modules/mthca/Makefile ============================================================================== --- stable/9/sys/modules/mthca/Makefile Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/modules/mthca/Makefile Mon Aug 27 19:37:02 2012 (r239748) @@ -1,14 +1,30 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/infiniband/hw/mthca + +.include + KMOD = mthca SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= mthca_allocator.c mthca_av.c mthca_catas.c mthca_cmd.c mthca_cq.c SRCS+= mthca_eq.c mthca_mad.c mthca_main.c mthca_mcg.c mthca_memfree.c SRCS+= mthca_mr.c mthca_pd.c mthca_profile.c mthca_provider.c mthca_qp.c SRCS+= mthca_reset.c mthca_srq.c mthca_uar.c +SRCS+= opt_inet.h opt_inet6.h + +CFLAGS+= -I${.CURDIR}/../../ofed/include + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include Modified: stable/9/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/core/addr.c Mon Aug 27 19:37:02 2012 (r239748) @@ -136,6 +136,7 @@ int rdma_translate_ip(struct sockaddr *a } switch (addr->sa_family) { +#ifdef INET case AF_INET: dev = ip_dev_find(NULL, ((struct sockaddr_in *) addr)->sin_addr.s_addr); @@ -146,6 +147,7 @@ int rdma_translate_ip(struct sockaddr *a ret = rdma_copy_addr(dev_addr, dev, NULL); dev_put(dev); break; +#endif #if defined(INET6) case AF_INET6: @@ -346,7 +348,9 @@ static int addr_resolve(struct sockaddr struct sockaddr_in6 *sin6; struct ifaddr *ifa; struct ifnet *ifp; +#if defined(INET) || defined(INET6) struct llentry *lle; +#endif struct rtentry *rte; in_port_t port; u_char edst[MAX_ADDR_LEN]; @@ -365,6 +369,7 @@ static int addr_resolve(struct sockaddr ifp = NULL; rte = NULL; switch (dst_in->sa_family) { +#ifdef INET case AF_INET: sin = (struct sockaddr_in *)dst_in; if (sin->sin_addr.s_addr == INADDR_BROADCAST) @@ -383,6 +388,7 @@ static int addr_resolve(struct sockaddr } else src_in = NULL; break; +#endif #ifdef INET6 case AF_INET6: sin6 = (struct sockaddr_in6 *)dst_in; @@ -459,12 +465,21 @@ mcast: /* * Resolve the link local address. */ - if (dst_in->sa_family == AF_INET) + switch (dst_in->sa_family) { +#ifdef INET + case AF_INET: error = arpresolve(ifp, rte, NULL, dst_in, edst, &lle); + break; +#endif #ifdef INET6 - else + case AF_INET6: error = nd6_storelladdr(ifp, NULL, dst_in, (u_char *)edst, &lle); + break; #endif + default: + /* XXX: Shouldn't happen. */ + error = -EINVAL; + } RTFREE(rte); if (error == 0) return rdma_copy_addr(addr, ifp, edst); Modified: stable/9/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 27 19:37:02 2012 (r239748) @@ -96,7 +96,9 @@ static DEFINE_IDR(sdp_ps); static DEFINE_IDR(tcp_ps); static DEFINE_IDR(udp_ps); static DEFINE_IDR(ipoib_ps); +#if defined(INET) static int next_port; +#endif struct cma_device { struct list_head list; @@ -1242,7 +1244,9 @@ static void cma_set_compare_data(enum rd struct cma_hdr *cma_data, *cma_mask; struct sdp_hh *sdp_data, *sdp_mask; __be32 ip4_addr; +#ifdef INET6 struct in6_addr ip6_addr; +#endif memset(compare, 0, sizeof *compare); cma_data = (void *) compare->data; @@ -2135,6 +2139,7 @@ err1: static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv) { +#if defined(INET) struct rdma_bind_list *bind_list; int port, ret, low, high; @@ -2176,6 +2181,9 @@ err2: err1: kfree(bind_list); return ret; +#else + return -ENOSPC; +#endif } static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv) @@ -2917,13 +2925,20 @@ static int cma_ib_mc_handler(int status, static void cma_set_mgid(struct rdma_id_private *id_priv, struct sockaddr *addr, union ib_gid *mgid) { +#if defined(INET) || defined(INET6) unsigned char mc_map[MAX_ADDR_LEN]; struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; +#endif +#ifdef INET struct sockaddr_in *sin = (struct sockaddr_in *) addr; +#endif +#ifdef INET6 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) addr; +#endif if (cma_any_addr(addr)) { memset(mgid, 0, sizeof *mgid); +#ifdef INET6 } else if ((addr->sa_family == AF_INET6) && ((be32_to_cpu(sin6->sin6_addr.s6_addr32[0]) & 0xFFF0FFFF) == 0xFF10A01B)) { @@ -2934,11 +2949,14 @@ static void cma_set_mgid(struct rdma_id_ if (id_priv->id.ps == RDMA_PS_UDP) mc_map[7] = 0x01; /* Use RDMA CM signature */ *mgid = *(union ib_gid *) (mc_map + 4); +#endif +#ifdef INET } else { ip_ib_mc_map(sin->sin_addr.s_addr, dev_addr->broadcast, mc_map); if (id_priv->id.ps == RDMA_PS_UDP) mc_map[7] = 0x01; /* Use RDMA CM signature */ *mgid = *(union ib_gid *) (mc_map + 4); +#endif } } @@ -3341,12 +3359,15 @@ static void cma_remove_one(struct ib_dev static int cma_init(void) { - int ret, low, high, remaining; + int ret; +#if defined(INET) + int low, high, remaining; get_random_bytes(&next_port, sizeof next_port); inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; next_port = ((unsigned int) next_port % remaining) + low; +#endif cma_wq = create_singlethread_workqueue("rdma_cm"); if (!cma_wq) Modified: stable/9/sys/ofed/drivers/infiniband/core/fmr_pool.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/core/fmr_pool.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/core/fmr_pool.c Mon Aug 27 19:37:02 2012 (r239748) @@ -150,7 +150,7 @@ static void ib_fmr_batch_release(struct #ifdef DEBUG if (fmr->ref_count !=0) { - printk(KERN_WARNING PFX "Unmapping FMR 0x%08x with ref count %d\n", + printk(KERN_WARNING PFX "Unmapping FMR %p with ref count %d\n", fmr, fmr->ref_count); } #endif Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Mon Aug 27 19:37:02 2012 (r239748) @@ -1247,7 +1247,9 @@ static void ipoib_cm_mb_reap(struct work cm.mb_task); struct mbuf *mb; unsigned long flags; +#if defined(INET) || defined(INET6) unsigned mtu = priv->mcast_mtu; +#endif uint16_t proto; spin_lock_irqsave(&priv->lock, flags); @@ -1260,14 +1262,20 @@ static void ipoib_cm_mb_reap(struct work proto = htons(*mtod(mb, uint16_t *)); m_adj(mb, IPOIB_ENCAP_LEN); - if (proto == ETHERTYPE_IP) + switch (proto) { +#if defined(INET) + case ETHERTYPE_IP: icmp_error(mb, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, mtu); + break; +#endif #if defined(INET6) - else if (proto == ETHERTYPE_IPV6) + case ETHERTYPE_IPV6: icmp6_error(mb, ICMP6_PACKET_TOO_BIG, 0, mtu); + break; #endif - else + default: m_freem(mb); + } spin_lock_irqsave(&priv->lock, flags); } Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Aug 27 19:37:02 2012 (r239748) @@ -876,7 +876,7 @@ ipoib_intf_alloc(const char *name) dev->if_output = ipoib_output; dev->if_input = ipoib_input; dev->if_resolvemulti = ipoib_resolvemulti; - dev->if_baudrate = IF_Gbps(10LL); + dev->if_baudrate = IF_Gbps(10UL); dev->if_broadcastaddr = priv->broadcastaddr; dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr; Modified: stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Mon Aug 27 19:37:02 2012 (r239748) @@ -855,7 +855,7 @@ sdp_append(struct sdp_sock *ssk, struct int ncnt; SOCKBUF_LOCK_ASSERT(sb); - SBLASTRECORDCHK(sb) + SBLASTRECORDCHK(sb); KASSERT(mb->m_flags & M_PKTHDR, ("sdp_append: %p Missing packet header.\n", mb)); n = sb->sb_lastrecord; Modified: stable/9/sys/ofed/drivers/net/mlx4/en_frag.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_frag.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/net/mlx4/en_frag.c Mon Aug 27 19:37:02 2012 (r239748) @@ -31,8 +31,11 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" +#ifdef INET + #include #include #include @@ -186,3 +189,4 @@ void mlx4_en_flush_frags(struct mlx4_en_ flush_session(priv, session, IP_MF); } } +#endif Modified: stable/9/sys/ofed/drivers/net/mlx4/en_rx.c ============================================================================== --- stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/drivers/net/mlx4/en_rx.c Mon Aug 27 19:37:02 2012 (r239748) @@ -31,6 +31,7 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" #include @@ -287,6 +288,7 @@ int mlx4_en_activate_rx_rings(struct mlx /* Initailize all descriptors */ for (i = 0; i < ring->size; i++) mlx4_en_init_rx_desc(priv, ring, i); +#ifdef INET /* Configure lro mngr */ if (priv->dev->if_capenable & IFCAP_LRO) { if (tcp_lro_init(&ring->lro)) @@ -294,6 +296,7 @@ int mlx4_en_activate_rx_rings(struct mlx else ring->lro.ifp = priv->dev; } +#endif } err = mlx4_en_fill_rx_buffers(priv); if (err) @@ -330,7 +333,9 @@ void mlx4_en_destroy_rx_ring(struct mlx4 void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring) { +#ifdef INET tcp_lro_free(&ring->lro); +#endif mlx4_en_free_rx_buf(priv, ring); if (ring->stride <= TXBB_SIZE) ring->buf -= TXBB_SIZE; @@ -446,7 +451,9 @@ int mlx4_en_process_rx_cq(struct net_dev struct mbuf **mb_list; struct mlx4_en_rx_desc *rx_desc; struct mbuf *mb; +#ifdef INET struct lro_entry *queued; +#endif int index; unsigned int length; int polled = 0; @@ -515,22 +522,26 @@ int mlx4_en_process_rx_cq(struct net_dev * - without IP options * - not an IP fragment */ +#ifdef INET if (mlx4_en_can_lro(cqe->status) && (dev->if_capenable & IFCAP_LRO)) { if (ring->lro.lro_cnt != 0 && tcp_lro_rx(&ring->lro, mb, 0) == 0) goto next; } +#endif /* LRO not possible, complete processing here */ INC_PERF_COUNTER(priv->pstats.lro_misses); } else { mb->m_pkthdr.csum_flags = 0; priv->port_stats.rx_chksum_none++; +#ifdef INET if (priv->ip_reasm && cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4) && !mlx4_en_rx_frags(priv, ring, mb, cqe)) goto next; +#endif } /* Push it up the stack */ @@ -545,11 +556,13 @@ next: } /* Flush all pending IP reassembly sessions */ out: +#ifdef INET mlx4_en_flush_frags(priv, ring); while ((queued = SLIST_FIRST(&ring->lro.lro_active)) != NULL) { SLIST_REMOVE_HEAD(&ring->lro.lro_active, next); tcp_lro_flush(&ring->lro, queued); } +#endif AVG_PERF_COUNTER(priv->pstats.rx_coal_avg, polled); mlx4_cq_set_ci(&cq->mcq); wmb(); /* ensure HW sees CQ consumer before we post new buffers */ Modified: stable/9/sys/ofed/include/linux/in.h ============================================================================== --- stable/9/sys/ofed/include/linux/in.h Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/include/linux/in.h Mon Aug 27 19:37:02 2012 (r239748) @@ -28,6 +28,8 @@ #ifndef _LINUX_IN_H_ #define _LINUX_IN_H_ +#include "opt_inet.h" + #include #include Modified: stable/9/sys/ofed/include/linux/in6.h ============================================================================== --- stable/9/sys/ofed/include/linux/in6.h Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/include/linux/in6.h Mon Aug 27 19:37:02 2012 (r239748) @@ -29,8 +29,6 @@ #ifndef _LINUX_IN6_H_ #define _LINUX_IN6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #endif /* _LINUX_IN6_H_ */ Modified: stable/9/sys/ofed/include/net/ip.h ============================================================================== --- stable/9/sys/ofed/include/net/ip.h Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/include/net/ip.h Mon Aug 27 19:37:02 2012 (r239748) @@ -29,6 +29,8 @@ #ifndef _LINUX_NET_IP_H_ #define _LINUX_NET_IP_H_ +#include "opt_inet.h" + #include #include @@ -39,6 +41,7 @@ #include #include +#ifdef INET static inline void inet_get_local_port_range(int *low, int *high) { *low = V_ipport_firstauto; @@ -73,5 +76,6 @@ ip_ib_mc_map(uint32_t addr, const unsign buf[18] = (addr >> 8) & 0xff; buf[19] = addr & 0xff; } +#endif #endif /* _LINUX_NET_IP_H_ */ Modified: stable/9/sys/ofed/include/net/ipv6.h ============================================================================== --- stable/9/sys/ofed/include/net/ipv6.h Mon Aug 27 19:30:21 2012 (r239747) +++ stable/9/sys/ofed/include/net/ipv6.h Mon Aug 27 19:37:02 2012 (r239748) @@ -29,9 +29,7 @@ #ifndef _LINUX_NET_IPV6_H_ #define _LINUX_NET_IPV6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #define ipv6_addr_loopback IN6_IS_ADDR_LOOPBACK #define ipv6_addr_copy(dst, src) \ From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 19:55:20 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4EDA91065670; Mon, 27 Aug 2012 19:55:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3849C8FC1C; Mon, 27 Aug 2012 19:55: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 q7RJtKaM048649; Mon, 27 Aug 2012 19:55:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RJtJ4L048642; Mon, 27 Aug 2012 19:55:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208271955.q7RJtJ4L048642@svn.freebsd.org> From: John Baldwin Date: Mon, 27 Aug 2012 19:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239750 - in stable/9: contrib/top usr.bin/top X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 19:55:20 -0000 Author: jhb Date: Mon Aug 27 19:55:19 2012 New Revision: 239750 URL: http://svn.freebsd.org/changeset/base/239750 Log: MFC 237646,237656,238020: - Add a new line to top that provides a brief summary of the ZFS ARC memory usage on hosts using ZFS. The new line displays the total amount of RAM used by the ARC along with the size of MFU, MRU, anonymous (in flight), headers, and other (miscellaneous) sub-categories. The line is not displayed on systems that are not using ZFS. - Clarify that the cached file data pages included in the "Wired" count in top are the BIO-level cached data (i.e. "Buf"), since the previous phrase was a bit ambiguous with the "Cache" count. Modified: stable/9/contrib/top/display.c stable/9/contrib/top/layout.h stable/9/contrib/top/machine.h stable/9/contrib/top/top.c stable/9/usr.bin/top/machine.c stable/9/usr.bin/top/top.local.1 Directory Properties: stable/9/contrib/top/ (props changed) stable/9/contrib/top/install-sh (props changed) stable/9/usr.bin/top/ (props changed) Modified: stable/9/contrib/top/display.c ============================================================================== --- stable/9/contrib/top/display.c Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/contrib/top/display.c Mon Aug 27 19:55:19 2012 (r239750) @@ -66,6 +66,7 @@ char *screenbuf = NULL; static char **procstate_names; static char **cpustate_names; static char **memory_names; +static char **arc_names; static char **swap_names; static int num_procstates; @@ -100,6 +101,8 @@ int x_brkdn = 15; int y_brkdn = 1; int x_mem = 5; int y_mem = 3; +int x_arc = 5; +int y_arc = 4; int x_swap = 6; int y_swap = 4; int y_message = 5; @@ -216,6 +219,8 @@ struct statics *statics; num_memory = string_count(memory_names); lmemory = (int *)malloc(num_memory * sizeof(int)); + arc_names = statics->arc_names; + /* calculate starting columns where needed */ cpustate_total_length = 0; pp = cpustate_names; @@ -627,6 +632,46 @@ int *stats; } /* + * *_arc(stats) - print "ARC: " followed by the ARC summary string + * + * Assumptions: cursor is on "lastline" + * for i_arc ONLY: cursor is on the previous line + */ +char arc_buffer[MAX_COLS]; + +i_arc(stats) + +int *stats; + +{ + if (arc_names == NULL) + return (0); + + fputs("\nARC: ", stdout); + lastline++; + + /* format and print the memory summary */ + summary_format(arc_buffer, stats, arc_names); + fputs(arc_buffer, stdout); +} + +u_arc(stats) + +int *stats; + +{ + static char new[MAX_COLS]; + + if (arc_names == NULL) + return (0); + + /* format the new line */ + summary_format(new, stats, arc_names); + line_update(arc_buffer, new, x_arc, y_arc); +} + + +/* * *_swap(stats) - print "Swap: " followed by the swap summary string * * Assumptions: cursor is on "lastline" Modified: stable/9/contrib/top/layout.h ============================================================================== --- stable/9/contrib/top/layout.h Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/contrib/top/layout.h Mon Aug 27 19:55:19 2012 (r239750) @@ -19,6 +19,8 @@ extern int x_brkdn; /* 15 */ extern int y_brkdn; /* 1 */ extern int x_mem; /* 5 */ extern int y_mem; /* 3 */ +extern int x_arc; /* 5 */ +extern int y_arc; /* 4 */ extern int x_swap; /* 6 */ extern int y_swap; /* 4 */ extern int y_message; /* 5 */ Modified: stable/9/contrib/top/machine.h ============================================================================== --- stable/9/contrib/top/machine.h Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/contrib/top/machine.h Mon Aug 27 19:55:19 2012 (r239750) @@ -16,6 +16,7 @@ struct statics char **procstate_names; char **cpustate_names; char **memory_names; + char **arc_names; char **swap_names; #ifdef ORDER char **order_names; @@ -42,6 +43,7 @@ struct system_info int *procstates; int *cpustates; int *memory; + int *arc; int *swap; struct timeval boottime; int ncpus; Modified: stable/9/contrib/top/top.c ============================================================================== --- stable/9/contrib/top/top.c Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/contrib/top/top.c Mon Aug 27 19:55:19 2012 (r239750) @@ -121,6 +121,8 @@ int i_cpustates(); int u_cpustates(); int i_memory(); int u_memory(); +int i_arc(); +int u_arc(); int i_swap(); int u_swap(); int i_message(); @@ -135,6 +137,7 @@ int (*d_loadave)() = i_loadave; int (*d_procstates)() = i_procstates; int (*d_cpustates)() = i_cpustates; int (*d_memory)() = i_memory; +int (*d_arc)() = i_arc; int (*d_swap)() = i_swap; int (*d_message)() = i_message; int (*d_header)() = i_header; @@ -647,6 +650,7 @@ restart: /* display memory stats */ (*d_memory)(system_info.memory); + (*d_arc)(system_info.arc); /* display swap stats */ (*d_swap)(system_info.swap); @@ -712,6 +716,7 @@ restart: d_procstates = u_procstates; d_cpustates = u_cpustates; d_memory = u_memory; + d_arc = u_arc; d_swap = u_swap; d_message = u_message; d_header = u_header; @@ -1129,6 +1134,7 @@ reset_display() d_procstates = i_procstates; d_cpustates = i_cpustates; d_memory = i_memory; + d_arc = i_arc; d_swap = i_swap; d_message = i_message; d_header = i_header; Modified: stable/9/usr.bin/top/machine.c ============================================================================== --- stable/9/usr.bin/top/machine.c Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/usr.bin/top/machine.c Mon Aug 27 19:55:19 2012 (r239750) @@ -176,6 +176,12 @@ char *memorynames[] = { "K Free", NULL }; +int arc_stats[7]; +char *arcnames[] = { + "K Total, ", "K MRU, ", "K MFU, ", "K Anon, ", "K Header, ", "K Other", + NULL +}; + int swap_stats[7]; char *swapnames[] = { "K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out", @@ -194,6 +200,7 @@ static struct kinfo_proc *previous_procs static struct kinfo_proc **previous_pref; static int previous_proc_count = 0; static int previous_proc_count_max = 0; +static int arc_enabled; /* total number of io operations */ static long total_inblock; @@ -239,6 +246,7 @@ static int compare_tid(const void *a, co static const char *format_nice(const struct kinfo_proc *pp); static void getsysctl(const char *name, void *ptr, size_t len); static int swapmode(int *retavail, int *retfree); +static void update_layout(void); void toggle_pcpustats(void) @@ -246,24 +254,32 @@ toggle_pcpustats(void) if (ncpus == 1) return; + update_layout(); +} + +/* Adjust display based on ncpus and the ARC state. */ +static void +update_layout(void) +{ + + y_mem = 3; + y_arc = 4; + y_swap = 4 + arc_enabled; + y_idlecursor = 5 + arc_enabled; + y_message = 5 + arc_enabled; + y_header = 6 + arc_enabled; + y_procs = 7 + arc_enabled; + Header_lines = 7 + arc_enabled; - /* Adjust display based on ncpus */ if (pcpu_stats) { - y_mem += ncpus - 1; /* 3 */ - y_swap += ncpus - 1; /* 4 */ - y_idlecursor += ncpus - 1; /* 5 */ - y_message += ncpus - 1; /* 5 */ - y_header += ncpus - 1; /* 6 */ - y_procs += ncpus - 1; /* 7 */ - Header_lines += ncpus - 1; /* 7 */ - } else { - y_mem = 3; - y_swap = 4; - y_idlecursor = 5; - y_message = 5; - y_header = 6; - y_procs = 7; - Header_lines = 7; + y_mem += ncpus - 1; + y_arc += ncpus - 1; + y_swap += ncpus - 1; + y_idlecursor += ncpus - 1; + y_message += ncpus - 1; + y_header += ncpus - 1; + y_procs += ncpus - 1; + Header_lines += ncpus - 1; } } @@ -271,6 +287,7 @@ int machine_init(struct statics *statics, char do_unames) { int i, j, empty, pagesize; + uint64_t arc_size; size_t size; struct passwd *pw; @@ -282,6 +299,11 @@ machine_init(struct statics *statics, ch size != sizeof(smpmode)) smpmode = 0; + size = sizeof(arc_size); + if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arc_size, &size, + NULL, 0) == 0 && arc_size != 0) + arc_enabled = 1; + if (do_unames) { while ((pw = getpwent()) != NULL) { if (strlen(pw->pw_name) > namelength) @@ -322,6 +344,10 @@ machine_init(struct statics *statics, ch statics->procstate_names = procstatenames; statics->cpustate_names = cpustatenames; statics->memory_names = memorynames; + if (arc_enabled) + statics->arc_names = arcnames; + else + statics->arc_names = NULL; statics->swap_names = swapnames; #ifdef ORDER statics->order_names = ordernames; @@ -356,8 +382,7 @@ machine_init(struct statics *statics, ch pcpu_cpu_states = calloc(1, size); statics->ncpus = ncpus; - if (pcpu_stats) - toggle_pcpustats(); + update_layout(); /* all done! */ return (0); @@ -408,7 +433,7 @@ get_system_info(struct system_info *si) struct loadavg sysload; int mib[2]; struct timeval boottime; - size_t bt_size; + uint64_t arc_stat, arc_stat2; int i, j; size_t size; @@ -487,6 +512,23 @@ get_system_info(struct system_info *si) swap_stats[6] = -1; } + if (arc_enabled) { + GETSYSCTL("kstat.zfs.misc.arcstats.size", arc_stat); + arc_stats[0] = arc_stat >> 10; + GETSYSCTL("vfs.zfs.mfu_size", arc_stat); + arc_stats[1] = arc_stat >> 10; + GETSYSCTL("vfs.zfs.mru_size", arc_stat); + arc_stats[2] = arc_stat >> 10; + GETSYSCTL("vfs.zfs.anon_size", arc_stat); + arc_stats[3] = arc_stat >> 10; + GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc_stat); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc_stat2); + arc_stats[4] = arc_stat + arc_stat2 >> 10; + GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc_stat); + arc_stats[5] = arc_stat >> 10; + si->arc = arc_stats; + } + /* set arrays and strings */ if (pcpu_stats) { si->cpustates = pcpu_cpu_states; @@ -511,8 +553,8 @@ get_system_info(struct system_info *si) */ mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; - bt_size = sizeof(boottime); - if (sysctl(mib, 2, &boottime, &bt_size, NULL, 0) != -1 && + size = sizeof(boottime); + if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && boottime.tv_sec != 0) { si->boottime = boottime; } else { Modified: stable/9/usr.bin/top/top.local.1 ============================================================================== --- stable/9/usr.bin/top/top.local.1 Mon Aug 27 19:52:55 2012 (r239749) +++ stable/9/usr.bin/top/top.local.1 Mon Aug 27 19:55:19 2012 (r239750) @@ -3,6 +3,7 @@ .SH DESCRIPTION OF MEMORY Mem: 9220K Active, 1M Inact, 3284K Wired, 1M Cache, 2M Buf, 1320K Free +ARC: 2048K Total, 342K MRU, 760K MFU, 272K Anon, 232K Header, 442K Other Swap: 91M Total, 79M Free, 13% Inuse, 80K In, 104K Out .TP .B K: @@ -16,6 +17,7 @@ Gigabyte .TP .B %: 1/100 +.SS Physical Memory Stats .TP .B Active: number of bytes active @@ -24,7 +26,7 @@ number of bytes active number of bytes inactive .TP .B Wired: -number of bytes wired down, including cached file data pages +number of bytes wired down, including BIO-level cached file data pages .TP .B Cache: number of clean bytes caching data that are available for @@ -35,6 +37,27 @@ number of bytes used for BIO-level disk .TP .B Free: number of bytes free +.SS ZFS ARC Stats +These stats are only displayed when the ARC is in use. +.TP +.B Total: +number of wired bytes used for the ZFS ARC +.TP +.B MRU: +number of ARC bytes holding most recently used data +.TP +.B MFU: +number of ARC bytes holding most frequently used data +.TP +.B Anon: +number of ARC bytes holding in flight data +.TP +.B Header: +number of ARC bytes holding headers +.TP +.B Other +miscellaneous ARC bytes +.SS Swap Stats .TP .B Total: total available swap usage From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 20:23:04 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CAE51065674; Mon, 27 Aug 2012 20:23:04 +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 580D98FC0C; Mon, 27 Aug 2012 20:23:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7RKN4l2051961; Mon, 27 Aug 2012 20:23:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RKN4tb051959; Mon, 27 Aug 2012 20:23:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208272023.q7RKN4tb051959@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 27 Aug 2012 20:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239754 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 20:23:04 -0000 Author: kib Date: Mon Aug 27 20:23:03 2012 New Revision: 239754 URL: http://svn.freebsd.org/changeset/base/239754 Log: MFC r239374: Deliver SIGSYS to the guilty thread, not to the process. Modified: stable/9/sys/kern/kern_sig.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_sig.c ============================================================================== --- stable/9/sys/kern/kern_sig.c Mon Aug 27 20:10:38 2012 (r239753) +++ stable/9/sys/kern/kern_sig.c Mon Aug 27 20:23:03 2012 (r239754) @@ -3313,7 +3313,7 @@ nosys(td, args) struct proc *p = td->td_proc; PROC_LOCK(p); - kern_psignal(p, SIGSYS); + tdsignal(td, SIGSYS); PROC_UNLOCK(p); return (ENOSYS); } From owner-svn-src-stable-9@FreeBSD.ORG Mon Aug 27 20:25:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F9DA106564A; Mon, 27 Aug 2012 20:25:27 +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 6A5788FC19; Mon, 27 Aug 2012 20:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7RKPRsw052278; Mon, 27 Aug 2012 20:25:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RKPRMJ052276; Mon, 27 Aug 2012 20:25:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208272025.q7RKPRMJ052276@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 27 Aug 2012 20:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239755 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 20:25:27 -0000 Author: kib Date: Mon Aug 27 20:25:26 2012 New Revision: 239755 URL: http://svn.freebsd.org/changeset/base/239755 Log: MFC r239588: Provide some compat32 shims for sysctl vfs.conflist. It is required for getvfsbyname(3) operation when called from 32bit process, and getvfsbyname(3) is used by recent bsdtar import. Modified: stable/9/sys/kern/vfs_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Mon Aug 27 20:23:03 2012 (r239754) +++ stable/9/sys/kern/vfs_subr.c Mon Aug 27 20:25:26 2012 (r239755) @@ -41,6 +41,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_ddb.h" #include "opt_watchdog.h" @@ -3110,22 +3111,50 @@ DB_SHOW_COMMAND(mount, db_show_mount) /* * Fill in a struct xvfsconf based on a struct vfsconf. */ -static void -vfsconf2x(struct vfsconf *vfsp, struct xvfsconf *xvfsp) +static int +vfsconf2x(struct sysctl_req *req, struct vfsconf *vfsp) { + struct xvfsconf xvfsp; - strcpy(xvfsp->vfc_name, vfsp->vfc_name); - xvfsp->vfc_typenum = vfsp->vfc_typenum; - xvfsp->vfc_refcount = vfsp->vfc_refcount; - xvfsp->vfc_flags = vfsp->vfc_flags; + bzero(&xvfsp, sizeof(xvfsp)); + strcpy(xvfsp.vfc_name, vfsp->vfc_name); + xvfsp.vfc_typenum = vfsp->vfc_typenum; + xvfsp.vfc_refcount = vfsp->vfc_refcount; + xvfsp.vfc_flags = vfsp->vfc_flags; /* * These are unused in userland, we keep them * to not break binary compatibility. */ - xvfsp->vfc_vfsops = NULL; - xvfsp->vfc_next = NULL; + xvfsp.vfc_vfsops = NULL; + xvfsp.vfc_next = NULL; + return (SYSCTL_OUT(req, &xvfsp, sizeof(xvfsp))); } +#ifdef COMPAT_FREEBSD32 +struct xvfsconf32 { + uint32_t vfc_vfsops; + char vfc_name[MFSNAMELEN]; + int32_t vfc_typenum; + int32_t vfc_refcount; + int32_t vfc_flags; + uint32_t vfc_next; +}; + +static int +vfsconf2x32(struct sysctl_req *req, struct vfsconf *vfsp) +{ + struct xvfsconf32 xvfsp; + + strcpy(xvfsp.vfc_name, vfsp->vfc_name); + xvfsp.vfc_typenum = vfsp->vfc_typenum; + xvfsp.vfc_refcount = vfsp->vfc_refcount; + xvfsp.vfc_flags = vfsp->vfc_flags; + xvfsp.vfc_vfsops = 0; + xvfsp.vfc_next = 0; + return (SYSCTL_OUT(req, &xvfsp, sizeof(xvfsp))); +} +#endif + /* * Top level filesystem related information gathering. */ @@ -3133,14 +3162,16 @@ static int sysctl_vfs_conflist(SYSCTL_HANDLER_ARGS) { struct vfsconf *vfsp; - struct xvfsconf xvfsp; int error; error = 0; TAILQ_FOREACH(vfsp, &vfsconf, vfc_list) { - bzero(&xvfsp, sizeof(xvfsp)); - vfsconf2x(vfsp, &xvfsp); - error = SYSCTL_OUT(req, &xvfsp, sizeof xvfsp); +#ifdef COMPAT_FREEBSD32 + if (req->flags & SCTL_MASK32) + error = vfsconf2x32(req, vfsp); + else +#endif + error = vfsconf2x(req, vfsp); if (error) break; } @@ -3160,7 +3191,6 @@ vfs_sysctl(SYSCTL_HANDLER_ARGS) int *name = (int *)arg1 - 1; /* XXX */ u_int namelen = arg2 + 1; /* XXX */ struct vfsconf *vfsp; - struct xvfsconf xvfsp; printf("WARNING: userland calling deprecated sysctl, " "please rebuild world\n"); @@ -3184,9 +3214,12 @@ vfs_sysctl(SYSCTL_HANDLER_ARGS) break; if (vfsp == NULL) return (EOPNOTSUPP); - bzero(&xvfsp, sizeof(xvfsp)); - vfsconf2x(vfsp, &xvfsp); - return (SYSCTL_OUT(req, &xvfsp, sizeof(xvfsp))); +#ifdef COMPAT_FREEBSD32 + if (req->flags & SCTL_MASK32) + return (vfsconf2x32(req, vfsp)); + else +#endif + return (vfsconf2x(req, vfsp)); } return (EOPNOTSUPP); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 06:47:22 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83451106566C; Tue, 28 Aug 2012 06:47:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DC288FC15; Tue, 28 Aug 2012 06:47:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7S6lMMo025459; Tue, 28 Aug 2012 06:47:22 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7S6lMoK025457; Tue, 28 Aug 2012 06:47:22 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208280647.q7S6lMoK025457@svn.freebsd.org> From: Dimitry Andric Date: Tue, 28 Aug 2012 06:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239766 - stable/9/usr.bin/clang/clang X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 06:47:22 -0000 Author: dim Date: Tue Aug 28 06:47:21 2012 New Revision: 239766 URL: http://svn.freebsd.org/changeset/base/239766 Log: MFC r239509: Support the WITH_SHARED_TOOLCHAIN setting that was introduced in r234782 for the clang executable. Build it statically by default, like the gcc executables, which should improve performance a little bit. Modified: stable/9/usr.bin/clang/clang/Makefile Directory Properties: stable/9/usr.bin/clang/ (props changed) Modified: stable/9/usr.bin/clang/clang/Makefile ============================================================================== --- stable/9/usr.bin/clang/clang/Makefile Tue Aug 28 06:17:44 2012 (r239765) +++ stable/9/usr.bin/clang/clang/Makefile Tue Aug 28 06:47:21 2012 (r239766) @@ -9,6 +9,10 @@ SRCS= cc1_main.cpp \ cc1as_main.cpp \ driver.cpp +.if ${MK_SHARED_TOOLCHAIN} == "no" +NO_SHARED?= yes +.endif + LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \ ${BINDIR}/clang ${BINDIR}/clang-cpp MLINKS= clang.1 clang++.1 \ From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 06:49:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE61F106564A; Tue, 28 Aug 2012 06:49:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98E4D8FC19; Tue, 28 Aug 2012 06:49:33 +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 q7S6nXPM025749; Tue, 28 Aug 2012 06:49:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7S6nXOp025747; Tue, 28 Aug 2012 06:49:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208280649.q7S6nXOp025747@svn.freebsd.org> From: Dimitry Andric Date: Tue, 28 Aug 2012 06:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239767 - stable/9/usr.bin/clang X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 06:49:33 -0000 Author: dim Date: Tue Aug 28 06:49:33 2012 New Revision: 239767 URL: http://svn.freebsd.org/changeset/base/239767 Log: MFC r239513: When WITH_CLANG_EXTRAS is enabled, avoid needlessly building the llvm and clang extras in the cross-tools stage. Modified: stable/9/usr.bin/clang/Makefile Directory Properties: stable/9/usr.bin/clang/ (props changed) Modified: stable/9/usr.bin/clang/Makefile ============================================================================== --- stable/9/usr.bin/clang/Makefile Tue Aug 28 06:47:21 2012 (r239766) +++ stable/9/usr.bin/clang/Makefile Tue Aug 28 06:49:33 2012 (r239767) @@ -4,7 +4,7 @@ SUBDIR= clang clang-tblgen tblgen -.if ${MK_CLANG_EXTRAS} != "no" +.if ${MK_CLANG_EXTRAS} != "no" && !defined(TOOLS_PREFIX) SUBDIR+=bugpoint \ llc \ lli \ From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 12:56:24 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B7D106564A; Tue, 28 Aug 2012 12:56:24 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84A128FC14; Tue, 28 Aug 2012 12:56: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 q7SCuO1t070742; Tue, 28 Aug 2012 12:56:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SCuO96070740; Tue, 28 Aug 2012 12:56:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201208281256.q7SCuO96070740@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 28 Aug 2012 12:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239776 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 12:56:24 -0000 Author: bz Date: Tue Aug 28 12:56:23 2012 New Revision: 239776 URL: http://svn.freebsd.org/changeset/base/239776 Log: MFC r238877: Fix a comment that we do not have an SA yet but need to acquire one. Modified: stable/9/sys/netinet6/ip6_ipsec.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_ipsec.c ============================================================================== --- stable/9/sys/netinet6/ip6_ipsec.c Tue Aug 28 12:33:54 2012 (r239775) +++ stable/9/sys/netinet6/ip6_ipsec.c Tue Aug 28 12:56:23 2012 (r239776) @@ -263,7 +263,7 @@ ip6_ipsec_output(struct mbuf **m, struct mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED) continue; /* - * Check if policy has an SA associated with it. + * Check if policy has no SA associated with it. * This can happen when an SP has yet to acquire * an SA; e.g. on first reference. If it occurs, * then we let ipsec4_process_packet do its thing. From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 15:45:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CBE1A1065677; Tue, 28 Aug 2012 15:45:37 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B75AC8FC22; Tue, 28 Aug 2012 15:45: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 q7SFjb5V090070; Tue, 28 Aug 2012 15:45:37 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SFjbYh090068; Tue, 28 Aug 2012 15:45:37 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201208281545.q7SFjbYh090068@svn.freebsd.org> From: Devin Teske Date: Tue, 28 Aug 2012 15:45:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239782 - stable/9/usr.sbin/bsdinstall X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 15:45:37 -0000 Author: dteske Date: Tue Aug 28 15:45:37 2012 New Revision: 239782 URL: http://svn.freebsd.org/changeset/base/239782 Log: MFC r239500: Fix "unexpected operator" error when passed multi-word first-argument containing whitespace. Also make other changes to support multi-word arguments. PR: bin/170759 Submitted by: dteske Reviewed by: emaste (mentor) Approved by: emaste (mentor) Modified: stable/9/usr.sbin/bsdinstall/bsdinstall Modified: stable/9/usr.sbin/bsdinstall/bsdinstall ============================================================================== --- stable/9/usr.sbin/bsdinstall/bsdinstall Tue Aug 28 14:20:41 2012 (r239781) +++ stable/9/usr.sbin/bsdinstall/bsdinstall Tue Aug 28 15:45:37 2012 (r239782) @@ -34,11 +34,10 @@ VERB=$1; shift -if [ -z $VERB ]; then +if [ -z "$VERB" ]; then VERB=auto fi test -d "$BSDINSTALL_TMPETC" || mkdir "$BSDINSTALL_TMPETC" -echo Running installation step: $VERB $@ >> "$BSDINSTALL_LOG" -exec /usr/libexec/bsdinstall/$VERB $@ 2>>"$BSDINSTALL_LOG" - +echo "Running installation step: $VERB $@" >> "$BSDINSTALL_LOG" +exec "/usr/libexec/bsdinstall/$VERB" "$@" 2>>"$BSDINSTALL_LOG" From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 17:08:48 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 291631065676; Tue, 28 Aug 2012 17:08:48 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE1AE8FC14; Tue, 28 Aug 2012 17:08: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 q7SH8lBk099599; Tue, 28 Aug 2012 17:08:47 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SH8l3Z099596; Tue, 28 Aug 2012 17:08:47 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201208281708.q7SH8l3Z099596@svn.freebsd.org> From: Max Khon Date: Tue, 28 Aug 2012 17:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239783 - stable/9/sys/dev/puc X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 17:08:48 -0000 Author: fjoe Date: Tue Aug 28 17:08:47 2012 New Revision: 239783 URL: http://svn.freebsd.org/changeset/base/239783 Log: MFC: r238933 - Change back "d_ofs" to int8_t to not pessimize padding and size of "struct puc_cfg". - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f Approved by: re (kib) Modified: stable/9/sys/dev/puc/puc_cfg.h stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/puc/puc_cfg.h ============================================================================== --- stable/9/sys/dev/puc/puc_cfg.h Tue Aug 28 15:45:37 2012 (r239782) +++ stable/9/sys/dev/puc/puc_cfg.h Tue Aug 28 17:08:47 2012 (r239783) @@ -79,7 +79,7 @@ struct puc_cfg { int8_t ports; int8_t rid; /* Rid of first port */ int8_t d_rid; /* Delta rid of next ports */ - int16_t d_ofs; /* Delta offset of next ports */ + int8_t d_ofs; /* Delta offset of next ports */ puc_config_f *config_function; }; Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Tue Aug 28 15:45:37 2012 (r239782) +++ stable/9/sys/dev/puc/pucdata.c Tue Aug 28 17:08:47 2012 (r239783) @@ -510,13 +510,15 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1024, 0xffff, 0, "Moxa Technologies, Smartio CP-102E/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x14, 0, 0x200 + PUC_PORT_2S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1025, 0xffff, 0, "Moxa Technologies, Smartio CP-102EL/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x14, 0, 0x200, + PUC_PORT_2S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1040, 0xffff, 0, @@ -572,7 +574,8 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1182, 0xffff, 0, "Moxa Technologies, Smartio CP-118EL-A/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_8S, 0x14, 0, 0x200, + PUC_PORT_8S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1680, 0xffff, 0, @@ -596,7 +599,8 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1683, 0xffff, 0, "Moxa Technologies, Smartio CP-168EL-A/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_8S, 0x14, 0, 0x200, + PUC_PORT_8S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x13a8, 0x0152, 0xffff, 0, @@ -1153,7 +1157,12 @@ puc_config_moxa(struct puc_softc *sc, en intptr_t *res) { if (cmd == PUC_CFG_GET_OFS) { - *res = ((port == 3) ? 7 : port) * 0x200; + const struct puc_cfg *cfg = sc->sc_cfg; + + if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144)) + port = 7; + *res = port * 0x200; + return 0; } return (ENXIO); From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 18:44:56 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BFA33106566B; Tue, 28 Aug 2012 18:44:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8ADC8FC0A; Tue, 28 Aug 2012 18:44: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 q7SIiuDC010948; Tue, 28 Aug 2012 18:44:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SIiu6e010943; Tue, 28 Aug 2012 18:44:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208281844.q7SIiu6e010943@svn.freebsd.org> From: John Baldwin Date: Tue, 28 Aug 2012 18:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239787 - in stable/9: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 18:44:56 -0000 Author: jhb Date: Tue Aug 28 18:44:56 2012 New Revision: 239787 URL: http://svn.freebsd.org/changeset/base/239787 Log: MFC 230782,237274: Refine the implementation of POSIX_FADV_NOREUSE to perform POSIX_FADV_DONTNEED requests on the currently accessed portion of the file on each read(2) or write(2) rather than using direct I/O. This gives much better performance including read-ahead and write clustering similar to normal read(2) and write(2) calls. If subsequent read(2) and write(2) calls are sequential, then the POSIX_FADV_DONTNEED requests will cover the entire sequentially-accessed range. Modified: stable/9/lib/libc/sys/posix_fadvise.2 stable/9/sys/kern/vfs_syscalls.c stable/9/sys/kern/vfs_vnops.c stable/9/sys/sys/file.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/lib/libc/uuid/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/lib/libc/sys/posix_fadvise.2 ============================================================================== --- stable/9/lib/libc/sys/posix_fadvise.2 Tue Aug 28 18:33:12 2012 (r239786) +++ stable/9/lib/libc/sys/posix_fadvise.2 Tue Aug 28 18:44:56 2012 (r239787) @@ -28,7 +28,7 @@ .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd February 25, 2012 +.Dd June 19, 2012 .Dt POSIX_FADVISE 2 .Os .Sh NAME @@ -84,10 +84,9 @@ specified range and future access to thi .It Dv POSIX_FADV_NOREUSE Tells the system that the specified data will only be accessed once and then not reused. -Accesses to data within the specified range are treated as if the file -descriptor has the -.Dv O_DIRECT -flag enabled. +The system may decrease the in-memory priority of data once it has been +read or written. +Future access to this data may require a read operation. .El .Pp .Sh RETURN VALUES Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Tue Aug 28 18:33:12 2012 (r239786) +++ stable/9/sys/kern/vfs_syscalls.c Tue Aug 28 18:44:56 2012 (r239787) @@ -4953,6 +4953,8 @@ kern_posix_fadvise(struct thread *td, in new->fa_advice = advice; new->fa_start = offset; new->fa_end = end; + new->fa_prevstart = 0; + new->fa_prevend = 0; fp->f_advice = new; new = fa; } Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Tue Aug 28 18:33:12 2012 (r239786) +++ stable/9/sys/kern/vfs_vnops.c Tue Aug 28 18:44:56 2012 (r239787) @@ -519,6 +519,7 @@ vn_read(fp, uio, active_cred, flags, td) int error, ioflag; struct mtx *mtxp; int advice, vfslocked; + off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -558,19 +559,14 @@ vn_read(fp, uio, active_cred, flags, td) switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_NOREUSE: ioflag |= sequential_heuristic(uio, fp); break; case POSIX_FADV_RANDOM: /* Disable read-ahead for random I/O. */ break; - case POSIX_FADV_NOREUSE: - /* - * Request the underlying FS to discard the buffers - * and pages after the I/O is complete. - */ - ioflag |= IO_DIRECT; - break; } + offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -587,6 +583,39 @@ vn_read(fp, uio, active_cred, flags, td) } fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); + if (error == 0 && advice == POSIX_FADV_NOREUSE && + offset != uio->uio_offset) { + /* + * Use POSIX_FADV_DONTNEED to flush clean pages and + * buffers for the backing file after a + * POSIX_FADV_NOREUSE read(2). To optimize the common + * case of using POSIX_FADV_NOREUSE with sequential + * access, track the previous implicit DONTNEED + * request and grow this request to include the + * current read(2) in addition to the previous + * DONTNEED. With purely sequential access this will + * cause the DONTNEED requests to continously grow to + * cover all of the previously read regions of the + * file. This allows filesystem blocks that are + * accessed by multiple calls to read(2) to be flushed + * once the last read(2) finishes. + */ + start = offset; + end = uio->uio_offset - 1; + mtx_lock(mtxp); + if (fp->f_advice != NULL && + fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { + if (start != 0 && fp->f_advice->fa_prevend + 1 == start) + start = fp->f_advice->fa_prevstart; + else if (fp->f_advice->fa_prevstart != 0 && + fp->f_advice->fa_prevstart == end + 1) + end = fp->f_advice->fa_prevend; + fp->f_advice->fa_prevstart = start; + fp->f_advice->fa_prevend = end; + } + mtx_unlock(mtxp); + error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); + } VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -607,6 +636,7 @@ vn_write(fp, uio, active_cred, flags, td int error, ioflag, lock_flags; struct mtx *mtxp; int advice, vfslocked; + off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -641,6 +671,7 @@ vn_write(fp, uio, active_cred, flags, td if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; advice = POSIX_FADV_NORMAL; + mtxp = NULL; if (fp->f_advice != NULL) { mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); @@ -653,19 +684,14 @@ vn_write(fp, uio, active_cred, flags, td switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_NOREUSE: ioflag |= sequential_heuristic(uio, fp); break; case POSIX_FADV_RANDOM: /* XXX: Is this correct? */ break; - case POSIX_FADV_NOREUSE: - /* - * Request the underlying FS to discard the buffers - * and pages after the I/O is complete. - */ - ioflag |= IO_DIRECT; - break; } + offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); @@ -678,6 +704,55 @@ vn_write(fp, uio, active_cred, flags, td VOP_UNLOCK(vp, 0); if (vp->v_type != VCHR) vn_finished_write(mp); + if (error == 0 && advice == POSIX_FADV_NOREUSE && + offset != uio->uio_offset) { + /* + * Use POSIX_FADV_DONTNEED to flush clean pages and + * buffers for the backing file after a + * POSIX_FADV_NOREUSE write(2). To optimize the + * common case of using POSIX_FADV_NOREUSE with + * sequential access, track the previous implicit + * DONTNEED request and grow this request to include + * the current write(2) in addition to the previous + * DONTNEED. With purely sequential access this will + * cause the DONTNEED requests to continously grow to + * cover all of the previously written regions of the + * file. + * + * Note that the blocks just written are almost + * certainly still dirty, so this only works when + * VOP_ADVISE() calls from subsequent writes push out + * the data written by this write(2) once the backing + * buffers are clean. However, as compared to forcing + * IO_DIRECT, this gives much saner behavior. Write + * clustering is still allowed, and clean pages are + * merely moved to the cache page queue rather than + * outright thrown away. This means a subsequent + * read(2) can still avoid hitting the disk if the + * pages have not been reclaimed. + * + * This does make POSIX_FADV_NOREUSE largely useless + * with non-sequential access. However, sequential + * access is the more common use case and the flag is + * merely advisory. + */ + start = offset; + end = uio->uio_offset - 1; + mtx_lock(mtxp); + if (fp->f_advice != NULL && + fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { + if (start != 0 && fp->f_advice->fa_prevend + 1 == start) + start = fp->f_advice->fa_prevstart; + else if (fp->f_advice->fa_prevstart != 0 && + fp->f_advice->fa_prevstart == end + 1) + end = fp->f_advice->fa_prevend; + fp->f_advice->fa_prevstart = start; + fp->f_advice->fa_prevend = end; + } + mtx_unlock(mtxp); + error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); + } + unlock: VFS_UNLOCK_GIANT(vfslocked); return (error); Modified: stable/9/sys/sys/file.h ============================================================================== --- stable/9/sys/sys/file.h Tue Aug 28 18:33:12 2012 (r239786) +++ stable/9/sys/sys/file.h Tue Aug 28 18:44:56 2012 (r239787) @@ -126,6 +126,8 @@ struct fadvise_info { int fa_advice; /* (f) FADV_* type. */ off_t fa_start; /* (f) Region start. */ off_t fa_end; /* (f) Region end. */ + off_t fa_prevstart; /* (f) Previous NOREUSE start. */ + off_t fa_prevend; /* (f) Previous NOREUSE end. */ }; struct file { From owner-svn-src-stable-9@FreeBSD.ORG Tue Aug 28 19:23:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C322106566C; Tue, 28 Aug 2012 19:23:05 +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 EA8A88FC16; Tue, 28 Aug 2012 19:23:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7SJN4pD017486; Tue, 28 Aug 2012 19:23:04 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7SJN4XW017484; Tue, 28 Aug 2012 19:23:04 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201208281923.q7SJN4XW017484@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 28 Aug 2012 19:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239789 - stable/9/sys/vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2012 19:23:05 -0000 Author: pluknet Date: Tue Aug 28 19:23:04 2012 New Revision: 239789 URL: http://svn.freebsd.org/changeset/base/239789 Log: MFC r239723: Typo in previous change: print half the theoretical maximum as maximum recommended amount. Modified: stable/9/sys/vm/swap_pager.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/swap_pager.c ============================================================================== --- stable/9/sys/vm/swap_pager.c Tue Aug 28 18:45:20 2012 (r239788) +++ stable/9/sys/vm/swap_pager.c Tue Aug 28 19:23:04 2012 (r239789) @@ -2135,7 +2135,7 @@ swapon_check_swzone(unsigned long npages if (npages > maxpages / 2) { printf("warning: total configured swap (%lu pages) " "exceeds maximum recommended amount (%lu pages).\n", - npages, maxpages); + npages, maxpages / 2); printf("warning: increase kern.maxswzone " "or reduce amount of swap.\n"); return (-1); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 01:04:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B306106564A; Wed, 29 Aug 2012 01:04:13 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFC268FC08; Wed, 29 Aug 2012 01:04:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7T14Cke057370; Wed, 29 Aug 2012 01:04:12 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T14CcR057368; Wed, 29 Aug 2012 01:04:12 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208290104.q7T14CcR057368@svn.freebsd.org> From: Jim Harris Date: Wed, 29 Aug 2012 01:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239798 - stable/9/sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 01:04:13 -0000 Author: jimharris Date: Wed Aug 29 01:04:12 2012 New Revision: 239798 URL: http://svn.freebsd.org/changeset/base/239798 Log: MFC r239591: Remove unncessary atomic operation when reading process flags in PMC_PROC_IS_USING_PMCS macro. Invocations of this macro are not synchronized with setting/clearing of P_HWPMC flag, so the atomic operation here isn't needed. Removing the atomic operation provides noticeable improvement (5-6%) on some scheduler-intensive workloads with HWPMC_HOOKS enabled on an 8C Sandy Bridge Xeon system. Sponsored by: Intel Modified: stable/9/sys/sys/pmckern.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/pmckern.h ============================================================================== --- stable/9/sys/sys/pmckern.h Wed Aug 29 00:53:58 2012 (r239797) +++ stable/9/sys/sys/pmckern.h Wed Aug 29 01:04:12 2012 (r239798) @@ -201,8 +201,7 @@ do { \ /* Check if a process is using HWPMCs.*/ #define PMC_PROC_IS_USING_PMCS(p) \ - (__predict_false(atomic_load_acq_int(&(p)->p_flag) & \ - P_HWPMC)) + (__predict_false(p->p_flag & P_HWPMC)) /* Check if a thread have pending user capture. */ #define PMC_IS_PENDING_CALLCHAIN(p) \ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 08:14:17 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F2D44106567C; Wed, 29 Aug 2012 08:14:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D69BA8FC23; Wed, 29 Aug 2012 08:14:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7T8EGh8010207; Wed, 29 Aug 2012 08:14:16 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T8EGFX010205; Wed, 29 Aug 2012 08:14:16 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201208290814.q7T8EGFX010205@svn.freebsd.org> From: Andriy Gapon Date: Wed, 29 Aug 2012 08:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239807 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 08:14:17 -0000 Author: avg Date: Wed Aug 29 08:14:16 2012 New Revision: 239807 URL: http://svn.freebsd.org/changeset/base/239807 Log: MFC r238418: acpi_cpu: separate a notion of current deepest allowed+available Cx level from a user-set persistent limit on the said level Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 06:43:28 2012 (r239806) +++ stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:14:16 2012 (r239807) @@ -89,6 +89,7 @@ struct acpi_cpu_softc { struct sysctl_ctx_list cpu_sysctl_ctx; struct sysctl_oid *cpu_sysctl_tree; int cpu_cx_lowest; + int cpu_cx_lowest_lim; char cpu_cx_supported[64]; int cpu_rid; }; @@ -138,13 +139,12 @@ static int cpu_quirks; /* Indicate any /* Runtime state. */ static int cpu_disable_idle; /* Disable entry to idle function */ -static int cpu_cx_count; /* Number of valid Cx states */ /* Values for sysctl. */ static struct sysctl_ctx_list cpu_sysctl_ctx; static struct sysctl_oid *cpu_sysctl_tree; static int cpu_cx_generic; -static int cpu_cx_lowest; +static int cpu_cx_lowest_lim; static device_t *cpu_devices; static int cpu_ndevices; @@ -173,7 +173,7 @@ static void acpi_cpu_idle(void); static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context); static int acpi_cpu_quirks(void); static int acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS); -static int acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc, int val); +static int acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc); static int acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS); static int acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS); @@ -590,6 +590,7 @@ acpi_cpu_cx_probe(struct acpi_cpu_softc /* Use initial sleep value of 1 sec. to start with lowest idle state. */ sc->cpu_prev_sleep = 1000000; sc->cpu_cx_lowest = 0; + sc->cpu_cx_lowest_lim = 0; /* * Check for the ACPI 2.0 _CST sleep states object. If we can't find @@ -816,7 +817,6 @@ acpi_cpu_startup(void *arg) */ acpi_cpu_quirks(); - cpu_cx_count = 0; if (cpu_cx_generic) { /* * We are using generic Cx mode, probe for available Cx states @@ -825,24 +825,10 @@ acpi_cpu_startup(void *arg) for (i = 0; i < cpu_ndevices; i++) { sc = device_get_softc(cpu_devices[i]); acpi_cpu_generic_cx_probe(sc); - if (sc->cpu_cx_count > cpu_cx_count) - cpu_cx_count = sc->cpu_cx_count; - } - - /* - * Find the highest Cx state common to all CPUs - * in the system, taking quirks into account. - */ - for (i = 0; i < cpu_ndevices; i++) { - sc = device_get_softc(cpu_devices[i]); - if (sc->cpu_cx_count < cpu_cx_count) - cpu_cx_count = sc->cpu_cx_count; } } else { /* * We are using _CST mode, remove C3 state if necessary. - * Update the largest Cx state supported in the global cpu_cx_count. - * It will be used in the global Cx sysctl handler. * As we now know for sure that we will be using _CST mode * install our notify handler. */ @@ -851,8 +837,6 @@ acpi_cpu_startup(void *arg) if (cpu_quirks & CPU_QUIRK_NO_C3) { sc->cpu_cx_count = sc->cpu_non_c3 + 1; } - if (sc->cpu_cx_count > cpu_cx_count) - cpu_cx_count = sc->cpu_cx_count; AcpiInstallNotifyHandler(sc->cpu_handle, ACPI_DEVICE_NOTIFY, acpi_cpu_notify, sc); } @@ -871,7 +855,7 @@ acpi_cpu_startup(void *arg) "Global lowest Cx sleep state to use"); /* Take over idling from cpu_idle_default(). */ - cpu_cx_lowest = 0; + cpu_cx_lowest_lim = 0; cpu_disable_idle = FALSE; cpu_idle_hook = acpi_cpu_idle; } @@ -1062,8 +1046,6 @@ static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context) { struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context; - struct acpi_cpu_softc *isc; - int i; if (notify != ACPI_NOTIFY_CX_STATES) return; @@ -1072,16 +1054,8 @@ acpi_cpu_notify(ACPI_HANDLE h, UINT32 no acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); - /* Update the new lowest useable Cx state for all CPUs. */ ACPI_SERIAL_BEGIN(cpu); - cpu_cx_count = 0; - for (i = 0; i < cpu_ndevices; i++) { - isc = device_get_softc(cpu_devices[i]); - if (isc->cpu_cx_count > cpu_cx_count) - cpu_cx_count = isc->cpu_cx_count; - } - if (sc->cpu_cx_lowest < cpu_cx_lowest) - acpi_cpu_set_cx_lowest(sc, min(cpu_cx_lowest, sc->cpu_cx_count - 1)); + acpi_cpu_set_cx_lowest(sc); ACPI_SERIAL_END(cpu); } @@ -1209,12 +1183,12 @@ acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARG } static int -acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc, int val) +acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc) { int i; ACPI_SERIAL_ASSERT(cpu); - sc->cpu_cx_lowest = val; + sc->cpu_cx_lowest = min(sc->cpu_cx_lowest_lim, sc->cpu_cx_count - 1); /* If not disabling, cache the new lowest non-C3 state. */ sc->cpu_non_c3 = 0; @@ -1238,18 +1212,23 @@ acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER int val, error; sc = (struct acpi_cpu_softc *) arg1; - snprintf(state, sizeof(state), "C%d", sc->cpu_cx_lowest + 1); + snprintf(state, sizeof(state), "C%d", sc->cpu_cx_lowest_lim + 1); error = sysctl_handle_string(oidp, state, sizeof(state), req); if (error != 0 || req->newptr == NULL) return (error); if (strlen(state) < 2 || toupper(state[0]) != 'C') return (EINVAL); - val = (int) strtol(state + 1, NULL, 10) - 1; - if (val < 0 || val > sc->cpu_cx_count - 1) - return (EINVAL); + if (strcasecmp(state, "Cmax") == 0) + val = MAX_CX_STATES; + else { + val = (int) strtol(state + 1, NULL, 10); + if (val < 1 || val > MAX_CX_STATES) + return (EINVAL); + } ACPI_SERIAL_BEGIN(cpu); - acpi_cpu_set_cx_lowest(sc, val); + sc->cpu_cx_lowest_lim = val - 1; + acpi_cpu_set_cx_lowest(sc); ACPI_SERIAL_END(cpu); return (0); @@ -1262,22 +1241,27 @@ acpi_cpu_global_cx_lowest_sysctl(SYSCTL_ char state[8]; int val, error, i; - snprintf(state, sizeof(state), "C%d", cpu_cx_lowest + 1); + snprintf(state, sizeof(state), "C%d", cpu_cx_lowest_lim + 1); error = sysctl_handle_string(oidp, state, sizeof(state), req); if (error != 0 || req->newptr == NULL) return (error); if (strlen(state) < 2 || toupper(state[0]) != 'C') return (EINVAL); - val = (int) strtol(state + 1, NULL, 10) - 1; - if (val < 0 || val > cpu_cx_count - 1) - return (EINVAL); - cpu_cx_lowest = val; + if (strcasecmp(state, "Cmax") == 0) + val = MAX_CX_STATES; + else { + val = (int) strtol(state + 1, NULL, 10); + if (val < 1 || val > MAX_CX_STATES) + return (EINVAL); + } /* Update the new lowest useable Cx state for all CPUs. */ ACPI_SERIAL_BEGIN(cpu); + cpu_cx_lowest_lim = val - 1; for (i = 0; i < cpu_ndevices; i++) { sc = device_get_softc(cpu_devices[i]); - acpi_cpu_set_cx_lowest(sc, min(val, sc->cpu_cx_count - 1)); + sc->cpu_cx_lowest_lim = cpu_cx_lowest_lim; + acpi_cpu_set_cx_lowest(sc); } ACPI_SERIAL_END(cpu); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 08:39:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F5BF106568D; Wed, 29 Aug 2012 08:39:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AAD98FC0C; Wed, 29 Aug 2012 08:39:59 +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 q7T8dxms013455; Wed, 29 Aug 2012 08:39:59 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T8dxhY013452; Wed, 29 Aug 2012 08:39:59 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201208290839.q7T8dxhY013452@svn.freebsd.org> From: Andriy Gapon Date: Wed, 29 Aug 2012 08:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239809 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 08:39:59 -0000 Author: avg Date: Wed Aug 29 08:39:58 2012 New Revision: 239809 URL: http://svn.freebsd.org/changeset/base/239809 Log: MFC r238192: acpi_cpu_cx_cst: consistently use cpu_cx_count during state enumeration Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:34:16 2012 (r239808) +++ stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:39:58 2012 (r239809) @@ -747,13 +747,13 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s /* This is the first C1 state. Use the reserved slot. */ sc->cpu_cx_states[0] = *cx_ptr; } else { - sc->cpu_non_c3 = i; + sc->cpu_non_c3 = sc->cpu_cx_count; cx_ptr++; sc->cpu_cx_count++; } continue; case ACPI_STATE_C2: - sc->cpu_non_c3 = i; + sc->cpu_non_c3 = sc->cpu_cx_count; break; case ACPI_STATE_C3: default: From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 08:47:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 393FB1065674; Wed, 29 Aug 2012 08:47:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF4768FC1D; Wed, 29 Aug 2012 08:47:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7T8lhsv014580; Wed, 29 Aug 2012 08:47:43 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T8lh3U014577; Wed, 29 Aug 2012 08:47:43 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201208290847.q7T8lh3U014577@svn.freebsd.org> From: Andriy Gapon Date: Wed, 29 Aug 2012 08:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239812 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 08:47:44 -0000 Author: avg Date: Wed Aug 29 08:47:43 2012 New Revision: 239812 URL: http://svn.freebsd.org/changeset/base/239812 Log: MFC r238193: acpi_cpu_cx_list: there is no need to re-evaluate cpu_non_c3 here Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:46:04 2012 (r239811) +++ stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:47:43 2012 (r239812) @@ -671,6 +671,7 @@ acpi_cpu_generic_cx_probe(struct acpi_cp cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency; cx_ptr++; sc->cpu_cx_count++; + cpu_can_deep_sleep = 1; } } } @@ -762,7 +763,8 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s "acpi_cpu%d: C3[%d] not available.\n", device_get_unit(sc->cpu_dev), i)); continue; - } + } else + cpu_can_deep_sleep = 1; break; } @@ -869,16 +871,10 @@ acpi_cpu_cx_list(struct acpi_cpu_softc * /* * Set up the list of Cx states */ - sc->cpu_non_c3 = 0; sbuf_new(&sb, sc->cpu_cx_supported, sizeof(sc->cpu_cx_supported), SBUF_FIXEDLEN); - for (i = 0; i < sc->cpu_cx_count; i++) { + for (i = 0; i < sc->cpu_cx_count; i++) sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat); - if (sc->cpu_cx_states[i].type < ACPI_STATE_C3) - sc->cpu_non_c3 = i; - else - cpu_can_deep_sleep = 1; - } sbuf_trim(&sb); sbuf_finish(&sb); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 08:58:11 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95A471065670; Wed, 29 Aug 2012 08:58:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 808428FC16; Wed, 29 Aug 2012 08:58: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 q7T8wBix015964; Wed, 29 Aug 2012 08:58:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T8wB4X015962; Wed, 29 Aug 2012 08:58:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201208290858.q7T8wB4X015962@svn.freebsd.org> From: Andriy Gapon Date: Wed, 29 Aug 2012 08:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239813 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 08:58:11 -0000 Author: avg Date: Wed Aug 29 08:58:10 2012 New Revision: 239813 URL: http://svn.freebsd.org/changeset/base/239813 Log: MFC r238194: acpi_cpu_generic_cx_probe: for consistency set cpu_non_c3 here too Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:47:43 2012 (r239812) +++ stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:58:10 2012 (r239813) @@ -630,6 +630,7 @@ acpi_cpu_generic_cx_probe(struct acpi_cp cx_ptr->type = ACPI_STATE_C1; cx_ptr->trans_lat = 0; cx_ptr++; + sc->cpu_non_c3 = sc->cpu_cx_count; sc->cpu_cx_count++; /* @@ -654,6 +655,7 @@ acpi_cpu_generic_cx_probe(struct acpi_cp cx_ptr->type = ACPI_STATE_C2; cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency; cx_ptr++; + sc->cpu_non_c3 = sc->cpu_cx_count; sc->cpu_cx_count++; } } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 09:00:58 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D4591065674; Wed, 29 Aug 2012 09:00:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C58C8FC12; Wed, 29 Aug 2012 09:00:58 +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 q7T90wUJ016420; Wed, 29 Aug 2012 09:00:58 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7T90vcV016418; Wed, 29 Aug 2012 09:00:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201208290900.q7T90vcV016418@svn.freebsd.org> From: Andriy Gapon Date: Wed, 29 Aug 2012 09:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239815 - stable/9/sys/dev/acpica X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 09:00:58 -0000 Author: avg Date: Wed Aug 29 09:00:57 2012 New Revision: 239815 URL: http://svn.freebsd.org/changeset/base/239815 Log: MFC r238229: acpi_cpu: we are able to handle _CST change notifications Modified: stable/9/sys/dev/acpica/acpi_cpu.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_cpu.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 08:59:02 2012 (r239814) +++ stable/9/sys/dev/acpica/acpi_cpu.c Wed Aug 29 09:00:57 2012 (r239815) @@ -902,14 +902,12 @@ acpi_cpu_startup_cx(struct acpi_cpu_soft (void *)sc, 0, acpi_cpu_usage_sysctl, "A", "percent usage for each Cx state"); -#ifdef notyet /* Signal platform that we can handle _CST notification. */ if (!cpu_cx_generic && cpu_cst_cnt != 0) { ACPI_LOCK(acpi); AcpiOsWritePort(cpu_smi_cmd, cpu_cst_cnt, 8); ACPI_UNLOCK(acpi); } -#endif } /* From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 11:23:21 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B88A106566C; Wed, 29 Aug 2012 11:23:21 +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 13F818FC14; Wed, 29 Aug 2012 11:23: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 q7TBNLtZ035355; Wed, 29 Aug 2012 11:23:21 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TBNK6G035350; Wed, 29 Aug 2012 11:23:20 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208291123.q7TBNK6G035350@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 29 Aug 2012 11:23:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239817 - in stable/9: share/man/man4 share/syscons/keymaps sys/dev/usb sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 11:23:21 -0000 Author: gavin Date: Wed Aug 29 11:23:20 2012 New Revision: 239817 URL: http://svn.freebsd.org/changeset/base/239817 Log: Merge r238803, r238804 from head: Add support for more devices to uslcom(4). This commit syncronises the list of supported devices with the union of: NetBSD src/sys/dev/usb/uslsa.c 1.18 OpenBSD src/sys/dev/usb/uslcom.c 1.24 Linux source/drivers/usb/serial/cp210x.c HEAD Remove duplicate JABLOTRON PC60B entry. Note that some of the devices added here are multi-port devices. The uslcom(4) driver currently only supports the first port on such devices. Update the man page to reflect the full list of supported devices. Remove two caveats from the CAVEATS section, as both listed caveats no longer apply. Add a caveat about multi-port devices. Improve descriptions for several devices supported by uslcom(4). Correct the spelling of the company Telegesis. Move MpMan to the correct location alphabetically. Replaced: stable/9/share/syscons/keymaps/spanish.dvorak.kbd - copied unchanged from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd Modified: stable/9/share/man/man4/uslcom.4 stable/9/sys/dev/usb/serial/uslcom.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/share/man/man4/uslcom.4 ============================================================================== --- stable/9/share/man/man4/uslcom.4 Wed Aug 29 09:02:02 2012 (r239816) +++ stable/9/share/man/man4/uslcom.4 Wed Aug 29 11:23:20 2012 (r239817) @@ -16,12 +16,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2007 +.Dd July 26, 2012 .Dt USLCOM 4 .Os .Sh NAME .Nm uslcom -.Nd Silicon Laboratories CP2101/CP2102 based USB serial adapter +.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104 based USB serial adapter .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -39,7 +39,8 @@ uslcom_load="YES" .Sh DESCRIPTION The .Nm -driver supports Silicon Laboratories CP2101/CP2102 based USB serial adapters. +driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104 +based USB serial adapters. .Sh HARDWARE The following devices should work with the .Nm @@ -47,29 +48,147 @@ driver: .Pp .Bl -bullet -compact .It +AC-Services CAN, CIS-IBUS, IBUS and OBD interfaces +.It +Aerocomm Radio +.It +AKTACOM ACE-1001 cable +.It +AMBER Wireless AMB2560 +.It +Arkham DS-101 Adapter +.It Argussoft ISP .It +Arygon Technologies Mifare RFID Reader +.It +AVIT Research USB-TTL interface +.It +B&G H3000 Data Cable +.It +Balluff RFID reader +.It Baltech card reader .It +BEI USB VCP Sensor +.It Burnside Telecom Desktop Mobile .It chip45.com Crumb128 module .It +Clipsal 5000CT2, 5500PACA, 5500PCU, 560884, 5800PC, C5000CT2 +and L51xx C-Bus Home Automation products +.It +Commander 2 EDGE(GSM) Modem +.It +Cygnal Fasttrax GPS and Debug adapter +.It +DataApex MultiCOM USB to RS232 converter +.It +Degree Controls USB adapter +.It +DekTec DTA Plus VHF/UHF Booster +.It +Dell DW700 GPS Receiver +.It +Digianswer ZigBee/802.15.4 MAC +.It +Dynastream ANT Development kits +.It +Elan USBcount50, USBscope50, USBpulse100 and USBwave12 +.It +ELV USB-I2C interface +.It +EMS C1007 HF RFID controller +.It +Festo CPX-USB and CMSP interfaces +.It +Gemalto Prox-PU/CU contactless card reader +.It +Helicomm IP-Link 1220-DVM +.It +IMS USB-RS422 adapter +.It +Infinity GPS-MIC-1 Radio Monophone +.It +INSYS Modem +.It +IRZ SG-10 and MC35pu GSM/GPRS Modems +.It Jablotron PC-60B .It -Lipowsky Baby-JTAG +Kamstrup M-Bus Master MultiPort 250D +and Optical Eye/3 wire utility meter interfaces .It -Lipowsky Baby-LIN +Kyocera GPS .It -Lipowsky HARP-1 +Link Instruments MS-019 and MS-028 +Oscilloscope/Logic Analyzer/Pattern Generators +.It +Lipowsky Baby-JTAG, Baby-LIN and HARP-1 +.It +MEI CashFlow SC and Series 2000 cash acceptors +.It +MJS USB-TOSLINK Adapter +.It +MobiData GPRS USB Modems +.It +MSD DashHawk +.It +Multiplex RC adapter +.It +Optris MSpro LT Thermometer +.It +Owen AC4 USB-RS485 converter +.It +Pirelli DP-L10 SIP phone +.It +PLX CA-42 Phone cable .It Pololu USB to Serial .It -Silicon Laboratories CP2101 +Procyon AVS Mind Machine +.It +Renesas RX-Stick for RX610 +.It +Siemens MC60 Cable +.It +Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104 chips +.It +Software Bisque Paramount ME +.It +SPORTident BSM7-D USB .It -Silicon Laboratories CP2102 +Suunto Sports Instrument +.It +Syntech CipherLab USB Barcode Scanner +.It +T-Com TC 300 SIP phone +.It +Tams Master Easy Control +.It +Telegesis ETRX2USB +.It +Timewave HamLinkUSB +.It +Tracient RFID Reader .It Track Systems Traqmate +.It +Vaisala USB Instrument cable +.It +VStabi Controller +.It +WAGO 750-923 USB Service Cable +.It +WaveSense Jazz Blood Glucose Meter +.It +WIENER Plein & Baus CML Data Logger, RCM Remote, +and PL512 and MPOD PSUs +.It +WMR RIGblaster Plug&Play and RIGtalk RT1 +.It +Zephyr Bioharness .El .Sh SEE ALSO .Xr tty 4 , @@ -90,7 +209,5 @@ The driver was written by .An Jonathan Gray Aq jsg@openbsd.org . .Sh CAVEATS -Setting hardware flow control is not currently supported. -.Pp -Silicon Laboratories do not release any programming information -on their products. +On devices with multiple ports attached to a single chip, +only the first port is currently supported. Copied: stable/9/share/syscons/keymaps/spanish.dvorak.kbd (from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/syscons/keymaps/spanish.dvorak.kbd Wed Aug 29 11:23:20 2012 (r239817, copy of r235251, head/share/syscons/keymaps/spanish.dvorak.kbd) @@ -0,0 +1,139 @@ +# $FreeBSD$ +# alt +# scan cntrl alt alt cntrl lock +# code base shift cntrl shift alt shift cntrl shift state +# ------------------------------------------------------------------ + 000 nop nop nop nop nop nop nop nop O + 001 esc esc esc esc esc esc debug esc O + 002 '1' '!' nop nop '|' '!' nop nop O + 003 '2' '"' nop nop '@' '"' nop nop O + 004 '3' 183 nop nop '#' '#' nop nop O + 005 '4' '$' nop nop '~' '~' nop nop O + 006 '5' '%' nop nop '5' '%' nop nop O + 007 '6' '&' nop nop 172 172 nop nop O + 008 '7' '/' nop nop '7' '/' nop nop O + 009 '8' '(' nop nop '8' '(' nop nop O + 010 '9' ')' nop nop '9' ')' nop nop O + 011 '0' '=' nop nop '0' '=' nop nop O + 012 ''' '?' nop nop ''' '?' nop nop O + 013 161 191 nop nop 161 191 nop nop O + 014 bs bs del del bs bs del del O + 015 ht btab nop nop ht btab nop nop O + 016 '.' ':' nop nop '.' ':' nop nop O + 017 ',' ';' nop nop ',' ';' nop nop O + 018 241 209 nop nop '~' '~' nop nop O + 019 'p' 'P' dle dle 'p' 'P' dle dle C + 020 'y' 'Y' em em 'y' 'Y' em em C + 021 'f' 'F' ack ack 'f' 'F' ack ack C + 022 'g' 'G' bel bel 'g' 'G' bel bel C + 023 'c' 'C' etx etx 'c' 'C' etx etx C + 024 'h' 'H' bs bs 'h' 'H' bs bs C + 025 'l' 'L' ff ff 'l' 'L' ff ff C + 026 dgra dcir esc esc '[' '[' esc esc O + 027 '+' '*' gs gs ']' ']' gs gs O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a' 'A' soh soh 'a' 'A' soh soh C + 031 'o' 'O' si si 243 211 si si C + 032 'e' 'E' enq enq 164 164 enq enq C + 033 'u' 'U' nak nak 250 218 nak nak C + 034 'i' 'I' ht ht 237 205 ht ht C + 035 'd' 'D' eot eot 'd' 'D' eot eot C + 036 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C + 037 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C + 038 'n' 'N' so so 'n' 'N' so so C + 039 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C + 040 dacu duml nop nop '{' '{' nop nop O + 041 '\' '|' fs fs '\' '|' fs fs O + 042 lshift lshift lshift lshift lshift lshift lshift lshift O + 043 231 199 rs rs '}' '}' rs rs O + 044 '-' '_' us us '-' '_' us us O + 045 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C + 046 'j' 'J' nl nl 'j' 'J' nl nl C + 047 'k' 'K' vt vt 'k' 'K' vt vt C + 048 'x' 'X' can can 'x' 'X' can can C + 049 'b' 'B' stx stx 'b' 'B' stx stx C + 050 'm' 'M' cr cr 'm' 'M' cr cr C + 051 'w' 'W' etb etb 'w' 'W' etb etb C + 052 'v' 'V' syn syn 'v' 'V' syn syn C + 053 'z' 'Z' sub sub 'z' 'Z' sub sub C + 054 rshift rshift rshift rshift rshift rshift rshift rshift O + 055 '*' '*' '*' '*' '*' '*' '*' '*' O + 056 lalt lalt lalt lalt lalt lalt lalt lalt O + 057 ' ' ' ' nul ' ' ' ' ' ' susp ' ' O + 058 clock clock clock clock clock clock clock clock O + 059 fkey01 fkey13 fkey25 fkey37 scr01 scr11 scr01 scr11 O + 060 fkey02 fkey14 fkey26 fkey38 scr02 scr12 scr02 scr12 O + 061 fkey03 fkey15 fkey27 fkey39 scr03 scr13 scr03 scr13 O + 062 fkey04 fkey16 fkey28 fkey40 scr04 scr14 scr04 scr14 O + 063 fkey05 fkey17 fkey29 fkey41 scr05 scr15 scr05 scr15 O + 064 fkey06 fkey18 fkey30 fkey42 scr06 scr16 scr06 scr16 O + 065 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O + 066 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O + 067 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O + 068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O + 069 nlock nlock nlock nlock nlock nlock nlock nlock O + 070 slock slock slock slock slock slock slock slock O + 071 fkey49 '7' '7' '7' '7' '7' '7' '7' N + 072 fkey50 '8' '8' '8' '8' '8' '8' '8' N + 073 fkey51 '9' '9' '9' '9' '9' '9' '9' N + 074 fkey52 '-' '-' '-' '-' '-' '-' '-' N + 075 fkey53 '4' '4' '4' '4' '4' '4' '4' N + 076 fkey54 '5' '5' '5' '5' '5' '5' '5' N + 077 fkey55 '6' '6' '6' '6' '6' '6' '6' N + 078 fkey56 '+' '+' '+' '+' '+' '+' '+' N + 079 fkey57 '1' '1' '1' '1' '1' '1' '1' N + 080 fkey58 '2' '2' '2' '2' '2' '2' '2' N + 081 fkey59 '3' '3' '3' '3' '3' '3' '3' N + 082 fkey60 '0' '0' '0' '0' '0' '0' '0' N + 083 del '.' '.' '.' '.' '.' boot boot N + 084 nop nop nop nop nop nop nop nop O + 085 nop nop nop nop nop nop nop nop O + 086 '<' '>' nop nop '<' '>' nop nop O + 087 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O + 088 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O + 089 cr cr nl nl cr cr nl nl O + 090 rctrl rctrl rctrl rctrl rctrl rctrl rctrl rctrl O + 091 '/' '/' '/' '/' '/' '/' '/' '/' N + 092 nscr pscr debug debug nop nop nop nop O + 093 ralt ralt ralt ralt ralt ralt ralt ralt O + 094 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O + 095 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O + 096 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O + 097 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O + 098 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O + 099 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O + 100 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O + 101 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O + 102 fkey60 paste fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O + 103 fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot fkey61 O + 104 slock saver slock saver susp nop susp nop O + 105 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 O + 106 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 O + 107 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 O + 108 nop nop nop nop nop nop nop nop O + + dgra '`' ( 'a' 224 ) ( 'A' 192 ) ( 'e' 232 ) ( 'E' 200 ) + ( 'i' 236 ) ( 'I' 204 ) ( 'o' 242 ) ( 'O' 210 ) + ( 'u' 249 ) ( 'U' 217 ) + dacu 180 ( 'a' 225 ) ( 'A' 193 ) ( 'e' 233 ) ( 'E' 201 ) + ( 'i' 237 ) ( 'I' 205 ) ( 'o' 243 ) ( 'O' 211 ) + ( 'u' 250 ) ( 'U' 218 ) ( 'y' 253 ) ( 'Y' 221 ) + dcir '^' ( 'a' 226 ) ( 'A' 194 ) ( 'e' 234 ) ( 'E' 202 ) + ( 'i' 238 ) ( 'I' 206 ) ( 'o' 244 ) ( 'O' 212 ) + ( 'u' 251 ) ( 'U' 219 ) + dtil '~' ( 'a' 227 ) ( 'A' 195 ) ( 'n' 241 ) ( 'N' 209 ) + ( 'o' 245 ) ( 'O' 213 ) + dmac 000 + dbre 000 + ddot 000 + duml 168 ( 'a' 228 ) ( 'A' 196 ) ( 'e' 235 ) ( 'E' 203 ) + ( 'i' 239 ) ( 'I' 207 ) ( 'o' 246 ) ( 'O' 214 ) + ( 'u' 252 ) ( 'U' 220 ) ( 'y' 255 ) + dsla 000 + drin 176 ( 'a' 229 ) ( 'A' 197 ) + dced 184 ( 'c' 231 ) ( 'C' 199 ) + dapo 000 + ddac 000 + dogo 000 + dcar 000 Modified: stable/9/sys/dev/usb/serial/uslcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uslcom.c Wed Aug 29 09:02:02 2012 (r239816) +++ stable/9/sys/dev/usb/serial/uslcom.c Wed Aug 29 11:23:20 2012 (r239817) @@ -214,7 +214,13 @@ static struct ucom_callback uslcom_callb static const STRUCT_USB_HOST_ID uslcom_devs[] = { #define USLCOM_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } USLCOM_DEV(BALTECH, CARDREADER), + USLCOM_DEV(CLIPSAL, 5000CT2), + USLCOM_DEV(CLIPSAL, 5500PACA), USLCOM_DEV(CLIPSAL, 5500PCU), + USLCOM_DEV(CLIPSAL, 560884), + USLCOM_DEV(CLIPSAL, 5800PC), + USLCOM_DEV(CLIPSAL, C5000CT2), + USLCOM_DEV(CLIPSAL, L51xx), USLCOM_DEV(DATAAPEX, MULTICOM), USLCOM_DEV(DELL, DW700), USLCOM_DEV(DIGIANSWER, ZIGBEE802154), @@ -222,17 +228,27 @@ static const STRUCT_USB_HOST_ID uslcom_d USLCOM_DEV(DYNASTREAM, ANTDEVBOARD2), USLCOM_DEV(DYNASTREAM, ANT2USB), USLCOM_DEV(ELV, USBI2C), + USLCOM_DEV(FESTO, CMSP), + USLCOM_DEV(FESTO, CPX_USB), USLCOM_DEV(FOXCONN, PIRELLI_DP_L10), USLCOM_DEV(FOXCONN, TCOM_TC_300), USLCOM_DEV(GEMALTO, PROXPU), USLCOM_DEV(JABLOTRON, PC60B), + USLCOM_DEV(KAMSTRUP, OPTICALEYE), + USLCOM_DEV(KAMSTRUP, MBUS_250D), + USLCOM_DEV(LINKINSTRUMENTS, MSO19), + USLCOM_DEV(LINKINSTRUMENTS, MSO28), + USLCOM_DEV(LINKINSTRUMENTS, MSO28_2), USLCOM_DEV(MEI, CASHFLOW_SC), USLCOM_DEV(MEI, S2000), - USLCOM_DEV(JABLOTRON, PC60B), USLCOM_DEV(OWEN, AC4), USLCOM_DEV(PHILIPS, ACE1001), USLCOM_DEV(PLX, CA42), USLCOM_DEV(RENESAS, RX610), + USLCOM_DEV(SILABS, AC_SERV_CAN), + USLCOM_DEV(SILABS, AC_SERV_CIS), + USLCOM_DEV(SILABS, AC_SERV_IBUS), + USLCOM_DEV(SILABS, AC_SERV_OBD), USLCOM_DEV(SILABS, AEROCOMM), USLCOM_DEV(SILABS, AMBER_AMB2560), USLCOM_DEV(SILABS, ARGUSISP), @@ -248,16 +264,21 @@ static const STRUCT_USB_HOST_ID uslcom_d USLCOM_DEV(SILABS, C2_EDGE_MODEM), USLCOM_DEV(SILABS, CP2102), USLCOM_DEV(SILABS, CP210X_2), + USLCOM_DEV(SILABS, CP210X_3), + USLCOM_DEV(SILABS, CP210X_4), USLCOM_DEV(SILABS, CRUMB128), USLCOM_DEV(SILABS, CYGNAL), USLCOM_DEV(SILABS, CYGNAL_DEBUG), USLCOM_DEV(SILABS, CYGNAL_GPS), USLCOM_DEV(SILABS, DEGREE), + USLCOM_DEV(SILABS, DEKTEK_DTAPLUS), USLCOM_DEV(SILABS, EMS_C1007), + USLCOM_DEV(SILABS, HAMLINKUSB), USLCOM_DEV(SILABS, HELICOM), USLCOM_DEV(SILABS, IMS_USB_RS422), USLCOM_DEV(SILABS, INFINITY_MIC), USLCOM_DEV(SILABS, INSYS_MODEM), + USLCOM_DEV(SILABS, IRZ_SG10), USLCOM_DEV(SILABS, KYOCERA_GPS), USLCOM_DEV(SILABS, LIPOWSKY_HARP), USLCOM_DEV(SILABS, LIPOWSKY_JTAG), @@ -265,12 +286,14 @@ static const STRUCT_USB_HOST_ID uslcom_d USLCOM_DEV(SILABS, MC35PU), USLCOM_DEV(SILABS, MJS_TOSLINK), USLCOM_DEV(SILABS, MSD_DASHHAWK), + USLCOM_DEV(SILABS, MULTIPLEX_RC), + USLCOM_DEV(SILABS, OPTRIS_MSPRO), USLCOM_DEV(SILABS, POLOLU), USLCOM_DEV(SILABS, PROCYON_AVS), USLCOM_DEV(SILABS, SB_PARAMOUNT_ME), USLCOM_DEV(SILABS, SUUNTO), USLCOM_DEV(SILABS, TAMSMASTER), - USLCOM_DEV(SILABS, TELEGESYS_ETRX2), + USLCOM_DEV(SILABS, TELEGESIS_ETRX2), USLCOM_DEV(SILABS, TRACIENT), USLCOM_DEV(SILABS, TRAQMATE), USLCOM_DEV(SILABS, USBCOUNT50), Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Wed Aug 29 09:02:02 2012 (r239816) +++ stable/9/sys/dev/usb/usbdevs Wed Aug 29 11:23:20 2012 (r239817) @@ -656,6 +656,7 @@ vendor SENAO 0x1740 Senao vendor ASUS2 0x1761 ASUS vendor SWEEX2 0x177f Sweex vendor METAGEEK 0x1781 MetaGeek +vendor KAMSTRUP 0x17a8 Kamstrup A/S vendor WAVESENSE 0x17f4 WaveSense vendor VAISALA 0x1843 Vaisala vendor AMIT 0x18c5 AMIT @@ -680,6 +681,7 @@ vendor QISDA 0x1da5 Qisda vendor METAGEEK2 0x1dd5 MetaGeek vendor ALINK 0x1e0e Alink vendor AIRTIES 0x1eda AirTies +vendor FESTO 0x1e29 Festo vendor VERTEX 0x1fe7 Vertex Wireless Co., Ltd. vendor DLINK 0x2001 D-Link vendor PLANEX2 0x2019 Planex Communications @@ -695,6 +697,7 @@ vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ vendor PLANEX 0x2c02 Planex Communications vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd +vendor LINKINSTRUMENTS 0x3195 Link Instruments Inc. vendor AEI 0x3334 AEI vendor HANK 0x3353 Hank Connection vendor PQI 0x3538 PQI @@ -1240,7 +1243,13 @@ product CISCOLINKSYS2 RT3070 0x4001 RT30 product CISCOLINKSYS3 RT3070 0x0101 RT3070 /* Clipsal products */ -product CLIPSAL 5500PCU 0x0303 5500PCU C-Bus +product CLIPSAL 560884 0x0101 560884 C-Bus Audio Matrix Switch +product CLIPSAL 5500PACA 0x0201 5500PACA C-Bus Pascal Automation Controller +product CLIPSAL 5800PC 0x0301 5800PC C-Bus Wireless Interface +product CLIPSAL 5500PCU 0x0303 5500PCU C-Bus Interface +product CLIPSAL 5000CT2 0x0304 5000CT2 C-Bus Touch Screen +product CLIPSAL C5000CT2 0x0305 C5000CT2 C-Bus Touch Screen +product CLIPSAL L51xx 0x0401 L51xx C-Bus Dimmer /* CMOTECH products */ product CMOTECH CNU510 0x5141 CDMA Technologies USB modem @@ -1582,6 +1591,10 @@ product FEIYA DUMMY 0x0000 Dummy produc product FEIYA 5IN1 0x1132 5-in-1 Card Reader product FEIYA AC110 0x6300 AC-110 Card Reader +/* Festo */ +product FESTO CPX_USB 0x0102 CPX-USB +product FESTO CMSP 0x0501 CMSP + /* Fiberline */ product FIBERLINE WL430U 0x6003 WL-430U @@ -1649,7 +1662,7 @@ product FUJITSUSIEMENS SCR 0x0009 Fujits product GARMIN IQUE_3600 0x0004 iQue 3600 /* Gemalto products */ -product GEMALTO PROXPU 0x5501 Prox-PU/CU +product GEMALTO PROXPU 0x5501 Prox-PU/CU RFID Card Reader /* General Instruments (Motorola) products */ product GENERALINSTMNTS SB5100 0x5100 SURFboard SB5100 Cable modem @@ -1978,6 +1991,10 @@ product JVC MP_PRX1 0x3008 MP-PRX1 Ethe /* JRC products */ product JRC AH_J3001V_J3002V 0x0001 AirH PHONE AH-J3001V/J3002V +/* Kamstrrup products */ +product KAMSTRUP OPTICALEYE 0x0001 Optical Eye/3-wire +product KAMSTRUP MBUS_250D 0x0005 M-Bus Master MultiPort 250D + /* Kawatsu products */ product KAWATSU MH4000P 0x0003 MiniHub 4000P @@ -2073,6 +2090,11 @@ product LEXMARK S2450 0x0009 Optra S 24 /* Liebert products */ product LIEBERT POWERSURE_PXT 0xffff PowerSure Personal XT +/* Link Instruments Inc. products */ +product LINKINSTRUMENTS MSO19 0xf190 Link Instruments MSO-19 +product LINKINSTRUMENTS MSO28 0xf280 Link Instruments MSO-28 +product LINKINSTRUMENTS MSO28_2 0xf281 Link Instruments MSO-28 + /* Linksys products */ product LINKSYS MAUSB2 0x0105 Camedia MAUSB-2 product LINKSYS USB10TX1 0x200c USB10TX @@ -2208,7 +2230,7 @@ product MGE UPS2 0xffff MGE UPS SYSTEMS /* MEI products */ product MEI CASHFLOW_SC 0x1100 Cashflow-SC Cash Acceptor -product MEI S2000 0x1101 Seies 2000 Combo Acceptor +product MEI S2000 0x1101 Series 2000 Combo Acceptor /* Micro Star International products */ product MSI BT_DONGLE 0x1967 Bluetooth USB dongle @@ -2321,6 +2343,10 @@ product MOTOROLA2 USBLAN2 0x6027 USBLAN product MOTOROLA4 RT2770 0x9031 RT2770 product MOTOROLA4 RT3070 0x9032 RT3070 +/* MpMan products */ +product MPMAN MPF400_2 0x25a8 MPF400 Music Player 2Go +product MPMAN MPF400_1 0x36d0 MPF400 Music Player 1Go + /* MultiTech products */ product MULTITECH ATLAS 0xf101 MT5634ZBA-USB modem @@ -3029,10 +3055,10 @@ product SILICOM U2E 0x0001 U2E product SILICOM GPE 0x0002 Psion Gold Port Ethernet /* SI Labs */ -product SILABS VSTABI 0x0f91 Vstabi +product SILABS VSTABI 0x0f91 VStabi Controller product SILABS ARKHAM_DS101_M 0x1101 Arkham DS101 Monitor product SILABS ARKHAM_DS101_A 0x1601 Arkham DS101 Adapter -product SILABS BSM7DUSB 0x800a BSM7-D-USB +product SILABS BSM7DUSB 0x800a SPORTident BSM7-D USB product SILABS POLOLU 0x803b Pololu Serial product SILABS CYGNAL_DEBUG 0x8044 Cygnal Debug Adapter product SILABS SB_PARAMOUNT_ME 0x8043 Software Bisque Paramount ME @@ -3041,6 +3067,7 @@ product SILABS GSM2228 0x8054 Enfora GS product SILABS ARGUSISP 0x8066 Argussoft ISP product SILABS IMS_USB_RS422 0x806f IMS USB-RS422 product SILABS CRUMB128 0x807a Crumb128 board +product SILABS OPTRIS_MSPRO 0x80c4 Optris MSpro LT Thermometer product SILABS DEGREE 0x80ca Degree Controls Inc product SILABS TRACIENT 0x80dd Tracient RFID product SILABS TRAQMATE 0x80ed Track Systems Traqmate @@ -3053,9 +3080,11 @@ product SILABS WMRRIGBLASTER 0x814a WMR product SILABS WMRRIGTALK 0x814b WMR RIGtalk RT1 product SILABS B_G_H3000 0x8156 B&G H3000 Data Cable product SILABS HELICOM 0x815e Helicomm IP-Link 1220-DVM +product SILABS HAMLINKUSB 0x815f Timewave HamLinkUSB product SILABS AVIT_USB_TTL 0x818b AVIT Research USB-TTL -product SILABS MJS_TOSLINK 0x819f MJS USB-TOSLINk +product SILABS MJS_TOSLINK 0x819f MJS USB-TOSLINK product SILABS WAVIT 0x81a6 ThinkOptics WavIt +product SILABS MULTIPLEX_RC 0x81a9 Multiplex RC adapter product SILABS MSD_DASHHAWK 0x81ac MSD DashHawk product SILABS INSYS_MODEM 0x81ad INSYS Modem product SILABS LIPOWSKY_JTAG 0x81c8 Lipowsky Baby-JTAG @@ -3066,16 +3095,24 @@ product SILABS EMS_C1007 0x81f2 EMS C100 product SILABS LIPOWSKY_HARP 0x8218 Lipowsky HARP-1 product SILABS C2_EDGE_MODEM 0x822b Commander 2 EDGE(GSM) Modem product SILABS CYGNAL_GPS 0x826b Cygnal Fasttrax GPS -product SILABS TELEGESYS_ETRX2 0x8293 Telegesys ETRX2USB +product SILABS TELEGESIS_ETRX2 0x8293 Telegesis ETRX2USB product SILABS PROCYON_AVS 0x82f9 Procyon AVS product SILABS MC35PU 0x8341 MC35pu product SILABS CYGNAL 0x8382 Cygnal product SILABS AMBER_AMB2560 0x83a8 Amber Wireless AMB2560 +product SILABS DEKTEK_DTAPLUS 0x83d8 DekTec DTA Plus VHF/UHF Booster product SILABS KYOCERA_GPS 0x8411 Kyocera GPS +product SILABS IRZ_SG10 0x8418 IRZ SG-10 GSM/GPRS Modem product SILABS BEI_VCP 0x846e BEI USB Sensor (VCP) product SILABS BALLUFF_RFID 0x8477 Balluff RFID reader +product SILABS AC_SERV_IBUS 0x85ea AC-Services IBUS Interface +product SILABS AC_SERV_CIS 0x85eb AC-Services CIS-IBUS +product SILABS AC_SERV_CAN 0x8664 AC-Services CAN Interface +product SILABS AC_SERV_OBD 0x8665 AC-Services OBD Interface product SILABS CP2102 0xea60 SILABS USB UART product SILABS CP210X_2 0xea61 CP210x Serial +product SILABS CP210X_3 0xea70 CP210x Serial +product SILABS CP210X_4 0xea80 CP210x Serial product SILABS INFINITY_MIC 0xea71 Infinity GPS-MIC-1 Radio Monophone product SILABS USBSCOPE50 0xf001 USBscope50 product SILABS USBWAVE12 0xf002 USBwave12 @@ -3215,10 +3252,6 @@ product STELERA E1010 0x1010 3G modem product STELERA E1011 0x1011 3G modem product STELERA E1012 0x1012 3G modem -/* MpMan products */ -product MPMAN MPF400_1 0x36d0 MPF400 Music Player 1Go -product MPMAN MPF400_2 0x25a8 MPF400 Music Player 2Go - /* STMicroelectronics products */ product STMICRO BIOCPU 0x2016 Biometric Coprocessor product STMICRO COMMUNICATOR 0x7554 USB Communicator From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 12:25:46 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8699106564A; Wed, 29 Aug 2012 12:25:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id B3C7B8FC17; Wed, 29 Aug 2012 12:25:46 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0DA71B93B; Wed, 29 Aug 2012 08:25:46 -0400 (EDT) From: John Baldwin To: Gavin Atkinson Date: Wed, 29 Aug 2012 07:46:03 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201208291123.q7TBNK6G035350@svn.freebsd.org> In-Reply-To: <201208291123.q7TBNK6G035350@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201208290746.03772.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 29 Aug 2012 08:25:46 -0400 (EDT) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r239817 - in stable/9: share/man/man4 share/syscons/keymaps sys/dev/usb sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 12:25:47 -0000 On Wednesday, August 29, 2012 7:23:20 am Gavin Atkinson wrote: > Author: gavin > Date: Wed Aug 29 11:23:20 2012 > New Revision: 239817 > URL: http://svn.freebsd.org/changeset/base/239817 > > Log: > Merge r238803, r238804 from head: > > Add support for more devices to uslcom(4). This commit syncronises the > list of supported devices with the union of: > > NetBSD src/sys/dev/usb/uslsa.c 1.18 > OpenBSD src/sys/dev/usb/uslcom.c 1.24 > Linux source/drivers/usb/serial/cp210x.c HEAD > > Remove duplicate JABLOTRON PC60B entry. > > Note that some of the devices added here are multi-port devices. The > uslcom(4) driver currently only supports the first port on such devices. > > Update the man page to reflect the full list of supported devices. > Remove two caveats from the CAVEATS section, as both listed caveats no > longer apply. Add a caveat about multi-port devices. > > Improve descriptions for several devices supported by uslcom(4). > Correct the spelling of the company Telegesis. > Move MpMan to the correct location alphabetically. > > Replaced: > stable/9/share/syscons/keymaps/spanish.dvorak.kbd > - copied unchanged from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd This seems to be unrelated? -- John Baldwin From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 12:34:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A5C91065670; Wed, 29 Aug 2012 12:34:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9B68FC21; Wed, 29 Aug 2012 12:34:44 +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 q7TCYidL044549; Wed, 29 Aug 2012 12:34:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TCYiGF044546; Wed, 29 Aug 2012 12:34:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291234.q7TCYiGF044546@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 12:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239821 - stable/9/sys/boot/common X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 12:34:44 -0000 Author: jhb Date: Wed Aug 29 12:34:43 2012 New Revision: 239821 URL: http://svn.freebsd.org/changeset/base/239821 Log: MFC 237338: Don't return an error if a kld does not contain any modules (e.g. a kld that only contained a sysctl). The kernel linker allows such modules, so the boot loader should not reject them. Modified: stable/9/sys/boot/common/load_elf.c stable/9/sys/boot/common/load_elf_obj.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/boot/common/load_elf.c ============================================================================== --- stable/9/sys/boot/common/load_elf.c Wed Aug 29 12:18:42 2012 (r239820) +++ stable/9/sys/boot/common/load_elf.c Wed Aug 29 12:34:43 2012 (r239821) @@ -612,7 +612,7 @@ __elfN(parse_modmetadata)(struct preload Elf_Addr v, p, p_stop; if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0) - return ENOENT; + return 0; p = sym.st_value + ef->off; if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0) return ENOENT; Modified: stable/9/sys/boot/common/load_elf_obj.c ============================================================================== --- stable/9/sys/boot/common/load_elf_obj.c Wed Aug 29 12:18:42 2012 (r239820) +++ stable/9/sys/boot/common/load_elf_obj.c Wed Aug 29 12:34:43 2012 (r239821) @@ -369,7 +369,7 @@ __elfN(obj_parse_modmetadata)(struct pre if (__elfN(obj_lookup_set)(fp, ef, "modmetadata_set", &p, &p_stop, &modcnt) != 0) - return ENOENT; + return 0; modcnt = 0; while (p < p_stop) { From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 12:44:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFF5F1065670; Wed, 29 Aug 2012 12:44:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A0198FC19; Wed, 29 Aug 2012 12:44:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TCiDiN046024; Wed, 29 Aug 2012 12:44:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TCiDAa046022; Wed, 29 Aug 2012 12:44:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201208291244.q7TCiDAa046022@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Aug 2012 12:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239823 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 12:44:13 -0000 Author: bz Date: Wed Aug 29 12:44:13 2012 New Revision: 239823 URL: http://svn.freebsd.org/changeset/base/239823 Log: MFC r238878: For consistency put the IPsec comment iside the #fidef section. Modified: stable/9/sys/netinet6/ip6_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Wed Aug 29 12:35:50 2012 (r239822) +++ stable/9/sys/netinet6/ip6_output.c Wed Aug 29 12:44:13 2012 (r239823) @@ -292,11 +292,11 @@ ip6_output(struct mbuf *m0, struct ip6_p MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2); } +#ifdef IPSEC /* * IPSec checking which handles several cases. * FAST IPSEC: We re-injected the packet. */ -#ifdef IPSEC switch(ip6_ipsec_output(&m, inp, &flags, &error, &ifp, &sp)) { case 1: /* Bad packet */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 12:46:53 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2B3A1065677; Wed, 29 Aug 2012 12:46:53 +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 BBC838FC1F; Wed, 29 Aug 2012 12:46: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 q7TCkrXH046510; Wed, 29 Aug 2012 12:46:53 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TCkrFM046507; Wed, 29 Aug 2012 12:46:53 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208291246.q7TCkrFM046507@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 29 Aug 2012 12:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239826 - in stable/9: share/man/man4 sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 12:46:54 -0000 Author: gavin Date: Wed Aug 29 12:46:53 2012 New Revision: 239826 URL: http://svn.freebsd.org/changeset/base/239826 Log: Merge r239037,239050 from head: Support multiple interface devices. The driver had previously hardcoded support for only the first port, but the CP2105 can have multiple ports. Although without this change the the first port mostly worked on multi port devices, there could still be issues with this arrangement. Update the man page to reflect support for both ports and the CP2105. Many thanks to Silicon Labs (www.silabs.com) for providing a CP2105-EK dev board for testing. Modified: stable/9/share/man/man4/uslcom.4 stable/9/sys/dev/usb/serial/uslcom.c Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/share/man/man4/uslcom.4 ============================================================================== --- stable/9/share/man/man4/uslcom.4 Wed Aug 29 12:44:17 2012 (r239825) +++ stable/9/share/man/man4/uslcom.4 Wed Aug 29 12:46:53 2012 (r239826) @@ -16,12 +16,12 @@ .\" .\" $FreeBSD$ .\" -.Dd July 26, 2012 +.Dd August 4, 2012 .Dt USLCOM 4 .Os .Sh NAME .Nm uslcom -.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104 based USB serial adapter +.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105 based USB serial adapter .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -39,7 +39,7 @@ uslcom_load="YES" .Sh DESCRIPTION The .Nm -driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104 +driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105 based USB serial adapters. .Sh HARDWARE The following devices should work with the @@ -153,7 +153,7 @@ Renesas RX-Stick for RX610 .It Siemens MC60 Cable .It -Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104 chips +Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104/CP2105 chips .It Software Bisque Paramount ME .It @@ -208,6 +208,3 @@ The .Nm driver was written by .An Jonathan Gray Aq jsg@openbsd.org . -.Sh CAVEATS -On devices with multiple ports attached to a single chip, -only the first port is currently supported. Modified: stable/9/sys/dev/usb/serial/uslcom.c ============================================================================== --- stable/9/sys/dev/usb/serial/uslcom.c Wed Aug 29 12:44:17 2012 (r239825) +++ stable/9/sys/dev/usb/serial/uslcom.c Wed Aug 29 12:46:53 2012 (r239826) @@ -60,7 +60,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb #define USLCOM_BULK_BUF_SIZE 1024 #define USLCOM_CONFIG_INDEX 0 -#define USLCOM_IFACE_INDEX 0 #define USLCOM_SET_DATA_BITS(x) ((x) << 8) @@ -103,8 +102,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb #define USLCOM_PARITY_ODD 0x10 #define USLCOM_PARITY_EVEN 0x20 -#define USLCOM_PORT_NO 0x0000 - /* USLCOM_BREAK values */ #define USLCOM_BREAK_OFF 0x00 #define USLCOM_BREAK_ON 0x01 @@ -138,6 +135,7 @@ struct uslcom_softc { uint8_t sc_msr; uint8_t sc_lsr; + uint8_t sc_iface_no; }; static device_probe_t uslcom_probe; @@ -367,9 +365,6 @@ uslcom_probe(device_t dev) if (uaa->info.bConfigIndex != USLCOM_CONFIG_INDEX) { return (ENXIO); } - if (uaa->info.bIfaceIndex != USLCOM_IFACE_INDEX) { - return (ENXIO); - } return (usbd_lookup_id_by_uaa(uslcom_devs, sizeof(uslcom_devs), uaa)); } @@ -387,6 +382,8 @@ uslcom_attach(device_t dev) usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); sc->sc_udev = uaa->device; + /* use the interface number from the USB interface descriptor */ + sc->sc_iface_no = uaa->info.bIfaceNum; error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, @@ -441,7 +438,7 @@ uslcom_open(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_ENABLE); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -465,7 +462,7 @@ uslcom_close(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_DISABLE); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -489,7 +486,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -513,7 +510,7 @@ uslcom_set_rts(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -544,7 +541,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_BAUD_RATE; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(baudrate)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -581,7 +578,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_DATA; USETW(req.wValue, data); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -603,7 +600,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_FLOWCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(flowctrl)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -633,7 +630,7 @@ uslcom_set_break(struct ucom_softc *ucom req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_BREAK; USETW(req.wValue, brk); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -787,7 +784,7 @@ uslcom_control_callback(struct usb_xfer req.bmRequestType = USLCOM_READ; req.bRequest = USLCOM_RCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_iface_no); USETW(req.wLength, sizeof(buf)); usbd_xfer_set_frames(xfer, 2); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 13:10:35 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 744C3106564A; Wed, 29 Aug 2012 13:10:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DC4E8FC1F; Wed, 29 Aug 2012 13:10:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TDAZiL049530; Wed, 29 Aug 2012 13:10:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TDAZmX049528; Wed, 29 Aug 2012 13:10:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201208291310.q7TDAZmX049528@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Aug 2012 13:10:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239830 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 13:10:35 -0000 Author: bz Date: Wed Aug 29 13:10:34 2012 New Revision: 239830 URL: http://svn.freebsd.org/changeset/base/239830 Log: MFC 238934: Improve the should-never-hit printf to ease debugging in case we'd ever hit it again when doing the delayed IPv6 checksum calculations. Modified: stable/9/sys/netinet6/ip6_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Wed Aug 29 13:00:00 2012 (r239829) +++ stable/9/sys/netinet6/ip6_output.c Wed Aug 29 13:10:34 2012 (r239830) @@ -195,8 +195,9 @@ in6_delayed_cksum(struct mbuf *m, uint32 offset += m->m_pkthdr.csum_data; /* checksum offset */ if (offset + sizeof(u_short) > m->m_len) { - printf("%s: delayed m_pullup, m->len: %d off: %d\n", - __func__, m->m_len, offset); + printf("%s: delayed m_pullup, m->len: %d plen %u off %u " + "csum_flags=0x%04x\n", __func__, m->m_len, plen, offset, + m->m_pkthdr.csum_flags); /* * XXX this should not happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 13:14:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DEEA41065677; Wed, 29 Aug 2012 13:14:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA7B78FC0C; Wed, 29 Aug 2012 13:14:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TDEd3e050123; Wed, 29 Aug 2012 13:14:39 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TDEdiq050121; Wed, 29 Aug 2012 13:14:39 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201208291314.q7TDEdiq050121@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Aug 2012 13:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239831 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 13:14:40 -0000 Author: bz Date: Wed Aug 29 13:14:39 2012 New Revision: 239831 URL: http://svn.freebsd.org/changeset/base/239831 Log: MFC r238935: Properly apply #ifdef INET and leave a comment that we are (will) apply delayed IPv6 checksum processing in ip6_output.c when doing IPsec. PR: kern/170116 Modified: stable/9/sys/netinet6/ip6_ipsec.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_ipsec.c ============================================================================== --- stable/9/sys/netinet6/ip6_ipsec.c Wed Aug 29 13:10:34 2012 (r239830) +++ stable/9/sys/netinet6/ip6_ipsec.c Wed Aug 29 13:14:39 2012 (r239831) @@ -291,16 +291,16 @@ ip6_ipsec_output(struct mbuf **m, struct /* * Do delayed checksums now because we send before * this is done in the normal processing path. - * XXX-BZ CSUM_DELAY_DATA_IPV6? + * For IPv6 we do delayed checksums in ip6_output.c. */ +#ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); -#ifdef INET in_delayed_cksum(*m); -#endif (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } +#endif /* * Preserve KAME behaviour: ENOENT can be returned From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 13:19:28 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 487091065670; Wed, 29 Aug 2012 13:19:28 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 325FD8FC0A; Wed, 29 Aug 2012 13:19:28 +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 q7TDJSgo050853; Wed, 29 Aug 2012 13:19:28 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TDJSfE050851; Wed, 29 Aug 2012 13:19:28 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201208291319.q7TDJSfE050851@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 29 Aug 2012 13:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239832 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 13:19:28 -0000 Author: bz Date: Wed Aug 29 13:19:27 2012 New Revision: 239832 URL: http://svn.freebsd.org/changeset/base/239832 Log: MFC r238960: In case of IPsec he have to do delayed checksum calculations before adding any extension header, or rather before calling into IPsec processing as we may send the packet and not return to IPv6 output processing here. PR: kern/170116 Modified: stable/9/sys/netinet6/ip6_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Wed Aug 29 13:14:39 2012 (r239831) +++ stable/9/sys/netinet6/ip6_output.c Wed Aug 29 13:19:27 2012 (r239832) @@ -304,6 +304,20 @@ ip6_output(struct mbuf *m0, struct ip6_p goto freehdrs; case -1: /* Do IPSec */ needipsec = 1; + /* + * Do delayed checksums now, as we may send before returning. + */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + plen = m->m_pkthdr.len - sizeof(*ip6); + in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif case 0: /* No IPSec */ default: break; From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 13:28:07 2012 Return-Path: Delivered-To: svn-src-stable-9@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 937A21065675; Wed, 29 Aug 2012 13:28:07 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw5.york.ac.uk (mail-gw5.york.ac.uk [144.32.129.29]) by mx1.freebsd.org (Postfix) with ESMTP id 16C608FC08; Wed, 29 Aug 2012 13:28:00 +0000 (UTC) Received: from ury.york.ac.uk ([144.32.108.81]:49838 helo=ury.org.uk) by mail-gw5.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1T6iJF-0007WS-Rt; Wed, 29 Aug 2012 14:27:53 +0100 Received: from localhost ([127.0.0.1] helo=thunderhorn.york.ac.uk) by ury.org.uk with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80 (FreeBSD)) (envelope-from ) id 1T6iJF-0002Wn-HO; Wed, 29 Aug 2012 14:27:53 +0100 Received: from localhost (gavin@localhost) by thunderhorn.york.ac.uk (8.14.5/8.14.5/Submit) with ESMTP id q7TDRrOb009718; Wed, 29 Aug 2012 14:27:53 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: thunderhorn.york.ac.uk: gavin owned process doing -bs Date: Wed, 29 Aug 2012 14:27:53 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@thunderhorn.york.ac.uk To: John Baldwin In-Reply-To: <201208290746.03772.jhb@freebsd.org> Message-ID: References: <201208291123.q7TBNK6G035350@svn.freebsd.org> <201208290746.03772.jhb@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: gavin@FreeBSD.org X-SA-Exim-Scanned: No (on ury.org.uk); SAEximRunCond expanded to false Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org Subject: Re: svn commit: r239817 - in stable/9: share/man/man4 share/syscons/keymaps sys/dev/usb sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 13:28:07 -0000 On Wed, 29 Aug 2012, John Baldwin wrote: > On Wednesday, August 29, 2012 7:23:20 am Gavin Atkinson wrote: > > Author: gavin > > Date: Wed Aug 29 11:23:20 2012 > > New Revision: 239817 > > URL: http://svn.freebsd.org/changeset/base/239817 > > > > Log: > > Merge r238803, r238804 from head: > > > > Add support for more devices to uslcom(4). This commit syncronises the > > list of supported devices with the union of: > > > > Replaced: > > stable/9/share/syscons/keymaps/spanish.dvorak.kbd > > - copied unchanged from r235251, head/share/syscons/keymaps/spanish.dvorak.kbd > > This seems to be unrelated? Indeed it was, and it's not clear why this happened at all (it didn't show up in "svn diff", and I've never knowingly touched that file). Luckily, it apparently hasn't broken the SVN-CVS exporter. Gavin From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 13:28:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4C27106579E; Wed, 29 Aug 2012 13:28:26 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAD4B8FC28; Wed, 29 Aug 2012 13:28:26 +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 q7TDSQfi051998; Wed, 29 Aug 2012 13:28:26 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TDSQ6m051990; Wed, 29 Aug 2012 13:28:26 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201208291328.q7TDSQ6m051990@svn.freebsd.org> From: Isabell Long Date: Wed, 29 Aug 2012 13:28:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239833 - stable/9/lib/libc/locale X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 13:28:27 -0000 Author: issyl0 (doc committer) Date: Wed Aug 29 13:28:25 2012 New Revision: 239833 URL: http://svn.freebsd.org/changeset/base/239833 Log: MFC r238781, r238919 from HEAD: r238781: - Add a new man page containing details of new locale-specific functions for wctype.h, iswalnum_l(3). Add it and its functions to the Makefile. r238919: - Add more locale-specific functions to the relevant man pages and Makefile: - lib/libc/locale/islower.3 - lib/libc/locale/ispunct.3 - lib/libc/locale/nl_langinfo.3 - lib/libc/locale/isgraph.3 - lib/libc/locale/isspace.3 Approved by: gjb (mentor) Added: stable/9/lib/libc/locale/iswalnum_l.3 - copied unchanged from r238781, head/lib/libc/locale/iswalnum_l.3 Modified: stable/9/lib/libc/locale/Makefile.inc stable/9/lib/libc/locale/isgraph.3 stable/9/lib/libc/locale/islower.3 stable/9/lib/libc/locale/ispunct.3 stable/9/lib/libc/locale/isspace.3 stable/9/lib/libc/locale/nl_langinfo.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/Makefile.inc ============================================================================== --- stable/9/lib/libc/locale/Makefile.inc Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/Makefile.inc Wed Aug 29 13:28:25 2012 (r239833) @@ -30,7 +30,8 @@ MAN+= btowc.3 \ ctype.3 digittoint.3 isalnum.3 isalpha.3 isascii.3 isblank.3 iscntrl.3 \ isdigit.3 isgraph.3 isideogram.3 islower.3 isphonogram.3 isprint.3 \ ispunct.3 isrune.3 isspace.3 isspecial.3 \ - isupper.3 iswalnum.3 isxdigit.3 localeconv.3 mblen.3 mbrlen.3 \ + isupper.3 iswalnum.3 iswalnum_l.3 isxdigit.3 \ + localeconv.3 mblen.3 mbrlen.3 \ mbrtowc.3 \ mbsinit.3 \ mbsrtowcs.3 mbstowcs.3 mbtowc.3 multibyte.3 \ @@ -46,6 +47,11 @@ MAN+= big5.5 euc.5 gb18030.5 gb2312.5 gb MLINKS+=btowc.3 wctob.3 MLINKS+=isdigit.3 isnumber.3 +MLINKS+=isgraph.3 isgraph_l.3 +MLINKS+=islower.3 islower_l.3 +MLINKS+=ispunct.3 ispunct_l.3 +MLINKS+=isspace.3 isspace_l.3 +MLINKS+=nl_langinfo.3 nl_langinfo_l.3 MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswascii.3 iswalnum.3 iswblank.3 \ iswalnum.3 iswcntrl.3 iswalnum.3 iswdigit.3 iswalnum.3 iswgraph.3 \ iswalnum.3 iswhexnumber.3 \ @@ -53,6 +59,18 @@ MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswalnum.3 iswphonogram.3 iswalnum.3 iswprint.3 iswalnum.3 iswpunct.3 \ iswalnum.3 iswrune.3 iswalnum.3 iswspace.3 iswalnum.3 iswspecial.3 \ iswalnum.3 iswupper.3 iswalnum.3 iswxdigit.3 +MLINKS+=iswalnum_l.3 iswalpha_l.3 iswalnum_l.3 iswcntrl_l.3 \ + iswalnum_l.3 iswctype_l.3 iswalnum_l.3 iswdigit_l.3 \ + iswalnum_l.3 iswgraph_l.3 iswalnum_l.3 iswlower_l.3 \ + iswalnum_l.3 iswprint_l.3 iswalnum_l.3 iswpunct_l.3 \ + iswalnum_l.3 iswspace_l.3 iswalnum_l.3 iswupper_l.3 \ + iswalnum_l.3 iswxdigit_l.3 iswalnum_l.3 towlower_l.3 \ + iswalnum_l.3 towupper_l.3 iswalnum_l.3 wctype_l.3 \ + iswalnum_l.3 iswblank_l.3 iswalnum_l.3 iswhexnumber_l.3 \ + iswalnum_l.3 iswideogram_l.3 iswalnum_l.3 iswnumber_l.3 \ + iswalnum_l.3 iswphonogram_l.3 iswalnum_l.3 iswrune_l.3 \ + iswalnum_l.3 iswspecial_l.3 iswalnum_l.3 nextwctype_l.3 \ + iswalnum_l.3 towctrans_l.3 iswalnum_l.3 wctrans_l.3 MLINKS+=isxdigit.3 ishexnumber.3 MLINKS+=mbsrtowcs.3 mbsnrtowcs.3 MLINKS+=wcsrtombs.3 wcsnrtombs.3 Modified: stable/9/lib/libc/locale/isgraph.3 ============================================================================== --- stable/9/lib/libc/locale/isgraph.3 Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/isgraph.3 Wed Aug 29 13:28:25 2012 (r239833) @@ -32,7 +32,7 @@ .\" @(#)isgraph.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISGRAPH 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isgraph "int c" +.Ft int +.Fn isgraph_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isgraph @@ -80,11 +82,19 @@ In the ASCII character set, this include .It "\&166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y'' \t172\ ``z''" .It "\&173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" .El +.Pp +The +.Fn isgraph_l +function takes an explicit locale argument, whereas the +.Fn isgraph +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isgraph -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn isgraph_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -104,3 +114,7 @@ The .Fn isgraph function conforms to .St -isoC . +The +.Fn isgraph_l +function conforms to +.St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/islower.3 ============================================================================== --- stable/9/lib/libc/locale/islower.3 Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/islower.3 Wed Aug 29 13:28:25 2012 (r239833) @@ -32,7 +32,7 @@ .\" @(#)islower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISLOWER 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn islower "int c" +.Ft int +.Fn islower_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn islower @@ -64,11 +66,18 @@ In the ASCII character set, this include .It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" .It "\&172\ ``z''" .El +The +.Fn islower_l +function takes an explicit locale argument, whereas the +.Fn islower +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn islower -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn islower_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -89,3 +98,7 @@ The .Fn islower function conforms to .St -isoC . +The +.Fn islower_l +function conforms to +.St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/ispunct.3 ============================================================================== --- stable/9/lib/libc/locale/ispunct.3 Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/ispunct.3 Wed Aug 29 13:28:25 2012 (r239833) @@ -32,7 +32,7 @@ .\" @(#)ispunct.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISPUNCT 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn ispunct "int c" +.Ft int +.Fn ispunct_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn ispunct @@ -70,11 +72,19 @@ In the ASCII character set, this include .It "\&136\ ``^'' \t137\ ``_'' \t140\ ```'' \t173\ ``{'' \t174\ ``|''" .It "\&175\ ``}'' \t176\ ``~''" .El +.Pp +The +.Fn ispunct_l +function takes an explicit locale argument, whereas the +.Fn ispunct +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn ispunct -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn ispunct_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -94,3 +104,7 @@ The .Fn ispunct function conforms to .St -isoC . +The +.Fn ispunct_l +function conforms to +.St -p1003.1-2008 . Modified: stable/9/lib/libc/locale/isspace.3 ============================================================================== --- stable/9/lib/libc/locale/isspace.3 Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/isspace.3 Wed Aug 29 13:28:25 2012 (r239833) @@ -32,7 +32,7 @@ .\" @(#)isspace.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISSPACE 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isspace "int c" +.Ft int +.Fn isspace_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isspace @@ -61,11 +63,19 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +The +.Fn isspace_l +function takes an explicit locale argument, whereas the +.Fn isspace +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isspace -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn isspace_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -86,3 +96,7 @@ The .Fn isspace function conforms to .St -isoC . +The +.Fn isspace_l +function conforms to +.St -p1003.1-2008 . Copied: stable/9/lib/libc/locale/iswalnum_l.3 (from r238781, head/lib/libc/locale/iswalnum_l.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/locale/iswalnum_l.3 Wed Aug 29 13:28:25 2012 (r239833, copy of r238781, head/lib/libc/locale/iswalnum_l.3) @@ -0,0 +1,168 @@ +.\" Copyright (c) 2012 Isabell Long +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dt ISWALNUM_L 3 +.Dd July 25, 2012 +.Os +.Sh NAME +.Nm iswalnum_l , +.Nm iswalpha_l , +.Nm iswcntrl_l , +.Nm iswctype_l , +.Nm iswdigit_l , +.Nm iswgraph_l , +.Nm iswlower_l , +.Nm iswprint_l , +.Nm iswpunct_l , +.Nm iswspace_l , +.Nm iswupper_l , +.Nm iswxdigit_l , +.Nm towlower_l , +.Nm towupper_l , +.Nm wctype_l , +.Nm iswblank_l , +.Nm iswhexnumber_l , +.Nm iswideogram_l , +.Nm iswnumber_l , +.Nm iswphonogram_l , +.Nm iswrune_l , +.Nm iswspecial_l , +.Nm nextwctype_l , +.Nm towctrans_l , +.Nm wctrans_l +.Nd wide character classification utilities +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In wctype.h +.Ft int +.Fn iswalnum_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswalpha_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswcntrl_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswctype_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswdigit_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswgraph_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswlower_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswprint_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswpunct_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswspace_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswupper_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswxdigit_l "wint_t wc" "locale_t loc" +.Ft wint_t +.Fn towlower_l "wint_t wc" "locale_t loc" +.Ft wint_t +.Fn towupper_l "wint_t wc" "locale_t loc" +.Ft wctype_t +.Fn wctype_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswblank_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswhexnumber_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswideogram_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswnumber_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswphonogram_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswrune_l "wint_t wc" "locale_t loc" +.Ft int +.Fn iswspecial_l "wint_t wc" "locale_t loc" +.Ft wint_t +.Fn nextwctype_l "wint_t wc" "locale_t loc" +.Ft wint_t +.Fn towctrans_l "wint_t wc" "wctrans_t" "locale_t loc" +.Ft wctrans_t +.Fn wctrans_l "const char *" "locale_t loc" +.Sh DESCRIPTION +The above functions are character classification utility functions, +for use with wide characters +.Vt ( wchar_t +or +.Vt wint_t ) +in the locale +.Fa loc . +They behave in the same way as the versions without the _l suffix, but use +the specified locale rather than the global or per-thread locale. +These functions may be implemented as inline functions in +.In wctype.h +and as functions in the C library. +See the specific manual pages for more information. +.Sh RETURN VALUES +These functions return the same things as their non-locale versions. +If the locale is invalid, their behaviors are undefined. +.Sh SEE ALSO +.Xr iswalnum 3 , +.Xr iswalpha 3 , +.Xr iswblank 3 , +.Xr iswcntrl 3 , +.Xr iswctype 3 , +.Xr iswdigit 3 , +.Xr iswgraph 3 , +.Xr iswhexnumber 3 , +.Xr iswideogram 3 , +.Xr iswlower 3 , +.Xr iswnumber 3 , +.Xr iswphonogram 3 , +.Xr iswprint 3 , +.Xr iswpunct 3 , +.Xr iswrune 3 , +.Xr iswspace 3 , +.Xr iswspecial 3 , +.Xr iswupper 3 , +.Xr iswxdigit 3 , +.Xr nextwctype 3 , +.Xr towctrans 3 , +.Xr towlower 3 , +.Xr towupper 3 , +.Xr wctrans 3 , +.Xr wctype 3 +.Sh STANDARDS +These functions conform to +.St -p1003.1-2008 , +except for +.Fn iswascii_l , +.Fn iswhexnumber_l , +.Fn iswideogram_l , +.Fn iswphonogram_l , +.Fn iswrune_l , +.Fn iswspecial_l +and +.Fn nextwctype_l +which are +.Fx +extensions. Modified: stable/9/lib/libc/locale/nl_langinfo.3 ============================================================================== --- stable/9/lib/libc/locale/nl_langinfo.3 Wed Aug 29 13:19:27 2012 (r239832) +++ stable/9/lib/libc/locale/nl_langinfo.3 Wed Aug 29 13:28:25 2012 (r239833) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2001 +.Dd July 30, 2012 .Dt NL_LANGINFO 3 .Os .Sh NAME @@ -36,11 +36,16 @@ .In langinfo.h .Ft char * .Fn nl_langinfo "nl_item item" +.Ft char * +.Fn nl_langinfo_l "nl_item item" "locale_t loc" .Sh DESCRIPTION The .Fn nl_langinfo function returns a pointer to a string containing information relevant to -the particular language or cultural area defined in the program's locale. +the particular language or cultural area defined in the program or thread's +locale, or in the case of +.Fn nl_langinfo_l , +the locale passed as the second argument. The manifest constant names and values of .Fa item are defined in @@ -60,6 +65,9 @@ In a locale where langinfo data is not d returns a pointer to the corresponding string in the .Tn POSIX locale. +.Fn nl_langinfo_l +returns the same values as +.Fn nl_langinfo . In all locales, .Fn nl_langinfo returns a pointer to an empty string if @@ -83,6 +91,10 @@ The .Fn nl_langinfo function conforms to .St -susv2 . +The +.Fn nl_langinfo_l +function conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn nl_langinfo From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 14:06:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CC70106564A; Wed, 29 Aug 2012 14:06:59 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 369508FC08; Wed, 29 Aug 2012 14:06:59 +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 q7TE6xuR058085; Wed, 29 Aug 2012 14:06:59 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TE6wkr058083; Wed, 29 Aug 2012 14:06:59 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201208291406.q7TE6wkr058083@svn.freebsd.org> From: Isabell Long Date: Wed, 29 Aug 2012 14:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239834 - stable/9/sbin/geom/class/sched X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 14:06:59 -0000 Author: issyl0 (doc committer) Date: Wed Aug 29 14:06:58 2012 New Revision: 239834 URL: http://svn.freebsd.org/changeset/base/239834 Log: MFC r238813 from HEAD: - The ad(4) driver no longer exists in FreeBSD CURRENT or 9, so change the references to it in gsched(8) to the existing ada(4) driver. PR: docs/170085 Approved by: gjb (mentor) Modified: stable/9/sbin/geom/class/sched/gsched.8 Directory Properties: stable/9/sbin/geom/class/sched/ (props changed) Modified: stable/9/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/9/sbin/geom/class/sched/gsched.8 Wed Aug 29 13:28:25 2012 (r239833) +++ stable/9/sbin/geom/class/sched/gsched.8 Wed Aug 29 14:06:58 2012 (r239834) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2010 +.Dd July 26, 2012 .Dt GSCHED 8 .Os .Sh NAME @@ -135,19 +135,19 @@ maximum amount of debug information is p Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES The following example shows how to create a scheduling provider for disk -.Pa /dev/ad0 , +.Pa /dev/ada0 , and how to destroy it. .Bd -literal -offset indent # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: kldload gsched_rr -# Configure device ad0 to use scheduler "rr": -geom sched insert -a rr ad0 -# Now provider ad0 uses the "rr" algorithm; -# the new geom is ad0.sched. +# Configure device ada0 to use scheduler "rr": +geom sched insert -a rr ada0 +# Now provider ada0 uses the "rr" algorithm; +# the new geom is ada0.sched. # Remove the scheduler on the device: -geom sched destroy -v ad0.sched. +geom sched destroy -v ada0.sched. .Ed .Pp .Sh SEE ALSO From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:06:35 2012 Return-Path: Delivered-To: svn-src-stable-9@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 75F051065674; Wed, 29 Aug 2012 15:06:35 +0000 (UTC) Date: Wed, 29 Aug 2012 15:06:35 +0000 From: Alexey Dokuchaev To: Gavin Atkinson Message-ID: <20120829150635.GA43130@FreeBSD.org> References: <201208291123.q7TBNK6G035350@svn.freebsd.org> <201208290746.03772.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org, John Baldwin Subject: Re: svn commit: r239817 - in stable/9: share/man/man4 share/syscons/keymaps sys/dev/usb sys/dev/usb/serial X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:06:35 -0000 On Wed, Aug 29, 2012 at 02:27:53PM +0100, Gavin Atkinson wrote: > Indeed it was, and it's not clear why this happened at all (it didn't show > up in "svn diff", and I've never knowingly touched that file). Luckily, > it apparently hasn't broken the SVN-CVS exporter. I would not trust "svn diff" to reveal all uncommitted changes. "svn st" is better suited for this. ./danfe From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:13:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC71D106564A; Wed, 29 Aug 2012 15:13:13 +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 C41868FC14; Wed, 29 Aug 2012 15:13:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TFDDVf066183; Wed, 29 Aug 2012 15:13:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFDDTd066174; Wed, 29 Aug 2012 15:13:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291513.q7TFDDTd066174@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239835 - in stable/9/sys: conf kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:13:14 -0000 Author: kib Date: Wed Aug 29 15:13:13 2012 New Revision: 239835 URL: http://svn.freebsd.org/changeset/base/239835 Log: MFC r236317: Add a rangelock implementation, intended to be used to range-locking the i/o regions of the vnode data space. The implementation is quite simple-minded, it uses the list of the lock requests, ordered by arrival time. Each request may be for read or for write. The implementation is fair FIFO. Added: stable/9/sys/kern/kern_rangelock.c - copied unchanged from r236317, head/sys/kern/kern_rangelock.c stable/9/sys/sys/rangelock.h - copied unchanged from r236317, head/sys/sys/rangelock.h Modified: stable/9/sys/conf/files stable/9/sys/kern/kern_thread.c stable/9/sys/kern/vfs_subr.c stable/9/sys/sys/proc.h stable/9/sys/sys/vnode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Wed Aug 29 14:06:58 2012 (r239834) +++ stable/9/sys/conf/files Wed Aug 29 15:13:13 2012 (r239835) @@ -2381,6 +2381,7 @@ kern/kern_priv.c standard kern/kern_proc.c standard kern/kern_prot.c standard kern/kern_racct.c standard +kern/kern_rangelock.c standard kern/kern_rctl.c standard kern/kern_resource.c standard kern/kern_rmlock.c standard Copied: stable/9/sys/kern/kern_rangelock.c (from r236317, head/sys/kern/kern_rangelock.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/kern/kern_rangelock.c Wed Aug 29 15:13:13 2012 (r239835, copy of r236317, head/sys/kern/kern_rangelock.c) @@ -0,0 +1,246 @@ +/*- + * Copyright (c) 2009 Konstantin Belousov + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct rl_q_entry { + TAILQ_ENTRY(rl_q_entry) rl_q_link; + off_t rl_q_start, rl_q_end; + int rl_q_flags; +}; + +static uma_zone_t rl_entry_zone; + +static void +rangelock_sys_init(void) +{ + + rl_entry_zone = uma_zcreate("rl_entry", sizeof(struct rl_q_entry), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); +} +SYSINIT(vfs, SI_SUB_LOCK, SI_ORDER_ANY, rangelock_sys_init, NULL); + +static struct rl_q_entry * +rlqentry_alloc(void) +{ + + return (uma_zalloc(rl_entry_zone, M_WAITOK)); +} + +void +rlqentry_free(struct rl_q_entry *rleq) +{ + + uma_zfree(rl_entry_zone, rleq); +} + +void +rangelock_init(struct rangelock *lock) +{ + + TAILQ_INIT(&lock->rl_waiters); + lock->rl_currdep = NULL; +} + +void +rangelock_destroy(struct rangelock *lock) +{ + + KASSERT(TAILQ_EMPTY(&lock->rl_waiters), ("Dangling waiters")); +} + +/* + * Verifies the supplied rl_q_entries for compatibility. Returns true + * if the rangelock queue entries are not compatible, false if they are. + * + * Two entries are compatible if their ranges do not overlap, or both + * entries are for read. + */ +static int +rangelock_incompatible(const struct rl_q_entry *e1, + const struct rl_q_entry *e2) +{ + + if ((e1->rl_q_flags & RL_LOCK_TYPE_MASK) == RL_LOCK_READ && + (e2->rl_q_flags & RL_LOCK_TYPE_MASK) == RL_LOCK_READ) + return (0); + if (e1->rl_q_start < e2->rl_q_end && e1->rl_q_end > e2->rl_q_start) + return (1); + return (0); +} + +/* + * Recalculate the lock->rl_currdep after an unlock. + */ +static void +rangelock_calc_block(struct rangelock *lock) +{ + struct rl_q_entry *entry, *entry1, *whead; + + if (lock->rl_currdep == TAILQ_FIRST(&lock->rl_waiters) && + lock->rl_currdep != NULL) + lock->rl_currdep = TAILQ_NEXT(lock->rl_currdep, rl_q_link); + for (entry = lock->rl_currdep; entry != NULL; + entry = TAILQ_NEXT(entry, rl_q_link)) { + TAILQ_FOREACH(entry1, &lock->rl_waiters, rl_q_link) { + if (rangelock_incompatible(entry, entry1)) + goto out; + if (entry1 == entry) + break; + } + } +out: + lock->rl_currdep = entry; + TAILQ_FOREACH(whead, &lock->rl_waiters, rl_q_link) { + if (whead == lock->rl_currdep) + break; + if (!(whead->rl_q_flags & RL_LOCK_GRANTED)) { + whead->rl_q_flags |= RL_LOCK_GRANTED; + wakeup(whead); + } + } +} + +static void +rangelock_unlock_locked(struct rangelock *lock, struct rl_q_entry *entry, + struct mtx *ilk) +{ + + MPASS(lock != NULL && entry != NULL && ilk != NULL); + mtx_assert(ilk, MA_OWNED); + KASSERT(entry != lock->rl_currdep, ("stuck currdep")); + + TAILQ_REMOVE(&lock->rl_waiters, entry, rl_q_link); + rangelock_calc_block(lock); + mtx_unlock(ilk); + if (curthread->td_rlqe == NULL) + curthread->td_rlqe = entry; + else + rlqentry_free(entry); +} + +void +rangelock_unlock(struct rangelock *lock, void *cookie, struct mtx *ilk) +{ + + MPASS(lock != NULL && cookie != NULL && ilk != NULL); + + mtx_lock(ilk); + rangelock_unlock_locked(lock, cookie, ilk); +} + +/* + * Unlock the sub-range of granted lock. + */ +void * +rangelock_unlock_range(struct rangelock *lock, void *cookie, off_t start, + off_t end, struct mtx *ilk) +{ + struct rl_q_entry *entry; + + MPASS(lock != NULL && cookie != NULL && ilk != NULL); + entry = cookie; + KASSERT(entry->rl_q_flags & RL_LOCK_GRANTED, + ("Unlocking non-granted lock")); + KASSERT(entry->rl_q_start == start, ("wrong start")); + KASSERT(entry->rl_q_end >= end, ("wrong end")); + + mtx_lock(ilk); + if (entry->rl_q_end == end) { + rangelock_unlock_locked(lock, cookie, ilk); + return (NULL); + } + entry->rl_q_end = end; + rangelock_calc_block(lock); + mtx_unlock(ilk); + return (cookie); +} + +/* + * Add the lock request to the queue of the pending requests for + * rangelock. Sleep until the request can be granted. + */ +static void * +rangelock_enqueue(struct rangelock *lock, off_t start, off_t end, int mode, + struct mtx *ilk) +{ + struct rl_q_entry *entry; + struct thread *td; + + MPASS(lock != NULL && ilk != NULL); + + td = curthread; + if (td->td_rlqe != NULL) { + entry = td->td_rlqe; + td->td_rlqe = NULL; + } else + entry = rlqentry_alloc(); + MPASS(entry != NULL); + entry->rl_q_flags = mode; + entry->rl_q_start = start; + entry->rl_q_end = end; + + mtx_lock(ilk); + /* + * XXXKIB TODO. Check that a thread does not try to enqueue a + * lock that is incompatible with another request from the same + * thread. + */ + + TAILQ_INSERT_TAIL(&lock->rl_waiters, entry, rl_q_link); + if (lock->rl_currdep == NULL) + lock->rl_currdep = entry; + rangelock_calc_block(lock); + while (!(entry->rl_q_flags & RL_LOCK_GRANTED)) + msleep(entry, ilk, 0, "range", 0); + mtx_unlock(ilk); + return (entry); +} + +void * +rangelock_rlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) +{ + + return (rangelock_enqueue(lock, start, end, RL_LOCK_READ, ilk)); +} + +void * +rangelock_wlock(struct rangelock *lock, off_t start, off_t end, struct mtx *ilk) +{ + + return (rangelock_enqueue(lock, start, end, RL_LOCK_WRITE, ilk)); +} Modified: stable/9/sys/kern/kern_thread.c ============================================================================== --- stable/9/sys/kern/kern_thread.c Wed Aug 29 14:06:58 2012 (r239834) +++ stable/9/sys/kern/kern_thread.c Wed Aug 29 15:13:13 2012 (r239835) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -205,6 +206,7 @@ thread_init(void *mem, int size, int fla td->td_sleepqueue = sleepq_alloc(); td->td_turnstile = turnstile_alloc(); + td->td_rlqe = NULL; EVENTHANDLER_INVOKE(thread_init, td); td->td_sched = (struct td_sched *)&td[1]; umtx_thread_init(td); @@ -222,6 +224,7 @@ thread_fini(void *mem, int size) td = (struct thread *)mem; EVENTHANDLER_INVOKE(thread_fini, td); + rlqentry_free(td->td_rlqe); turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); umtx_thread_fini(td); Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Wed Aug 29 14:06:58 2012 (r239834) +++ stable/9/sys/kern/vfs_subr.c Wed Aug 29 15:13:13 2012 (r239835) @@ -1026,6 +1026,7 @@ alloc: if ((mp->mnt_kern_flag & MNTK_NOKNOTE) != 0) vp->v_vflag |= VV_NOKNOTE; } + rangelock_init(&vp->v_rl); *vpp = vp; return (0); @@ -2468,6 +2469,7 @@ vdropl(struct vnode *vp) /* XXX Elsewhere we detect an already freed vnode via NULL v_op. */ vp->v_op = NULL; #endif + rangelock_destroy(&vp->v_rl); lockdestroy(vp->v_vnlock); mtx_destroy(&vp->v_interlock); mtx_destroy(BO_MTX(bo)); Modified: stable/9/sys/sys/proc.h ============================================================================== --- stable/9/sys/sys/proc.h Wed Aug 29 14:06:58 2012 (r239834) +++ stable/9/sys/sys/proc.h Wed Aug 29 15:13:13 2012 (r239835) @@ -313,6 +313,7 @@ struct thread { const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */ struct trapframe *td_intr_frame;/* (k) Frame of the current irq */ struct proc *td_rfppwait_p; /* (k) The vforked child */ + struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */ }; struct mtx *thread_lock_block(struct thread *); Copied: stable/9/sys/sys/rangelock.h (from r236317, head/sys/sys/rangelock.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/sys/rangelock.h Wed Aug 29 15:13:13 2012 (r239835, copy of r236317, head/sys/sys/rangelock.h) @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2009 Konstantin Belousov + * 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 unmodified, 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_RANGELOCK_H +#define _SYS_RANGELOCK_H + +#include + +#define RL_LOCK_READ 0x0001 +#define RL_LOCK_WRITE 0x0002 +#define RL_LOCK_TYPE_MASK 0x0003 +#define RL_LOCK_GRANTED 0x0004 + +struct rl_q_entry; + +/* + * The structure representing the range lock. Caller may request + * read or write access to the range of bytes. Access is granted if + * all existing lock owners are compatible with the request. Two lock + * owners are compatible if their ranges do not overlap, or both + * owners are for read. + * + * Access to the structure itself is synchronized with the externally + * supplied mutex. + * + * rl_waiters is the queue of lock requests in the order of arrival. + * rl_currdep is the first lock request that cannot be granted now due + * to the preceding requests conflicting with it. + */ +struct rangelock { + TAILQ_HEAD(, rl_q_entry) rl_waiters; + struct rl_q_entry *rl_currdep; +}; + +#ifdef _KERNEL + +struct mtx; + +void rangelock_init(struct rangelock *lock); +void rangelock_destroy(struct rangelock *lock); +void rangelock_unlock(struct rangelock *lock, void *cookie, + struct mtx *ilk); +void *rangelock_unlock_range(struct rangelock *lock, void *cookie, + off_t start, off_t end, struct mtx *ilk); +void *rangelock_rlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk); +void *rangelock_wlock(struct rangelock *lock, off_t start, off_t end, + struct mtx *ilk); +void rlqentry_free(struct rl_q_entry *rlqe); + +#endif /* _KERNEL */ + +#endif /* _SYS_RANGELOCK_H */ Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Wed Aug 29 14:06:58 2012 (r239834) +++ stable/9/sys/sys/vnode.h Wed Aug 29 15:13:13 2012 (r239835) @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,7 @@ struct vnode { struct vpollinfo *v_pollinfo; /* i Poll events, p for *v_pi */ struct label *v_label; /* MAC label for vnode */ struct lockf *v_lockf; /* Byte-level advisory lock list */ + struct rangelock v_rl; /* Byte-range lock */ }; #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ @@ -682,6 +684,15 @@ int vn_extattr_rm(struct vnode *vp, int int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp); +#define vn_rangelock_unlock(vp, cookie) \ + rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) +#define vn_rangelock_unlock_range(vp, cookie, start, end) \ + rangelock_unlock_range(&(vp)->v_rl, (cookie), (start), (end), \ + VI_MTX(vp)) +#define vn_rangelock_rlock(vp, start, end) \ + rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) +#define vn_rangelock_wlock(vp, start, end) \ + rangelock_wlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) int vfs_cache_lookup(struct vop_lookup_args *ap); void vfs_timestamp(struct timespec *); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:21:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8D3E1065677; Wed, 29 Aug 2012 15:21:27 +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 D22578FC1C; Wed, 29 Aug 2012 15:21:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TFLRD8067299; Wed, 29 Aug 2012 15:21:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFLRHO067294; Wed, 29 Aug 2012 15:21:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291521.q7TFLRHO067294@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239837 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:21:28 -0000 Author: kib Date: Wed Aug 29 15:21:27 2012 New Revision: 239837 URL: http://svn.freebsd.org/changeset/base/239837 Log: MFC r236321: Add vn_io_fault(), which is a facility to prevent page faults while filesystems perform copyin/copyout of the file data into the usermode buffer. Modified: stable/9/sys/kern/vfs_vnops.c stable/9/sys/sys/mount.h stable/9/sys/sys/proc.h stable/9/sys/sys/vnode.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:18:56 2012 (r239836) +++ stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:21:27 2012 (r239837) @@ -65,10 +65,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include +#include static fo_rdwr_t vn_read; static fo_rdwr_t vn_write; +static fo_rdwr_t vn_io_fault; static fo_truncate_t vn_truncate; static fo_ioctl_t vn_ioctl; static fo_poll_t vn_poll; @@ -77,8 +82,8 @@ static fo_stat_t vn_statfile; static fo_close_t vn_closefile; struct fileops vnops = { - .fo_read = vn_read, - .fo_write = vn_write, + .fo_read = vn_io_fault, + .fo_write = vn_io_fault, .fo_truncate = vn_truncate, .fo_ioctl = vn_ioctl, .fo_poll = vn_poll, @@ -362,57 +367,56 @@ sequential_heuristic(struct uio *uio, st * Package up an I/O request on a vnode into a uio and do it. */ int -vn_rdwr(rw, vp, base, len, offset, segflg, ioflg, active_cred, file_cred, - aresid, td) - enum uio_rw rw; - struct vnode *vp; - void *base; - int len; - off_t offset; - enum uio_seg segflg; - int ioflg; - struct ucred *active_cred; - struct ucred *file_cred; - ssize_t *aresid; - struct thread *td; +vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, + enum uio_seg segflg, int ioflg, struct ucred *active_cred, + struct ucred *file_cred, ssize_t *aresid, struct thread *td) { struct uio auio; struct iovec aiov; struct mount *mp; struct ucred *cred; + void *rl_cookie; int error, lock_flags; VFS_ASSERT_GIANT(vp->v_mount); + auio.uio_iov = &aiov; + auio.uio_iovcnt = 1; + aiov.iov_base = base; + aiov.iov_len = len; + auio.uio_resid = len; + auio.uio_offset = offset; + auio.uio_segflg = segflg; + auio.uio_rw = rw; + auio.uio_td = td; + error = 0; + if ((ioflg & IO_NODELOCKED) == 0) { + if (rw == UIO_READ) { + rl_cookie = vn_rangelock_rlock(vp, offset, + offset + len); + } else { + rl_cookie = vn_rangelock_wlock(vp, offset, + offset + len); + } mp = NULL; if (rw == UIO_WRITE) { if (vp->v_type != VCHR && (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - return (error); + goto out; if (MNT_SHARED_WRITES(mp) || - ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) { + ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) lock_flags = LK_SHARED; - } else { + else lock_flags = LK_EXCLUSIVE; - } - vn_lock(vp, lock_flags | LK_RETRY); } else - vn_lock(vp, LK_SHARED | LK_RETRY); + lock_flags = LK_SHARED; + vn_lock(vp, lock_flags | LK_RETRY); + } else + rl_cookie = NULL; - } ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held"); - auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - aiov.iov_base = base; - aiov.iov_len = len; - auio.uio_resid = len; - auio.uio_offset = offset; - auio.uio_segflg = segflg; - auio.uio_rw = rw; - auio.uio_td = td; - error = 0; #ifdef MAC if ((ioflg & IO_NOMACCHECK) == 0) { if (rw == UIO_READ) @@ -424,7 +428,7 @@ vn_rdwr(rw, vp, base, len, offset, segfl } #endif if (error == 0) { - if (file_cred) + if (file_cred != NULL) cred = file_cred; else cred = active_cred; @@ -439,10 +443,13 @@ vn_rdwr(rw, vp, base, len, offset, segfl if (auio.uio_resid && error == 0) error = EIO; if ((ioflg & IO_NODELOCKED) == 0) { - if (rw == UIO_WRITE && vp->v_type != VCHR) - vn_finished_write(mp); VOP_UNLOCK(vp, 0); + if (mp != NULL) + vn_finished_write(mp); } + out: + if (rl_cookie != NULL) + vn_rangelock_unlock(vp, rl_cookie); return (error); } @@ -758,29 +765,269 @@ unlock: return (error); } +static const int io_hold_cnt = 16; + /* - * File table truncate routine. + * The vn_io_fault() is a wrapper around vn_read() and vn_write() to + * prevent the following deadlock: + * + * Assume that the thread A reads from the vnode vp1 into userspace + * buffer buf1 backed by the pages of vnode vp2. If a page in buf1 is + * currently not resident, then system ends up with the call chain + * vn_read() -> VOP_READ(vp1) -> uiomove() -> [Page Fault] -> + * vm_fault(buf1) -> vnode_pager_getpages(vp2) -> VOP_GETPAGES(vp2) + * which establishes lock order vp1->vn_lock, then vp2->vn_lock. + * If, at the same time, thread B reads from vnode vp2 into buffer buf2 + * backed by the pages of vnode vp1, and some page in buf2 is not + * resident, we get a reversed order vp2->vn_lock, then vp1->vn_lock. + * + * To prevent the lock order reversal and deadlock, vn_io_fault() does + * not allow page faults to happen during VOP_READ() or VOP_WRITE(). + * Instead, it first tries to do the whole range i/o with pagefaults + * disabled. If all pages in the i/o buffer are resident and mapped, + * VOP will succeed (ignoring the genuine filesystem errors). + * Otherwise, we get back EFAULT, and vn_io_fault() falls back to do + * i/o in chunks, with all pages in the chunk prefaulted and held + * using vm_fault_quick_hold_pages(). + * + * Filesystems using this deadlock avoidance scheme should use the + * array of the held pages from uio, saved in the curthread->td_ma, + * instead of doing uiomove(). A helper function + * vn_io_fault_uiomove() converts uiomove request into + * uiomove_fromphys() over td_ma array. + * + * Since vnode locks do not cover the whole i/o anymore, rangelocks + * make the current i/o request atomic with respect to other i/os and + * truncations. */ static int -vn_truncate(fp, length, active_cred, td) - struct file *fp; - off_t length; - struct ucred *active_cred; +vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred, + int flags, struct thread *td) +{ + vm_page_t ma[io_hold_cnt + 2]; + struct uio *uio_clone, short_uio; + struct iovec short_iovec[1]; + fo_rdwr_t *doio; + struct vnode *vp; + void *rl_cookie; + struct mount *mp; + vm_page_t *prev_td_ma; + int cnt, error, save, saveheld, prev_td_ma_cnt; + vm_offset_t addr, end; + vm_prot_t prot; + size_t len, resid; + ssize_t adv; + + if (uio->uio_rw == UIO_READ) + doio = vn_read; + else + doio = vn_write; + vp = fp->f_vnode; + if (uio->uio_segflg != UIO_USERSPACE || vp->v_type != VREG || + ((mp = vp->v_mount) != NULL && + (mp->mnt_kern_flag & MNTK_NO_IOPF) == 0)) + return (doio(fp, uio, active_cred, flags, td)); + + /* + * The UFS follows IO_UNIT directive and replays back both + * uio_offset and uio_resid if an error is encountered during the + * operation. But, since the iovec may be already advanced, + * uio is still in an inconsistent state. + * + * Cache a copy of the original uio, which is advanced to the redo + * point using UIO_NOCOPY below. + */ + uio_clone = cloneuio(uio); + resid = uio->uio_resid; + + short_uio.uio_segflg = UIO_USERSPACE; + short_uio.uio_rw = uio->uio_rw; + short_uio.uio_td = uio->uio_td; + + if (uio->uio_rw == UIO_READ) { + prot = VM_PROT_WRITE; + rl_cookie = vn_rangelock_rlock(vp, uio->uio_offset, + uio->uio_offset + uio->uio_resid); + } else { + prot = VM_PROT_READ; + if ((fp->f_flag & O_APPEND) != 0 || (flags & FOF_OFFSET) == 0) + /* For appenders, punt and lock the whole range. */ + rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); + else + rl_cookie = vn_rangelock_wlock(vp, uio->uio_offset, + uio->uio_offset + uio->uio_resid); + } + + save = vm_fault_disable_pagefaults(); + error = doio(fp, uio, active_cred, flags, td); + if (error != EFAULT) + goto out; + + uio_clone->uio_segflg = UIO_NOCOPY; + uiomove(NULL, resid - uio->uio_resid, uio_clone); + uio_clone->uio_segflg = uio->uio_segflg; + + saveheld = curthread_pflags_set(TDP_UIOHELD); + prev_td_ma = td->td_ma; + prev_td_ma_cnt = td->td_ma_cnt; + + while (uio_clone->uio_resid != 0) { + len = uio_clone->uio_iov->iov_len; + if (len == 0) { + KASSERT(uio_clone->uio_iovcnt >= 1, + ("iovcnt underflow")); + uio_clone->uio_iov++; + uio_clone->uio_iovcnt--; + continue; + } + + addr = (vm_offset_t)uio_clone->uio_iov->iov_base; + end = round_page(addr + len); + cnt = howmany(end - trunc_page(addr), PAGE_SIZE); + /* + * A perfectly misaligned address and length could cause + * both the start and the end of the chunk to use partial + * page. +2 accounts for such a situation. + */ + if (cnt > io_hold_cnt + 2) { + len = io_hold_cnt * PAGE_SIZE; + KASSERT(howmany(round_page(addr + len) - + trunc_page(addr), PAGE_SIZE) <= io_hold_cnt + 2, + ("cnt overflow")); + } + cnt = vm_fault_quick_hold_pages(&td->td_proc->p_vmspace->vm_map, + addr, len, prot, ma, io_hold_cnt + 2); + if (cnt == -1) { + error = EFAULT; + break; + } + short_uio.uio_iov = &short_iovec[0]; + short_iovec[0].iov_base = (void *)addr; + short_uio.uio_iovcnt = 1; + short_uio.uio_resid = short_iovec[0].iov_len = len; + short_uio.uio_offset = uio_clone->uio_offset; + td->td_ma = ma; + td->td_ma_cnt = cnt; + + error = doio(fp, &short_uio, active_cred, flags, td); + vm_page_unhold_pages(ma, cnt); + adv = len - short_uio.uio_resid; + + uio_clone->uio_iov->iov_base = + (char *)uio_clone->uio_iov->iov_base + adv; + uio_clone->uio_iov->iov_len -= adv; + uio_clone->uio_resid -= adv; + uio_clone->uio_offset += adv; + + uio->uio_resid -= adv; + uio->uio_offset += adv; + + if (error != 0 || adv == 0) + break; + } + td->td_ma = prev_td_ma; + td->td_ma_cnt = prev_td_ma_cnt; + curthread_pflags_restore(saveheld); +out: + vm_fault_enable_pagefaults(save); + vn_rangelock_unlock(vp, rl_cookie); + free(uio_clone, M_IOV); + return (error); +} + +/* + * Helper function to perform the requested uiomove operation using + * the held pages for io->uio_iov[0].iov_base buffer instead of + * copyin/copyout. Access to the pages with uiomove_fromphys() + * instead of iov_base prevents page faults that could occur due to + * pmap_collect() invalidating the mapping created by + * vm_fault_quick_hold_pages(), or pageout daemon, page laundry or + * object cleanup revoking the write access from page mappings. + * + * Filesystems specified MNTK_NO_IOPF shall use vn_io_fault_uiomove() + * instead of plain uiomove(). + */ +int +vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio) +{ + struct uio transp_uio; + struct iovec transp_iov[1]; struct thread *td; + size_t adv; + int error, pgadv; + + td = curthread; + if ((td->td_pflags & TDP_UIOHELD) == 0 || + uio->uio_segflg != UIO_USERSPACE) + return (uiomove(data, xfersize, uio)); + + KASSERT(uio->uio_iovcnt == 1, ("uio_iovcnt %d", uio->uio_iovcnt)); + transp_iov[0].iov_base = data; + transp_uio.uio_iov = &transp_iov[0]; + transp_uio.uio_iovcnt = 1; + if (xfersize > uio->uio_resid) + xfersize = uio->uio_resid; + transp_uio.uio_resid = transp_iov[0].iov_len = xfersize; + transp_uio.uio_offset = 0; + transp_uio.uio_segflg = UIO_SYSSPACE; + /* + * Since transp_iov points to data, and td_ma page array + * corresponds to original uio->uio_iov, we need to invert the + * direction of the i/o operation as passed to + * uiomove_fromphys(). + */ + switch (uio->uio_rw) { + case UIO_WRITE: + transp_uio.uio_rw = UIO_READ; + break; + case UIO_READ: + transp_uio.uio_rw = UIO_WRITE; + break; + } + transp_uio.uio_td = uio->uio_td; + error = uiomove_fromphys(td->td_ma, + ((vm_offset_t)uio->uio_iov->iov_base) & PAGE_MASK, + xfersize, &transp_uio); + adv = xfersize - transp_uio.uio_resid; + pgadv = + (((vm_offset_t)uio->uio_iov->iov_base + adv) >> PAGE_SHIFT) - + (((vm_offset_t)uio->uio_iov->iov_base) >> PAGE_SHIFT); + td->td_ma += pgadv; + KASSERT(td->td_ma_cnt >= pgadv, ("consumed pages %d %d", td->td_ma_cnt, + pgadv)); + td->td_ma_cnt -= pgadv; + uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + adv; + uio->uio_iov->iov_len -= adv; + uio->uio_resid -= adv; + uio->uio_offset += adv; + return (error); +} + +/* + * File table truncate routine. + */ +static int +vn_truncate(struct file *fp, off_t length, struct ucred *active_cred, + struct thread *td) { struct vattr vattr; struct mount *mp; struct vnode *vp; + void *rl_cookie; int vfslocked; int error; vp = fp->f_vnode; + + /* + * Lock the whole range for truncation. Otherwise split i/o + * might happen partly before and partly after the truncation. + */ + rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); vfslocked = VFS_LOCK_GIANT(vp->v_mount); error = vn_start_write(vp, &mp, V_WAIT | PCATCH); - if (error) { - VFS_UNLOCK_GIANT(vfslocked); - return (error); - } + if (error) + goto out1; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_type == VDIR) { error = EISDIR; @@ -800,7 +1047,9 @@ vn_truncate(fp, length, active_cred, td) out: VOP_UNLOCK(vp, 0); vn_finished_write(mp); +out1: VFS_UNLOCK_GIANT(vfslocked); + vn_rangelock_unlock(vp, rl_cookie); return (error); } Modified: stable/9/sys/sys/mount.h ============================================================================== --- stable/9/sys/sys/mount.h Wed Aug 29 15:18:56 2012 (r239836) +++ stable/9/sys/sys/mount.h Wed Aug 29 15:21:27 2012 (r239837) @@ -371,6 +371,9 @@ void __mnt_vnode_markerfree(str #define MNTK_REFEXPIRE 0x00000020 /* refcount expiring is happening */ #define MNTK_EXTENDED_SHARED 0x00000040 /* Allow shared locking for more ops */ #define MNTK_SHARED_WRITES 0x00000080 /* Allow shared locking for writes */ +#define MNTK_NO_IOPF 0x00000100 /* Disallow page faults during reads + and writes. Filesystem shall properly + handle i/o state on EFAULT. */ #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: stable/9/sys/sys/proc.h ============================================================================== --- stable/9/sys/sys/proc.h Wed Aug 29 15:18:56 2012 (r239836) +++ stable/9/sys/sys/proc.h Wed Aug 29 15:21:27 2012 (r239837) @@ -312,7 +312,9 @@ struct thread { struct vnet *td_vnet; /* (k) Effective vnet. */ const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */ struct trapframe *td_intr_frame;/* (k) Frame of the current irq */ - struct proc *td_rfppwait_p; /* (k) The vforked child */ + struct proc *td_rfppwait_p; /* (k) The vforked child */ + struct vm_page **td_ma; /* (k) uio pages held */ + int td_ma_cnt; /* (k) size of *td_ma */ struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */ }; @@ -421,6 +423,7 @@ do { \ #define TDP_RFPPWAIT 0x02000000 /* Handle RFPPWAIT on syscall exit */ #define TDP_RESETSPUR 0x04000000 /* Reset spurious page fault history. */ #define TDP_NERRNO 0x08000000 /* Last errno is already in td_errno */ +#define TDP_UIOHELD 0x10000000 /* Current uio has pages held in td_ma */ /* * Reasons that the current thread can not be run yet. Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Wed Aug 29 15:18:56 2012 (r239836) +++ stable/9/sys/sys/vnode.h Wed Aug 29 15:21:27 2012 (r239837) @@ -684,6 +684,8 @@ int vn_extattr_rm(struct vnode *vp, int int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp); +int vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio); + #define vn_rangelock_unlock(vp, cookie) \ rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) #define vn_rangelock_unlock_range(vp, cookie, start, end) \ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:28:39 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30754106574F; Wed, 29 Aug 2012 15:28:39 +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 184F28FC19; Wed, 29 Aug 2012 15:28:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TFSc9e068200; Wed, 29 Aug 2012 15:28:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFScrj068198; Wed, 29 Aug 2012 15:28:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291528.q7TFScrj068198@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239838 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:28:39 -0000 Author: kib Date: Wed Aug 29 15:28:38 2012 New Revision: 239838 URL: http://svn.freebsd.org/changeset/base/239838 Log: MFC r236516: Count and export the number of prefaulting happen. Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:21:27 2012 (r239837) +++ stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:28:38 2012 (r239838) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -766,6 +767,9 @@ unlock: } static const int io_hold_cnt = 16; +static unsigned long vn_io_faults_cnt; +SYSCTL_LONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD, + &vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers"); /* * The vn_io_fault() is a wrapper around vn_read() and vn_write() to @@ -863,6 +867,7 @@ vn_io_fault(struct file *fp, struct uio if (error != EFAULT) goto out; + atomic_add_long(&vn_io_faults_cnt, 1); uio_clone->uio_segflg = UIO_NOCOPY; uiomove(NULL, resid - uio->uio_resid, uio_clone); uio_clone->uio_segflg = uio->uio_segflg; From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:34:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02F79106564A; Wed, 29 Aug 2012 15:34:27 +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 E17448FC1A; Wed, 29 Aug 2012 15:34:26 +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 q7TFYQVr069098; Wed, 29 Aug 2012 15:34:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFYQUn069096; Wed, 29 Aug 2012 15:34:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291534.q7TFYQUn069096@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239839 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:34:27 -0000 Author: kib Date: Wed Aug 29 15:34:26 2012 New Revision: 239839 URL: http://svn.freebsd.org/changeset/base/239839 Log: MFC r236517: Add a knob to disable vn_io_fault. MFC note: by default, vn_io_fault for stable/9 is disabled. Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:28:38 2012 (r239838) +++ stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:34:26 2012 (r239839) @@ -767,6 +767,9 @@ unlock: } static const int io_hold_cnt = 16; +static int vn_io_fault_enable = 0; +SYSCTL_INT(_debug, OID_AUTO, vn_io_fault_enable, CTLFLAG_RW, + &vn_io_fault_enable, 0, "Enable vn_io_fault lock avoidance"); static unsigned long vn_io_faults_cnt; SYSCTL_LONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD, &vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers"); @@ -829,7 +832,8 @@ vn_io_fault(struct file *fp, struct uio vp = fp->f_vnode; if (uio->uio_segflg != UIO_USERSPACE || vp->v_type != VREG || ((mp = vp->v_mount) != NULL && - (mp->mnt_kern_flag & MNTK_NO_IOPF) == 0)) + (mp->mnt_kern_flag & MNTK_NO_IOPF) == 0) || + !vn_io_fault_enable) return (doio(fp, uio, active_cred, flags, td)); /* From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:38:19 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11993106564A; Wed, 29 Aug 2012 15:38:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E649D8FC0A; Wed, 29 Aug 2012 15:38: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 q7TFcI5e069644; Wed, 29 Aug 2012 15:38:18 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFcIZK069634; Wed, 29 Aug 2012 15:38:18 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201208291538.q7TFcIZK069634@svn.freebsd.org> From: Glen Barber Date: Wed, 29 Aug 2012 15:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239841 - in stable/9/sys: amd64/conf arm/conf i386/conf pc98/conf sparc64/conf X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:38:19 -0000 Author: gjb (doc,ports committer) Date: Wed Aug 29 15:38:18 2012 New Revision: 239841 URL: http://svn.freebsd.org/changeset/base/239841 Log: MFC r239699: - Grammar fix: s/NIC's/NICs/ Modified: stable/9/sys/amd64/conf/GENERIC stable/9/sys/arm/conf/AVILA stable/9/sys/arm/conf/AVILA.hints stable/9/sys/arm/conf/CAMBRIA stable/9/sys/arm/conf/CAMBRIA.hints stable/9/sys/i386/conf/GENERIC stable/9/sys/i386/conf/PAE stable/9/sys/pc98/conf/GENERIC stable/9/sys/sparc64/conf/GENERIC Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/conf/GENERIC ============================================================================== --- stable/9/sys/amd64/conf/GENERIC Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/amd64/conf/GENERIC Wed Aug 29 15:38:18 2012 (r239841) @@ -253,7 +253,7 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. -device ath # Atheros NIC's +device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors Modified: stable/9/sys/arm/conf/AVILA ============================================================================== --- stable/9/sys/arm/conf/AVILA Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/arm/conf/AVILA Wed Aug 29 15:38:18 2012 (r239841) @@ -120,7 +120,7 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth -device ath # Atheros NIC's +device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue options ATH_DEBUG options ATH_DIAGAPI Modified: stable/9/sys/arm/conf/AVILA.hints ============================================================================== --- stable/9/sys/arm/conf/AVILA.hints Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/arm/conf/AVILA.hints Wed Aug 29 15:38:18 2012 (r239841) @@ -19,7 +19,7 @@ hint.uart.1.ier_rxbits=0x5d # NB: need U # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" -# NPE wired NIC's, requires ixpqmgr +# NPE wired NICs, requires ixpqmgr hint.npe.0.at="ixp0" hint.npe.0.npeid="B" hint.npe.0.mac="B" Modified: stable/9/sys/arm/conf/CAMBRIA ============================================================================== --- stable/9/sys/arm/conf/CAMBRIA Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/arm/conf/CAMBRIA Wed Aug 29 15:38:18 2012 (r239841) @@ -123,7 +123,7 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_xauth -device ath # Atheros NIC's +device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue options ATH_DEBUG options ATH_DIAGAPI Modified: stable/9/sys/arm/conf/CAMBRIA.hints ============================================================================== --- stable/9/sys/arm/conf/CAMBRIA.hints Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/arm/conf/CAMBRIA.hints Wed Aug 29 15:38:18 2012 (r239841) @@ -28,7 +28,7 @@ hint.uart.0.ier_rxbits=0x5d # NB: need U # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" -# NPE wired NIC's, requires ixpqmgr +# NPE wired NICs, requires ixpqmgr hint.npe.0.at="ixp0" hint.npe.0.npeid="C" hint.npe.0.mac="C" Modified: stable/9/sys/i386/conf/GENERIC ============================================================================== --- stable/9/sys/i386/conf/GENERIC Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/i386/conf/GENERIC Wed Aug 29 15:38:18 2012 (r239841) @@ -265,7 +265,7 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm device an # Aironet 4500/4800 802.11 wireless NICs. -device ath # Atheros NIC's +device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors Modified: stable/9/sys/i386/conf/PAE ============================================================================== --- stable/9/sys/i386/conf/PAE Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/i386/conf/PAE Wed Aug 29 15:38:18 2012 (r239841) @@ -76,7 +76,7 @@ nodevice sn nodevice xe nodevice an -nodevice ath # Atheros pci/cardbus NIC's +nodevice ath # Atheros pci/cardbus NICs nodevice ath_pci nodevice ath_hal nodevice ath_rate_sample # SampleRate tx rate control for ath Modified: stable/9/sys/pc98/conf/GENERIC ============================================================================== --- stable/9/sys/pc98/conf/GENERIC Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/pc98/conf/GENERIC Wed Aug 29 15:38:18 2012 (r239841) @@ -205,7 +205,7 @@ device xe # Xircom pccard Ethernet #device wlan_tkip # 802.11 TKIP support #device wlan_amrr # AMRR transmit rate control algorithm #device an # Aironet 4500/4800 802.11 wireless NICs. -#device ath # Atheros NIC's +#device ath # Atheros NICs #device ath_pci # Atheros pci/cardbus glue #device ath_hal # pci/cardbus chip support #options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors Modified: stable/9/sys/sparc64/conf/GENERIC ============================================================================== --- stable/9/sys/sparc64/conf/GENERIC Wed Aug 29 15:34:31 2012 (r239840) +++ stable/9/sys/sparc64/conf/GENERIC Wed Aug 29 15:38:18 2012 (r239841) @@ -193,7 +193,7 @@ device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm -device ath # Atheros NIC's +device ath # Atheros NICs device ath_pci # Atheros pci/cardbus glue device ath_hal # Atheros HAL (Hardware Access Layer) options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:41:18 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C6A71065670; Wed, 29 Aug 2012 15:41:18 +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 064FF8FC0A; Wed, 29 Aug 2012 15:41: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 q7TFfHt0070053; Wed, 29 Aug 2012 15:41:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFfHsR070051; Wed, 29 Aug 2012 15:41:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291541.q7TFfHsR070051@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239842 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:41:18 -0000 Author: kib Date: Wed Aug 29 15:41:17 2012 New Revision: 239842 URL: http://svn.freebsd.org/changeset/base/239842 Log: MFC r237365: Fix locking for f_offset, vn_read() and vn_write() cases only. Modified: stable/9/sys/kern/vfs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:38:18 2012 (r239841) +++ stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:41:17 2012 (r239842) @@ -512,6 +512,66 @@ vn_rdwr_inchunks(rw, vp, base, len, offs return (error); } +static void +foffset_lock(struct file *fp, struct uio *uio, int flags) +{ + struct mtx *mtxp; + + if ((flags & FOF_OFFSET) != 0) + return; + + /* + * According to McKusick the vn lock was protecting f_offset here. + * It is now protected by the FOFFSET_LOCKED flag. + */ + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vnread offlock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + uio->uio_offset = fp->f_offset; + mtx_unlock(mtxp); +} + +static int +get_advice(struct file *fp, struct uio *uio) +{ + struct mtx *mtxp; + int ret; + + ret = POSIX_FADV_NORMAL; + if (fp->f_advice == NULL) + return (ret); + + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + ret = fp->f_advice->fa_advice; + mtx_unlock(mtxp); + return (ret); +} + +static void +foffset_unlock(struct file *fp, struct uio *uio, int flags) +{ + struct mtx *mtxp; + + if ((flags & FOF_OFFSET) != 0) + return; + + fp->f_offset = uio->uio_offset; + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) + wakeup(&fp->f_vnread_flags); + fp->f_vnread_flags = 0; + mtx_unlock(mtxp); +} + /* * File table vnode read routine. */ @@ -524,44 +584,22 @@ vn_read(fp, uio, active_cred, flags, td) struct thread *td; { struct vnode *vp; - int error, ioflag; struct mtx *mtxp; + int error, ioflag; int advice, vfslocked; off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); - mtxp = NULL; + KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET")); vp = fp->f_vnode; ioflag = 0; if (fp->f_flag & FNONBLOCK) ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - advice = POSIX_FADV_NORMAL; + advice = get_advice(fp, uio); vfslocked = VFS_LOCK_GIANT(vp->v_mount); - /* - * According to McKusick the vn lock was protecting f_offset here. - * It is now protected by the FOFFSET_LOCKED flag. - */ - if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) { - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if ((flags & FOF_OFFSET) == 0) { - while (fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); - } - fp->f_vnread_flags |= FOFFSET_LOCKED; - uio->uio_offset = fp->f_offset; - } - if (fp->f_advice != NULL && - uio->uio_offset >= fp->f_advice->fa_start && - uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) - advice = fp->f_advice->fa_advice; - mtx_unlock(mtxp); - } vn_lock(vp, LK_SHARED | LK_RETRY); switch (advice) { @@ -581,14 +619,6 @@ vn_read(fp, uio, active_cred, flags, td) if (error == 0) #endif error = VOP_READ(vp, uio, ioflag, fp->f_cred); - if ((flags & FOF_OFFSET) == 0) { - fp->f_offset = uio->uio_offset; - mtx_lock(mtxp); - if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) - wakeup(&fp->f_vnread_flags); - fp->f_vnread_flags = 0; - mtx_unlock(mtxp); - } fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (error == 0 && advice == POSIX_FADV_NOREUSE && @@ -610,6 +640,7 @@ vn_read(fp, uio, active_cred, flags, td) */ start = offset; end = uio->uio_offset - 1; + mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); if (fp->f_advice != NULL && fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { @@ -641,13 +672,14 @@ vn_write(fp, uio, active_cred, flags, td { struct vnode *vp; struct mount *mp; - int error, ioflag, lock_flags; struct mtx *mtxp; + int error, ioflag, lock_flags; int advice, vfslocked; off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); + KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET")); vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type == VREG) @@ -666,6 +698,8 @@ vn_write(fp, uio, active_cred, flags, td if (vp->v_type != VCHR && (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto unlock; + + advice = get_advice(fp, uio); if ((MNT_SHARED_WRITES(mp) || ((mp == NULL) && MNT_SHARED_WRITES(vp->v_mount))) && @@ -676,19 +710,6 @@ vn_write(fp, uio, active_cred, flags, td } vn_lock(vp, lock_flags | LK_RETRY); - if ((flags & FOF_OFFSET) == 0) - uio->uio_offset = fp->f_offset; - advice = POSIX_FADV_NORMAL; - mtxp = NULL; - if (fp->f_advice != NULL) { - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - uio->uio_offset >= fp->f_advice->fa_start && - uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) - advice = fp->f_advice->fa_advice; - mtx_unlock(mtxp); - } switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: @@ -706,8 +727,6 @@ vn_write(fp, uio, active_cred, flags, td if (error == 0) #endif error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); - if ((flags & FOF_OFFSET) == 0) - fp->f_offset = uio->uio_offset; fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (vp->v_type != VCHR) @@ -746,6 +765,7 @@ vn_write(fp, uio, active_cred, flags, td */ start = offset; end = uio->uio_offset - 1; + mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); if (fp->f_advice != NULL && fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { @@ -830,11 +850,15 @@ vn_io_fault(struct file *fp, struct uio else doio = vn_write; vp = fp->f_vnode; + foffset_lock(fp, uio, flags); + if (uio->uio_segflg != UIO_USERSPACE || vp->v_type != VREG || ((mp = vp->v_mount) != NULL && (mp->mnt_kern_flag & MNTK_NO_IOPF) == 0) || - !vn_io_fault_enable) - return (doio(fp, uio, active_cred, flags, td)); + !vn_io_fault_enable) { + error = doio(fp, uio, active_cred, flags | FOF_OFFSET, td); + goto out_last; + } /* * The UFS follows IO_UNIT directive and replays back both @@ -867,7 +891,7 @@ vn_io_fault(struct file *fp, struct uio } save = vm_fault_disable_pagefaults(); - error = doio(fp, uio, active_cred, flags, td); + error = doio(fp, uio, active_cred, flags | FOF_OFFSET, td); if (error != EFAULT) goto out; @@ -918,7 +942,8 @@ vn_io_fault(struct file *fp, struct uio td->td_ma = ma; td->td_ma_cnt = cnt; - error = doio(fp, &short_uio, active_cred, flags, td); + error = doio(fp, &short_uio, active_cred, flags | FOF_OFFSET, + td); vm_page_unhold_pages(ma, cnt); adv = len - short_uio.uio_resid; @@ -941,6 +966,8 @@ out: vm_fault_enable_pagefaults(save); vn_rangelock_unlock(vp, rl_cookie); free(uio_clone, M_IOV); +out_last: + foffset_unlock(fp, uio, flags); return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:45:59 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A80E1106566C; Wed, 29 Aug 2012 15:45:59 +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 8FFD68FC14; Wed, 29 Aug 2012 15:45:59 +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 q7TFjxZ5070687; Wed, 29 Aug 2012 15:45:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFjxX0070678; Wed, 29 Aug 2012 15:45:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291545.q7TFjxX0070678@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239843 - in stable/9/sys: compat/linux fs/devfs kern sys ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:45:59 -0000 Author: kib Date: Wed Aug 29 15:45:58 2012 New Revision: 239843 URL: http://svn.freebsd.org/changeset/base/239843 Log: MFC r238029: Extend the KPI to lock and unlock f_offset member of struct file. It now fully encapsulates all accesses to f_offset, and extends f_offset locking to other consumers that need it, in particular, to lseek() and variants of getdirentries(). Modified: stable/9/sys/compat/linux/linux_file.c stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/kern/kern_descrip.c stable/9/sys/kern/vfs_syscalls.c stable/9/sys/kern/vfs_vnops.c stable/9/sys/sys/file.h stable/9/sys/ufs/ffs/ffs_alloc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/compat/linux/linux_file.c ============================================================================== --- stable/9/sys/compat/linux/linux_file.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/compat/linux/linux_file.c Wed Aug 29 15:45:58 2012 (r239843) @@ -354,15 +354,16 @@ getdents_common(struct thread *td, struc return (EBADF); } + off = foffset_lock(fp, 0); vp = fp->f_vnode; vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, off, 0); fdrop(fp, td); return (EINVAL); } - off = fp->f_offset; buflen = max(LINUX_DIRBLKSIZ, nbytes); buflen = min(buflen, MAXBSIZE); @@ -511,7 +512,6 @@ getdents_common(struct thread *td, struc goto eof; } - fp->f_offset = off; if (justone) nbytes = resid + linuxreclen; @@ -524,6 +524,7 @@ out: VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, off, 0); fdrop(fp, td); free(buf, M_TEMP); free(lbuf, M_TEMP); Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/fs/devfs/devfs_vnops.c Wed Aug 29 15:45:58 2012 (r239843) @@ -1170,18 +1170,14 @@ devfs_read_f(struct file *fp, struct uio if (ioflag & O_DIRECT) ioflag |= IO_DIRECT; - if ((flags & FOF_OFFSET) == 0) - uio->uio_offset = fp->f_offset; - + foffset_lock_uio(fp, uio, flags | FOF_NOLOCK); error = dsw->d_read(dev, uio, ioflag); if (uio->uio_resid != resid || (error == 0 && resid != 0)) vfs_timestamp(&dev->si_atime); td->td_fpop = fpop; dev_relthread(dev, ref); - if ((flags & FOF_OFFSET) == 0) - fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; + foffset_unlock_uio(fp, uio, flags | FOF_NOLOCK | FOF_NEXTOFF); return (error); } @@ -1648,8 +1644,7 @@ devfs_write_f(struct file *fp, struct ui ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT | O_FSYNC); if (ioflag & O_DIRECT) ioflag |= IO_DIRECT; - if ((flags & FOF_OFFSET) == 0) - uio->uio_offset = fp->f_offset; + foffset_lock_uio(fp, uio, flags | FOF_NOLOCK); resid = uio->uio_resid; @@ -1661,9 +1656,7 @@ devfs_write_f(struct file *fp, struct ui td->td_fpop = fpop; dev_relthread(dev, ref); - if ((flags & FOF_OFFSET) == 0) - fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; + foffset_unlock_uio(fp, uio, flags | FOF_NOLOCK | FOF_NEXTOFF); return (error); } Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/kern/kern_descrip.c Wed Aug 29 15:45:58 2012 (r239843) @@ -472,6 +472,7 @@ kern_fcntl(struct thread *td, int fd, in int vfslocked; u_int old, new; uint64_t bsize; + off_t foffset; vfslocked = 0; error = 0; @@ -613,14 +614,15 @@ kern_fcntl(struct thread *td, int fd, in } flp = (struct flock *)arg; if (flp->l_whence == SEEK_CUR) { - if (fp->f_offset < 0 || + foffset = foffset_get(fp); + if (foffset < 0 || (flp->l_start > 0 && - fp->f_offset > OFF_MAX - flp->l_start)) { + foffset > OFF_MAX - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; break; } - flp->l_start += fp->f_offset; + flp->l_start += foffset; } /* @@ -714,15 +716,16 @@ kern_fcntl(struct thread *td, int fd, in break; } if (flp->l_whence == SEEK_CUR) { + foffset = foffset_get(fp); if ((flp->l_start > 0 && - fp->f_offset > OFF_MAX - flp->l_start) || + foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - fp->f_offset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; break; } - flp->l_start += fp->f_offset; + flp->l_start += foffset; } /* * VOP_ADVLOCK() may block. @@ -2907,7 +2910,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) xf.xf_type = fp->f_type; xf.xf_count = fp->f_count; xf.xf_msgcount = 0; - xf.xf_offset = fp->f_offset; + xf.xf_offset = foffset_get(fp); xf.xf_flag = fp->f_flag; error = SYSCTL_OUT(req, &xf, sizeof(xf)); if (error) @@ -3112,7 +3115,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE kif->kf_flags |= KF_FLAG_DIRECT; if (fp->f_flag & FHASLOCK) kif->kf_flags |= KF_FLAG_HASLOCK; - kif->kf_offset = fp->f_offset; + kif->kf_offset = foffset_get(fp); if (vp != NULL) { vref(vp); switch (vp->v_type) { @@ -3456,7 +3459,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER } refcnt = fp->f_count; fflags = fp->f_flag; - offset = fp->f_offset; + offset = foffset_get(fp); /* * Create sysctl entry. Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/kern/vfs_syscalls.c Wed Aug 29 15:45:58 2012 (r239843) @@ -1992,7 +1992,7 @@ sys_lseek(td, uap) struct file *fp; struct vnode *vp; struct vattr vattr; - off_t offset, size; + off_t foffset, offset, size; int error, noneg; int vfslocked; @@ -2004,18 +2004,19 @@ sys_lseek(td, uap) return (ESPIPE); } vp = fp->f_vnode; + foffset = foffset_lock(fp, 0); vfslocked = VFS_LOCK_GIANT(vp->v_mount); noneg = (vp->v_type != VCHR); offset = uap->offset; switch (uap->whence) { case L_INCR: if (noneg && - (fp->f_offset < 0 || - (offset > 0 && fp->f_offset > OFF_MAX - offset))) { + (foffset < 0 || + (offset > 0 && foffset > OFF_MAX - offset))) { error = EOVERFLOW; break; } - offset += fp->f_offset; + offset += foffset; break; case L_XTND: vn_lock(vp, LK_SHARED | LK_RETRY); @@ -2055,12 +2056,12 @@ sys_lseek(td, uap) error = EINVAL; if (error != 0) goto drop; - fp->f_offset = offset; VFS_KNOTE_UNLOCKED(vp, 0); - *(off_t *)(td->td_retval) = fp->f_offset; + *(off_t *)(td->td_retval) = offset; drop: fdrop(fp, td); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, offset, error != 0 ? FOF_NOUPDATE : 0); return (error); } @@ -3993,6 +3994,7 @@ kern_ogetdirentries(struct thread *td, s caddr_t dirbuf; int error, eofflag, readcnt, vfslocked; long loff; + off_t foffset; /* XXX arbitrary sanity limit on `count'. */ if (uap->count > 64 * 1024) @@ -4005,10 +4007,12 @@ kern_ogetdirentries(struct thread *td, s return (EBADF); } vp = fp->f_vnode; + foffset = foffset_lock(fp, 0); unionread: vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, foffset, 0); fdrop(fp, td); return (EINVAL); } @@ -4021,12 +4025,13 @@ unionread: auio.uio_td = td; auio.uio_resid = uap->count; vn_lock(vp, LK_SHARED | LK_RETRY); - loff = auio.uio_offset = fp->f_offset; + loff = auio.uio_offset = foffset; #ifdef MAC error = mac_vnode_check_readdir(td->td_ucred, vp); if (error) { VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, foffset, FOF_NOUPDATE); fdrop(fp, td); return (error); } @@ -4035,7 +4040,7 @@ unionread: if (vp->v_mount->mnt_maxsymlinklen <= 0) { error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL); - fp->f_offset = auio.uio_offset; + foffset = auio.uio_offset; } else # endif { @@ -4047,7 +4052,7 @@ unionread: kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); - fp->f_offset = kuio.uio_offset; + foffset = kuio.uio_offset; if (error == 0) { readcnt = uap->count - kuio.uio_resid; edp = (struct dirent *)&dirbuf[readcnt]; @@ -4085,6 +4090,7 @@ unionread: if (error) { VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, foffset, 0); fdrop(fp, td); return (error); } @@ -4096,13 +4102,14 @@ unionread: VREF(vp); fp->f_vnode = vp; fp->f_data = vp; - fp->f_offset = 0; + foffset = 0; vput(tvp); VFS_UNLOCK_GIANT(vfslocked); goto unionread; } VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock(fp, foffset, 0); fdrop(fp, td); td->td_retval[0] = uap->count - auio.uio_resid; if (error == 0) @@ -4154,6 +4161,7 @@ kern_getdirentries(struct thread *td, in int vfslocked; long loff; int error, eofflag; + off_t foffset; AUDIT_ARG_FD(fd); auio.uio_resid = count; @@ -4167,6 +4175,7 @@ kern_getdirentries(struct thread *td, in return (EBADF); } vp = fp->f_vnode; + foffset = foffset_lock(fp, 0); unionread: vfslocked = VFS_LOCK_GIANT(vp->v_mount); if (vp->v_type != VDIR) { @@ -4183,14 +4192,14 @@ unionread: auio.uio_td = td; vn_lock(vp, LK_SHARED | LK_RETRY); AUDIT_ARG_VNODE1(vp); - loff = auio.uio_offset = fp->f_offset; + loff = auio.uio_offset = foffset; #ifdef MAC error = mac_vnode_check_readdir(td->td_ucred, vp); if (error == 0) #endif error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL); - fp->f_offset = auio.uio_offset; + foffset = auio.uio_offset; if (error) { VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); @@ -4204,7 +4213,7 @@ unionread: VREF(vp); fp->f_vnode = vp; fp->f_data = vp; - fp->f_offset = 0; + foffset = 0; vput(tvp); VFS_UNLOCK_GIANT(vfslocked); goto unionread; @@ -4214,6 +4223,7 @@ unionread: *basep = loff; td->td_retval[0] = count - auio.uio_resid; fail: + foffset_unlock(fp, foffset, 0); fdrop(fp, td); return (error); } Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/kern/vfs_vnops.c Wed Aug 29 15:45:58 2012 (r239843) @@ -512,13 +512,22 @@ vn_rdwr_inchunks(rw, vp, base, len, offs return (error); } -static void -foffset_lock(struct file *fp, struct uio *uio, int flags) +off_t +foffset_lock(struct file *fp, int flags) { struct mtx *mtxp; + off_t res; - if ((flags & FOF_OFFSET) != 0) - return; + KASSERT((flags & FOF_OFFSET) == 0, ("FOF_OFFSET passed")); + +#if OFF_MAX <= LONG_MAX + /* + * Caller only wants the current f_offset value. Assume that + * the long and shorter integer types reads are atomic. + */ + if ((flags & FOF_NOLOCK) != 0) + return (fp->f_offset); +#endif /* * According to McKusick the vn lock was protecting f_offset here. @@ -526,16 +535,68 @@ foffset_lock(struct file *fp, struct uio */ mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); - while (fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); + if ((flags & FOF_NOLOCK) == 0) { + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vofflock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + } + res = fp->f_offset; + mtx_unlock(mtxp); + return (res); +} + +void +foffset_unlock(struct file *fp, off_t val, int flags) +{ + struct mtx *mtxp; + + KASSERT((flags & FOF_OFFSET) == 0, ("FOF_OFFSET passed")); + +#if OFF_MAX <= LONG_MAX + if ((flags & FOF_NOLOCK) != 0) { + if ((flags & FOF_NOUPDATE) == 0) + fp->f_offset = val; + if ((flags & FOF_NEXTOFF) != 0) + fp->f_nextoff = val; + return; + } +#endif + + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if ((flags & FOF_NOUPDATE) == 0) + fp->f_offset = val; + if ((flags & FOF_NEXTOFF) != 0) + fp->f_nextoff = val; + if ((flags & FOF_NOLOCK) == 0) { + KASSERT((fp->f_vnread_flags & FOFFSET_LOCKED) != 0, + ("Lost FOFFSET_LOCKED")); + if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) + wakeup(&fp->f_vnread_flags); + fp->f_vnread_flags = 0; } - fp->f_vnread_flags |= FOFFSET_LOCKED; - uio->uio_offset = fp->f_offset; mtx_unlock(mtxp); } +void +foffset_lock_uio(struct file *fp, struct uio *uio, int flags) +{ + + if ((flags & FOF_OFFSET) == 0) + uio->uio_offset = foffset_lock(fp, flags); +} + +void +foffset_unlock_uio(struct file *fp, struct uio *uio, int flags) +{ + + if ((flags & FOF_OFFSET) == 0) + foffset_unlock(fp, uio->uio_offset, flags); +} + static int get_advice(struct file *fp, struct uio *uio) { @@ -555,23 +616,6 @@ get_advice(struct file *fp, struct uio * return (ret); } -static void -foffset_unlock(struct file *fp, struct uio *uio, int flags) -{ - struct mtx *mtxp; - - if ((flags & FOF_OFFSET) != 0) - return; - - fp->f_offset = uio->uio_offset; - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_vnread_flags & FOFFSET_LOCK_WAITING) - wakeup(&fp->f_vnread_flags); - fp->f_vnread_flags = 0; - mtx_unlock(mtxp); -} - /* * File table vnode read routine. */ @@ -850,7 +894,7 @@ vn_io_fault(struct file *fp, struct uio else doio = vn_write; vp = fp->f_vnode; - foffset_lock(fp, uio, flags); + foffset_lock_uio(fp, uio, flags); if (uio->uio_segflg != UIO_USERSPACE || vp->v_type != VREG || ((mp = vp->v_mount) != NULL && @@ -967,7 +1011,7 @@ out: vn_rangelock_unlock(vp, rl_cookie); free(uio_clone, M_IOV); out_last: - foffset_unlock(fp, uio, flags); + foffset_unlock_uio(fp, uio, flags); return (error); } Modified: stable/9/sys/sys/file.h ============================================================================== --- stable/9/sys/sys/file.h Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/sys/file.h Wed Aug 29 15:45:58 2012 (r239843) @@ -72,10 +72,25 @@ struct socket; struct file; struct ucred; +#define FOF_OFFSET 0x01 /* Use the offset in uio argument */ +#define FOF_NOLOCK 0x02 /* Do not take FOFFSET_LOCK */ +#define FOF_NEXTOFF 0x04 /* Also update f_nextoff */ +#define FOF_NOUPDATE 0x10 /* Do not update f_offset */ +off_t foffset_lock(struct file *fp, int flags); +void foffset_lock_uio(struct file *fp, struct uio *uio, int flags); +void foffset_unlock(struct file *fp, off_t val, int flags); +void foffset_unlock_uio(struct file *fp, struct uio *uio, int flags); + +static inline off_t +foffset_get(struct file *fp) +{ + + return (foffset_lock(fp, FOF_NOLOCK)); +} + typedef int fo_rdwr_t(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td); -#define FOF_OFFSET 1 /* Use the offset in uio argument */ typedef int fo_truncate_t(struct file *fp, off_t length, struct ucred *active_cred, struct thread *td); typedef int fo_ioctl_t(struct file *fp, u_long com, void *data, Modified: stable/9/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_alloc.c Wed Aug 29 15:41:17 2012 (r239842) +++ stable/9/sys/ufs/ffs/ffs_alloc.c Wed Aug 29 15:45:58 2012 (r239843) @@ -2871,10 +2871,9 @@ buffered_write(fp, uio, active_cred, fla if (ip->i_devvp != devvp) return (EINVAL); fs = ip->i_fs; + foffset_lock_uio(fp, uio, flags); vfslocked = VFS_LOCK_GIANT(ip->i_vnode->v_mount); vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); - if ((flags & FOF_OFFSET) == 0) - uio->uio_offset = fp->f_offset; #ifdef DEBUG if (fsckcmds) { printf("%s: buffered write for block %jd\n", @@ -2899,11 +2898,9 @@ buffered_write(fp, uio, active_cred, fla goto out; } error = bwrite(bp); - if ((flags & FOF_OFFSET) == 0) - fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; out: VOP_UNLOCK(devvp, 0); VFS_UNLOCK_GIANT(vfslocked); + foffset_unlock_uio(fp, uio, flags | FOF_NEXTOFF); return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:50:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCFF3106566C; Wed, 29 Aug 2012 15:50:09 +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 AD58D8FC14; Wed, 29 Aug 2012 15:50:09 +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 q7TFo9YM071262; Wed, 29 Aug 2012 15:50:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFo9mQ071260; Wed, 29 Aug 2012 15:50:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291550.q7TFo9mQ071260@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239845 - stable/9/sys/fs/nfsclient X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:50:10 -0000 Author: kib Date: Wed Aug 29 15:50:09 2012 New Revision: 239845 URL: http://svn.freebsd.org/changeset/base/239845 Log: MFC r236687: Improve handling of uiomove(9) errors for the NFS client. Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:46:01 2012 (r239844) +++ stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:50:09 2012 (r239845) @@ -873,8 +873,9 @@ ncl_write(struct vop_write_args *ap) struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; int bcount; - int n, on, error = 0; - off_t tmp_off; + int bp_cached, n, on, error = 0; + size_t orig_resid, local_resid; + off_t orig_size, tmp_off; KASSERT(uio->uio_rw == UIO_WRITE, ("ncl_write mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, @@ -926,6 +927,11 @@ flush_and_restart: mtx_unlock(&np->n_mtx); } + orig_resid = uio->uio_resid; + mtx_lock(&np->n_mtx); + orig_size = np->n_size; + mtx_unlock(&np->n_mtx); + /* * If IO_APPEND then load uio_offset. We restart here if we cannot * get the append lock. @@ -1103,7 +1109,10 @@ again: * normally. */ + bp_cached = 1; if (on == 0 && n == bcount) { + if ((bp->b_flags & B_CACHE) == 0) + bp_cached = 0; bp->b_flags |= B_CACHE; bp->b_flags &= ~B_INVAL; bp->b_ioflags &= ~BIO_ERROR; @@ -1169,8 +1178,24 @@ again: goto again; } + local_resid = uio->uio_resid; error = uiomove((char *)bp->b_data + on, n, uio); + if (error != 0 && !bp_cached) { + /* + * This block has no other content then what + * possibly was written by the faulty uiomove. + * Release it, forgetting the data pages, to + * prevent the leak of uninitialized data to + * usermode. + */ + bp->b_ioflags |= BIO_ERROR; + brelse(bp); + uio->uio_offset -= local_resid - uio->uio_resid; + uio->uio_resid = local_resid; + break; + } + /* * Since this block is being modified, it must be written * again and not just committed. Since write clustering does @@ -1179,17 +1204,18 @@ again: */ bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); - if (error) { - bp->b_ioflags |= BIO_ERROR; - brelse(bp); - break; - } + /* + * Get the partial update on the progress made from + * uiomove, if an error occured. + */ + if (error != 0) + n = local_resid - uio->uio_resid; /* * Only update dirtyoff/dirtyend if not a degenerate * condition. */ - if (n) { + if (n > 0) { if (bp->b_dirtyend > 0) { bp->b_dirtyoff = min(on, bp->b_dirtyoff); bp->b_dirtyend = max((on + n), bp->b_dirtyend); @@ -1218,8 +1244,22 @@ again: } else { bdwrite(bp); } + + if (error != 0) + break; } while (uio->uio_resid > 0 && n > 0); + if (error != 0) { + if (ioflag & IO_UNIT) { + VATTR_NULL(&vattr); + vattr.va_size = orig_size; + /* IO_SYNC is handled implicitely */ + (void)VOP_SETATTR(vp, &vattr, cred); + uio->uio_offset -= orig_resid - uio->uio_resid; + uio->uio_resid = orig_resid; + } + } + return (error); } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:53:28 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EB8B106566C; Wed, 29 Aug 2012 15:53:28 +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 295998FC12; Wed, 29 Aug 2012 15:53:28 +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 q7TFrS2T071766; Wed, 29 Aug 2012 15:53:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFrRlv071764; Wed, 29 Aug 2012 15:53:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291553.q7TFrRlv071764@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239848 - stable/9/sys/fs/nfsclient X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:53:28 -0000 Author: kib Date: Wed Aug 29 15:53:27 2012 New Revision: 239848 URL: http://svn.freebsd.org/changeset/base/239848 Log: MFC r237987: Do not override an error from uiomove() with (non-)error result from bwrite(). Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:51:40 2012 (r239847) +++ stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:53:27 2012 (r239848) @@ -873,7 +873,7 @@ ncl_write(struct vop_write_args *ap) struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; int bcount; - int bp_cached, n, on, error = 0; + int bp_cached, n, on, error = 0, error1; size_t orig_resid, local_resid; off_t orig_size, tmp_off; @@ -1235,9 +1235,12 @@ again: if ((ioflag & IO_SYNC)) { if (ioflag & IO_INVAL) bp->b_flags |= B_NOCACHE; - error = bwrite(bp); - if (error) + error1 = bwrite(bp); + if (error1 != 0) { + if (error == 0) + error = error1; break; + } } else if ((n + on) == biosize) { bp->b_flags |= B_ASYNC; (void) ncl_writebp(bp, 0, NULL); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:56:14 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C21D1065687; Wed, 29 Aug 2012 15:56:14 +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 769228FC0A; Wed, 29 Aug 2012 15:56:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7TFuEdr072220; Wed, 29 Aug 2012 15:56:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFuEik072217; Wed, 29 Aug 2012 15:56:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291556.q7TFuEik072217@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239850 - stable/9/sys/ufs/ffs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:56:14 -0000 Author: kib Date: Wed Aug 29 15:56:13 2012 New Revision: 239850 URL: http://svn.freebsd.org/changeset/base/239850 Log: MFC r236322: Enable vn_io_fault() lock avoidance for UFS. Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c stable/9/sys/ufs/ffs/ffs_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vfsops.c Wed Aug 29 15:55:54 2012 (r239849) +++ stable/9/sys/ufs/ffs/ffs_vfsops.c Wed Aug 29 15:56:13 2012 (r239850) @@ -1064,7 +1064,7 @@ ffs_mountfs(devvp, mp, td) */ MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | - MNTK_EXTENDED_SHARED; + MNTK_EXTENDED_SHARED | MNTK_NO_IOPF; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART Modified: stable/9/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_vnops.c Wed Aug 29 15:55:54 2012 (r239849) +++ stable/9/sys/ufs/ffs/ffs_vnops.c Wed Aug 29 15:56:13 2012 (r239850) @@ -567,7 +567,7 @@ ffs_read(ap) xfersize = size; } - error = uiomove((char *)bp->b_data + blkoffset, + error = vn_io_fault_uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); if (error) break; @@ -738,8 +738,8 @@ ffs_write(ap) if (size < xfersize) xfersize = size; - error = - uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + error = vn_io_fault_uiomove((char *)bp->b_data + blkoffset, + (int)xfersize, uio); /* * If the buffer is not already filled and we encounter an * error while trying to fill it, we have to clear out any From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 15:58:45 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07877106564A; Wed, 29 Aug 2012 15:58:45 +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 E55638FC19; Wed, 29 Aug 2012 15:58:44 +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 q7TFwi7J072633; Wed, 29 Aug 2012 15:58:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TFwihO072630; Wed, 29 Aug 2012 15:58:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291558.q7TFwihO072630@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 15:58:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239852 - stable/9/sys/fs/nfsclient X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 15:58:45 -0000 Author: kib Date: Wed Aug 29 15:58:44 2012 New Revision: 239852 URL: http://svn.freebsd.org/changeset/base/239852 Log: MFC r237367: Enable deadlock avoidance code for NFS client. Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:56:25 2012 (r239851) +++ stable/9/sys/fs/nfsclient/nfs_clbio.c Wed Aug 29 15:58:44 2012 (r239852) @@ -698,7 +698,7 @@ ncl_bioread(struct vnode *vp, struct uio }; if (n > 0) { - error = uiomove(bp->b_data + on, (int)n, uio); + error = vn_io_fault_uiomove(bp->b_data + on, (int)n, uio); } if (vp->v_type == VLNK) n = 0; @@ -1179,7 +1179,7 @@ again: } local_resid = uio->uio_resid; - error = uiomove((char *)bp->b_data + on, n, uio); + error = vn_io_fault_uiomove((char *)bp->b_data + on, n, uio); if (error != 0 && !bp_cached) { /* Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Wed Aug 29 15:56:25 2012 (r239851) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Wed Aug 29 15:58:44 2012 (r239852) @@ -1136,7 +1136,8 @@ nfs_mount(struct mount *mp) out: if (!error) { MNT_ILOCK(mp); - mp->mnt_kern_flag |= (MNTK_MPSAFE|MNTK_LOOKUP_SHARED); + mp->mnt_kern_flag |= MNTK_MPSAFE | MNTK_LOOKUP_SHARED | + MNTK_NO_IOPF; MNT_IUNLOCK(mp); } return (error); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:00:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 253821065675; Wed, 29 Aug 2012 16:00:27 +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 EA3FD8FC14; Wed, 29 Aug 2012 16:00:26 +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 q7TG0QEh072915; Wed, 29 Aug 2012 16:00:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TG0QCn072914; Wed, 29 Aug 2012 16:00:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291600.q7TG0QCn072914@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239853 - stable/9/tools/test/upsdl X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:00:27 -0000 Author: kib Date: Wed Aug 29 16:00:26 2012 New Revision: 239853 URL: http://svn.freebsd.org/changeset/base/239853 Log: MFC r238374: Add a test program, written by Stephan Uphoff, which demonstrates the deadlock due to i/o performed over the buffers backed by file mappings. Added: stable/9/tools/test/upsdl/ - copied from r238374, head/tools/test/upsdl/ Modified: Directory Properties: stable/9/tools/test/ (props changed) From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:11:04 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1C091065670; Wed, 29 Aug 2012 16:11:03 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D376B8FC1A; Wed, 29 Aug 2012 16:11: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 q7TGB3kf074850; Wed, 29 Aug 2012 16:11:03 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGB3xX074847; Wed, 29 Aug 2012 16:11:03 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201208291611.q7TGB3xX074847@svn.freebsd.org> From: Jamie Gritton Date: Wed, 29 Aug 2012 16:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239854 - stable/9/usr.sbin/jail X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:11:04 -0000 Author: jamie Date: Wed Aug 29 16:11:03 2012 New Revision: 239854 URL: http://svn.freebsd.org/changeset/base/239854 Log: MFC r239601: Remember that I'm using length-defined strings in parameters: Remove a bogus null terminator when stripping the netmask from IP addresses. This was causing later addresses in a comma-separated string to disappear. Use memcpy instead of strcpy. This could just cause Bad Things. MFC r239602: Pre-separate IP addresses passed on the command line, so they can be properly parsed for interface prefixes and netmask suffixes. This was already done for the old-style (fixed) command line, but missed for the new-style. MFC r239621: Partially roll back r239601 - keep parameter strings both length-delimited and null-terminated at the same time, because they're later passed to libjail as null-terminated. That means I also need to add a nul byte when comma-combining array parameters. PR: 170832 Modified: stable/9/usr.sbin/jail/config.c stable/9/usr.sbin/jail/jail.c Directory Properties: stable/9/usr.sbin/jail/ (props changed) Modified: stable/9/usr.sbin/jail/config.c ============================================================================== --- stable/9/usr.sbin/jail/config.c Wed Aug 29 16:00:26 2012 (r239853) +++ stable/9/usr.sbin/jail/config.c Wed Aug 29 16:11:03 2012 (r239854) @@ -596,7 +596,7 @@ check_intparams(struct cfjail *j) error = -1; } *cs = '\0'; - s->len = cs - s->s + 1; + s->len = cs - s->s; } } } @@ -620,7 +620,7 @@ check_intparams(struct cfjail *j) error = -1; } *cs = '\0'; - s->len = cs - s->s + 1; + s->len = cs - s->s; } } } @@ -712,12 +712,11 @@ import_params(struct cfjail *j) value = alloca(vallen); cs = value; TAILQ_FOREACH_SAFE(s, &p->val, tq, ts) { - strcpy(cs, s->s); - if (ts != NULL) { - cs += s->len + 1; - cs[-1] = ','; - } + memcpy(cs, s->s, s->len); + cs += s->len + 1; + cs[-1] = ','; } + value[vallen - 1] = '\0'; } if (jailparam_import(jp, value) < 0) { error = -1; Modified: stable/9/usr.sbin/jail/jail.c ============================================================================== --- stable/9/usr.sbin/jail/jail.c Wed Aug 29 16:00:26 2012 (r239853) +++ stable/9/usr.sbin/jail/jail.c Wed Aug 29 16:11:03 2012 (r239854) @@ -304,9 +304,33 @@ main(int argc, char **argv) for (i++; i < argc; i++) add_param(NULL, NULL, IP_COMMAND, argv[i]); - break; } - add_param(NULL, NULL, 0, argv[i]); +#ifdef INET + else if (!strncmp(argv[i], "ip4.addr=", 9)) { + for (cs = argv[i] + 9;; cs = ncs + 1) { + ncs = strchr(cs, ','); + if (ncs) + *ncs = '\0'; + add_param(NULL, NULL, KP_IP4_ADDR, cs); + if (!ncs) + break; + } + } +#endif +#ifdef INET6 + else if (!strncmp(argv[i], "ip6.addr=", 9)) { + for (cs = argv[i] + 9;; cs = ncs + 1) { + ncs = strchr(cs, ','); + if (ncs) + *ncs = '\0'; + add_param(NULL, NULL, KP_IP6_ADDR, cs); + if (!ncs) + break; + } + } +#endif + else + add_param(NULL, NULL, 0, argv[i]); } } else { /* From the config file, perhaps with a specified jail */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:17:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33565106566C; Wed, 29 Aug 2012 16:17:03 +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 EB2078FC14; Wed, 29 Aug 2012 16:17: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 q7TGH24F076290; Wed, 29 Aug 2012 16:17:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGH2KH076287; Wed, 29 Aug 2012 16:17:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291617.q7TGH2KH076287@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239856 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:17:03 -0000 Author: kib Date: Wed Aug 29 16:17:02 2012 New Revision: 239856 URL: http://svn.freebsd.org/changeset/base/239856 Log: MFC r238614: Implement F_DUPFD_CLOEXEC command for fcntl(2), specified by SUSv4. MFC r238627: Remove line which was accidentally kept in r238614. PR: standards/169962 Modified: stable/9/sys/kern/kern_descrip.c stable/9/sys/sys/fcntl.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Wed Aug 29 16:15:22 2012 (r239855) +++ stable/9/sys/kern/kern_descrip.c Wed Aug 29 16:17:02 2012 (r239856) @@ -113,6 +113,7 @@ static uma_zone_t file_zone; /* Flags for do_dup() */ #define DUP_FIXED 0x1 /* Force fixed allocation */ #define DUP_FCNTL 0x2 /* fcntl()-style errors */ +#define DUP_CLOEXEC 0x4 /* Atomically set FD_CLOEXEC. */ static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); @@ -486,6 +487,12 @@ kern_fcntl(struct thread *td, int fd, in error = do_dup(td, DUP_FCNTL, fd, tmp, td->td_retval); break; + case F_DUPFD_CLOEXEC: + tmp = arg; + error = do_dup(td, DUP_FCNTL | DUP_CLOEXEC, fd, tmp, + td->td_retval); + break; + case F_DUP2FD: tmp = arg; error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval); @@ -914,7 +921,10 @@ do_dup(struct thread *td, int flags, int * Duplicate the source descriptor */ fdp->fd_ofiles[new] = fp; - fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; + if ((flags & DUP_CLOEXEC) != 0) + fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] | UF_EXCLOSE; + else + fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] & ~UF_EXCLOSE; if (new > fdp->fd_lastfile) fdp->fd_lastfile = new; *retval = new; Modified: stable/9/sys/sys/fcntl.h ============================================================================== --- stable/9/sys/sys/fcntl.h Wed Aug 29 16:15:22 2012 (r239855) +++ stable/9/sys/sys/fcntl.h Wed Aug 29 16:17:02 2012 (r239856) @@ -225,6 +225,9 @@ typedef __pid_t pid_t; #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define F_READAHEAD 15 /* read ahead */ #define F_RDAHEAD 16 /* Darwin compatible read ahead */ +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ +#endif /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:23:30 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 99A53106564A; Wed, 29 Aug 2012 16:23:30 +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 8460E8FC18; Wed, 29 Aug 2012 16:23: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 q7TGNUTV077094; Wed, 29 Aug 2012 16:23:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGNURc077091; Wed, 29 Aug 2012 16:23:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291623.q7TGNURc077091@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239857 - in stable/9/sys: kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:23:30 -0000 Author: kib Date: Wed Aug 29 16:23:29 2012 New Revision: 239857 URL: http://svn.freebsd.org/changeset/base/239857 Log: MFC r238834: Add F_DUP2FD_CLOEXEC. PR: standards/169962 Modified: stable/9/sys/kern/kern_descrip.c stable/9/sys/sys/fcntl.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Wed Aug 29 16:17:02 2012 (r239856) +++ stable/9/sys/kern/kern_descrip.c Wed Aug 29 16:23:29 2012 (r239857) @@ -498,6 +498,12 @@ kern_fcntl(struct thread *td, int fd, in error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval); break; + case F_DUP2FD_CLOEXEC: + tmp = arg; + error = do_dup(td, DUP_FIXED | DUP_CLOEXEC, fd, tmp, + td->td_retval); + break; + case F_GETFD: FILEDESC_SLOCK(fdp); if ((fp = fdtofp(fd, fdp)) == NULL) { @@ -836,6 +842,8 @@ do_dup(struct thread *td, int flags, int } if (flags & DUP_FIXED && old == new) { *retval = new; + if (flags & DUP_CLOEXEC) + fdp->fd_ofileflags[new] |= UF_EXCLOSE; FILEDESC_XUNLOCK(fdp); return (0); } Modified: stable/9/sys/sys/fcntl.h ============================================================================== --- stable/9/sys/sys/fcntl.h Wed Aug 29 16:17:02 2012 (r239856) +++ stable/9/sys/sys/fcntl.h Wed Aug 29 16:23:29 2012 (r239857) @@ -228,6 +228,9 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif +#if __BSD_VISIBLE +#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */ +#endif /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:25:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B8D921065670; Wed, 29 Aug 2012 16:25:33 +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 A29A78FC0C; Wed, 29 Aug 2012 16:25:33 +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 q7TGPXJG077389; Wed, 29 Aug 2012 16:25:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGPXXO077387; Wed, 29 Aug 2012 16:25:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291625.q7TGPXXO077387@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239858 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:25:33 -0000 Author: kib Date: Wed Aug 29 16:25:33 2012 New Revision: 239858 URL: http://svn.freebsd.org/changeset/base/239858 Log: MFC r238615: Document F_DUPFD_CLOEXEC. Modified: stable/9/lib/libc/sys/fcntl.2 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/sys/fcntl.2 ============================================================================== --- stable/9/lib/libc/sys/fcntl.2 Wed Aug 29 16:23:29 2012 (r239857) +++ stable/9/lib/libc/sys/fcntl.2 Wed Aug 29 16:25:33 2012 (r239858) @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd September 28, 2009 +.Dd July 18, 2012 .Dt FCNTL 2 .Os .Sh NAME @@ -54,7 +54,7 @@ Depending on the value of .Fn fcntl can take an additional third argument .Fa "int arg" . -.Bl -tag -width F_GETOWNX +.Bl -tag -width F_DUPFD_CLOEXEC .It Dv F_DUPFD Return a new descriptor as follows: .Pp @@ -73,11 +73,22 @@ Same access mode (read, write or read/wr Same file status flags (i.e., both file descriptors share the same file status flags). .It -The close-on-exec flag associated with the new file descriptor -is set to remain open across +The close-on-exec flag +.Dv FD_CLOEXEC +associated with the new file descriptor is cleared, so the file descriptor is +to remain open across .Xr execve 2 system calls. .El +.It Dv F_DUPFD_CLOEXEC +Like +.Dv F_DUPFD , +but the +.Dv FD_CLOEXEC +flag associated with the new file descriptor is set, so the file descriptor +is closed when +.Xr execve 2 +system call executes. .It Dv F_DUP2FD It is functionally equivalent to .Bd -literal -offset indent From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 16:26:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CDAD8106566B; Wed, 29 Aug 2012 16:26:41 +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 B81048FC1C; Wed, 29 Aug 2012 16:26:41 +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 q7TGQfCr077581; Wed, 29 Aug 2012 16:26:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TGQfj9077579; Wed, 29 Aug 2012 16:26:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208291626.q7TGQfj9077579@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 29 Aug 2012 16:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239859 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 16:26:42 -0000 Author: kib Date: Wed Aug 29 16:26:41 2012 New Revision: 239859 URL: http://svn.freebsd.org/changeset/base/239859 Log: MFC r238835: Document F_DUP2FD_CLOEXEC. Modified: stable/9/lib/libc/sys/fcntl.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/fcntl.2 ============================================================================== --- stable/9/lib/libc/sys/fcntl.2 Wed Aug 29 16:25:33 2012 (r239858) +++ stable/9/lib/libc/sys/fcntl.2 Wed Aug 29 16:26:41 2012 (r239859) @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd July 18, 2012 +.Dd July 27, 2012 .Dt FCNTL 2 .Os .Sh NAME @@ -54,7 +54,7 @@ Depending on the value of .Fn fcntl can take an additional third argument .Fa "int arg" . -.Bl -tag -width F_DUPFD_CLOEXEC +.Bl -tag -width F_DUP2FD_CLOEXEC .It Dv F_DUPFD Return a new descriptor as follows: .Pp @@ -94,13 +94,23 @@ It is functionally equivalent to .Bd -literal -offset indent dup2(fd, arg) .Ed +.It Dv F_DU2PFD_CLOEXEC +Like +.Dv F_DUP2FD , +but the +.Dv FD_CLOEXEC +flag associated with the new file descriptor is set. .Pp The .Dv F_DUP2FD -constant is not portable, so it should not be used if portability is needed. +and +.Dv F_DUP2DF_CLOEXEC +constants are not portable, so they should not be used if +portability is needed. Use .Fn dup2 -instead. +instead of +.Dv F_DUP2FD . .It Dv F_GETFD Get the close-on-exec flag associated with the file descriptor .Fa fd From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 17:36:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A057D1065670; Wed, 29 Aug 2012 17:36:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AD1B8FC0A; Wed, 29 Aug 2012 17:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7THaCvN086412; Wed, 29 Aug 2012 17:36:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7THaCEm086409; Wed, 29 Aug 2012 17:36:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291736.q7THaCEm086409@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 17:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239866 - stable/9/sys/dev/mfi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 17:36:12 -0000 Author: jhb Date: Wed Aug 29 17:36:12 2012 New Revision: 239866 URL: http://svn.freebsd.org/changeset/base/239866 Log: MFC 238077: Fix panics triggered by older mfiutil binaries run on the new mfi(4) driver. The new driver changed the size of the mfi_dcmd_frame structure in such a way that a MFI_IOC_PASSTHRU ioctl from an old amd64 binary is treated as an MFI_IOC_PASSTHRU32 ioctl in the new driver. As a result, the user pointer is treated as the buffer length. mfi_user_command() doesn't have a bounds check on the buffer length, so it passes a really big value to malloc() which panics when it tries to exhaust the kmem_map. Fix this two ways: - Only honor MFI_IOC_PASSTHRU32 if the binary has the SV_ILP32 flag set, otherwise treat it as an unknown ioctl. - Add a bounds check on the buffer length passed by the user. For now it fails any user attempts to use a buffer larger than 1MB. While here, fix a few other nits: - Remove an unnecessary check for a NULL return from malloc(M_WAITOK). - Use the ENOTTY errno for invalid ioctl commands instead of ENOENT. Modified: stable/9/sys/dev/mfi/mfi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Wed Aug 29 16:58:51 2012 (r239865) +++ stable/9/sys/dev/mfi/mfi.c Wed Aug 29 17:36:12 2012 (r239866) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2832,10 +2833,9 @@ mfi_user_command(struct mfi_softc *sc, s if (ioc->buf_size > 0) { - ioc_buf = malloc(ioc->buf_size, M_MFIBUF, M_WAITOK); - if (ioc_buf == NULL) { + if (ioc->buf_size > 1024 * 1024) return (ENOMEM); - } + ioc_buf = malloc(ioc->buf_size, M_MFIBUF, M_WAITOK); error = copyin(ioc->buf, ioc_buf, ioc->buf_size); if (error) { device_printf(sc->mfi_dev, "failed to copyin\n"); @@ -3244,6 +3244,10 @@ out: } #ifdef COMPAT_FREEBSD32 case MFIIO_PASSTHRU32: + if (!SV_CURPROC_FLAG(SV_ILP32)) { + error = ENOTTY; + break; + } iop_swab.ioc_frame = iop32->ioc_frame; iop_swab.buf_size = iop32->buf_size; iop_swab.buf = PTRIN(iop32->buf); @@ -3259,7 +3263,7 @@ out: break; default: device_printf(sc->mfi_dev, "IOCTL 0x%lx not handled\n", cmd); - error = ENOENT; + error = ENOTTY; break; } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 19:12:34 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AD00106566C; Wed, 29 Aug 2012 19:12:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 445938FC0C; Wed, 29 Aug 2012 19:12:34 +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 q7TJCY2R099051; Wed, 29 Aug 2012 19:12:34 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TJCYEU099047; Wed, 29 Aug 2012 19:12:34 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291912.q7TJCYEU099047@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 19:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239874 - in stable/9/sys: kern vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 19:12:34 -0000 Author: jhb Date: Wed Aug 29 19:12:33 2012 New Revision: 239874 URL: http://svn.freebsd.org/changeset/base/239874 Log: MFC 238000,239584: Honor db_pager_quit in 'show malloc', 'show uma', and 'show witness'. Modified: stable/9/sys/kern/kern_malloc.c stable/9/sys/kern/subr_witness.c stable/9/sys/vm/uma_core.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/kern/kern_malloc.c ============================================================================== --- stable/9/sys/kern/kern_malloc.c Wed Aug 29 18:58:03 2012 (r239873) +++ stable/9/sys/kern/kern_malloc.c Wed Aug 29 19:12:33 2012 (r239874) @@ -963,6 +963,8 @@ DB_SHOW_COMMAND(malloc, db_show_malloc) db_printf("%18s %12ju %12juK %12ju\n", mtp->ks_shortdesc, allocs - frees, (alloced - freed + 1023) / 1024, allocs); + if (db_pager_quit) + break; } } @@ -992,6 +994,8 @@ DB_SHOW_COMMAND(multizone_matches, db_sh if (mtip->mti_zone != subzone) continue; db_printf("%s\n", mtp->ks_shortdesc); + if (db_pager_quit) + break; } } #endif /* MALLOC_DEBUG_MAXZONES > 1 */ Modified: stable/9/sys/kern/subr_witness.c ============================================================================== --- stable/9/sys/kern/subr_witness.c Wed Aug 29 18:58:03 2012 (r239873) +++ stable/9/sys/kern/subr_witness.c Wed Aug 29 19:12:33 2012 (r239874) @@ -943,6 +943,8 @@ witness_ddb_display_descendants(int(*prn indent++; WITNESS_INDEX_ASSERT(w->w_index); for (i = 1; i <= w_max_used_index; i++) { + if (db_pager_quit) + return; if (w_rmatrix[w->w_index][i] & WITNESS_PARENT) witness_ddb_display_descendants(prnt, &w_data[i], indent); @@ -961,6 +963,8 @@ witness_ddb_display_list(int(*prnt)(cons /* This lock has no anscestors - display its descendants. */ witness_ddb_display_descendants(prnt, w, 0); + if (db_pager_quit) + return; } } @@ -982,12 +986,16 @@ witness_ddb_display(int(*prnt)(const cha */ prnt("Sleep locks:\n"); witness_ddb_display_list(prnt, &w_sleep); + if (db_pager_quit) + return; /* * Now do spin locks which have been acquired at least once. */ prnt("\nSpin locks:\n"); witness_ddb_display_list(prnt, &w_spin); + if (db_pager_quit) + return; /* * Finally, any locks which have not been acquired yet. @@ -998,6 +1006,8 @@ witness_ddb_display(int(*prnt)(const cha continue; prnt("%s (type: %s, depth: %d)\n", w->w_name, w->w_class->lc_name, w->w_ddb_level); + if (db_pager_quit) + return; } } #endif /* DDB */ @@ -2393,6 +2403,8 @@ DB_SHOW_ALL_COMMAND(locks, db_witness_li db_printf("Process %d (%s) thread %p (%d)\n", p->p_pid, p->p_comm, td, td->td_tid); witness_ddb_list(td); + if (db_pager_quit) + return; } } } Modified: stable/9/sys/vm/uma_core.c ============================================================================== --- stable/9/sys/vm/uma_core.c Wed Aug 29 18:58:03 2012 (r239873) +++ stable/9/sys/vm/uma_core.c Wed Aug 29 19:12:33 2012 (r239874) @@ -3345,6 +3345,8 @@ DB_SHOW_COMMAND(uma, db_show_uma) (uintmax_t)kz->uk_size, (intmax_t)(allocs - frees), cachefree, (uintmax_t)allocs, sleeps); + if (db_pager_quit) + return; } } } From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 19:17:30 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18290106564A; Wed, 29 Aug 2012 19:17:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0277A8FC16; Wed, 29 Aug 2012 19:17: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 q7TJHTbi099699; Wed, 29 Aug 2012 19:17:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TJHTZR099697; Wed, 29 Aug 2012 19:17:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291917.q7TJHTZR099697@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 19:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239876 - stable/9/usr.sbin/cron/crontab X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 19:17:30 -0000 Author: jhb Date: Wed Aug 29 19:17:29 2012 New Revision: 239876 URL: http://svn.freebsd.org/changeset/base/239876 Log: MFC 238024: Add a one second sleep before touching the spool directory. If the touch occurs in the same second as the earlier operations to create the temporary file and the cron(8) daemon is rescans the spool directory during that second, then the daemon may miss a cron edit and not properly update its internal database. Modified: stable/9/usr.sbin/cron/crontab/crontab.c Directory Properties: stable/9/usr.sbin/cron/crontab/ (props changed) Modified: stable/9/usr.sbin/cron/crontab/crontab.c ============================================================================== --- stable/9/usr.sbin/cron/crontab/crontab.c Wed Aug 29 19:12:53 2012 (r239875) +++ stable/9/usr.sbin/cron/crontab/crontab.c Wed Aug 29 19:17:29 2012 (r239876) @@ -608,6 +608,15 @@ replace_cmd() { log_it(RealUser, Pid, "REPLACE", User); + /* + * Creating the 'tn' temp file has already updated the + * modification time of the spool directory. Sleep for a + * second to ensure that poke_daemon() sets a later + * modification time. Otherwise, this can race with the cron + * daemon scanning for updated crontabs. + */ + sleep(1); + poke_daemon(); return (0); From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 19:34:47 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 460CA1065670; Wed, 29 Aug 2012 19:34:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E3CB8FC1A; Wed, 29 Aug 2012 19:34: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 q7TJYkcJ002041; Wed, 29 Aug 2012 19:34:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TJYkff002035; Wed, 29 Aug 2012 19:34:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291934.q7TJYkff002035@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 19:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239878 - in stable/9/contrib/binutils: gas/config opcodes X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 19:34:47 -0000 Author: jhb Date: Wed Aug 29 19:34:46 2012 New Revision: 239878 URL: http://svn.freebsd.org/changeset/base/239878 Log: MFC 238123,238167: - Add support for the 'xsave', 'xrstor', 'xsaveopt', 'xgetbv', and 'xsetbv' instructions. I reimplemented this from scratch based on the Intel manuals and the existing support for handling the fxsave and fxrstor instructions. - Add support for the 'invept' and 'invvpid' instructions. Beyond simply adding appropriate table entries, the assembler had to be adjusted as these are the first non-SSE instructions to use a 3-byte opcode (and a mandatory prefix to boot). Modified: stable/9/contrib/binutils/gas/config/tc-i386.c stable/9/contrib/binutils/opcodes/i386-dis.c stable/9/contrib/binutils/opcodes/i386-opc.h stable/9/contrib/binutils/opcodes/i386-opc.tbl stable/9/contrib/binutils/opcodes/i386-tbl.h Directory Properties: stable/9/contrib/binutils/ (props changed) Modified: stable/9/contrib/binutils/gas/config/tc-i386.c ============================================================================== --- stable/9/contrib/binutils/gas/config/tc-i386.c Wed Aug 29 19:17:35 2012 (r239877) +++ stable/9/contrib/binutils/gas/config/tc-i386.c Wed Aug 29 19:34:46 2012 (r239878) @@ -517,7 +517,9 @@ static const arch_entry cpu_arch[] = {".sse4a", PROCESSOR_UNKNOWN, CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuSSE4a}, {".abm", PROCESSOR_UNKNOWN, - CpuABM} + CpuABM}, + {".xsave", PROCESSOR_UNKNOWN, + CpuXSAVE} }; const pseudo_typeS md_pseudo_table[] = @@ -3988,6 +3990,16 @@ output_insn (void) goto check_prefix; } } + else if (i.tm.base_opcode == 0x660f3880 || i.tm.base_opcode == 0x660f3881) + { + /* invept and invvpid are 3 byte instructions with a + mandatory prefix. */ + if (i.tm.base_opcode & 0xff000000) + { + prefix = (i.tm.base_opcode >> 24) & 0xff; + add_prefix (prefix); + } + } else if ((i.tm.base_opcode & 0xff0000) != 0) { prefix = (i.tm.base_opcode >> 16) & 0xff; @@ -4027,6 +4039,12 @@ output_insn (void) p = frag_more (3); *p++ = (i.tm.base_opcode >> 16) & 0xff; } + else if (i.tm.base_opcode == 0x660f3880 || + i.tm.base_opcode == 0x660f3881) + { + p = frag_more (3); + *p++ = (i.tm.base_opcode >> 16) & 0xff; + } else p = frag_more (2); Modified: stable/9/contrib/binutils/opcodes/i386-dis.c ============================================================================== --- stable/9/contrib/binutils/opcodes/i386-dis.c Wed Aug 29 19:17:35 2012 (r239877) +++ stable/9/contrib/binutils/opcodes/i386-dis.c Wed Aug 29 19:34:46 2012 (r239878) @@ -93,6 +93,7 @@ static void OP_3DNowSuffix (int, int); static void OP_SIMD_Suffix (int, int); static void SIMD_Fixup (int, int); static void PNI_Fixup (int, int); +static void XCR_Fixup (int, int); static void SVME_Fixup (int, int); static void INVLPG_Fixup (int, int); static void BadOp (void); @@ -212,6 +213,7 @@ fetch_data (struct disassemble_info *inf #define Ew { OP_E, w_mode } #define M { OP_M, 0 } /* lea, lgdt, etc. */ #define Ma { OP_M, v_mode } +#define Mo { OP_M, o_mode } #define Mp { OP_M, f_mode } /* 32 or 48 bit memory operand for LDS, LES etc */ #define Mq { OP_M, q_mode } #define Gb { OP_G, b_mode } @@ -539,6 +541,8 @@ fetch_data (struct disassemble_info *inf #define PREGRP95 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 95 } } #define PREGRP96 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 96 } } #define PREGRP97 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 97 } } +#define PREGRP98 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 98 } } +#define PREGRP99 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 99 } } #define X86_64_0 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 0 } } @@ -1693,7 +1697,7 @@ static const struct dis386 grps[][8] = { { { "sgdt{Q|IQ||}", { { VMX_Fixup, 0 } } }, { "sidt{Q|IQ||}", { { PNI_Fixup, 0 } } }, - { "lgdt{Q|Q||}", { M } }, + { "lgdt{Q|Q||}", { { XCR_Fixup, 0 } } }, { "lidt{Q|Q||}", { { SVME_Fixup, 0 } } }, { "smswD", { Sv } }, { "(bad)", { XX } }, @@ -1783,9 +1787,9 @@ static const struct dis386 grps[][8] = { { "fxrstor", { Ev } }, { "ldmxcsr", { Ev } }, { "stmxcsr", { Ev } }, - { "(bad)", { XX } }, - { "lfence", { { OP_0fae, 0 } } }, - { "mfence", { { OP_0fae, 0 } } }, + { "xsave", { Ev } }, + { "xrstor", { { OP_0fae, v_mode } } }, + { "xsaveopt", { { OP_0fae, v_mode } } }, { "clflush", { { OP_0fae, 0 } } }, }, /* GRP16 */ @@ -2585,6 +2589,22 @@ static const struct dis386 prefix_user_t { "punpckldq",{ MX, EMq } }, { "(bad)", { XX } }, }, + + /* PREGRP98 */ + { + { "(bad)", { XX } }, + { "(bad)", { XX } }, + { "invept", { Gm, Mo } }, + { "(bad)", { XX } }, + }, + + /* PREGRP99 */ + { + { "(bad)", { XX } }, + { "(bad)", { XX } }, + { "invvpid",{ Gm, Mo } }, + { "(bad)", { XX } }, + }, }; static const struct dis386 x86_64_table[][2] = { @@ -2754,8 +2774,8 @@ static const struct dis386 three_byte_ta { "(bad)", { XX } }, { "(bad)", { XX } }, /* 80 */ - { "(bad)", { XX } }, - { "(bad)", { XX } }, + { PREGRP98 }, + { PREGRP99 }, { "(bad)", { XX } }, { "(bad)", { XX } }, { "(bad)", { XX } }, @@ -5883,7 +5903,7 @@ static void OP_M (int bytemode, int sizeflag) { if (modrm.mod == 3) - /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst modrm */ + /* bad bound,lea,lds,les,lfs,lgs,lss,cmpxchg8b,vmptrst,invept,invvpid modrm */ BadOp (); else OP_E (bytemode, sizeflag); @@ -5905,17 +5925,17 @@ OP_0fae (int bytemode, int sizeflag) { if (modrm.reg == 7) strcpy (obuf + strlen (obuf) - sizeof ("clflush") + 1, "sfence"); + else if (modrm.reg == 6) + strcpy (obuf + strlen (obuf) - sizeof ("xsaveopt") + 1, "mfence"); + else if (modrm.reg == 5) + strcpy (obuf + strlen (obuf) - sizeof ("xrstor") + 1, "lfence"); if (modrm.reg < 5 || modrm.rm != 0) { BadOp (); /* bad sfence, mfence, or lfence */ return; } - } - else if (modrm.reg != 7) - { - BadOp (); /* bad clflush */ - return; + bytemode = 0; } OP_E (bytemode, sizeflag); @@ -6170,6 +6190,43 @@ PNI_Fixup (int extrachar ATTRIBUTE_UNUSE } static void +XCR_Fixup (int extrachar ATTRIBUTE_UNUSED, int sizeflag) +{ + if (modrm.mod == 3 && modrm.reg == 2 && modrm.rm <= 1) + { + /* Override "lgdt". */ + size_t olen = strlen (obuf); + char *p = obuf + olen - 4; + + /* We might have a suffix when disassembling with -Msuffix. */ + if (*p == 'i') + --p; + + /* Remove "addr16/addr32" if we aren't in Intel mode. */ + if (!intel_syntax + && (prefixes & PREFIX_ADDR) + && olen >= (4 + 7) + && *(p - 1) == ' ' + && CONST_STRNEQ (p - 7, "addr") + && (CONST_STRNEQ (p - 3, "16") + || CONST_STRNEQ (p - 3, "32"))) + p -= 7; + + if (modrm.rm) + { + strcpy (p, "xsetbv"); + } + else + { + strcpy (p, "xgetbv"); + } + + codep++; + } + else + OP_M (0, sizeflag); +} +static void SVME_Fixup (int bytemode, int sizeflag) { const char *alt; Modified: stable/9/contrib/binutils/opcodes/i386-opc.h ============================================================================== --- stable/9/contrib/binutils/opcodes/i386-opc.h Wed Aug 29 19:17:35 2012 (r239877) +++ stable/9/contrib/binutils/opcodes/i386-opc.h Wed Aug 29 19:34:46 2012 (r239878) @@ -71,6 +71,7 @@ typedef struct template #define CpuABM 0x200000 /* ABM New Instructions required */ #define CpuSSE4_1 0x400000 /* SSE4.1 Instructions required */ #define CpuSSE4_2 0x800000 /* SSE4.2 Instructions required */ +#define CpuXSAVE 0x1000000 /* XSAVE Instructions required */ /* SSE4.1/4.2 Instructions required */ #define CpuSSE4 (CpuSSE4_1|CpuSSE4_2) @@ -83,7 +84,7 @@ typedef struct template #define CpuUnknownFlags (Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 \ |CpuP4|CpuSledgehammer|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3|CpuVMX \ |Cpu3dnow|Cpu3dnowA|CpuK6|CpuPadLock|CpuSVME|CpuSSSE3|CpuSSE4_1 \ - |CpuSSE4_2|CpuABM|CpuSSE4a) + |CpuSSE4_2|CpuABM|CpuSSE4a|CpuXSAVE) /* the bits in opcode_modifier are used to generate the final opcode from the base_opcode. These bits also are used to detect alternate forms of Modified: stable/9/contrib/binutils/opcodes/i386-opc.tbl ============================================================================== --- stable/9/contrib/binutils/opcodes/i386-opc.tbl Wed Aug 29 19:17:35 2012 (r239877) +++ stable/9/contrib/binutils/opcodes/i386-opc.tbl Wed Aug 29 19:34:46 2012 (r239878) @@ -1289,6 +1289,10 @@ mwait, 2, 0xf01, 0xc9, CpuSSE3|CpuNo64, mwait, 2, 0xf01, 0xc9, CpuSSE3|Cpu64, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt|NoRex64, { Reg64, Reg64 } // VMX instructions. +invept, 2, 0x660f3880, None, CpuVMX|CpuNo64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg32 } +invept, 2, 0x660f3880, None, CpuVMX|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg64 } +invvpid, 2, 0x660f3881, None, CpuVMX|CpuNo64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg32 } +invvpid, 2, 0x660f3881, None, CpuVMX|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S, Reg64 } vmcall, 0, 0xf01, 0xc1, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } vmclear, 1, 0x660fc7, 0x6, CpuVMX, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } vmlaunch, 0, 0xf01, 0xc2, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } @@ -1487,3 +1491,10 @@ xcryptcfb, 0, 0xf30fa7, 0xe0, Cpu686|Cpu xcryptofb, 0, 0xf30fa7, 0xe8, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } // Alias for xstore-rng. xstore, 0, 0xfa7, 0xc0, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } + +// XSAVE/XRSTOR related instructions +xgetbv, 0, 0xf01, 0xd0, CpuXSAVE, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } +xsetbv, 0, 0xf01, 0xd1, CpuXSAVE, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } +xsave, 1, 0xfae, 0x4, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } +xsaveopt, 1, 0xfae, 0x6, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } +xrstor, 1, 0xfae, 0x5, CpuXSAVE, Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, { BaseIndex|Disp8|Disp16|Disp32|Disp32S } Modified: stable/9/contrib/binutils/opcodes/i386-tbl.h ============================================================================== --- stable/9/contrib/binutils/opcodes/i386-tbl.h Wed Aug 29 19:17:35 2012 (r239877) +++ stable/9/contrib/binutils/opcodes/i386-tbl.h Wed Aug 29 19:34:46 2012 (r239878) @@ -3625,6 +3625,22 @@ const template i386_optab[] = No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt|NoRex64, { Reg64, Reg64 } }, + { "invept", 2, 0x660f3880, None, CpuVMX|CpuNo64, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg32 } }, + { "invept", 2, 0x660f3880, None, CpuVMX|Cpu64, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg64 } }, + { "invvpid", 2, 0x660f3881, None, CpuVMX|CpuNo64, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg32 } }, + { "invvpid", 2, 0x660f3881, None, CpuVMX|Cpu64, + Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_qSuf|No_xSuf|NoRex64, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S, + Reg64 } }, { "vmcall", 0, 0xf01, 0xc1, CpuVMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, { 0 } }, @@ -4288,6 +4304,21 @@ const template i386_optab[] = { "xstore", 0, 0xfa7, 0xc0, Cpu686|CpuPadLock, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|IsString|ImmExt, { 0 } }, + { "xgetbv", 0, 0xf01, 0xd0, CpuXSAVE, + No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, + { 0 } }, + { "xsetbv", 0, 0xf01, 0xd1, CpuXSAVE, + No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_xSuf|ImmExt, + { 0 } }, + { "xsave", 1, 0xfae, 0x4, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, + { "xsaveopt", 1, 0xfae, 0x6, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, + { "xrstor", 1, 0xfae, 0x5, CpuXSAVE, + Modrm|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_xSuf, + { BaseIndex|Disp8|Disp16|Disp32|Disp32S } }, { NULL, 0, 0, 0, 0, 0, { 0 } } }; From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 19:47:19 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A41CD1065677; Wed, 29 Aug 2012 19:47:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D33B8FC25; Wed, 29 Aug 2012 19:47:19 +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 q7TJlJ9A003601; Wed, 29 Aug 2012 19:47:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TJlJuW003599; Wed, 29 Aug 2012 19:47:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291947.q7TJlJuW003599@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 19:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239879 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 19:47:19 -0000 Author: jhb Date: Wed Aug 29 19:47:19 2012 New Revision: 239879 URL: http://svn.freebsd.org/changeset/base/239879 Log: MFC 238109,238166: Several fixes to the amd64 disassembler: - Decode the 'xsave', 'xrstor', 'xsaveopt', 'xgetbv', 'xsetbv', and 'rdtscp' instructions. - Add generic support for opcodes that are escape bytes used for multi-byte opcodes (such as the 0x0f prefix). Use this to replace the hard-coded 0x0f special case and add support for three-byte opcodes that use the 0x0f38 prefix. - Decode all Intel VMX instructions. invept and invvpid in particular are three-byte opcodes that use the 0x0f38 escape prefix. - Rework how the special 'SDEP' size flag works such that the default instruction name (i_name) is the instruction when the data size prefix (0x66) is not specified, and the alternate name in i_extra is used when the prefix is included. - Add a new 'ADEP' size flag similar to 'SDEP' except that it chooses between i_name and i_extra based on the address size prefix (0x67). Use this to fix the decoding for jrcxz vs jecxz which is determined by the address size prefix, not the operand size prefix. Also, jcxz is not possible in 64-bit mode, but jrcxz is the default instruction for that opcode. - Add support for handling instructions that have a mandatory 'rep' prefix (this means not outputting the 'repe ' prefix until determining if it is used as part of an opcode). Make 'pause' less of a special case this way. - Decode 'cmpxchg16b' and 'cdqe' which are variants of other instructions but with a REX.W prefix. Modified: stable/9/sys/amd64/amd64/db_disasm.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/amd64/db_disasm.c ============================================================================== --- stable/9/sys/amd64/amd64/db_disasm.c Wed Aug 29 19:34:46 2012 (r239878) +++ stable/9/sys/amd64/amd64/db_disasm.c Wed Aug 29 19:47:19 2012 (r239879) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); * Instruction disassembler. */ #include +#include #include #include @@ -47,7 +48,9 @@ __FBSDID("$FreeBSD$"); #define DBLR 5 #define EXTR 6 #define SDEP 7 -#define NONE 8 +#define ADEP 8 +#define ESC 9 +#define NONE 10 /* * REX prefix and bits @@ -67,6 +70,7 @@ __FBSDID("$FreeBSD$"); #define Eb 4 /* address, byte size */ #define R 5 /* register, in 'reg' field */ #define Rw 6 /* word register, in 'reg' field */ +#define Rq 39 /* quad register, in 'reg' field */ #define Ri 7 /* register in instruction */ #define S 8 /* segment reg, in 'reg' field */ #define Si 9 /* segment reg, in instruction */ @@ -120,6 +124,45 @@ struct finst { (or pointer to table) */ }; +static const struct inst db_inst_0f388x[] = { +/*80*/ { "", TRUE, SDEP, op2(E, Rq), "invept" }, +/*81*/ { "", TRUE, SDEP, op2(E, Rq), "invvpid" }, +/*82*/ { "", FALSE, NONE, 0, 0 }, +/*83*/ { "", FALSE, NONE, 0, 0 }, +/*84*/ { "", FALSE, NONE, 0, 0 }, +/*85*/ { "", FALSE, NONE, 0, 0 }, +/*86*/ { "", FALSE, NONE, 0, 0 }, +/*87*/ { "", FALSE, NONE, 0, 0 }, + +/*88*/ { "", FALSE, NONE, 0, 0 }, +/*89*/ { "", FALSE, NONE, 0, 0 }, +/*8a*/ { "", FALSE, NONE, 0, 0 }, +/*8b*/ { "", FALSE, NONE, 0, 0 }, +/*8c*/ { "", FALSE, NONE, 0, 0 }, +/*8d*/ { "", FALSE, NONE, 0, 0 }, +/*8e*/ { "", FALSE, NONE, 0, 0 }, +/*8f*/ { "", FALSE, NONE, 0, 0 }, +}; + +static const struct inst * const db_inst_0f38[] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + db_inst_0f388x, + 0, + 0, + 0, + 0, + 0, + 0, + 0 +}; + static const char * const db_Grp6[] = { "sldt", "str", @@ -160,8 +203,8 @@ static const char * const db_Grp9[] = { "", "", "", - "", - "" + "vmptrld", + "vmptrst" }; static const char * const db_Grp15[] = { @@ -169,9 +212,9 @@ static const char * const db_Grp15[] = { "fxrstor", "ldmxcsr", "stmxcsr", - "", - "", - "", + "xsave", + "xrstor", + "xsaveopt", "clflush" }; @@ -236,7 +279,7 @@ static const struct inst db_inst_0f3x[] /*36*/ { "", FALSE, NONE, 0, 0 }, /*37*/ { "getsec",FALSE, NONE, 0, 0 }, -/*38*/ { "", FALSE, NONE, 0, 0 }, +/*38*/ { "", FALSE, ESC, 0, db_inst_0f38 }, /*39*/ { "", FALSE, NONE, 0, 0 }, /*3a*/ { "", FALSE, NONE, 0, 0 }, /*3b*/ { "", FALSE, NONE, 0, 0 }, @@ -266,6 +309,26 @@ static const struct inst db_inst_0f4x[] /*4f*/ { "cmovnle",TRUE, NONE, op2(E, R), 0 }, }; +static const struct inst db_inst_0f7x[] = { +/*70*/ { "", FALSE, NONE, 0, 0 }, +/*71*/ { "", FALSE, NONE, 0, 0 }, +/*72*/ { "", FALSE, NONE, 0, 0 }, +/*73*/ { "", FALSE, NONE, 0, 0 }, +/*74*/ { "", FALSE, NONE, 0, 0 }, +/*75*/ { "", FALSE, NONE, 0, 0 }, +/*76*/ { "", FALSE, NONE, 0, 0 }, +/*77*/ { "", FALSE, NONE, 0, 0 }, + +/*78*/ { "vmread", TRUE, NONE, op2(Rq, E), 0 }, +/*79*/ { "vmwrite",TRUE, NONE, op2(E, Rq), 0 }, +/*7a*/ { "", FALSE, NONE, 0, 0 }, +/*7b*/ { "", FALSE, NONE, 0, 0 }, +/*7c*/ { "", FALSE, NONE, 0, 0 }, +/*7d*/ { "", FALSE, NONE, 0, 0 }, +/*7e*/ { "", FALSE, NONE, 0, 0 }, +/*7f*/ { "", FALSE, NONE, 0, 0 }, +}; + static const struct inst db_inst_0f8x[] = { /*80*/ { "jo", FALSE, NONE, op1(Dl), 0 }, /*81*/ { "jno", FALSE, NONE, op1(Dl), 0 }, @@ -373,7 +436,7 @@ static const struct inst * const db_inst db_inst_0f4x, 0, 0, - 0, + db_inst_0f7x, db_inst_0f8x, db_inst_0f9x, db_inst_0fax, @@ -582,7 +645,7 @@ static const struct inst db_inst_table[2 /*0c*/ { "or", FALSE, BYTE, op2(I, A), 0 }, /*0d*/ { "or", FALSE, LONG, op2(I, A), 0 }, /*0e*/ { "push", FALSE, NONE, op1(Si), 0 }, -/*0f*/ { "", FALSE, NONE, 0, 0 }, +/*0f*/ { "", FALSE, ESC, 0, db_inst_0f }, /*10*/ { "adc", TRUE, BYTE, op2(R, E), 0 }, /*11*/ { "adc", TRUE, LONG, op2(R, E), 0 }, @@ -738,8 +801,8 @@ static const struct inst db_inst_table[2 /*96*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 }, /*97*/ { "xchg", FALSE, LONG, op2(A, Ri), 0 }, -/*98*/ { "cbw", FALSE, SDEP, 0, "cwde" }, /* cbw/cwde */ -/*99*/ { "cwd", FALSE, SDEP, 0, "cdq" }, /* cwd/cdq */ +/*98*/ { "cwde", FALSE, SDEP, 0, "cbw" }, +/*99*/ { "cdq", FALSE, SDEP, 0, "cwd" }, /*9a*/ { "lcall", FALSE, NONE, op1(OS), 0 }, /*9b*/ { "wait", FALSE, NONE, 0, 0 }, /*9c*/ { "pushf", FALSE, LONG, 0, 0 }, @@ -822,7 +885,7 @@ static const struct inst db_inst_table[2 /*e0*/ { "loopne",FALSE, NONE, op1(Db), 0 }, /*e1*/ { "loope", FALSE, NONE, op1(Db), 0 }, /*e2*/ { "loop", FALSE, NONE, op1(Db), 0 }, -/*e3*/ { "jcxz", FALSE, SDEP, op1(Db), "jecxz" }, +/*e3*/ { "jrcxz", FALSE, ADEP, op1(Db), "jecxz" }, /*e4*/ { "in", FALSE, BYTE, op2(Ib, A), 0 }, /*e5*/ { "in", FALSE, LONG, op2(Ib, A) , 0 }, /*e6*/ { "out", FALSE, BYTE, op2(A, Ib), 0 }, @@ -1208,14 +1271,6 @@ db_disasm(loc, altfmt) if (prefix) { get_value_inc(inst, loc, 1, FALSE); } - if (rep == TRUE) { - if (inst == 0x90) { - db_printf("pause\n"); - return (loc); - } - db_printf("repe "); /* XXX repe VS rep */ - rep = FALSE; - } } while (prefix); if (inst >= 0xd8 && inst <= 0xdf) { @@ -1224,9 +1279,10 @@ db_disasm(loc, altfmt) return (loc); } - if (inst == 0x0f) { + ip = &db_inst_table[inst]; + while (ip->i_size == ESC) { get_value_inc(inst, loc, 1, FALSE); - ip = db_inst_0f[inst>>4]; + ip = ((const struct inst * const *)ip->i_extra)[inst>>4]; if (ip == 0) { ip = &db_bad_inst; } @@ -1234,8 +1290,6 @@ db_disasm(loc, altfmt) ip = &ip[inst&0xf]; } } - else - ip = &db_inst_table[inst]; if (ip->i_has_modrm) { get_value_inc(regmodrm, loc, 1, FALSE); @@ -1269,6 +1323,26 @@ db_disasm(loc, altfmt) /* Special cases that don't fit well in the tables. */ if (ip->i_extra == db_Grp7 && f_mod(rex, regmodrm) == 3) { switch (regmodrm) { + case 0xc1: + i_name = "vmcall"; + i_size = NONE; + i_mode = 0; + break; + case 0xc2: + i_name = "vmlaunch"; + i_size = NONE; + i_mode = 0; + break; + case 0xc3: + i_name = "vmresume"; + i_size = NONE; + i_mode = 0; + break; + case 0xc4: + i_name = "vmxoff"; + i_size = NONE; + i_mode = 0; + break; case 0xc8: i_name = "monitor"; i_size = NONE; @@ -1279,11 +1353,26 @@ db_disasm(loc, altfmt) i_size = NONE; i_mode = 0; break; + case 0xd0: + i_name = "xgetbv"; + i_size = NONE; + i_mode = 0; + break; + case 0xd1: + i_name = "xsetbv"; + i_size = NONE; + i_mode = 0; + break; case 0xf8: i_name = "swapgs"; i_size = NONE; i_mode = 0; break; + case 0xf9: + i_name = "rdtscp"; + i_size = NONE; + i_mode = 0; + break; } } if (ip->i_extra == db_Grp15 && f_mod(rex, regmodrm) == 3) { @@ -1292,8 +1381,42 @@ db_disasm(loc, altfmt) i_mode = 0; } + /* Handle instructions identified by mandatory prefixes. */ + if (rep == TRUE) { + if (inst == 0x90) { + i_name = "pause"; + i_size = NONE; + i_mode = 0; + rep = FALSE; + } else if (ip->i_extra == db_Grp9 && f_mod(rex, regmodrm) != 3 && + f_reg(rex, regmodrm) == 0x6) { + i_name = "vmxon"; + rep = FALSE; + } + } + if (size == WORD) { + if (ip->i_extra == db_Grp9 && f_mod(rex, regmodrm) != 3 && + f_reg(rex, regmodrm) == 0x6) { + i_name = "vmclear"; + } + } + if (rex & REX_W) { + if (strcmp(i_name, "cwde") == 0) + i_name = "cdqe"; + else if (strcmp(i_name, "cmpxchg8b") == 0) + i_name = "cmpxchg16b"; + } + + if (rep == TRUE) + db_printf("repe "); /* XXX repe VS rep */ + if (i_size == SDEP) { - if (size == WORD) + if (size == LONG) + db_printf("%s", i_name); + else + db_printf("%s", (const char *)ip->i_extra); + } else if (i_size == ADEP) { + if (short_addr == FALSE) db_printf("%s", i_name); else db_printf("%s", (const char *)ip->i_extra); @@ -1366,6 +1489,10 @@ db_disasm(loc, altfmt) db_printf("%s", db_reg[rex != 0 ? 1 : 0][WORD][f_reg(rex, regmodrm)]); break; + case Rq: + db_printf("%s", db_reg[rex != 0 ? 1 : 0][QUAD][f_reg(rex, regmodrm)]); + break; + case Ri: db_printf("%s", db_reg[0][QUAD][f_rm(rex, inst)]); break; From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 20:49:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84339106564A; Wed, 29 Aug 2012 20:49:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBD68FC08; Wed, 29 Aug 2012 20:49: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 q7TKnbgY012410; Wed, 29 Aug 2012 20:49:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TKnbxN012404; Wed, 29 Aug 2012 20:49:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208292049.q7TKnbxN012404@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 20:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239880 - in stable/9/sys: amd64/amd64 i386/i386 pc98/pc98 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 20:49:37 -0000 Author: jhb Date: Wed Aug 29 20:49:36 2012 New Revision: 239880 URL: http://svn.freebsd.org/changeset/base/239880 Log: MFC 238310: Partially revert r217515 so that the mem_range_softc variable is always present on x86 kernels. This fixes the build of kernels that include 'device acpi' but do not include 'device mem'. Modified: stable/9/sys/amd64/amd64/machdep.c stable/9/sys/amd64/amd64/mem.c stable/9/sys/i386/i386/machdep.c stable/9/sys/i386/i386/mem.c stable/9/sys/pc98/pc98/machdep.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Wed Aug 29 19:47:19 2012 (r239879) +++ stable/9/sys/amd64/amd64/machdep.c Wed Aug 29 20:49:36 2012 (r239880) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -206,6 +207,8 @@ struct pcpu __pcpu[MAXCPU]; struct mtx icu_lock; +struct mem_range_softc mem_range_softc; + struct mtx dt_lock; /* lock for GDT and LDT */ static void Modified: stable/9/sys/amd64/amd64/mem.c ============================================================================== --- stable/9/sys/amd64/amd64/mem.c Wed Aug 29 19:47:19 2012 (r239879) +++ stable/9/sys/amd64/amd64/mem.c Wed Aug 29 20:49:36 2012 (r239880) @@ -72,8 +72,6 @@ __FBSDID("$FreeBSD$"); */ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -struct mem_range_softc mem_range_softc; - /* ARGSUSED */ int memrw(struct cdev *dev, struct uio *uio, int flags) Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Wed Aug 29 19:47:19 2012 (r239879) +++ stable/9/sys/i386/i386/machdep.c Wed Aug 29 20:49:36 2012 (r239880) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -247,6 +248,8 @@ struct pcpu __pcpu[MAXCPU]; struct mtx icu_lock; +struct mem_range_softc mem_range_softc; + static void cpu_startup(dummy) void *dummy; Modified: stable/9/sys/i386/i386/mem.c ============================================================================== --- stable/9/sys/i386/i386/mem.c Wed Aug 29 19:47:19 2012 (r239879) +++ stable/9/sys/i386/i386/mem.c Wed Aug 29 20:49:36 2012 (r239880) @@ -72,8 +72,6 @@ __FBSDID("$FreeBSD$"); */ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -struct mem_range_softc mem_range_softc; - static struct sx memsxlock; SX_SYSINIT(memsxlockinit, &memsxlock, "/dev/mem lock"); Modified: stable/9/sys/pc98/pc98/machdep.c ============================================================================== --- stable/9/sys/pc98/pc98/machdep.c Wed Aug 29 19:47:19 2012 (r239879) +++ stable/9/sys/pc98/pc98/machdep.c Wed Aug 29 20:49:36 2012 (r239880) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -216,6 +217,8 @@ struct pcpu __pcpu[MAXCPU]; struct mtx icu_lock; +struct mem_range_softc mem_range_softc; + static void cpu_startup(dummy) void *dummy; From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 21:12:20 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39356106566C; Wed, 29 Aug 2012 21:12:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19E078FC1E; Wed, 29 Aug 2012 21:12: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 q7TLCJRD015298; Wed, 29 Aug 2012 21:12:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TLCJcH015293; Wed, 29 Aug 2012 21:12:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208292112.q7TLCJcH015293@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 21:12:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239882 - in stable/9/sys/amd64: acpica amd64 include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 21:12:20 -0000 Author: jhb Date: Wed Aug 29 21:12:19 2012 New Revision: 239882 URL: http://svn.freebsd.org/changeset/base/239882 Log: MFC 238142,238179: Now that our assembler supports the xsave family of instructions, use them natively rather than hand-assembled versions. For xgetbv/xsetbv, add a wrapper API to deal with xcr* registers: rxcr() and load_xcr(). Modified: stable/9/sys/amd64/acpica/acpi_switch.S stable/9/sys/amd64/amd64/cpu_switch.S stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/include/cpufunc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/acpica/acpi_switch.S ============================================================================== --- stable/9/sys/amd64/acpica/acpi_switch.S Wed Aug 29 20:50:01 2012 (r239881) +++ stable/9/sys/amd64/acpica/acpi_switch.S Wed Aug 29 21:12:19 2012 (r239882) @@ -143,10 +143,8 @@ ENTRY(acpi_restorecpu) movq %rax, %rdx shrq $32, %rdx movl $XCR0, %ecx -/* xsetbv */ - .byte 0x0f, 0x01, 0xd1 -/* xrstor (%rbx) */ - .byte 0x0f, 0xae, 0x2b + xsetbv + xrstor (%rbx) jmp 2f 1: fxrstor (%rbx) Modified: stable/9/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/9/sys/amd64/amd64/cpu_switch.S Wed Aug 29 20:50:01 2012 (r239881) +++ stable/9/sys/amd64/amd64/cpu_switch.S Wed Aug 29 21:12:19 2012 (r239882) @@ -122,8 +122,7 @@ done_store_dr: 1: movq %rdx,%rcx movl xsave_mask,%eax movl xsave_mask+4,%edx -/* xsave (%r8) */ - .byte 0x41,0x0f,0xae,0x20 + xsave (%r8) movq %rcx,%rdx 2: smsw %ax orb $CR0_TS,%al Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Wed Aug 29 20:50:01 2012 (r239881) +++ stable/9/sys/amd64/amd64/fpu.c Wed Aug 29 21:12:19 2012 (r239882) @@ -85,9 +85,7 @@ xrstor(char *addr, uint64_t mask) low = mask; hi = mask >> 32; - /* xrstor (%rdi) */ - __asm __volatile(".byte 0x0f,0xae,0x2f" : : - "a" (low), "d" (hi), "D" (addr)); + __asm __volatile("xrstor %0" : : "m" (*addr), "a" (low), "d" (hi)); } static __inline void @@ -97,20 +95,8 @@ xsave(char *addr, uint64_t mask) low = mask; hi = mask >> 32; - /* xsave (%rdi) */ - __asm __volatile(".byte 0x0f,0xae,0x27" : : - "a" (low), "d" (hi), "D" (addr) : "memory"); -} - -static __inline void -xsetbv(uint32_t reg, uint64_t val) -{ - uint32_t low, hi; - - low = val; - hi = val >> 32; - __asm __volatile(".byte 0x0f,0x01,0xd1" : : - "c" (reg), "a" (low), "d" (hi)); + __asm __volatile("xsave %0" : "=m" (*addr) : "a" (low), "d" (hi) : + "memory"); } #else /* !(__GNUCLIKE_ASM && !lint) */ @@ -127,7 +113,6 @@ void start_emulating(void); void stop_emulating(void); void xrstor(char *addr, uint64_t mask); void xsave(char *addr, uint64_t mask); -void xsetbv(uint32_t reg, uint64_t val); #endif /* __GNUCLIKE_ASM && !lint */ @@ -238,7 +223,7 @@ fpuinit(void) if (use_xsave) { load_cr4(rcr4() | CR4_XSAVE); - xsetbv(XCR0, xsave_mask); + load_xcr(XCR0, xsave_mask); } /* Modified: stable/9/sys/amd64/include/cpufunc.h ============================================================================== --- stable/9/sys/amd64/include/cpufunc.h Wed Aug 29 20:50:01 2012 (r239881) +++ stable/9/sys/amd64/include/cpufunc.h Wed Aug 29 21:12:19 2012 (r239882) @@ -409,6 +409,25 @@ rcr4(void) return (data); } +static __inline u_long +rxcr(u_int reg) +{ + u_int low, high; + + __asm __volatile("xgetbv" : "=a" (low), "=d" (high) : "c" (reg)); + return (low | ((uint64_t)high << 32)); +} + +static __inline void +load_xcr(u_int reg, u_long val) +{ + u_int low, high; + + low = val; + high = val >> 32; + __asm __volatile("xsetbv" : : "c" (reg), "a" (low), "d" (high)); +} + /* * Global TLB flush (except for thise for pages marked PG_G) */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 07:25:18 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86BF0106566C; Thu, 30 Aug 2012 07:25:18 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57E8B8FC08; Thu, 30 Aug 2012 07:25: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 q7U7PIkZ098846; Thu, 30 Aug 2012 07:25:18 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7U7PI02098844; Thu, 30 Aug 2012 07:25:18 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208300725.q7U7PI02098844@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 30 Aug 2012 07:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239891 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 07:25:18 -0000 Author: maxim Date: Thu Aug 30 07:25:17 2012 New Revision: 239891 URL: http://svn.freebsd.org/changeset/base/239891 Log: MFC r230584 by glebius: remove casts from inet6 address testing macros, thus preserving qualifier from original argument. Modified: stable/9/sys/netinet6/in6.h Modified: stable/9/sys/netinet6/in6.h ============================================================================== --- stable/9/sys/netinet6/in6.h Thu Aug 30 06:55:47 2012 (r239890) +++ stable/9/sys/netinet6/in6.h Thu Aug 30 07:25:17 2012 (r239891) @@ -235,37 +235,37 @@ extern const struct in6_addr in6addr_lin * Unspecified */ #define IN6_IS_ADDR_UNSPECIFIED(a) \ - ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0)) + ((a)->__u6_addr.__u6_addr32[0] == 0 && \ + (a)->__u6_addr.__u6_addr32[1] == 0 && \ + (a)->__u6_addr.__u6_addr32[2] == 0 && \ + (a)->__u6_addr.__u6_addr32[3] == 0) /* * Loopback */ #define IN6_IS_ADDR_LOOPBACK(a) \ - ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1))) + ((a)->__u6_addr.__u6_addr32[0] == 0 && \ + (a)->__u6_addr.__u6_addr32[1] == 0 && \ + (a)->__u6_addr.__u6_addr32[2] == 0 && \ + (a)->__u6_addr.__u6_addr32[3] == ntohl(1)) /* * IPv4 compatible */ #define IN6_IS_ADDR_V4COMPAT(a) \ - ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1))) + ((a)->__u6_addr.__u6_addr32[0] == 0 && \ + (a)->__u6_addr.__u6_addr32[1] == 0 && \ + (a)->__u6_addr.__u6_addr32[2] == 0 && \ + (a)->__u6_addr.__u6_addr32[3] != 0 && \ + (a)->__u6_addr.__u6_addr32[3] != ntohl(1)) /* * Mapped */ #define IN6_IS_ADDR_V4MAPPED(a) \ - ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ - (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) + ((a)->__u6_addr.__u6_addr32[0] == 0 && \ + (a)->__u6_addr.__u6_addr32[1] == 0 && \ + (a)->__u6_addr.__u6_addr32[2] == ntohl(0x0000ffff)) /* * KAME Scope Values From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 07:34:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6293A106566C; Thu, 30 Aug 2012 07:34:26 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC858FC15; Thu, 30 Aug 2012 07:34:26 +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 q7U7YQ0q000120; Thu, 30 Aug 2012 07:34:26 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7U7YQ4g000118; Thu, 30 Aug 2012 07:34:26 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208300734.q7U7YQ4g000118@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 30 Aug 2012 07:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239892 - stable/9/usr.sbin/jail X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 07:34:26 -0000 Author: maxim Date: Thu Aug 30 07:34:25 2012 New Revision: 239892 URL: http://svn.freebsd.org/changeset/base/239892 Log: MFC r237697: restore -u getopt(3) flag. Modified: stable/9/usr.sbin/jail/jail.c Directory Properties: stable/9/usr.sbin/jail/ (props changed) Modified: stable/9/usr.sbin/jail/jail.c ============================================================================== --- stable/9/usr.sbin/jail/jail.c Thu Aug 30 07:25:17 2012 (r239891) +++ stable/9/usr.sbin/jail/jail.c Thu Aug 30 07:34:25 2012 (r239892) @@ -145,7 +145,7 @@ main(int argc, char **argv) cfname = CONF_FILE; JidFile = NULL; - while ((ch = getopt(argc, argv, "cdf:hiJ:lmn:p:qrRs:U:v")) != -1) { + while ((ch = getopt(argc, argv, "cdf:hiJ:lmn:p:qrRs:u:U:v")) != -1) { switch (ch) { case 'c': op |= JF_START; From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 07:38:25 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 168A0106566B; Thu, 30 Aug 2012 07:38:25 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01C358FC08; Thu, 30 Aug 2012 07:38:25 +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 q7U7cOme000666; Thu, 30 Aug 2012 07:38:24 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7U7cOYZ000664; Thu, 30 Aug 2012 07:38:24 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208300738.q7U7cOYZ000664@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 30 Aug 2012 07:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239893 - stable/9/usr.bin/ncal X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 07:38:25 -0000 Author: maxim Date: Thu Aug 30 07:38:24 2012 New Revision: 239893 URL: http://svn.freebsd.org/changeset/base/239893 Log: MFC r232004: use ISO 3166 county code for Sweden. Modified: stable/9/usr.bin/ncal/ncal.c Directory Properties: stable/9/usr.bin/ncal/ (props changed) Modified: stable/9/usr.bin/ncal/ncal.c ============================================================================== --- stable/9/usr.bin/ncal/ncal.c Thu Aug 30 07:34:25 2012 (r239892) +++ stable/9/usr.bin/ncal/ncal.c Thu Aug 30 07:38:24 2012 (r239893) @@ -105,7 +105,7 @@ static struct djswitch { {"RO", "Romania", {1919, 3, 31}}, {"RU", "Russia", {1918, 1, 31}}, {"SI", "Slovenia", {1919, 3, 4}}, - {"SW", "Sweden", {1753, 2, 17}}, + {"SE", "Sweden", {1753, 2, 17}}, {"TR", "Turkey", {1926, 12, 18}}, {"US", "United States", {1752, 9, 2}}, {"YU", "Yugoslavia", {1919, 3, 4}} From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 07:45:26 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86675106566C; Thu, 30 Aug 2012 07:45:26 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70E708FC0C; Thu, 30 Aug 2012 07:45:26 +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 q7U7jQsW001624; Thu, 30 Aug 2012 07:45:26 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7U7jQhR001622; Thu, 30 Aug 2012 07:45:26 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208300745.q7U7jQhR001622@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 30 Aug 2012 07:45:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239894 - stable/9/games/pom X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 07:45:26 -0000 Author: maxim Date: Thu Aug 30 07:45:25 2012 New Revision: 239894 URL: http://svn.freebsd.org/changeset/base/239894 Log: MFC r230644: preserve argv[0] to use it later in usage(). Modified: stable/9/games/pom/pom.c Directory Properties: stable/9/games/pom/ (props changed) Modified: stable/9/games/pom/pom.c ============================================================================== --- stable/9/games/pom/pom.c Thu Aug 30 07:38:24 2012 (r239893) +++ stable/9/games/pom/pom.c Thu Aug 30 07:45:25 2012 (r239894) @@ -86,6 +86,7 @@ main(int argc, char **argv) double days, today, tomorrow; int ch, cnt, pflag = 0; char *odate = NULL, *otime = NULL; + char *progname = argv[0]; while ((ch = getopt(argc, argv, "d:pt:")) != -1) switch (ch) { @@ -99,14 +100,14 @@ main(int argc, char **argv) otime = optarg; break; default: - usage(argv[0]); + usage(progname); } argc -= optind; argv += optind; if (argc) - usage(argv[0]); + usage(progname); /* Adjust based on users preferences */ time(&tt); From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 08:37:07 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C04B1065674; Thu, 30 Aug 2012 08:37:07 +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 771DE8FC22; Thu, 30 Aug 2012 08:37:07 +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 q7U8b7Lj008409; Thu, 30 Aug 2012 08:37:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7U8b7ob008407; Thu, 30 Aug 2012 08:37:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208300837.q7U8b7ob008407@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 30 Aug 2012 08:37:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239897 - stable/9/sys/vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 08:37:07 -0000 Author: kib Date: Thu Aug 30 08:37:06 2012 New Revision: 239897 URL: http://svn.freebsd.org/changeset/base/239897 Log: MFC r238180: Style. Modified: stable/9/sys/vm/vm_pageout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_pageout.c ============================================================================== --- stable/9/sys/vm/vm_pageout.c Thu Aug 30 08:07:37 2012 (r239896) +++ stable/9/sys/vm/vm_pageout.c Thu Aug 30 08:37:06 2012 (r239897) @@ -836,7 +836,7 @@ rescan0: object = m->object; if (!VM_OBJECT_TRYLOCK(object) && (!vm_pageout_fallback_object_lock(m, &next) || - m->hold_count != 0)) { + m->hold_count != 0)) { VM_OBJECT_UNLOCK(object); vm_page_unlock(m); addl_page_shortage++; @@ -867,8 +867,8 @@ rescan0: * level VM system not knowing anything about existing * references. */ - } else if (((m->aflags & PGA_REFERENCED) == 0) && - (actcount = pmap_ts_referenced(m))) { + } else if ((m->aflags & PGA_REFERENCED) == 0 && + (actcount = pmap_ts_referenced(m)) != 0) { vm_page_activate(m); vm_page_unlock(m); m->act_count += actcount + ACT_ADVANCE; From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 10:12:41 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E4FC1065676; Thu, 30 Aug 2012 10:12:41 +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 28DF48FC1F; Thu, 30 Aug 2012 10:12:41 +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 q7UACfMX021023; Thu, 30 Aug 2012 10:12:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UACeft021019; Thu, 30 Aug 2012 10:12:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208301012.q7UACeft021019@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 30 Aug 2012 10:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239899 - in stable/9: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 10:12:41 -0000 Author: kib Date: Thu Aug 30 10:12:40 2012 New Revision: 239899 URL: http://svn.freebsd.org/changeset/base/239899 Log: MFC r238667: Fixes for symbols visibility issues and style in fcntl.h. Modified: stable/9/lib/libc/sys/fcntl.c stable/9/sys/kern/kern_descrip.c stable/9/sys/sys/fcntl.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/lib/libc/sys/fcntl.c ============================================================================== --- stable/9/lib/libc/sys/fcntl.c Thu Aug 30 08:54:13 2012 (r239898) +++ stable/9/lib/libc/sys/fcntl.c Thu Aug 30 10:12:40 2012 (r239899) @@ -41,7 +41,7 @@ __fcntl_compat(int fd, int cmd, ...) { va_list args; long arg; - struct oflock ofl; + struct __oflock ofl; struct flock *flp; int res; Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Thu Aug 30 08:54:13 2012 (r239898) +++ stable/9/sys/kern/kern_descrip.c Thu Aug 30 10:12:40 2012 (r239899) @@ -364,7 +364,7 @@ int sys_fcntl(struct thread *td, struct fcntl_args *uap) { struct flock fl; - struct oflock ofl; + struct __oflock ofl; intptr_t arg; int error; int cmd; Modified: stable/9/sys/sys/fcntl.h ============================================================================== --- stable/9/sys/sys/fcntl.h Thu Aug 30 08:54:13 2012 (r239898) +++ stable/9/sys/sys/fcntl.h Thu Aug 30 10:12:40 2012 (r239899) @@ -111,7 +111,7 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE /* Attempt to bypass buffer cache */ -#define O_DIRECT 0x00010000 +#define O_DIRECT 0x00010000 #endif /* Defined by POSIX Extended API Set Part 2 */ @@ -213,18 +213,22 @@ typedef __pid_t pid_t; #define F_SETFL 4 /* set file status flags */ #if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 #define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ -#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ +#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ #endif +#if __BSD_VISIBLE #define F_OGETLK 7 /* get record locking information */ #define F_OSETLK 8 /* set record locking information */ #define F_OSETLKW 9 /* F_SETLK; wait if blocked */ #define F_DUP2FD 10 /* duplicate file descriptor to arg */ +#endif #define F_GETLK 11 /* get record locking information */ #define F_SETLK 12 /* set record locking information */ #define F_SETLKW 13 /* F_SETLK; wait if blocked */ +#if __BSD_VISIBLE #define F_SETLK_REMOTE 14 /* debugging support for remote locks */ #define F_READAHEAD 15 /* read ahead */ #define F_RDAHEAD 16 /* Darwin compatible read ahead */ +#endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 #define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ #endif @@ -239,14 +243,16 @@ typedef __pid_t pid_t; #define F_RDLCK 1 /* shared or read lock */ #define F_UNLCK 2 /* unlock */ #define F_WRLCK 3 /* exclusive or write lock */ +#if __BSD_VISIBLE #define F_UNLCKSYS 4 /* purge locks for a given system ID */ #define F_CANCEL 5 /* cancel an async lock request */ +#endif #ifdef _KERNEL #define F_WAIT 0x010 /* Wait until lock is granted */ #define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ #define F_POSIX 0x040 /* Use POSIX semantics for lock */ #define F_REMOTE 0x080 /* Lock owner is remote NFS client */ -#define F_NOINTR 0x100 /* Ignore signals when waiting */ +#define F_NOINTR 0x100 /* Ignore signals when waiting */ #endif /* @@ -262,18 +268,19 @@ struct flock { int l_sysid; /* remote system id or zero for local */ }; +#if __BSD_VISIBLE /* * Old advisory file segment locking data type, * before adding l_sysid. */ -struct oflock { +struct __oflock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; - +#endif #if __BSD_VISIBLE /* lock operations for flock(2) */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 10:18:56 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36298106564A; Thu, 30 Aug 2012 10:18:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 207128FC15; Thu, 30 Aug 2012 10:18: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 q7UAItdg022073; Thu, 30 Aug 2012 10:18:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UAItP8022069; Thu, 30 Aug 2012 10:18:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208301018.q7UAItP8022069@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 30 Aug 2012 10:18:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239900 - in stable/9/sys: compat/ia32 kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 10:18:56 -0000 Author: kib Date: Thu Aug 30 10:18:55 2012 New Revision: 239900 URL: http://svn.freebsd.org/changeset/base/239900 Log: MFC r238687: Cosmetics: define FREEBSD32_MINUSER and AOUT32_MINUSER for struct sysentvec .sv_minuser. Also improve style. Modified: stable/9/sys/compat/ia32/ia32_sysvec.c stable/9/sys/compat/ia32/ia32_util.h stable/9/sys/kern/imgact_aout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/9/sys/compat/ia32/ia32_sysvec.c Thu Aug 30 10:12:40 2012 (r239899) +++ stable/9/sys/compat/ia32/ia32_sysvec.c Thu Aug 30 10:18:55 2012 (r239900) @@ -126,7 +126,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, .sv_pagesize = IA32_PAGE_SIZE, - .sv_minuser = 0, + .sv_minuser = FREEBSD32_MINUSER, .sv_maxuser = FREEBSD32_MAXUSER, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, Modified: stable/9/sys/compat/ia32/ia32_util.h ============================================================================== --- stable/9/sys/compat/ia32/ia32_util.h Thu Aug 30 10:12:40 2012 (r239899) +++ stable/9/sys/compat/ia32/ia32_util.h Thu Aug 30 10:18:55 2012 (r239900) @@ -35,29 +35,30 @@ #include #include - #include #include #include #ifdef __ia64__ -#define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE * 2) +#define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE * 2) +#define FREEBSD32_MINUSER 0 #define FREEBSD32_SHAREDPAGE 0 -#define FREEBSD32_USRSTACK FREEBSD32_MAXUSER -#else +#define FREEBSD32_USRSTACK FREEBSD32_MAXUSER +#else /* __ia64__ */ #define FREEBSD32_MAXUSER ((1ul << 32) - IA32_PAGE_SIZE) +#define FREEBSD32_MINUSER 0 #define FREEBSD32_SHAREDPAGE (FREEBSD32_MAXUSER - IA32_PAGE_SIZE) -#define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE -#endif +#define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE +#endif /* __ia64 */ #define IA32_PAGE_SIZE 4096 #define IA32_MAXDSIZ (512*1024*1024) /* 512MB */ #define IA32_MAXSSIZ (64*1024*1024) /* 64MB */ -#define IA32_MAXVMEM 0 /* Unlimited */ +#define IA32_MAXVMEM 0 /* Unlimited */ struct syscall_args; int ia32_fetch_syscall_args(struct thread *td, struct syscall_args *sa); void ia32_set_syscall_retval(struct thread *, int); void ia32_fixlimit(struct rlimit *rl, int which); -#endif +#endif /* _COMPAT_IA32_IA32_UTIL_H */ Modified: stable/9/sys/kern/imgact_aout.c ============================================================================== --- stable/9/sys/kern/imgact_aout.c Thu Aug 30 10:12:40 2012 (r239899) +++ stable/9/sys/kern/imgact_aout.c Thu Aug 30 10:18:55 2012 (r239900) @@ -106,6 +106,7 @@ struct sysentvec aout_sysvec = { #define AOUT32_USRSTACK 0xbfc00000 #define AOUT32_PS_STRINGS \ (AOUT32_USRSTACK - sizeof(struct freebsd32_ps_strings)) +#define AOUT32_MINUSER FREEBSD32_MINUSER extern const char *freebsd32_syscallnames[]; extern u_long ia32_maxssiz; @@ -129,7 +130,7 @@ struct sysentvec aout_sysvec = { .sv_imgact_try = NULL, .sv_minsigstksz = MINSIGSTKSZ, .sv_pagesize = IA32_PAGE_SIZE, - .sv_minuser = 0, + .sv_minuser = AOUT32_MINUSER, .sv_maxuser = AOUT32_USRSTACK, .sv_usrstack = AOUT32_USRSTACK, .sv_psstrings = AOUT32_PS_STRINGS, From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 10:23:28 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DF6B1065677; Thu, 30 Aug 2012 10:23:28 +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 1971D8FC08; Thu, 30 Aug 2012 10:23:28 +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 q7UANRCg022878; Thu, 30 Aug 2012 10:23:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UANR26022874; Thu, 30 Aug 2012 10:23:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208301023.q7UANR26022874@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 30 Aug 2012 10:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239901 - stable/9/sys/sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 10:23:28 -0000 Author: kib Date: Thu Aug 30 10:23:27 2012 New Revision: 239901 URL: http://svn.freebsd.org/changeset/base/239901 Log: MFC r238703: Put struct ostat and struct nstat under #ifdef _KERNEL. The compatibility definitions are only needed for implementation of the syscalls, they cause namespace pollution and are not useful for applications. Modified: stable/9/sys/sys/stat.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/stat.h ============================================================================== --- stable/9/sys/sys/stat.h Thu Aug 30 10:18:55 2012 (r239900) +++ stable/9/sys/sys/stat.h Thu Aug 30 10:23:27 2012 (r239901) @@ -99,7 +99,7 @@ typedef __uid_t uid_t; #include #endif -#if __BSD_VISIBLE +#ifdef _KERNEL struct ostat { __uint16_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ @@ -117,7 +117,7 @@ struct ostat { fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ }; -#endif /* __BSD_VISIBLE */ +#endif struct stat { __dev_t st_dev; /* inode's device */ @@ -149,7 +149,7 @@ struct stat { unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); }; -#if __BSD_VISIBLE +#ifdef _KERNEL struct nstat { __dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 10:38:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 92E3F1065679; Thu, 30 Aug 2012 10:38:42 +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 7CFE28FC0A; Thu, 30 Aug 2012 10:38:42 +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 q7UAcg1L024831; Thu, 30 Aug 2012 10:38:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UAcgrj024827; Thu, 30 Aug 2012 10:38:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208301038.q7UAcgrj024827@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 30 Aug 2012 10:38:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239902 - in stable/9/sys: amd64/include i386/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 10:38:42 -0000 Author: kib Date: Thu Aug 30 10:38:41 2012 New Revision: 239902 URL: http://svn.freebsd.org/changeset/base/239902 Log: MFC r238972: Add lfence(). Modified: stable/9/sys/amd64/include/cpufunc.h stable/9/sys/i386/include/cpufunc.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/cpufunc.h ============================================================================== --- stable/9/sys/amd64/include/cpufunc.h Thu Aug 30 10:23:27 2012 (r239901) +++ stable/9/sys/amd64/include/cpufunc.h Thu Aug 30 10:38:41 2012 (r239902) @@ -274,6 +274,13 @@ outw(u_int port, u_short data) } static __inline void +lfence(void) +{ + + __asm __volatile("lfence" : : : "memory"); +} + +static __inline void mfence(void) { Modified: stable/9/sys/i386/include/cpufunc.h ============================================================================== --- stable/9/sys/i386/include/cpufunc.h Thu Aug 30 10:23:27 2012 (r239901) +++ stable/9/sys/i386/include/cpufunc.h Thu Aug 30 10:38:41 2012 (r239902) @@ -148,6 +148,13 @@ cpu_mwait(u_long extensions, u_int hints } static __inline void +lfence(void) +{ + + __asm __volatile("lfence" : : : "memory"); +} + +static __inline void mfence(void) { From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 18:03:03 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E64B1106566C; Thu, 30 Aug 2012 18:03:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C73FD8FC12; Thu, 30 Aug 2012 18:03: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 q7UI33je088314; Thu, 30 Aug 2012 18:03:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UI33pc088309; Thu, 30 Aug 2012 18:03:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208301803.q7UI33pc088309@svn.freebsd.org> From: John Baldwin Date: Thu, 30 Aug 2012 18:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239914 - in stable/9/sys: amd64/amd64 amd64/include i386/include i386/isa X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 18:03:04 -0000 Author: jhb Date: Thu Aug 30 18:03:03 2012 New Revision: 239914 URL: http://svn.freebsd.org/changeset/base/239914 Log: MFC 238311: Add a clts() wrapper around the 'clts' instruction to on x86 and use that to implement stop_emulating() in the fpu/npx code. Reimplement start_emulating() in the non-XEN case by using load_cr0() and rcr0() instead of the 'lmsw' and 'smsw' instructions. Intel explicitly discourages the use of 'lmsw' and 'smsw' on 80386 and later processors in the description of these instructions in Volume 2 of the ADM. Modified: stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/include/cpufunc.h stable/9/sys/i386/include/cpufunc.h stable/9/sys/i386/isa/npx.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Thu Aug 30 17:47:39 2012 (r239913) +++ stable/9/sys/amd64/amd64/fpu.c Thu Aug 30 18:03:03 2012 (r239914) @@ -73,10 +73,6 @@ __FBSDID("$FreeBSD$"); #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr)) -#define start_emulating() __asm __volatile( \ - "smsw %%ax; orb %0,%%al; lmsw %%ax" \ - : : "n" (CR0_TS) : "ax") -#define stop_emulating() __asm __volatile("clts") static __inline void xrstor(char *addr, uint64_t mask) @@ -109,13 +105,14 @@ void fnstsw(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); -void start_emulating(void); -void stop_emulating(void); void xrstor(char *addr, uint64_t mask); void xsave(char *addr, uint64_t mask); #endif /* __GNUCLIKE_ASM && !lint */ +#define start_emulating() load_cr0(rcr0() | CR0_TS) +#define stop_emulating() clts() + #define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) #define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) Modified: stable/9/sys/amd64/include/cpufunc.h ============================================================================== --- stable/9/sys/amd64/include/cpufunc.h Thu Aug 30 17:47:39 2012 (r239913) +++ stable/9/sys/amd64/include/cpufunc.h Thu Aug 30 18:03:03 2012 (r239914) @@ -107,6 +107,13 @@ clflush(u_long addr) } static __inline void +clts(void) +{ + + __asm __volatile("clts"); +} + +static __inline void disable_intr(void) { __asm __volatile("cli" : : : "memory"); @@ -700,6 +707,9 @@ intr_restore(register_t rflags) int breakpoint(void); u_int bsfl(u_int mask); u_int bsrl(u_int mask); +void clflush(u_long addr); +void clts(void); +void cpuid_count(u_int ax, u_int cx, u_int *p); void disable_intr(void); void do_cpuid(u_int ax, u_int *p); void enable_intr(void); Modified: stable/9/sys/i386/include/cpufunc.h ============================================================================== --- stable/9/sys/i386/include/cpufunc.h Thu Aug 30 17:47:39 2012 (r239913) +++ stable/9/sys/i386/include/cpufunc.h Thu Aug 30 18:03:03 2012 (r239914) @@ -97,6 +97,13 @@ clflush(u_long addr) } static __inline void +clts(void) +{ + + __asm __volatile("clts"); +} + +static __inline void disable_intr(void) { #ifdef XEN @@ -695,6 +702,9 @@ intr_restore(register_t eflags) int breakpoint(void); u_int bsfl(u_int mask); u_int bsrl(u_int mask); +void clflush(u_long addr); +void clts(void); +void cpuid_count(u_int ax, u_int cx, u_int *p); void disable_intr(void); void do_cpuid(u_int ax, u_int *p); void enable_intr(void); Modified: stable/9/sys/i386/isa/npx.c ============================================================================== --- stable/9/sys/i386/isa/npx.c Thu Aug 30 17:47:39 2012 (r239913) +++ stable/9/sys/i386/isa/npx.c Thu Aug 30 18:03:03 2012 (r239914) @@ -100,15 +100,6 @@ __FBSDID("$FreeBSD$"); #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #endif -#ifdef XEN -#define start_emulating() (HYPERVISOR_fpu_taskswitch(1)) -#define stop_emulating() (HYPERVISOR_fpu_taskswitch(0)) -#else -#define start_emulating() __asm __volatile( \ - "smsw %%ax; orb %0,%%al; lmsw %%ax" \ - : : "n" (CR0_TS) : "ax") -#define stop_emulating() __asm __volatile("clts") -#endif #else /* !(__GNUCLIKE_ASM && !lint) */ void fldcw(u_short cw); @@ -123,11 +114,17 @@ void frstor(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); #endif -void start_emulating(void); -void stop_emulating(void); #endif /* __GNUCLIKE_ASM && !lint */ +#ifdef XEN +#define start_emulating() (HYPERVISOR_fpu_taskswitch(1)) +#define stop_emulating() (HYPERVISOR_fpu_taskswitch(0)) +#else +#define start_emulating() load_cr0(rcr0() | CR0_TS) +#define stop_emulating() clts() +#endif + #ifdef CPU_ENABLE_SSE #define GET_FPU_CW(thread) \ (cpu_fxsr ? \ From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 18:29:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5CFF2106566B; Thu, 30 Aug 2012 18:29:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4708F8FC12; Thu, 30 Aug 2012 18:29: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 q7UITo4R091818; Thu, 30 Aug 2012 18:29:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UIToR1091816; Thu, 30 Aug 2012 18:29:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208301829.q7UIToR1091816@svn.freebsd.org> From: John Baldwin Date: Thu, 30 Aug 2012 18:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239915 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 18:29:50 -0000 Author: jhb Date: Thu Aug 30 18:29:49 2012 New Revision: 239915 URL: http://svn.freebsd.org/changeset/base/239915 Log: MFC 238424: Make the interval timings for EVFILT_TIMER more accurate. tvtohz() always adds an extra tick to account for the current partial clock tick. However, that is not appropriate for a repeating timer when the exact tvtohz() value should be used for subsequent intervals. Fix repeating callouts for EVFILT_TIMER by subtracting 1 tick from the tvtohz() result similar to the fix used in realitexpire() for interval timers. While here, update a few comments to note that if the EVFILT_TIMER code were to move out of kern_event.c, it should move to kern_time.c (where the interval timer code it mimics lives) rather than kern_timeout.c. Modified: stable/9/sys/kern/kern_event.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/kern/kern_event.c ============================================================================== --- stable/9/sys/kern/kern_event.c Thu Aug 30 18:03:03 2012 (r239914) +++ stable/9/sys/kern/kern_event.c Thu Aug 30 18:29:49 2012 (r239915) @@ -512,6 +512,10 @@ knote_fork(struct knlist *list, int pid) list->kl_unlock(list->kl_lockarg); } +/* + * XXX: EVFILT_TIMER should perhaps live in kern_time.c beside the + * interval timer support code. + */ static int timertoticks(intptr_t data) { @@ -525,7 +529,6 @@ timertoticks(intptr_t data) return tticks; } -/* XXX - move to kern_timeout.c? */ static void filt_timerexpire(void *knx) { @@ -535,9 +538,16 @@ filt_timerexpire(void *knx) kn->kn_data++; KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ + /* + * timertoticks() uses tvtohz() which always adds 1 to allow + * for the time until the next clock interrupt being strictly + * less than 1 clock tick. We don't want that here since we + * want to appear to be in sync with the clock interrupt even + * when we're delayed. + */ if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { calloutp = (struct callout *)kn->kn_hook; - callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata), + callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata) - 1, filt_timerexpire, kn); } } @@ -545,7 +555,6 @@ filt_timerexpire(void *knx) /* * data contains amount of time to sleep, in milliseconds */ -/* XXX - move to kern_timeout.c? */ static int filt_timerattach(struct knote *kn) { @@ -569,7 +578,6 @@ filt_timerattach(struct knote *kn) return (0); } -/* XXX - move to kern_timeout.c? */ static void filt_timerdetach(struct knote *kn) { @@ -582,7 +590,6 @@ filt_timerdetach(struct knote *kn) kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */ } -/* XXX - move to kern_timeout.c? */ static int filt_timer(struct knote *kn, long hint) { From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 19:46:38 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD1DB106566B; Thu, 30 Aug 2012 19:46:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AEA3A8FC08; Thu, 30 Aug 2012 19:46:38 +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 q7UJkcb4002367; Thu, 30 Aug 2012 19:46:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UJkchv002365; Thu, 30 Aug 2012 19:46:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208301946.q7UJkchv002365@svn.freebsd.org> From: John Baldwin Date: Thu, 30 Aug 2012 19:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239917 - stable/9/sys/dev/pci X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 19:46:39 -0000 Author: jhb Date: Thu Aug 30 19:46:38 2012 New Revision: 239917 URL: http://svn.freebsd.org/changeset/base/239917 Log: MFC 239103: Explicitly enable busmastering on PCI-PCI bridges. Transactions initiated on the secondary side of a bridge will not be propagated to the primary bus unless this is enabled. Busmastering is not enabled by default (we have relied on firmware to set this bit to date). The OS needs to set it for any bridges not configured by system firmware. Modified: stable/9/sys/dev/pci/pci_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/pci/pci_pci.c ============================================================================== --- stable/9/sys/dev/pci/pci_pci.c Thu Aug 30 18:30:08 2012 (r239916) +++ stable/9/sys/dev/pci/pci_pci.c Thu Aug 30 19:46:38 2012 (r239917) @@ -683,6 +683,13 @@ pcib_attach_common(device_t dev) * would be more widely routed than absolutely necessary. We could * then do a walk of the tree later and fix it. */ + + /* + * Always enable busmastering on bridges so that transactions + * initiated on the secondary bus are passed through to the + * primary bus. + */ + pci_enable_busmaster(dev); } int From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 20:42:43 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E465106566C; Thu, 30 Aug 2012 20:42:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB7F8FC0C; Thu, 30 Aug 2012 20:42:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7UKghXZ010938; Thu, 30 Aug 2012 20:42:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UKghnS010935; Thu, 30 Aug 2012 20:42:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208302042.q7UKghnS010935@svn.freebsd.org> From: John Baldwin Date: Thu, 30 Aug 2012 20:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239920 - stable/9/sys/dev/ipmi X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 20:42:43 -0000 Author: jhb Date: Thu Aug 30 20:42:42 2012 New Revision: 239920 URL: http://svn.freebsd.org/changeset/base/239920 Log: MFC 239128: Don't try to stop the IPMI watchdog timer if it is not running. Starting or stopping the IPMI watchdog is rather expensive with the current implementation as all IPMI requests are bounced via thread. This is not viable during shutdown or dumps, and this avoids headache in the common case that the watchdog is not enabled. The IPMI watchdog should probably be reworked to not use a separate thread to fix this in the case when the watchdog timer is enabled. Modified: stable/9/sys/dev/ipmi/ipmi.c stable/9/sys/dev/ipmi/ipmivars.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/ipmi/ipmi.c ============================================================================== --- stable/9/sys/dev/ipmi/ipmi.c Thu Aug 30 20:31:53 2012 (r239919) +++ stable/9/sys/dev/ipmi/ipmi.c Thu Aug 30 20:42:42 2012 (r239920) @@ -652,11 +652,12 @@ ipmi_wd_event(void *arg, unsigned int cm if (timeout == 0) timeout = 1; e = ipmi_set_watchdog(sc, timeout); - if (e == 0) + if (e == 0) { *error = 0; - else + sc->ipmi_watchdog_active = 1; + } else (void)ipmi_set_watchdog(sc, 0); - } else { + } else if (atomic_readandclear_int(&sc->ipmi_watchdog_active) != 0) { e = ipmi_set_watchdog(sc, 0); if (e != 0 && cmd == 0) *error = EOPNOTSUPP; Modified: stable/9/sys/dev/ipmi/ipmivars.h ============================================================================== --- stable/9/sys/dev/ipmi/ipmivars.h Thu Aug 30 20:31:53 2012 (r239919) +++ stable/9/sys/dev/ipmi/ipmivars.h Thu Aug 30 20:42:42 2012 (r239920) @@ -105,6 +105,7 @@ struct ipmi_softc { struct cdev *ipmi_cdev; TAILQ_HEAD(,ipmi_request) ipmi_pending_requests; eventhandler_tag ipmi_watchdog_tag; + int ipmi_watchdog_active; struct intr_config_hook ipmi_ich; struct mtx ipmi_lock; struct cv ipmi_request_added; From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 23:50:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02569106564A; Thu, 30 Aug 2012 23:50:12 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF8AA8FC14; Thu, 30 Aug 2012 23:50: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 q7UNoBWC033435; Thu, 30 Aug 2012 23:50:11 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UNoBXl033430; Thu, 30 Aug 2012 23:50:11 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201208302350.q7UNoBXl033430@svn.freebsd.org> From: Justin Hibbits Date: Thu, 30 Aug 2012 23:50:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239928 - in stable/9/sys: conf powerpc/conf powerpc/powermac X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 23:50:12 -0000 Author: jhibbits Date: Thu Aug 30 23:50:11 2012 New Revision: 239928 URL: http://svn.freebsd.org/changeset/base/239928 Log: MFC r239027 Add backlight support for nVidia-based PowerBooks/iBooks/iMacs. Added: stable/9/sys/powerpc/powermac/nvbl.c - copied unchanged from r239027, head/sys/powerpc/powermac/nvbl.c Modified: stable/9/sys/conf/files.powerpc stable/9/sys/powerpc/conf/GENERIC stable/9/sys/powerpc/conf/GENERIC64 Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files.powerpc ============================================================================== --- stable/9/sys/conf/files.powerpc Thu Aug 30 22:56:32 2012 (r239927) +++ stable/9/sys/conf/files.powerpc Thu Aug 30 23:50:11 2012 (r239928) @@ -155,6 +155,7 @@ powerpc/powermac/hrowpic.c optional powe powerpc/powermac/kiic.c optional powermac kiic powerpc/powermac/macgpio.c optional powermac pci powerpc/powermac/macio.c optional powermac pci +powerpc/powermac/nvbl.c optional powermac nvbl powerpc/powermac/openpic_macio.c optional powermac pci powerpc/powermac/platform_powermac.c optional powermac powerpc/powermac/powermac_thermal.c optional powermac Modified: stable/9/sys/powerpc/conf/GENERIC ============================================================================== --- stable/9/sys/powerpc/conf/GENERIC Thu Aug 30 22:56:32 2012 (r239927) +++ stable/9/sys/powerpc/conf/GENERIC Thu Aug 30 23:50:11 2012 (r239928) @@ -179,6 +179,7 @@ device powermac_nvram # Open Firmware c device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Modified: stable/9/sys/powerpc/conf/GENERIC64 ============================================================================== --- stable/9/sys/powerpc/conf/GENERIC64 Thu Aug 30 22:56:32 2012 (r239927) +++ stable/9/sys/powerpc/conf/GENERIC64 Thu Aug 30 23:50:11 2012 (r239928) @@ -178,6 +178,7 @@ device max6690 # PowerMac7,2 temperatu device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Copied: stable/9/sys/powerpc/powermac/nvbl.c (from r239027, head/sys/powerpc/powermac/nvbl.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/powerpc/powermac/nvbl.c Thu Aug 30 23:50:11 2012 (r239928, copy of r239027, head/sys/powerpc/powermac/nvbl.c) @@ -0,0 +1,197 @@ +/*- + * Copyright (c) 2012 Justin Hibbits + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define NVIDIA_BRIGHT_MIN (0x0ec) +#define NVIDIA_BRIGHT_MAX (0x538) +#define NVIDIA_BRIGHT_SCALE ((NVIDIA_BRIGHT_MAX - NVIDIA_BRIGHT_MIN)/100) +/* nVidia's MMIO registers are at PCI BAR[0] */ +#define NVIDIA_MMIO_PMC (0x0) +#define NVIDIA_PMC_OFF (NVIDIA_MMIO_PMC + 0x10f0) +#define NVIDIA_PMC_BL_SHIFT (16) +#define NVIDIA_PMC_BL_EN (1 << 31) + + +struct nvbl_softc { + device_t dev; + struct resource *sc_memr; +}; + +static void nvbl_identify(driver_t *driver, device_t parent); +static int nvbl_probe(device_t dev); +static int nvbl_attach(device_t dev); +static int nvbl_setlevel(struct nvbl_softc *sc, int newlevel); +static int nvbl_getlevel(struct nvbl_softc *sc); +static int nvbl_sysctl(SYSCTL_HANDLER_ARGS); + +static device_method_t nvbl_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, nvbl_identify), + DEVMETHOD(device_probe, nvbl_probe), + DEVMETHOD(device_attach, nvbl_attach), + {0, 0}, +}; + +static driver_t nvbl_driver = { + "backlight", + nvbl_methods, + sizeof(struct nvbl_softc) +}; + +static devclass_t nvbl_devclass; + +DRIVER_MODULE(nvbl, vgapci, nvbl_driver, nvbl_devclass, 0, 0); + +static void +nvbl_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "backlight", -1) == NULL) + device_add_child(parent, "backlight", -1); +} + +static int +nvbl_probe(device_t dev) +{ + char control[8]; + phandle_t handle; + + handle = OF_finddevice("mac-io/backlight"); + + if (handle <= 0) + return (ENXIO); + + if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) + return (ENXIO); + + if (strcmp(control, "mnca") != 0) + return (ENXIO); + + device_set_desc(dev, "PowerBook backlight for nVidia graphics"); + + return (0); +} + +static int +nvbl_attach(device_t dev) +{ + struct nvbl_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + int rid; + + sc = device_get_softc(dev); + + rid = 0x10; /* BAR[0], for the MMIO register */ + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->sc_memr == NULL) { + device_printf(dev, "Could not alloc mem resource!\n"); + return (ENXIO); + } + + /* Turn on big-endian mode */ + if (!(bus_read_stream_4(sc->sc_memr, NVIDIA_MMIO_PMC + 4) & 0x01000001)) { + bus_write_stream_4(sc->sc_memr, NVIDIA_MMIO_PMC + 4, 0x01000001); + mb(); + } + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "level", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + nvbl_sysctl, "I", "Backlight level (0-100)"); + + return (0); +} + +static int +nvbl_setlevel(struct nvbl_softc *sc, int newlevel) +{ + uint32_t pmc_reg; + + if (newlevel > 100) + newlevel = 100; + + if (newlevel < 0) + newlevel = 0; + + if (newlevel > 0) + newlevel = (newlevel * NVIDIA_BRIGHT_SCALE) + NVIDIA_BRIGHT_MIN; + + pmc_reg = bus_read_stream_4(sc->sc_memr, NVIDIA_PMC_OFF) & 0xffff; + pmc_reg |= NVIDIA_PMC_BL_EN | (newlevel << NVIDIA_PMC_BL_SHIFT); + bus_write_stream_4(sc->sc_memr, NVIDIA_PMC_OFF, pmc_reg); + + return (0); +} + +static int +nvbl_getlevel(struct nvbl_softc *sc) +{ + uint16_t level; + + level = bus_read_stream_2(sc->sc_memr, NVIDIA_PMC_OFF) & 0x7fff; + + if (level < NVIDIA_BRIGHT_MIN) + return 0; + + level = (level - NVIDIA_BRIGHT_MIN) / NVIDIA_BRIGHT_SCALE; + + return (level); +} + +static int +nvbl_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct nvbl_softc *sc; + int newlevel, error; + + sc = arg1; + + newlevel = nvbl_getlevel(sc); + + error = sysctl_handle_int(oidp, &newlevel, 0, req); + + if (error || !req->newptr) + return (error); + + return (nvbl_setlevel(sc, newlevel)); +} From owner-svn-src-stable-9@FreeBSD.ORG Thu Aug 30 23:54:50 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C765106564A; Thu, 30 Aug 2012 23:54:50 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26FCA8FC08; Thu, 30 Aug 2012 23:54: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 q7UNsoXH033974; Thu, 30 Aug 2012 23:54:50 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7UNsndS033971; Thu, 30 Aug 2012 23:54:49 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201208302354.q7UNsndS033971@svn.freebsd.org> From: Justin Hibbits Date: Thu, 30 Aug 2012 23:54:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239929 - stable/9/sys/powerpc/powermac X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2012 23:54:50 -0000 Author: jhibbits Date: Thu Aug 30 23:54:49 2012 New Revision: 239929 URL: http://svn.freebsd.org/changeset/base/239929 Log: MFC r239548: phandle_t is unsigned, and OF_finddevice() returns (phandle_t)(-1) on failure, so check for that instead of 0. While here, provide a better description for ATI backlight driver. Modified: stable/9/sys/powerpc/powermac/atibl.c stable/9/sys/powerpc/powermac/nvbl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/powermac/atibl.c ============================================================================== --- stable/9/sys/powerpc/powermac/atibl.c Thu Aug 30 23:50:11 2012 (r239928) +++ stable/9/sys/powerpc/powermac/atibl.c Thu Aug 30 23:54:49 2012 (r239929) @@ -98,7 +98,7 @@ atibl_probe(device_t dev) handle = OF_finddevice("mac-io/backlight"); - if (handle <= 0) + if (handle == -1) return (ENXIO); if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) @@ -107,7 +107,7 @@ atibl_probe(device_t dev) if (strcmp(control, "ati") != 0) return (ENXIO); - device_set_desc(dev, "PowerBook backlight"); + device_set_desc(dev, "PowerBook backlight for ATI graphics"); return (0); } Modified: stable/9/sys/powerpc/powermac/nvbl.c ============================================================================== --- stable/9/sys/powerpc/powermac/nvbl.c Thu Aug 30 23:50:11 2012 (r239928) +++ stable/9/sys/powerpc/powermac/nvbl.c Thu Aug 30 23:54:49 2012 (r239929) @@ -94,7 +94,7 @@ nvbl_probe(device_t dev) handle = OF_finddevice("mac-io/backlight"); - if (handle <= 0) + if (handle == -1) return (ENXIO); if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 00:33:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2D44106566C; Fri, 31 Aug 2012 00:33:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A447A8FC18; Fri, 31 Aug 2012 00:33:09 +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 q7V0X9jO038390; Fri, 31 Aug 2012 00:33:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7V0X9SL038386; Fri, 31 Aug 2012 00:33:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208310033.q7V0X9SL038386@svn.freebsd.org> From: Xin LI Date: Fri, 31 Aug 2012 00:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239931 - stable/9/sbin/md5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 00:33:09 -0000 Author: delphij Date: Fri Aug 31 00:33:09 2012 New Revision: 239931 URL: http://svn.freebsd.org/changeset/base/239931 Log: MFC r238964: Teach md5(1) about sha512. Modified: stable/9/sbin/md5/Makefile stable/9/sbin/md5/md5.1 stable/9/sbin/md5/md5.c Directory Properties: stable/9/sbin/md5/ (props changed) Modified: stable/9/sbin/md5/Makefile ============================================================================== --- stable/9/sbin/md5/Makefile Fri Aug 31 00:11:30 2012 (r239930) +++ stable/9/sbin/md5/Makefile Fri Aug 31 00:33:09 2012 (r239931) @@ -5,11 +5,13 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ - ${BINDIR}/md5 ${BINDIR}/sha256 + ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha512 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ - md5.1 sha256.1 + md5.1 sha256.1 \ + md5.1 sha512.1 WFORMAT?= 1 Modified: stable/9/sbin/md5/md5.1 ============================================================================== --- stable/9/sbin/md5/md5.1 Fri Aug 31 00:11:30 2012 (r239930) +++ stable/9/sbin/md5/md5.1 Fri Aug 31 00:33:09 2012 (r239931) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd September 7, 2008 +.Dd July 31, 2012 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , rmd160 +.Nm md5 , sha1 , sha256 , sha512, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,6 +21,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha512 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm rmd160 .Op Fl pqrtx .Op Fl c Ar string @@ -28,7 +33,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -41,7 +46,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 +.Tn MD5 , SHA-1 , SHA-256 , SHA-512 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -104,7 +109,7 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities exit 0 on success, @@ -115,7 +120,8 @@ and 2 if at least one file does not have .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , -.Xr sha256 3 +.Xr sha256 3 , +.Xr sha512 3 .Rs .%A R. Rivest .%T The MD5 Message-Digest Algorithm Modified: stable/9/sbin/md5/md5.c ============================================================================== --- stable/9/sbin/md5/md5.c Fri Aug 31 00:11:30 2012 (r239930) +++ stable/9/sbin/md5/md5.c Fri Aug 31 00:33:09 2012 (r239931) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; +extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { @@ -78,12 +80,14 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; + SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; /* max(MD5_DIGEST_LENGTH, SHA_DIGEST_LENGTH, - SHA256_DIGEST_LENGTH, RIPEMD160_DIGEST_LENGTH)*2+1 */ -#define HEX_DIGEST_LENGTH 65 + SHA256_DIGEST_LENGTH, SHA512_DIGEST_LENGTH, + RIPEMD160_DIGEST_LENGTH)*2+1 */ +#define HEX_DIGEST_LENGTH 129 /* algorithm function table */ @@ -97,6 +101,9 @@ struct Algorithm_t Algorithm[] = { { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, + { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, + (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, + &SHA512_Data, &SHA512_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } @@ -320,6 +327,17 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; +const char *SHA512_TestOutput[MDTESTCOUNT] = { + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", + "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", + "107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c", + "4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1", + "1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894", + "72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843", + "e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3" +}; + const char *RIPEMD160_TestOutput[MDTESTCOUNT] = { "9c1185a5c5e9fc54612808977ee8f548b2258d31", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 06:34:47 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6C55106566C; Fri, 31 Aug 2012 06:34:47 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77D0B8FC1A; Fri, 31 Aug 2012 06:34: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 q7V6Yls4081909; Fri, 31 Aug 2012 06:34:47 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7V6YllD081907; Fri, 31 Aug 2012 06:34:47 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208310634.q7V6YllD081907@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 31 Aug 2012 06:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239935 - stable/9/usr.sbin/ifmcstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 06:34:47 -0000 Author: maxim Date: Fri Aug 31 06:34:46 2012 New Revision: 239935 URL: http://svn.freebsd.org/changeset/base/239935 Log: MFC r230617: allow to build ifmcstat(8) without kvm(3) support. Modified: stable/9/usr.sbin/ifmcstat/ifmcstat.c Directory Properties: stable/9/usr.sbin/ifmcstat/ (props changed) Modified: stable/9/usr.sbin/ifmcstat/ifmcstat.c ============================================================================== --- stable/9/usr.sbin/ifmcstat/ifmcstat.c Fri Aug 31 02:59:44 2012 (r239934) +++ stable/9/usr.sbin/ifmcstat/ifmcstat.c Fri Aug 31 06:34:46 2012 (r239935) @@ -440,32 +440,6 @@ ll_addrlist(struct ifaddr *ifap) #ifdef INET6 static void -in6_ifinfo(struct mld_ifinfo *mli) -{ - - printf("\t"); - switch (mli->mli_version) { - case MLD_VERSION_1: - case MLD_VERSION_2: - printf("mldv%d", mli->mli_version); - break; - default: - printf("mldv?(%d)", mli->mli_version); - break; - } - printb(" flags", mli->mli_flags, "\020\1SILENT"); - if (mli->mli_version == MLD_VERSION_2) { - printf(" rv %u qi %u qri %u uri %u", - mli->mli_rv, mli->mli_qi, mli->mli_qri, mli->mli_uri); - } - if (vflag >= 2) { - printf(" v1timer %u v2timer %u", mli->mli_v1_timer, - mli->mli_v2_timer); - } - printf("\n"); -} - -static void if6_addrlist(struct ifaddr *ifap) { struct ifnet ifnet; @@ -762,6 +736,33 @@ in_multientry(struct in_multi *pinm) #endif /* WITH_KVM */ #ifdef INET6 + +static void +in6_ifinfo(struct mld_ifinfo *mli) +{ + + printf("\t"); + switch (mli->mli_version) { + case MLD_VERSION_1: + case MLD_VERSION_2: + printf("mldv%d", mli->mli_version); + break; + default: + printf("mldv?(%d)", mli->mli_version); + break; + } + printb(" flags", mli->mli_flags, "\020\1SILENT"); + if (mli->mli_version == MLD_VERSION_2) { + printf(" rv %u qi %u qri %u uri %u", + mli->mli_rv, mli->mli_qi, mli->mli_qri, mli->mli_uri); + } + if (vflag >= 2) { + printf(" v1timer %u v2timer %u", mli->mli_v1_timer, + mli->mli_v2_timer); + } + printf("\n"); +} + static const char * inet6_n2a(struct in6_addr *p) { From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 06:38:44 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E492106566C; Fri, 31 Aug 2012 06:38:44 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7D58FC15; Fri, 31 Aug 2012 06:38:44 +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 q7V6cim1082410; Fri, 31 Aug 2012 06:38:44 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7V6cim2082406; Fri, 31 Aug 2012 06:38:44 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201208310638.q7V6cim2082406@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 31 Aug 2012 06:38:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239936 - in stable/9: sys/netinet6 usr.bin/netstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 06:38:44 -0000 Author: maxim Date: Fri Aug 31 06:38:43 2012 New Revision: 239936 URL: http://svn.freebsd.org/changeset/base/239936 Log: MFC r228700: convert IPv6 read-only stats sysctls to the read-write ones. Teach netstat(1) -z to reset these sysctls. Modified: stable/9/sys/netinet6/in6_proto.c stable/9/sys/netinet6/ip6_mroute.c stable/9/usr.bin/netstat/inet6.c Directory Properties: stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/sys/netinet6/in6_proto.c ============================================================================== --- stable/9/sys/netinet6/in6_proto.c Fri Aug 31 06:34:46 2012 (r239935) +++ stable/9/sys/netinet6/in6_proto.c Fri Aug 31 06:38:43 2012 (r239936) @@ -520,7 +520,7 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ &VNET_NAME(ip6_sendredirects), 0, ""); SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM, hlim, CTLFLAG_RW, &VNET_NAME(ip6_defhlim), 0, ""); -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RD, +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_STATS, stats, CTLFLAG_RW, &VNET_NAME(ip6stat), ip6stat, ""); SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, maxfragpackets, CTLFLAG_RW, &VNET_NAME(ip6_maxfragpackets), 0, ""); @@ -573,7 +573,7 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_ CTLFLAG_RW, &VNET_NAME(ip6_auto_linklocal), 0, "Default value of per-interface flag for automatically adding an IPv6" " link-local address to interfaces when attached"); -SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RD, +SYSCTL_VNET_STRUCT(_net_inet6_ip6, IPV6CTL_RIP6STATS, rip6stats, CTLFLAG_RW, &VNET_NAME(rip6stat), rip6stat, ""); SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_PREFER_TEMPADDR, prefer_tempaddr, CTLFLAG_RW, &VNET_NAME(ip6_prefer_tempaddr), 0, ""); @@ -603,7 +603,7 @@ SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6 CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0, ""); SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT, redirtimeout, CTLFLAG_RW, &VNET_NAME(icmp6_redirtimeout), 0, ""); -SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD, +SYSCTL_VNET_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RW, &VNET_NAME(icmp6stat), icmp6stat, ""); SYSCTL_VNET_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE, nd6_prune, CTLFLAG_RW, &VNET_NAME(nd6_prune), 0, ""); Modified: stable/9/sys/netinet6/ip6_mroute.c ============================================================================== --- stable/9/sys/netinet6/ip6_mroute.c Fri Aug 31 06:34:46 2012 (r239935) +++ stable/9/sys/netinet6/ip6_mroute.c Fri Aug 31 06:38:43 2012 (r239936) @@ -250,7 +250,7 @@ static mifi_t nummifs = 0; static mifi_t reg_mif_num = (mifi_t)-1; static struct pim6stat pim6stat; -SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RD, +SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RW, &pim6stat, pim6stat, "PIM Statistics (struct pim6stat, netinet6/pim_var.h)"); Modified: stable/9/usr.bin/netstat/inet6.c ============================================================================== --- stable/9/usr.bin/netstat/inet6.c Fri Aug 31 06:34:46 2012 (r239935) +++ stable/9/usr.bin/netstat/inet6.c Fri Aug 31 06:38:43 2012 (r239936) @@ -360,15 +360,17 @@ static char *srcrule_str[] = { void ip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct ip6stat ip6stat; + struct ip6stat ip6stat, zerostat; int first, i; size_t len; len = sizeof ip6stat; if (live) { memset(&ip6stat, 0, len); - if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, NULL, - 0) < 0) { + if (zflag) + memset(&zerostat, 0, len); + if (sysctlbyname("net.inet6.ip6.stats", &ip6stat, &len, + zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) warn("sysctl: net.inet6.ip6.stats"); return; @@ -840,15 +842,17 @@ static const char *icmp6names[] = { void icmp6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct icmp6stat icmp6stat; + struct icmp6stat icmp6stat, zerostat; int i, first; size_t len; len = sizeof icmp6stat; if (live) { memset(&icmp6stat, 0, len); + if (zflag) + memset(&zerostat, 0, len); if (sysctlbyname("net.inet6.icmp6.stats", &icmp6stat, &len, - NULL, 0) < 0) { + zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) warn("sysctl: net.inet6.icmp6.stats"); return; @@ -1033,14 +1037,16 @@ pim6_stats(u_long off, const char *name, void rip6_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { - struct rip6stat rip6stat; + struct rip6stat rip6stat, zerostat; u_quad_t delivered; size_t len; len = sizeof(rip6stat); if (live) { + if (zflag) + memset(&zerostat, 0, len); if (sysctlbyname("net.inet6.ip6.rip6stats", &rip6stat, &len, - NULL, 0) < 0) { + zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { if (errno != ENOENT) warn("sysctl: net.inet6.ip6.rip6stats"); return; From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 06:42:52 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A48B106567B; Fri, 31 Aug 2012 06:42:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A3D98FC1A; Fri, 31 Aug 2012 06:42: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 q7V6gqXH083023; Fri, 31 Aug 2012 06:42:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7V6gqBt083019; Fri, 31 Aug 2012 06:42:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208310642.q7V6gqBt083019@svn.freebsd.org> From: Xin LI Date: Fri, 31 Aug 2012 06:42:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239937 - in stable: 8/sbin/md5 9/sbin/md5 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 06:42:52 -0000 Author: delphij Date: Fri Aug 31 06:42:51 2012 New Revision: 239937 URL: http://svn.freebsd.org/changeset/base/239937 Log: Revert 239931 and 239932 until I figure out why it breaks on stable branches but not on -HEAD. Noticed by: tinderbox Pointy hat to: delphij Modified: stable/9/sbin/md5/Makefile stable/9/sbin/md5/md5.1 stable/9/sbin/md5/md5.c Directory Properties: stable/9/sbin/md5/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sbin/md5/Makefile stable/8/sbin/md5/md5.1 stable/8/sbin/md5/md5.c Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/9/sbin/md5/Makefile ============================================================================== --- stable/9/sbin/md5/Makefile Fri Aug 31 06:38:43 2012 (r239936) +++ stable/9/sbin/md5/Makefile Fri Aug 31 06:42:51 2012 (r239937) @@ -5,13 +5,11 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ - ${BINDIR}/md5 ${BINDIR}/sha256 \ - ${BINDIR}/md5 ${BINDIR}/sha512 + ${BINDIR}/md5 ${BINDIR}/sha256 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ - md5.1 sha256.1 \ - md5.1 sha512.1 + md5.1 sha256.1 WFORMAT?= 1 Modified: stable/9/sbin/md5/md5.1 ============================================================================== --- stable/9/sbin/md5/md5.1 Fri Aug 31 06:38:43 2012 (r239936) +++ stable/9/sbin/md5/md5.1 Fri Aug 31 06:42:51 2012 (r239937) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd July 31, 2012 +.Dd September 7, 2008 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha512, rmd160 +.Nm md5 , sha1 , sha256 , rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,11 +21,6 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar -.Nm sha512 -.Op Fl pqrtx -.Op Fl c Ar string -.Op Fl s Ar string -.Op Ar .Nm rmd160 .Op Fl pqrtx .Op Fl c Ar string @@ -33,7 +28,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha512 +.Nm md5 , sha1 , sha256 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -46,7 +41,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 , SHA-512 +.Tn MD5 , SHA-1 , SHA-256 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -109,7 +104,7 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 , sha512 +.Nm md5 , sha1 , sha256 and .Nm rmd160 utilities exit 0 on success, @@ -120,8 +115,7 @@ and 2 if at least one file does not have .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , -.Xr sha256 3 , -.Xr sha512 3 +.Xr sha256 3 .Rs .%A R. Rivest .%T The MD5 Message-Digest Algorithm Modified: stable/9/sbin/md5/md5.c ============================================================================== --- stable/9/sbin/md5/md5.c Fri Aug 31 06:38:43 2012 (r239936) +++ stable/9/sbin/md5/md5.c Fri Aug 31 06:42:51 2012 (r239937) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -55,7 +54,6 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; -extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { @@ -80,14 +78,12 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; - SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; /* max(MD5_DIGEST_LENGTH, SHA_DIGEST_LENGTH, - SHA256_DIGEST_LENGTH, SHA512_DIGEST_LENGTH, - RIPEMD160_DIGEST_LENGTH)*2+1 */ -#define HEX_DIGEST_LENGTH 129 + SHA256_DIGEST_LENGTH, RIPEMD160_DIGEST_LENGTH)*2+1 */ +#define HEX_DIGEST_LENGTH 65 /* algorithm function table */ @@ -101,9 +97,6 @@ struct Algorithm_t Algorithm[] = { { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, - { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, - (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, - &SHA512_Data, &SHA512_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } @@ -327,17 +320,6 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; -const char *SHA512_TestOutput[MDTESTCOUNT] = { - "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", - "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", - "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", - "107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c", - "4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1", - "1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894", - "72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843", - "e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3" -}; - const char *RIPEMD160_TestOutput[MDTESTCOUNT] = { "9c1185a5c5e9fc54612808977ee8f548b2258d31", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 11:20:13 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77B091065670; Fri, 31 Aug 2012 11:20:13 +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 60ACC8FC08; Fri, 31 Aug 2012 11:20:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7VBKD8b021502; Fri, 31 Aug 2012 11:20:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VBKD0i021496; Fri, 31 Aug 2012 11:20:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311120.q7VBKD0i021496@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 11:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239942 - in stable/9/sys: amd64/amd64 amd64/include i386/include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 11:20:13 -0000 Author: kib Date: Fri Aug 31 11:20:12 2012 New Revision: 239942 URL: http://svn.freebsd.org/changeset/base/239942 Log: MFC r238450: Add support for the XSAVEOPT instruction use. Modified: stable/9/sys/amd64/amd64/cpu_switch.S stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/include/md_var.h stable/9/sys/amd64/include/specialreg.h stable/9/sys/i386/include/specialreg.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/9/sys/amd64/amd64/cpu_switch.S Fri Aug 31 11:15:01 2012 (r239941) +++ stable/9/sys/amd64/amd64/cpu_switch.S Fri Aug 31 11:20:12 2012 (r239942) @@ -122,6 +122,9 @@ done_store_dr: 1: movq %rdx,%rcx movl xsave_mask,%eax movl xsave_mask+4,%edx + .globl ctx_switch_xsave +ctx_switch_xsave: + /* This is patched to xsaveopt if supported, see fpuinit_bsp1() */ xsave (%r8) movq %rcx,%rdx 2: smsw %ax Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:15:01 2012 (r239941) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:20:12 2012 (r239942) @@ -132,10 +132,16 @@ static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, NULL, 1, "Floating point instructions executed in hardware"); +static int use_xsaveopt; int use_xsave; /* non-static for cpu_switch.S */ uint64_t xsave_mask; /* the same */ static struct savefpu *fpu_initialstate; +struct xsave_area_elm_descr { + u_int offset; + u_int size; +} *xsave_area_desc; + void fpusave(void *addr) { @@ -182,6 +188,17 @@ fpuinit_bsp1(void) TUNABLE_ULONG_FETCH("hw.xsave_mask", &xsave_mask_user); xsave_mask_user |= XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; xsave_mask &= xsave_mask_user; + + cpuid_count(0xd, 0x1, cp); + if ((cp[0] & CPUID_EXTSTATE_XSAVEOPT) != 0) { + /* + * Patch the XSAVE instruction in the cpu_switch code + * to XSAVEOPT. We assume that XSAVE encoding used + * REX byte, and set the bit 4 of the r/m byte. + */ + ctx_switch_xsave[3] |= 0x10; + use_xsaveopt = 1; + } } /* @@ -252,6 +269,7 @@ static void fpuinitstate(void *arg __unused) { register_t saveintr; + int cp[4], i, max_ext_n; fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, M_WAITOK | M_ZERO); @@ -273,6 +291,28 @@ fpuinitstate(void *arg __unused) */ bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc)); + /* + * Create a table describing the layout of the CPU Extended + * Save Area. + */ + if (use_xsaveopt) { + max_ext_n = flsl(xsave_mask); + xsave_area_desc = malloc(max_ext_n * sizeof(struct + xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); + /* x87 state */ + xsave_area_desc[0].offset = 0; + xsave_area_desc[0].size = 160; + /* XMM */ + xsave_area_desc[1].offset = 160; + xsave_area_desc[1].size = 288 - 160; + + for (i = 2; i < max_ext_n; i++) { + cpuid_count(0xd, i, cp); + xsave_area_desc[i].offset = cp[1]; + xsave_area_desc[i].size = cp[0]; + } + } + start_emulating(); intr_restore(saveintr); } @@ -560,8 +600,14 @@ fpudna(void) * This is the first time this thread has used the FPU or * the PCB doesn't contain a clean FPU state. Explicitly * load an initial state. + * + * We prefer to restore the state from the actual save + * area in PCB instead of directly loading from + * fpu_initialstate, to ignite the XSAVEOPT + * tracking engine. */ - fpurestore(fpu_initialstate); + bcopy(fpu_initialstate, pcb->pcb_save, cpu_max_ext_state_size); + fpurestore(pcb->pcb_save); if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(pcb->pcb_initial_fpucw); if (PCB_USER_FPU(pcb)) @@ -596,6 +642,9 @@ int fpugetregs(struct thread *td) { struct pcb *pcb; + uint64_t *xstate_bv, bit; + char *sa; + int max_ext_n, i; pcb = td->td_pcb; if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { @@ -613,6 +662,25 @@ fpugetregs(struct thread *td) return (_MC_FPOWNED_FPU); } else { critical_exit(); + if (use_xsaveopt) { + /* + * Handle partially saved state. + */ + sa = (char *)get_pcb_user_save_pcb(pcb); + xstate_bv = (uint64_t *)(sa + sizeof(struct savefpu) + + offsetof(struct xstate_hdr, xstate_bv)); + max_ext_n = flsl(xsave_mask); + for (i = 0; i < max_ext_n; i++) { + bit = 1 << i; + if ((*xstate_bv & bit) != 0) + continue; + bcopy((char *)fpu_initialstate + + xsave_area_desc[i].offset, + sa + xsave_area_desc[i].offset, + xsave_area_desc[i].size); + *xstate_bv |= bit; + } + } return (_MC_FPOWNED_PCB); } } Modified: stable/9/sys/amd64/include/md_var.h ============================================================================== --- stable/9/sys/amd64/include/md_var.h Fri Aug 31 11:15:01 2012 (r239941) +++ stable/9/sys/amd64/include/md_var.h Fri Aug 31 11:20:12 2012 (r239942) @@ -57,6 +57,7 @@ extern u_int cpu_procinfo; extern u_int cpu_procinfo2; extern char cpu_vendor[]; extern u_int cpu_vendor_id; +extern char ctx_switch_xsave[]; extern char kstack[]; extern char sigcode[]; extern int szsigcode; Modified: stable/9/sys/amd64/include/specialreg.h ============================================================================== --- stable/9/sys/amd64/include/specialreg.h Fri Aug 31 11:15:01 2012 (r239941) +++ stable/9/sys/amd64/include/specialreg.h Fri Aug 31 11:20:12 2012 (r239942) @@ -236,6 +236,11 @@ #define CPUID_TYPE_CORE 2 /* + * CPUID instruction 0xd Processor Extended State Enumeration Sub-leaf 1 + */ +#define CPUID_EXTSTATE_XSAVEOPT 0x00000001 + +/* * AMD extended function 8000_0007h edx info */ #define AMDPM_TS 0x00000001 Modified: stable/9/sys/i386/include/specialreg.h ============================================================================== --- stable/9/sys/i386/include/specialreg.h Fri Aug 31 11:15:01 2012 (r239941) +++ stable/9/sys/i386/include/specialreg.h Fri Aug 31 11:20:12 2012 (r239942) @@ -223,6 +223,11 @@ #define CPUID_TYPE_CORE 2 /* + * CPUID instruction 0xd Processor Extended State Enumeration Sub-leaf 1 + */ +#define CPUID_EXTSTATE_XSAVEOPT 0x00000001 + +/* * AMD extended function 8000_0007h edx info */ #define AMDPM_TS 0x00000001 From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 11:29:40 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9473D106566C; Fri, 31 Aug 2012 11:29:40 +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 7E7AD8FC08; Fri, 31 Aug 2012 11:29:40 +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 q7VBTe6g022606; Fri, 31 Aug 2012 11:29:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VBTe2m022604; Fri, 31 Aug 2012 11:29:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311129.q7VBTe2m022604@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 11:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239943 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 11:29:40 -0000 Author: kib Date: Fri Aug 31 11:29:39 2012 New Revision: 239943 URL: http://svn.freebsd.org/changeset/base/239943 Log: MFC r238597: Add stmxcsr. MFC r238914, only amd64 part, do not record mi: Change (unused) prototype for stmxcsr() to match reality. Modified: stable/9/sys/amd64/amd64/fpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:20:12 2012 (r239942) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:29:39 2012 (r239943) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr)) +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) static __inline void xrstor(char *addr, uint64_t mask) @@ -105,6 +106,7 @@ void fnstsw(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); +void stmxcsr(u_int *csr); void xrstor(char *addr, uint64_t mask); void xsave(char *addr, uint64_t mask); From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 11:33:55 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 370FD1065674; Fri, 31 Aug 2012 11:33:55 +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 215A98FC0C; Fri, 31 Aug 2012 11:33:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7VBXs0w023193; Fri, 31 Aug 2012 11:33:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VBXsaP023189; Fri, 31 Aug 2012 11:33:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311133.q7VBXsaP023189@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 11:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239944 - in stable/9/sys/amd64: amd64 include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 11:33:55 -0000 Author: kib Date: Fri Aug 31 11:33:54 2012 New Revision: 239944 URL: http://svn.freebsd.org/changeset/base/239944 Log: MFC r238598: On AMD64, provide siginfo.si_code for floating point errors when error occurs using the SSE math processor. Update comments describing the handling of the exception status bits in coprocessors control words. Modified: stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/amd64/trap.c stable/9/sys/amd64/include/fpu.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:29:39 2012 (r239943) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:33:54 2012 (r239944) @@ -115,9 +115,6 @@ void xsave(char *addr, uint64_t mask); #define start_emulating() load_cr0(rcr0() | CR0_TS) #define stop_emulating() clts() -#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) -#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) - CTASSERT(sizeof(struct savefpu) == 512); CTASSERT(sizeof(struct xstate_hdr) == 64); CTASSERT(sizeof(struct savefpu_ymm) == 832); @@ -516,11 +513,15 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions, then generate a SIGFPE. + * Preserve the FP status word, clear FP exceptions for x87, then + * generate a SIGFPE. + * + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs and is + * engraved in our i386 ABI. We now depend on longjmp() restoring a + * usable state. Restoring the state or examining it might fail if we + * didn't clear exceptions. * - * Clearing exceptions is necessary mainly to avoid IRQ13 bugs. We now - * depend on longjmp() restoring a usable state. Restoring the state - * or examining it might fail if we didn't clear exceptions. + * For SSE exceptions, the exceptions are not cleared. * * The error code chosen will be one of the FPE_... macros. It will be * sent as the second argument to old BSD-style signal handlers and as @@ -533,8 +534,9 @@ static char fpetable[128] = { * solution for signals other than SIGFPE. */ int -fputrap() +fputrap_x87(void) { + struct savefpu *pcb_save; u_short control, status; critical_enter(); @@ -545,19 +547,33 @@ fputrap() * wherever they are. */ if (PCPU_GET(fpcurthread) != curthread) { - control = GET_FPU_CW(curthread); - status = GET_FPU_SW(curthread); + pcb_save = PCPU_GET(curpcb)->pcb_save; + control = pcb_save->sv_env.en_cw; + status = pcb_save->sv_env.en_sw; } else { fnstcw(&control); fnstsw(&status); + fnclex(); } - if (PCPU_GET(fpcurthread) == curthread) - fnclex(); critical_exit(); return (fpetable[status & ((~control & 0x3f) | 0x40)]); } +int +fputrap_sse(void) +{ + u_int mxcsr; + + critical_enter(); + if (PCPU_GET(fpcurthread) != curthread) + mxcsr = PCPU_GET(curpcb)->pcb_save->sv_env.en_mxcsr; + else + stmxcsr(&mxcsr); + critical_exit(); + return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]); +} + /* * Implement device not available (DNA) exception * Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Fri Aug 31 11:29:39 2012 (r239943) +++ stable/9/sys/amd64/amd64/trap.c Fri Aug 31 11:33:54 2012 (r239944) @@ -333,7 +333,7 @@ trap(struct trapframe *frame) break; case T_ARITHTRAP: /* arithmetic trap */ - ucode = fputrap(); + ucode = fputrap_x87(); if (ucode == -1) goto userout; i = SIGFPE; @@ -447,7 +447,9 @@ trap(struct trapframe *frame) break; case T_XMMFLT: /* SIMD floating-point exception */ - ucode = 0; /* XXX */ + ucode = fputrap_sse(); + if (ucode == -1) + goto userout; i = SIGFPE; break; } Modified: stable/9/sys/amd64/include/fpu.h ============================================================================== --- stable/9/sys/amd64/include/fpu.h Fri Aug 31 11:29:39 2012 (r239943) +++ stable/9/sys/amd64/include/fpu.h Fri Aug 31 11:33:54 2012 (r239944) @@ -145,7 +145,8 @@ int fpusetregs(struct thread *td, struct char *xfpustate, size_t xfpustate_size); int fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size); -int fputrap(void); +int fputrap_sse(void); +int fputrap_x87(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 11:48:05 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97F8D106566C; Fri, 31 Aug 2012 11:48:05 +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 829C48FC12; Fri, 31 Aug 2012 11:48: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 q7VBm5oT024867; Fri, 31 Aug 2012 11:48:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VBm5o4024861; Fri, 31 Aug 2012 11:48:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311148.q7VBm5o4024861@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 11:48:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239945 - in stable/9/sys/amd64: amd64 include X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 11:48:05 -0000 Author: kib Date: Fri Aug 31 11:48:04 2012 New Revision: 239945 URL: http://svn.freebsd.org/changeset/base/239945 Log: MFC r238623: Introduce curpcb magic variable, similar to curthread, which is MD amd64. It is implemented as __pure2 inline with non-volatile asm read from pcpu, which allows a compiler to cache its results. Convert most PCPU_GET(pcb) and curthread->td_pcb accesses into curpcb. MFC r238723: Forcibly shut up clang warning about NULL pointer dereference. Modified: stable/9/sys/amd64/amd64/fpu.c stable/9/sys/amd64/amd64/machdep.c stable/9/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/vm_machdep.c stable/9/sys/amd64/include/pcpu.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:33:54 2012 (r239944) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:48:04 2012 (r239945) @@ -327,7 +327,7 @@ fpuexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fpusave(PCPU_GET(curpcb)->pcb_save); + fpusave(curpcb->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -547,7 +547,7 @@ fputrap_x87(void) * wherever they are. */ if (PCPU_GET(fpcurthread) != curthread) { - pcb_save = PCPU_GET(curpcb)->pcb_save; + pcb_save = curpcb->pcb_save; control = pcb_save->sv_env.en_cw; status = pcb_save->sv_env.en_sw; } else { @@ -567,7 +567,7 @@ fputrap_sse(void) critical_enter(); if (PCPU_GET(fpcurthread) != curthread) - mxcsr = PCPU_GET(curpcb)->pcb_save->sv_env.en_mxcsr; + mxcsr = curpcb->pcb_save->sv_env.en_mxcsr; else stmxcsr(&mxcsr); critical_exit(); @@ -609,7 +609,7 @@ fpudna(void) * Record new context early in case frstor causes a trap. */ PCPU_SET(fpcurthread, curthread); - pcb = PCPU_GET(curpcb); + pcb = curpcb; fpu_clean_state(); @@ -970,7 +970,7 @@ fpu_kern_thread(u_int flags) { struct pcb *pcb; - pcb = PCPU_GET(curpcb); + pcb = curpcb; KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), @@ -987,5 +987,5 @@ is_fpu_kern_thread(u_int flags) if ((curthread->td_pflags & TDP_KTHREAD) == 0) return (0); - return ((PCPU_GET(curpcb)->pcb_flags & PCB_KERNFPU) != 0); + return ((curpcb->pcb_flags & PCB_KERNFPU) != 0); } Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Fri Aug 31 11:33:54 2012 (r239944) +++ stable/9/sys/amd64/amd64/machdep.c Fri Aug 31 11:48:04 2012 (r239945) @@ -967,7 +967,7 @@ exec_setregs(struct thread *td, struct i pcb->pcb_dr3 = 0; pcb->pcb_dr6 = 0; pcb->pcb_dr7 = 0; - if (pcb == PCPU_GET(curpcb)) { + if (pcb == curpcb) { /* * Clear the debug registers on the running * CPU, otherwise they will end up affecting Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Fri Aug 31 11:33:54 2012 (r239944) +++ stable/9/sys/amd64/amd64/trap.c Fri Aug 31 11:48:04 2012 (r239945) @@ -525,9 +525,8 @@ trap(struct trapframe *frame) frame->tf_rip = (long)fsbase_load_fault; goto out; } - if (PCPU_GET(curpcb)->pcb_onfault != NULL) { - frame->tf_rip = - (long)PCPU_GET(curpcb)->pcb_onfault; + if (curpcb->pcb_onfault != NULL) { + frame->tf_rip = (long)curpcb->pcb_onfault; goto out; } break; @@ -730,7 +729,7 @@ trap_pfault(frame, usermode) * it normally, and panic immediately. */ if (!usermode && (td->td_intr_nesting_level != 0 || - PCPU_GET(curpcb)->pcb_onfault == NULL)) { + curpcb->pcb_onfault == NULL)) { trap_fatal(frame, eva); return (-1); } @@ -786,8 +785,8 @@ trap_pfault(frame, usermode) nogo: if (!usermode) { if (td->td_intr_nesting_level == 0 && - PCPU_GET(curpcb)->pcb_onfault != NULL) { - frame->tf_rip = (long)PCPU_GET(curpcb)->pcb_onfault; + curpcb->pcb_onfault != NULL) { + frame->tf_rip = (long)curpcb->pcb_onfault; return (0); } trap_fatal(frame, eva); Modified: stable/9/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/vm_machdep.c Fri Aug 31 11:33:54 2012 (r239944) +++ stable/9/sys/amd64/amd64/vm_machdep.c Fri Aug 31 11:48:04 2012 (r239945) @@ -90,6 +90,10 @@ static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif +CTASSERT((struct thread **)OFFSETOF_CURTHREAD == + &((struct pcpu *)NULL)->pc_curthread); +CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb); + struct savefpu * get_pcb_user_save_td(struct thread *td) { Modified: stable/9/sys/amd64/include/pcpu.h ============================================================================== --- stable/9/sys/amd64/include/pcpu.h Fri Aug 31 11:33:54 2012 (r239944) +++ stable/9/sys/amd64/include/pcpu.h Fri Aug 31 11:48:04 2012 (r239945) @@ -216,16 +216,36 @@ extern struct pcpu *pcpup; #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +#define OFFSETOF_CURTHREAD 0 +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnull-dereference" +#endif static __inline __pure2 struct thread * __curthread(void) { struct thread *td; - __asm("movq %%gs:0,%0" : "=r" (td)); + __asm("movq %%gs:%1,%0" : "=r" (td) + : "m" (*(char *)OFFSETOF_CURTHREAD)); return (td); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #define curthread (__curthread()) +#define OFFSETOF_CURPCB 32 +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movq %%gs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); + return (pcb); +} +#define curpcb (__curpcb()) + #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 12:01:36 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A274106568F; Fri, 31 Aug 2012 12:01:36 +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 1B9648FC2A; Fri, 31 Aug 2012 12:01:36 +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 q7VC1ZNk026669; Fri, 31 Aug 2012 12:01:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VC1Zc8026667; Fri, 31 Aug 2012 12:01:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311201.q7VC1Zc8026667@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 12:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239946 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 12:01:36 -0000 Author: kib Date: Fri Aug 31 12:01:35 2012 New Revision: 239946 URL: http://svn.freebsd.org/changeset/base/239946 Log: MFC r238668: Stop clearing x87 exceptions in the #MF handler on amd64. Modified: stable/9/sys/amd64/amd64/fpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 11:48:04 2012 (r239945) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 12:01:35 2012 (r239946) @@ -513,25 +513,21 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions for x87, then - * generate a SIGFPE. + * Read the FP status and control words, then generate si_code value + * for SIGFPE. The error code chosen will be one of the + * FPE_... macros. It will be sent as the second argument to old + * BSD-style signal handlers and as "siginfo_t->si_code" (second + * argument) to SA_SIGINFO signal handlers. * - * Clearing exceptions was necessary mainly to avoid IRQ13 bugs and is - * engraved in our i386 ABI. We now depend on longjmp() restoring a - * usable state. Restoring the state or examining it might fail if we - * didn't clear exceptions. + * Some time ago, we cleared the x87 exceptions with FNCLEX there. + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The + * usermode code which understands the FPU hardware enough to enable + * the exceptions, can also handle clearing the exception state in the + * handler. The only consequence of not clearing the exception is the + * rethrow of the SIGFPE on return from the signal handler and + * reexecution of the corresponding instruction. * - * For SSE exceptions, the exceptions are not cleared. - * - * The error code chosen will be one of the FPE_... macros. It will be - * sent as the second argument to old BSD-style signal handlers and as - * "siginfo_t->si_code" (second argument) to SA_SIGINFO signal handlers. - * - * XXX the FP state is not preserved across signal handlers. So signal - * handlers cannot afford to do FP unless they preserve the state or - * longjmp() out. Both preserving the state and longjmp()ing may be - * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable - * solution for signals other than SIGFPE. + * For XMM traps, the exceptions were never cleared. */ int fputrap_x87(void) @@ -553,7 +549,6 @@ fputrap_x87(void) } else { fnstcw(&control); fnstsw(&status); - fnclex(); } critical_exit(); From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 12:04:30 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19A321065670; Fri, 31 Aug 2012 12:04:30 +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 030D58FC14; Fri, 31 Aug 2012 12:04: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 q7VC4TGI027210; Fri, 31 Aug 2012 12:04:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VC4TQM027208; Fri, 31 Aug 2012 12:04:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311204.q7VC4TQM027208@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 12:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239947 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 12:04:30 -0000 Author: kib Date: Fri Aug 31 12:04:29 2012 New Revision: 239947 URL: http://svn.freebsd.org/changeset/base/239947 Log: MFC r238669: Force clean FPU state in PCB user FPU save area by performing getfpuregs(9) before accessing user FPU save area in ptrace_machdep.c for PT_I386_{GET,SET}XMMREGS and PT_{GET,SET}XSTATE. Modified: stable/9/sys/amd64/amd64/ptrace_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/ptrace_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/ptrace_machdep.c Fri Aug 31 12:01:35 2012 (r239946) +++ stable/9/sys/amd64/amd64/ptrace_machdep.c Fri Aug 31 12:04:29 2012 (r239947) @@ -50,6 +50,7 @@ cpu_ptrace_xstate(struct thread *td, int switch (req) { case PT_GETXSTATE: + fpugetregs(td); savefpu = (char *)(get_pcb_user_save_td(td) + 1); error = copyout(savefpu, addr, cpu_max_ext_state_size - sizeof(struct savefpu)); @@ -62,8 +63,10 @@ cpu_ptrace_xstate(struct thread *td, int } savefpu = malloc(data, M_TEMP, M_WAITOK); error = copyin(addr, savefpu, data); - if (error == 0) + if (error == 0) { + fpugetregs(td); error = fpusetxstate(td, savefpu, data); + } free(savefpu, M_TEMP); break; @@ -89,11 +92,13 @@ cpu32_ptrace(struct thread *td, int req, switch (req) { case PT_I386_GETXMMREGS: + fpugetregs(td); error = copyout(get_pcb_user_save_td(td), addr, sizeof(*fpstate)); break; case PT_I386_SETXMMREGS: + fpugetregs(td); fpstate = get_pcb_user_save_td(td); error = copyin(addr, fpstate, sizeof(*fpstate)); fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 12:06:33 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F4981065698; Fri, 31 Aug 2012 12:06:33 +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 501478FC18; Fri, 31 Aug 2012 12:06:33 +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 q7VC6X90027488; Fri, 31 Aug 2012 12:06:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VC6XlS027486; Fri, 31 Aug 2012 12:06:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311206.q7VC6XlS027486@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 12:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239948 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 12:06:33 -0000 Author: kib Date: Fri Aug 31 12:06:32 2012 New Revision: 239948 URL: http://svn.freebsd.org/changeset/base/239948 Log: MFC r238670: Stop caching curpcb in the local variable. Modified: stable/9/sys/amd64/amd64/fpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 12:04:29 2012 (r239947) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 12:06:32 2012 (r239948) @@ -582,7 +582,6 @@ static int err_count = 0; void fpudna(void) { - struct pcb *pcb; critical_enter(); if (PCPU_GET(fpcurthread) == curthread) { @@ -604,11 +603,10 @@ fpudna(void) * Record new context early in case frstor causes a trap. */ PCPU_SET(fpcurthread, curthread); - pcb = curpcb; fpu_clean_state(); - if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) { + if ((curpcb->pcb_flags & PCB_FPUINITDONE) == 0) { /* * This is the first time this thread has used the FPU or * the PCB doesn't contain a clean FPU state. Explicitly @@ -619,17 +617,17 @@ fpudna(void) * fpu_initialstate, to ignite the XSAVEOPT * tracking engine. */ - bcopy(fpu_initialstate, pcb->pcb_save, cpu_max_ext_state_size); - fpurestore(pcb->pcb_save); - if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) - fldcw(pcb->pcb_initial_fpucw); - if (PCB_USER_FPU(pcb)) - set_pcb_flags(pcb, + bcopy(fpu_initialstate, curpcb->pcb_save, cpu_max_ext_state_size); + fpurestore(curpcb->pcb_save); + if (curpcb->pcb_initial_fpucw != __INITIAL_FPUCW__) + fldcw(curpcb->pcb_initial_fpucw); + if (PCB_USER_FPU(curpcb)) + set_pcb_flags(curpcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); else - set_pcb_flags(pcb, PCB_FPUINITDONE); + set_pcb_flags(curpcb, PCB_FPUINITDONE); } else - fpurestore(pcb->pcb_save); + fpurestore(curpcb->pcb_save); critical_exit(); } @@ -963,16 +961,14 @@ fpu_kern_leave(struct thread *td, struct int fpu_kern_thread(u_int flags) { - struct pcb *pcb; - pcb = curpcb; KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); - KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), + KASSERT(curpcb->pcb_save == get_pcb_user_save_pcb(curpcb), ("mangled pcb_save")); - KASSERT(PCB_USER_FPU(pcb), ("recursive call")); + KASSERT(PCB_USER_FPU(curpcb), ("recursive call")); - set_pcb_flags(pcb, PCB_KERNFPU); + set_pcb_flags(curpcb, PCB_KERNFPU); return (0); } From owner-svn-src-stable-9@FreeBSD.ORG Fri Aug 31 12:08:31 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 90503106566B; Fri, 31 Aug 2012 12:08:31 +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 7A4058FC0A; Fri, 31 Aug 2012 12:08:31 +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 q7VC8VON027761; Fri, 31 Aug 2012 12:08:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7VC8VPe027759; Fri, 31 Aug 2012 12:08:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208311208.q7VC8VPe027759@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 31 Aug 2012 12:08:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239949 - stable/9/sys/amd64/amd64 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Aug 2012 12:08:31 -0000 Author: kib Date: Fri Aug 31 12:08:31 2012 New Revision: 239949 URL: http://svn.freebsd.org/changeset/base/239949 Log: MFC r238671: Constently use 2-space sentence breaks. Modified: stable/9/sys/amd64/amd64/fpu.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/fpu.c ============================================================================== --- stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 12:06:32 2012 (r239948) +++ stable/9/sys/amd64/amd64/fpu.c Fri Aug 31 12:08:31 2012 (r239949) @@ -515,7 +515,7 @@ static char fpetable[128] = { /* * Read the FP status and control words, then generate si_code value * for SIGFPE. The error code chosen will be one of the - * FPE_... macros. It will be sent as the second argument to old + * FPE_... macros. It will be sent as the second argument to old * BSD-style signal handlers and as "siginfo_t->si_code" (second * argument) to SA_SIGINFO signal handlers. * @@ -523,7 +523,7 @@ static char fpetable[128] = { * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The * usermode code which understands the FPU hardware enough to enable * the exceptions, can also handle clearing the exception state in the - * handler. The only consequence of not clearing the exception is the + * handler. The only consequence of not clearing the exception is the * rethrow of the SIGFPE on return from the signal handler and * reexecution of the corresponding instruction. * From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 05:35:49 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C2E910658E1; Sat, 1 Sep 2012 05:35:49 +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 435408FC12; Sat, 1 Sep 2012 05:35: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 q815ZnKX055705; Sat, 1 Sep 2012 05:35:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q815Zm9n055697; Sat, 1 Sep 2012 05:35:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209010535.q815Zm9n055697@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 05:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239965 - in stable/9/sys: dev/drm2 dev/drm2/i915 modules/drm2/drm2 modules/drm2/i915kms X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 05:35:49 -0000 Author: kib Date: Sat Sep 1 05:35:48 2012 New Revision: 239965 URL: http://svn.freebsd.org/changeset/base/239965 Log: MFC r239375: Add drm and i915 ioctl translations for 32 bit process on 64 bit host. Added: stable/9/sys/dev/drm2/drm_ioc32.c - copied unchanged from r239375, head/sys/dev/drm2/drm_ioc32.c stable/9/sys/dev/drm2/i915/i915_ioc32.c - copied unchanged from r239375, head/sys/dev/drm2/i915/i915_ioc32.c Modified: stable/9/sys/dev/drm2/drmP.h stable/9/sys/dev/drm2/drm_drv.c stable/9/sys/dev/drm2/i915/i915_dma.c stable/9/sys/dev/drm2/i915/i915_drv.h stable/9/sys/modules/drm2/drm2/Makefile stable/9/sys/modules/drm2/i915kms/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/drm2/drmP.h ============================================================================== --- stable/9/sys/dev/drm2/drmP.h Sat Sep 1 03:46:28 2012 (r239964) +++ stable/9/sys/dev/drm2/drmP.h Sat Sep 1 05:35:48 2012 (r239965) @@ -105,6 +105,7 @@ struct drm_file; #include #include +#include "opt_compat.h" #include "opt_drm.h" #ifdef DRM_DEBUG #undef DRM_DEBUG @@ -760,6 +761,10 @@ struct drm_driver_info { int (*device_is_agp) (struct drm_device * dev); drm_ioctl_desc_t *ioctls; +#ifdef COMPAT_FREEBSD32 + drm_ioctl_desc_t *compat_ioctls; + int *compat_ioctls_nr; +#endif int max_ioctl; int buf_priv_size; Modified: stable/9/sys/dev/drm2/drm_drv.c ============================================================================== --- stable/9/sys/dev/drm2/drm_drv.c Sat Sep 1 03:46:28 2012 (r239964) +++ stable/9/sys/dev/drm2/drm_drv.c Sat Sep 1 05:35:48 2012 (r239965) @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); * open/close, and ioctl dispatch. */ - #include +#include #include #include #include @@ -802,6 +802,8 @@ void drm_close(void *data) DRM_UNLOCK(dev); } +extern drm_ioctl_desc_t drm_compat_ioctls[]; + /* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags, @@ -846,7 +848,22 @@ int drm_ioctl(struct cdev *kdev, u_long return EINVAL; } - ioctl = &drm_ioctls[nr]; +#ifdef COMPAT_FREEBSD32 + /* + * Called whenever a 32-bit process running under a 64-bit + * kernel performs an ioctl on /dev/drm. + */ + if (SV_CURPROC_FLAG(SV_ILP32) && drm_compat_ioctls[nr].func != NULL) + /* + * Assume that ioctls without an explicit compat + * routine will just work. This may not always be a + * good assumption, but it's better than always + * failing. + */ + ioctl = &drm_compat_ioctls[nr]; + else +#endif + ioctl = &drm_ioctls[nr]; /* It's not a core DRM ioctl, try driver-specific. */ if (ioctl->func == NULL && nr >= DRM_COMMAND_BASE) { /* The array entries begin at DRM_COMMAND_BASE ioctl nr */ @@ -856,7 +873,14 @@ int drm_ioctl(struct cdev *kdev, u_long nr, dev->driver->max_ioctl); return EINVAL; } - ioctl = &dev->driver->ioctls[nr]; +#ifdef COMPAT_FREEBSD32 + if (SV_CURPROC_FLAG(SV_ILP32) && + nr < *dev->driver->compat_ioctls_nr && + dev->driver->compat_ioctls[nr].func != NULL) + ioctl = &dev->driver->compat_ioctls[nr]; + else +#endif + ioctl = &dev->driver->ioctls[nr]; is_driver_ioctl = 1; } func = ioctl->func; Copied: stable/9/sys/dev/drm2/drm_ioc32.c (from r239375, head/sys/dev/drm2/drm_ioc32.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/drm2/drm_ioc32.c Sat Sep 1 05:35:48 2012 (r239965, copy of r239375, head/sys/dev/drm2/drm_ioc32.c) @@ -0,0 +1,788 @@ +/*- + * Copyright (C) Paul Mackerras 2005. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Paul Mackerras + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#ifdef COMPAT_FREEBSD32 + +#include +#include + +/** @file drm_ioc32.c + * 32-bit ioctl compatibility routines for the DRM. + */ + +#define DRM_IOCTL_VERSION32 DRM_IOWR(0x00, drm_version32_t) +#define DRM_IOCTL_GET_UNIQUE32 DRM_IOWR(0x01, drm_unique32_t) +#define DRM_IOCTL_GET_MAP32 DRM_IOWR(0x04, drm_map32_t) +#define DRM_IOCTL_GET_CLIENT32 DRM_IOWR(0x05, drm_client32_t) +#define DRM_IOCTL_GET_STATS32 DRM_IOR( 0x06, drm_stats32_t) + +#define DRM_IOCTL_SET_UNIQUE32 DRM_IOW( 0x10, drm_unique32_t) +#define DRM_IOCTL_ADD_MAP32 DRM_IOWR(0x15, drm_map32_t) +#define DRM_IOCTL_ADD_BUFS32 DRM_IOWR(0x16, drm_buf_desc32_t) +#define DRM_IOCTL_MARK_BUFS32 DRM_IOW( 0x17, drm_buf_desc32_t) +#define DRM_IOCTL_INFO_BUFS32 DRM_IOWR(0x18, drm_buf_info32_t) +#define DRM_IOCTL_MAP_BUFS32 DRM_IOWR(0x19, drm_buf_map32_t) +#define DRM_IOCTL_FREE_BUFS32 DRM_IOW( 0x1a, drm_buf_free32_t) + +#define DRM_IOCTL_RM_MAP32 DRM_IOW( 0x1b, drm_map32_t) + +#define DRM_IOCTL_SET_SAREA_CTX32 DRM_IOW( 0x1c, drm_ctx_priv_map32_t) +#define DRM_IOCTL_GET_SAREA_CTX32 DRM_IOWR(0x1d, drm_ctx_priv_map32_t) + +#define DRM_IOCTL_RES_CTX32 DRM_IOWR(0x26, drm_ctx_res32_t) +#define DRM_IOCTL_DMA32 DRM_IOWR(0x29, drm_dma32_t) + +#define DRM_IOCTL_AGP_ENABLE32 DRM_IOW( 0x32, drm_agp_mode32_t) +#define DRM_IOCTL_AGP_INFO32 DRM_IOR( 0x33, drm_agp_info32_t) +#define DRM_IOCTL_AGP_ALLOC32 DRM_IOWR(0x34, drm_agp_buffer32_t) +#define DRM_IOCTL_AGP_FREE32 DRM_IOW( 0x35, drm_agp_buffer32_t) +#define DRM_IOCTL_AGP_BIND32 DRM_IOW( 0x36, drm_agp_binding32_t) +#define DRM_IOCTL_AGP_UNBIND32 DRM_IOW( 0x37, drm_agp_binding32_t) + +#define DRM_IOCTL_SG_ALLOC32 DRM_IOW( 0x38, drm_scatter_gather32_t) +#define DRM_IOCTL_SG_FREE32 DRM_IOW( 0x39, drm_scatter_gather32_t) + +#define DRM_IOCTL_UPDATE_DRAW32 DRM_IOW( 0x3f, drm_update_draw32_t) + +#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) + +typedef struct drm_version_32 { + int version_major; /**< Major version */ + int version_minor; /**< Minor version */ + int version_patchlevel; /**< Patch level */ + u32 name_len; /**< Length of name buffer */ + u32 name; /**< Name of driver */ + u32 date_len; /**< Length of date buffer */ + u32 date; /**< User-space buffer to hold date */ + u32 desc_len; /**< Length of desc buffer */ + u32 desc; /**< User-space buffer to hold desc */ +} drm_version32_t; + +static int compat_drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_version32_t *v32 = data; + struct drm_version version; + int err; + + version.name_len = v32->name_len; + version.name = (void *)(unsigned long)v32->name; + version.date_len = v32->date_len; + version.date = (void *)(unsigned long)v32->date; + version.desc_len = v32->desc_len; + version.desc = (void *)(unsigned long)v32->desc; + + err = drm_version(dev, (void *)&version, file_priv); + if (err) + return err; + + v32->version_major = version.version_major; + v32->version_minor = version.version_minor; + v32->version_patchlevel = version.version_patchlevel; + v32->name_len = version.name_len; + v32->date_len = version.date_len; + v32->desc_len = version.desc_len; + + return 0; +} + +typedef struct drm_unique32 { + u32 unique_len; /**< Length of unique */ + u32 unique; /**< Unique name for driver instantiation */ +} drm_unique32_t; + +static int compat_drm_getunique(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_unique32_t *uq32 = data; + struct drm_unique u; + int err; + + u.unique_len = uq32->unique_len; + u.unique = (void *)(unsigned long)uq32->unique; + + err = drm_getunique(dev, (void *)&u, file_priv); + if (err) + return err; + + uq32->unique_len = u.unique_len; + + return 0; +} + +static int compat_drm_setunique(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_unique32_t *uq32 = data; + struct drm_unique u; + + u.unique_len = uq32->unique_len; + u.unique = (void *)(unsigned long)uq32->unique; + + return drm_setunique(dev, (void *)&u, file_priv); +} + +typedef struct drm_map32 { + u32 offset; /**< Requested physical address (0 for SAREA)*/ + u32 size; /**< Requested physical size (bytes) */ + enum drm_map_type type; /**< Type of memory to map */ + enum drm_map_flags flags; /**< Flags */ + u32 handle; /**< User-space: "Handle" to pass to mmap() */ + int mtrr; /**< MTRR slot used */ +} drm_map32_t; + +static int compat_drm_getmap(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_map32_t *m32 = data; + struct drm_map map; + int err; + void *handle; + + map.offset = (unsigned long)m32->offset; + + err = drm_getmap(dev, (void *)&map, file_priv); + if (err) + return err; + + m32->offset = map.offset; + m32->size = map.size; + m32->type = map.type; + m32->flags = map.flags; + handle = map.handle; + m32->mtrr = map.mtrr; + + m32->handle = (unsigned long)handle; + + return 0; + +} + +static int compat_drm_addmap(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_map32_t *m32 = data; + struct drm_map map; + int err; + void *handle; + + map.offset = (unsigned long)m32->offset; + map.size = (unsigned long)m32->size; + map.type = m32->type; + map.flags = m32->flags; + + err = drm_addmap_ioctl(dev, (void *)&map, file_priv); + if (err) + return err; + + m32->offset = map.offset; + m32->mtrr = map.mtrr; + handle = map.handle; + + m32->handle = (unsigned long)handle; + if (m32->handle != (unsigned long)handle) + DRM_DEBUG("compat_drm_addmap truncated handle" + " %p for type %d offset %x\n", + handle, m32->type, m32->offset); + + return 0; +} + +static int compat_drm_rmmap(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_map32_t *m32 = data; + struct drm_map map; + + map.handle = (void *)(unsigned long)m32->handle; + + return drm_rmmap_ioctl(dev, (void *)&map, file_priv); +} + +typedef struct drm_client32 { + int idx; /**< Which client desired? */ + int auth; /**< Is client authenticated? */ + u32 pid; /**< Process ID */ + u32 uid; /**< User ID */ + u32 magic; /**< Magic */ + u32 iocs; /**< Ioctl count */ +} drm_client32_t; + +static int compat_drm_getclient(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_client32_t *c32 = data; + struct drm_client client; + int err; + + client.idx = c32->idx; + + err = drm_getclient(dev, (void *)&client, file_priv); + if (err) + return err; + + c32->idx = client.idx; + c32->auth = client.auth; + c32->pid = client.pid; + c32->uid = client.uid; + c32->magic = client.magic; + c32->iocs = client.iocs; + + return 0; +} + +typedef struct drm_stats32 { + u32 count; + struct { + u32 value; + enum drm_stat_type type; + } data[15]; +} drm_stats32_t; + +static int compat_drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_stats32_t *s32 = data; + struct drm_stats stats; + int i, err; + + err = drm_getstats(dev, (void *)&stats, file_priv); + if (err) + return err; + + s32->count = stats.count; + for (i = 0; i < stats.count; i++) { + s32->data[i].value = stats.data[i].value; + s32->data[i].type = stats.data[i].type; + } + + return 0; +} + +typedef struct drm_buf_desc32 { + int count; /**< Number of buffers of this size */ + int size; /**< Size in bytes */ + int low_mark; /**< Low water mark */ + int high_mark; /**< High water mark */ + int flags; + u32 agp_start; /**< Start address in the AGP aperture */ +} drm_buf_desc32_t; + +static int compat_drm_addbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_buf_desc32_t *b32 = data; + struct drm_buf_desc buf; + int err; + + buf.count = b32->count; + buf.size = b32->size; + buf.low_mark = b32->low_mark; + buf.high_mark = b32->high_mark; + buf.flags = b32->flags; + buf.agp_start = (unsigned long)b32->agp_start; + + err = drm_addbufs(dev, (void *)&buf, file_priv); + if (err) + return err; + + b32->count = buf.count; + b32->size = buf.size; + b32->low_mark = buf.low_mark; + b32->high_mark = buf.high_mark; + b32->flags = buf.flags; + b32->agp_start = buf.agp_start; + + return 0; +} + +static int compat_drm_markbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_buf_desc32_t *b32 = data; + struct drm_buf_desc buf; + + buf.size = b32->size; + buf.low_mark = b32->low_mark; + buf.high_mark = b32->high_mark; + + return drm_markbufs(dev, (void *)&buf, file_priv); +} + +typedef struct drm_buf_info32 { + int count; /**< Entries in list */ + u32 list; +} drm_buf_info32_t; + +static int compat_drm_infobufs(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_buf_info32_t *req32 = data; + drm_buf_desc32_t *to; + struct drm_buf_info *request; + struct drm_buf_desc *list; + size_t nbytes; + int i, err; + int count, actual; + + count = req32->count; + to = (drm_buf_desc32_t *)(unsigned long)req32->list; + if (count < 0) + count = 0; + + nbytes = sizeof(*request) + count * sizeof(struct drm_buf_desc); + request = malloc(nbytes, DRM_MEM_BUFLISTS, M_ZERO | M_NOWAIT); + if (!request) + return -EFAULT; + list = (struct drm_buf_desc *) (request + 1); + + request->count = count; + request->list = list; + + err = drm_infobufs(dev, (void *)request, file_priv); + if (err) + return err; + + actual = request->count; + if (count >= actual) + for (i = 0; i < actual; ++i) { + to[i].count = list[i].count; + to[i].size = list[i].size; + to[i].low_mark = list[i].low_mark; + to[i].high_mark = list[i].high_mark; + to[i].flags = list[i].flags; + } + + req32->count = actual; + + return 0; +} + +typedef struct drm_buf_pub32 { + int idx; /**< Index into the master buffer list */ + int total; /**< Buffer size */ + int used; /**< Amount of buffer in use (for DMA) */ + u32 address; /**< Address of buffer */ +} drm_buf_pub32_t; + +typedef struct drm_buf_map32 { + int count; /**< Length of the buffer list */ + u32 virtual; /**< Mmap'd area in user-virtual */ + u32 list; /**< Buffer information */ +} drm_buf_map32_t; + +static int compat_drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_buf_map32_t *req32 = data; + drm_buf_pub32_t *list32; + struct drm_buf_map *request; + struct drm_buf_pub *list; + int i, err; + int count, actual; + size_t nbytes; + + count = req32->count; + list32 = (void *)(unsigned long)req32->list; + + if (count < 0) + return -EINVAL; + nbytes = sizeof(*request) + count * sizeof(struct drm_buf_pub); + request = malloc(nbytes, DRM_MEM_BUFLISTS, M_ZERO | M_NOWAIT); + if (!request) + return -EFAULT; + list = (struct drm_buf_pub *) (request + 1); + + request->count = count; + request->list = list; + + err = drm_mapbufs(dev, (void *)request, file_priv); + if (err) + return err; + + actual = request->count; + if (count >= actual) + for (i = 0; i < actual; ++i) { + list32[i].idx = list[i].idx; + list32[i].total = list[i].total; + list32[i].used = list[i].used; + list32[i].address = (unsigned long)list[i].address; + } + + req32->count = actual; + req32->virtual = (unsigned long)request->virtual; + + return 0; +} + +typedef struct drm_buf_free32 { + int count; + u32 list; +} drm_buf_free32_t; + +static int compat_drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_buf_free32_t *req32 = data; + struct drm_buf_free request; + + request.count = req32->count; + request.list = (int *)(unsigned long)req32->list; + + return drm_freebufs(dev, (void *)&request, file_priv); +} + +typedef struct drm_ctx_priv_map32 { + unsigned int ctx_id; /**< Context requesting private mapping */ + u32 handle; /**< Handle of map */ +} drm_ctx_priv_map32_t; + +static int compat_drm_setsareactx(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_ctx_priv_map32_t *req32 = data; + struct drm_ctx_priv_map request; + + request.ctx_id = req32->ctx_id; + request.handle = (void *)(unsigned long)req32->handle; + + return drm_setsareactx(dev, (void *)&request, file_priv); +} + +static int compat_drm_getsareactx(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_ctx_priv_map32_t *req32 = data; + struct drm_ctx_priv_map request; + int err; + + request.ctx_id = req32->ctx_id; + + err = drm_getsareactx(dev, (void *)&request, file_priv); + if (err) + return err; + + req32->handle = (unsigned long)request.handle; + + return 0; +} + +typedef struct drm_ctx_res32 { + int count; + u32 contexts; +} drm_ctx_res32_t; + +static int compat_drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_ctx_res32_t *res32 = data; + struct drm_ctx_res res; + int err; + + res.count = res32->count; + res.contexts = (struct drm_ctx __user *)(unsigned long)res32->contexts; + + err = drm_resctx(dev, (void *)&res, file_priv); + if (err) + return err; + + res32->count = res.count; + + return 0; +} + +typedef struct drm_dma32 { + int context; /**< Context handle */ + int send_count; /**< Number of buffers to send */ + u32 send_indices; /**< List of handles to buffers */ + u32 send_sizes; /**< Lengths of data to send */ + enum drm_dma_flags flags; /**< Flags */ + int request_count; /**< Number of buffers requested */ + int request_size; /**< Desired size for buffers */ + u32 request_indices; /**< Buffer information */ + u32 request_sizes; + int granted_count; /**< Number of buffers granted */ +} drm_dma32_t; + +static int compat_drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_dma32_t *d32 = data; + struct drm_dma d; + int err; + + d.context = d32->context; + d.send_count = d32->send_count; + d.send_indices = (int *)(unsigned long)d32->send_indices; + d.send_sizes = (int *)(unsigned long)d32->send_sizes; + d.flags = d32->flags; + d.request_count = d32->request_count; + d.request_indices = (int *)(unsigned long)d32->request_indices; + d.request_sizes = (int *)(unsigned long)d32->request_sizes; + + err = drm_dma(dev, (void *)&d, file_priv); + if (err) + return err; + + d32->request_size = d.request_size; + d32->granted_count = d.granted_count; + + return 0; +} + +typedef struct drm_agp_mode32 { + u32 mode; /**< AGP mode */ +} drm_agp_mode32_t; + +static int compat_drm_agp_enable(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_mode32_t *m32 = data; + struct drm_agp_mode mode; + + mode.mode = m32->mode; + + return drm_agp_enable_ioctl(dev, (void *)&mode, file_priv); +} + +typedef struct drm_agp_info32 { + int agp_version_major; + int agp_version_minor; + u32 mode; + u32 aperture_base; /* physical address */ + u32 aperture_size; /* bytes */ + u32 memory_allowed; /* bytes */ + u32 memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +} drm_agp_info32_t; + +static int compat_drm_agp_info(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_info32_t *i32 = data; + struct drm_agp_info info; + int err; + + err = drm_agp_info_ioctl(dev, (void *)&info, file_priv); + if (err) + return err; + + i32->agp_version_major = info.agp_version_major; + i32->agp_version_minor = info.agp_version_minor; + i32->mode = info.mode; + i32->aperture_base = info.aperture_base; + i32->aperture_size = info.aperture_size; + i32->memory_allowed = info.memory_allowed; + i32->memory_used = info.memory_used; + i32->id_vendor = info.id_vendor; + i32->id_device = info.id_device; + + return 0; +} + +typedef struct drm_agp_buffer32 { + u32 size; /**< In bytes -- will round to page boundary */ + u32 handle; /**< Used for binding / unbinding */ + u32 type; /**< Type of memory to allocate */ + u32 physical; /**< Physical used by i810 */ +} drm_agp_buffer32_t; + +static int compat_drm_agp_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_buffer32_t *req32 = data; + struct drm_agp_buffer request; + int err; + + request.size = req32->size; + request.type = req32->type; + + err = drm_agp_alloc_ioctl(dev, (void *)&request, file_priv); + if (err) + return err; + + req32->handle = request.handle; + req32->physical = request.physical; + + return 0; +} + +static int compat_drm_agp_free(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_buffer32_t *req32 = data; + struct drm_agp_buffer request; + + request.handle = req32->handle; + + return drm_agp_free_ioctl(dev, (void *)&request, file_priv); +} + +typedef struct drm_agp_binding32 { + u32 handle; /**< From drm_agp_buffer */ + u32 offset; /**< In bytes -- will round to page boundary */ +} drm_agp_binding32_t; + +static int compat_drm_agp_bind(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_binding32_t *req32 = data; + struct drm_agp_binding request; + + request.handle = req32->handle; + request.offset = req32->offset; + + return drm_agp_bind_ioctl(dev, (void *)&request, file_priv); +} + +static int compat_drm_agp_unbind(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_agp_binding32_t *req32 = data; + struct drm_agp_binding request; + + request.handle = req32->handle; + + return drm_agp_unbind_ioctl(dev, (void *)&request, file_priv); +} + +typedef struct drm_scatter_gather32 { + u32 size; /**< In bytes -- will round to page boundary */ + u32 handle; /**< Used for mapping / unmapping */ +} drm_scatter_gather32_t; + +static int compat_drm_sg_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_scatter_gather32_t *req32 = data; + struct drm_scatter_gather request; + int err; + + request.size = (unsigned long)req32->size; + + err = drm_sg_alloc_ioctl(dev, (void *)&request, file_priv); + if (err) + return err; + + /* XXX not sure about the handle conversion here... */ + req32->handle = (unsigned long)request.handle >> PAGE_SHIFT; + + return 0; +} + +static int compat_drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_scatter_gather32_t *req32 = data; + struct drm_scatter_gather request; + + request.handle = (unsigned long)req32->handle << PAGE_SHIFT; + + return drm_sg_free(dev, (void *)&request, file_priv); +} + +typedef struct drm_update_draw32 { + drm_drawable_t handle; + unsigned int type; + unsigned int num; + /* 64-bit version has a 32-bit pad here */ + u64 data; /**< Pointer */ +} __attribute__((packed)) drm_update_draw32_t; + +static int compat_drm_update_draw(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_update_draw32_t *update32 = data; + struct drm_update_draw request; + int err; + + request.handle = update32->handle; + request.type = update32->type; + request.num = update32->num; + request.data = update32->data; + + err = drm_update_draw(dev, (void *)&request, file_priv); + return err; +} + +struct drm_wait_vblank_request32 { + enum drm_vblank_seq_type type; + unsigned int sequence; + u32 signal; +}; + +struct drm_wait_vblank_reply32 { + enum drm_vblank_seq_type type; + unsigned int sequence; + s32 tval_sec; + s32 tval_usec; +}; + +typedef union drm_wait_vblank32 { + struct drm_wait_vblank_request32 request; + struct drm_wait_vblank_reply32 reply; +} drm_wait_vblank32_t; + +static int compat_drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ + drm_wait_vblank32_t *req32 = data; + union drm_wait_vblank request; + int err; + + request.request.type = req32->request.type; + request.request.sequence = req32->request.sequence; + request.request.signal = req32->request.signal; + + err = drm_wait_vblank(dev, (void *)&request, file_priv); + if (err) + return err; + + req32->reply.type = request.reply.type; + req32->reply.sequence = request.reply.sequence; + req32->reply.tval_sec = request.reply.tval_sec; + req32->reply.tval_usec = request.reply.tval_usec; + + return 0; +} + +drm_ioctl_desc_t drm_compat_ioctls[256] = { + DRM_IOCTL_DEF(DRM_IOCTL_VERSION32, compat_drm_version, 0), + DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE32, compat_drm_getunique, 0), + DRM_IOCTL_DEF(DRM_IOCTL_GET_MAP32, compat_drm_getmap, 0), + DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT32, compat_drm_getclient, 0), + DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS32, compat_drm_getstats, 0), + DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE32, compat_drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_ADD_MAP32, compat_drm_addmap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_ADD_BUFS32, compat_drm_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_MARK_BUFS32, compat_drm_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS32, compat_drm_infobufs, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS32, compat_drm_mapbufs, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS32, compat_drm_freebufs, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_RM_MAP32, compat_drm_rmmap, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_SET_SAREA_CTX32, compat_drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_GET_SAREA_CTX32, compat_drm_getsareactx, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_RES_CTX32, compat_drm_resctx, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_DMA32, compat_drm_dma, DRM_AUTH), + + DRM_IOCTL_DEF(DRM_IOCTL_AGP_ENABLE32, compat_drm_agp_enable, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_AGP_INFO32, compat_drm_agp_info, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_AGP_ALLOC32, compat_drm_agp_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_AGP_FREE32, compat_drm_agp_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_AGP_BIND32, compat_drm_agp_bind, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_AGP_UNBIND32, compat_drm_agp_unbind, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + + DRM_IOCTL_DEF(DRM_IOCTL_SG_ALLOC32, compat_drm_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_SG_FREE32, compat_drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + + DRM_IOCTL_DEF(DRM_IOCTL_UPDATE_DRAW32, compat_drm_update_draw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + + DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK32, compat_drm_wait_vblank, DRM_UNLOCKED), +}; + +#endif Modified: stable/9/sys/dev/drm2/i915/i915_dma.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_dma.c Sat Sep 1 03:46:28 2012 (r239964) +++ stable/9/sys/dev/drm2/i915/i915_dma.c Sat Sep 1 05:35:48 2012 (r239965) @@ -627,7 +627,7 @@ i915_flush_ioctl(struct drm_device *dev, return (ret); } -static int i915_batchbuffer(struct drm_device *dev, void *data, +int i915_batchbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; @@ -676,7 +676,7 @@ fail_free: return ret; } -static int i915_cmdbuffer(struct drm_device *dev, void *data, +int i915_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; @@ -747,7 +747,7 @@ static int i915_flip_bufs(struct drm_dev return ret; } -static int i915_getparam(struct drm_device *dev, void *data, +int i915_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv) { drm_i915_private_t *dev_priv = dev->dev_private; @@ -1493,6 +1493,11 @@ struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF(DRM_I915_GET_SPRITE_COLORKEY, intel_sprite_get_colorkey, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), }; +#ifdef COMPAT_FREEBSD32 +extern drm_ioctl_desc_t i915_compat_ioctls[]; +extern int i915_compat_ioctls_nr; +#endif + struct drm_driver_info i915_driver_info = { .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_LOCKLESS_IRQ | @@ -1516,6 +1521,10 @@ struct drm_driver_info i915_driver_info .sysctl_cleanup = i915_sysctl_cleanup, .ioctls = i915_ioctls, +#ifdef COMPAT_FREEBSD32 + .compat_ioctls = i915_compat_ioctls, + .compat_ioctls_nr = &i915_compat_ioctls_nr, +#endif .max_ioctl = DRM_ARRAY_SIZE(i915_ioctls), .name = DRIVER_NAME, Modified: stable/9/sys/dev/drm2/i915/i915_drv.h ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_drv.h Sat Sep 1 03:46:28 2012 (r239964) +++ stable/9/sys/dev/drm2/i915/i915_drv.h Sat Sep 1 05:35:48 2012 (r239965) @@ -1034,6 +1034,12 @@ int i915_sysctl_init(struct drm_device * void i915_sysctl_cleanup(struct drm_device *dev); /* i915_dma.c */ +int i915_batchbuffer(struct drm_device *dev, void *data, + struct drm_file *file_priv); +int i915_cmdbuffer(struct drm_device *dev, void *data, + struct drm_file *file_priv); +int i915_getparam(struct drm_device *dev, void *data, + struct drm_file *file_priv); extern void i915_kernel_lost_context(struct drm_device * dev); extern int i915_driver_load(struct drm_device *, unsigned long flags); extern int i915_driver_unload(struct drm_device *); Copied: stable/9/sys/dev/drm2/i915/i915_ioc32.c (from r239375, head/sys/dev/drm2/i915/i915_ioc32.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/dev/drm2/i915/i915_ioc32.c Sat Sep 1 05:35:48 2012 (r239965, copy of r239375, head/sys/dev/drm2/i915/i915_ioc32.c) @@ -0,0 +1,138 @@ +/*- + * Copyright (C) Paul Mackerras 2005 + * Copyright (C) Alan Hourihane 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Paul Mackerras + * Alan Hourihane + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#ifdef COMPAT_FREEBSD32 + +/** @file i915_ioc32.c + * 32-bit ioctl compatibility routines for the i915 DRM. + */ + +#include +#include +#include +#include +#include + +typedef struct _drm_i915_batchbuffer32 { + int start; /* agp offset */ + int used; /* nr bytes in use */ + int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ + int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ + int num_cliprects; /* mulitpass with multiple cliprects? */ + u32 cliprects; /* pointer to userspace cliprects */ +} drm_i915_batchbuffer32_t; + +static int compat_i915_batchbuffer(struct drm_device *dev, void *data, struct drm_file *file_priv) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 09:55:36 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EDFC106566C; Sat, 1 Sep 2012 09:55:36 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33F4E8FC08; Sat, 1 Sep 2012 09:55:36 +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 q819taFV086804; Sat, 1 Sep 2012 09:55:36 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q819tZHq086802; Sat, 1 Sep 2012 09:55:35 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209010955.q819tZHq086802@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 09:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239975 - stable/9/usr.bin/procstat X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 09:55:36 -0000 Author: trociny Date: Sat Sep 1 09:55:35 2012 New Revision: 239975 URL: http://svn.freebsd.org/changeset/base/239975 Log: MFC r238086: Fix style. Modified: stable/9/usr.bin/procstat/procstat_rlimit.c Directory Properties: stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_rlimit.c Sat Sep 1 08:45:58 2012 (r239974) +++ stable/9/usr.bin/procstat/procstat_rlimit.c Sat Sep 1 09:55:35 2012 (r239975) @@ -66,8 +66,8 @@ static struct { #error "Resource limits have grown. Add new entries to rlimit_param[]." #endif -static -const char *humanize_rlimit(int indx, rlim_t limit) +static const char * +humanize_rlimit(int indx, rlim_t limit) { static char buf[14]; int scale; From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 09:58:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E04341065670; Sat, 1 Sep 2012 09:58:09 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB24D8FC16; Sat, 1 Sep 2012 09:58:09 +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 q819w9SZ087148; Sat, 1 Sep 2012 09:58:09 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q819w9CO087145; Sat, 1 Sep 2012 09:58:09 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209010958.q819w9CO087145@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 09:58:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239976 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 09:58:10 -0000 Author: trociny Date: Sat Sep 1 09:58:09 2012 New Revision: 239976 URL: http://svn.freebsd.org/changeset/base/239976 Log: MFC r238084: Don't check for ifp != NULL before KASSERT, as ifp may not be NULL here (it is dereferenced below). Discussed with: jhb Modified: stable/9/sys/netinet/igmp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/igmp.c ============================================================================== --- stable/9/sys/netinet/igmp.c Sat Sep 1 09:55:35 2012 (r239975) +++ stable/9/sys/netinet/igmp.c Sat Sep 1 09:58:09 2012 (r239976) @@ -2284,13 +2284,11 @@ igmp_change_state(struct in_multi *inm) */ KASSERT(inm->inm_ifma != NULL, ("%s: no ifma", __func__)); ifp = inm->inm_ifma->ifma_ifp; - if (ifp != NULL) { - /* - * Sanity check that netinet's notion of ifp is the - * same as net's. - */ - KASSERT(inm->inm_ifp == ifp, ("%s: bad ifp", __func__)); - } + /* + * Sanity check that netinet's notion of ifp is the + * same as net's. + */ + KASSERT(inm->inm_ifp == ifp, ("%s: bad ifp", __func__)); IGMP_LOCK(); From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 10:18:09 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3BAF1065673; Sat, 1 Sep 2012 10:18:09 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9ED898FC0C; Sat, 1 Sep 2012 10:18:09 +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 q81AI92v092229; Sat, 1 Sep 2012 10:18:09 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81AI9Y5092227; Sat, 1 Sep 2012 10:18:09 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209011018.q81AI9Y5092227@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 10:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239978 - stable/9/sys/kern X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 10:18:09 -0000 Author: trociny Date: Sat Sep 1 10:18:09 2012 New Revision: 239978 URL: http://svn.freebsd.org/changeset/base/239978 Log: MFC r238085: Fix KASSERT message. Modified: stable/9/sys/kern/uipc_socket.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_socket.c ============================================================================== --- stable/9/sys/kern/uipc_socket.c Sat Sep 1 10:00:37 2012 (r239977) +++ stable/9/sys/kern/uipc_socket.c Sat Sep 1 10:18:09 2012 (r239978) @@ -635,7 +635,7 @@ sofree(struct socket *so) so->so_qstate & SQ_COMP, so->so_qstate & SQ_INCOMP)); if (so->so_options & SO_ACCEPTCONN) { KASSERT((TAILQ_EMPTY(&so->so_comp)), ("sofree: so_comp populated")); - KASSERT((TAILQ_EMPTY(&so->so_incomp)), ("sofree: so_comp populated")); + KASSERT((TAILQ_EMPTY(&so->so_incomp)), ("sofree: so_incomp populated")); } SOCK_UNLOCK(so); ACCEPT_UNLOCK(); From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 10:27:18 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5A8D106566B; Sat, 1 Sep 2012 10:27:18 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B77938FC18; Sat, 1 Sep 2012 10:27: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 q81ARIMR093390; Sat, 1 Sep 2012 10:27:18 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81ARIHQ093388; Sat, 1 Sep 2012 10:27:18 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209011027.q81ARIHQ093388@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 10:27:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239980 - stable/9/sys/net X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 10:27:19 -0000 Author: trociny Date: Sat Sep 1 10:27:18 2012 New Revision: 239980 URL: http://svn.freebsd.org/changeset/base/239980 Log: MFC r238309: In epair_clone_destroy(), when destroying the second half, we have to switch to its vnet before calling ether_ifdetach(). Otherwise if the second half resides in a different vnet, if_detach() silently fails leaving a stale pointer in V_ifnet list, and the system crashes trying to access this pointer later. Another solution could be not to allow to destroy epair unless both ends are in the home vnet. Discussed with: bz Tested by: delphij Modified: stable/9/sys/net/if_epair.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/if_epair.c ============================================================================== --- stable/9/sys/net/if_epair.c Sat Sep 1 10:21:56 2012 (r239979) +++ stable/9/sys/net/if_epair.c Sat Sep 1 10:27:18 2012 (r239980) @@ -904,39 +904,41 @@ epair_clone_destroy(struct if_clone *ifc if_link_state_change(oifp, LINK_STATE_DOWN); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; oifp->if_drv_flags &= ~IFF_DRV_RUNNING; + + /* + * Get rid of our second half. As the other of the two + * interfaces may reside in a different vnet, we need to + * switch before freeing them. + */ + CURVNET_SET_QUIET(oifp->if_vnet); ether_ifdetach(oifp); - ether_ifdetach(ifp); /* * Wait for all packets to be dispatched to if_input. - * The numbers can only go down as the interfaces are + * The numbers can only go down as the interface is * detached so there is no need to use atomics. */ - DPRINTF("sca refcnt=%u scb refcnt=%u\n", sca->refcount, scb->refcount); - EPAIR_REFCOUNT_ASSERT(sca->refcount == 1 && scb->refcount == 1, - ("%s: ifp=%p sca->refcount!=1: %d || ifp=%p scb->refcount!=1: %d", - __func__, ifp, sca->refcount, oifp, scb->refcount)); - - /* - * Get rid of our second half. - */ + DPRINTF("scb refcnt=%u\n", scb->refcount); + EPAIR_REFCOUNT_ASSERT(scb->refcount == 1, + ("%s: ifp=%p scb->refcount!=1: %d", __func__, oifp, scb->refcount)); oifp->if_softc = NULL; error = if_clone_destroyif(ifc, oifp); if (error) panic("%s: if_clone_destroyif() for our 2nd iface failed: %d", __func__, error); + if_free(oifp); + ifmedia_removeall(&scb->media); + free(scb, M_EPAIR); + CURVNET_RESTORE(); + ether_ifdetach(ifp); /* - * Finish cleaning up. Free them and release the unit. - * As the other of the two interfaces my reside in a different vnet, - * we need to switch before freeing them. + * Wait for all packets to be dispatched to if_input. */ - CURVNET_SET_QUIET(oifp->if_vnet); - if_free(oifp); - CURVNET_RESTORE(); + DPRINTF("sca refcnt=%u\n", sca->refcount); + EPAIR_REFCOUNT_ASSERT(sca->refcount == 1, + ("%s: ifp=%p sca->refcount!=1: %d", __func__, ifp, sca->refcount)); if_free(ifp); ifmedia_removeall(&sca->media); - ifmedia_removeall(&scb->media); - free(scb, M_EPAIR); free(sca, M_EPAIR); ifc_free_unit(ifc, unit); From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 10:32:40 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFCB3106566C; Sat, 1 Sep 2012 10:32:40 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAA858FC15; Sat, 1 Sep 2012 10:32:40 +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 q81AWefP094099; Sat, 1 Sep 2012 10:32:40 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81AWead094097; Sat, 1 Sep 2012 10:32:40 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209011032.q81AWead094097@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 10:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239982 - stable/9/sys/netinet X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 10:32:41 -0000 Author: trociny Date: Sat Sep 1 10:32:40 2012 New Revision: 239982 URL: http://svn.freebsd.org/changeset/base/239982 Log: MFC r239075: In tcp timers, check INP_DROPPED flag a little later, after callout_deactivate(), so if INP_DROPPED is set we return with the timer active flag cleared. For me this fixes negative keep timer values reported by `netstat -x' for connections in CLOSE state. Modified: stable/9/sys/netinet/tcp_timer.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_timer.c ============================================================================== --- stable/9/sys/netinet/tcp_timer.c Sat Sep 1 10:28:20 2012 (r239981) +++ stable/9/sys/netinet/tcp_timer.c Sat Sep 1 10:32:40 2012 (r239982) @@ -183,13 +183,18 @@ tcp_timer_delack(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack) - || !callout_active(&tp->t_timers->tt_delack)) { + if (callout_pending(&tp->t_timers->tt_delack) || + !callout_active(&tp->t_timers->tt_delack)) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_delack); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + CURVNET_RESTORE(); + return; + } tp->t_flags |= TF_ACKNOW; TCPSTAT_INC(tcps_delack); @@ -229,7 +234,7 @@ tcp_timer_2msl(void *xtp) } INP_WLOCK(inp); tcp_free_sackholes(tp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) || + if (callout_pending(&tp->t_timers->tt_2msl) || !callout_active(&tp->t_timers->tt_2msl)) { INP_WUNLOCK(tp->t_inpcb); INP_INFO_WUNLOCK(&V_tcbinfo); @@ -237,6 +242,12 @@ tcp_timer_2msl(void *xtp) return; } callout_deactivate(&tp->t_timers->tt_2msl); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * 2 MSL timeout in shutdown went off. If we're closed but * still waiting for peer to close and connection has been idle @@ -300,14 +311,20 @@ tcp_timer_keep(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep) - || !callout_active(&tp->t_timers->tt_keep)) { + if (callout_pending(&tp->t_timers->tt_keep) || + !callout_active(&tp->t_timers->tt_keep)) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_keep); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * Keep-alive timer went off; send something * or drop connection if idle for too long. @@ -397,14 +414,20 @@ tcp_timer_persist(void *xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist) - || !callout_active(&tp->t_timers->tt_persist)) { + if (callout_pending(&tp->t_timers->tt_persist) || + !callout_active(&tp->t_timers->tt_persist)) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_persist); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } /* * Persistance timer into zero window. * Force a byte to be output, if possible. @@ -469,14 +492,20 @@ tcp_timer_rexmt(void * xtp) return; } INP_WLOCK(inp); - if ((inp->inp_flags & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt) - || !callout_active(&tp->t_timers->tt_rexmt)) { + if (callout_pending(&tp->t_timers->tt_rexmt) || + !callout_active(&tp->t_timers->tt_rexmt)) { INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); CURVNET_RESTORE(); return; } callout_deactivate(&tp->t_timers->tt_rexmt); + if ((inp->inp_flags & INP_DROPPED) != 0) { + INP_WUNLOCK(inp); + INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); + return; + } tcp_free_sackholes(tp); /* * Retransmission timer went off. Message has not From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 10:37:42 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2B70106564A; Sat, 1 Sep 2012 10:37:41 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD9168FC12; Sat, 1 Sep 2012 10:37:41 +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 q81Abffh094776; Sat, 1 Sep 2012 10:37:41 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81Abfo8094774; Sat, 1 Sep 2012 10:37:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201209011037.q81Abfo8094774@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 1 Sep 2012 10:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239984 - stable/9/sys/netinet6 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 10:37:42 -0000 Author: trociny Date: Sat Sep 1 10:37:41 2012 New Revision: 239984 URL: http://svn.freebsd.org/changeset/base/239984 Log: MFC r239383: In ip6_ctloutput() guard inp_flags modifications with INP_WLOCK. Modified: stable/9/sys/netinet6/ip6_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_output.c ============================================================================== --- stable/9/sys/netinet6/ip6_output.c Sat Sep 1 10:33:53 2012 (r239983) +++ stable/9/sys/netinet6/ip6_output.c Sat Sep 1 10:37:41 2012 (r239984) @@ -1618,18 +1618,22 @@ ip6_ctloutput(struct socket *so, struct break; #define OPTSET(bit) \ do { \ + INP_WLOCK(in6p); \ if (optval) \ in6p->inp_flags |= (bit); \ else \ in6p->inp_flags &= ~(bit); \ + INP_WUNLOCK(in6p); \ } while (/*CONSTCOND*/ 0) #define OPTSET2292(bit) \ do { \ + INP_WLOCK(in6p); \ in6p->inp_flags |= IN6P_RFC2292; \ if (optval) \ in6p->inp_flags |= (bit); \ else \ in6p->inp_flags &= ~(bit); \ + INP_WUNLOCK(in6p); \ } while (/*CONSTCOND*/ 0) #define OPTBIT(bit) (in6p->inp_flags & (bit) ? 1 : 0) @@ -1883,6 +1887,7 @@ do { \ if (error) break; + INP_WLOCK(in6p); switch (optval) { case IPV6_PORTRANGE_DEFAULT: in6p->inp_flags &= ~(INP_LOWPORT); @@ -1903,6 +1908,7 @@ do { \ error = EINVAL; break; } + INP_WUNLOCK(in6p); break; #ifdef IPSEC From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 15:50:52 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 940DF106567B; Sat, 1 Sep 2012 15:50:52 +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 7B91C8FC23; Sat, 1 Sep 2012 15:50: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 q81FoqLn033381; Sat, 1 Sep 2012 15:50:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81FoqPD033379; Sat, 1 Sep 2012 15:50:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209011550.q81FoqPD033379@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 15:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239992 - stable/9/sys/i386/i386 X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 15:50:52 -0000 Author: kib Date: Sat Sep 1 15:50:52 2012 New Revision: 239992 URL: http://svn.freebsd.org/changeset/base/239992 Log: MFC r238675: Force clean FPU state in PCB user FPU save area for PT_I386_{GET,SET}XMMREGS. Modified: stable/9/sys/i386/i386/ptrace_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/ptrace_machdep.c ============================================================================== --- stable/9/sys/i386/i386/ptrace_machdep.c Sat Sep 1 14:45:15 2012 (r239991) +++ stable/9/sys/i386/i386/ptrace_machdep.c Sat Sep 1 15:50:52 2012 (r239992) @@ -54,10 +54,12 @@ cpu_ptrace(struct thread *td, int req, v fpstate = &td->td_pcb->pcb_user_save.sv_xmm; switch (req) { case PT_GETXMMREGS: + npxgetregs(td); error = copyout(fpstate, addr, sizeof(*fpstate)); break; case PT_SETXMMREGS: + npxgetregs(td); error = copyin(addr, fpstate, sizeof(*fpstate)); fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; break; From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 15:53:27 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C78D106566B; Sat, 1 Sep 2012 15:53:27 +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 468AF8FC0C; Sat, 1 Sep 2012 15:53:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q81FrRlg033710; Sat, 1 Sep 2012 15:53:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81FrRmO033708; Sat, 1 Sep 2012 15:53:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209011553.q81FrRmO033708@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 15:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239993 - stable/9/sys/i386/isa X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 15:53:27 -0000 Author: kib Date: Sat Sep 1 15:53:26 2012 New Revision: 239993 URL: http://svn.freebsd.org/changeset/base/239993 Log: MFC r238676: Add stmxcsr. MFC r238914: Change (unused) prototype for stmxcsr() to match reality. Modified: stable/9/sys/i386/isa/npx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/isa/npx.c ============================================================================== --- stable/9/sys/i386/isa/npx.c Sat Sep 1 15:50:52 2012 (r239992) +++ stable/9/sys/i386/isa/npx.c Sat Sep 1 15:53:26 2012 (r239993) @@ -99,6 +99,7 @@ __FBSDID("$FreeBSD$"); #ifdef CPU_ENABLE_SSE #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) #endif #else /* !(__GNUCLIKE_ASM && !lint) */ @@ -113,6 +114,7 @@ void frstor(caddr_t addr); #ifdef CPU_ENABLE_SSE void fxsave(caddr_t addr); void fxrstor(caddr_t addr); +void stmxcsr(u_int *csr); #endif #endif /* __GNUCLIKE_ASM && !lint */ From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 15:55:15 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45597106566B; Sat, 1 Sep 2012 15:55:15 +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 16A418FC0C; Sat, 1 Sep 2012 15:55:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q81FtEqU033985; Sat, 1 Sep 2012 15:55:14 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81FtEEA033983; Sat, 1 Sep 2012 15:55:14 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209011555.q81FtEEA033983@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 15:55:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239994 - stable/9/sys/i386/isa X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 15:55:15 -0000 Author: kib Date: Sat Sep 1 15:55:14 2012 New Revision: 239994 URL: http://svn.freebsd.org/changeset/base/239994 Log: MFC r238677: Stop clearing x87 exceptions in the #MF handler. Modified: stable/9/sys/i386/isa/npx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/isa/npx.c ============================================================================== --- stable/9/sys/i386/isa/npx.c Sat Sep 1 15:53:26 2012 (r239993) +++ stable/9/sys/i386/isa/npx.c Sat Sep 1 15:55:14 2012 (r239994) @@ -583,21 +583,21 @@ static char fpetable[128] = { }; /* - * Preserve the FP status word, clear FP exceptions, then generate a SIGFPE. + * Read the FP status and control words, then generate si_code value + * for SIGFPE. The error code chosen will be one of the + * FPE_... macros. It will be sent as the second argument to old + * BSD-style signal handlers and as "siginfo_t->si_code" (second + * argument) to SA_SIGINFO signal handlers. * - * Clearing exceptions is necessary mainly to avoid IRQ13 bugs. We now - * depend on longjmp() restoring a usable state. Restoring the state - * or examining it might fail if we didn't clear exceptions. + * Some time ago, we cleared the x87 exceptions with FNCLEX there. + * Clearing exceptions was necessary mainly to avoid IRQ13 bugs. The + * usermode code which understands the FPU hardware enough to enable + * the exceptions, can also handle clearing the exception state in the + * handler. The only consequence of not clearing the exception is the + * rethrow of the SIGFPE on return from the signal handler and + * reexecution of the corresponding instruction. * - * The error code chosen will be one of the FPE_... macros. It will be - * sent as the second argument to old BSD-style signal handlers and as - * "siginfo_t->si_code" (second argument) to SA_SIGINFO signal handlers. - * - * XXX the FP state is not preserved across signal handlers. So signal - * handlers cannot afford to do FP unless they preserve the state or - * longjmp() out. Both preserving the state and longjmp()ing may be - * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable - * solution for signals other than SIGFPE. + * For XMM traps, the exceptions were never cleared. */ int npxtrap() @@ -623,9 +623,6 @@ npxtrap() fnstcw(&control); fnstsw(&status); } - - if (PCPU_GET(fpcurthread) == curthread) - fnclex(); critical_exit(); return (fpetable[status & ((~control & 0x3f) | 0x40)]); } From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 15:57:12 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6308106566B; Sat, 1 Sep 2012 15:57:12 +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 B6D0F8FC15; Sat, 1 Sep 2012 15:57:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q81FvC0x034397; Sat, 1 Sep 2012 15:57:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81FvCSk034393; Sat, 1 Sep 2012 15:57:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209011557.q81FvCSk034393@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 15:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239995 - in stable/9/sys/i386: i386 include isa X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 15:57:13 -0000 Author: kib Date: Sat Sep 1 15:57:12 2012 New Revision: 239995 URL: http://svn.freebsd.org/changeset/base/239995 Log: MFC r238678: Provide siginfo.si_code for floating point errors when error occurs using the SSE math processor. Modified: stable/9/sys/i386/i386/trap.c stable/9/sys/i386/include/npx.h stable/9/sys/i386/isa/npx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/trap.c ============================================================================== --- stable/9/sys/i386/i386/trap.c Sat Sep 1 15:55:14 2012 (r239994) +++ stable/9/sys/i386/i386/trap.c Sat Sep 1 15:57:12 2012 (r239995) @@ -368,7 +368,7 @@ trap(struct trapframe *frame) case T_ARITHTRAP: /* arithmetic trap */ #ifdef DEV_NPX - ucode = npxtrap(); + ucode = npxtrap_x87(); if (ucode == -1) goto userout; #else @@ -531,7 +531,13 @@ trap(struct trapframe *frame) break; case T_XMMFLT: /* SIMD floating-point exception */ - ucode = 0; /* XXX */ +#if defined(DEV_NPX) && !defined(CPU_DISABLE_SSE) && defined(I686_CPU) + ucode = npxtrap_sse(); + if (ucode == -1) + goto userout; +#else + ucode = 0; +#endif i = SIGFPE; break; } Modified: stable/9/sys/i386/include/npx.h ============================================================================== --- stable/9/sys/i386/include/npx.h Sat Sep 1 15:55:14 2012 (r239994) +++ stable/9/sys/i386/include/npx.h Sat Sep 1 15:57:12 2012 (r239995) @@ -175,7 +175,8 @@ int npxgetregs(struct thread *td); void npxinit(void); void npxsave(union savefpu *addr); void npxsetregs(struct thread *td, union savefpu *addr); -int npxtrap(void); +int npxtrap_x87(void); +int npxtrap_sse(void); void npxuserinited(struct thread *); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); Modified: stable/9/sys/i386/isa/npx.c ============================================================================== --- stable/9/sys/i386/isa/npx.c Sat Sep 1 15:55:14 2012 (r239994) +++ stable/9/sys/i386/isa/npx.c Sat Sep 1 15:57:12 2012 (r239995) @@ -600,12 +600,13 @@ static char fpetable[128] = { * For XMM traps, the exceptions were never cleared. */ int -npxtrap() +npxtrap_x87(void) { u_short control, status; if (!hw_float) { - printf("npxtrap: fpcurthread = %p, curthread = %p, hw_float = %d\n", + printf( + "npxtrap_x87: fpcurthread = %p, curthread = %p, hw_float = %d\n", PCPU_GET(fpcurthread), curthread, hw_float); panic("npxtrap from nowhere"); } @@ -627,6 +628,28 @@ npxtrap() return (fpetable[status & ((~control & 0x3f) | 0x40)]); } +#ifdef CPU_ENABLE_SSE +int +npxtrap_sse(void) +{ + u_int mxcsr; + + if (!hw_float) { + printf( + "npxtrap_sse: fpcurthread = %p, curthread = %p, hw_float = %d\n", + PCPU_GET(fpcurthread), curthread, hw_float); + panic("npxtrap from nowhere"); + } + critical_enter(); + if (PCPU_GET(fpcurthread) != curthread) + mxcsr = curthread->td_pcb->pcb_save->sv_xmm.sv_env.en_mxcsr; + else + stmxcsr(&mxcsr); + critical_exit(); + return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]); +} +#endif + /* * Implement device not available (DNA) exception * From owner-svn-src-stable-9@FreeBSD.ORG Sat Sep 1 15:59:10 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B6DA9106566C; Sat, 1 Sep 2012 15:59:10 +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 A0A1A8FC08; Sat, 1 Sep 2012 15:59: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 q81FxAeh034666; Sat, 1 Sep 2012 15:59:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q81FxApd034658; Sat, 1 Sep 2012 15:59:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201209011559.q81FxApd034658@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 1 Sep 2012 15:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239996 - in stable/9/sys/i386: i386 include isa X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2012 15:59:10 -0000 Author: kib Date: Sat Sep 1 15:59:09 2012 New Revision: 239996 URL: http://svn.freebsd.org/changeset/base/239996 Log: MFC r238792: Introduce curpcb magic variable. Modified: stable/9/sys/i386/i386/machdep.c stable/9/sys/i386/i386/pmap.c stable/9/sys/i386/i386/trap.c stable/9/sys/i386/i386/vm86.c stable/9/sys/i386/i386/vm_machdep.c stable/9/sys/i386/include/pcpu.h stable/9/sys/i386/isa/npx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/i386/machdep.c Sat Sep 1 15:59:09 2012 (r239996) @@ -1570,7 +1570,7 @@ exec_setregs(struct thread *td, struct i pcb->pcb_dr3 = 0; pcb->pcb_dr6 = 0; pcb->pcb_dr7 = 0; - if (pcb == PCPU_GET(curpcb)) { + if (pcb == curpcb) { /* * Clear the debug registers on the running * CPU, otherwise they will end up affecting Modified: stable/9/sys/i386/i386/pmap.c ============================================================================== --- stable/9/sys/i386/i386/pmap.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/i386/pmap.c Sat Sep 1 15:59:09 2012 (r239996) @@ -1962,7 +1962,7 @@ pmap_lazyfix_action(void) (*ipi_lazypmap_counts[PCPU_GET(cpuid)])++; #endif if (rcr3() == lazyptd) - load_cr3(PCPU_GET(curpcb)->pcb_cr3); + load_cr3(curpcb->pcb_cr3); CPU_CLR_ATOMIC(PCPU_GET(cpuid), lazymask); atomic_store_rel_int(&lazywait, 1); } @@ -1972,7 +1972,7 @@ pmap_lazyfix_self(u_int cpuid) { if (rcr3() == lazyptd) - load_cr3(PCPU_GET(curpcb)->pcb_cr3); + load_cr3(curpcb->pcb_cr3); CPU_CLR_ATOMIC(cpuid, lazymask); } @@ -2039,7 +2039,7 @@ pmap_lazyfix(pmap_t pmap) cr3 = vtophys(pmap->pm_pdir); if (cr3 == rcr3()) { - load_cr3(PCPU_GET(curpcb)->pcb_cr3); + load_cr3(curpcb->pcb_cr3); CPU_CLR(PCPU_GET(cpuid), &pmap->pm_active); } } Modified: stable/9/sys/i386/i386/trap.c ============================================================================== --- stable/9/sys/i386/i386/trap.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/i386/trap.c Sat Sep 1 15:59:09 2012 (r239996) @@ -343,7 +343,7 @@ trap(struct trapframe *frame) if ((ISPL(frame->tf_cs) == SEL_UPL) || ((frame->tf_eflags & PSL_VM) && - !(PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL))) { + !(curpcb->pcb_flags & PCB_VM86CALL))) { /* user trap */ td->td_pticks = 0; @@ -592,7 +592,7 @@ trap(struct trapframe *frame) /* FALL THROUGH */ case T_SEGNPFLT: /* segment not present fault */ - if (PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL) + if (curpcb->pcb_flags & PCB_VM86CALL) break; /* @@ -605,7 +605,7 @@ trap(struct trapframe *frame) * a signal. */ if (frame->tf_eip == (int)cpu_switch_load_gs) { - PCPU_GET(curpcb)->pcb_gs = 0; + curpcb->pcb_gs = 0; #if 0 PROC_LOCK(p); kern_psignal(p, SIGBUS); @@ -643,9 +643,9 @@ trap(struct trapframe *frame) frame->tf_eip = (int)doreti_popl_fs_fault; goto out; } - if (PCPU_GET(curpcb)->pcb_onfault != NULL) { + if (curpcb->pcb_onfault != NULL) { frame->tf_eip = - (int)PCPU_GET(curpcb)->pcb_onfault; + (int)curpcb->pcb_onfault; goto out; } break; @@ -695,7 +695,7 @@ trap(struct trapframe *frame) * debugging the kernel. */ if (user_dbreg_trap() && - !(PCPU_GET(curpcb)->pcb_flags & PCB_VM86CALL)) { + !(curpcb->pcb_flags & PCB_VM86CALL)) { /* * Reset breakpoint bits because the * processor doesn't @@ -872,7 +872,7 @@ trap_pfault(frame, usermode, eva) map = &vm->vm_map; if (!usermode && (td->td_intr_nesting_level != 0 || - PCPU_GET(curpcb)->pcb_onfault == NULL)) { + curpcb->pcb_onfault == NULL)) { trap_fatal(frame, eva); return (-1); } @@ -930,8 +930,8 @@ trap_pfault(frame, usermode, eva) nogo: if (!usermode) { if (td->td_intr_nesting_level == 0 && - PCPU_GET(curpcb)->pcb_onfault != NULL) { - frame->tf_eip = (int)PCPU_GET(curpcb)->pcb_onfault; + curpcb->pcb_onfault != NULL) { + frame->tf_eip = (int)curpcb->pcb_onfault; return (0); } trap_fatal(frame, eva); Modified: stable/9/sys/i386/i386/vm86.c ============================================================================== --- stable/9/sys/i386/i386/vm86.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/i386/vm86.c Sat Sep 1 15:59:09 2012 (r239996) @@ -143,9 +143,9 @@ vm86_emulate(vmf) * the extension is not present. (This check should not be needed, * as we can't enter vm86 mode until we set up an extension area) */ - if (PCPU_GET(curpcb)->pcb_ext == 0) + if (curpcb->pcb_ext == 0) return (SIGBUS); - vm86 = &PCPU_GET(curpcb)->pcb_ext->ext_vm86; + vm86 = &curpcb->pcb_ext->ext_vm86; if (vmf->vmf_eflags & PSL_T) retcode = SIGTRAP; @@ -535,7 +535,7 @@ vm86_prepcall(struct vm86frame *vmf) vmf->kernel_fs = vmf->kernel_es = vmf->kernel_ds = 0; vmf->vmf_eflags = PSL_VIF | PSL_VM | PSL_USER; - vm86 = &PCPU_GET(curpcb)->pcb_ext->ext_vm86; + vm86 = &curpcb->pcb_ext->ext_vm86; if (!vm86->vm86_has_vme) vm86->vm86_eflags = vmf->vmf_eflags; /* save VIF, VIP */ } Modified: stable/9/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/9/sys/i386/i386/vm_machdep.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/i386/vm_machdep.c Sat Sep 1 15:59:09 2012 (r239996) @@ -106,6 +106,10 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif +CTASSERT((struct thread **)OFFSETOF_CURTHREAD == + &((struct pcpu *)NULL)->pc_curthread); +CTASSERT((struct pcb **)OFFSETOF_CURPCB == &((struct pcpu *)NULL)->pc_curpcb); + static void cpu_reset_real(void); #ifdef SMP static void cpu_reset_proxy(void); Modified: stable/9/sys/i386/include/pcpu.h ============================================================================== --- stable/9/sys/i386/include/pcpu.h Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/include/pcpu.h Sat Sep 1 15:59:09 2012 (r239996) @@ -236,16 +236,36 @@ extern struct pcpu *pcpup; #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) +#define OFFSETOF_CURTHREAD 0 +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnull-dereference" +#endif static __inline __pure2 struct thread * __curthread(void) { struct thread *td; - __asm("movl %%fs:0,%0" : "=r" (td)); + __asm("movl %%fs:%1,%0" : "=r" (td) + : "m" (*(char *)OFFSETOF_CURTHREAD)); return (td); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #define curthread (__curthread()) +#define OFFSETOF_CURPCB 16 +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movl %%fs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); + return (pcb); +} +#define curpcb (__curpcb()) + #else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ #error "this file needs to be ported to your compiler" Modified: stable/9/sys/i386/isa/npx.c ============================================================================== --- stable/9/sys/i386/isa/npx.c Sat Sep 1 15:57:12 2012 (r239995) +++ stable/9/sys/i386/isa/npx.c Sat Sep 1 15:59:09 2012 (r239996) @@ -378,7 +378,7 @@ npxexit(td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) - npxsave(PCPU_GET(curpcb)->pcb_save); + npxsave(curpcb->pcb_save); critical_exit(); #ifdef NPX_DEBUG if (hw_float) { @@ -663,7 +663,6 @@ static int err_count = 0; int npxdna(void) { - struct pcb *pcb; if (!hw_float) return (0); @@ -687,25 +686,24 @@ npxdna(void) * Record new context early in case frstor causes an IRQ13. */ PCPU_SET(fpcurthread, curthread); - pcb = PCPU_GET(curpcb); #ifdef CPU_ENABLE_SSE if (cpu_fxsr) fpu_clean_state(); #endif - if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) { + if ((curpcb->pcb_flags & PCB_NPXINITDONE) == 0) { /* * This is the first time this thread has used the FPU or * the PCB doesn't contain a clean FPU state. Explicitly * load an initial state. */ fpurstor(&npx_initialstate); - if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__) - fldcw(pcb->pcb_initial_npxcw); - pcb->pcb_flags |= PCB_NPXINITDONE; - if (PCB_USER_FPU(pcb)) - pcb->pcb_flags |= PCB_NPXUSERINITDONE; + if (curpcb->pcb_initial_npxcw != __INITIAL_NPXCW__) + fldcw(curpcb->pcb_initial_npxcw); + curpcb->pcb_flags |= PCB_NPXINITDONE; + if (PCB_USER_FPU(curpcb)) + curpcb->pcb_flags |= PCB_NPXUSERINITDONE; } else { /* * The following fpurstor() may cause an IRQ13 when the @@ -721,7 +719,7 @@ npxdna(void) * fnclex if it is the first FPU instruction after a context * switch. */ - fpurstor(pcb->pcb_save); + fpurstor(curpcb->pcb_save); } critical_exit(); @@ -1099,13 +1097,14 @@ fpu_kern_thread(u_int flags) { struct pcb *pcb; - pcb = PCPU_GET(curpcb); + pcb = curpcb; KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); - KASSERT(pcb->pcb_save == &pcb->pcb_user_save, ("mangled pcb_save")); - KASSERT(PCB_USER_FPU(pcb), ("recursive call")); + KASSERT(curpcb->pcb_save == &curpcb->pcb_user_save, + ("mangled pcb_save")); + KASSERT(PCB_USER_FPU(curpcb), ("recursive call")); - pcb->pcb_flags |= PCB_KERNNPX; + curpcb->pcb_flags |= PCB_KERNNPX; return (0); } @@ -1115,5 +1114,5 @@ is_fpu_kern_thread(u_int flags) if ((curthread->td_pflags & TDP_KTHREAD) == 0) return (0); - return ((PCPU_GET(curpcb)->pcb_flags & PCB_KERNNPX) != 0); + return ((curpcb->pcb_flags & PCB_KERNNPX) != 0); }